Exemple #1
0
 /**
  * Loads theme data and configs
  *
  * @return void
  */
 private static function load_theme_data()
 {
     self::$config = self::get_config();
     /*
      * WordPress 3.4 deprecated `get_theme_data()` so we must use
      * `wp_get_theme()` which returns an instance of `WP_Theme`
      */
     if (function_exists('wp_get_theme')) {
         self::$themeData = wp_get_theme();
         self::$themeVersion = self::$themeData->version;
         self::$themeName = self::$themeData->name;
     } else {
         self::$themeData = get_theme_data(get_template_directory() . '/style.css');
         self::$themeVersion = self::$themeData['Version'];
         self::$themeName = self::$config['name'];
     }
     self::$theme_raw_name = basename(get_template_directory());
     self::$themePath = get_template_directory_uri();
     self::$wpzoomPath = self::$themePath . "/functions/wpzoom";
     self::$assetsPath = WPZOOM::$wpzoomPath . '/assets';
     self::$tf = isset(self::$config['tf_url']);
 }
 /**
  * Checks if we are going to make an update and updates current framework to latest version
  */
 public static function update_init()
 {
     global $r;
     if (!isset($_GET['page'])) {
         return;
     }
     $requestedPage = strtolower(strip_tags(trim($_REQUEST['page'])));
     if ($requestedPage != 'wpzoom_update') {
         return;
     }
     $fsmethod = get_filesystem_method();
     $fs = WP_Filesystem();
     if ($fs == false) {
         function framework_update_filesystem_warning()
         {
             $method = get_filesystem_method();
             echo "<p>Failed: Filesystem preventing downloads. ({$method})</p>";
         }
         add_action('admin_notices', 'framework_update_filesystem_warning');
         return;
     }
     if (isset($_POST['wpzoom-update-do'])) {
         $action = strtolower(trim(strip_tags($_POST['wpzoom-update-do'])));
         if ($action == 'update') {
             $fwUrl = 'http://framework.wpzoom.com/wpzoom-framework.zip';
             $fwFile = download_url($fwUrl);
             if (is_wp_error($fwUrl)) {
                 $error = $fwFile->get_error_code();
                 if ($error == 'http_no_url') {
                     $r = "<p>Failed: Invalid URL Provided</p>";
                 } else {
                     $r = "<p>Failed: Upload - {$error}</p>";
                 }
                 function framework_update_warning()
                 {
                     global $r;
                     echo "<p>{$r}</p>";
                 }
                 add_action('admin_notices', 'framework_update_warning');
                 return;
             }
         }
         global $wp_filesystem;
         $to = WPZOOM::get_wpzoom_root();
         $dounzip = unzip_file($fwFile, $to);
         unlink($fwFile);
         if (is_wp_error($dounzip)) {
             $error = $dounzip->get_error_code();
             $data = $dounzip->get_error_data($error);
             if ($error == 'incompatible_archive') {
                 //The source file was not found or is invalid
                 function framework_update_no_archive_warning()
                 {
                     echo "<p>Failed: Incompatible archive</p>";
                 }
                 add_action('admin_notices', 'framework_update_no_archive_warning');
             }
             if ($error == 'empty_archive') {
                 function framework_update_empty_archive_warning()
                 {
                     echo "<p>Failed: Empty Archive</p>";
                 }
                 add_action('admin_notices', 'framework_update_empty_archive_warning');
             }
             if ($error == 'mkdir_failed') {
                 function framework_update_mkdir_warning()
                 {
                     echo "<p>Failed: mkdir Failure</p>";
                 }
                 add_action('admin_notices', 'framework_update_mkdir_warning');
             }
             if ($error == 'copy_failed') {
                 function framework_update_copy_fail_warning()
                 {
                     echo "<p>Failed: Copy Failed</p>";
                 }
                 add_action('admin_notices', 'update_copy_fail_warning');
             }
             return;
         }
         function framework_updated_success()
         {
             echo '<div class="updated fade"><p>New framework successfully downloaded, extracted and updated.</p></div>';
         }
         add_action('admin_notices', 'framework_updated_success');
         remove_action('admin_notices', array('WPZOOM', 'notification'));
         option::delete('framework_status');
         option::set('framework_last_checked', time());
     }
 }
<?php

/**
 * WPZOOM Framework Integration
 */
require_once WPZOOM_INC . "/functions.php";
require_once WPZOOM_INC . "/wpzoom.php";
require_once WPZOOM_INC . "/components/option.php";
/* Initialize WPZOOM Framework */
WPZOOM::init();
/* Only WordPress dashboard needs these files */
if (is_admin()) {
    require_once WPZOOM_INC . "/components/medialib-uploader.php";
    require_once WPZOOM_INC . "/components/admin/admin.php";
    require_once WPZOOM_INC . "/components/admin/settings-fields.php";
    require_once WPZOOM_INC . "/components/admin/settings-interface.php";
    require_once WPZOOM_INC . "/components/admin/settings-page.php";
    require_once WPZOOM_INC . "/components/admin/settings-sanitization.php";
    require_once WPZOOM_INC . "/components/dashboard/dashboard.php";
    require_once WPZOOM_INC . "/components/updater/updater.php";
    require_once WPZOOM_INC . "/components/updater/framework-updater.php";
    require_once WPZOOM_INC . "/components/updater/theme-updater.php";
}
/* Video API */
require_once WPZOOM_INC . "/components/video-api.php";
if (is_admin()) {
    require_once WPZOOM_INC . "/components/video-thumb.php";
}
/* Load get the image file only when it's not installed as a plugin */
if (!function_exists('get_the_image')) {
    require_once WPZOOM_INC . "/components/get-the-image.php";
 public function wpadmin_css()
 {
     wp_enqueue_style('zoom-wp-admin', WPZOOM::get_assets_uri() . '/css/wp-admin.css', array(), WPZOOM::$wpzoomVersion);
 }
<?php

if (!class_exists('WPZOOM')) {
    die;
}
$support_shortcodes = file_exists(WPZOOM::get_wpzoom_root() . '/assets/css/shortcodes.css');
?>
<!doctype html>
<html <?php 
language_attributes();
?>
>
<head>
    <meta charset="<?php 
bloginfo('charset');
?>
" />
</head>
<body>
<div id="wpz-dialog">

<?php 
if ($support_shortcodes) {
    ?>

<div id="wpz-options-buttons" class="clear">
    <div class="alignleft">

        <input type="button" id="wpz-btn-cancel" class="button" name="cancel" value="Cancel" accesskey="C" />

    </div>