Ticket #23040: class-wp-theme.php.patch
File class-wp-theme.php.patch, 3.1 KB (added by , 10 years ago) |
---|
-
class-wp-theme.php
299 299 300 300 /** 301 301 * __isset() magic method for properties formerly returned by current_theme_info() 302 * Use appropriate method to obtain WP_Theme properties. 302 303 */ 303 304 public function __isset( $offset ) { 305 306 _doing_it_wrong( __METHOD__, sprintf( __( 'Please use the appropriate, public WP_Theme method: %s.' ), $this->_deprecated( $offset ) ), '3.7' ); 304 307 static $properties = array( 305 308 'name', 'title', 'version', 'parent_theme', 'template_dir', 'stylesheet_dir', 'template', 'stylesheet', 306 309 'screenshot', 'description', 'author', 'tags', 'theme_root', 'theme_root_uri', … … 308 311 309 312 return in_array( $offset, $properties ); 310 313 } 314 315 /** 316 * Generate appropriate WP_Theme method for _doing_it_wrong notice. 317 */ 318 private function _deprecated( $offset ) { 319 $properties = array( 320 'name' => "wp_get_theme()->get('Name')", 321 'title' => "wp_get_theme()->get('Name')", 322 'version' => "wp_get_theme()->get('Version')", 323 'parent_theme' => "wp_get_theme()->parent() ? wp_get_theme()->->parent() : wp_get_theme()->get('Name')", 324 'template_dir' => "wp_get_theme()->get_template_directory()", 325 'stylesheet_dir' => "wp_get_theme()->get_stylesheet_directory()", 326 'template' => "wp_get_theme()->get_template()", 327 'stylesheet' => "wp_get_theme()->get_stylesheet()", 328 'screenshot' => "wp_get_theme()->get_screenshot()", 329 'description' => "wp_get_theme()->display('description')", 330 'author' => "wp_get_theme()->display('author')", 331 'tags' => "wp_get_theme()->get('Tags')", 332 'theme_root' => "wp_get_theme()->get_theme_root()", 333 'theme_root_uri' => "wp_get_theme()->get_theme_root_uri()", 334 'default' => "wp_get_theme()->offsetGet( $offset )", 335 ); 336 return isset( $properties[ $offset ] ) ? $properties[ $offset ] : $properties['default']; 337 } 311 338 312 339 /** 313 340 * __get() magic method for properties formerly returned by current_theme_info() 341 * Use appropriate method to obtain WP_Theme properties. 314 342 */ 315 343 public function __get( $offset ) { 344 _doing_it_wrong( __METHOD__, sprintf( __( 'Please use the appropriate, public WP_Theme method: %s.' ), $this->_deprecated( $offset ) ), '3.7' ); 345 316 346 switch ( $offset ) { 317 347 case 'name' : 318 348 case 'title' : … … 362 392 * Method to implement ArrayAccess for keys formerly returned by get_themes() 363 393 */ 364 394 public function offsetExists( $offset ) { 395 _deprecated_function( __METHOD__, sprintf( __( 'Please use the appropriate, public WP_Theme method: %s.' ), $this->_deprecated( $offset ) ), '3.7' ); 365 396 static $keys = array( 366 397 'Name', 'Version', 'Status', 'Title', 'Author', 'Author Name', 'Author URI', 'Description', 367 398 'Template', 'Stylesheet', 'Template Files', 'Stylesheet Files', 'Template Dir', 'Stylesheet Dir',