Ticket #23040: 23040.r1.patch
File 23040.r1.patch, 2.9 KB (added by , 10 years ago) |
---|
-
wp-includes/class-wp-theme.php
310 310 311 311 /** 312 312 * __isset() magic method for properties formerly returned by current_theme_info() 313 * Use appropriate method to obtain WP_Theme properties. 313 314 */ 314 315 public function __isset( $offset ) { 315 316 static $properties = array( … … 317 318 'screenshot', 'description', 'author', 'tags', 'theme_root', 'theme_root_uri', 318 319 ); 319 320 321 _doing_it_wrong( __METHOD__, sprintf( __( 'Please use the appropriate, public WP_Theme method: %s.' ), $this->_deprecated( $offset ) ), '4.1' ); 322 320 323 return in_array( $offset, $properties ); 321 324 } 322 325 326 /** 327 * Generate appropriate WP_Theme method for _doing_it_wrong notice. 328 */ 329 private function _deprecated( $offset ) { 330 $properties = array( 331 'name' => "wp_get_theme()->get('Name')", 332 'title' => "wp_get_theme()->get('Name')", 333 'version' => "wp_get_theme()->get('Version')", 334 'parent_theme' => "wp_get_theme()->parent() ? wp_get_theme()->->parent() : wp_get_theme()->get('Name')", 335 'template_dir' => "wp_get_theme()->get_template_directory()", 336 'stylesheet_dir' => "wp_get_theme()->get_stylesheet_directory()", 337 'template' => "wp_get_theme()->get_template()", 338 'stylesheet' => "wp_get_theme()->get_stylesheet()", 339 'screenshot' => "wp_get_theme()->get_screenshot()", 340 'description' => "wp_get_theme()->display('description')", 341 'author' => "wp_get_theme()->display('author')", 342 'tags' => "wp_get_theme()->get('Tags')", 343 'theme_root' => "wp_get_theme()->get_theme_root()", 344 'theme_root_uri' => "wp_get_theme()->get_theme_root_uri()", 345 'default' => "wp_get_theme()->offsetGet( $offset )", 346 ); 347 return isset( $properties[ $offset ] ) ? $properties[ $offset ] : $properties['default']; 348 } 349 323 350 /** 324 351 * __get() magic method for properties formerly returned by current_theme_info() 352 * Use appropriate method to obtain WP_Theme properties. 325 353 */ 326 354 public function __get( $offset ) { 355 _doing_it_wrong( __METHOD__, sprintf( __( 'Please use the appropriate, public WP_Theme method: %s.' ), $this->_deprecated( $offset ) ), '4.2' ); 356 327 357 switch ( $offset ) { 328 358 case 'name' : 329 359 case 'title' : … … 373 403 * Method to implement ArrayAccess for keys formerly returned by get_themes() 374 404 */ 375 405 public function offsetExists( $offset ) { 406 _deprecated_function( __METHOD__, sprintf( __( 'Please use the appropriate, public WP_Theme method: %s.' ), $this->_deprecated( $offset ) ), '4.2' ); 407 376 408 static $keys = array( 377 409 'Name', 'Version', 'Status', 'Title', 'Author', 'Author Name', 'Author URI', 'Description', 378 410 'Template', 'Stylesheet', 'Template Files', 'Stylesheet Files', 'Template Dir', 'Stylesheet Dir',