function wii2wx_form_checkbox($id, $desc, $br = '<br />') { ?> <div style = "display:inline-block;padding-left:2.5em;text-indent:-1.7em;"><label><input type="checkbox" name="<?php echo $id; ?> " id="<?php echo $id; ?> " <?php checked(wii2wx_getopt($id)); ?> > <?php echo $desc . '</label></div>' . $br . "\n"; }
function wii2wx_set_current_to_serialized_values($contents) { global $wii2wx_cache; // need to mess with the cache if (substr($contents, 0, 10) == 'W2T-V01.00') { $type = 'theme'; } else { if (substr($contents, 0, 10) == 'W2B-V01.00') { $type = 'backup'; } else { return wii2wx_alert(wii2wx_t_("Wrong theme file format version")); } } /* simple check for one of ours */ $restore = array(); $restore = unserialize(substr($contents, 10)); if (!$restore) { return wwii2wx_alert("Unserialize of Weaver II Theme failed"); } $version = wii2wx_getopt('wii_version_id'); // get something to force load if ($type == 'theme') { // need to clear some settings // first, pickup the per-site settings that aren't theme related... $new_cache = array(); foreach (_cache as $key => $val) { if ($key[0] == '_') { // these are non-theme specific settings $new_cache[$key] = $val; } // keep } $opts = $restore['wii2wx_base']; // fetch base opts wii2wx_delete_all_options(); foreach ($opts as $key => $val) { if ($key[0] != '_') { wii2wx_setopt($key, $val, false); } // overwrite with saved theme values } foreach ($new_cache as $key => $val) { // set the values we need to keep wii2wx_setopt($key, $val, false); } } else { if ($type == 'backup') { wii2wx_delete_all_options(); $opts = $restore['wii2wx_base']; // fetch base opts foreach ($opts as $key => $val) { wii2wx_setopt($key, $val, false); // overwrite with saved values } global $wii2wx_pro_opts; $wii2wx_pro_opts = false; $wii2wx_pro_opts = $restore['weaverii_pro']; wii2wx_wpupdate_option('wii2wx_pro', $wii2wx_pro_opts, 'backup'); } } wii2wx_setopt('wii_version_id', $version); // keep version, force save of db wii2wx_setopt('wii_last_option', 'WeaverII'); wii2wx_save_opts('loading theme'); // OK, now we've saved the options, update them in the DB return true; }