PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
← All changes | src/helper/class-file.php +3 -2 5.4.1 → 6.3.0 View file →
@@ -7,8 +7,9 @@
7 7
8 8 namespace WP_Defender\Helper;
9 9
10 10 use WP_Error;
11 +use WP_Filesystem_Base;
11 12
12 13 /**
13 14 * Handles file related tasks.
14 15 */
@@ -50,9 +51,9 @@
50 51 */
51 52 public function maybe_dir_access_deny( string $directory ) {
52 53 global $wp_filesystem;
53 54 // Initialize the WP filesystem, no more using 'file-put-contents' function.
54 - if ( empty( $wp_filesystem ) ) {
55 + if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
55 56 require_once ABSPATH . '/wp-admin/includes/file.php';
56 57 WP_Filesystem();
57 58 }
58 59 $files = array(
@@ -69,9 +70,9 @@
69 70 );
70 71
71 72 foreach ( $files as $file ) {
72 73 $file_path = trailingslashit( $file['base'] ) . $file['file'];
73 - if ( ! is_null( $file_path ) && ! file_exists( $file_path ) ) {
74 + if ( ! file_exists( $file_path ) ) {
74 75 $wp_filesystem->put_contents( $file_path, $file['content'] );
75 76 }
76 77 }
77 78 }