PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
← All changes | admin/section/class-convertkit-admin-section-tools.php +5 -25 3.3.93.4.3 View file →
@@ -18,12 +18,8 @@
18 18 * Constructor
19 19 */
20 20 public function __construct() {
21 21
22 - // Initialize WP_Filesystem.
23 - require_once ABSPATH . 'wp-admin/includes/file.php';
24 - WP_Filesystem();
25 -
26 22 $this->settings_key = '_wp_convertkit_tools'; // Required for ConvertKit_Settings_Base, but we don't save settings on the Tools screen.
27 23 $this->name = 'tools';
28 24 $this->title = __( 'Tools', 'convertkit' );
29 25 $this->tab_text = __( 'Tools', 'convertkit' );
@@ -124,10 +120,8 @@
124 120 * @since 1.9.6
125 121 */
126 122 private function maybe_download_log() {
127 123
128 - global $wp_filesystem;
129 -
130 124 // Bail if nonce verification fails.
131 125 if ( ! isset( $_REQUEST['_convertkit_settings_tools_nonce'] ) ) {
132 126 return;
133 127 }
@@ -148,9 +142,10 @@
148 142 header( 'Content-type: application/octet-stream' );
149 143 header( 'Content-Disposition: attachment; filename=convertkit-log.txt' );
150 144 header( 'Pragma: no-cache' );
151 145 header( 'Expires: 0' );
152 - echo esc_html( $wp_filesystem->get_contents( $log->get_filename() ) );
146 + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
147 + echo esc_html( (string) file_get_contents( $log->get_filename() ) );
153 148 exit();
154 149
155 150 }
156 151
@@ -161,10 +156,8 @@
161 156 * @since 1.9.6
162 157 */
163 158 private function maybe_download_system_info() {
164 159
165 - global $wp_filesystem;
166 -
167 160 // Bail if nonce verification fails.
168 161 if ( ! isset( $_REQUEST['_convertkit_settings_tools_nonce'] ) ) {
169 162 return;
170 163 }
@@ -180,23 +173,14 @@
180 173
181 174 // Get System Info.
182 175 $system_info = $this->get_system_info();
183 176
184 - // Write contents to temporary file.
185 - $tmpfile = tmpfile();
186 - $filename = stream_get_meta_data( $tmpfile )['uri'];
187 - $wp_filesystem->put_contents(
188 - $filename,
189 - esc_attr( $system_info )
190 - );
191 -
192 177 // Download.
193 178 header( 'Content-type: application/octet-stream' );
194 179 header( 'Content-Disposition: attachment; filename=convertkit-system-info.txt' );
195 180 header( 'Pragma: no-cache' );
196 181 header( 'Expires: 0' );
197 - echo esc_html( $wp_filesystem->get_contents( $filename ) );
198 - $wp_filesystem->delete( $filename );
182 + echo esc_html( $system_info );
199 183 exit();
200 184
201 185 }
202 186
@@ -262,13 +246,8 @@
262 246 if ( ! wp_verify_nonce( sanitize_key( $_REQUEST['_convertkit_settings_tools_nonce'] ), 'convertkit-settings-tools' ) ) {
263 247 return;
264 248 }
265 249
266 - // Allow us to easily interact with the filesystem.
267 - require_once ABSPATH . 'wp-admin/includes/file.php';
268 - WP_Filesystem();
269 - global $wp_filesystem;
270 -
271 250 // Bail if the submit button for importing the configuration was not clicked.
272 251 if ( ! array_key_exists( 'convertkit-import', $_REQUEST ) ) {
273 252 return;
274 253 }
@@ -283,9 +262,10 @@
283 262 $this->redirect_with_error_notice( 'import_configuration_upload_error' );
284 263 }
285 264
286 265 // Read file.
287 - $json = $wp_filesystem->get_contents( sanitize_text_field( wp_unslash( $_FILES['import']['tmp_name'] ) ) );
266 + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
267 + $json = file_get_contents( sanitize_text_field( wp_unslash( $_FILES['import']['tmp_name'] ) ) );
288 268
289 269 // Decode.
290 270 $import = json_decode( $json, true );
291 271