[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-includes/ -> class-wp-theme.php (summary)

WP_Theme Class

File Size: 1212 lines (39 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 39 functions

  __construct()
  __toString()
  __isset()
  __get()
  offsetSet()
  offsetUnset()
  offsetExists()
  offsetGet()
  errors()
  exists()
  parent()
  cache_add()
  cache_get()
  cache_delete()
  get()
  display()
  sanitize_header()
  markup_header()
  translate_header()
  get_stylesheet()
  get_template()
  get_stylesheet_directory()
  get_template_directory()
  get_stylesheet_directory_uri()
  get_template_directory_uri()
  get_theme_root()
  get_theme_root_uri()
  get_screenshot()
  get_files()
  get_page_templates()
  scandir()
  load_textdomain()
  is_allowed()
  get_allowed()
  get_allowed_on_network()
  get_allowed_on_site()
  sort_by_name()
  _name_sort()
  _name_sort_i18n()

Functions
Functions that are not part of a class:

__construct( $theme_dir, $theme_root, $_child = null )   X-Ref
Constructor for WP_Theme.

param: string $theme_dir Directory of the theme within the theme_root.
param: string $theme_root Theme root.
param: WP_Error|null $_child If this theme is a parent theme, the child may be passed for validation purposes.

__toString()   X-Ref
No description

__isset( $offset )   X-Ref
__isset() magic method for properties formerly returned by current_theme_info()


__get( $offset )   X-Ref
__get() magic method for properties formerly returned by current_theme_info()


offsetSet( $offset, $value )   X-Ref
Method to implement ArrayAccess for keys formerly returned by get_themes()


offsetUnset( $offset )   X-Ref
Method to implement ArrayAccess for keys formerly returned by get_themes()


offsetExists( $offset )   X-Ref
Method to implement ArrayAccess for keys formerly returned by get_themes()


offsetGet( $offset )   X-Ref
Method to implement ArrayAccess for keys formerly returned by get_themes().

Author, Author Name, Author URI, and Description did not previously return
translated data. We are doing so now as it is safe to do. However, as
Name and Title could have been used as the key for get_themes(), both remain
untranslated for back compatibility. This means that ['Name'] is not ideal,
and care should be taken to use $theme->display('Name') to get a properly
translated header.

errors()   X-Ref
Returns errors property.

return: WP_Error|bool WP_Error if there are errors, or false.

exists()   X-Ref
Whether the theme exists.

A theme with errors exists. A theme with the error of 'theme_not_found',
meaning that the theme's directory was not found, does not exist.

return: bool Whether the theme exists.

parent()   X-Ref
Returns reference to the parent theme.

return: WP_Theme|bool Parent theme, or false if the current theme is not a child theme.

cache_add( $key, $data )   X-Ref
Adds theme data to cache.

Cache entries keyed by the theme and the type of data.

param: string $key Type of data to store (theme, screenshot, headers, page_templates)
param: string $data Data to store
return: bool Return value from wp_cache_add()

cache_get( $key )   X-Ref
Gets theme data from cache.

Cache entries are keyed by the theme and the type of data.

param: string $key Type of data to retrieve (theme, screenshot, headers, page_templates)
return: mixed Retrieved data

cache_delete()   X-Ref
Clears the cache for the theme.


get( $header )   X-Ref
Get a raw, unformatted theme header.

The header is sanitized, but is not translated, and is not marked up for display.
To get a theme header for display, use the display() method.

Use the get_template() method, not the 'Template' header, for finding the template.
The 'Template' header is only good for what was written in the style.css, while
get_template() takes into account where WordPress actually located the theme and
whether it is actually valid.

param: string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
return: string String on success, false on failure.

display( $header, $markup = true, $translate = true )   X-Ref
Gets a theme header, formatted and translated for display.

param: string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
param: bool $markup Optional. Whether to mark up the header. Defaults to true.
param: bool $translate Optional. Whether to translate the header. Defaults to true.
return: string Processed header, false on failure.

sanitize_header( $header, $value )   X-Ref
Sanitize a theme header.

param: string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
param: string $value Value to sanitize.

markup_header( $header, $value, $translate )   X-Ref
Mark up a theme header.

param: string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
param: string $value Value to mark up.
param: string $translate Whether the header has been translated.
return: string Value, marked up.

translate_header( $header, $value )   X-Ref
Translate a theme header.

param: string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
param: string $value Value to translate.
return: string Translated value.

get_stylesheet()   X-Ref
The directory name of the theme's "stylesheet" files, inside the theme root.

In the case of a child theme, this is directory name of the child theme.
Otherwise, get_stylesheet() is the same as get_template().

return: string Stylesheet

get_template()   X-Ref
The directory name of the theme's "template" files, inside the theme root.

In the case of a child theme, this is the directory name of the parent theme.
Otherwise, the get_template() is the same as get_stylesheet().

return: string Template

get_stylesheet_directory()   X-Ref
Returns the absolute path to the directory of a theme's "stylesheet" files.

In the case of a child theme, this is the absolute path to the directory
of the child theme's files.

return: string Absolute path of the stylesheet directory.

get_template_directory()   X-Ref
Returns the absolute path to the directory of a theme's "template" files.

In the case of a child theme, this is the absolute path to the directory
of the parent theme's files.

return: string Absolute path of the template directory.

get_stylesheet_directory_uri()   X-Ref
Returns the URL to the directory of a theme's "stylesheet" files.

In the case of a child theme, this is the URL to the directory of the
child theme's files.

return: string URL to the stylesheet directory.

get_template_directory_uri()   X-Ref
Returns the URL to the directory of a theme's "template" files.

In the case of a child theme, this is the URL to the directory of the
parent theme's files.

return: string URL to the template directory.

get_theme_root()   X-Ref
The absolute path to the directory of the theme root.

This is typically the absolute path to wp-content/themes.

return: string Theme root.

get_theme_root_uri()   X-Ref
Returns the URL to the directory of the theme root.

This is typically the absolute URL to wp-content/themes. This forms the basis
for all other URLs returned by WP_Theme, so we pass it to the public function
get_theme_root_uri() and allow it to run the theme_root_uri filter.

return: string Theme root URI.

get_screenshot( $uri = 'uri' )   X-Ref
Returns the main screenshot file for the theme.

The main screenshot is called screenshot.png. gif and jpg extensions are also allowed.

Screenshots for a theme must be in the stylesheet directory. (In the case of child
themes, parent theme screenshots are not inherited.)

param: string $uri Type of URL to return, either 'relative' or an absolute URI. Defaults to absolute URI.
return: mixed Screenshot file. False if the theme does not have a screenshot.

get_files( $type = null, $depth = 0, $search_parent = false )   X-Ref
Return files in the theme's directory.

param: mixed $type Optional. Array of extensions to return. Defaults to all files (null).
param: int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). -1 depth is infinite.
param: bool $search_parent Optional. Whether to return parent files. Defaults to false.
return: array Array of files, keyed by the path to the file relative to the theme's directory, with the values

get_page_templates()   X-Ref
Returns the theme's page templates.

return: array Array of page templates, keyed by filename, with the value of the translated header name.

scandir( $path, $extensions = null, $depth = 0, $relative_path = '' )   X-Ref
Scans a directory for files of a certain extension.

param: string $path Absolute path to search.
param: mixed  Array of extensions to find, string of a single extension, or null for all extensions.
param: int $depth How deep to search for files. Optional, defaults to a flat scan (0 depth). -1 depth is infinite.
param: string $relative_path The basename of the absolute path. Used to control the returned path

load_textdomain()   X-Ref
Loads the theme's textdomain.

Translation files are not inherited from the parent theme. Todo: if this fails for the
child theme, it should probably try to load the parent theme's translations.

return: True if the textdomain was successfully loaded or has already been loaded. False if

is_allowed( $check = 'both', $blog_id = null )   X-Ref
Whether the theme is allowed (multisite only).

param: string $check Optional. Whether to check only the 'network'-wide settings, the 'site'
param: int $blog_id Optional. Ignored if only network-wide settings are checked. Defaults to current blog.
return: bool Whether the theme is allowed for the network. Returns true in single-site.

get_allowed( $blog_id = null )   X-Ref
Returns array of stylesheet names of themes allowed on the site or network.

param: int $blog_id Optional. Defaults to current blog.
return: array Array of stylesheet names.

get_allowed_on_network()   X-Ref
Returns array of stylesheet names of themes allowed on the network.

return: array Array of stylesheet names.

get_allowed_on_site( $blog_id = null )   X-Ref
Returns array of stylesheet names of themes allowed on the site.

param: int $blog_id Optional. Defaults to current blog.
return: array Array of stylesheet names.

sort_by_name( &$themes )   X-Ref
Sort themes by name.


_name_sort( $a, $b )   X-Ref
Callback function for usort() to naturally sort themes by name.

Accesses the Name header directly from the class for maximum speed.
Would choke on HTML but we don't care enough to slow it down with strip_tags().


_name_sort_i18n( $a, $b )   X-Ref
Name sort (with translation).




Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu