public static function check_for_update_action() { $current_screen = get_current_screen(); if ($current_screen && false !== strpos($current_screen->id, 'of-themeupdate-menu')) { $user = of_get_option('theme_update-user_name', ''); $api_key = of_get_option('theme_update-api_key', ''); if ($user || $api_key) { $upgrader = new Envato_WordPress_Theme_Upgrader($user, $api_key); if ($upgrader) { $responce = $upgrader->check_for_theme_update(); $current_theme = wp_get_theme(); $update_needed = false; //check is current theme up to date if (isset($responce->updated_themes)) { foreach ($responce->updated_themes as $updated_theme) { if ($updated_theme->version == $current_theme->version && $updated_theme->name == $current_theme->name) { $update_needed = true; } } } if (!empty($responce->errors)) { add_settings_error('options-framework', 'update_errors', _x('Error:<br />', 'backend', 'the7mk2') . implode('<br \\>', $responce->errors), 'error'); } else { if ($update_needed) { // changelog link $message = sprintf(_x('New version (<a href="%s" target="_blank">see changelog</a>) of theme is available!', 'backend', 'the7mk2'), presscore_theme_update_get_changelog_url()); // update link $message .= ' <a href="' . esc_url(add_query_arg('theme-updater', 'update')) . '">' . _x('Please, click here to update.', 'backend', 'the7mk2') . '</a>'; add_settings_error('options-framework', 'update_nedded', $message, 'updated'); } else { add_settings_error('options-framework', 'theme_uptodate', _x("You have the most recent version of the theme.", 'backend', 'the7mk2'), 'updated salat'); } } $update_result = get_transient('presscore_update_result'); if ($update_result) { if (!empty($update_result->success)) { add_settings_error('options-framework', 'update_result', _x('Theme was successfully updated to newest version!', 'backend', 'the7mk2'), 'updated salat'); } else { if (!empty($update_result->installation_feedback)) { add_settings_error('options-framework', 'update_result', _x('Error:<br />', 'backend', 'the7mk2') . implode('<br />', $update_result->installation_feedback), 'error'); } } } } } } }
*/ // File Security Check if (!defined('ABSPATH')) { exit; } /** * Page definition. */ $options[] = array("page_title" => _x("Theme Update", 'theme-options', 'the7mk2'), "menu_title" => _x("Theme Update", 'theme-options', 'the7mk2'), "menu_slug" => "of-themeupdate-menu", "type" => "page"); /** * Heading definition. */ $options[] = array("name" => _x('Theme Update', 'theme-options', 'the7mk2'), "type" => "heading"); /** * User credentials. */ $options[] = array("name" => _x('Theme info', 'theme-options', 'the7mk2'), "type" => "block_begin"); // info $options[] = array("id" => 'theme_update-user_name', "type" => 'info', "desc" => sprintf(_x('Activated theme version is %1$s ver. %2$s <a href="%3$s" target="_blank">Install required plugins</a> <a href="%4$s" target="_blank">Check theme changelog</a>', 'theme-options', 'the7mk2'), wp_get_theme()->get('Name'), wp_get_theme()->get('Version'), class_exists('TGM_Plugin_Activation', false) ? esc_url(add_query_arg('page', TGM_Plugin_Activation::$instance->menu, admin_url('admin.php'))) : '#', presscore_theme_update_get_changelog_url())); $options[] = array("type" => "block_end"); /** * User credentials. */ $options[] = array("name" => _x('User credentials', 'theme-options', 'the7mk2'), "type" => "block_begin"); // input $options[] = array("name" => _x('Themeforest user name', 'theme-options', 'the7mk2'), "id" => 'theme_update-user_name', "std" => '', "type" => 'text'); // input $options[] = array("name" => _x('Secret API key', 'theme-options', 'the7mk2'), "id" => 'theme_update-api_key', "std" => '', "type" => 'password'); $options[] = array("type" => "block_end");
*/ // File Security Check if (!defined('ABSPATH')) { exit; } /** * Page definition. */ $options[] = array("page_title" => _x("Theme Update", 'theme-options', 'the7mk2'), "menu_title" => _x("Theme Update", 'theme-options', 'the7mk2'), "menu_slug" => "of-themeupdate-menu", "type" => "page"); /** * Heading definition. */ $options[] = array("name" => _x('Theme Update', 'theme-options', 'the7mk2'), "type" => "heading"); /** * User credentials. */ $options[] = array("name" => _x('Theme info', 'theme-options', 'the7mk2'), "type" => "block_begin"); // info $options[] = array("id" => 'theme_update-user_name', "type" => 'info', "desc" => sprintf(_x('Activated theme version is %1$s ver. %2$s %3$s<a href="%4$s" target="_blank">Check theme changelog</a>', 'theme-options', 'the7mk2'), wp_get_theme()->get('Name'), wp_get_theme()->get('Version'), presscore_theme_update_get_install_plugins_link(), presscore_theme_update_get_changelog_url())); $options[] = array("type" => "block_end"); /** * User credentials. */ $options[] = array("name" => _x('User credentials', 'theme-options', 'the7mk2'), "type" => "block_begin"); // input $options[] = array("name" => _x('Themeforest user name', 'theme-options', 'the7mk2'), "id" => 'theme_update-user_name', "std" => '', "type" => 'text'); // input $options[] = array("name" => _x('Secret API key', 'theme-options', 'the7mk2'), "id" => 'theme_update-api_key', "std" => '', "type" => 'password'); $options[] = array("type" => "block_end");