????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.astacus.eu/wp-content/themes/Avada/includes/patcher/ |
Upload File : |
<?php
// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Direct script access denied.' );
}
/**
* Handles writing patches to the filesystem.
*
* @since 4.0.0
*/
class Avada_Patcher_Filesystem {
/**
* Is this for the avada theme, or the fusion-core plugin?
*
* @static
* @access public
* @var string
*/
public static $target = 'avada';
/**
* The remote source.
*
* @static
* @access public
* @var null|string
*/
public static $source = null;
/**
* The path of the target.
*
* @static
* @access public
* @var null|string
*/
public static $destination = null;
/**
* Whether the file-writing was successful or not.
*
* @access public
* @var bool
*/
public $status = false;
/**
* Constructor.
*
* @access public
* @param string $target The context (avada/fusion-core/fusion-builder).
* @param string|null $source The remote source.
* @param string|null $destination The destination path.
*/
public function __construct( $target = 'avada', $source = null, $destination = null ) {
if ( is_null( $source ) || is_null( $destination ) ) {
return;
}
self::$target = $target;
self::$source = $source;
self::$destination = $destination;
// Instantiate the WordPress filesystem.
$this->init_filesystem();
// Write the source contents to the destination.
$this->write_file();
}
/**
* Make sure the WordPress Filesystem class in properly instatiated.
*
* @access public
* @return void
*/
public function init_filesystem() {
global $wp_filesystem;
if ( empty( $wp_filesystem ) ) {
require_once( ABSPATH . '/wp-admin/includes/file.php' );
WP_Filesystem();
}
}
/**
* Get remote contents
*
* @access public
* @param string $url The URL we're getting our data from.
* @return false|string The contents of the remote URL, or false if we can't get it.
*/
public function get_remote( $url ) {
$response = wp_remote_get( $url );
if ( is_array( $response ) ) {
return $response['body'];
}
// Add a message so that the user knows what happened.
new Avada_Patcher_Admin_Notices( 'no-patch-contents', esc_attr__( 'The Avada patch contents cannot be retrieved. Please contact your host to unblock the "https://gist.github.com/" domain.', 'Avada' ) );
return false;
}
/**
* Write our contents to the destination file.
*
* @access public
* @return bool Returns true if the process was successful, false otherwise.
*/
public function write_file() {
$contents = $this->get_remote( self::$source );
if ( ! $contents ) {
$this->status = false;
// Add a message to users for debugging purposes.
new Avada_Patcher_Admin_Notices( 'patch-empty', esc_attr__( 'Patch empty.', 'Avada' ) );
return false;
}
$target = false;
if ( 'avada' === self::$target ) {
$target = Avada::$template_dir_path;
} elseif ( 'fusion-core' === self::$target && defined( 'FUSION_CORE_PATH' ) ) {
$target = FUSION_CORE_PATH;
} elseif ( 'fusion-builder' === self::$target && defined( 'FUSION_BUILDER_PLUGIN_DIR' ) ) {
$target = FUSION_BUILDER_PLUGIN_DIR;
}
if ( false === $target ) {
$this->status = false;
// Add a message to users for debugging purposes.
new Avada_Patcher_Admin_Notices( 'invalid-patch-target', esc_attr__( 'Invalid Patch target.', 'Avada' ) );
return false;
}
global $wp_filesystem;
$path = wp_normalize_path( $target . '/' . self::$destination );
$this->status = $wp_filesystem->put_contents( $path, $contents, FS_CHMOD_FILE );
if ( ! $this->status ) {
// Add a message to users for debugging purposes.
new Avada_Patcher_Admin_Notices( 'write-permissions-' . md5( $path ), sprintf( esc_attr__( 'Unable to write file %s to the filesystem.', 'Avada' ), $path ) );
}
return $this->status;
}
}