Static Public Member Functions | |
| static | get_named_stack ($stack_name) |
| static | has ($stack_name, $value_name) |
| static | get_item ($stack_name, $value_name, $default_value=null) |
| static | create_stack ($stack_name) |
| static | add ($stack_name, $value, $value_name=null, $after=null) |
| static | remove ($stack_name, $value_name=null) |
| static | get_sorted_stack ($stack_name) |
| static | sort_stack_cmp ($a, $b) |
| static | get ($stack_name, $format=null) |
| static | out ($stack_name, $format=null) |
| static | scripts ($element) |
| static | styles ($element, $typename) |
This class allows Habari to accumulate a group of unique values that can be output using a specific formatting string. This is useful for collecting a set of unique javascript references to output and then insert them at a specific point on the page.
// Add jquery to the javascript stack: Stack::add( 'template_header_javascript', Site::get_url('scripts') . '/jquery.js', 'jquery' );
// Add stylesheet to theme_stylesheet stack with media type Stack::add( 'template_stylesheet', array( Site::get_url('theme') . '/style.css', 'screen' ), 'style' );
// Output the javascript stack: Stack::out( 'template_header_javascript', '<script src="%s" type="text/javascript"></script>' );
// Output the theme_stylesheet stack: Stack::out( 'template_stylesheet', '<link rel="stylesheet" type="text/css" href="%s" media="%s">' );
Definition at line 30 of file stack.php.
| static Stack::add | ( | $ | stack_name, | |
| $ | value, | |||
| $ | value_name = null, |
|||
| $ | after = null | |||
| ) | [static] |
Add a value to a stack
| string | $stack_name The name of the stack | |
| mixed | $value The value to add | |
| string | $value_name The name of the value to add | |
| string | $after The name of the stack element to insert this new element after |
Definition at line 134 of file stack.php.
Referenced by Theme::act_display(), ViddlerSilo::action_init(), Theme::add_script(), Theme::add_style(), K2::add_template_vars(), AdminGroupsHandler::get_group(), AdminHandler::setup_admin_theme(), AdminHandler::setup_stacks(), and Theme::theme_header().
| static Stack::create_stack | ( | $ | stack_name | ) | [static] |
Creates and retreives a named stack instance
| string | $stack_name The name of the stack to create and return |
Definition at line 116 of file stack.php.
Referenced by get_named_stack().
| static Stack::get | ( | $ | stack_name, | |
| $ | format = null | |||
| ) | [static] |
Returns all of the values of the stack
| string | $stack_name The name of the stack to output | |
| mixed | $format A printf-style formatting string or callback used to output each stack element |
Definition at line 216 of file stack.php.
Referenced by out(), Theme::theme_footer(), and Theme::theme_header().
| static Stack::get_item | ( | $ | stack_name, | |
| $ | value_name, | |||
| $ | default_value = null | |||
| ) | [static] |
Get a single item from a given stack.
| string | $stack_name The name of the stack to fetch an item from. | |
| string | $value The item to fetch. | |
| mixed | $default_value The default value to return if the item does not exist in the stack. |
| static Stack::get_named_stack | ( | $ | stack_name | ) | [static] |
Retreive a named stack instance
| string | $stack_name The name of the stack to return |
Definition at line 56 of file stack.php.
Referenced by add(), get_item(), has(), remove(), and Theme::theme_body_class().
| static Stack::has | ( | $ | stack_name, | |
| $ | value_name | |||
| ) | [static] |
| static Stack::out | ( | $ | stack_name, | |
| $ | format = null | |||
| ) | [static] |
| static Stack::remove | ( | $ | stack_name, | |
| $ | value_name = null | |||
| ) | [static] |
| static Stack::scripts | ( | $ | element | ) | [static] |
A callback for Stack::get() that outputs scripts as reference or inline depending on their content
| string | $element The script element in the stack |
| static Stack::styles | ( | $ | element, | |
| $ | typename | |||
| ) | [static] |
A callback for Stack::get() that outputs styles as link or inline style tags depending on their content
| string | $element The style element in the stack | |
| string | $typename The media disposition of the content |
1.7.1