Make WordPress Core

Changeset 31134


Ignore:
Timestamp:
01/10/2015 10:10:02 PM (9 years ago)
Author:
wonderboymusic
Message:

In Custom_Image_Header:

  • In [28481], $admin_header_callback and $admin_image_div_callback were set to private based on their erroneous @param values
  • $admin_header_callback and $admin_image_div_callback are used as hook callbacks - as such, they must be public
  • In [28521] and [28524], magic methods were added for back-compat
  • Currently, there are 4 properties marked private: $uploaded_headers, $default_headers, $page, and $updated - $page and $uploaded_headers are never used and $updated was added by me in [30187] during 4.1. $default_headers does not necessarily need to be private

Set $admin_header_callback and $admin_image_div_callback to public.
Remove the $page property - it duplicated the $page local var and is referenced/used nowhere.
Remove the $uploaded_headers property - it is used nowhere and is dead code.
Set $default_headers to public.
Remove the magic methods - they were beyond overkill and rendered moot by the above changes.

See #30891.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/custom-header.php

    r31130 r31134  
    2121     * @var callback
    2222     * @since 2.1.0
    23      * @access private
    24      */
    25     private $admin_header_callback;
     23     */
     24    public $admin_header_callback;
    2625
    2726    /**
     
    3029     * @var callback
    3130     * @since 3.0.0
    32      * @access private
    33      */
    34     private $admin_image_div_callback;
     31     */
     32    public $admin_image_div_callback;
    3533
    3634    /**
     
    4139     * @access private
    4240     */
    43     private $default_headers = array();
    44 
    45     /**
    46      * Holds custom headers uploaded by the user.
    47      *
    48      * @var array
    49      * @since 3.2.0
    50      * @access private
    51      */
    52     private $uploaded_headers = array();
    53 
    54     /**
    55      * Holds the page menu hook.
    56      *
    57      * @var string
    58      * @since 3.0.0
    59      * @access private
    60      */
    61     private $page = '';
     41    public $default_headers = array();
    6242
    6343    /**
     
    8666
    8767    /**
    88      * Make private properties readable for backwards compatibility.
    89      *
    90      * @since 4.0.0
    91      * @access public
    92      *
    93      * @param string $name Property to get.
    94      * @return mixed Property.
    95      */
    96     public function __get( $name ) {
    97         return $this->$name;
    98     }
    99 
    100     /**
    101      * Make private properties settable for backwards compatibility.
    102      *
    103      * @since 4.0.0
    104      * @access public
    105      *
    106      * @param string $name  Property to set.
    107      * @param mixed  $value Property value.
    108      * @return mixed Newly-set property.
    109      */
    110     public function __set( $name, $value ) {
    111         return $this->$name = $value;
    112     }
    113 
    114     /**
    115      * Make private properties checkable for backwards compatibility.
    116      *
    117      * @since 4.0.0
    118      * @access public
    119      *
    120      * @param string $name Property to check if set.
    121      * @return bool Whether the property is set.
    122      */
    123     public function __isset( $name ) {
    124         return isset( $this->$name );
    125     }
    126 
    127     /**
    128      * Make private properties un-settable for backwards compatibility.
    129      *
    130      * @since 4.0.0
    131      * @access public
    132      *
    133      * @param string $name Property to unset.
    134      */
    135     public function __unset( $name ) {
    136         unset( $this->$name );
    137     }
    138 
    139     /**
    14068     * Set up the hooks for the Custom Header admin page.
    14169     *
     
    14775            return;
    14876        }
    149 
    150         $this->page = $page;
    15177
    15278        add_action( "admin_print_scripts-$page", array( $this, 'js_includes' ) );
Note: See TracChangeset for help on using the changeset viewer.