Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-smush.../core
File: class-file-system.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Smush\Core;
[2] Fix | Delete
[3] Fix | Delete
class File_System {
[4] Fix | Delete
public function file_get_contents( $path, $use_include_path = false, $context = null, $offset = 0, $length = null ) {
[5] Fix | Delete
if ( ! $this->is_valid_path( $path ) ) {
[6] Fix | Delete
return false;
[7] Fix | Delete
}
[8] Fix | Delete
[9] Fix | Delete
$args = array( $path, $use_include_path, $context, $offset );
[10] Fix | Delete
if ( ! is_null( $length ) ) {
[11] Fix | Delete
// Even though the default value of $length is 'null', an empty string is returned when 'null' is passed as $length. So, we only include it when a non-null value is provided.
[12] Fix | Delete
$args[] = $length;
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
return call_user_func_array( 'file_get_contents', $args );
[16] Fix | Delete
}
[17] Fix | Delete
[18] Fix | Delete
public function file_exists( $path ) {
[19] Fix | Delete
return $this->validate_and_call( 'file_exists', $path );
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
public function unlink( $path ) {
[23] Fix | Delete
return $this->validate_and_call( 'unlink', $path );
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
public function copy( $source, $destination ) {
[27] Fix | Delete
return $this->validate_and_call( 'copy', $source, $destination );
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
public function is_file( $file ) {
[31] Fix | Delete
return $this->validate_and_call( 'is_file', $file );
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
public function is_dir( $path ) {
[35] Fix | Delete
return $this->validate_and_call( 'is_dir', $path );
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
public function filesize( $file ) {
[39] Fix | Delete
return $this->validate_and_call( 'filesize', $file );
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
public function getimagesize( $path ) {
[43] Fix | Delete
return $this->validate_and_call( 'getimagesize', $path );
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
private function validate_and_call( $callback, ...$args ) {
[47] Fix | Delete
foreach ( $args as $arg ) {
[48] Fix | Delete
if ( ! $this->is_valid_path( $arg ) ) {
[49] Fix | Delete
return false;
[50] Fix | Delete
}
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
return call_user_func_array( $callback, $args );
[54] Fix | Delete
}
[55] Fix | Delete
[56] Fix | Delete
private function is_valid_path( $path ) {
[57] Fix | Delete
return false === stripos( $path, 'phar://' );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
public function get_wp_filesystem() {
[61] Fix | Delete
global $wp_filesystem;
[62] Fix | Delete
if ( is_null( $wp_filesystem ) ) {
[63] Fix | Delete
// These aren't included when applying a config from the Hub.
[64] Fix | Delete
if ( ! function_exists( 'WP_Filesystem' ) ) {
[65] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/file.php';
[66] Fix | Delete
}
[67] Fix | Delete
WP_Filesystem();
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
return $wp_filesystem;
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function