/** * Envato Upgrader Theme Update */ function grve_envato_toolkit_update() { if (isset($_GET['grve-theme-update']) && 'update' == $_GET['grve-theme-update']) { if (is_super_admin() && 1 == grve_option('update_enabled')) { $envato_username = grve_option('update_user_name'); $envato_api_key = grve_option('update_api_key'); if (empty($envato_username) || empty($envato_api_key)) { return; } else { $upgrader = new Envato_WordPress_Theme_Upgrader($envato_username, $envato_api_key); $update_response = $upgrader->upgrade_theme(GRVE_THEME_NAME); } wp_safe_redirect(esc_url(remove_query_arg('grve-theme-update'))); } } }
function update_theme() { if (isset($_REQUEST['page'])) { // Sanitize page being requested. $_page = esc_attr($_REQUEST['page']); if ('spyropress-update' == $_page) { //Setup Filesystem $method = get_filesystem_method(); if (isset($_POST['spyropress_ftp_cred'])) { $cred = spyropress_decode($_POST['spyropress_ftp_cred']); $filesystem = WP_Filesystem($cred); } else { $filesystem = WP_Filesystem(); } if (false == $filesystem && 'Proceed' != $_POST['upgrade']) { add_error_message(sprintf(__('Failed: Filesystem preventing downloads. (%s)', 'spyropress'), $method)); return; } if (isset($_REQUEST['spyropress_updater'])) { // Sanitize action being requested. $_action = esc_attr($_REQUEST['spyropress_updater']); if ('framework' == $_action) { locate_template('framework/utilities/envato/class-envato-wordpress-theme-upgrader.php', true); $envato_api_key = get_option('_spyropress_envato_api_key_' . get_internal_name()); $envato_username = get_option('_spyropress_envato_username_' . get_internal_name()); $upgrader = new Envato_WordPress_Theme_Upgrader($envato_username, $envato_api_key); $result = $upgrader->upgrade_theme(); // Successfully Updated if ($result->success) { $message = __('New version successfully downloaded, extracted and updated.', 'spyropress'); $message .= '<script type="text/javascript"> //<![CDATA[ window.location.replace("' . admin_url('admin.php?page=spyropress-update') . '"); //]]> </script>'; add_success_message($message); } else { add_error_message($result->errors[0]); } } } } // END UPDATE HERE } }
function ct_on_admin_init() { // if there is a submit to update theme if (isset($_POST['ct_update_theme'])) { $envato_username = ot_get_option('envato_username', ''); $envato_api = ot_get_option('envato_api', ''); // if user has entered username and api if ($envato_username != '' && $envato_api != '') { // include the library require_once locate_template('/inc/plugins/envato-wordpress-toolkit/class-envato-wordpress-theme-upgrader.php'); $upgrader = new Envato_WordPress_Theme_Upgrader($envato_username, $envato_api); $upgrader->upgrade_theme(PARENT_THEME); add_action('admin_notices', 'ct_admin_notice_theme_updated'); } //add_action( 'admin_notices', 'ct_admin_notice_theme_updated' ); } else { // if Auto Update is set if (ot_get_option('envato_auto_update') == 'on') { $envato_username = ot_get_option('envato_username', ''); $envato_api = ot_get_option('envato_api', ''); // if user has entered username and api if ($envato_username != '' && $envato_api != '') { // include the library require_once locate_template('/inc/plugins/envato-wordpress-toolkit/class-envato-wordpress-theme-upgrader.php'); $upgrader = new Envato_WordPress_Theme_Upgrader($envato_username, $envato_api); if (ct_check_for_update(PARENT_THEME) == 1) { $upgrader->upgrade_theme(PARENT_THEME); add_action('admin_notices', 'ct_admin_notice_theme_updated'); } } } } }
function themeva_theme_update() { // Check AJAX Referer check_ajax_referer('_theme_options', '_ajax_nonce'); ob_start(); include_once NV_FILES . '/adm/inc/theme-updates/class-envato-wordpress-theme-upgrader.php'; $upgrader = new Envato_WordPress_Theme_Upgrader(of_get_option('tf_username'), of_get_option('tf_apikey')); $upgrader->upgrade_theme(wp_get_theme()->Name); ob_end_clean(); _e('<strong>Update Complete.</strong> You\'re now using the latest version of the theme. Please wait whilst the page reloads.', 'themeva-admin'); die; }
/** * Update theme. * */ function presscore_theme_update() { if (isset($_GET['theme-updater']) && 'update' == $_GET['theme-updater']) { // global timestamp global $dt_lang_backup_dir_timestamp; $user = of_get_option('theme_update-user_name', ''); $api_key = of_get_option('theme_update-api_key', ''); $dt_lang_backup_dir_timestamp = time(); // backup lang files add_filter('upgrader_pre_install', 'presscore_before_theme_update', 10, 2); // restore lang files add_filter('upgrader_post_install', 'presscore_after_theme_update', 10, 3); $upgrader = new Envato_WordPress_Theme_Upgrader($user, $api_key); $responce = $upgrader->upgrade_theme(); remove_filter('upgrader_pre_install', 'presscore_before_theme_update', 10, 2); remove_filter('upgrader_post_install', 'presscore_after_theme_update', 10, 3); unset($dt_lang_backup_dir_timestamp); set_transient('presscore_update_result', $responce, 10); if ($responce) { wp_safe_redirect(add_query_arg('theme-updater', 'updated', remove_query_arg('theme-updater'))); } else { wp_safe_redirect(remove_query_arg('theme-updater')); } // regenrate stylesheets after succesful update } else { if (isset($_GET['theme-updater']) && 'updated' == $_GET['theme-updater'] && get_transient('presscore_update_result')) { add_settings_error('options-framework', 'theme_updated', _x('Stylesheets regenerated.', 'backend', LANGUAGE_ZONE), 'updated fade'); } } }
function rockthemes_to_them_update_start_update($data) { // include the library include_once OPTIONS_DIR . '/envato-wordpress-toolkit-library/class-envato-wordpress-theme-upgrader.php'; $upgrader = new Envato_WordPress_Theme_Upgrader($data['username'], $data['user_api_key']); /* * Uncomment to check if the current theme has been updated */ //return $upgrader->check_for_theme_update(); /* * Uncomment to update the current theme */ $is_updated = $upgrader->upgrade_theme(); //var_dump($is_updated); //echo $is_updated; return $is_updated; }
function ct_do_update_theme() { $envato_username = ot_get_option('envato_username', ''); $envato_api = ot_get_option('envato_api', ''); // if user has entered username and api if ($envato_username != '' && $envato_api != '') { // include the library require_once locate_template('/inc/plugins/envato-wordpress-toolkit/class-envato-wordpress-theme-upgrader.php'); $upgrader = new Envato_WordPress_Theme_Upgrader($envato_username, $envato_api); $upgrader->upgrade_theme(PARENT_THEME); add_action('admin_notices', 'ct_admin_notice_theme_updated'); } }
function wpGrade_set_update_functionality() { global $wpGrade_Options, $wpGrade_data; if ($wpGrade_Options->get('themeforest_upgrade') && isset($_GET['wpGrade_update']) && $_GET['wpGrade_update'] == 'true') { $theme_data = wp_get_theme(); $theme_name = $theme_data->Name; $allow_cache = true; // include the library include_once 'vendor/envato-wtl/class-envato-wordpress-theme-upgrader.php'; $marketplace_username = $wpGrade_Options->get('marketplace_username'); $marketplace_api_key = $wpGrade_Options->get('marketplace_api_key'); if (!empty($marketplace_username) && !empty($marketplace_api_key)) { if (in_array('curl', get_loaded_extensions())) { //cURL is enabled, the Envato Toolkit uses cURL, so the update can be performed $upgrader = new Envato_WordPress_Theme_Upgrader($marketplace_username, $marketplace_api_key); $upgrader->check_for_theme_update($theme_name, $allow_cache); $res = $upgrader->upgrade_theme($theme_name, $allow_cache); $success = $res->success; $wpGrade_data->theme_updated = $success; } else { $wpGrade_data->curl_disabled = true; } } } }
function pp_update_theme() { if (is_admin()) { include_once get_template_directory() . '/modules/envato-wordpress-toolkit-library/class-envato-wordpress-theme-upgrader.php'; $pp_envato_username = get_option('pp_envato_username'); $pp_envato_api_key = get_option('pp_envato_api_key'); if (!empty($pp_envato_username) && !empty($pp_envato_api_key)) { $upgrader = new Envato_WordPress_Theme_Upgrader($pp_envato_username, $pp_envato_api_key); $upgrader_obj = $upgrader->check_for_theme_update(); if ($upgrader_obj->updated_themes_count > 0) { $result = $upgrader->upgrade_theme(); echo $result->installation_feedback; } else { echo 'There is no theme update available'; } } else { echo 'Please enter Envato username and API Key'; } } }
/** * Description here. * */ function presscore_theme_update() { if (isset($_GET['theme-updater']) && 'update' == $_GET['theme-updater']) { $user = of_get_option('theme_update-user_name', ''); $api_key = of_get_option('theme_update-api_key', ''); $upgrader = new Envato_WordPress_Theme_Upgrader($user, $api_key); $responce = $upgrader->upgrade_theme(); set_transient('presscore_update_result', $responce, 10); wp_safe_redirect(remove_query_arg('theme-updater')); } }
function on_admin_init() { // include the library include_once 'library/class-envato-wordpress-theme-upgrader.php'; $upgrader = new Envato_WordPress_Theme_Upgrader(ot_get_option('tf_user'), ot_get_option('tf_api')); $upgrader->check_for_theme_update(); $upgrader->upgrade_theme(); }