84,'11' => 91,'12' => 98,'13' => 109.5,'14' => 117.5,'15' => 125,'16' => 133,'17' => 142,'18' => 151,'20' => 168.5,'22' => 181,'24' => 200,'26' => 218,'28' => 233,'32' => 270,'34' => 280,'36' => 300,'40' => 330,'44' => 370,'48' => 400,'56' => 470,'64' => 530,'72' => 600,); var $page_widget_exclusions = array(); var $list_page_options = 'sort_column=menu_order&title_li='; var $list_cats_options = 'children=1&hierarchical=1&use_desc_for_title=0&title_li=&orderby=ID'; // Some theme defaults, All these can be set from the admin page. var $theme_name = 'blend'; // The name of the theme. No real need to change this. I just use it to prefix the settings. var $theme_style = 'coffee'; // Default style, should be set to the folder name of the style you wish to use. var $title_size = 300; // Size of the tile font in the header. var $tag_size = 125; // Size of the site description tag. I use this mostly as a tag line so the default size is quite large. var $header_links = 1; // What should be shown in the link space in the header, 0 = off; 1 = blogroll; 2 = Pages with the meta value of header set to 1. var $enableNAV = true; // Should the nav bar be shown. var $navcontent = 1; // What should be shown on the nav bar, 1: Pages, 2: Categories, 3: Pages & Categories, 4: Categories & Pages. var $hometext = 'Home'; // Text for the home link on the nav bar. var $homelink = true; // Should the home link be shown. var $sidebarposition = 2; // Where should the sidebar be, 0 = off; 1 = left; 2 = right var $sidebarpostoff = false; // Should we show the sidebar when in posts/pages. var $header_hide = false; // Hide the header text, the text is still there just moved 2 miles above the top border var $header_image = 'images/logo.png'; // Header logo image, path can be either a full URI to an image or relative to the theme root. var $sIFR = false; // Always keep the default at false. Strange things happen when it's set to true. var $sIFRtitle = ''; var $sIFRtag = ''; var $sIFRwidgettitle = ''; var $sIFRposttitle = ''; var $sIFRFooter = ''; function spectaculaTheme() { if (!preg_match('/^http:\/\/.*\.(png|jpg|jpeg|gif)$/i',$this->header_image) && $this->header_image != '') // Prefix the theme path if the default doesn't reference http://. $this->header_image = get_bloginfo('template_directory').'/'.$this->header_image; //delete_option($this->theme_name.'_options'); // Uncomment to delete settings. $settings_temp = get_option($this->theme_name.'_options'); // Get the settings from the db. if (is_array($settings_temp)) foreach (array_keys($settings_temp) as $key) $this->$key = $settings_temp[$key]; // populate this class with them. add_filter('body_class',array($this,'get_agent_body_class')); add_action('wp',array($this,'prepare_header_stuff')); add_action('NAVbar',array($this,'NAVbar')); add_action('admin_menu', array($this,'add_theme_page')); // Add the admin page add_action('admin_menu',array($this,'add_sidebar_options')); //Call a function that will add my custom page interface to pages. add_action('wp_insert_post',array($this,'process_single_page_options')); // Process any options when a page is saved add_filter('loginout',array($this,'no_follow_login')); // Adds a nofollow to the login logout. add_filter('wp_list_pages_excludes',array($this,'pages_excluded_from_widgets')); // Pages to be excluded from widgets. They will still show up in the navigation bar. add_action('wp_head',array($this,'header_CSS')); // Quick and dirty header addition to override the title font size with the ones chosen in the backend. add_filter('wp_list_categories',array($this,'CategoryCountFix')); /* Register sidebars */ if ( function_exists('register_sidebar') ) { register_sidebar(array( 'name' => 'Sidebar', 'before_widget' => '
', 'before_title' =>'' )); register_sidebar(array( 'name' => 'Footer Bar', 'before_widget' => '', 'before_title' => '' )); } } // Stuff to execute before headers are sent but after WP has finished doing its thing. function prepare_header_stuff(){ global $wp_db_version; if(function_exists('wp_list_comments') && is_singular()) wp_enqueue_script('comment-reply'); if (!is_admin() && $wp_db_version > 7000) { // Only add jQuery to wp 2.5 an above. wp_enqueue_script ('behaviour',get_bloginfo('template_url').'/js/behaviour.min.js',array('jquery'),1.0); wp_localize_script('behaviour','behaviourL10n',array( 'searchError' => __('Oops! Try again.'), 'searchPrompt' => __('Search'), 'trackbackShowText' => __('Show trackbacks'), 'trackbackHideText' => __('Hide trackbacks'), 'replyHideMany' => __("Hide %count% replies to %name% comment"), 'replyShowMany' => __("View %count% replies to %name% comment"), 'replyHideOne' => __("Hide the reply to %name% comment"), 'replyShowOne' => __("View the reply to %name% comment"), 'nestDepth' => 1 // The depth at which to start collapsing comments. )); /* Simply check that sIFR is wanted, if not lets not bother adding the actions. */ wp_register_script('sifr',get_bloginfo('template_directory').'/js/sifr.js',array(),'2.0.7'); wp_register_script('blendsifr',get_bloginfo('template_directory').'/js/blend-sifr.js',array('sifr'),'1.0.0'); if ($this->sIFR) { $colours = get_theme_option('colours'); $folder = get_bloginfo('template_directory').'/fonts/'; wp_enqueue_script('sifr'); // This should dump sifr.js into the header, the next bit should output the calls in the footer. add_action('wp_footer',create_function('','wp_print_scripts("blendsifr"); return;')); wp_localize_script('blendsifr','sifrSettings',array( 'header_text' => $colours['header_text'], 'header_back' => $colours['header_back'], 'content_text' => $colours['content_text'], 'content_link1' => $colours['content_link1'], 'content_back' => $colours['content_back'], 'content_highlight' => $colours['content_highlight'], 'content_link1_hover'=> $colours['content_link1_hover'], 'footer1_text' => $colours['footer1_text'], 'footer1_back' => $colours['footer1_back'], 'sIFRtitle' => get_theme_option('sIFRtitle') ? $folder.get_theme_option('sIFRtitle') : false, 'sIFRtag' => get_theme_option('sIFRtag') ? $folder.get_theme_option('sIFRtag') : false, 'sIFRwidgettitle' => get_theme_option('sIFRwidgettitle') ? $folder.get_theme_option('sIFRwidgettitle') : false, 'sIFRposttitle' => get_theme_option('sIFRposttitle') ? $folder.get_theme_option('sIFRposttitle') : false, 'sIFRFooter' => get_theme_option('sIFRFooter') ? $folder.get_theme_option('sIFRFooter') : false, )); } } } // Move the category count to inside the anchor. Otherwise formatting done on the anchor can be messed up when the option is turned on. function CategoryCountFix($content) { $content = preg_replace("/<\/a>[^\(<]*(\([0-9]*\))/i"," $1",$content); return $content; } // Simple function to test if we are on WP25 yet or still on 2.3. If on 2.5 we'll use the new admin interface. function add_sidebar_options(){ if( function_exists( "add_meta_box" )) { add_meta_box("ICIT_Page_Options","Theme specific options for this post",array($this,"single_post_options"),"post"); add_meta_box("ICIT_Page_Options","Theme specific options for this page",array($this,"single_page_options"),"page"); } else { add_action("dbx_post_sidebar",array($this,"single_post_options"),10); add_action("dbx_page_sidebar",array($this,"single_page_options"),10); } } //Change the [...] item at the bottom of the excerpt to a more useful link. function excerpt_more_link($content = "") { $content = str_replace(array(" […]","[…]"),"…",$content); return ($content.""); } /* Navigation bar */ function NAVbar(){ if (get_theme_option("enableNAV")) {?> page_widget_exclusions = array(); $page_list = get_pages("meta_key=exclude&meta_value=1&hierarchical=0"); foreach ($page_list as $excluded_pages) { array_push($this->page_widget_exclusions,$excluded_pages->ID); } $this->page_widget_exclusions_executed = true; return get_theme_option("page_widget_exclusions"); } /* This is a filter for pages that will be hidden from The navigation bar. */ function pages_excluded_from_navigation() { if ($this->pages_excluded_from_navigation_executed) return $this->page_navigation_exclusions; // No point searching twice so we'll just send back what we already know. $page_list = $this->page_navigation_exclusions = array(); $page_list = get_pages("meta_key=nav-exclude&meta_value=1&hierarchical=0"); foreach ($page_list as $excluded_pages) { array_push($this->page_navigation_exclusions,$excluded_pages->ID); } $this->pages_excluded_from_navigation_executed = true; return $this->page_navigation_exclusions; } /* A simple bit of regEX to find and remove a title from an anchor. I use this as a filter on wp_list_pages and wp_list_categories to remove the title attribute when I have them arranged in a drop-down menu. The title tag can get in the way causing you to lose focus on the menu resulting in the menu folding away.*/ function remove_title_attrib($content = "") { $content = preg_replace("/(]*)(title=\"[^\"]*\")([^<>]*>)/iUs","$1$3",$content); return($content); } /* Add a nofollow attribute to the wp_login as there is no point google indexing that and helps me hide from certain searches that are looking just for wp installs. */ function no_follow_login($content="") { return ereg_replace( "(]*)(>.*)","\\1 rel=\"nofollow\"\\2",$content); } // Title should be sort of self explanatory. It removes the above filter. function turn_off_page_exclusions () { remove_filter("wp_list_pages_excludes",array($this,"pages_excluded_from_widgets")); return true; } // Title should be sort of self explanatory. It adds the above filter. function turn_on_page_exclusions () { add_filter("wp_list_pages_excludes",array($this,"pages_excluded_from_widgets")); return true; } /* Search the styles sub folder for valid colour schemes. */ function find_schemes () { $this->colour_schemes; /* Define as a global so that if I need it twice in a single execution I shouldn't have to search the files again. */ if (isset($this->colour_schemes)) return $this->colour_schemes; /* Most of this is a straight copy of the theme collection code in themes.php. Why reinvent the wheel. */ $styles_root = TEMPLATEPATH."/styles"; $styles_folder = @opendir($styles_root); if (!$styles_folder) return false; $this->colour_schemes = array(); /* Read the content of the styles folder finding any folders with a style.cfg file in it and dropping that name into an array. */ while (($scheme_folder = readdir($styles_folder)) !== false ) { if (is_dir($styles_root."/".$scheme_folder) && is_readable($styles_root."/".$scheme_folder) ) { if ( $scheme_folder{0} == "." || $scheme_folder == ".." || $scheme_folder == "CSV" ) continue; /* Drop out of the while if the file is very unlikely to be needed.*/ $scheme_folder_content = @opendir($styles_root."/".$scheme_folder); while (($scheme_file = readdir($scheme_folder_content)) !== false) { if($scheme_file == "style.cfg") array_push($this->colour_schemes,array("folder" => $scheme_folder)); } @closedir($scheme_folder_content); } } @closedir($styles_root); /*Lets open all previously found style.cfg files and extract a few needed elements. */ for ($i = 0;$i < count($this->colour_schemes);$i++) { /* Open the file and dump it to a variable. */ $file = TEMPLATEPATH."/styles/".$this->colour_schemes[$i]["folder"]."/style.cfg"; if (file_exists($file)) { $stylecfg = fopen($file,"r"); $file_content = fread($stylecfg, filesize($file)); fclose($stylecfg); } /* Find all objects matching the patern of $word = vale; */ preg_match_all("/\\$([a-z0-9A-Z_\-]+)[ |\t]*=[ |\t]*([^;$\n]*)/s",$file_content,$returns); for ($count=0;$count < count($returns[1]);$count++) { if (strtolower($returns[1][$count] == "title")) $this->colour_schemes[$i]["title"] = preg_replace("/[^a-zA-Z0-9 ]*/","",$returns[2][$count]); //strip anything that isn't meant to be in the title. /*Find the colours I need for the sIFR forground and background so I can store them in the DB. I then don't need to read the files each time, although I do read them when processing the CSS I don't want to over do it. */ if (in_array(strtolower($returns[1][$count]),array("header_text","header_back","content_text","content_back","content_highlight","content_link1","content_link1_hover","footer1_back","footer1_text"))) { //I'll strip anything that dosn't look like a hex colour code and replace it with something ugly. :D Should be spotted that way. if (preg_match("/^#([0-9A-F]{3}|[0-9A-F]{6})$/i",$returns[2][$count])) { $this->colour_schemes[$i]["colours"][strtolower($returns[1][$count])] = $returns[2][$count]; } else { $this->colour_schemes[$i]["colours"][strtolower($returns[1][$count])] = "#FF99CC"; } } } if (!isset($this->colour_schemes[$i]["title"])) $this->colour_schemes[$i]["title"] = $this->colour_schemes[$i]["folder"]; } return($this->colour_schemes); } /* Search the fonts folder for any swf files and assume they are sIFR fonts. */ function font_list() { global $fonts_list; // Set it up as a global so I can keep referring back to the global rather than re-reading the folder. if (isset($fonts_list)) return $fonts_list; $fonts_list= array(); $files = @glob(TEMPLATEPATH."/fonts/*.swf"); // I'll likely have to change this to use something other than glob as glob won't work universally. if (is_array($files) && count($files) > 0) { $fonts_list = array(); foreach ($files as $file) array_push($fonts_list,str_replace(TEMPLATEPATH."/fonts/","",$file)); } return($fonts_list); } /* Simple filter to override the header font sizes. */ function header_CSS() { echo "\n"; } /* Add the page to the back end and process any post variables that need processing.*/ function add_theme_page() { if ($_GET["page"] == basename(__FILE__)) { /* If the admin is using this file then execute the following. */ add_action("admin_head", array($this,"admin_head")); /* Add my CSS to the header. */ add_action("admin_footer", array($this,"admin_foot")); /*Add my JS to the footer of the admin page. I like my JS at the foot as I can usually be sure the rest of the page has loaded. */ /* Process the post variable and check and filter anything that shouldn't be there.*/ if (count($_POST) > 0) { $schemes = $this->find_schemes(); /* Retreive the list of available schemes. */ if ($_POST["theme_style"] != "") { foreach ($schemes as $scheme) if ($scheme["folder"] == $_POST["theme_style"]) { $this->theme_style = $scheme["folder"]; $this->colours = $scheme["colours"]; } } else { unset($this->theme_style); unset($this->colours); } /* Check the sIFR toggle switch, if on then well check the fonts at the same time. If someone changes a font then sets it to disabled then the change will not be saved, not a big loss in my book though. Could cause confustion to people with JS turned off as the font dropdowns will still be usable.*/ if ($_POST["sIFR"] == "on") { $this->sIFR = true; unset($this->sIFRtitle); unset($this->sIFRtag); unset($this->sIFRwidgettitle); unset($this->sIFRposttitle); unset($this->sIFRFooter); foreach ($this->font_list() as $font) { if ($_POST["sIFRtitle"] == $font) $this->sIFRtitle = $font; if ($_POST["sIFRtag"] == $font) $this->sIFRtag = $font; if ($_POST["sIFRwidgettitle"] == $font) $this->sIFRwidgettitle = $font; if ($_POST["sIFRposttitle"] == $font) $this->sIFRposttitle = $font; if ($_POST["sIFRFooter"] == $font) $this->sIFRFooter = $font; $this->settings_updated["warn"]["fonts"] = "Caution: If using sIFR fonts for the post/page title or sidebar widget title the navigation bar drop down menus may fall behind the sIFR fonts."; } } else { $this->sIFR = false; } /* Check and save the font scaling */ if ($_POST["title_size"] != "" && in_array($_POST["title_size"],$this->font_size_array)) $this->title_size = floatval($_POST["title_size"]); if ($_POST["tag_size"] != "" && in_array($_POST["tag_size"],$this->font_size_array)) $this->tag_size = floatval($_POST["tag_size"]); if (($this->title_size != 300) || ($this->tag_size != 125)) $this->settings_updated["warn"]["font-size"] = "Be cautious when setting font sizes for the header, if you have sIFR turned on you should check that it doesn't break the page with sIFR off."; if ($_POST["header_hide"] == "on") { $this->header_hide = true; } else { $this->header_hide = false; } /* Filter the header image file post var. */ $theimage = strip_tags(stripslashes($_POST["header_image"])); // Get rid of stuff that someone may try and add to the string. if (preg_match("/^http:\/\/.+\.(png|gif|jpeg|jpg|jpe)$/",$theimage)) { // Lets make sure we have the full path and a gif, jpg or png extension. $this->header_image = $theimage; } else { $this->header_image = ""; if ($theimage != "") $this->settings_updated["errors"]["header"] = "The image URL is invalid. The path should start http:// and end with jpeg, jpg, jpe, gif or png."; } /*The links space to the right of the header section, lets see what is wanted there. */ switch ($_POST["header_links"]) { /* Header links, pages or off.*/ case 0: $this->header_links = 0; break; case 1: $this->header_links = 1; $this->settings_updated["warn"]["links"] = "The links space in the header when set to links is limited to the 10 most recent links."; break; case 2: $this->header_links = 2; $this->settings_updated["warn"]["links"] = "Notice: If you have no pages set to show in the header space the space will act as though it is off.There seems to have been a problem.
Settings Updated
settings_updated["warn"])) {?>