PluginProbe
Tableberg – Simple Gutenberg Table Block / 0.4.1
Tableberg – Simple Gutenberg Table Block v0.4.1
1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 0.5.8 All 41 releases
tableberg / includes / Version_Control_Upgrader_Skin.php

Version_Control_Upgrader_Skin.php in Tableberg – Simple Gutenberg Table Block 0.4.1, at includes/Version_Control_Upgrader_Skin.php

125 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Version control upgrader skin
4 *
5 * @package Tableberg
6 */
7
8 namespace Tableberg\includes;
9
10 use WP_Error;
11 use WP_Upgrader_Skin;
12
13 require_once ABSPATH . '/wp-admin/includes/class-wp-upgrader-skin.php';
14
15 // if called directly, abort process.
16 if ( ! defined( 'WPINC' ) ) {
17 die;
18 }
19
20 /**
21 * Class Version_Control_Upgrader_Skin
22 *
23 * Upgrader skin for version rollback and version sync operations.
24 */
25 class Version_Control_Upgrader_Skin extends WP_Upgrader_Skin {
26 /**
27 * Errors array.
28 *
29 * @var array
30 */
31 protected $errors = array();
32
33 /**
34 * Plugin info.
35 *
36 * @var array
37 */
38 public $plugin_info = array();
39
40 /**
41 * Version_Control_Upgrader_Skin constructor.
42 *
43 * @param array $options options.
44 * @param array $plugin_info plugin info.
45 */
46 public function __construct( $options, $plugin_info = array() ) {
47 $this->plugin_info = $plugin_info;
48
49 parent::__construct( $options );
50 }
51
52
53 /**
54 * Feedback
55 *
56 * @param string $string string value.
57 * @param mixed ...$args Optional text replacements.
58 */
59 public function feedback( $string, ...$args ) {
60 // keep it quiet.
61 }
62
63 /**
64 * Get error.
65 *
66 * @param string|WP_Error $errors found errors.
67 */
68 public function error( $errors ) {
69 if ( is_wp_error( $errors ) && $errors->has_errors() ) {
70 foreach ( $errors->get_error_messages() as $error_message ) {
71 $this->errors[] = $error_message;
72 }
73 }
74 }
75
76 /**
77 * Action to perform following an update.
78 *
79 * @since 2.8.0
80 */
81 public function after() {
82 if ( count( $this->errors ) > 0 ) {
83 header( 'Content-Type: text/plain-text' );
84
85 echo join( ',', $this->errors );
86 die();
87 }
88 }
89
90 /**
91 * Displays a form to the user to request for their FTP/SSH details in order
92 * to connect to the filesystem.
93 *
94 * @param bool|WP_Error $error Optional. Whether the current request has failed to connect,
95 * or an error object. Default false.
96 * @param string $context Optional. Full path to the directory that is tested
97 * for being writable. Default empty.
98 * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
99 *
100 * @return bool True on success, false on failure.
101 * @since 4.6.0 The `$context` parameter default changed from `false` to an empty string.
102 *
103 * @see request_filesystem_credentials()
104 *
105 * @since 2.8.0
106 */
107 public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
108 return true;
109 }
110
111 /**
112 * Header
113 */
114 public function header() {
115 // keep it quiet.
116 }
117
118 /**
119 * Footer
120 */
121 public function footer() {
122 // keep it quiet.
123 }
124 }
125