'.__("Twenty Ten Weaver main options saved.",TTW_TRANS).'

'; foreach ($ttw_options as $value) { /* only reset main options so use $ttw_options */ $id = $value['id']; $type = $value['type']; if ($type == 'ctext') { if ( isset( $_POST[ $id ] ) ) { // do the color part $v = ttw_esc_code($_POST[$id]); ttw_setopt( $id, $v ); } else { ttw_defaultopt( $id ); } $css_id = $id . '_css'; if ( isset( $_POST[ $css_id ] ) ) { // do the CSS part $v = ttw_esc_code($_POST[$css_id]); if ((strpos($v, '{') === false) && strlen($v) > 0) { ttw_setopt( $css_id, '{' . $v . '}'); // tricky - allows them to add multiple rules, or sub-rules } else { ttw_setopt( $css_id, $v ); } } else { ttw_setopt( $css_id, '/* NO OPTION SET*/' ); } } elseif ($type == 'text_xy') { if ( isset( $_POST[ $id.'_X' ] ) ) { $v = ttw_esc_code($_POST[$id.'_X']); ttw_setopt( $id.'_X', $v ); } else { ttw_defaultopt( $id.'_X' ); } if ( isset( $_POST[ $id.'_Y' ] ) ) { $v = ttw_esc_code($_POST[$id.'_Y']); ttw_setopt( $id.'_Y', $v ); } else { ttw_defaultopt( $id.'_Y' ); } } else { if ( isset( $_POST[ $id ] ) ) { $v = ttw_esc_code($_POST[$id]); ttw_setopt( $id, $v ); } else { ttw_defaultopt( $id ); } } } ttw_saveopts(); } if (ttw_submitted('saveadvanced')) { echo '

'.__("Twenty Ten Weaver advanced options saved.",TTW_TRANS).'

'; // THEME OPTS - advanced theme opts - unlike the options from the Main Options form, // these options don't have default values, and thus use the ttw_post_xxx functions. ttw_post_opt_js('ttw_head_opts'); // Section ttw_post_opt_js('ttw_add_css'); // add css opts ttw_post_opt_js('ttw_theme_head_opts'); // per theme special css ttw_post_opt_html('ttw_footer_opts'); // into footer area ttw_post_opt_html('ttw_header_insert'); // into the #header div ttw_post_opt_html('ttw_preheader_insert'); // above header ttw_post_opt_html('ttw_prefooter_insert'); // above footer ttw_post_opt_html('ttw_postfooter_insert'); // after footer ttw_post_opt_html('ttw_postheader_insert'); // after header ttw_post_opt_html('ttw_presidebar_insert'); // above sidebars ttw_post_opt_html('ttw_custom_header_insert'); // for custom header template ttw_post_opt_html('ttw_header_frontpage_only'); // front page #header ttw_post_opt('ttw_hide_front_preheader'); ttw_post_opt('ttw_hide_rest_preheader'); ttw_post_opt('ttw_hide_front_postheader'); ttw_post_opt('ttw_hide_rest_postheader'); ttw_post_opt('ttw_hide_front_prefooter'); ttw_post_opt('ttw_hide_rest_prefooter'); ttw_post_opt('ttw_hide_front_postfooter'); ttw_post_opt('ttw_hide_rest_postfooter'); ttw_post_opt('ttw_hide_front_presidebar'); ttw_post_opt('ttw_hide_rest_presidebar'); // ADMIN OPTS - per site tags - not theme related ttw_post_adminopt_html('ttw_metainfo'); // our SEO tags ttw_post_adminopt_html('ttw_menu_addhtml'); // html for menu bar... ttw_post_adminopt_html('ttw_menu_addhtml-left'); ttw_post_adminopt_html('ttw_end_opts'); // last thing ttw_post_adminopt_html('ttw_copyright'); // copyright replacement in footer ttw_post_adminopt('ttw_show_codeinsertareas'); ttw_post_adminopt('ttw_hide_PIE'); ttw_post_adminopt('ttw_show_preview'); ttw_post_adminopt('ttw_hide_theme_thumbs'); ttw_post_adminopt('ttw_hide_auto_css_rules'); ttw_post_adminopt('ttw_hide_metainfo'); ttw_post_adminopt('ttw_perpagewidgets'); ttw_post_adminopt('ttw_hide_poweredby'); ttw_post_adminopt('ttw_force_inline_css'); ttw_post_adminopt('ttw_hide_IE_warning_css'); // NOW, save everything ttw_saveopts(); } if (ttw_submitted('setsubtheme') || ttw_submitted('setsubtheme2')) { /* seems like Mozilla doesn't like 2 sets of select inputs on same page, so we make up 2 ids/names to use */ if (isset($_POST['setsubtheme'])) $pID = 'ttw_subtheme'; else $pID = 'ttw_subtheme2'; $cur_subtheme = ttw_esc_code($_POST[ $pID]); /* must have been set to get here */ if ($cur_subtheme == '') $cur_subtheme = 'Twenty Ten'; /* but just in case */ /* now, i set all values for theme */ st_set_subtheme($cur_subtheme); $t = ttw_getopt('ttw_subtheme'); if ($t == '') $t = 'Twenty Ten'; /* did we save a theme? */ echo '

'.__("Twenty Ten Weaver options reset to sub-theme: ",TTW_TRANS).$t. '.

'; } if (ttw_submitted('changethemename')) { if (isset($_POST['newthemename'])) { $new_name = sanitize_user($_POST['newthemename']); ttw_setopt('ttw_themename',$new_name); echo '

Theme name changed to '.$new_name.'

'; } global $ttw_dev; if($ttw_dev) { // used to save a theme for distribution/inclusion in dynamic theme db if (isset($_POST['newthemeimage'])) { ttw_setopt('ttw_theme_image',$_POST['newthemeimage']); } if (isset($_POST['newthemedesc'])) { ttw_setopt('ttw_theme_description',$_POST['newthemedesc']); } } } if (ttw_submitted('savemytheme')) { ttw_savemytheme(); echo '

'.__('All current main and advanced options saved in My Saved Theme.',TTW_TRANS).'

'; } if (ttw_submitted('reset_weaver')) { // delete everything! echo '

All Weaver settings have been reset to the default.

'; delete_option('ttw_options'); delete_option('ttw_myoptions'); delete_option('ttw_adminoptions'); $ttw_optionsList = $ttw_optionsListDefault; foreach ($ttw_options as $value ) { ttw_defaultopt( $value['id'] ); } $ttw_myoptionsList = $ttw_optionsList; $ttw_adminOpts = $ttw_adminOptsDefault; ttw_saveopts(); st_set_subtheme(TTW_START_THEME); } if (ttw_submitted('filesavetheme')) { $base = strtolower(sanitize_file_name($_POST['savethemename'])); $temp_url = ttw_write_current_theme($base); if ($temp_url == '') echo '

Invalid name supplied to save theme to file.

'; else echo '

'.__("All current main and advanced options saved in $temp_url.",TTW_TRANS).'

'; } if (ttw_submitted('uploadtheme') && isset($_POST['uploadit']) && $_POST['uploadit'] == 'yes') { ttw_uploadit(); } if (ttw_submitted('uploadthemeurl')) { // url method $filename = esc_url($_POST['ttw_uploadname'] ); if (ttw_upload_theme($filename)) { $t = ttw_getopt('ttw_subtheme'); if ($t == '') $t = 'Twenty Ten'; /* did we save a theme? */ echo '

'.__("Twenty Ten Weaver theme options reset to uploaded theme, saved as: ",TTW_TRANS).$t. '.

'; } else { echo ('

'. __('INVALID THEME URL PROVIDED - Try Again',TTW_TRANS).'

'); } } if (ttw_submitted('restoretheme')) { $wpdir = wp_upload_dir(); $base = $_POST['ttw_restorename']; $valid = validate_file($base); // make sure an ok file name $fn = $wpdir['basedir'].'/weaver-subthemes/'.$base; if ($valid < 1 && ttw_upload_theme($fn )) { $t = ttw_getopt('ttw_subtheme'); if ($t == '') $t = 'Twenty Ten'; /* did we save a theme? */ echo '

'.__("Twenty Ten Weaver theme restored from file, saved as: ",TTW_TRANS).$t. '.

'; } else { echo ('

'. __('INVALID FILE NAME PROVIDED - Try Again',TTW_TRANS).'

'); } } if (ttw_submitted('deletetheme')) { $myFile = $_POST['selectName']; $valid = validate_file($myFile); if ($valid < 1 && $myFile != "None") { $wpdir = wp_upload_dir(); unlink($wpdir['basedir'].'/weaver-subthemes/'.$myFile); echo '

File: '.$myFile.' has been deleted.

'; } else { echo '

File: '.$myFile.' invalid file name, not deleted.

'; } } if (ttw_submitted('ttw_save_extension')) { /* for theme extensions */ do_action('ttwx_save_extension'); } ?>

Options

Like Weaver? Please
', '
'); /* extended option admin tab */ ?>

Preview of site. Displays current look after you save options or select sub-theme.

If you'd like a preview box of your site here, check the 'Show Site Preview' box near the bottom of the Advanced Options tab.\n"); } ?>
"; $ok = false; } if ($ok && $ext_check != 'wvr'){ $errors[] = "Theme files must have .wvr extension.
"; $ok = false; } if ($ok) { $handle = fopen($openname,'r'); // now try to open the uploaded file if (!$handle) { $errors[] = ''. __('Sorry, there was a problem uploading your file. You may need to check your folder permissions or other server settings.',TTW_TRANS).''. "
(Trying to use file '$openname')"; $ok = false; } } if (!$ok) { echo '

ERROR

'; foreach($errors as $error){ echo $error.'
'; } echo '

'; } else { // OK - read file and save to My Saved Theme // $handle has file handle to temp file. $contents = null; while ( !feof($handle) ) { $contents .= fread($handle, 1024); } fclose($handle); if (!ttw_save_serialized_theme($contents)) { echo '

'. __('Sorry, there was a problem uploading your file. The file you picked was not a valid Weaver theme file.',TTW_TRANS).'

'; } else { $t = ttw_getopt('ttw_subtheme'); if ($t == '') $t = 'Twenty Ten'; /* did we save a theme? */ echo '

'.__("Twenty Ten Weaver theme options reset to uploaded theme, saved as: ",TTW_TRANS).$t. '.

'; } } } function ttw_submitted($submit_name) { // do a nonce check for each form submit button // pairs 1:1 with ttw_nonce_field $nonce_act = $submit_name.'_act'; $nonce_name = $submit_name.'_nonce'; if (isset($_POST[$submit_name])) { if (isset($_POST[$nonce_name]) && wp_verify_nonce($_POST[$nonce_name],$nonce_act)) { return true; } else { die("WARNING: invalid form interaction detected ($submit_name). Failed security check: please contact wpweaver.info if you continue to receive this message."); } } else { return false; } } function ttw_nonce_field($submit_name) { // pairs 1:1 with ttw_sumbitted // will be one for each form submit button wp_nonce_field($submit_name.'_act',$submit_name.'_nonce'); } function ttw_post_adminopt($optname) { if (isset($_POST[$optname])) ttw_setadminopt($optname, ttw_esc_code($_POST[$optname])); else ttw_deleteadminopt($optname); } function ttw_post_adminopt_html($optname) { if (isset($_POST[$optname])) ttw_setadminopt($optname, ttw_esc_html($_POST[$optname])); else ttw_deleteadminopt($optname); } function ttw_post_opt($optname) { if (isset($_POST[$optname])) ttw_setopt($optname, ttw_esc_code($_POST[$optname])); else ttw_deleteopt($optname); } function ttw_post_opt_html($optname) { // these options are html, but even wp's esc_html breaks user input. // For example,   is changed to a blank, which is NOT what is // desired behavior. Someday, might build a better filter, but for // now, let the user do what they need to do! if (isset($_POST[$optname])) { ttw_setopt($optname, ttw_esc_html($_POST[$optname])); } else ttw_deleteopt($optname); } function ttw_post_opt_js($optname) { // just use the html filter for js for now... return ttw_post_opt_html($optname); } /** * Escaping for raw code. */ function ttw_esc_code( $text ) { // virtually all option input from Weaver can be code, and thus must not be // content filtered. The utf8 check is about the extent of it, although even // that is more restrictive than the standard text widget uses. // Note: this check also works OK for simple checkboxes/radio buttons/selections, // so it is ok to blindly pass those options in here, too. return wp_check_invalid_utf8( $text ); } function ttw_esc_html( $text ) { // virtually all option text input from Weaver can be code, and thus must not be // content filtered. We will use the unfiltered_html capability to filter... if ( current_user_can('unfiltered_html') ) return wp_check_invalid_utf8($text); else return stripslashes( wp_filter_post_kses( addslashes($text) ) ); // wp_filter_post_kses() expects slashed } function ttw_options_admin() { /* theme admin page - Main Options tab */ global $ttw_options; ?>

Main Options

General Appearance | Header Options | Footer Options | Content Areas | Post Page Specifics | Widget Areas

* Note: color value boxes also allow text such as blue, inherit , transparent, rgba(), etc. The values are not checked for valid color attributes.   top"; } function mytheme_put_main_options_form($ttw_options_list, $actname, $flabel, $showFirstInput) { /* output a list of options - this really does the layout for the options defined in an array */ echo '
' ."\n"; if ($showFirstInput) { /* maybe show extra submit button at top */ // Don't change this - IE8 an IE9 have troubles if not done this way. // echo("
"); echo(""); echo("  All \"" . $flabel. "\" buttons are equivalent.
\n"); } foreach ($ttw_options_list as $value) { if ($value['type'] == "text") { ?> '); echo $value['info']; echo(""); } ?> '); echo $value['info']; echo(""); } ?> ' ; $img_hide = get_template_directory_uri() . '/images/weaver/hide.png' ; $img_show = get_template_directory_uri() . '/images/weaver/show.png' ; $help_file = get_template_directory_uri() . '/css-help.html'; $css_id = $value['id'] . '_css'; $css_id_text = ttw_getopt($css_id); if ($css_id_text && !ttw_getadminopt( 'ttw_hide_auto_css_rules' )) { $img_toggle = $img_hide; } else { $img_toggle = $img_show; } ?> '); echo $value['info']; echo(""); } ?> '); echo $value['info']; echo(""); } ?> '); echo $value['info']; echo(""); } ?> '); echo $value['info']; echo(""); } ?>  \n"); } ?>
" />
X:" />  Y:" />
" /> '; ?>
Custom CSS styling:   You can enter CSS rules, enclosed in {}'s, and separated by ;. See CSS Help for more details.
>

'.$value['name'].''; if (!empty($value['std'])) { ttw_help_link($value['std'], 'Help for ' . $value['id']); } ?>
'); echo $value['info']; echo("   top"); echo("   "); echo("