function vw_envato_toolkit_check() { if (!class_exists('Envato_WordPress_Theme_Upgrader')) { return; } // Use credentials used in toolkit plugin so that we don't have to show our own forms anymore $credentials = get_option('envato-wordpress-toolkit'); if (empty($credentials['user_name']) || empty($credentials['api_key'])) { add_action('admin_notices', 'vw_envato_toolkit_credentials_admin_notices'); return; } // Check updates only after a while $lastCheck = get_option('vw-last-toolkit-check'); if (false === $lastCheck) { update_option('vw-last-toolkit-check', time()); return; } // Check for an update every ... if (VW_CONST_THEME_UPDATE_CHECKING_PERIOD < time() - $lastCheck) { return; } // Update the time we last checked update_option('vw-last-toolkit-check', time()); // Check for updates $upgrader = new Envato_WordPress_Theme_Upgrader($credentials['user_name'], $credentials['api_key']); $updates = $upgrader->check_for_theme_update(); // If $updates->updated_themes_count == true then we have an update! // Add update alert, to update the theme if ($updates->updated_themes_count) { add_action('admin_notices', 'vw_envato_toolkit_admin_notices'); } }
static function check_for_updates($credentials) { # include the library include_once BW_FRAME_LIB . 'envato-wtl/class-envato-wordpress-theme-upgrader.php'; # Check for updates $upgrader = new Envato_WordPress_Theme_Upgrader($credentials['user_name'], $credentials['api_key']); $updates = $upgrader->check_for_theme_update(); if ($updates->updated_themes_count) { add_action('admin_notices', array('Bw_updater', 'admin_notices_download_update')); } }
/** * Envato Upgrader Check for updates */ function grve_envato_toolkit_update_check() { if (is_super_admin() && 1 == grve_option('update_enabled')) { $envato_username = grve_option('update_user_name'); $envato_api_key = grve_option('update_api_key'); $show_admin_notice = false; if (empty($envato_username) || empty($envato_api_key)) { $message = __("To enable theme update notifications, please enter your Envato Marketplace credentials via:", GRVE_THEME_TRANSLATE) . " " . __("Theme Options - Theme Update", GRVE_THEME_TRANSLATE); $message_id = 'theme_update_error'; $message_type = 'error'; $show_admin_notice = true; } else { $current_screen = get_current_screen(); if ('themes' == $current_screen->id || 'toplevel_page_grve_options' == $current_screen->id) { // Check for updates $upgrader = new Envato_WordPress_Theme_Upgrader($envato_username, $envato_api_key); $updates = $upgrader->check_for_theme_update(GRVE_THEME_NAME); $current_theme = wp_get_theme(GRVE_THEME_SHORT_NAME); $update_needed = false; //check is current theme up to date if (isset($updates->updated_themes)) { foreach ($updates->updated_themes as $updated_theme) { if ($updated_theme->version == $current_theme->version && $updated_theme->name == $current_theme->name) { $update_needed = true; } } } if (!empty($updates->errors)) { $message = __("Theme Updater Error:", GRVE_THEME_TRANSLATE) . implode('<br \\>', $updates->errors); $message_id = 'theme_update_error'; $message_type = 'error'; $show_admin_notice = true; } else { if ($update_needed) { $change_log_url = "http://greatives.eu/themes/updates/osmosis/"; $message = __("New version of Osmosis theme is available!", GRVE_THEME_TRANSLATE) . " " . __("View", GRVE_THEME_TRANSLATE) . " " . "<a href='" . $change_log_url . "' target='_blank'>" . __("changelog", GRVE_THEME_TRANSLATE) . "</a>.<br/>" . __("It is recommended to make a backup before performing an update.", GRVE_THEME_TRANSLATE) . "<br/>" . __("To update click", GRVE_THEME_TRANSLATE) . " " . "<a href='" . admin_url() . "themes.php?theme=" . GRVE_THEME_SHORT_NAME . "&grve-theme-update=update'>" . __("here", GRVE_THEME_TRANSLATE) . "</a>."; $message_id = 'theme_update_available'; $message_type = 'updated'; $show_admin_notice = true; } } } } if ($show_admin_notice) { add_settings_error('grve-theme-update-message', esc_attr($message_id), $message, $message_type); } } }
/** * Check for theme update. * */ function presscore_check_for_update() { $current_screen = get_current_screen(); if ('theme-options_page_of-themeupdate-menu' == $current_screen->id) { $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('theme-update', 'update_errors', _x('Error:<br />', 'backend', LANGUAGE_ZONE) . 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', LANGUAGE_ZONE), 'http://the7.dream-demo.com/changelog.txt'); // update link $message .= ' <a href="' . add_query_arg('theme-updater', 'update') . '">' . _x('Please, click here to update.', 'backend', LANGUAGE_ZONE) . '</a>'; add_settings_error('theme-update', 'update_nedded', $message, 'updated'); } else { add_settings_error('theme-update', 'theme-uptodate', _x("You're have most recent version of theme!", 'backend', LANGUAGE_ZONE), 'updated salat'); } } $update_result = get_transient('presscore_update_result'); if ($update_result) { if (!empty($update_result->success)) { add_settings_error('theme-update', 'update_result', _x('Theme was successfully updated to newest version!', 'backend', LANGUAGE_ZONE), 'updated salat'); } else { if (!empty($update_result->installation_feedback)) { add_settings_error('theme-update', 'update_result', _x('Error:<br />', 'backend', LANGUAGE_ZONE) . implode('<br />', $update_result->installation_feedback), 'error'); } } } } } } }
/** * Load the Envato WordPress Toolkit Library check for updates * and direct the user to the Toolkit Plugin if there is one */ function envato_toolkit_admin_init() { // Include the Toolkit Library include_once IRON_PARENT_DIR . '/includes/envato-wordpress-toolkit-library/class-envato-wordpress-theme-upgrader.php'; // Use credentials used in toolkit plugin so that we don't have to show our own forms anymore $credentials = get_option('envato-wordpress-toolkit'); if (empty($credentials['user_name']) || empty($credentials['api_key'])) { add_action('admin_notices', 'envato_toolkit_credentials_admin_notices'); return; } // Check updates only after a while $lastCheck = get_option('toolkit-last-toolkit-check'); if (false === $lastCheck) { update_option('toolkit-last-toolkit-check', time()); return; } if (!(time() - $lastCheck > 10800)) { // 3 HOURS = 10800 SECONDS return; } // Update the time we last checked update_option('toolkit-last-toolkit-check', time()); // Check for updates $upgrader = new Envato_WordPress_Theme_Upgrader($credentials['user_name'], $credentials['api_key']); $updates = $upgrader->check_for_theme_update(); // If $updates->updated_themes_count == true then we have an update! // Add update alert, to update the theme if ($updates->updated_themes_count) { add_action('admin_notices', 'envato_toolkit_admin_notices'); } }
function ct_check_for_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); $update = $upgrader->check_for_theme_update($theme); // we enter theme name here to make sure if users are using child theme // found an update return $update->updated_themes_count; } }
function sf_envato_toolkit_admin_init() { // Include the Toolkit Library include_once SF_INCLUDES_PATH . '/envato-wordpress-toolkit-library/class-envato-wordpress-theme-upgrader.php'; // Display a notice in the admin to remind the user to enter their credentials function sf_envato_toolkit_credentials_admin_notices() { $message = sprintf(__("To enable Dante update notifications, please enter your Envato Marketplace credentials in the %s", "swift-framework-admin"), "<a href='" . admin_url() . "admin.php?page=envato-wordpress-toolkit'>Envato WordPress Toolkit Plugin</a>"); echo "<div id='message' class='updated below-h2'><p>{$message}</p></div>"; } // Use credentials used in toolkit plugin so that we don't have to show our own forms anymore $credentials = get_option('envato-wordpress-toolkit'); if (empty($credentials['user_name']) || empty($credentials['api_key'])) { add_action('admin_notices', 'sf_envato_toolkit_credentials_admin_notices'); return; } // Check updates only after a while $lastCheck = get_option('toolkit-last-toolkit-check'); if (false === $lastCheck) { update_option('toolkit-last-toolkit-check', time()); return; } // Check for an update every 3 hours if (time() - $lastCheck < 10800) { return; } // Update the time we last checked update_option('toolkit-last-toolkit-check', time()); // Check for updates $upgrader = new Envato_WordPress_Theme_Upgrader($credentials['user_name'], $credentials['api_key']); $updates = $upgrader->check_for_theme_update(); // Add update alert, to update the theme if ($updates->updated_themes_count) { add_action('admin_notices', 'sf_envato_toolkit_admin_notices'); } // Display a notice in the admin that an update is available function sf_envato_toolkit_admin_notices() { $message = sprintf(__("An update to Dante is available! Head over to %s to update it now.", "swift-framework-admin"), "<a href='" . admin_url() . "admin.php?page=envato-wordpress-toolkit'>Envato WordPress Toolkit Plugin</a>"); echo "<div id='message' class='updated below-h2'><p>{$message}</p></div>"; } }
function optionsframework_options() { // WP Editor data $wp_editor_settings = array('wpautop' => true, 'textarea_rows' => 5, 'tinymce' => array('plugins' => 'wordpress')); // If using image radio buttons, define a directory path $imagepath = get_template_directory_uri() . '/lib/adm/images/'; $theme = wp_get_theme(); $theme_name = $theme->Name; // Page Layout $page_layout_array = array('layout_one' => $imagepath . 'layout-1.png', 'layout_two' => $imagepath . 'layout-2.png', 'layout_three' => $imagepath . 'layout-3.png', 'layout_four' => $imagepath . 'layout-4.png', 'layout_five' => $imagepath . 'layout-5.png', 'layout_six' => $imagepath . 'layout-6.png'); // Columns data $columns_array = array('1' => __('One', 'themeva-admin'), '2' => __('Two', 'themeva-admin'), '3' => __('Three', 'themeva-admin'), '4' => __('Four', 'themeva-admin')); // Sidebar data $sidebars = of_get_option('sidebars_num') != '' ? of_get_option('sidebars_num') : 2; for ($i = 1; $i <= $sidebars; $i++) { $sidebar_array['Sidebar' . $i] = 'Sidebar ' . $i; } $post_formats = get_theme_support('post-formats'); foreach ($post_formats[0] as $format) { $format_array[$format] = $format; } // Author Bio $author_bio_array = array('posts' => __('Posts', 'themeva-admin'), 'enable' => __('Posts & Pages', 'themeva-admin'), 'disable' => __('Disable', 'themeva-admin')); // Twitter Fedd $twitter_feed_array = array('none' => __('Disabled', 'themeva-admin'), 'pagetop' => __('Top', 'themeva-admin'), 'pagebot' => __('Bottom', 'themeva-admin')); // Social Icon data $social_icon_array = social_icon_data(); // Multicheck Defaults $multicheck_defaults = array('one' => '1', 'five' => '1'); // Background Defaults $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll'); // Pull all the categories into an array $options_categories = array(); $options_categories_obj = get_categories(); foreach ($options_categories_obj as $category) { $options_categories[$category->cat_ID] = $category->cat_name; } // Pull all tags into an array $options_tags = array(); $options_tags_obj = get_tags(); foreach ($options_tags_obj as $tag) { $options_tags[$tag->term_id] = $tag->name; } // Pull all the pages into an array $options_pages = array(); $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); $options_pages[''] = 'Select a page:'; foreach ($options_pages_obj as $page) { $options_pages[$page->ID] = $page->post_title; } $options = array(); $options[] = array('name' => __('General', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Layout', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Site Layout', 'themeva-admin'), 'desc' => '', 'id' => 'wide_layout', 'std' => '', 'type' => 'select', 'options' => array('enable' => __('Wide', 'themeva-admin'), 'wide_boxed' => __('Wide + Boxed Content', 'themeva-admin'), '' => __('Boxed', 'themeva-admin'))); $options[] = array('name' => 'Page Layout', 'desc' => '', 'id' => 'pagelayout', 'std' => 'layout_four', 'type' => "images", 'options' => $page_layout_array); $options[] = array('name' => __('Number of Sidebars', 'themeva-admin'), 'plac' => __('Default is 2', 'themeva-admin'), 'id' => 'sidebars_num', 'class' => 'mini', 'std' => '', 'type' => 'text'); $options[] = array('name' => __('Breadcrumbs', 'themeva-admin'), 'desc' => '', 'id' => 'breadcrumb', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Page Comments', 'themeva-admin'), 'desc' => '', 'id' => 'pagecomments', 'std' => 'disable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Show Author Bio', 'themeva-admin'), 'desc' => __('Enable this option to display author bio information.', 'themeva-admin'), 'id' => 'author_bio', 'std' => 'disable', 'type' => 'radio', 'options' => $author_bio_array); $options[] = array('name' => __('Preloader Animation', 'themeva-admin'), 'desc' => '', 'id' => 'preloader', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Responsive Design', 'themeva-admin'), 'desc' => '', 'id' => 'enable_responsive', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Typography', 'themeva-admin'), 'type' => 'info', 'id' => 'typopgraphy_info', 'tooltip' => 'See documentation for how to setup custom <a target="_blank" href="http://themeva.com/docs/' . strtolower($theme_name) . '/google-cufon-font-settings/">Google / Cufón</a> Fonts.'); $options[] = array('name' => __('Font Type', 'themeva-admin'), 'desc' => '', 'id' => 'nv_font_type', 'std' => 'enable_google', 'type' => 'radio', 'options' => array('enable' => __('Cufón', 'themeva-admin'), 'enable_google' => __('Google', 'themeva-admin'), 'disable' => __('Standard', 'themeva-admin'))); $options[] = array('name' => __('Custom Cufón Font', 'themeva-admin'), 'desc' => '', 'id' => 'cufon_font', 'type' => 'upload'); $options[] = array('name' => __('Custom Google Font One', 'themeva-admin'), 'desc' => 'URL Name', 'id' => 'googlefont_url_1', 'std' => '', 'type' => 'text'); $options[] = array('name' => '', 'id' => 'googlefont_css_1', 'desc' => 'CSS Name', 'std' => '', 'type' => 'text'); $options[] = array('name' => __('Custom Google Font Two', 'themeva-admin'), 'desc' => 'URL Name', 'id' => 'googlefont_url_2', 'plac' => 'URL Name', 'std' => '', 'type' => 'text'); $options[] = array('name' => '', 'id' => 'googlefont_css_2', 'desc' => 'CSS Name', 'std' => '', 'type' => 'text'); $options[] = array('name' => __('Image Resizing + First Image Detection', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Image Resizer', 'themeva-admin'), 'desc' => '', 'id' => 'timthumb_disable', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('First Image Detection', 'themeva-admin'), 'desc' => '', 'id' => 'firstimage_detect', 'std' => 'disable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Visual Composer', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Standard VC Elements', 'themeva-admin'), 'desc' => __('Enable all visual composer elements, this will add extra CSS to the front end and may result in longer load times.', 'themeva-admin'), 'id' => 'display_vc_elements', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable_vc_elements' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); /*$options[] = array( 'name' => __('JW Player', 'themeva-admin'), 'type' => 'info', 'desc' => __('See documentation for how to setup JW Player', 'themeva-admin'), ); $options[] = array( 'name' => __('Javascript File ( jwplayer.js )', 'themeva-admin'), 'id' => 'jwplayer_js', 'plac' => 'Upload jwplayer.js', 'type' => 'upload' ); $options[] = array( 'name' => __('Flash File ( player.swf )', 'themeva-admin'), 'id' => 'jwplayer_swf', 'plac' => 'Upload player.swf', 'type' => 'upload' ); $options[] = array( 'name' => __('Plugins', 'themeva-admin'), 'id' => 'jwplayer_plugins', 'plac' => 'Comma separated', 'type' => 'upload' ); $options[] = array( 'name' => __('Skin', 'themeva-admin'), 'id' => 'jwplayer_skin', 'plac' => '.zip file', 'type' => 'upload' ); $options[] = array( 'name' => __('Controlbar Height', 'themeva-admin'), 'desc' => '', 'id' => 'jwplayer_height', 'plac' => '24 is the default', 'std' => '', 'type' => 'text' ); $options[] = array( 'name' => __('Controlbar Position', 'themeva-admin'), 'desc' => '', 'id' => 'jwplayer_skinpos', 'std' => 'over', 'type' => 'radio', 'options' => array( 'over' => __('Over', 'themeva-admin'), 'top' => __('Top', 'themeva-admin'), 'bottom' => __('Bottom', 'themeva-admin') ) );*/ $options[] = array('name' => __('Flickr', 'themeva-admin'), 'type' => 'info', 'desc' => __('See documentation for how to setup Flickr', 'themeva-admin')); $options[] = array('name' => __('Flickr User ID', 'themeva-admin'), 'desc' => '', 'id' => 'flickr_userid', 'std' => '', 'type' => 'text'); $options[] = array('name' => __('Header', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Header Layout', 'themeva-admin'), 'desc' => '', 'id' => 'header_layout', 'std' => 'left', 'type' => 'select', 'options' => array('left' => __('Left', 'themeva-admin'), 'top-lr' => __('Top: Logo Left | Menu Right', 'themeva-admin'), 'top-cc' => __('Top: Logo Center | Menu Center', 'themeva-admin'), 'top-rl' => __('Top: Logo Right | Menu Left', 'themeva-admin'))); $options[] = array('name' => __('Collapse Header', 'themeva-admin'), 'id' => 'collapse_menu', 'std' => 'disable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'collapse-menu' => __('On', 'themeva-admin'))); $options['header_tagline'] = array('name' => __('Display Tagline', 'themeva-admin'), 'id' => 'header_tagline', 'std' => 'enable', 'type' => 'select', 'class' => 'mini', 'options' => array('enable' => __('On', 'themeva-admin'), 'disable' => __('Off', 'themeva-admin'))); $options[] = array('name' => __('Primary Branding / Logo', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Primary Logo', 'themeva-admin'), 'desc' => '', 'id' => 'branding_url', 'type' => 'upload'); $options[] = array('name' => __('Primary Logo ( Retina )', 'themeva-admin'), 'desc' => '', 'id' => 'branding_2x', 'type' => 'upload'); $options[] = array('name' => __('Primary Logo ( Retina ) Width x Height', 'themeva-admin'), 'desc' => '', 'id' => 'branding_2x_dimensions', 'std' => '', 'plac' => 'e.g. 200x100 ( See description below )', 'desc' => 'Enter a value half the size of the actual image size e.g. 400px ( width ) x 200px ( height ): value = <strong>200x100</strong>', 'type' => 'text'); $options[] = array('name' => __('Secondary Branding / Logo', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Secondary Logo', 'themeva-admin'), 'desc' => '', 'id' => 'branding_url_sec', 'type' => 'upload'); $options[] = array('name' => __('Secondary Logo ( Retina )', 'themeva-admin'), 'desc' => '', 'id' => 'branding_sec_2x', 'type' => 'upload'); $options[] = array('name' => __('Secondary Logo ( Retina ) Width x Height', 'themeva-admin'), 'desc' => '', 'id' => 'branding_sec_2x_dimensions', 'std' => '', 'plac' => 'e.g. 200x100 ( See description below )', 'desc' => 'Enter a value half the size of the actual image size e.g. 400px ( width ) x 200px ( height ): value = <strong>200x100</strong>', 'type' => 'text'); $options[] = array('name' => __('Main Menu', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('WP Custom Menu', 'themeva-admin'), 'id' => 'wpcustomm_enable', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Menu Subtitles', 'themeva-admin'), 'id' => 'menu_subtitles', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Menu Descriptions', 'themeva-admin'), 'id' => 'wpcustommdesc_enable', 'std' => 'disable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Display Search', 'themeva-admin'), 'id' => 'enable_search', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Extras', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Sticky Menu', 'themeva-admin'), 'id' => 'sticky_menu', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Favicon', 'themeva-admin'), 'desc' => '', 'id' => 'header_favicon', 'type' => 'upload'); $options[] = array('name' => __('Tracking Code', 'themeva-admin'), 'id' => 'tracking_code', 'type' => 'textarea', 'desc' => __('Add Google Analytics / tracking code within this field.', 'themeva-admin'), 'settings' => array('rows' => '20')); $options[] = array('name' => __('Footer', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Main Footer', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Display Footer', 'themeva-admin'), 'id' => 'mainfooter', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Footer Columns', 'themeva-admin'), 'id' => 'footer_columns_num', 'std' => '4', 'type' => 'select', 'class' => 'mini', 'options' => $columns_array); $options[] = array('name' => __('Lower Footer', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Display Lower Footer', 'themeva-admin'), 'id' => 'lowerfooter', 'std' => 'enable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Left Column', 'themeva-admin'), 'id' => 'lowfooterleft', 'type' => 'textarea', 'settings' => $wp_editor_settings); $options[] = array('name' => __('Right Column', 'themeva-admin'), 'id' => 'lowfooterright', 'type' => 'textarea', 'settings' => $wp_editor_settings); $options[] = array('name' => __('Blog', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Layout', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Wide Site Layout', 'themeva-admin'), 'desc' => '', 'id' => 'wide_layout_blog', 'std' => '', 'type' => 'radio', 'options' => array('' => __('Default', 'themeva-admin'), 'disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => 'Page Layout', 'desc' => '', 'id' => 'arhlayout', 'std' => 'layout_four', 'type' => "images", 'options' => $page_layout_array); $options[] = array('name' => __('Column 1 Sidebar', 'themeva-admin'), 'id' => 'archcolone', 'type' => 'select', 'class' => 'mini', 'options' => $sidebar_array); $options[] = array('name' => __('Column 2 Sidebar', 'themeva-admin'), 'id' => 'archcoltwo', 'type' => 'select', 'class' => 'mini', 'options' => $sidebar_array); $options[] = array('name' => __('Layout Format', 'themeva-admin'), 'desc' => '', 'id' => 'arhpostdisplay', 'std' => 'normal', 'type' => 'radio', 'options' => array('normal' => __('Normal', 'themeva-admin'), 'grid' => __('Grid', 'themeva-admin'))); $options[] = array('name' => __('Grid Columns', 'themeva-admin'), 'desc' => '', 'id' => 'arhpostcolumns', 'std' => 'normal', 'type' => 'select', 'class' => 'mini', 'options' => array('2' => 'Two', '3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six')); $options[] = array('name' => __('Post Content', 'themeva-admin'), 'id' => 'arhpostcontent', 'type' => 'select', 'class' => 'mini', 'options' => array('excerpt' => 'Excerpt', 'full_post' => 'Full Post')); $options[] = array('name' => __('Featured Image', 'themeva-admin'), 'id' => 'arhpostimage', 'type' => 'select', 'class' => 'mini', 'std' => '', 'options' => array('' => 'Single & Archive', 'archive' => 'Archive', 'single' => 'Single', 'disable' => 'Disable')); $options[] = array('name' => __('Display Post Metadata', 'themeva-admin'), 'id' => 'arhpostpostmeta', 'type' => 'select', 'class' => 'mini', 'options' => array('' => 'Archive / Single Post', 'archive_only' => 'Archive Only', 'post_only' => 'Single Post Only', 'disabled' => 'Disabled')); $options[] = array('name' => __('Post Metadata Align', 'themeva-admin'), 'desc' => '', 'id' => 'postmetaalign', 'std' => 'default', 'type' => 'radio', 'options' => array('default' => __('Left', 'themeva-admin'), 'post_title' => __('Below Title', 'themeva-admin'))); $options[] = array('name' => __('Blog Page Images', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Image Alignment', 'themeva-admin'), 'id' => 'arhimgalign', 'std' => 'aligncenter', 'type' => 'radio', 'options' => array('alignleft' => __('Left', 'themeva-admin'), 'aligncenter' => __('Center', 'themeva-admin'), 'alignright' => __('Right', 'themeva-admin'))); $options[] = array('name' => __('Image Lightbox', 'themeva-admin'), 'id' => 'arhimgdisplay', 'std' => 'disable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'lightbox' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Image Effect', 'themeva-admin'), 'id' => 'arhimgeffect', 'type' => 'select', 'std' => 'none', 'class' => 'mini', 'options' => array('frame' => 'Frame', 'blackwhite' => 'Black & White', 'frameblackwhite' => 'Frame + Black & White', 'none' => 'None')); $options[] = array('name' => __('Image Width', 'themeva-admin'), 'id' => 'arhimgwidth', 'std' => '', 'class' => 'mini', 'type' => 'text'); $options[] = array('name' => __('Image Height', 'themeva-admin'), 'id' => 'arhimgheight', 'std' => '', 'class' => 'mini', 'type' => 'text'); $options[] = array('name' => __('Single Post Images', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Image Alignment', 'themeva-admin'), 'id' => 'postimgalign', 'std' => 'aligncenter', 'type' => 'radio', 'options' => array('alignleft' => __('Left', 'themeva-admin'), 'aligncenter' => __('Center', 'themeva-admin'), 'alignright' => __('Right', 'themeva-admin'))); $options[] = array('name' => __('Image Lightbox', 'themeva-admin'), 'id' => 'postimgdisplay', 'std' => 'disable', 'type' => 'radio', 'options' => array('disable' => __('Off', 'themeva-admin'), 'lightbox' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Image Effect', 'themeva-admin'), 'id' => 'postimgeffect', 'type' => 'select', 'std' => 'none', 'class' => 'mini', 'options' => array('frame' => 'Frame', 'blackwhite' => 'Black & White', 'frameblackwhite' => 'Frame + Black & White', 'none' => 'None')); $options[] = array('name' => __('Image Width', 'themeva-admin'), 'id' => 'postimgwidth', 'std' => '', 'class' => 'mini', 'type' => 'text'); $options[] = array('name' => __('Image Height', 'themeva-admin'), 'id' => 'postimgheight', 'std' => '', 'class' => 'mini', 'type' => 'text'); $options[] = array('name' => __('Portfolio', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Parent Portfolio Page', 'themeva-admin'), 'id' => 'portfoliopage', 'std' => '', 'desc' => 'Default is the Archive page.', 'class' => 'mini', 'type' => 'select', 'options' => $options_pages); $options[] = array('name' => __('Portfolio Page Link', 'themeva-admin'), 'id' => 'portfoliopagelink', 'std' => '', 'type' => 'radio', 'options' => array('' => __('Enable', 'themeva-admin'), 'disable' => __('Disable', 'themeva-admin'))); $options[] = array('name' => __('Single Portfolio Images', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Image Alignment', 'themeva-admin'), 'id' => 'portfolioimgalign', 'std' => 'aligncenter', 'type' => 'radio', 'options' => array('alignleft' => __('Left', 'themeva-admin'), 'aligncenter' => __('Center', 'themeva-admin'), 'alignright' => __('Right', 'themeva-admin'))); $options[] = array('name' => __('Image Lightbox', 'themeva-admin'), 'id' => 'portfolioimgdisplay', 'std' => 'disable', 'type' => 'radio', 'options' => array('' => __('Default', 'themeva-admin'), 'disable' => __('Off', 'themeva-admin'), 'lightbox' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Image Width', 'themeva-admin'), 'id' => 'portfolioimgwidth', 'std' => '', 'class' => 'mini', 'type' => 'text'); $options[] = array('name' => __('Image Height', 'themeva-admin'), 'id' => 'portfolioimgheight', 'std' => '', 'class' => 'mini', 'type' => 'text'); if (class_exists('BP_Core_User') || class_exists('bbPress')) { $options[] = array('name' => __('BuddyPress / BBPress', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Layout', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => 'Page Layout', 'desc' => '', 'id' => 'buddylayout', 'std' => 'layout_four', 'type' => "images", 'options' => $page_layout_array); $options[] = array('name' => __('Column 1 Sidebar', 'themeva-admin'), 'id' => 'buddycolone', 'type' => 'select', 'class' => 'mini', 'options' => $sidebar_array); $options[] = array('name' => __('Column 2 Sidebar', 'themeva-admin'), 'id' => 'buddycoltwo', 'type' => 'select', 'class' => 'mini', 'options' => $sidebar_array); $options[] = array('name' => __('Content Border', 'themeva-admin'), 'desc' => '', 'id' => 'buddycontentborder', 'std' => 'default', 'type' => 'radio', 'options' => array('default' => __('Default', 'themeva-admin'), 'disabled' => __('Disable', 'themeva-admin'))); } if (class_exists('woocommerce')) { $options[] = array('name' => __('Woocommerce', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Layout', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Wide Site Layout', 'themeva-admin'), 'desc' => '', 'id' => 'wide_layout_woocommerce', 'std' => '', 'type' => 'radio', 'options' => array('' => __('Default', 'themeva-admin'), 'disable' => __('Off', 'themeva-admin'), 'enable' => __('On', 'themeva-admin'))); $options[] = array('name' => 'Page Layout', 'desc' => '', 'id' => 'woocomlayout', 'std' => 'layout_four', 'type' => "images", 'options' => $page_layout_array); $options[] = array('name' => __('Column 1 Sidebar', 'themeva-admin'), 'id' => 'woocomcolone', 'type' => 'select', 'class' => 'mini', 'options' => $sidebar_array); $options[] = array('name' => __('Column 2 Sidebar', 'themeva-admin'), 'id' => 'woocomcoltwo', 'type' => 'select', 'class' => 'mini', 'options' => $sidebar_array); } $options[] = array('name' => __('Social Media', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Social Icons', 'themeva-admin'), 'type' => 'info', 'id' => 'social_info', 'tooltip' => 'Switch Social Icons "On" if you want to enable social icons on every Page / Post, it can be disabled on individual pages if required.'); $options[] = array('name' => __('Social Icons', 'themeva-admin'), 'desc' => '', 'id' => 'display_socialicons', 'std' => 'off', 'type' => 'radio', 'options' => array('off' => __('Off', 'themeva-admin'), 'yes' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Share Icon', 'themeva-admin'), 'desc' => '', 'id' => 'socialicons_share', 'std' => 'on', 'type' => 'radio', 'desc' => __('Set this option to "Off" to show social icons individually.', 'themeva-admin'), 'options' => array('yes' => __('Off', 'themeva-admin'), 'on' => __('On', 'themeva-admin'))); $options[] = array('name' => __('Social Icons Color', 'themeva-admin'), 'id' => 'socialicons_color', 'type' => 'select', 'class' => 'mini', 'options' => array('' => 'Default', 'light' => 'Light', 'dark' => 'Dark', 'color' => 'Color')); foreach ($social_icon_array as $key => $socialicon) { $social_array[strtolower(str_replace('.', '', $socialicon['name']))] = $socialicon['name']; } $options[] = array('name' => __('Enable Social Icons', 'themeva-admin'), 'id' => 'socialicons', 'std' => '', 'type' => 'multicheck', 'options' => $social_array); $options[] = array('name' => __('Social Icon URL\'s', 'themeva-admin'), 'type' => 'info', 'id' => 'socialurl_info'); foreach ($social_icon_array as $key => $socialicon) { $options[] = array('name' => $socialicon['name'], 'id' => $key, 'std' => $socialicon['path'], 'type' => 'text'); } $options[] = array('name' => __('Twitter Feed', 'themeva-admin'), 'type' => 'info', 'id' => 'twitter_info', 'tooltip' => 'Enter your Twitter details, if you wish to enable Twitter Feed globally, set the Twitter Display, this can be overriden on individual pages.'); $options[] = array('name' => __('Twitter Username', 'themeva-admin'), 'id' => 'twitter_usrname', 'type' => 'text'); $options[] = array('name' => __('Consumer Key', 'themeva-admin'), 'id' => 'twitter_conkey', 'type' => 'text'); $options[] = array('name' => __('Consumer Secret', 'themeva-admin'), 'id' => 'twitter_consecret', 'type' => 'text'); $options[] = array('name' => __('Access Token', 'themeva-admin'), 'id' => 'twitter_acctoken', 'type' => 'text'); $options[] = array('name' => __('Access Token Secret', 'themeva-admin'), 'id' => 'twitter_acctokensecret', 'type' => 'text'); $options[] = array('name' => __('Number of Tweets', 'themeva-admin'), 'id' => 'twitter_feednum', 'plac' => 'Enter the number of tweets to display', 'type' => 'text'); $options[] = array('name' => __('Twitter Display', 'themeva-admin'), 'id' => 'twitter_display', 'std' => 'none', 'type' => 'radio', 'options' => $twitter_feed_array); $options[] = array('name' => __('Main RSS Feed', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('Main RSS Title', 'themeva-admin'), 'id' => 'rss_title', 'std' => 'Blog', 'type' => 'text'); $options[] = array('name' => __('Main RSS Feed URL', 'themeva-admin'), 'id' => 'rss_feed', 'plac' => 'e.g. /category/YOUR-CATEGORY-NAME/feed/', 'type' => 'text'); $options[] = array('name' => __('Customize', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('Custom CSS', 'themeva-admin'), 'id' => 'header_css', 'type' => 'textarea', 'settings' => array('rows' => '20')); $options[] = array('name' => __('Mobile CSS', 'themeva-admin'), 'id' => 'responsive_css', 'desc' => __('CSS for Mobile / Responsive mode e.g. ( hides sidebars ) <strong>.content-wrap .sidebar {display:none !important;}</strong>', 'themeva-admin'), 'type' => 'textarea', 'settings' => array('rows' => '20')); $options[] = array('name' => __('JavaScript', 'themeva-admin'), 'id' => 'footer_javascript', 'desc' => __('Add your scripts here, loads at the end of the page. E.g. <strong><script type="text/javascript"> YOUR CODE </script></strong>', 'themeva-admin'), 'type' => 'textarea', 'settings' => array('rows' => '20')); $options[] = array('name' => __('Docs + Getting Started', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('1. Import Demo Content', 'themeva-admin'), 'type' => 'info', 'desc' => __(' <p>Click the button below to Import the demo content. Please note, some of the demo images have been removed due to copyright.</p> <p><strong>DO NOT</strong> install if you have existing content, the demo content may interfere.</p> <a href="#" class="import-demo button button-primary">' . __('Import Demo Content', 'optionsframework') . '</a> <p><div class="ajax-message"></div></p> ', 'themeva-admin')); $options[] = array('name' => __('2. Documentation', 'themeva-admin'), 'type' => 'info', 'desc' => __('<p>See the Getting Started section of the documentation below.</p> <a target="_blank" href="http://themeva.com/docs/' . strtolower($theme_name) . '/category/getting-started/" class="documentation_link button button-primary">' . __('Documentation', 'optionsframework') . '</a> ', 'themeva-admin')); $options[] = array('name' => __('3. Customize Skin', 'themeva-admin'), 'type' => 'info', 'desc' => __('<p>Click here to Customize a Skin, once the customization screen has loaded - <strong>Select a Skin</strong> to edit from the <strong>Edit + Set Default Skin</strong> section.</p> <a href="/wp-admin/customize.php" target="_blank" class="documentation_link button button-primary">' . __('Customize', 'optionsframework') . '</a> ', 'themeva-admin')); $options[] = array('name' => __('Theme Updates', 'themeva-admin'), 'type' => 'heading'); $options[] = array('name' => __('ThemeForest User Details', 'themeva-admin'), 'type' => 'info'); $options[] = array('name' => __('ThemeForest Username', 'themeva-admin'), 'id' => 'tf_username', 'type' => 'text', 'desc' => __('<p>Enter the ThemeForest Username you used to purchase this them.</p>', 'themeva-admin')); $options[] = array('name' => __('ThemeForest API Key', 'themeva-admin'), 'id' => 'tf_apikey', 'type' => 'text', 'desc' => __('<p>Enter your ThemeForest API Key here. To find your API Key, click <a target="_blank" href="http://themeva.com/themeforest/images/find-api-key.jpg">' . __('here', 'optionsframework') . '</a>.</p>', 'themeva-admin')); // Check for Theme Updates if (of_get_option('tf_username') != '' && of_get_option('tf_apikey') != '') { include_once get_template_directory() . '/lib/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')); $theme_update = $upgrader->check_for_theme_update(wp_get_theme()->Name, $allow_cache = false); $current_theme = wp_get_theme(); if ($theme_update->latest_version - $current_theme->get('Version') > 0 && !$theme_update->errors > 0) { add_action('admin_notices', 'acoda_theme_update_admin_notice'); function acoda_theme_update_admin_notice() { $message = sprintf(__("An update for the theme is available! Head over to %s to update it now.", "themeva-admin"), "<a href='" . admin_url() . "admin.php?page=options-framework#themeupdates'>Theme Updates</a>"); echo "<div id='message' class='updated'><p>{$message}</p></div>"; } $options[] = array('name' => __('Version ' . $theme_update->latest_version . ' is Available!', 'themeva-admin'), 'type' => 'info', 'desc' => '<p>Your current version <strong>' . $current_theme->get('Version') . '</strong> needs to be updated. Please click the update button below to update to <strong>version ' . $theme_update->latest_version . '</strong></p> <p class="ajax-theme-update-message"></p> <a href="#" class="update-theme button button-primary">' . __('Update Theme', 'optionsframework') . '</a> '); } elseif ($theme_update->errors > 0) { $options[] = array('name' => __('Incorrect Details', 'themeva-admin'), 'type' => 'info', 'desc' => '<p>The details entered above appear to be incorrect. Please re-enter your <strong>ThemeForest Username</strong> and <strong>ThemeForest API Key</strong> into the relevant fields.</p>'); } else { $options[] = array('name' => __($current_theme->get('Name') . ' is Up-to-date!', 'themeva-admin'), 'type' => 'info', 'desc' => '<p>You\'re using the latest version of <strong>' . $current_theme->get('Version') . '</strong>.</p>'); } } else { $current_theme = wp_get_theme(); $options[] = array('name' => __('Theme Updates', 'themeva-admin'), 'type' => 'info', 'desc' => '<p>You\'re using version <strong>' . $current_theme->get('Version') . ' </strong> of the ' . $current_theme->get('Name') . ' theme. To check for the latest updates, please enter your <strong>ThemeForest Username</strong> and <strong>ThemeForest API Key</strong> into the above fields.</p>'); } return $options; }
function rockthemes_to_them_update_check_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 i4cbjt9rht8lldu57petvqsw6vcas5zk */ return $upgrader->check_for_theme_update(); /* * Uncomment to update the current theme */ // $upgrader->upgrade_theme(); }
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'; } } }
echo "<div id='message' class='updated below-h2'><p>{$message}</p></div>"; } // Check updates only after a while $lastCheck = get_option('toolkit-last-toolkit-check'); if (false === $lastCheck) { update_option('toolkit-last-toolkit-check', time()); return; } // Check for an update every 3 hours if (10800 < time() - $lastCheck) { return; } // Update the time we last checked update_option('toolkit-last-toolkit-check', time()); // Check for updates $upgrader = new Envato_WordPress_Theme_Upgrader($credentials['user_name'], $credentials['api_key']); $updates = $upgrader->check_for_theme_update(); // If $updates->updated_themes_count == true then we have an update! // Add update alert, to update the theme if ($updates->updated_themes_count) { add_action('admin_notices', 'envato_toolkit_admin_notices'); } /** * Display a notice in the admin that an update is available */ function envato_toolkit_admin_notices() { $message = sprintf(__("An update to the theme is available! Head over to %s to update it now.", "default"), "<a href='" . admin_url() . "admin.php?page=envato-wordpress-toolkit'>Envato WordPress Toolkit Plugin</a>"); echo "<div id='message' class='updated below-h2'><p>{$message}</p></div>"; } }
</li> <li data-demo="3"> <img src="' . get_template_directory_uri() . '/cache/demos/vega_demo3.jpg" alt=""/> </li> <li data-demo="4"> <img src="' . get_template_directory_uri() . '/cache/demos/vega_demo4.jpg" alt=""/> </li> </ul> <input id="pp_import_default_button" name="pp_import_default_button" type="submit" value="Import Selected Settings" class="upload_btn button-primary"/> <input type="hidden" id="pp_import_demo" name="pp_import_demo" value="1"/> <input type="hidden" id="pp_import_default" name="pp_import_default" value=""/> '), array("type" => "close"), array("name" => "Backup", "type" => "section", "icon" => "drive_disk.png"), array("type" => "open"), array("name" => "<h2>Import Settings</h2>", "desc" => "Choose theme export file (.json) from your computer and click \"Import\" button", "id" => SHORTNAME . "_import_current", "type" => "html", "html" => '<input type="file" id="' . SHORTNAME . '_import_current" name="' . SHORTNAME . '_import_current"/><input type="submit" id="' . SHORTNAME . '_import_current_button" class="button" value="Import"/>'), array("name" => "<h2>Export Settings</h2>", "desc" => "You can click below button to save current backup into .json file so you can import it back any time using restore form below.", "id" => SHORTNAME . "_export_current", "type" => "html", "html" => '<input type="submit" id="' . SHORTNAME . '_export_current_button" class="button" value="Export Current Theme Settings"/><input type="hidden" id="' . SHORTNAME . '_export_current" name="' . SHORTNAME . '_export_current" value="0"/>'), array("type" => "close"), array("name" => "Auto-update", "type" => "section", "icon" => "arrow_refresh.png"), array("type" => "open"), array("name" => "<h2>Envato API Settings</h2>Envato Username", "desc" => "Enter you Envato username", "id" => SHORTNAME . "_envato_username", "type" => "text", "std" => ""), array("name" => "Envato API Key", "desc" => "Enter account API key. You can get it from Your account > Settings > API Keys", "id" => SHORTNAME . "_envato_api_key", "type" => "text", "std" => "")); //Check if has new update 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'); $upgrader = array(); 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) { $options[] = array("name" => "Update Theme<br/>", "desc" => "", "id" => SHORTNAME . "_theme_go_update", "type" => "html", "html" => ' Click to update ' . THEMENAME . ' theme to the latest version. If you made changes on any them code, please backup your changes first otherwise they will be overwritten by the update.<br/><br/> <a id="' . SHORTNAME . '_theme_go_update_bth" href="' . $api_url . '" class="button button-primary">Click here to update theme</a> <div class="update_message"><img src="' . get_template_directory_uri() . '/functions/images/ajax-loader.gif" alt="" style="vertical-align: middle;"/><br/><br/>*Theme is being updated please be patient, don\'t navigate away from this page</div>'); } } $options[] = array("type" => "close"); /*print '<pre>'; print_r($options); print '</pre>';*/
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(); }