Make WordPress Core


Ignore:
Timestamp:
05/18/2014 09:30:43 PM (8 years ago)
Author:
wonderboymusic
Message:

Use proper access modifiers and add a magic __get() method to Custom_Background and Custom_Image_Header.

See #27881, #22234.

File:
1 edited

Legend:

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

    r27469 r28481  
    2323     * @access private
    2424     */
    25     var $admin_header_callback;
     25    private $admin_header_callback;
    2626
    2727    /**
     
    3232     * @access private
    3333     */
    34     var $admin_image_div_callback;
     34    private $admin_image_div_callback;
    3535
    3636    /**
     
    4141     * @access private
    4242     */
    43     var $page = '';
     43    private $page = '';
    4444
    4545    /**
     
    5151     * @return Custom_Background
    5252     */
    53     function __construct($admin_header_callback = '', $admin_image_div_callback = '') {
     53    public function __construct($admin_header_callback = '', $admin_image_div_callback = '') {
    5454        $this->admin_header_callback = $admin_header_callback;
    5555        $this->admin_image_div_callback = $admin_image_div_callback;
     
    6060
    6161    /**
     62     * Make private properties readable for backwards compatibility
     63     *
     64     * @since 4.0.0
     65     * @param string $name
     66     * @return mixed
     67     */
     68    public function __get( $name ) {
     69        return $this->$name;
     70    }
     71
     72    /**
    6273     * Set up the hooks for the Custom Background admin page.
    6374     *
    6475     * @since 3.0.0
    6576     */
    66     function init() {
     77    public function init() {
    6778        if ( ! current_user_can('edit_theme_options') )
    6879            return;
     
    8394     * @since 3.0.0
    8495     */
    85     function admin_load() {
     96    public function admin_load() {
    8697        get_current_screen()->add_help_tab( array(
    8798            'id'      => 'overview',
     
    110121     * @since 3.0.0
    111122     */
    112     function take_action() {
     123    public function take_action() {
    113124
    114125        if ( empty($_POST) )
     
    177188     * @since 3.0.0
    178189     */
    179     function admin_page() {
     190    public function admin_page() {
    180191?>
    181192<div class="wrap" id="custom-background">
     
    344355     * @since 3.0.0
    345356     */
    346     function handle_upload() {
     357    public function handle_upload() {
    347358
    348359        if ( empty($_FILES) )
     
    398409     * @since 3.4.0
    399410     */
    400     function attachment_fields_to_edit( $form_fields ) {
     411    public function attachment_fields_to_edit( $form_fields ) {
    401412        return $form_fields;
    402413    }
     
    407418     * @since 3.4.0
    408419     */
    409     function filter_upload_tabs( $tabs ) {
     420    public function filter_upload_tabs( $tabs ) {
    410421        return $tabs;
    411422    }
Note: See TracChangeset for help on using the changeset viewer.