PHP Class Habari\Themes

Mostrar archivo Open project: habari/system

Public Methods

Method Description
activate_theme ( $theme_name, $theme_dir ) function activate_theme Updates the database with the name of the new theme to use
cancel_preview ( ) Cancel the viewing of any preview theme
class_from_filename ( $file, $check_realpath = false )
create ( string $name = null, string $template_engine = null, string $theme_dir = null ) : Theme Returns a named Theme descendant.
get_active ( $nopreview = false ) : QueryRecord Returns the active theme information from the database
get_active_data ( $nopreview = false ) : array Returns theme information for the active theme -- dir, path, theme.xml, screenshot url
get_all ( ) : array Returns the theme dir and path information
get_all_data ( ) : array Returns all theme information -- dir, path, theme.xml, screenshot url
get_theme_classes ( ) : array Get a list of classes that extend Theme
get_theme_dir ( $nopreview = false ) : string Returns the name of the active or previewed theme
preview_theme ( string $theme_name, string $theme_dir ) Sets a theme to be the current user's preview theme
validate_theme ( string $theme_dir ) : boolean Ensure that a theme meets requirements for activation/preview

Private Methods

Method Description
get_active_theme_dir ( $nopreview = false ) : string Returns the active theme's full directory path.
get_by_name ( $name )

Method Details

activate_theme() public static method

function activate_theme Updates the database with the name of the new theme to use
public static activate_theme ( $theme_name, $theme_dir )

cancel_preview() public static method

Cancel the viewing of any preview theme
public static cancel_preview ( )

class_from_filename() public static method

public static class_from_filename ( $file, $check_realpath = false )

create() public static method

If no parameter is supplied, then load the active theme from the database. If no theme option is set, a fatal error is thrown
public static create ( string $name = null, string $template_engine = null, string $theme_dir = null ) : Theme
$name string ( optional ) override the default theme lookup
$template_engine string ( optional ) specify a template engine
$theme_dir string ( optional ) specify a theme directory
return Theme An instance of the requested theme or the default theme

get_active() public static method

Returns the active theme information from the database
public static get_active ( $nopreview = false ) : QueryRecord
return QueryRecord An array of Theme data

get_active_data() public static method

Returns theme information for the active theme -- dir, path, theme.xml, screenshot url
public static get_active_data ( $nopreview = false ) : array
return array An array of Theme data

get_all() public static method

Returns the theme dir and path information
public static get_all ( ) : array
return array An array of Theme data

get_all_data() public static method

Returns all theme information -- dir, path, theme.xml, screenshot url
public static get_all_data ( ) : array
return array An array of Theme data

get_theme_classes() public static method

Get a list of classes that extend Theme
public static get_theme_classes ( ) : array
return array List of string names of classes that extend Theme

get_theme_dir() public static method

Returns the name of the active or previewed theme
public static get_theme_dir ( $nopreview = false ) : string
return string the current theme or previewed theme's directory name

preview_theme() public static method

Sets a theme to be the current user's preview theme
public static preview_theme ( string $theme_name, string $theme_dir )
$theme_name string The name of the theme to preview
$theme_dir string The directory of the theme to preview

validate_theme() public static method

Ensure that a theme meets requirements for activation/preview
public static validate_theme ( string $theme_dir ) : boolean
$theme_dir string the directory of the theme
return boolean True if the theme meets all requirements