Movable Type Enterprise Documentation

« Movable Type 3.3 docs index | Up | Movable Type Date Formats »

Chapter B: Global Filters

Global tag attribute filters

The following is a list of global filters that can be applied to any tag.

  • decode_html

    With a value of "1" decodes all HTML entities in the tag value.

  • decode_xml

    With a value of "1" decodes all XML entities in the tag value.

  • dirify

    With a value of "1" encodes the tag value into a string suitable for usage in a file or directory name. "Dirification" is a multi-step process. First the value is converted to lower case. Any HTML tags and entities are stripped. Characters that are not alphanumeric, the underscore (_) or whitespace characters (i.e. space, tab) are stripped. Finally whitespace characters are converted to an underscore characters.

    dirify also converts certain high-ASCII characters (accented characters, etc) to their low-ASCII characters, meaning that something like crudité will be converted to crudite.

    The above paragraph needs more clarification. Exact which characters and what are they coverted to?

    For example, if the value of the tag without this attribute were Foo "Baz" is<br> Bar!, the dirified version would be foo_baz_is_bar.

  • encode_html

    With a value of "1" HTML-encodes the tag value.

  • encode_js

    With a value of "1" encodes the tag value into a format suitable for usage in a Javascript string value.

  • encode_php

    Encodes the tag value into a format suitable for usage in one of three PHP string values: single-quote, double-quote, or here document. The value of this tag attribute should be either q (single-quote), qq (double-quote), or heredoc (here document).

  • encode_url

    Encodes the tag value into a format suitable for usage in a URL. This means encoding non-alphanumeric characters into their hex equivalents.

  • encode_xml

    With a value of "1" encodes into entities any characters that XML requires to be encoded. These are: &, ", <, and >.

    The difference between this and encode_html is that the latter encodes a much wider set of special characters into HTML entities if you have the HTML::Entities module installed and you have not turned on the NoHTMLEntities option in mt-config.cgi.

  • filters

    Lists a set of Text Formatting filters that will be applied to the tag value. The filter names should be the key names that uniquely identify the filters, not the labels shown in the Text Formatting options pulldown menu. Multiple text formatting keys should be separated with commas (,). Multiple filters will be executed in the order in which they are listed.

  • lower_case

    Transforms the text into lower case characters.

  • ltrim

    Removes leading whitespace from the string.

  • remove_html

    With a value of "1" strips all markup tags (such as HTML or XML) from the tag value.

  • rtrim

    Removes trailing whitespace from the string.

  • sanitize

    Runs a sanitize filter over the text. If the value of the attribute is 1, the default sanitize spec for the weblog is used. If the value is 0, the value will not be sanitized. All other values will be interpreted as a sanitize specification. See the article on GlobalSanitizeSpec for much more information on this function.

  • space_pad

    Pads the tag value with spaces so that the total length is Ncharacters. N is specified as the value of the attribute.

  • spam_protect

    Obscures an email address by entity-encoding the key characters, such as the at symbol (@), so it is more difficult to automated agents to recognize. This filter isn't truly global, but can be used with any variable tag that outputs an email address.

  • sprintf

    A general purpose formatter based on the sprintf command found in a number of programming languages. The value of the attribute should be the format string. The tag value will be passed in as the argument to sprintf.

  • strip_linefeeds

    Removes carriage return and line feed characters from the text.

  • trim

    Removes leading and trailing whitespace from the string.

  • trim_to

    Trims the string to the first Ncharacters. N is specified as the value of the attribute.

  • upper_case

    Transforms the text into upper case characters.

  • zero_pad

    Pads the tag value with zeros so that the total length is N characters. N is specified as the value of the attribute.

Submit Feedback on This Article

Your comments on how we can improve this article are appreciated; but please do not use the feedback form to submit support requests or question. We will not respond to or publish such queries submitted through this form. If you have a technical question or problem, visit Movable Type Enterprise Support.

Six Apart
Makers of weblog software and services for individuals, organizations and businesses.
This website is powered by Movable Type.