Make WordPress Core

Ticket #7657: 7657.r8969.diff

File 7657.r8969.diff, 5.4 KB (added by jacobsantos, 16 years ago)

Complete inline documentation for theme.php based off of r8969

  • theme.php

     
    7171/**
    7272 * Retrieve localized stylesheet URI.
    7373 *
    74  * {@internal Missing Long Description}}
     74 * The stylesheet directory for the localized stylesheet files are located, by
     75 * default, in the base theme directory. The name of the locale file will be the
     76 * locale followed by '.css'. If that does not exist, then the text direction
     77 * stylesheet will be checked for existence, for example 'ltr.css'.
    7578 *
     79 * The theme may change the location of the stylesheet directory by either using
     80 * the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter.
     81 * If you want to change the location of the stylesheet files for the entire
     82 * WordPress workflow, then change the former. If you just have the locale in a
     83 * separate folder, then change the latter.
     84 *
    7685 * @since 2.1.0
    7786 * @uses apply_filters() Calls 'locale_stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
    7887 *
     
    135144/**
    136145 * Retrieve theme data from parsed theme file.
    137146 *
    138  * {@internal Missing Long Description}}
     147 * The description will have the tags filtered with the following HTML elements
     148 * whitelisted. The <b>'a'</b> element with the <em>href</em> and <em>title</em>
     149 * attributes. The <b>abbr</b> element with the <em>title</em> attribute. The
     150 * <b>acronym<b> element with the <em>title</em> attribute allowed. The
     151 * <b>code</b>, <b>em</b>, and <b>strong</b> elements also allowed.
    139152 *
     153 * The style.css file must contain theme name, theme URI, and description. The
     154 * data can also contain author URI, author, template (parent template),
     155 * version, status, and finally tags. Some of these are not used by WordPress
     156 * administration panels, but are used by theme directory web sites which list
     157 * the theme.
     158 *
    140159 * @since 1.5.0
    141160 *
    142161 * @param string $theme_file Theme file path.
     
    209228/**
    210229 * Retrieve list of themes with theme data in theme directory.
    211230 *
    212  * {@internal Missing Long Description}}
     231 * The theme is broken, if it doesn't have a parent theme and is missing either
     232 * style.css and, or index.php. If the theme has a parent theme then it is
     233 * broken, if it is missing style.css; index.php is optional. The broken theme
     234 * list is saved in the {@link $wp_broken_themes} global, which is displayed on
     235 * the theme list in the administration panels.
    213236 *
    214237 * @since 1.5.0
     238 * @global array $wp_broken_themes Stores the broken themes.
     239 * @global array $wp_themes Stores the working themes.
    215240 *
    216241 * @return array Theme list with theme data.
    217242 */
     
    574599        return apply_filters('tag_template', $template);
    575600}
    576601
     602/**
     603 * Retrieve path of taxonomy template in current or parent template.
     604 *
     605 * Retrieves the taxonomy and term, if term is available. The template is
     606 * prepended with 'taxonomy-' and followed by both the taxonomy string and
     607 * the taxonomy string followed by a dash and then followed by the term.
     608 *
     609 * The taxonomy and term template is checked and used first, if it exists.
     610 * Second, just the taxonomy template is checked, and then finally, taxonomy.php
     611 * template is used. If none of the files exist, then it will fall back on to
     612 * index.php.
     613 *
     614 * @since unknown (2.6.0 most likely)
     615 * @uses apply_filters() Calls 'taxonomy_template' filter on found path.
     616 *
     617 * @return string
     618 */
    577619function get_taxonomy_template() {
    578620        $taxonomy = get_query_var('taxonomy');
    579621        $term = get_query_var('term');
     
    672714 *
    673715 * @since 1.5.0
    674716 *
    675  * @return unknown
     717 * @return string
    676718 */
    677719function get_single_template() {
    678720        return get_query_template('single');
     
    793835}
    794836
    795837/**
    796  * {@internal Missing Short Description}}
     838 * Start preview theme output buffer.
    797839 *
    798  * {@internal Missing Long Description}}
     840 * Will only preform task if the user has permissions and template and preview
     841 * query variables exist.
    799842 *
    800843 * @since 2.5.0
    801  *
    802  * @param unknown_type $template
    803  * @param unknown_type $stylesheet
    804844 */
    805845function preview_theme() {
    806846        if ( ! (isset($_GET['template']) && isset($_GET['preview'])) )
     
    827867}
    828868add_action('setup_theme', 'preview_theme');
    829869
     870/**
     871 * Callback function for ob_start() to capture all links in the theme.
     872 *
     873 * @since unknown
     874 * @access private
     875 *
     876 * @param string $content
     877 * @return string
     878 */
    830879function preview_theme_ob_filter( $content ) {
    831880        return preg_replace_callback( "|(<a.*?href=([\"']))(.*?)([\"'].*?>)|", 'preview_theme_ob_filter_callback', $content );
    832881}
    833882
     883/**
     884 * Manipulates preview theme links in order to control and maintain location.
     885 *
     886 * Callback function for preg_replace_callback() to accept and filter matches.
     887 *
     888 * @since unknown
     889 * @access private
     890 *
     891 * @param array $matches
     892 * @return string
     893 */
    834894function preview_theme_ob_filter_callback( $matches ) {
    835895        if (
    836896                ( false !== strpos($matches[3], '/wp-admin/') )
     
    849909        return $matches[1] . attribute_escape( $link ) . $matches[4];
    850910}
    851911
     912/**
     913 * Switches current theme to new template and stylesheet names.
     914 *
     915 * @since unknown
     916 * @uses do_action() Calls 'switch_theme' action on updated theme display name.
     917 *
     918 * @param string $template Template name
     919 * @param string $stylesheet Stylesheet name.
     920 */
    852921function switch_theme($template, $stylesheet) {
    853922        update_option('template', $template);
    854923        update_option('stylesheet', $stylesheet);