function hu_update_widget_database_option() { if (!hu_user_started_before_version('3.1.2')) { return; } $_options = get_option('hu_theme_options'); $_update_widget_areas = array(); if (!isset($_options['sidebar-areas']) || !is_array($_options['sidebar-areas'])) { return; } $_zones = hu_get_default_widget_zones(); foreach ($_options['sidebar-areas'] as $key => $data) { if (!array_key_exists($data['id'], $_zones)) { continue; } $_id = $data['id']; $_options['sidebar-areas'][$key]['title'] = $_zones[$_id]['name']; } update_option('hu_theme_options', $_options); }
/** * hook : admin_notices */ function hu_may_be_display_update_notice() { $opt_name = 'last_update_notice'; $last_update_notice_values = hu_get_option($opt_name); $show_new_notice = false; if (!$last_update_notice_values || !is_array($last_update_notice_values)) { //first time user of the theme, the option does not exist // 1) initialize it => set it to the current Hueman version, displayed 0 times. // 2) update in db $last_update_notice_values = array("version" => HUEMAN_VER, "display_count" => 0); HU_utils::$inst->hu_set_option($opt_name, $last_update_notice_values); //already user of the theme ? if (hu_user_started_before_version(HUEMAN_VER)) { $show_new_notice = true; } } $_db_version = $last_update_notice_values["version"]; $_db_displayed_count = $last_update_notice_values["display_count"]; //user who just upgraded the theme will be notified until he/she clicks on the dismiss link //or until the notice has been displayed 5 times. if (version_compare(HUEMAN_VER, $_db_version, '>')) { //CASE 1 : displayed less than 5 times if ($_db_displayed_count < 5) { $show_new_notice = true; //increments the counter (int) $_db_displayed_count++; $last_update_notice_values["display_count"] = $_db_displayed_count; //updates the option val with the new count HU_utils::$inst->hu_set_option($opt_name, $last_update_notice_values); } else { //reset option value with new version and counter to 0 $new_val = array("version" => HUEMAN_VER, "display_count" => 0); HU_utils::$inst->hu_set_option($opt_name, $new_val); } //end else } //end if if (!$show_new_notice) { return; } ob_start(); ?> <div class="updated" style="position:relative"> <?php echo apply_filters('hu_update_notice', sprintf('<h3>%1$s %2$s %3$s %4$s :D</h3>', __("Good, you've just upgraded to", "hueman"), 'Hueman', __("version", "hueman"), HUEMAN_VER)); ?> <?php echo apply_filters('hu_update_notice', sprintf('<h4>%1$s</h4><strong><a class="button button-primary" href="%2$s" title="%3$s" target="_blank">%3$s »</a> <a class="button button-primary" href="%4$s" title="%5$s" target="_blank">%5$s »</a></strong>', __("We'd like to introduce the new features we've been working on.", "hueman"), HU_WEBSITE . "/category/hueman-releases/", __("Read the latest release notes", "hueman"), esc_url('demo-hueman.presscustomizr.com'), __("Visit the demo", "hueman"))); ?> <p style="text-align:right;position: absolute;right: 7px;bottom: -5px;"> <?php printf('<em>%1$s <strong><a href="#" title="%1$s" class="tc-dismiss-update-notice"> ( %2$s x ) </a></strong></em>', __("I already know what's new thanks !", "hueman"), __('close', 'hueman')); ?> </p> </div> <?php $_html = ob_get_contents(); if ($_html) { ob_end_clean(); } echo $_html; }
function hu_performance_sec() { return array('minified-css' => array('default' => 1, 'control' => 'HU_controls', 'label' => __('Use a minified stylesheet', 'hueman'), 'section' => 'performance_sec', 'type' => 'checkbox', 'notice' => __("Unchecking this option is not recommended. Minifying css stylesheets improves performance for your website overall by decreasing the load time.", 'hueman')), 'structured-data' => array('default' => hu_user_started_before_version('3.1.1') ? 0 : 1, 'control' => 'HU_controls', 'label' => __('Use Structured Data Markup for your posts', 'hueman'), 'section' => 'performance_sec', 'type' => 'checkbox', 'notice' => __('"Structured data markup" is a standard way to annotate your content so machines can understand it. Implementing it will help your website rank higher in search engines.', 'hueman'))); }