Make WordPress Core

Ticket #23040: 23040.r1.patch

File 23040.r1.patch, 2.9 KB (added by wpsmith, 10 years ago)

Refreshed

  • wp-includes/class-wp-theme.php

     
    310310
    311311        /**
    312312         * __isset() magic method for properties formerly returned by current_theme_info()
     313         * Use appropriate method to obtain WP_Theme properties.
    313314         */
    314315        public function __isset( $offset ) {
    315316                static $properties = array(
     
    317318                        'screenshot', 'description', 'author', 'tags', 'theme_root', 'theme_root_uri',
    318319                );
    319320
     321                _doing_it_wrong( __METHOD__, sprintf( __( 'Please use the appropriate, public WP_Theme method: %s.' ), $this->_deprecated( $offset ) ), '4.1' );
     322
    320323                return in_array( $offset, $properties );
    321324        }
    322325
     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
    323350        /**
    324351         * __get() magic method for properties formerly returned by current_theme_info()
     352         * Use appropriate method to obtain WP_Theme properties.
    325353         */
    326354        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
    327357                switch ( $offset ) {
    328358                        case 'name' :
    329359                        case 'title' :
     
    373403         * Method to implement ArrayAccess for keys formerly returned by get_themes()
    374404         */
    375405        public function offsetExists( $offset ) {
     406                _deprecated_function( __METHOD__, sprintf( __( 'Please use the appropriate, public WP_Theme method: %s.' ), $this->_deprecated( $offset ) ), '4.2' );
     407
    376408                static $keys = array(
    377409                        'Name', 'Version', 'Status', 'Title', 'Author', 'Author Name', 'Author URI', 'Description',
    378410                        'Template', 'Stylesheet', 'Template Files', 'Stylesheet Files', 'Template Dir', 'Stylesheet Dir',