Changeset 20316
- Timestamp:
- 03/29/2012 04:29:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-theme.php
r20315 r20316 162 162 * @param string $theme_dir Directory of the theme within the theme_root. 163 163 * @param string $theme_root Theme root. 164 * @param WP_Error|null $child If this theme is a parent theme, the child may be passed for validation purposes. 165 */ 166 public function __construct( $theme_dir, $theme_root, $child = null ) { 164 * @param WP_Error|null $_child If this theme is a parent theme, the child may be passed for validation purposes. 165 */ 166 public function __construct( $theme_dir, $theme_root, $_child = null ) { 167 global $wp_theme_directories; 167 168 168 169 // Initialize caching on first run. … … 180 181 $this->theme_root = $theme_root; 181 182 $this->stylesheet = $theme_dir; 183 184 // Correct a situation where the theme is 'some-directory/some-theme' but 'some-directory' was passed in as part of the theme root instead. 185 if ( ! in_array( $theme_root, (array) $wp_theme_directories ) && in_array( dirname( $theme_root ), (array) $wp_theme_directories ) ) { 186 $this->stylesheet = basename( $this->theme_root ) . '/' . $this->stylesheet; 187 $this->theme_root = dirname( $theme_root ); 188 } 189 182 190 $this->cache_hash = md5( $this->theme_root . '/' . $this->stylesheet ); 183 191 $theme_file = $this->stylesheet . '/style.css'; … … 253 261 if ( $this->template != $this->stylesheet ) { 254 262 // If we are a parent, then there is a problem. Only two generations allowed! Cancel things out. 255 if ( is_a( $ child, 'WP_Theme' ) && $child->template == $this->stylesheet ) {256 $ child->parent = null;257 $ child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $child->template ) );258 $ child->cache_add( 'theme', array( 'headers' => $child->headers, 'errors' => $child->errors, 'stylesheet' => $child->stylesheet, 'template' => $child->template ) );263 if ( is_a( $_child, 'WP_Theme' ) && $_child->template == $this->stylesheet ) { 264 $_child->parent = null; 265 $_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $_child->template ) ); 266 $_child->cache_add( 'theme', array( 'headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template ) ); 259 267 // The two themes actually reference each other with the Template header. 260 if ( $ child->stylesheet == $this->template ) {268 if ( $_child->stylesheet == $this->template ) { 261 269 $this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $this->template ) ); 262 270 $this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
Note: See TracChangeset
for help on using the changeset viewer.