Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions

Theme Class Reference

Inheritance diagram for Theme:
Collaboration diagram for Theme:

List of all members.

Public Member Functions

 __construct ($themedata)
 info ()
 add_template_vars ()
 display_fallback ($template_list, $display_function= 'display')
 template_exists ($template_name)
 act_display ($paramarray=array( 'user_filters'=> array()))
 act_display_home ($user_filters=array())
 act_display_entries ($user_filters=array())
 act_display_post ($user_filters=array())
 act_display_tag ($user_filters=array())
 act_display_date ($user_filters=array())
 act_search ($user_filters=array())
 act_display_404 ($user_filters=array())
 display ($template_name)
 fetch ($template_name, $unstack=false)
 fetch_unassigned ($template_name)
 assign ($key, $value)
 theme_header ($theme)
 theme_footer ($theme)
 theme_content ($theme, $object, $context=null)
 theme_has_context ($theme, $context)
 theme_feed_alternate ($theme)
 theme_comment_form_action ($theme, $post)
 theme_prev_page_link ($theme, $text=null)
 theme_next_page_link ($theme, $text=null)
 theme_comments_link ($theme, $post, $zero= '', $one= '', $many= '', $fragment= 'comments')
 theme_comments_count ($theme, $post, $zero= '', $one= '', $many= '')
 theme_query_count ()
 theme_query_time ()
 theme_comment_author_link ($theme, $comment)
 __isset ($key)
 __set ($key, $value)
 __get ($key)
 __unset ($key)
 start_buffer ()
 end_buffer ()
 __call ($function, $params)
 get_blocks ($area, $scope, $theme)
 check_scope_criteria ($criteria)
 get_scopes ($area)
 sort_scopes ($scope1, $scope2)
 theme_area ($theme, $area, $context=null, $scope=null)
 theme_body_class ($theme, $args=array())
 add_script ($where= 'header', $value, $name=null, $requires=null)
 add_style ($where= 'header', $value, $name=null, $requires=null)
 get_version ()

Static Public Member Functions

static theme_page_selector ($theme, $rr_name=null, $settings=array())

Public Attributes

 $name = null
 $version = null
 $template_engine = null
 $theme_dir = null
 $config_vars = array()
 $context = array()
 $valid_filters

Protected Member Functions

 play_var_stack ()

Detailed Description

Habari Theme Class

The Theme class is the behind-the-scenes representation of of a set of UI files that compose the visual theme of the blog

Definition at line 14 of file theme.php.


Constructor & Destructor Documentation

Theme::__construct ( themedata  ) 

Constructor for theme

If no parameter is supplied, then the constructor Loads the active theme from the database.

If no theme option is set, a fatal error is thrown

Parameters:
name ( optional ) override the default theme lookup
template_engine ( optional ) specify a template engine
theme_dir ( optional ) specify a theme directory

Definition at line 71 of file theme.php.


Member Function Documentation

Theme::__call ( function,
params 
)

Handle methods called on this class or its descendants that are not defined by this class. Allow plugins to provide additional theme actions, like a custom act_display_*()

Parameters:
string $function The method that was called.
array $params An array of parameters passed to the method

Definition at line 1027 of file theme.php.

Theme::__get ( key  ) 

Get a template variable value

Parameters:
string $key The template variable name to get
Returns:
mixed The value of the variable

Definition at line 984 of file theme.php.

Theme::__isset ( key  ) 

Detects if a variable is assigned to the template engine for use in constructing the template's output.

Parameters:
key name of variable
Returns:
boolean true if name is set, false if not set

Definition at line 962 of file theme.php.

Theme::__set ( key,
value 
)

Set a template variable, a property alias for assign()

Parameters:
string $key The template variable to set
mixed $value The value of the variable

Definition at line 973 of file theme.php.

Theme::__unset ( key  ) 

Remove a template variable value

Parameters:
string $key The template variable name to unset

Definition at line 997 of file theme.php.

Theme::act_display ( paramarray = array( 'user_filters'=> array() )  ) 

Grabs post data and inserts that data into the internal handler_vars array, which eventually gets extracted into the theme's ( and thereby the template_engine's ) local symbol table for use in the theme's templates

This is the default, generic function to grab posts. To "filter" the posts retrieved, simply pass any filters to the handler_vars variables associated with the post retrieval. For instance, to filter by tag, ensure that handler_vars['tag'] contains the tag to filter by. Simple as that.

Definition at line 168 of file theme.php.

Theme::act_display_404 ( user_filters = array()  ) 

Helper function: Display a 404 template

Parameters:
array $user_filters Additional arguments user to get the page content

Definition at line 500 of file theme.php.

Theme::act_display_date ( user_filters = array()  ) 

Helper function: Display the posts for a specific date

Parameters:
array $user_filters Additional arguments used to get the page content

Definition at line 413 of file theme.php.

Theme::act_display_entries ( user_filters = array()  ) 

Helper function: Displays multiple entries

Parameters:
array $user_filters Additional arguments used to get the page content

Definition at line 333 of file theme.php.

Theme::act_display_home ( user_filters = array()  ) 

Helper function: Displays the home page

Parameters:
array $user_filters Additional arguments used to get the page content

Reimplemented in Mzingi.

Definition at line 312 of file theme.php.

Theme::act_display_post ( user_filters = array()  ) 

Helper function: Display a post

Parameters:
array $user_filters Additional arguments used to get the page content

Definition at line 354 of file theme.php.

Theme::act_display_tag ( user_filters = array()  ) 

Helper function: Display the posts for a tag

Parameters:
array $user_filters Additional arguments used to get the page content

Definition at line 385 of file theme.php.

Theme::act_search ( user_filters = array()  ) 

Helper function: Display the posts for a specific criteria

Parameters:
array $user_filters Additional arguments used to get the page content

Definition at line 482 of file theme.php.

Theme::add_script ( where = 'header',
value,
name = null,
requires = null 
)

Add javascript to the stack to be output in the theme.

Parameters:
string $where Where should it be output? Options are header and footer.
string $value Either a URL or raw JS to be output inline.
string $name A name to reference this script by. Used for removing or using in $requires by other scripts.
string|array $requires Either a string or an array of strings of $name's for scripts this script requires.
Returns:
boolean True if added successfully, false otherwise.

Definition at line 1302 of file theme.php.

Theme::add_style ( where = 'header',
value,
name = null,
requires = null 
)

Add a stylesheet to the stack to be output in the theme.

Parameters:
string $where Where should it be output? Options are header and footer.
string $value Either a URL or raw CSS to be output inline.
string $name A name to reference this script by. Used for removing or using in $after by other scripts.
string|array $requires Either a string or an array of strings of $name's for scripts this script requires.
Returns:
boolean True if added successfully, false otherwise.

Definition at line 1332 of file theme.php.

Theme::add_template_vars (  ) 

Assign the default variables that would be used in every template

Reimplemented in InstallerTheme, Charcoal, K2, and Mzingi.

Definition at line 109 of file theme.php.

Theme::assign ( key,
value 
)

Helper function: Avoids having to call $theme->template_engine->key= 'value';

Definition at line 575 of file theme.php.

Referenced by act_display(), Mzingi::add_template_vars(), Charcoal::add_template_vars(), add_template_vars(), and display_fallback().

Theme::check_scope_criteria ( criteria  ) 

Matches the scope criteria against the current request

Parameters:
array $criteria An array of scope criteria data in RPN, where values are arrays and operators are strings
Returns:
boolean True if the criteria matches the current request

Definition at line 1085 of file theme.php.

Theme::display ( template_name  ) 

Helper function: Avoids having to call $theme->template_engine->display( 'template_name' );

Parameters:
string $template_name The name of the template to display

Definition at line 515 of file theme.php.

Theme::display_fallback ( template_list,
display_function = 'display' 
)

Find the first template that matches from the list provided and display it

Parameters:
array $template_list The list of templates to search for

Definition at line 133 of file theme.php.

Theme::end_buffer (  ) 

End the current template variable buffer

Definition at line 1014 of file theme.php.

Theme::fetch ( template_name,
unstack = false 
)

Helper function: Avoids having to call $theme->template_engine->fetch( 'template_name' );

Parameters:
string $template_name The name of the template to display
boolean $unstack If true, end the current template variable buffer upon returning
Returns:
string The content of the template

Definition at line 532 of file theme.php.

Theme::fetch_unassigned ( template_name  ) 

Calls the template engine's fetch() method without pre-assigning template variables. Assumes that the template variables have already been set.

Parameters:
string $template_name The name of the template to display
Returns:
string The content of the template

Definition at line 567 of file theme.php.

Theme::get_blocks ( area,
scope,
theme 
)

Retrieve the block objects for the current scope and specified area Incomplete!

Parameters:
string $area The area to which blocks will be output
string $scope The scope to which blocks will be output
Theme $theme The theme that is outputting these blocks
Returns:
array An array of Block instances to render
Todo:
Finish this function to pull data from a block_instances table

Definition at line 1072 of file theme.php.

Referenced by K2::action_theme_activated(), and Charcoal::action_theme_activated().

Theme::get_scopes ( area  ) 

Retrieve current scope data from the database based on the requested area

Parameters:
string $area The area for which a scope may be applied
Returns:
array An array of scope data

Definition at line 1140 of file theme.php.

Theme::get_version (  ) 

Provide a method to return the version number from the theme xml

Returns:
string The theme version from XML

Reimplemented from Pluggable.

Definition at line 1357 of file theme.php.

Theme::info (  ) 

Loads a theme's metadata from an XML file in theme's directory.

Definition at line 88 of file theme.php.

Theme::play_var_stack (  )  [protected]

Play back the full stack of template variables to assign them into the template

Definition at line 550 of file theme.php.

Theme::sort_scopes ( scope1,
scope2 
)

Sort function for ordering scope object rows by priority

Parameters:
StdObject $scope1 A scope to compare
StdObject $scope2 A scope to compare
Returns:
integer A sort return value, -1 to 1

Definition at line 1158 of file theme.php.

Theme::start_buffer (  ) 

Start a new template variable buffer

Definition at line 1005 of file theme.php.

Theme::template_exists ( template_name  ) 

Determine if a template exists in the current theme

Parameters:
string $template_name The name of the template to detect
Returns:
boolean True if template exists

Definition at line 151 of file theme.php.

Referenced by act_display(), and display_fallback().

Theme::theme_area ( theme,
area,
context = null,
scope = null 
)

Displays blocks associated to the specified area and current scope.

Parameters:
Theme $theme The theme with which this area will be output
string $area The area to which blocks will be output
string $context The area of context within the theme that could adjust the template used
string $scope Used to force a specific scope
Returns:
string the output of all the blocks

Definition at line 1175 of file theme.php.

Theme::theme_body_class ( theme,
args = array() 
)

A theme function for outputting CSS classes based on the requested content

Parameters:
Theme $theme A Theme object instance
mixed $args Additional classes that should be added to the ones generated
Returns:
string The resultant classes

Definition at line 1279 of file theme.php.

Theme::theme_comment_author_link ( theme,
comment 
)

Returns a humane commenter's link for a comment if a URL is supplied, or just display the comment author's name

Parameters:
Theme $theme The current theme
Comment $comment The comment object
Returns:
string A link to the comment author or the comment author's name with no link

Definition at line 935 of file theme.php.

Theme::theme_comment_form_action ( theme,
post 
)

Returns the feedback URL to which comments should be submitted for the indicated Post

Parameters:
Theme $theme The current theme
Post $post The post object to get the feedback URL for
Returns:
string The URL to the feedback entrypoint for this comment

Definition at line 715 of file theme.php.

Theme::theme_comments_count ( theme,
post,
zero = '',
one = '',
many = '' 
)

Returns a full qualified URL of the specified post based on the comments count.

Passed strings are localized prior to parsing therefore to localize "%d Comments" in french, it would be "%d Commentaires".

Since we use sprintf() in the final concatenation, you must format passed strings accordingly.

Parameters:
Theme $theme The current theme object
Post $post Post object used to build the comments link
string $zero String to return when there are no comments
string $one String to return when there is one comment
string $many String to return when there are more than one comment
Returns:
string String to display for comment count

Definition at line 884 of file theme.php.

Theme::theme_comments_link ( theme,
post,
zero = '',
one = '',
many = '',
fragment = 'comments' 
)

Returns a full qualified URL of the specified post based on the comments count, and links to the post.

Passed strings are localized prior to parsing therefore to localize "%d Comments" in french, it would be "%d Commentaires".

Since we use sprintf() in the final concatenation, you must format passed strings accordingly.

Parameters:
Theme $theme The current theme object
Post $post Post object used to build the comments link
string $zero String to return when there are no comments
string $one String to return when there is one comment
string $many String to return when there are more than one comment
string $fragment Fragment (bookmark) portion of the URL to append to the link
string $title Fragment (bookmark) portion of the URL to append to the link
Returns:
string Linked string to display for comment count
See also:
Theme::theme_comments_count()

Definition at line 864 of file theme.php.

Theme::theme_content ( theme,
object,
context = null 
)

Display an object using a template designed for the type of object it is The $object is assigned into the theme using the $content template variable

Parameters:
Theme $theme The theme used to display the object
object $object An object to display
string $context The context in which the object will be displayed
Returns:

Definition at line 624 of file theme.php.

Theme::theme_feed_alternate ( theme  ) 

Returns the appropriate alternate feed based on the currently matched rewrite rule.

Parameters:
mixed $return Incoming return value from other plugins
Theme $theme The current theme object
Returns:
string Link to the appropriate alternate Atom feed

Definition at line 681 of file theme.php.

Theme::theme_footer ( theme  ) 

Aggregates and echos the additional footer code by combining Plugins and Stack calls.

Definition at line 607 of file theme.php.

Theme::theme_has_context ( theme,
context 
)

Check to see if the theme is currently rendering a specific context

Parameters:
string $context The context to check for.
Returns:
bool True if the context is active.

Definition at line 666 of file theme.php.

Theme::theme_header ( theme  ) 

Aggregates and echos the additional header code by combining Plugins and Stack calls.

Definition at line 583 of file theme.php.

Theme::theme_next_page_link ( theme,
text = null 
)

Provides a link to the next page

Parameters:
string $text text to display for link

Definition at line 825 of file theme.php.

static Theme::theme_page_selector ( theme,
rr_name = null,
settings = array() 
) [static]

Build a collection of paginated URLs to be used for pagination.

Parameters:
string The RewriteRule name used to build the links.
array Various settings used by the method and the RewriteRule.
Returns:
string Collection of paginated URLs built by the RewriteRule.

Definition at line 727 of file theme.php.

Theme::theme_prev_page_link ( theme,
text = null 
)

Provides a link to the previous page

Parameters:
string $text text to display for link

Definition at line 802 of file theme.php.

Theme::theme_query_count (  ) 

Returns the count of queries executed

Returns:
integer The query count

Definition at line 913 of file theme.php.

Theme::theme_query_time (  ) 

Returns total query execution time in seconds

Returns:
float Query execution time in seconds, with fractions.

Definition at line 923 of file theme.php.


Member Data Documentation

Theme::$valid_filters
Initial value:
 array(
    'content_type',
    'not:content_type',
    'slug',
    'not:slug',
    'user_id',
    'vocabulary',
    'status',
    'page',
    'tag',
    'not:tag',
    'month',
    'year',
    'day',
    'criteria',
    'limit',
    'nolimit',
    'offset',
    'fetch_fn',
    'id',
    'info',
    'has:info',
    'all:info',
    'any:info',
    'not:info',
    'not:all:info',
    'not:any:info',
  )

We build the Post filters by analyzing the handler_var data which is assigned to the handler ( by the Controller and also, optionally, by the Theme )

Definition at line 30 of file theme.php.


The documentation for this class was generated from the following file: