Make WordPress Core


Ignore:
Timestamp:
05/19/2014 01:22:55 AM (11 years ago)
Author:
wonderboymusic
Message:

Add access modifier (public) to methods and members of WP_Upgrader_Skin and its subclasses.

See #27881, #22234.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-upgrader-skins.php

    r28040 r28495  
    1717class WP_Upgrader_Skin {
    1818
    19     var $upgrader;
    20     var $done_header = false;
    21     var $result = false;
    22 
    23     function __construct($args = array()) {
     19    public $upgrader;
     20    public $done_header = false;
     21    public $result = false;
     22
     23    public function __construct($args = array()) {
    2424        $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
    2525        $this->options = wp_parse_args($args, $defaults);
    2626    }
    2727
    28     function set_upgrader(&$upgrader) {
     28    public function set_upgrader(&$upgrader) {
    2929        if ( is_object($upgrader) )
    3030            $this->upgrader =& $upgrader;
     
    3232    }
    3333
    34     function add_strings() {
    35     }
    36 
    37     function set_result($result) {
     34    public function add_strings() {
     35    }
     36
     37    public function set_result($result) {
    3838        $this->result = $result;
    3939    }
    4040
    41     function request_filesystem_credentials($error = false) {
     41    public function request_filesystem_credentials($error = false) {
    4242        $url = $this->options['url'];
    4343        $context = $this->options['context'];
     
    4747    }
    4848
    49     function header() {
     49    public function header() {
    5050        if ( $this->done_header )
    5151            return;
     
    5454        echo '<h2>' . $this->options['title'] . '</h2>';
    5555    }
    56     function footer() {
     56    public function footer() {
    5757        echo '</div>';
    5858    }
    5959
    60     function error($errors) {
     60    public function error($errors) {
    6161        if ( ! $this->done_header )
    6262            $this->header();
     
    7373    }
    7474
    75     function feedback($string) {
     75    public function feedback($string) {
    7676        if ( isset( $this->upgrader->strings[$string] ) )
    7777            $string = $this->upgrader->strings[$string];
     
    9090        show_message($string);
    9191    }
    92     function before() {}
    93     function after() {}
     92    public function before() {}
     93    public function after() {}
    9494
    9595    /**
     
    123123 */
    124124class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
    125     var $plugin = '';
    126     var $plugin_active = false;
    127     var $plugin_network_active = false;
    128 
    129     function __construct($args = array()) {
     125    public $plugin = '';
     126    public $plugin_active = false;
     127    public $plugin_network_active = false;
     128
     129    public function __construct($args = array()) {
    130130        $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') );
    131131        $args = wp_parse_args($args, $defaults);
     
    139139    }
    140140
    141     function after() {
     141    public function after() {
    142142        $this->plugin = $this->upgrader->plugin_info();
    143143        if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
     
    177177 */
    178178class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
    179     var $in_loop = false;
    180     var $error = false;
    181 
    182     function __construct($args = array()) {
     179    public $in_loop = false;
     180    public $error = false;
     181
     182    public function __construct($args = array()) {
    183183        $defaults = array( 'url' => '', 'nonce' => '' );
    184184        $args = wp_parse_args($args, $defaults);
     
    187187    }
    188188
    189     function add_strings() {
     189    public function add_strings() {
    190190        $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take a while on some hosts, so please be patient.');
    191191        $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: <strong>%2$s</strong>');
     
    195195    }
    196196
    197     function feedback($string) {
     197    public function feedback($string) {
    198198        if ( isset( $this->upgrader->strings[$string] ) )
    199199            $string = $this->upgrader->strings[$string];
     
    216216    }
    217217
    218     function header() {
     218    public function header() {
    219219        // Nothing, This will be displayed within a iframe.
    220220    }
    221221
    222     function footer() {
     222    public function footer() {
    223223        // Nothing, This will be displayed within a iframe.
    224224    }
    225     function error($error) {
     225    public function error($error) {
    226226        if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
    227227            $this->error = $this->upgrader->strings[$error];
     
    239239    }
    240240
    241     function bulk_header() {
     241    public function bulk_header() {
    242242        $this->feedback('skin_upgrade_start');
    243243    }
    244244
    245     function bulk_footer() {
     245    public function bulk_footer() {
    246246        $this->feedback('skin_upgrade_end');
    247247    }
    248248
    249     function before($title = '') {
     249    public function before($title = '') {
    250250        $this->in_loop = true;
    251251        printf( '<h4>' . $this->upgrader->strings['skin_before_update_header'] . ' <span class="spinner waiting-' . $this->upgrader->update_current . '"></span></h4>',  $title, $this->upgrader->update_current, $this->upgrader->update_count);
     
    255255    }
    256256
    257     function after($title = '') {
     257    public function after($title = '') {
    258258        echo '</p></div>';
    259259        if ( $this->error || ! $this->result ) {
     
    275275    }
    276276
    277     function reset() {
     277    public function reset() {
    278278        $this->in_loop = false;
    279279        $this->error = false;
    280280    }
    281281
    282     function flush_output() {
     282    public function flush_output() {
    283283        wp_ob_end_flush_all();
    284284        flush();
     
    306306
    307307class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
    308     var $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
    309 
    310     function __construct($args = array()) {
     308    public $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
     309
     310    public function __construct($args = array()) {
    311311        parent::__construct($args);
    312312    }
    313313
    314     function add_strings() {
     314    public function add_strings() {
    315315        parent::add_strings();
    316316        $this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
    317317    }
    318318
    319     function before($title = '') {
     319    public function before($title = '') {
    320320        parent::before($this->plugin_info['Title']);
    321321    }
    322322
    323     function after($title = '') {
     323    public function after($title = '') {
    324324        parent::after($this->plugin_info['Title']);
    325325        $this->decrement_update_count( 'plugin' );
    326326    }
    327     function bulk_footer() {
     327    public function bulk_footer() {
    328328        parent::bulk_footer();
    329329        $update_actions =  array(
     
    350350
    351351class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
    352     var $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
    353 
    354     function __construct($args = array()) {
     352    public $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
     353
     354    public function __construct($args = array()) {
    355355        parent::__construct($args);
    356356    }
    357357
    358     function add_strings() {
     358    public function add_strings() {
    359359        parent::add_strings();
    360360        $this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
    361361    }
    362362
    363     function before($title = '') {
     363    public function before($title = '') {
    364364        parent::before( $this->theme_info->display('Name') );
    365365    }
    366366
    367     function after($title = '') {
     367    public function after($title = '') {
    368368        parent::after( $this->theme_info->display('Name') );
    369369        $this->decrement_update_count( 'theme' );
    370370    }
    371371
    372     function bulk_footer() {
     372    public function bulk_footer() {
    373373        parent::bulk_footer();
    374374        $update_actions =  array(
     
    402402 */
    403403class Plugin_Installer_Skin extends WP_Upgrader_Skin {
    404     var $api;
    405     var $type;
    406 
    407     function __construct($args = array()) {
     404    public $api;
     405    public $type;
     406
     407    public function __construct($args = array()) {
    408408        $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
    409409        $args = wp_parse_args($args, $defaults);
     
    415415    }
    416416
    417     function before() {
     417    public function before() {
    418418        if ( !empty($this->api) )
    419419            $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
    420420    }
    421421
    422     function after() {
     422    public function after() {
    423423
    424424        $plugin_file = $this->upgrader->plugin_info();
     
    477477 */
    478478class Theme_Installer_Skin extends WP_Upgrader_Skin {
    479     var $api;
    480     var $type;
    481 
    482     function __construct($args = array()) {
     479    public $api;
     480    public $type;
     481
     482    public function __construct($args = array()) {
    483483        $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
    484484        $args = wp_parse_args($args, $defaults);
     
    490490    }
    491491
    492     function before() {
     492    public function before() {
    493493        if ( !empty($this->api) )
    494494            $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
    495495    }
    496496
    497     function after() {
     497    public function after() {
    498498        if ( empty($this->upgrader->result['destination_name']) )
    499499            return;
     
    560560 */
    561561class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
    562     var $theme = '';
    563 
    564     function __construct($args = array()) {
     562    public $theme = '';
     563
     564    public function __construct($args = array()) {
    565565        $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
    566566        $args = wp_parse_args($args, $defaults);
     
    571571    }
    572572
    573     function after() {
     573    public function after() {
    574574        $this->decrement_update_count( 'theme' );
    575575
     
    631631 */
    632632class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
    633     var $language_update = null;
    634     var $done_header = false;
    635     var $display_footer_actions = true;
    636 
    637     function __construct( $args = array() ) {
     633    public $language_update = null;
     634    public $done_header = false;
     635    public $display_footer_actions = true;
     636
     637    public function __construct( $args = array() ) {
    638638        $defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false );
    639639        $args = wp_parse_args( $args, $defaults );
     
    645645    }
    646646
    647     function before() {
     647    public function before() {
    648648        $name = $this->upgrader->get_name_for_update( $this->language_update );
    649649
     
    653653    }
    654654
    655     function error( $error ) {
     655    public function error( $error ) {
    656656        echo '<div class="lp-error">';
    657657        parent::error( $error );
     
    659659    }
    660660
    661     function after() {
     661    public function after() {
    662662        echo '</div>';
    663663    }
    664664
    665     function bulk_footer() {
     665    public function bulk_footer() {
    666666        $this->decrement_update_count( 'translation' );
    667667        $update_actions = array();
     
    697697    protected $messages = array();
    698698
    699     function request_filesystem_credentials( $error = false, $context = '' ) {
     699    public function request_filesystem_credentials( $error = false, $context = '' ) {
    700700        if ( $context )
    701701            $this->options['context'] = $context;
     
    708708    }
    709709
    710     function get_upgrade_messages() {
     710    public function get_upgrade_messages() {
    711711        return $this->messages;
    712712    }
    713713
    714     function feedback( $data ) {
     714    public function feedback( $data ) {
    715715        if ( is_wp_error( $data ) )
    716716            $string = $data->get_error_message();
     
    748748    }
    749749
    750     function header() {
     750    public function header() {
    751751        ob_start();
    752752    }
    753753
    754     function footer() {
     754    public function footer() {
    755755        $output = ob_get_contents();
    756756        if ( ! empty( $output ) )
     
    759759    }
    760760
    761     function bulk_header() {}
    762     function bulk_footer() {}
    763     function before() {}
    764     function after() {}
    765 }
     761    public function bulk_header() {}
     762    public function bulk_footer() {}
     763    public function before() {}
     764    public function after() {}
     765}
Note: See TracChangeset for help on using the changeset viewer.