Ticket #20027: 20027.diff
| File 20027.diff, 3.2 KB (added by nacin, 16 months ago) |
|---|
-
wp-includes/theme.php
14 14 * @return bool true if a child theme is in use, false otherwise. 15 15 **/ 16 16 function is_child_theme() { 17 return ( TEMPLATEPATH !== STYLESHEETPATH);17 return ( get_stylesheet() !== get_template() ); 18 18 } 19 19 20 20 /** … … 23 23 * The theme name that the administrator has currently set the front end theme 24 24 * as. 25 25 * 26 * For all extensive purposes, the template name and the stylesheet name are 27 * going to be the same for most cases. 26 * The template name and stylesheet name differ when a child theme is in use. 28 27 * 29 28 * @since 1.5.0 30 29 * @uses apply_filters() Calls 'stylesheet' filter on stylesheet name. … … 32 31 * @return string Stylesheet name. 33 32 */ 34 33 function get_stylesheet() { 35 return apply_filters('stylesheet', get_option('stylesheet'));34 return get_option( 'stylesheet' ); 36 35 } 37 36 38 37 /** … … 125 124 * @return string Template name. 126 125 */ 127 126 function get_template() { 128 return apply_filters('template', get_option('template'));127 return get_option( 'template' ); 129 128 } 130 129 131 130 /** 131 * Applies the 'stylesheet' and 'template' filters to option calls. 132 * 133 * @since 3.4.0 134 * @access private 135 */ 136 function _stylesheet_template_option_filter( $value ) { 137 if ( 'stylesheet' == current_filter() ) 138 return apply_filters( 'stylesheet', $value ); 139 return apply_filters( 'template', $value ); 140 } 141 add_action( 'option_stylesheet', '_stylesheet_template_option_filter', 100 ); 142 add_action( 'option_stylesheet', '_stylesheet_template_option_filter', 100 ); 143 144 /** 132 145 * Retrieve current theme directory. 133 146 * 134 147 * @since 1.5.0 … … 1063 1076 /** 1064 1077 * Retrieve the name of the highest priority template file that exists. 1065 1078 * 1066 * Searches in the STYLESHEETPATH before TEMPLATEPATHso that themes which1079 * Searches in the stylesheet path before template path so that themes which 1067 1080 * inherit from a parent theme can just overload one file. 1068 1081 * 1069 1082 * @since 2.7.0 … … 1078 1091 foreach ( (array) $template_names as $template_name ) { 1079 1092 if ( !$template_name ) 1080 1093 continue; 1081 if ( file_exists( STYLESHEETPATH. '/' . $template_name)) {1082 $located = STYLESHEETPATH. '/' . $template_name;1094 if ( file_exists( get_stylesheet() . '/' . $template_name)) { 1095 $located = get_stylesheet() . '/' . $template_name; 1083 1096 break; 1084 } else if ( file_exists( TEMPLATEPATH. '/' . $template_name) ) {1085 $located = TEMPLATEPATH. '/' . $template_name;1097 } else if ( file_exists( get_template() . '/' . $template_name) ) { 1098 $located = get_template() . '/' . $template_name; 1086 1099 break; 1087 1100 } 1088 1101 } … … 1153 1166 if ( validate_file($_GET['template']) ) 1154 1167 return; 1155 1168 1156 add_filter( ' template', '_preview_theme_template_filter' );1169 add_filter( 'option_template', '_preview_theme_template_filter' ); 1157 1170 1158 1171 if ( isset($_GET['stylesheet']) ) { 1159 1172 $_GET['stylesheet'] = preg_replace('|[^a-z0-9_./-]|i', '', $_GET['stylesheet']); 1160 1173 if ( validate_file($_GET['stylesheet']) ) 1161 1174 return; 1162 add_filter( ' stylesheet', '_preview_theme_stylesheet_filter' );1175 add_filter( 'option_stylesheet', '_preview_theme_stylesheet_filter' ); 1163 1176 } 1164 1177 1165 1178 // Prevent theme mods to current theme being used on theme being previewed