Static Public Member Functions | |
| static | apply ($format, $onwhat) |
| static | apply_with_hook_serialize ($arg) |
| static | apply_with_hook_unserialize ($arg) |
| static | apply_with_hook_params ($format, $onwhat) |
| static | by_index ($index) |
| static | load_all () |
| static | autop ($value) |
| static | and_list ($array, $between= ', ', $between_last=null) |
| static | tag_and_list ($terms, $between= ', ', $between_last=null, $sort_alphabetical=false) |
| static | format_date ($date, $format) |
| static | nice_date ($date, $dateformat= 'F j, Y') |
| static | nice_time ($date, $dateformat= 'H:i:s') |
| static | summarize ($text, $count=100, $max_paragraphs=1) |
| static | more ($content, $post, $properties=array()) |
| static | html_messages ($notices, $errors) |
| static | humane_messages ($notices, $errors) |
| static | json_messages ($notices, $errors) |
| static | term_tree ($terms, $tree_name, $config=array()) |
Provides formatting functions for use in themes. Extendable.
Definition at line 13 of file format.php.
| static Format::and_list | ( | $ | array, | |
| $ | between = ', |
|||
| ' | , | |||
| $ | between_last = null | |||
| ) | [static] |
function and_list Turns an array of strings into a friendly delimited string separated by commas and an "and"
| array | $array An array of strings | |
| string | $between Text to put between each element | |
| string | $between_last Text to put between the next-to-last element and the last element string The constructed string |
Definition at line 240 of file format.php.
Referenced by HabariDateTime::friendly(), and FormValidators::validate_url().
| static Format::apply | ( | $ | format, | |
| $ | onwhat | |||
| ) | [static] |
Called to register a format function to a plugin hook, only passing the hook's first parameter to the Format function.
| string | $format A function name that exists in a Format class | |
| string | $onwhat A plugin hook to apply that Format function to as a filter |
Definition at line 22 of file format.php.
Referenced by K2::action_init_theme(), and Charcoal::action_init_theme().
| static Format::apply_with_hook_params | ( | $ | format, | |
| $ | onwhat | |||
| ) | [static] |
Called to register a format function to a plugin hook, and passes all of the hook's parameters to the Format function.
| string | $format A function name that exists in a Format class | |
| string | $onwhat A plugin hook to apply that Format function to as a filter |
Definition at line 67 of file format.php.
Referenced by Charcoal::action_init_theme().
| static Format::autop | ( | $ | value | ) | [static] |
DEFAULT FORMAT FUNCTIONS function autop Converts non-HTML paragraphs separated with 2 or more new lines into HTML paragraphs while preserving any internal HTML. New lines within the text of block elements are converted to linebreaks. New lines before and after tags are stripped.
If you make changes to this, PLEASE add test cases here: http://svn.habariproject.org/habari/trunk/tests/data/autop/
| string | $value The string to apply the formatting |
Definition at line 139 of file format.php.
| static Format::by_index | ( | $ | index | ) | [static] |
function by_index Returns an indexed formatter object, for use by lambda functions created to supply additional parameters to plugin filters.
| integer | $index The index of the formatter object to return. |
Definition at line 102 of file format.php.
| static Format::format_date | ( | $ | date, | |
| $ | format | |||
| ) | [static] |
Format a date using a specially formatted string Useful for using a single string to format multiple date components. Example: If $dt is a HabariDateTime for December 10, 2008... echo $dt->format_date('
'); // Output:
| HabariDateTime | $date The date to format | |
| string | $format A string with date()-like letters within braces to replace with date components |
Definition at line 306 of file format.php.
| static Format::html_messages | ( | $ | notices, | |
| $ | errors | |||
| ) | [static] |
html_messages Creates an HTML unordered list of an array of messages
| array | $notices a list of success messages | |
| array | $errors a list of error messages |
Definition at line 518 of file format.php.
Referenced by Session::messages_get().
| static Format::humane_messages | ( | $ | notices, | |
| $ | errors | |||
| ) | [static] |
humane_messages Creates JS calls to display session messages
| array | $notices a list of success messages | |
| array | $errors a list of error messages |
Definition at line 546 of file format.php.
| static Format::json_messages | ( | $ | notices, | |
| $ | errors | |||
| ) | [static] |
json_messages Creates a JSON list of session messages
| array | $notices a list of success messages | |
| array | $errors a list of error messages |
Definition at line 572 of file format.php.
| static Format::load_all | ( | ) | [static] |
function load_all Loads and stores an instance of all declared Format classes for future use
Definition at line 111 of file format.php.
Referenced by apply(), and apply_with_hook_params().
| static Format::more | ( | $ | content, | |
| $ | post, | |||
| $ | properties = array() | |||
| ) | [static] |
Returns a truncated version of post content when the post isn't being displayed on its own. Posts are split either at the comment or at the specified maximums. Use only after applying autop or other paragrpah styling methods. Apply to posts using: Format::apply_with_hook_params( 'more', 'post_content_out' );
| string | $content The post content | |
| Post | $post The Post object of the post | |
| string | $more_text The text to use in the "read more" link. | |
| integer | $max_words null or the maximum number of words to use before showing the more link | |
| integer | $max_paragraphs null or the maximum number of paragraphs to use before showing the more link |
Definition at line 436 of file format.php.
| static Format::nice_date | ( | $ | date, | |
| $ | dateformat = 'F j, |
|||
| Y' | ||||
| ) | [static] |
function nice_date Formats a date using a date format string
| HabariDateTime | A date as a HabariDateTime object | |
| string | A date format string |
Definition at line 327 of file format.php.
| static Format::nice_time | ( | $ | date, | |
| $ | dateformat = 'H:i:s' | |||
| ) | [static] |
function nice_time Formats a time using a date format string
| HabariDateTime | A date as a HabariDateTime object | |
| string | A date format string |
Definition at line 342 of file format.php.
| static Format::summarize | ( | $ | text, | |
| $ | count = 100, |
|||
| $ | max_paragraphs = 1 | |||
| ) | [static] |
Returns a shortened version of whatever is passed in.
| string | $value A string to shorten | |
| integer | $count Maximum words to display [100] | |
| integer | $max_paragraphs Maximum paragraphs to display [1] |
Definition at line 357 of file format.php.
Referenced by more().
| static Format::tag_and_list | ( | $ | terms, | |
| $ | between = ', |
|||
| ' | , | |||
| $ | between_last = null, |
|||
| $ | sort_alphabetical = false | |||
| ) | [static] |
function tag_and_list Formatting function (should be in Format class?) Turns an array of tag names into an HTML-linked list with commas and an "and".
| array | $array An array of tag names | |
| string | $between Text to put between each element | |
| string | $between_last Text to put between the next to last element and the last element | |
| boolean | $sort_alphabetical Should the tags be sorted alphabetically by `term` first? |
Definition at line 266 of file format.php.
Referenced by Mzingi::add_template_vars(), and Charcoal::add_template_vars().
| static Format::term_tree | ( | $ | terms, | |
| $ | tree_name, | |||
| $ | config = array() | |||
| ) | [static] |
function term_tree Create nested HTML lists from a hierarchical vocabulary.
Turns Terms or an array of terms from a hierarchical vocabulary into a ordered HTML list with list items for each term.
| mixed | $terms An array of Term objects or a Terms object. | |
| string | $tree_name The name of the tree, used for unique node id's | |
| array | $config an array of values to use to configure the output of this function |
Definition at line 588 of file format.php.
1.7.1