function theme_version_check() { $last_version = (int) wpv_get_option('theme_installed_version'); if (empty($last_version)) { $last_version = 1; } if ($last_version < (int) WpvFramework::get_version()) { wpv_update_option('theme_installed_version', (int) WpvFramework::get_version()); } }
public function check_version() { $local_version = WpvFramework::get_version(); $key = THEME_SLUG . '_' . $local_version; $last_license_key = wpv_get_option('envato-license-key-old'); $current_license_key = wpv_get_option('envato-license-key'); $system_status_opt_out_old = wpv_get_option('system-status-opt-out-old'); $system_status_opt_out = wpv_get_option('system-status-opt-out'); if ($last_license_key !== $current_license_key || $system_status_opt_out_old !== $system_status_opt_out || false === get_transient($key)) { global $wp_version; $data = array('user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() . '; ', 'blocking' => false, 'body' => array('theme_version' => $local_version, 'php_version' => phpversion(), 'server' => $_SERVER['SERVER_SOFTWARE'], 'theme_name' => THEME_NAME, 'license_key' => $current_license_key, 'active_plugins' => self::active_plugins(), 'system_status' => self::system_status())); if ($last_license_key !== $current_license_key) { wpv_update_option('envato-license-key-old', $current_license_key); } if ($system_status_opt_out_old !== $system_status_opt_out) { wpv_update_option('system-status-opt-out-old', $system_status_opt_out_old); } wp_remote_post($this->remote, $data); set_transient($key, true, $this->interval); // cache } }
/** * Front-end styles */ public function styles() { if (is_admin() || WpvTemplates::is_login()) { return; } $theme_version = WpvFramework::get_version(); $external_fonts = maybe_unserialize(wpv_get_option('external-fonts')); if (is_array($external_fonts) && !empty($external_fonts)) { foreach ($external_fonts as $name => $url) { wp_enqueue_style('wpv-' . $name, $url, array(), $theme_version); } } wp_enqueue_style('front-magnific-popup', wpv_prepare_url(WPV_THEME_CSS . 'magnific.css')); $cache_timestamp = wpv_get_option('css-cache-timestamp'); $generated_deps = array('front-magnific-popup'); if (wpv_has_woocommerce()) { $generated_deps[] = 'woocommerce-layout'; $generated_deps[] = 'woocommerce-smallscreen'; $generated_deps[] = 'woocommerce-general'; } if (class_exists('Tribe__Events__Main') && (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue())) { $generated_deps[] = 'tribe-events-calendar-style'; $generated_deps[] = 'tribe-events-full-calendar-style'; } $suffix = is_multisite() ? $GLOBALS['blog_id'] : ''; $css_file = 'all' . $suffix . '.css'; $css_path = WPV_CACHE_URI . $css_file; if (!file_exists(WPV_CACHE_DIR . $css_file)) { $css_path = WPV_SAMPLES_URI . 'all-default.css'; } wp_enqueue_style('front-all', wpv_prepare_url($css_path), $generated_deps, $cache_timestamp); global $wpv_is_shortcode_preview; if ($wpv_is_shortcode_preview) { wp_enqueue_style('vamtam-shortcode-preview', WPV_ADMIN_ASSETS_URI . 'css/shortcode-preview.css'); } $custom_icons = get_option('vamtam-custom-icons-map'); if ($custom_icons) { $icons_path = trailingslashit(WP_CONTENT_URL) . 'vamtam/custom-icon-font/'; $custom_icons_css = "\n\t\t\t\t@font-face {\n\t\t\t\t\tfont-family: 'vamtam-custom-icons';\n\t\t\t\t\tsrc: url({$icons_path}custom-icons.eot);\n\t\t\t\t\tsrc: url({$icons_path}custom-icons.eot?#iefix) format('embedded-opentype'),\n\t\t\t\t\t\turl({$icons_path}custom-icons.ttf) format('truetype');\n\t\t\t\t\tfont-weight: normal;\n\t\t\t\t\tfont-style: normal;\n\t\t\t\t}\n\t\t\t"; wp_add_inline_style('front-all', $custom_icons_css); } }
/** * dissmiss the notice once the theme options have been saved */ public static function dismiss_notice() { update_option(THEME_SLUG . self::$last_version_key, WpvFramework::get_version()); wpv_update_option('theme-update-notice-dismissed', true); }