Make WordPress Core

Changeset 31133


Ignore:
Timestamp:
01/10/2015 09:58:19 PM (12 years ago)
Author:
wonderboymusic
Message:

In Custom_Background:

  • In [28481], $admin_header_callback and $admin_image_div_callback were set to private based on their erroneous @param value
  • $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 2 properties marked private, $page and $updated - $page is never used and $updated was added by me in [30186] during 4.1

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 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-background.php

    r31129 r31133  
    2121         * @var callback
    2222         * @since 3.0.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;
    35 
    36         /**
    37          * Holds the page menu hook.
    38          *
    39          * @var string
    40          * @since 3.0.0
    41          * @access private
    42          */
    43         private $page = '';
     31         */
     32        public $admin_image_div_callback;
    4433
    4534        /**
     
    6554                // Unused since 3.5.0.
    6655                add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) );
    67         }
    68 
    69         /**
    70          * Make private properties readable for backwards compatibility.
    71          *
    72          * @since 4.0.0
    73          * @access public
    74          *
    75          * @param string $name Property name.
    76          * @return mixed Property.
    77          */
    78         public function __get( $name ) {
    79                 return $this->$name;
    80         }
    81 
    82         /**
    83          * Make private properties settable for backwards compatibility.
    84          *
    85          * @since 4.0.0
    86          * @access public
    87          *
    88          * @param string $name  Property to set.
    89          * @param mixed  $value Property value.
    90          * @return mixed Newly-set property.
    91          */
    92         public function __set( $name, $value ) {
    93                 return $this->$name = $value;
    94         }
    95 
    96         /**
    97          * Make private properties checkable for backwards compatibility.
    98          *
    99          * @since 4.0.0
    100          * @access public
    101          *
    102          * @param string $name Property to check if set.
    103          * @return bool Whether the property is set.
    104          */
    105         public function __isset( $name ) {
    106                 return isset( $this->$name );
    107         }
    108 
    109         /**
    110          * Make private properties un-settable for backwards compatibility.
    111          *
    112          * @since 4.0.0
    113          * @access public
    114          *
    115          * @param string $name Property to unset.
    116          */
    117         public function __unset( $name ) {
    118                 unset( $this->$name );
    11956        }
    12057
     
    12966                        return;
    13067                }
    131 
    132                 $this->page = $page;
    13368
    13469                add_action( "load-$page", array( $this, 'admin_load' ) );
Note: See TracChangeset for help on using the changeset viewer.