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 | framework/base/class-file.php +11 -9 5.4.0 → 6.3.0 View file →
@@ -158,9 +158,9 @@
158 158 $directory_flag = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO
159 159 | FilesystemIterator::UNIX_PATHS | FilesystemIterator::SKIP_DOTS;
160 160 $directory = new RecursiveDirectoryIterator( $path, $directory_flag );
161 161
162 - if ( ! empty( $this->include ) || ! empty( $this->exclude ) ) {
162 + if ( array() !== $this->include || array() !== $this->exclude ) {
163 163 $directory = new RecursiveCallbackFilterIterator(
164 164 $directory,
165 165 array(
166 166 &$this,
@@ -184,9 +184,9 @@
184 184 continue;
185 185 }
186 186 if ( false === $this->is_recursive ) {
187 187 // Have to filter this, for un recursive.
188 - if ( ! empty( $this->include ) || ! empty( $this->exclude ) ) {
188 + if ( array() !== $this->include || array() !== $this->exclude ) {
189 189 if ( false === $this->filter_directory( $real_path ) ) {
190 190 continue;
191 191 }
192 192 }
@@ -246,9 +246,9 @@
246 246 if ( 'dir' === $type ) {
247 247 $real_path .= DIRECTORY_SEPARATOR;
248 248 }
249 249
250 - if ( ( ! empty( $this->include ) || ! empty( $this->exclude ) ) && ( false === $this->filter_directory(
250 + if ( ( array() !== $this->include || array() !== $this->exclude ) && ( false === $this->filter_directory(
251 251 $real_path,
252 252 $type
253 253 ) ) ) {
254 254 continue;
@@ -296,10 +296,10 @@
296 296 $path = rtrim( $path, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR;
297 297 $data = array();
298 298 $dh = opendir( $path );
299 299 if ( $dh ) {
300 - // Assignment in condition is for comparison.
301 - while ( ( $file = readdir( $dh ) ) !== false ) { // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
300 + $file = readdir( $dh );
301 + while ( false !== $file ) {
302 302 if ( '.' === $file || '..' === $file ) {
303 303 continue;
304 304 }
305 305 $real_path = $path . $file;
@@ -307,9 +307,9 @@
307 307 // Hidden files, move on.
308 308 continue;
309 309 }
310 310
311 - if ( ( ! empty( $this->include ) || ! empty( $this->exclude ) ) && ( false === $this->filter_directory( $real_path ) ) ) {
311 + if ( ( array() !== $this->include || array() !== $this->exclude ) && ( false === $this->filter_directory( $real_path ) ) ) {
312 312 continue;
313 313 }
314 314
315 315 $type = filetype( $real_path );
@@ -335,8 +335,9 @@
335 335 $tdata = $this->get_dir_tree_by_open_dir( $real_path );
336 336 $data = array_merge( $data, $tdata );
337 337 }
338 338 }
339 + $file = readdir( $dh );
339 340 }
340 341 closedir( $dh );
341 342 }
342 343
@@ -351,11 +352,11 @@
351 352 *
352 353 * @return bool|void
353 354 */
354 355 public function filter_directory( $current, $filetype = null ) {
355 - if ( ! empty( $this->include ) ) {
356 + if ( array() !== $this->include ) {
356 357 return $this->filter_include( $current, $filetype );
357 - } elseif ( ! empty( $this->exclude ) ) {
358 + } elseif ( array() !== $this->exclude ) {
358 359 return $this->filter_exclude( $current, $filetype );
359 360 }
360 361 }
361 362
@@ -415,9 +416,10 @@
415 416 // Now filename.
416 417 $filename_include = isset( $include['filename'] ) ? $include['filename'] : array();
417 418 if ( is_array( $filename_include ) && count( $filename_include ) && 'file' === $type ) {
418 419 foreach ( $filename_include as $filename ) {
419 - if ( preg_match( '/' . $filename . '/', pathinfo( $path, PATHINFO_BASENAME ) ) ) {
420 + $pattern = '/' . preg_quote( $filename, '/' ) . '/';
421 + if ( preg_match( $pattern, pathinfo( $path, PATHINFO_BASENAME ) ) ) {
420 422 return true;
421 423 }
422 424 }
423 425 ++$applied;