public function pre_set_site_transient_update_themes($data)
 {
     //
     // Only run after other themes are checked.
     //
     if (empty($data->checked)) {
         return $data;
     }
     Themeco_Update_Api::refresh();
     $update_cache = Themeco_Update_Api::get_update_cache();
     if (!isset($update_cache['themes']) || !isset($update_cache['themes']['x'])) {
         return $data;
     }
     $themes = is_multisite() ? $this->multisite_get_themes() : wp_get_themes();
     if (isset($themes['x'])) {
         $remote = $update_cache['themes']['x'];
         if (version_compare($remote['new_version'], $themes['x']->get('Version'), '<=')) {
             return $data;
         }
         if (!$remote['package']) {
             $remote['new_version'] = $remote['new_version'] . '<br/>' . X_Update_API::get_validation_html_theme_updates();
         }
         $data->response['x'] = $remote;
     }
     return $data;
 }
 public function pre_set_site_transient_update_plugins($data)
 {
     //
     // Only run after other plugins are checked.
     //
     if (empty($data->checked)) {
         return $data;
     }
     Themeco_Update_Api::refresh();
     $update_cache = Themeco_Update_Api::get_update_cache();
     if (!isset($update_cache['plugins']) || empty($update_cache['plugins'])) {
         return $data;
     }
     include_once ABSPATH . '/wp-admin/includes/plugin.php';
     $installed_plugins = get_plugins();
     foreach ((array) $installed_plugins as $plugin_file => $local) {
         // Only check plugins in the Themeco update cache
         if (!isset($update_cache['plugins'][$plugin_file])) {
             continue;
         }
         $remote = $update_cache['plugins'][$plugin_file];
         // Version check
         if (version_compare($remote['new_version'], $local['Version'], '<=')) {
             continue;
         }
         if (!$remote['package']) {
             $remote['upgrade_notice'] = X_Update_API::get_validation_html_plugin_updates();
         }
         $data->response[$plugin_file] = (object) $remote;
     }
     return $data;
 }
function x_addons_product_validation()
{
    if (isset($_POST['validate']) && check_admin_referer('x-addons-product-validation')) {
        if (strip_tags($_POST['x_addons_product_validation_submitted']) == 'submitted') {
            $name = x_addons_get_api_key_option_name();
            $input = strip_tags($_POST[$name]);
            if (isset($input) && $input == '') {
                delete_option($name);
                Themeco_Update_Api::refresh();
                echo '<div class="updated"><p>' . __('API key removed successfully!', '__x__') . '</p></div>';
            } else {
                $validation = X_Update_API::validate_key($input);
                if ($validation['valid']) {
                    update_option($name, $input);
                    echo '<div class="updated"><p>' . $validation['message'] . '</p></div>';
                } else {
                    delete_option($name);
                    echo '<div class="error"><p>' . $validation['message'] . '</p></div>';
                    if (isset($_GET['x-verbose']) && $_GET['x-verbose'] == 1) {
                        x_dump($validation['verbose'], 350, 'var_dump');
                    }
                }
            }
        }
    }
}
 public static function get_cached_addons()
 {
     if (false === ($addons = get_site_option('x_extension_list', false))) {
         Themeco_Update_Api::refresh();
         if (false === ($addons = get_site_option('x_extension_list', false))) {
             return array('error' => true, 'message' => __('Could not retrieve extensions list. For assistance, please start by reviewing our article on troubleshooting <a href="https://community.theme.co/kb/connection-issues/">connection issues.</a>', '__x__'), 'verbose' => Themeco_Update_Api::get_errors());
         }
     }
     return $addons;
 }
 public static function refresh($force = false)
 {
     if (!is_admin()) {
         return false;
     }
     if (!isset(self::$instance)) {
         self::$instance = new self();
     }
     self::$instance->update($force);
     return true;
 }