<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[26501] trunk/src/wp-includes/theme.php: Inline documentation for hooks in wp-includes/theme.php.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26501">26501</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2013-12-01 17:23:05 +0000 (Sun, 01 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Inline documentation for hooks in wp-includes/theme.php.

Props ShinichiN.
Fixes <a href="http://core.trac.wordpress.org/ticket/25588">#25588</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesthemephp">trunk/src/wp-includes/theme.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/theme.php (26500 => 26501)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/theme.php  2013-12-01 12:47:35 UTC (rev 26500)
+++ trunk/src/wp-includes/theme.php     2013-12-01 17:23:05 UTC (rev 26501)
</span><span class="lines">@@ -141,19 +141,24 @@
</span><span class="cx">  * going to be the same for most cases.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><del>- * @uses apply_filters() Calls 'stylesheet' filter on stylesheet name.
</del><span class="cx">  *
</span><span class="cx">  * @return string Stylesheet name.
</span><span class="cx">  */
</span><span class="cx"> function get_stylesheet() {
</span><del>-       return apply_filters('stylesheet', get_option('stylesheet'));
</del><ins>+        /**
+        * Filter the name of current stylesheet.
+        *
+        * @since 1.5.0
+        *
+        * @param string $stylesheet Name of the current stylesheet.
+        */
+       return apply_filters( 'stylesheet', get_option( 'stylesheet' ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Retrieve stylesheet directory path for current theme.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><del>- * @uses apply_filters() Calls 'stylesheet_directory' filter on stylesheet directory and theme name.
</del><span class="cx">  *
</span><span class="cx">  * @return string Path to current theme directory.
</span><span class="cx">  */
</span><span class="lines">@@ -162,6 +167,15 @@
</span><span class="cx">  $theme_root = get_theme_root( $stylesheet );
</span><span class="cx">  $stylesheet_dir = "$theme_root/$stylesheet";
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the stylesheet directory path for current theme.
+        *
+        * @since 1.5.0
+        *
+        * @param string $stylesheet_dir Absolute path to the current them.
+        * @param string $stylesheet     Directory name of the current theme.
+        * @param string $theme_root     Absolute path to themes directory.
+        */
</ins><span class="cx">   return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -177,6 +191,15 @@
</span><span class="cx">  $theme_root_uri = get_theme_root_uri( $stylesheet );
</span><span class="cx">  $stylesheet_dir_uri = "$theme_root_uri/$stylesheet";
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the stylesheet directory URI.
+        *
+        * @since 1.5.0
+        *
+        * @param string $stylesheet_dir_uri Stylesheet directory URI.
+        * @param string $stylesheet         Name of the activated theme's directory.
+        * @param string $theme_root_uri     Themes root URI.
+        */
</ins><span class="cx">   return apply_filters( 'stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -187,14 +210,21 @@
</span><span class="cx">  * get_stylesheet_directory_uri() stylesheet directory URI} path.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><del>- * @uses apply_filters() Calls 'stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
</del><span class="cx">  *
</span><span class="cx">  * @return string
</span><span class="cx">  */
</span><span class="cx"> function get_stylesheet_uri() {
</span><span class="cx">  $stylesheet_dir_uri = get_stylesheet_directory_uri();
</span><span class="cx">  $stylesheet_uri = $stylesheet_dir_uri . '/style.css';
</span><del>-       return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
</del><ins>+        /**
+        * Filter the URI of the current theme stylesheet.
+        *
+        * @since 1.5.0
+        *
+        * @param string $stylesheet_uri     Stylesheet URI for the current theme/child theme.
+        * @param string $stylesheet_dir_uri Stylesheet directory URI for the current theme/child theme.
+        */
+       return apply_filters( 'stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -212,7 +242,6 @@
</span><span class="cx">  * separate folder, then change the latter.
</span><span class="cx">  *
</span><span class="cx">  * @since 2.1.0
</span><del>- * @uses apply_filters() Calls 'locale_stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
</del><span class="cx">  *
</span><span class="cx">  * @return string
</span><span class="cx">  */
</span><span class="lines">@@ -227,7 +256,15 @@
</span><span class="cx">          $stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css";
</span><span class="cx">  else
</span><span class="cx">          $stylesheet_uri = '';
</span><del>-       return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
</del><ins>+        /**
+        * Filter the localized stylesheet URI.
+        *
+        * @since 2.1.0
+        *
+        * @param string $stylesheet_uri     Localized stylesheet URI.
+        * @param string $stylesheet_dir_uri Stylesheet directory URI.
+        */
+       return apply_filters( 'locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -239,14 +276,20 @@
</span><span class="cx">  * @return string Template name.
</span><span class="cx">  */
</span><span class="cx"> function get_template() {
</span><del>-       return apply_filters('template', get_option('template'));
</del><ins>+        /**
+        * Filter the name of the current theme.
+        *
+        * @since 1.5.0
+        *
+        * @param string $template Current theme's directory name.
+        */
+       return apply_filters( 'template', get_option( 'template' ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Retrieve current theme directory.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><del>- * @uses apply_filters() Calls 'template_directory' filter on template directory path and template name.
</del><span class="cx">  *
</span><span class="cx">  * @return string Template directory path.
</span><span class="cx">  */
</span><span class="lines">@@ -255,6 +298,15 @@
</span><span class="cx">  $theme_root = get_theme_root( $template );
</span><span class="cx">  $template_dir = "$theme_root/$template";
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the current theme directory path.
+        *
+        * @since 1.5.0
+        *
+        * @param string $template_dir The URI of the current theme directory.
+        * @param string $template     Directory name of the current theme.
+        * @param string $theme_root   Absolute path to the themes directory.
+        */
</ins><span class="cx">   return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -262,7 +314,6 @@
</span><span class="cx">  * Retrieve theme directory URI.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><del>- * @uses apply_filters() Calls 'template_directory_uri' filter on template directory URI path and template name.
</del><span class="cx">  *
</span><span class="cx">  * @return string Template directory URI.
</span><span class="cx">  */
</span><span class="lines">@@ -271,6 +322,15 @@
</span><span class="cx">  $theme_root_uri = get_theme_root_uri( $template );
</span><span class="cx">  $template_dir_uri = "$theme_root_uri/$template";
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the current theme directory URI.
+        *
+        * @since 1.5.0
+        *
+        * @param string $template_dir_uri The URI of the current theme directory.
+        * @param string $template         Directory name of the current theme.
+        * @param string $theme_root_uri   The themes root URI.
+        */
</ins><span class="cx">   return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -350,6 +410,14 @@
</span><span class="cx">                  $relative_theme_roots[ $theme_root ] = $theme_root;
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter whether to get the cache of the registered theme directories.
+        *
+        * @since 3.4.0
+        *
+        * @param bool   $cache_expiration Whether to get the cache of the theme directories. Default false.
+        * @param string $cache_directory  Directory to be searched for the cache.
+        */
</ins><span class="cx">   if ( $cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' ) ) {
</span><span class="cx">          $cached_roots = get_site_transient( 'theme_roots' );
</span><span class="cx">          if ( is_array( $cached_roots ) ) {
</span><span class="lines">@@ -441,7 +509,6 @@
</span><span class="cx">  * Does not have trailing slash.
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><del>- * @uses apply_filters() Calls 'theme_root' filter on path.
</del><span class="cx">  *
</span><span class="cx">  * @param string $stylesheet_or_template The stylesheet or template name of the theme
</span><span class="cx">  * @return string Theme path.
</span><span class="lines">@@ -458,6 +525,13 @@
</span><span class="cx">          $theme_root = WP_CONTENT_DIR . '/themes';
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       /**
+        * Filter the absolute path to the themes directory.
+        *
+        * @since 1.5.0
+        *
+        * @param string $theme_root Absolute path to themes directory.
+        */
</ins><span class="cx">   return apply_filters( 'theme_root', $theme_root );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -498,7 +572,16 @@
</span><span class="cx">          $theme_root_uri = content_url( 'themes' );
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       return apply_filters( 'theme_root_uri', $theme_root_uri, get_option('siteurl'), $stylesheet_or_template );
</del><ins>+        /**
+        * Filter the URI for themes directory.
+        *
+        * @since 1.5.0
+        *
+        * @param string $theme_root_uri         The URI for themes directory.
+        * @param string $siteurl                WordPress web address which is set in General Options.
+        * @param string $stylesheet_or_template Stylesheet or template name of the theme.
+        */
+       return apply_filters( 'theme_root_uri', $theme_root_uri, get_option( 'siteurl' ), $stylesheet_or_template );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -665,7 +748,6 @@
</span><span class="cx">  * of two arguments: $template then $stylesheet. This is for backwards compatibility.
</span><span class="cx">  *
</span><span class="cx">  * @since 2.5.0
</span><del>- * @uses do_action() Calls 'switch_theme' action, passing the new theme.
</del><span class="cx">  *
</span><span class="cx">  * @param string $stylesheet Stylesheet name
</span><span class="cx">  */
</span><span class="lines">@@ -706,6 +788,14 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  update_option( 'theme_switched', $old_theme->get_stylesheet() );
</span><ins>+       /**
+        * Fires after the theme is switched.
+        *
+        * @since 1.5.0
+        *
+        * @param string   $new_name  Name of the new theme.
+        * @param WP_Theme $new_theme WP_Theme instance of the new theme.
+        */
</ins><span class="cx">   do_action( 'switch_theme', $new_name, $new_theme );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -723,8 +813,14 @@
</span><span class="cx">  * @return bool
</span><span class="cx">  */
</span><span class="cx"> function validate_current_theme() {
</span><del>-       // Don't validate during an install/upgrade.
-       if ( defined('WP_INSTALLING') || !apply_filters( 'validate_current_theme', true ) )
</del><ins>+        /**
+        * Filter whether to validate the current theme.
+        *
+        * @since 2.7.0
+        *
+        * @param bool true Validation flag to check the current theme.
+        */
+       if ( defined('WP_INSTALLING') || ! apply_filters( 'validate_current_theme', true ) )
</ins><span class="cx">           return true;
</span><span class="cx"> 
</span><span class="cx">  if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) {
</span><span class="lines">@@ -776,7 +872,6 @@
</span><span class="cx">  * directory URI.
</span><span class="cx">  *
</span><span class="cx">  * @since 2.1.0
</span><del>- * @uses apply_filters() Calls 'theme_mod_$name' filter on the value.
</del><span class="cx">  *
</span><span class="cx">  * @param string $name Theme modification name.
</span><span class="cx">  * @param bool|string $default
</span><span class="lines">@@ -785,13 +880,27 @@
</span><span class="cx"> function get_theme_mod( $name, $default = false ) {
</span><span class="cx">  $mods = get_theme_mods();
</span><span class="cx"> 
</span><del>-       if ( isset( $mods[ $name ] ) )
-               return apply_filters( "theme_mod_$name", $mods[ $name ] );
</del><ins>+        if ( isset( $mods[$name] ) ) {
+               /**
+                * Filter the theme modification, or 'theme_mod', value.
+                *
+                * The dynamic portion of the hook name, $name, refers to
+                * the key name of the modification array. For example,
+                * 'header_textcolor', 'header_image', and so on depending
+                * on the theme options.
+                *
+                * @since 2.2.0
+                *
+                * @param string $current_mod The value of the current theme modification.
+                */
+               return apply_filters( "theme_mod_{$name}", $mods[$name] );
+       }
</ins><span class="cx"> 
</span><span class="cx">  if ( is_string( $default ) )
</span><span class="cx">          $default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
</span><span class="cx"> 
</span><del>-       return apply_filters( "theme_mod_$name", $default );
</del><ins>+        /** This filter is documented in wp-includes/theme.php */
+       return apply_filters( "theme_mod_{$name}", $default );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1593,7 +1702,21 @@
</span><span class="cx">                  break;
</span><span class="cx">  }
</span><span class="cx"> 
</span><del>-       return apply_filters('current_theme_supports-' . $feature, true, $args, $_wp_theme_features[$feature]);
</del><ins>+        /**
+        * Filter whether the current theme supports a specific feature.
+        *
+        * The dynamic portion of the hook name, $feature, refers to
+        * the specific theme feature. Possible values include 'post-formats',
+        * 'post-thumbnails', 'custom-background', 'custom-header', 'menus',
+        * 'automatic-feed-links', and 'html5'.
+        *
+        * @since 3.4.0
+        *
+        * @param bool   true     Whether the current theme supports the given feature. Default true.
+        * @param array  $args    Array of arguments for the feature.
+        * @param string $feature The theme feature.
+        */
+       return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[$feature] );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -1641,10 +1764,25 @@
</span><span class="cx">  if ( $stylesheet = get_option( 'theme_switched' ) ) {
</span><span class="cx">          $old_theme = wp_get_theme( $stylesheet );
</span><span class="cx"> 
</span><del>-               if ( $old_theme->exists() )
-                       do_action( 'after_switch_theme', $old_theme->get('Name'), $old_theme );
-               else
</del><ins>+                if ( $old_theme->exists() ) {
+                       /**
+                        * Fires on the first WP load after a theme switch if the old theme still exists.
+                        *
+                        * This action fires multiple times and the parameters differs
+                        * according to the context, if the old theme exists or not.
+                        * If the old theme is missing, the parameter will be the slug
+                        * of the old theme.
+                        *
+                        * @since 3.3.0
+                        *
+                        * @param string   $old_name  Old theme name.
+                        * @param WP_Theme $old_theme WP_Theme instance of the old theme.
+                        */
+                       do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );
+               } else {
+                       /** This action is documented in wp-includes/theme.php */
</ins><span class="cx">                   do_action( 'after_switch_theme', $stylesheet );
</span><ins>+               }
</ins><span class="cx"> 
</span><span class="cx">          update_option( 'theme_switched', false );
</span><span class="cx">  }
</span></span></pre>
</div>
</div>

</body>
</html>