array ( 'url' => "$ttw_dir/images/headers/ivorydrive.png", 'thumbnail_url' => "$ttw_dir/images/headers/ivorydrive-thumbnail.png", 'description' => __( 'Ivory Drive band example', TTW_TRANS ) ), 'indieave' => array ( 'url' => "$ttw_dir/images/headers/indieave.png", 'thumbnail_url' => "$ttw_dir/images/headers/indieave-thumbnail.png", 'description' => __( 'Indie Ave 940x180 example', TTW_TRANS ) ), 'wpweaver' => array ( 'url' => "$ttw_dir/images/headers/wpweaver.jpg", 'thumbnail_url' => "$ttw_dir/images/headers/wpweaver-thumbnail.jpg", 'description' => __( 'WPWeaver 940x140 Header', TTW_TRANS ) ), 'sopris' => array ( 'url' => "$ttw_dir/images/headers/sopris.png", 'thumbnail_url' => "$ttw_dir/images/headers/sopris-thumbnail.png", 'description' => __( 'Sopris 940x198 Header', TTW_TRANS ) ) )); ## secondary menu register_nav_menus( array( 'secondary' => __( 'Secondary Navigation', TTW_TRANS ), ) ); ## top widget area register_sidebar( array ( 'name' => __( 'TTW Top Widget Area', TTW_TRANS ), 'id' => 'top-widget-area', 'description' => __( 'The top widget area', TTW_TRANS ), 'before_widget' => '
  • ', 'after_widget' => "
  • ", 'before_title' => '

    ', 'after_title' => '

    ', ) ); ## bottom widget area register_sidebar( array ( 'name' => __( 'TTW Bottom Widget Area', TTW_TRANS ), 'id' => 'bottom-widget-area', 'description' => __( 'The bottom widget area', TTW_TRANS ), 'before_widget' => '
  • ', 'after_widget' => "
  • ", 'before_title' => '

    ', 'after_title' => '

    ', ) ); ttw_extended_setup(); ttw_initopts(); /* load opts */ $cur_theme = ttw_getopt('ttw_subtheme'); if ($cur_theme == '' && TTW_START_THEME != TTW_DEFAULT_THEME) st_set_subtheme(TTW_START_THEME); } function mytheme_add_admin() { /* adds our admin panel */ if (TTW_MULTISITE || TTW_DEMOMULTISITE) { define('THEME_CAP','edit_theme_options'); /* allows non-superadmin admins to use theme options */ } else { define('THEME_CAP','edit_themes'); /* don't want Twenty Ten Weaver to work on MULTISITE */ } $page = add_theme_page(TTW_THEMENAME, TTW_THEMENAME, THEME_CAP, basename(__FILE__), 'mytheme_admin'); /* using registered $page handle to hook stylesheet loading for this admin page */ add_action('admin_print_styles-'.$page, 'ttw_admin_scripts'); } function ttw_admin_scripts() { /* called only on the admin page, enqueue our special style sheet here (for tabbed pages) */ wp_enqueue_style('ttwStylesheet', get_bloginfo('stylesheet_directory').'/ttw-admin-style.css'); wp_enqueue_script('ttwjscolor', get_bloginfo('stylesheet_directory').'/js/jscolor/jscolor.js'); wp_enqueue_script('ttwyetii', get_bloginfo('stylesheet_directory').'/js/yetii/yetii-min.js'); ttw_extended_admin_scripts(); } /* we use these option functions so that there is only one DB transaction per page load */ function ttw_setopt($opt, $val) { global $optionsList; $optionsList[$opt] = $val; } function ttw_getopt($opt) { global $optionsList; return $optionsList[$opt]; } function ttw_deleteopt($opt) { global $optionsList; $optionsList[$opt] = false; } function ttw_defaultopt($opt) { global $optionsList; $optionsList[$opt] = ttw_getopt_std($opt); /* set to default value */ } function ttw_setmyopt($opt, $val) { global $myoptionsList; $myoptionsList[$opt] = $val; } function ttw_getmyopt($opt) { global $myoptionsList; return $myoptionsList[$opt]; } function ttw_deletemyopt($opt) { global $myoptionsList; $myoptionsList[$opt] = ''; } function ttw_initopts() { global $optionsList, $myoptionsList, $options; $using12 = false; /* updating from 1.1 ? */ /* first thing, make sure $optionsList and $myoptionsList are set to good default values */ foreach ($options as $value ) { ttw_defaultopt( $value['id'] ); ttw_setmyopt($value['id'], ttw_getopt($value['id'])); } $opts = get_option('ttw_options'); if ($opts) { $using12 = true; $optionsList = unserialize($opts); } $myopts = get_option('ttw_myoptions'); if (!$myopts) $myoptionsList = $optionsList; else { $using12 = true; $myoptionsList = unserialize($myopts); } if (!$using12) { /* either they've never run this theme before, or they might be upgrading from 1.1 */ $oldFound = false; foreach ($optionsList as $opt => $notused) { $val = get_option($opt); if ($val) { $oldFound = true; if ($val != '') ttw_setopt($opt, $val); } $myval = get_option('my_'.$opt); if ($myval) { $oldFound = true; if ($myval != '') ttw_setmyopt($opt, $myval); } delete_option($opt); /* and delete it to clean up db */ delete_option('my_'.$opt); } if ($oldFound) { ttw_saveopts(); ?>

    You have just upgraded from an earlier version of the Weaver Theme.

    Because of some small changes in the theme defaults, you might see some differences in your custom theme, especially if you have set different background colors. If that is the case, simply use the Main Options tab to be sure all the background colors are set, and update the settings. Also some of the predefined themes have been tweaked to take advantage of the new features.

    Hope you enjoy all the other new features! Thank you for using Twenty Ten Weaver.

    This theme requires Wordpress 3 or greater. It will activate but not work properly with earlier versions of Wordpress. Please deactivate and upgrade to Wordpress 3.

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

    '; foreach ($options as $value) { /* only reset main options so use $options */ $id = $value['id']; if( isset( $_POST[ $id ] ) ) { $v = $_POST[$id]; ttw_setopt( $id, $_POST[ $id ] ); } else { ttw_defaultopt( $id ); } } ttw_saveopts(); } if (isset($_POST['saveadvanced'])) { echo '

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

    '; if (isset($_POST['ttw_head_opts'])) ttw_setopt('ttw_head_opts', str_replace("\\", "", $_POST['ttw_head_opts'])); else ttw_deleteopt('ttw_head_opts'); if (isset($_POST['ttw_theme_head_opts'])) ttw_setopt('ttw_theme_head_opts', str_replace("\\", "", $_POST['ttw_theme_head_opts'])); else ttw_deleteopt('ttw_theme_head_opts'); if (isset($_POST['ttw_end_opts'])) ttw_setopt('ttw_end_opts', str_replace("\\", "", $_POST['ttw_end_opts'])); else ttw_deleteopt('ttw_end_opts'); if (isset($_POST['ttw_footer_opts'])) ttw_setopt('ttw_footer_opts', str_replace("\\", "", $_POST['ttw_footer_opts'])); else ttw_deleteopt('ttw_footer_opts'); if (isset($_POST['ttw_header_insert'])) ttw_setopt('ttw_header_insert', str_replace("\\", "", $_POST['ttw_header_insert'])); else ttw_deleteopt('ttw_header_insert'); if (isset($_POST['ttw_header_frontpage_only'])) ttw_setopt('ttw_header_frontpage_only', $_POST['ttw_header_frontpage_only']); else ttw_deleteopt('ttw_header_frontpage_only'); 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['savemytheme'])) { ttw_savemytheme(); echo '

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

    '; } if (isset($_POST['exporttheme'])) { ttw_export_theme(); } if (isset($_POST['uploadtheme'])) { if (ttw_upload_theme()) { $t = ttw_getopt('ttw_subtheme'); if ($t == '') $t = TTW_DEFAULT_THEME; /* did we save a theme? */ echo '

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

    '; } else { echo ('

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

    '); } } if (isset($_POST['ttw_save_extension'])) { /* for theme extensions */ ttw_save_extension(); } ?>

    Options

    ', '
    '); /* and add the extended option admin tab if exists */ ?>

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

    \n"); echo(' \n"); } /* end mytheme_wp_head */ function childtheme_set_hi_height($def) { /* filter to change the height of the default header image */ $val = ttw_getopt("ttw_header_image_height"); return (int) $val; } function childtheme_set_hi_width($def) { /* filter to change the height of the default header image */ $val = ttw_getopt("ttw_header_image_width"); return (int) $val; } require_once("ttw-options.php"); /* add the rest of our files */ require_once("ttw-advancedopts.php"); require_once("ttw-help.php"); require_once("ttw-subthemes.php"); require_once("ttw-extend.php"); /* This is where the theme hooks into the rest of Wordpress */ add_filter('twentyten_header_image_height', 'childtheme_set_hi_height'); add_filter('twentyten_header_image_width', 'childtheme_set_hi_width'); add_action('after_setup_theme', 'weaver2010_setup' ); add_action('wp_head', 'mytheme_wp_head'); add_action('admin_menu', 'mytheme_add_admin'); if (!TTW_IS_CHILD) require_once("2010functions.php"); /* load the parent */ ?>