body_class();}
class InterconnectITTheme {
function __construct() {
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_action("wp_footer",array($this,"credit_line"));
add_action("wp_head",array($this,"fixIE"),20);
if (file_exists(TEMPLATEPATH."/widget/icit-navigation-widget.php")){ /* Add my custom navigation widget to the list of available widgets. The file can be moved out of the widget folder and into the plugins folder if needed. */
include_once TEMPLATEPATH."/widget/icit-navigation-widget.php";
define("HEADER_TEXTCOLOR","fff");
define("HEADER_IMAGE","%s/style/logo.png"); // %s is theme dir uri
define("HEADER_IMAGE_WIDTH", 128);
define("HEADER_IMAGE_HEIGHT", 128);
}
if (function_exists("add_custom_image_header")) {
add_custom_image_header("customImageHeader","customImageAdminHeader");
}
/* Register the two sidebars, first one is your normal sidebar and the second is the ad-banner type space at the top. */
if ( function_exists("register_sidebar") ) {
register_sidebar(array(
"name" => "Sidebar",
"before_widget" => "
"
));
}
}
// 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" )) {
// WP 2.5 stuff will go here once wp2.5 is stable.
add_meta_box("ICIT_Page_Options","Theme options for this page",array($this,"single_page_options_wp25"),"page");
add_meta_box("ICIT_Page_Options","Theme options for this page",array($this,"single_page_options_wp25"),"post");
} else {
add_action("dbx_post_sidebar",array($this,"single_page_options"),10);
add_action("dbx_page_sidebar",array($this,"single_page_options"),10);
}
}
function fixIE(){
?>
ID) {
if (get_post_meta($post->ID,"Hide-Meta-Data",true) == "1"){ $hidemetachecked = " checked=\"checked\"";}
}?>
ID) {
if (get_post_meta($post->ID,"Hide-Meta-Data",true) == "1"){ $hidemetachecked = " checked=\"checked\"";}
}?>
]*)(>.*)","\\1 rel=\"nofollow\"\\2",$content);
}
/* A simple browser sniffer, I call this from within the body tag to add a couple of classes to it to help me with the CSS in certain browsers. */
function body_class() {
$class = array();
$useragent = getenv("HTTP_USER_AGENT");
/* Add OS type*/
if (stristr($useragent,"linux"))
array_push($class,"linux");
elseif (stristr($useragent,"mac os x") || stristr($useragent,"mac_"))
array_push($class,"apple");
elseif (stristr($useragent,"Windows"))
array_push($class,"windows");
else
array_push($class,"other-os");
/* Add a tag for browser type. */
if (stristr($useragent,"firefox"))
array_push($class,"firefox");
elseif (stristr($useragent,"safari"))
array_push($class,"safari");
elseif (stristr($useragent,"Konqueror"))
array_push($class,"konqueror");
elseif (stristr($useragent,"MSIE")) {
array_push($class,"ie");
/* Add an identifier for IE versions. */
preg_match("/MSIE[^;]*/s",$useragent,$match);
$version = explode(" ",$match[0]);
$version = $version[1];
// With luck ie8 won't need and hacking. I try and avoid IE7 hacking so fingers crossed.
if ($version >= 7 && $version < 8) array_push($class,"ie7");
if ($version >= 6 && $version < 7) array_push($class,"ie6");
if ($version >= 5.5 && $version < 6) array_push($class,"ie55");
if ($version >= 5 && $version < 5.5) array_push($class,"ie5");
if ($version < 6) array_push($class,"ie-quirk-mode");
if ($version < 5) array_push($class,"ie-old");
}
/* Check to see where we are in the wordpress system */
if (is_page()) array_push($class,"page");
if (is_home()) array_push($class,"home");
if (is_single()) array_push($class,"single");
if (is_category()) array_push($class,"category");
if (is_author()) array_push($class,"author");
if (is_search()) array_push($class,"search");
if (is_date()) array_push($class,"date");
if (is_year()) array_push($class,"year");
if (is_month()) array_push($class,"month");
if (is_day()) array_push($class,"day");
if (is_time()) array_push($class,"time");
if (is_404()) array_push($class,"404");
if (is_paged()) array_push($class,"paged");
if (is_attachment()) array_push($class,"attachment");
if (is_archive() && !is_category()) array_push($class,"archive");
return implode(" ",$class);
}
function credit_line() {
?>
\n\t\n\n
IEHEADERFIX;
}
}?>