Changeset 28495 for trunk/src/wp-admin/includes/class-wp-upgrader-skins.php
- Timestamp:
- 05/19/2014 01:22:55 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader-skins.php
r28040 r28495 17 17 class WP_Upgrader_Skin { 18 18 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()) { 24 24 $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false ); 25 25 $this->options = wp_parse_args($args, $defaults); 26 26 } 27 27 28 function set_upgrader(&$upgrader) {28 public function set_upgrader(&$upgrader) { 29 29 if ( is_object($upgrader) ) 30 30 $this->upgrader =& $upgrader; … … 32 32 } 33 33 34 function add_strings() {35 } 36 37 function set_result($result) {34 public function add_strings() { 35 } 36 37 public function set_result($result) { 38 38 $this->result = $result; 39 39 } 40 40 41 function request_filesystem_credentials($error = false) {41 public function request_filesystem_credentials($error = false) { 42 42 $url = $this->options['url']; 43 43 $context = $this->options['context']; … … 47 47 } 48 48 49 function header() {49 public function header() { 50 50 if ( $this->done_header ) 51 51 return; … … 54 54 echo '<h2>' . $this->options['title'] . '</h2>'; 55 55 } 56 function footer() {56 public function footer() { 57 57 echo '</div>'; 58 58 } 59 59 60 function error($errors) {60 public function error($errors) { 61 61 if ( ! $this->done_header ) 62 62 $this->header(); … … 73 73 } 74 74 75 function feedback($string) {75 public function feedback($string) { 76 76 if ( isset( $this->upgrader->strings[$string] ) ) 77 77 $string = $this->upgrader->strings[$string]; … … 90 90 show_message($string); 91 91 } 92 function before() {}93 function after() {}92 public function before() {} 93 public function after() {} 94 94 95 95 /** … … 123 123 */ 124 124 class 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()) { 130 130 $defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') ); 131 131 $args = wp_parse_args($args, $defaults); … … 139 139 } 140 140 141 function after() {141 public function after() { 142 142 $this->plugin = $this->upgrader->plugin_info(); 143 143 if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){ … … 177 177 */ 178 178 class 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()) { 183 183 $defaults = array( 'url' => '', 'nonce' => '' ); 184 184 $args = wp_parse_args($args, $defaults); … … 187 187 } 188 188 189 function add_strings() {189 public function add_strings() { 190 190 $this->upgrader->strings['skin_upgrade_start'] = __('The update process is starting. This process may take a while on some hosts, so please be patient.'); 191 191 $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while updating %1$s: <strong>%2$s</strong>'); … … 195 195 } 196 196 197 function feedback($string) {197 public function feedback($string) { 198 198 if ( isset( $this->upgrader->strings[$string] ) ) 199 199 $string = $this->upgrader->strings[$string]; … … 216 216 } 217 217 218 function header() {218 public function header() { 219 219 // Nothing, This will be displayed within a iframe. 220 220 } 221 221 222 function footer() {222 public function footer() { 223 223 // Nothing, This will be displayed within a iframe. 224 224 } 225 function error($error) {225 public function error($error) { 226 226 if ( is_string($error) && isset( $this->upgrader->strings[$error] ) ) 227 227 $this->error = $this->upgrader->strings[$error]; … … 239 239 } 240 240 241 function bulk_header() {241 public function bulk_header() { 242 242 $this->feedback('skin_upgrade_start'); 243 243 } 244 244 245 function bulk_footer() {245 public function bulk_footer() { 246 246 $this->feedback('skin_upgrade_end'); 247 247 } 248 248 249 function before($title = '') {249 public function before($title = '') { 250 250 $this->in_loop = true; 251 251 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); … … 255 255 } 256 256 257 function after($title = '') {257 public function after($title = '') { 258 258 echo '</p></div>'; 259 259 if ( $this->error || ! $this->result ) { … … 275 275 } 276 276 277 function reset() {277 public function reset() { 278 278 $this->in_loop = false; 279 279 $this->error = false; 280 280 } 281 281 282 function flush_output() {282 public function flush_output() { 283 283 wp_ob_end_flush_all(); 284 284 flush(); … … 306 306 307 307 class 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()) { 311 311 parent::__construct($args); 312 312 } 313 313 314 function add_strings() {314 public function add_strings() { 315 315 parent::add_strings(); 316 316 $this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)'); 317 317 } 318 318 319 function before($title = '') {319 public function before($title = '') { 320 320 parent::before($this->plugin_info['Title']); 321 321 } 322 322 323 function after($title = '') {323 public function after($title = '') { 324 324 parent::after($this->plugin_info['Title']); 325 325 $this->decrement_update_count( 'plugin' ); 326 326 } 327 function bulk_footer() {327 public function bulk_footer() { 328 328 parent::bulk_footer(); 329 329 $update_actions = array( … … 350 350 351 351 class 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()) { 355 355 parent::__construct($args); 356 356 } 357 357 358 function add_strings() {358 public function add_strings() { 359 359 parent::add_strings(); 360 360 $this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)'); 361 361 } 362 362 363 function before($title = '') {363 public function before($title = '') { 364 364 parent::before( $this->theme_info->display('Name') ); 365 365 } 366 366 367 function after($title = '') {367 public function after($title = '') { 368 368 parent::after( $this->theme_info->display('Name') ); 369 369 $this->decrement_update_count( 'theme' ); 370 370 } 371 371 372 function bulk_footer() {372 public function bulk_footer() { 373 373 parent::bulk_footer(); 374 374 $update_actions = array( … … 402 402 */ 403 403 class 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()) { 408 408 $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' ); 409 409 $args = wp_parse_args($args, $defaults); … … 415 415 } 416 416 417 function before() {417 public function before() { 418 418 if ( !empty($this->api) ) 419 419 $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version); 420 420 } 421 421 422 function after() {422 public function after() { 423 423 424 424 $plugin_file = $this->upgrader->plugin_info(); … … 477 477 */ 478 478 class 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()) { 483 483 $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' ); 484 484 $args = wp_parse_args($args, $defaults); … … 490 490 } 491 491 492 function before() {492 public function before() { 493 493 if ( !empty($this->api) ) 494 494 $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version); 495 495 } 496 496 497 function after() {497 public function after() { 498 498 if ( empty($this->upgrader->result['destination_name']) ) 499 499 return; … … 560 560 */ 561 561 class 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()) { 565 565 $defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') ); 566 566 $args = wp_parse_args($args, $defaults); … … 571 571 } 572 572 573 function after() {573 public function after() { 574 574 $this->decrement_update_count( 'theme' ); 575 575 … … 631 631 */ 632 632 class 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() ) { 638 638 $defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false ); 639 639 $args = wp_parse_args( $args, $defaults ); … … 645 645 } 646 646 647 function before() {647 public function before() { 648 648 $name = $this->upgrader->get_name_for_update( $this->language_update ); 649 649 … … 653 653 } 654 654 655 function error( $error ) {655 public function error( $error ) { 656 656 echo '<div class="lp-error">'; 657 657 parent::error( $error ); … … 659 659 } 660 660 661 function after() {661 public function after() { 662 662 echo '</div>'; 663 663 } 664 664 665 function bulk_footer() {665 public function bulk_footer() { 666 666 $this->decrement_update_count( 'translation' ); 667 667 $update_actions = array(); … … 697 697 protected $messages = array(); 698 698 699 function request_filesystem_credentials( $error = false, $context = '' ) {699 public function request_filesystem_credentials( $error = false, $context = '' ) { 700 700 if ( $context ) 701 701 $this->options['context'] = $context; … … 708 708 } 709 709 710 function get_upgrade_messages() {710 public function get_upgrade_messages() { 711 711 return $this->messages; 712 712 } 713 713 714 function feedback( $data ) {714 public function feedback( $data ) { 715 715 if ( is_wp_error( $data ) ) 716 716 $string = $data->get_error_message(); … … 748 748 } 749 749 750 function header() {750 public function header() { 751 751 ob_start(); 752 752 } 753 753 754 function footer() {754 public function footer() { 755 755 $output = ob_get_contents(); 756 756 if ( ! empty( $output ) ) … … 759 759 } 760 760 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.