????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.191 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/ |
Upload File : |
<?php
// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Direct script access denied.' );
}
/**
* Demos importer.
*/
class Fusion_Builder_Demos_Importer {
/**
* The remote API URL.
*
* @static
* @access private
* @since 5.0.0
* @var string
*/
private static $remote_api_url = 'http://updates.theme-fusion.com/avada_demo/?fusion_builder_demos=1&compressed=1';
/**
* The demo we want to import.
*
* @access private
* @since 5.0.0
* @var string
*/
private $demo = '';
/**
* The Remote URL of the file containing the demo pages.
*
* @access private
* @since 5.0.0
* @var string
*/
private $demo_remote_url = '';
/**
* The path to the demo file locally.
*
* @access private
* @since 5.0.0
* @var string
*/
private $local_demo_path = '';
/**
* The class constructor.
*
* @access public
* @since 5.0.0
* @param string $demo The demo slug.
*/
public function __construct( $demo ) {
// Set $this->demo.
$this->demo = $demo;
// Set the local path for this demo.
$this->local_demo_path = $this->get_local_demo_path();
}
/**
* Get the local demo path.
* If the path doesn't exist, it creates the folder for that path.
*
* @access private
* @since 5.0.0
* @return string
*/
private function get_local_demo_path() {
// Get the basedir.
$wp_upload_dir = wp_upload_dir();
$basedir = $wp_upload_dir['basedir'];
// Build the path to the parent folder.
// If the folder doesn't exist, create it.
$parent_folder = wp_normalize_path( $basedir . '/fusion-builder-avada-pages' );
if ( ! file_exists( $parent_folder ) ) {
wp_mkdir_p( $parent_folder );
}
$path = wp_normalize_path( $parent_folder . '/' . str_replace( 'avada-', '', $this->demo . '.php' ) );
if ( ! file_exists( $path ) ) {
$this->get_file_path();
}
return $path;
}
/**
* Gets the path to the file containing the data.
* We're first checking if the data exists locally.
* If the file doesn't exist, then we'll need to get it remotely first.
*
* @access public
* @since 5.0.0
* @return string
*/
public function get_file_path() {
// If Avada is not properly registered, return false.
if ( ! Avada()->registration->is_registered() ) {
return false;
}
// If the file doesn't exist, then we need to get it remotely.
if ( ! file_exists( $this->local_demo_path ) ) { /* TODO: if ( ! file_exists( $this->local_demo_path ) || WEEK_IN_SECONDS < time() - filemtime( $this->local_demo_path ) ) { */
$wp_upload_dir = wp_upload_dir();
$zip_folder_path = wp_normalize_path( $wp_upload_dir['basedir'] . '/fusion-builder-avada-pages/' );
$zip_file_path = wp_normalize_path( $zip_folder_path . 'data.zip' );
$response = avada_wp_get_http( self::$remote_api_url, $zip_file_path );
// Initialize the Wordpress filesystem.
global $wp_filesystem;
if ( empty( $wp_filesystem ) ) {
require_once( ABSPATH . '/wp-admin/includes/file.php' );
WP_Filesystem();
}
$unzipfile = unzip_file( $zip_file_path, $zip_folder_path );
if ( ! $unzipfile ) {
return false;
}
}
if ( file_exists( $this->local_demo_path ) ) {
return $this->local_demo_path;
}
return false;
}
}