コード例 #1
0
ファイル: updates.php プロジェクト: femgineer/website
 public static function process_server_response($response, $cached = false)
 {
     if (empty($response['packages'])) {
         return;
     }
     require_once $GLOBALS['ithemes_updater_path'] . '/keys.php';
     require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
     $keys = array();
     foreach ($response['packages'] as $package => $data) {
         if (isset($data['key'])) {
             $keys[$package] = $data['key'];
         } else {
             if (isset($data['status']) && 'inactive' == $data['status']) {
                 $keys[$package] = '';
             }
         }
     }
     Ithemes_Updater_Keys::set($keys);
     $details = Ithemes_Updater_Packages::get_full_details($response);
     $updates = array('update_themes' => array(), 'update_plugins' => array(), 'expiration' => $details['expiration']);
     if (!$cached) {
         $updates['timestamp'] = time();
     }
     if (isset($response['timeout_multiplier'])) {
         $updates['timeout-multiplier'] = $response['timeout_multiplier'];
     }
     if (!isset($updates['timeout-multiplier']) || $updates['timeout-multiplier'] < 1) {
         $updates['timeout-mulitplier'] = 1;
     } else {
         if ($updates['timeout-multiplier'] > 10) {
             $updates['timeout-mulitplier'] = 10;
         }
     }
     $use_ssl = $GLOBALS['ithemes-updater-settings']->get_option('use_ssl');
     foreach ($details['packages'] as $path => $data) {
         if (empty($data['package-url']) || version_compare($data['installed'], $data['available'], '>=')) {
             continue;
         }
         $force_minor_version_update = $GLOBALS['ithemes-updater-settings']->get_option('force_minor_version_update');
         $quick_releases = $GLOBALS['ithemes-updater-settings']->get_option('quick_releases');
         if (isset($data['upgrade']) && !$data['upgrade'] && !$force_minor_version_update && !$quick_releases) {
             continue;
         }
         if (!$use_ssl) {
             $data['package-url'] = preg_replace('/^https/', 'http', $data['package-url']);
         }
         if ('plugin' == $data['type']) {
             $update = array('id' => 0, 'slug' => dirname($path), 'new_version' => $data['available'], 'url' => $data['info-url'], 'package' => $data['package-url']);
             $update = (object) $update;
         } else {
             $update = array('new_version' => $data['available'], 'url' => self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . dirname($path) . '&section=changelog&TB_iframe=true&width=600&height=800'), 'package' => $data['package-url']);
             $path = dirname($path);
         }
         $updates["update_{$data['type']}s"][$path] = $update;
     }
     $GLOBALS['ithemes-updater-settings']->update_options($updates);
 }
コード例 #2
0
 public static function get_plugin_information($path)
 {
     require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
     $details = Ithemes_Updater_Packages::get_full_details();
     if (!isset($details['packages'][$path])) {
         return false;
     }
     $package = $details['packages'][$path];
     require_once $GLOBALS['ithemes_updater_path'] . '/functions.php';
     require_once $GLOBALS['ithemes_updater_path'] . '/information.php';
     $changelog = Ithemes_Updater_API::get_package_changelog($package['package'], $details['packages'][$path]['installed']);
     $info = array('name' => Ithemes_Updater_Functions::get_package_name($package['package']), 'slug' => dirname($path), 'version' => $package['available'], 'author' => '<a href="http://ithemes.com/">iThemes</a>', 'download_link' => $package['package-url'], 'sections' => array('changelog' => $changelog));
     return (object) $info;
 }
コード例 #3
0
ファイル: information.php プロジェクト: khuonggau/pixel
 public static function get_plugin_information($path)
 {
     require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
     $details = Ithemes_Updater_Packages::get_full_details();
     if (!isset($details['packages'][$path])) {
         return false;
     }
     $package = $details['packages'][$path];
     $url = "http://package-info.ithemes.com/{$package['package']}/information.json";
     $response = wp_remote_get($url);
     if (!is_wp_error($response) && isset($response['body'])) {
         $info = json_decode($response['body']);
         if (is_object($info) && !empty($info->name) && !empty($info->version)) {
             $info->slug = dirname($path);
             $info->download_link = $package['package-url'];
             return $info;
         }
     }
     require_once $GLOBALS['ithemes_updater_path'] . '/functions.php';
     require_once $GLOBALS['ithemes_updater_path'] . '/information.php';
     $changelog = Ithemes_Updater_API::get_package_changelog($package['package'], $details['packages'][$path]['installed']);
     $info = array('name' => Ithemes_Updater_Functions::get_package_name($package['package']), 'slug' => dirname($path), 'version' => $package['available'], 'author' => '<a href="http://ithemes.com/">iThemes</a>', 'download_link' => $package['package-url'], 'sections' => array('changelog' => $changelog));
     return (object) $info;
 }
コード例 #4
0
ファイル: admin.php プロジェクト: jimrucinski/Vine
 private function set_package_details()
 {
     if (false !== $this->package_details) {
         return;
     }
     require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
     $this->package_details = Ithemes_Updater_Packages::get_local_details();
 }
コード例 #5
0
ファイル: api.php プロジェクト: jimlongo56/rdiv
 private static function get_request_package_details($desired_packages = array())
 {
     require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
     require_once $GLOBALS['ithemes_updater_path'] . '/keys.php';
     $all_packages = Ithemes_Updater_Packages::get_local_details();
     reset($desired_packages);
     if (empty($desired_packages)) {
         $desired_packages = $all_packages;
     } else {
         if (is_numeric(key($desired_packages))) {
             $new_desired_packages = array();
             foreach ($all_packages as $path => $details) {
                 foreach ($desired_packages as $package) {
                     if ($package != $details['package']) {
                         continue;
                     }
                     $new_desired_packages[$path] = $details;
                     break;
                 }
             }
             $desired_packages = $new_desired_packages;
         }
     }
     $packages = array();
     $keys = Ithemes_Updater_Keys::get();
     $package_slugs = array();
     foreach ($desired_packages as $data) {
         $package_slugs[] = $data['package'];
     }
     $legacy_keys = Ithemes_Updater_Keys::get_legacy($package_slugs);
     $active_themes = array('stylesheet' => get_stylesheet_directory(), 'template' => get_template_directory());
     $active_themes = array_unique($active_themes);
     foreach ($active_themes as $index => $path) {
         $active_themes[$index] = basename($path);
     }
     foreach ($desired_packages as $path => $data) {
         $key = isset($keys[$data['package']]) ? $keys[$data['package']] : '';
         $package = array('ver' => $data['installed'], 'key' => $key);
         if (!empty($legacy_keys[$data['package']])) {
             $package['old-key'] = $legacy_keys[$data['package']];
         }
         if ('plugins' == $data['type']) {
             $package['active'] = (int) is_plugin_active($path);
         } else {
             $dir = dirname($path);
             $package['active'] = (int) in_array($dir, $active_themes);
             if ($package['active'] && count($active_themes) > 1) {
                 if ($dir == $active_themes['stylesheet']) {
                     $package['child-theme'] = 1;
                 } else {
                     $package['parent-theme'] = 1;
                 }
             }
         }
         $package_key = $data['package'];
         $counter = 0;
         while (isset($packages[$package_key])) {
             $package_key = "{$data['package']} ||| " . ++$counter;
         }
         $packages[$package_key] = $package;
     }
     if (!empty($legacy_keys)) {
         Ithemes_Updater_Keys::delete_legacy(array_keys($legacy_keys));
     }
     return $packages;
 }
コード例 #6
0
 public static function get_legacy($packages = array())
 {
     $data = get_site_option('pluginbuddy_plugins', false);
     if (empty($data) || !is_array($data)) {
         return array();
     }
     $keys = array();
     foreach ($data as $index => $entry) {
         if (!is_object($entry) || empty($entry->slug) || !isset($entry->key)) {
             continue;
         }
         $slug = self::get_legacy_slug($entry->slug);
         $keys[$slug] = $entry->key;
     }
     foreach (array_keys($keys) as $slug) {
         if (!isset($data[$slug])) {
             continue;
         }
         $entry = $data[$slug];
         if (!is_object($entry) || empty($entry->slug) || empty($entry->key)) {
             continue;
         }
         $keys[$slug] = $entry->key;
     }
     if (empty($packages)) {
         require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
         $packages = array_unique(array_values(Ithemes_Updater_Packages::get_all()));
     } else {
         if (is_string($packages)) {
             if (!empty($keys[$packages])) {
                 return $keys[$packages];
             }
             return false;
         }
     }
     $package_keys = array();
     foreach ($packages as $package) {
         if (!empty($keys[$package])) {
             $package_keys[$package] = $keys[$package];
         }
     }
     return $package_keys;
 }
コード例 #7
0
ファイル: settings-page.php プロジェクト: jimlongo56/rdiv
    public function list_packages($action, $post_data)
    {
        require_once $GLOBALS['ithemes_updater_path'] . '/packages.php';
        $details = Ithemes_Updater_Packages::get_full_details();
        $packages = $details['packages'];
        $licensed = array();
        $unlicensed = array();
        $unrecognized = array();
        foreach ($packages as $path => $data) {
            $name = Ithemes_Updater_Functions::get_package_name($data['package']);
            $data['path'] = $path;
            if ('unlicensed' == $data['status']) {
                $unlicensed[$name] = $data;
            } else {
                if (in_array($data['status'], array('active', 'expired'))) {
                    $licensed[$name] = $data;
                } else {
                    $unrecognized[$name] = $data;
                }
            }
        }
        if (!empty($this->messages)) {
            foreach ($this->messages as $message) {
                echo "<div class=\"updated fade\"><p><strong>{$message}</strong></p></div>\n";
            }
        }
        if (!empty($this->errors)) {
            foreach ($this->errors as $error) {
                echo "<div class=\"error\"><p><strong>{$error}</strong></p></div>\n";
            }
        }
        if (!empty($this->soft_errors)) {
            foreach ($this->soft_errors as $error) {
                echo "<div class=\"error\"><p><strong>{$error}</strong></p></div>\n";
            }
        }
        ?>
	<div class="wrap">
		<?php 
        if (version_compare($GLOBALS['wp_version'], '3.7.10', '<=')) {
            screen_icon();
        }
        ?>
		
		<h2><?php 
        _e('iThemes Licensing', 'it-l10n-ithemes-sync');
        ?>
</h2>
		
		<?php 
        $this->list_licensed_products($licensed, $post_data, $action);
        ?>
		
		<?php 
        $this->list_unlicensed_products($unlicensed, $post_data, $action);
        ?>
		
		<?php 
        $this->list_unrecognized_products($unrecognized);
        ?>
		
		<?php 
        $this->show_settings();
        ?>
	</div>
<?php 
    }