'.__("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 = $_POST[$id];
ttw_setopt( $id, $v );
} else {
ttw_defaultopt( $id );
}
$css_id = $id . '_css';
if ( isset( $_POST[ $css_id ] ) ) { // do the CSS part
$v = $_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*/' );
}
} else {
if ( isset( $_POST[ $id ] ) ) {
$v = $_POST[$id];
ttw_setopt( $id, $v );
} else {
ttw_defaultopt( $id );
}
}
}
ttw_saveopts();
}
if (isset($_POST['saveadvanced'])) {
echo ''.__("Twenty Ten Weaver advanced options saved.",TTW_TRANS).'
';
// THEME OPTS - advanced theme opts
ttw_post_opt('ttw_head_opts');
ttw_post_opt('ttw_theme_head_opts');
ttw_post_opt('ttw_footer_opts');
ttw_post_opt('ttw_header_insert');
ttw_post_opt('ttw_preheader_insert');
ttw_post_opt('ttw_prefooter_insert');
ttw_post_opt('ttw_postfooter_insert');
ttw_post_opt('ttw_postheader_insert');
ttw_post_opt('ttw_presidebar_insert');
ttw_post_opt('ttw_custom_header_insert');
ttw_post_opt('ttw_header_frontpage_only');
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');
ttw_post_opt('ttw_hide_custom_header_template_menus');
ttw_post_opt('ttw_hide_custom_header_template_siteinfo');
ttw_post_opt('ttw_hide_blank_header');
ttw_post_opt('ttw_hide_blank_footer');
// ADMIN OPTS - per site tags - not theme related
ttw_post_adminopt('ttw_hide_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_metainfo');
ttw_post_adminopt('ttw_end_opts');
ttw_post_adminopt('ttw_copyright');
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 (isset($_POST['setsubtheme']) || isset($_POST['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 = $_POST[ $pID]; /* must have been set to get here */
if ($cur_subtheme == '') $cur_subtheme = TTW_DEFAULT_THEME; /* but just in case */
/* now, i set all values for theme */
st_set_subtheme($cur_subtheme);
$t = ttw_getopt('ttw_subtheme'); if ($t == '') $t = TTW_DEFAULT_THEME; /* did we save a theme? */
echo ''.__("Twenty Ten Weaver options reset to sub-theme: ",TTW_TRANS).$t.
'.
';
}
if (isset($_POST['changethemename'])) {
if (isset($_POST['newthemename'])) {
$new_name = sanitize_user($_POST['newthemename']);
ttw_setopt('ttw_themename',$new_name);
echo 'Theme name changed to '.$new_name.'
';
}
}
if (isset($_POST['savemytheme'])) {
ttw_savemytheme();
echo ''.__('All current main and advanced options saved in My Saved Theme.',TTW_TRANS).'
';
}
if (isset($_POST['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 (isset($_POST['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 (isset($_POST['uploadit']) && $_POST['uploadit'] == 'yes') { // don't know if need 2nd test or not...
ttw_uploadit();
}
if (isset($_POST['uploadthemeurl'])) {
// url method
$filename = esc_url($_POST['ttw_uploadname'] );
if (ttw_upload_theme($filename)) {
$t = ttw_getopt('ttw_subtheme'); if ($t == '') $t = TTW_DEFAULT_THEME; /* 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 (isset($_POST['restoretheme'])) {
$wpdir = wp_upload_dir();
$fn = $wpdir['basedir'].'/weaver-subthemes/'.$_POST['ttw_restorename'];
if (ttw_upload_theme($fn )) {
$t = ttw_getopt('ttw_subtheme'); if ($t == '') $t = TTW_DEFAULT_THEME; /* 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 (isset($_POST['deletetheme'])) {
$myFile = $_POST['selectName'];
if ($myFile != "None") {
$wpdir = wp_upload_dir();
unlink($wpdir['basedir'].'/weaver-subthemes/'.$myFile);
echo 'File: '.$myFile.' has been deleted.
';
}
}
if (isset($_POST['ttw_save_extension'])) { /* for theme extensions */
do_action('ttwx_save_extension');
}
?>
'); /* extended option admin tab */ ?>
Preview of site. Displays current look after you save options or select sub-theme.
Site Preview Disabled\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 = TTW_DEFAULT_THEME; /* did we save a theme? */
echo ''.__("Twenty Ten Weaver theme options reset to uploaded theme, saved as: ",TTW_TRANS).$t.
'.
';
}
}
}
function ttw_post_adminopt($optname) {
if (isset($_POST[$optname]))
ttw_setadminopt($optname, $_POST[$optname]);
else
ttw_deleteadminopt($optname);
}
function ttw_post_opt($optname) {
if (isset($_POST[$optname]))
ttw_setopt($optname, $_POST[$optname]);
else
ttw_deleteopt($optname);
}
function ttw_options_admin() {
/* theme admin page - Main Options tab */
global $ttw_options;
?>
Main Options
Main color* and appearance options
The main options are organized as General Appearance,
Header Options,
Footer Options,
Content Areas,
Post Page Specifics, and
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_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 '