PluginProbe
The WP Remote WordPress Plugin / 6.76
The WP Remote WordPress Plugin v6.76
6.76 6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 All 54 releases
wpremote / callback / wings / bv_upgrader_skin.php

bv_upgrader_skin.php in The WP Remote WordPress Plugin 6.76, at callback/wings/bv_upgrader_skin.php

89 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) exit;
4 if (!class_exists('WPRUpgraderSkin')) :
5 class WPRUpgraderSkin extends WP_Upgrader_Skin {
6 public $status = array();
7 public $action = '';
8 public $plugin_info = array();
9 public $theme_info = array();
10 public $plugins_by_name = array();
11 public $language_update = null;
12
13 const UPGRADER_WING_VERSION = 1.1;
14
15 function __construct($type, $plugins_by_name = array(), $package = '') {
16 $this->action = $type;
17 $this->package = $package;
18 $this->plugins_by_name = $plugins_by_name;
19 parent::__construct(array());
20 }
21
22 function header() {}
23
24 function footer() {}
25
26 function get_keys() {
27 $key = "bvgeneral";
28 $key_by_file = null;
29 switch ($this->action) {
30 case "theme_upgrade":
31 if (!empty($this->theme_info))
32 $key = $this->theme_info['Name'];
33 break;
34 case "plugin_upgrade":
35 if (!empty($this->plugin_info)) {
36 $key = $this->plugin_info['Name'];
37 $key_by_file = $this->plugins_by_name[$key];
38 }
39 break;
40 case "installer":
41 if (!empty($this->package))
42 $key = $this->package;
43 break;
44 case "upgrade_translations":
45 if (null != $this->language_update)
46 $key = $this->language_update->package;
47 break;
48 }
49 return array($key, $key_by_file);
50 }
51
52 function error($errors) {
53 list($key, $key_by_file) = $this->get_keys();
54 $message = array();
55 $message['error'] = true;
56 if (is_string($errors)) {
57 $message['message'] = $errors;
58 } elseif (is_wp_error($errors) && $errors->get_error_code()) {
59 $message['data'] = $errors->get_error_data();
60 $message['code'] = $errors->get_error_code();
61 }
62 $this->status[$this->action.':'.$key][] = $message;
63 if (!empty($key_by_file)) {
64 $this->status[$this->action.':'.$key_by_file][] = $message;
65 }
66 }
67
68 function feedback($string, ...$args) {
69 if ( empty($string) )
70 return;
71
72 if ( strpos( $string, '%' ) !== false ) {
73 if ( $args ) {
74 $args = array_map( 'strip_tags', $args );
75 $args = array_map( 'esc_html', $args );
76 $string = vsprintf( $string, $args );
77 }
78 }
79
80 list($key, $key_by_file) = $this->get_keys();
81 $message = array();
82 $message['message'] = $string;
83 if (!empty($key_by_file)) {
84 $this->status[$this->action.':'.$key_by_file][] = $message;
85 }
86 $this->status[$this->action.':'.$key][] = $message;
87 }
88 }
89 endif;