Skip to content

Commit afe33f0

Browse files
committed
Add access modifier (public) to methods and members of WP_Upgrader and its subclasses.
See #27881, #22234. git-svn-id: https://develop.svn.wordpress.org/trunk@28496 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 17cabb1 commit afe33f0

1 file changed

Lines changed: 54 additions & 54 deletions

File tree

src/wp-admin/includes/class-wp-upgrader.php

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@
2121
* @since 2.8.0
2222
*/
2323
class WP_Upgrader {
24-
var $strings = array();
25-
var $skin = null;
26-
var $result = array();
24+
public $strings = array();
25+
public $skin = null;
26+
public $result = array();
2727

28-
function __construct($skin = null) {
28+
public function __construct($skin = null) {
2929
if ( null == $skin )
3030
$this->skin = new WP_Upgrader_Skin();
3131
else
3232
$this->skin = $skin;
3333
}
3434

35-
function init() {
35+
public function init() {
3636
$this->skin->set_upgrader($this);
3737
$this->generic_strings();
3838
}
3939

40-
function generic_strings() {
40+
public function generic_strings() {
4141
$this->strings['bad_request'] = __('Invalid Data provided.');
4242
$this->strings['fs_unavailable'] = __('Could not access filesystem.');
4343
$this->strings['fs_error'] = __('Filesystem error.');
@@ -59,7 +59,7 @@ function generic_strings() {
5959
$this->strings['maintenance_end'] = __('Disabling Maintenance mode…');
6060
}
6161

62-
function fs_connect( $directories = array() ) {
62+
public function fs_connect( $directories = array() ) {
6363
global $wp_filesystem;
6464

6565
if ( false === ($credentials = $this->skin->request_filesystem_credentials()) )
@@ -106,7 +106,7 @@ function fs_connect( $directories = array() ) {
106106
return true;
107107
} //end fs_connect();
108108

109-
function download_package($package) {
109+
public function download_package($package) {
110110

111111
/**
112112
* Filter whether to return the package.
@@ -138,7 +138,7 @@ function download_package($package) {
138138
return $download_file;
139139
}
140140

141-
function unpack_package($package, $delete_package = true) {
141+
public function unpack_package($package, $delete_package = true) {
142142
global $wp_filesystem;
143143

144144
$this->skin->feedback('unpack_package');
@@ -177,7 +177,7 @@ function unpack_package($package, $delete_package = true) {
177177
return $working_dir;
178178
}
179179

180-
function install_package( $args = array() ) {
180+
public function install_package( $args = array() ) {
181181
global $wp_filesystem, $wp_theme_directories;
182182

183183
$defaults = array(
@@ -347,7 +347,7 @@ function install_package( $args = array() ) {
347347
return $this->result;
348348
}
349349

350-
function run( $options ) {
350+
public function run( $options ) {
351351

352352
$defaults = array(
353353
'package' => '', // Please always pass this.
@@ -441,7 +441,7 @@ function run( $options ) {
441441
return $result;
442442
}
443443

444-
function maintenance_mode($enable = false) {
444+
public function maintenance_mode($enable = false) {
445445
global $wp_filesystem;
446446
$file = $wp_filesystem->abspath() . '.maintenance';
447447
if ( $enable ) {
@@ -467,10 +467,10 @@ function maintenance_mode($enable = false) {
467467
*/
468468
class Plugin_Upgrader extends WP_Upgrader {
469469

470-
var $result;
471-
var $bulk = false;
470+
public $result;
471+
public $bulk = false;
472472

473-
function upgrade_strings() {
473+
public function upgrade_strings() {
474474
$this->strings['up_to_date'] = __('The plugin is at the latest version.');
475475
$this->strings['no_package'] = __('Update package not available.');
476476
$this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>&#8230;');
@@ -481,7 +481,7 @@ function upgrade_strings() {
481481
$this->strings['process_success'] = __('Plugin updated successfully.');
482482
}
483483

484-
function install_strings() {
484+
public function install_strings() {
485485
$this->strings['no_package'] = __('Install package not available.');
486486
$this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>&#8230;');
487487
$this->strings['unpack_package'] = __('Unpacking the package&#8230;');
@@ -491,7 +491,7 @@ function install_strings() {
491491
$this->strings['process_success'] = __('Plugin installed successfully.');
492492
}
493493

494-
function install( $package, $args = array() ) {
494+
public function install( $package, $args = array() ) {
495495

496496
$defaults = array(
497497
'clear_update_cache' => true,
@@ -525,7 +525,7 @@ function install( $package, $args = array() ) {
525525
return true;
526526
}
527527

528-
function upgrade( $plugin, $args = array() ) {
528+
public function upgrade( $plugin, $args = array() ) {
529529

530530
$defaults = array(
531531
'clear_update_cache' => true,
@@ -576,7 +576,7 @@ function upgrade( $plugin, $args = array() ) {
576576
return true;
577577
}
578578

579-
function bulk_upgrade( $plugins, $args = array() ) {
579+
public function bulk_upgrade( $plugins, $args = array() ) {
580580

581581
$defaults = array(
582582
'clear_update_cache' => true,
@@ -690,7 +690,7 @@ function bulk_upgrade( $plugins, $args = array() ) {
690690
return $results;
691691
}
692692

693-
function check_package($source) {
693+
public function check_package($source) {
694694
global $wp_filesystem;
695695

696696
if ( is_wp_error($source) )
@@ -717,7 +717,7 @@ function check_package($source) {
717717
}
718718

719719
//return plugin info.
720-
function plugin_info() {
720+
public function plugin_info() {
721721
if ( ! is_array($this->result) )
722722
return false;
723723
if ( empty($this->result['destination_name']) )
@@ -733,7 +733,7 @@ function plugin_info() {
733733
}
734734

735735
//Hooked to pre_install
736-
function deactivate_plugin_before_upgrade($return, $plugin) {
736+
public function deactivate_plugin_before_upgrade($return, $plugin) {
737737

738738
if ( is_wp_error($return) ) //Bypass.
739739
return $return;
@@ -753,7 +753,7 @@ function deactivate_plugin_before_upgrade($return, $plugin) {
753753
}
754754

755755
//Hooked to upgrade_clear_destination
756-
function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) {
756+
public function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) {
757757
global $wp_filesystem;
758758

759759
if ( is_wp_error($removed) )
@@ -791,10 +791,10 @@ function delete_old_plugin($removed, $local_destination, $remote_destination, $p
791791
*/
792792
class Theme_Upgrader extends WP_Upgrader {
793793

794-
var $result;
795-
var $bulk = false;
794+
public $result;
795+
public $bulk = false;
796796

797-
function upgrade_strings() {
797+
public function upgrade_strings() {
798798
$this->strings['up_to_date'] = __('The theme is at the latest version.');
799799
$this->strings['no_package'] = __('Update package not available.');
800800
$this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>&#8230;');
@@ -805,7 +805,7 @@ function upgrade_strings() {
805805
$this->strings['process_success'] = __('Theme updated successfully.');
806806
}
807807

808-
function install_strings() {
808+
public function install_strings() {
809809
$this->strings['no_package'] = __('Install package not available.');
810810
$this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>&#8230;');
811811
$this->strings['unpack_package'] = __('Unpacking the package&#8230;');
@@ -825,7 +825,7 @@ function install_strings() {
825825
$this->strings['parent_theme_not_found'] = __('<strong>The parent theme could not be found.</strong> You will need to install the parent theme, <strong>%s</strong>, before you can use this child theme.');
826826
}
827827

828-
function check_parent_theme_filter($install_result, $hook_extra, $child_result) {
828+
public function check_parent_theme_filter($install_result, $hook_extra, $child_result) {
829829
// Check to see if we need to install a parent theme
830830
$theme_info = $this->theme_info();
831831

@@ -884,12 +884,12 @@ function check_parent_theme_filter($install_result, $hook_extra, $child_result)
884884
return $install_result;
885885
}
886886

887-
function hide_activate_preview_actions($actions) {
887+
public function hide_activate_preview_actions($actions) {
888888
unset($actions['activate'], $actions['preview']);
889889
return $actions;
890890
}
891891

892-
function install( $package, $args = array() ) {
892+
public function install( $package, $args = array() ) {
893893

894894
$defaults = array(
895895
'clear_update_cache' => true,
@@ -925,7 +925,7 @@ function install( $package, $args = array() ) {
925925
return true;
926926
}
927927

928-
function upgrade( $theme, $args = array() ) {
928+
public function upgrade( $theme, $args = array() ) {
929929

930930
$defaults = array(
931931
'clear_update_cache' => true,
@@ -975,7 +975,7 @@ function upgrade( $theme, $args = array() ) {
975975
return true;
976976
}
977977

978-
function bulk_upgrade( $themes, $args = array() ) {
978+
public function bulk_upgrade( $themes, $args = array() ) {
979979

980980
$defaults = array(
981981
'clear_update_cache' => true,
@@ -1076,7 +1076,7 @@ function bulk_upgrade( $themes, $args = array() ) {
10761076
return $results;
10771077
}
10781078

1079-
function check_package($source) {
1079+
public function check_package($source) {
10801080
global $wp_filesystem;
10811081

10821082
if ( is_wp_error($source) )
@@ -1103,7 +1103,7 @@ function check_package($source) {
11031103
return $source;
11041104
}
11051105

1106-
function current_before($return, $theme) {
1106+
public function current_before($return, $theme) {
11071107

11081108
if ( is_wp_error($return) )
11091109
return $return;
@@ -1119,7 +1119,7 @@ function current_before($return, $theme) {
11191119
return $return;
11201120
}
11211121

1122-
function current_after($return, $theme) {
1122+
public function current_after($return, $theme) {
11231123
if ( is_wp_error($return) )
11241124
return $return;
11251125

@@ -1141,7 +1141,7 @@ function current_after($return, $theme) {
11411141
return $return;
11421142
}
11431143

1144-
function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
1144+
public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
11451145
global $wp_filesystem;
11461146

11471147
if ( is_wp_error( $removed ) )
@@ -1160,7 +1160,7 @@ function delete_old_theme( $removed, $local_destination, $remote_destination, $t
11601160
return true;
11611161
}
11621162

1163-
function theme_info($theme = null) {
1163+
public function theme_info($theme = null) {
11641164

11651165
if ( empty($theme) ) {
11661166
if ( !empty($this->result['destination_name']) )
@@ -1184,10 +1184,10 @@ function theme_info($theme = null) {
11841184
*/
11851185
class Language_Pack_Upgrader extends WP_Upgrader {
11861186

1187-
var $result;
1188-
var $bulk = true;
1187+
public $result;
1188+
public $bulk = true;
11891189

1190-
static function async_upgrade( $upgrader = false ) {
1190+
public static function async_upgrade( $upgrader = false ) {
11911191
// Avoid recursion.
11921192
if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader )
11931193
return;
@@ -1205,7 +1205,7 @@ static function async_upgrade( $upgrader = false ) {
12051205
$lp_upgrader->upgrade();
12061206
}
12071207

1208-
function upgrade_strings() {
1208+
public function upgrade_strings() {
12091209
$this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while we update them as well.' );
12101210
$this->strings['up_to_date'] = __( 'The translation is up to date.' ); // We need to silently skip this case
12111211
$this->strings['no_package'] = __( 'Update package not available.' );
@@ -1215,14 +1215,14 @@ function upgrade_strings() {
12151215
$this->strings['process_success'] = __( 'Translation updated successfully.' );
12161216
}
12171217

1218-
function upgrade( $update = false, $args = array() ) {
1218+
public function upgrade( $update = false, $args = array() ) {
12191219
if ( $update )
12201220
$update = array( $update );
12211221
$results = $this->bulk_upgrade( $update, $args );
12221222
return $results[0];
12231223
}
12241224

1225-
function bulk_upgrade( $language_updates = array(), $args = array() ) {
1225+
public function bulk_upgrade( $language_updates = array(), $args = array() ) {
12261226
global $wp_filesystem;
12271227

12281228
$defaults = array(
@@ -1323,7 +1323,7 @@ function bulk_upgrade( $language_updates = array(), $args = array() ) {
13231323
return $results;
13241324
}
13251325

1326-
function check_package( $source, $remote_source ) {
1326+
public function check_package( $source, $remote_source ) {
13271327
global $wp_filesystem;
13281328

13291329
if ( is_wp_error( $source ) )
@@ -1348,7 +1348,7 @@ function check_package( $source, $remote_source ) {
13481348
return $source;
13491349
}
13501350

1351-
function get_name_for_update( $update ) {
1351+
public function get_name_for_update( $update ) {
13521352
switch ( $update->type ) {
13531353
case 'core':
13541354
return 'WordPress'; // Not translated
@@ -1379,7 +1379,7 @@ function get_name_for_update( $update ) {
13791379
*/
13801380
class Core_Upgrader extends WP_Upgrader {
13811381

1382-
function upgrade_strings() {
1382+
public function upgrade_strings() {
13831383
$this->strings['up_to_date'] = __('WordPress is at the latest version.');
13841384
$this->strings['no_package'] = __('Update package not available.');
13851385
$this->strings['downloading_package'] = __('Downloading update from <span class="code">%s</span>&#8230;');
@@ -1390,7 +1390,7 @@ function upgrade_strings() {
13901390
$this->strings['rollback_was_required'] = __( 'Due to an error during updating, WordPress has rolled back to your previous version.' );
13911391
}
13921392

1393-
function upgrade( $current, $args = array() ) {
1393+
public function upgrade( $current, $args = array() ) {
13941394
global $wp_filesystem;
13951395

13961396
include( ABSPATH . WPINC . '/version.php' ); // $wp_version;
@@ -1536,7 +1536,7 @@ function upgrade( $current, $args = array() ) {
15361536
}
15371537

15381538
// Determines if this WordPress Core version should update to $offered_ver or not
1539-
static function should_update_to_version( $offered_ver /* x.y.z */ ) {
1539+
public static function should_update_to_version( $offered_ver /* x.y.z */ ) {
15401540
include( ABSPATH . WPINC . '/version.php' ); // $wp_version; // x.y.z
15411541

15421542
$current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); // x.y
@@ -1634,7 +1634,7 @@ static function should_update_to_version( $offered_ver /* x.y.z */ ) {
16341634
return false;
16351635
}
16361636

1637-
function check_files() {
1637+
public function check_files() {
16381638
global $wp_version, $wp_local_package;
16391639

16401640
$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
@@ -1662,11 +1662,11 @@ function check_files() {
16621662
* @since 2.8.0
16631663
*/
16641664
class File_Upload_Upgrader {
1665-
var $package;
1666-
var $filename;
1667-
var $id = 0;
1665+
public $package;
1666+
public $filename;
1667+
public $id = 0;
16681668

1669-
function __construct($form, $urlholder) {
1669+
public function __construct($form, $urlholder) {
16701670

16711671
if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) )
16721672
wp_die(__('Please select a file'));
@@ -1717,7 +1717,7 @@ function __construct($form, $urlholder) {
17171717
}
17181718
}
17191719

1720-
function cleanup() {
1720+
public function cleanup() {
17211721
if ( $this->id )
17221722
wp_delete_attachment( $this->id );
17231723

0 commit comments

Comments
 (0)