true, 'mnu.home_Caption' => "Home", 'mnu.show_Home' => true, 'mnu.top_Item_Begin' => "", 'mnu.top_Item_End' => "", 'mnu.src' => "Pages", 'vertmnu.show_Sub_menus' => false, 'vertmnu.simple' => false, 'vertmnu.src' => "Categories", ); $theme_name = "backyard1"; $short_name = "bhbackyard"; $defaultfootercontent = 'Contact Us
'.get_bloginfo('name').' - © '.date("Y"); $options = array ( array( "name" => "HTML", "desc" => sprintf(__('You are allowed to use the following tags: %s', 'kubrick'), 'a, abbr, acronym, em, b, i, strike, strong, span'), "id" => "bh_footer_content", "std" => $defaultfootercontent, "type" => "textarea") ); function bh_update_option($key, $value){ update_option($key, (get_magic_quotes_gpc()) ? stripslashes($value) : $value); } function bh_add_admin() { global $theme_name, $short_name, $options; if ( $_GET['page'] == basename(__FILE__) ) { if ('save' == $_REQUEST['action'] ) { foreach ($options as $value) { if($value['type'] != 'multicheck'){ bh_update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }else{ foreach($value['options'] as $mc_key => $mc_value){ $up_opt = $value['id'].'_'.$mc_key; bh_update_option($up_opt, $_REQUEST[$up_opt] ); } } } foreach ($options as $value) { if($value['type'] != 'multicheck'){ if( isset( $_REQUEST[ $value['id'] ] ) ) { bh_update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); } }else{ foreach($value['options'] as $mc_key => $mc_value){ $up_opt = $value['id'].'_'.$mc_key; if( isset( $_REQUEST[ $up_opt ] ) ) { bh_update_option( $up_opt, $_REQUEST[ $up_opt ] ); } else { delete_option( $up_opt ); } } } } header("Location: themes.php?page=functions.php&saved=true"); die; } } add_theme_page("Footer", "Footer", 'edit_themes', basename(__FILE__), 'bh_admin'); } function bh_admin() { global $theme_name, $short_name, $options; if ( $_REQUEST['saved'] ) echo '

'.$theme_name.' settings saved.

'; ?>

Footer Details

" /> $option) { $radio_setting = get_settings($value['id']); if($radio_setting != ''){ if ($key == get_settings($value['id']) ) { $checked = 'checked="checked"'; } else { $checked = ""; } }else{ if($key == $value['std']){ $checked = 'checked="checked"'; }else{ $checked = ''; } }?> />
/> $option) { $pn_key = $value['id'] . '_' . $key; $checkbox_setting = get_settings($pn_key); if($checkbox_setting != ''){ if (get_settings($pn_key) ) { $checked = 'checked="checked"'; } else { $checked = ""; } }else{ if($key == $value['std']){ $checked = 'checked="checked"'; }else{ $checked = ""; } }?> />

:  
  • id="li-comment-">
    :
    comment_approved == '0') : ?>
    $depth, 'max_depth' => $args['max_depth']))) ?>
    '
    ', 'before_title' => '', 'after_title' => '', 'after_widget' => '' )); } function bh_normalize_widget_style_tokens($content, $bw, $bwt, $ewt, $bwc, $bwc, $ewc, $ew) { $result = ''; $startBlock = 0; $endBlock = 0; while (true) { $startBlock = strpos($content, $bw, $endBlock); if (false === $startBlock) { $result .= substr($content, $endBlock); break; } $result .= substr($content, $endBlock, $startBlock - $endBlock); $endBlock = strpos($content, $ew, $startBlock); if (false === $endBlock) { $result .= substr($content, $endBlock); break; } $endBlock += strlen($ew); $widgetContent = substr($content, $startBlock, $endBlock - $startBlock); $beginTitlePos = strpos($widgetContent, $bwt); $endTitlePos = strpos($widgetContent, $ewt); if ((false == $beginTitlePos) xor (false == $endTitlePos)) { $widgetContent = str_replace($bwt, '', $widgetContent); $widgetContent = str_replace($ewt, '', $widgetContent); } else { $beginTitleText = $beginTitlePos + strlen($bwt); $titleContent = substr($widgetContent, $beginTitleText, $endTitlePos - $beginTitleText); if (' ' == $titleContent) { $widgetContent = substr($widgetContent, 0, $beginTitlePos) . substr($widgetContent, $endTitlePos + strlen($ewt)); } } if (false === strpos($widgetContent, $bwt)) { $widgetContent = str_replace($bw, $bw . $bwc, $widgetContent); } else { $widgetContent = str_replace($ewt, $ewt . $bwc, $widgetContent); } $result .= str_replace($ew, $ewc . $ew, $widgetContent); } return $result; } function bh_sidebar($index = 1) { if (!function_exists('dynamic_sidebar')) return false; ob_start(); $success = dynamic_sidebar($index); $content = ob_get_clean(); if (!$success) return false; $bw = ''; $bwt = ''; $ewt = ''; $bwc = ''; $ewc = ''; $ew = ''; $content = bh_normalize_widget_style_tokens($content, $bw, $bwt, $ewt, $bwc, $bwc, $ewc, $ew); $replaces = array( $bw => "
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n", $bwt => "
    \r\n
    \r\n
    \r\n
    ", $ewt => "
    \r\n
    \r\n", $bwc => "
    \r\n
    \r\n\r\n", $ewc => "\r\n\r\n\r\n
    \r\n
    \r\n
    \r\n", $ew => "\r\n
    \r\n
    \r\n
    \r\n" ); if ('' == $replaces[$bwt] && '' == $replaces[$ewt]) { $startTitle = 0; $endTitle = 0; $result = ''; while (true) { $startTitle = strpos($content, $bwt, $endTitle); if (false == $startTitle) { $result .= substr($content, $endTitle); break; } $result .= substr($content, $endTitle, $startTitle - $endTitle); $endTitle = strpos($content, $ewt, $startTitle); if (false == $endTitle) { $result .= substr($content, $startTitle); break; } $endTitle += strlen($ewt); } $content = $result; } $content = str_replace(array_keys($replaces), array_values($replaces), $content); echo $content; return true; } /* horizontal menu */ function bh_menu_items() { global $bhTheme_Settings; if ('Pages' === $bhTheme_Settings['mnu.src']) { bh_print_homepage(); add_action('get_pages', 'bh_menu_get_pages_filter'); add_action('wp_list_pages', 'bh_menu_list_pages_filter'); wp_list_pages('title_li=&sort_column=menu_order'); remove_action('wp_list_pages', 'bh_menu_list_pages_filter'); remove_action('get_pages', 'bh_menu_get_pages_filter'); } else { add_action('get_terms', 'bh_menu_get_terms_filter'); add_action('wp_list_categories', 'bh_menu_wp_list_categories_filter'); wp_list_categories('title_li='); remove_action('wp_list_categories', 'bh_menu_wp_list_categories_filter'); remove_action('get_terms', 'bh_menu_get_terms_filter'); } } /* end horizontal menu */ /* horizontal menu filters */ function bh_menu_get_pages_filter($pages) { global $bhTheme_Settings; bh_move_frontpage($pages); $bhTheme_Settings['mnu.blogID'] = bh_blogID($pages); $bhTheme_Settings['mnu.activeID'] = bh_active_pageID($pages); if (!$bhTheme_Settings['mnu.show_Sub_menus']) { bh_remove_subpage($pages); } $bhTheme_Settings['mnu.topIDs'] = bh_top_pageIDs($pages); return $pages; } function bh_menu_list_pages_filter($output) { global $bhTheme_Settings; $pref ='page-item-'; if($bhTheme_Settings['mnu.topIDs']) { foreach($bhTheme_Settings['mnu.topIDs'] as $id) { $output = preg_replace('~
  • ]+)>([^<]*)~', '
  • ' . $bhTheme_Settings['mnu.top_Item_Begin'] . '$5' . $bhTheme_Settings['mnu.top_Item_End'] . '', $output, 1); } } $frontID = null; $blogID = null; if('page' == get_option('show_on_front')) { $frontID = get_option('page_on_front'); $blogID = $bhTheme_Settings['mnu.blogID']; } if ($frontID) { $output = preg_replace('~
  • ]+)>([^<]*)~', '
  • ' . $bhTheme_Settings['mnu.top_Item_Begin'] . '$5' . $bhTheme_Settings['mnu.top_Item_End'] . '', $output, 1); } } if($bhTheme_Settings['mnu.activeID']) { $output = preg_replace('~
  • ]+)>([^<]*)~', '
  • ' . $bhTheme_Settings['mnu.top_Item_Begin'] . '$5' . $bhTheme_Settings['mnu.top_Item_End'] . '', $output, 1); } } $frontID = null; $blogID = null; if('page' == get_option('show_on_front')) { $frontID = get_option('page_on_front'); $blogID = $bhTheme_Settings['vertmnu.blogID']; } if ($frontID) { $output = preg_replace('~
  • ]+)>([^<]*)~', '
  • ' . $bhTheme_Settings['mnu.top_Item_Begin'] . '$5' . $bhTheme_Settings['mnu.top_Item_End'] . '', $output, 1); } } if($bhTheme_Settings['vertmnu.activeIDs']) { foreach($bhTheme_Settings['vertmnu.activeIDs'] as $id) { $output = preg_replace('~
  • ' .$bhTheme_Settings['mnu.top_Item_Begin'] . $bhTheme_Settings['mnu.home_Caption'] . $bhTheme_Settings['mnu.top_Item_End'] . '
  • '; } } function bh_move_frontpage(&$pages) { if ('page' != get_option('show_on_front')) return; $frontID = get_option('page_on_front'); if (!$frontID) return; foreach ($pages as $index => $page) if($page->ID == $frontID) { unset($pages[$index]); $page->post_parent = '0'; $page->menu_order = '0'; array_unshift($pages, $page); break; } } function bh_remove_subpage(&$pages) { foreach ($pages as $index => $page) if ($page->post_parent) unset($pages[$index]); } function bh_top_pageIDs($pages) { $page_IDs = array(); foreach ($pages as $index => $page) { $page_IDs[] = $page->ID; } $result = array(); foreach ($pages as $index => $page) { if (!$page->post_parent || !in_array($page->post_parent,$page_IDs)) { $result[]=$page->ID; } } return $result; } function bh_blogID($pages) { $result = null; if(!'page' == get_option('show_on_front')) { return $result; } $blogID = get_option('page_for_posts'); if (!$blogID) { return $result; } foreach ($pages as $page) { if ($page->ID == $blogID) { $result = $page; break; } } while($result && $result->post_parent) { foreach ($pages as $page) { if ($page->ID == $result->post_parent) { $result = $page; break; } } } return ($result ? $result->ID : null); } function bh_active_pageID($pages) { $current_page = null; foreach ($pages as $index => $page) { if (is_page($page->ID)) { $current_page = $page; break; } } while($current_page && $current_page->post_parent) { $parent_page = get_page($current_page->post_parent); if ($parent_page && $parent_page->post_status == 'private') { break; } $current_page = $parent_page; } return ($current_page ? $current_page->ID : null); } function bh_active_pageIDs($pages) { $current_page = null; foreach ($pages as $index => $page) { if (is_page($page->ID)) { $current_page = $page; break; } } $result = array(); if (!$current_page) { return $result; } $result[] = $current_page->ID; while($current_page->post_parent) { $current_page = get_page($current_page->post_parent); $result[] = $current_page->ID; } return $result; } function bh_process_simple_pages(&$pages, $activeIDs, $topIds) { foreach ($pages as $index => $page) { if ($page->post_parent && !in_array($page->post_parent,$activeIDs) && !in_array($page->ID,$topIds)) { unset($pages[$index]); } } } /* end pages */ /* categories */ function bh_active_catID($categories) { global $wp_query; $result = null; if (!$wp_query->is_category) { return $result; } $cat_obj = $wp_query->get_queried_object(); if (!$cat_obj) { return $result; } $result = $cat_obj->term_id; while ($cat_obj->parent != '0') { foreach ($categories as $index => $cat) if ($cat_obj->parent == $cat->term_id) { $cat_obj = $cat; break; } $result = $cat_obj->term_id; } return $result; } function bh_active_catIDs($categories) { global $wp_query; $result = array(); if (!$wp_query->is_category) { return $result; } $cat_obj = $wp_query->get_queried_object(); if (!$cat_obj) { return $result; } $result[] = $cat_obj->term_id; while ($cat_obj->parent != '0') { foreach ($categories as $index => $cat) if ($cat_obj->parent == $cat->term_id) { $cat_obj = $cat; break; } $result[] = $cat_obj->term_id; } return $result; } function bh_remove_subcat(&$terms, $topIds) { foreach ($terms as $index => $cat) { if (!in_array($cat->term_id,$topIds)) { unset($terms[$index]); } } } function bh_top_catIDs($categories) { $result = array(); $catIds = array(); foreach ($categories as $index => $cat) { $catIds[] = $cat->term_id; } foreach ($categories as $index => $cat) { if (!in_array($cat->parent,$catIds )) { $result[] = $cat->term_id; } } return $result; } function bh_process_simple_cats(&$terms, $activeIDs, $topIds) { foreach ($terms as $index => $cat) { if (!in_array($cat->term_id,$topIds) && !in_array($cat->parent,$activeIDs)) { unset($terms[$index]); } } } /* end categories */ add_filter('comments_template', 'legacy_comments'); function legacy_comments($file) { if(!function_exists('wp_list_comments')) : // WP 2.7-only check $file = TEMPLATEPATH.'/legacy.comments.php'; endif; return $file; } function widget_verticalmenu($args) { extract($args); global $bhTheme_Settings; $bw = "
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n"; $bwt = "
    \r\n
    \r\n
    \r\n
    "; $ewt = "
    \r\n
    \r\n"; $bwc = "
    \r\n
    \r\n\r\n"; $ewc = "\r\n\r\n\r\n
    \r\n
    \r\n
    \r\n"; $ew = "\r\n
    \r\n
    \r\n
    \r\n"; echo $bw; if ('' != $bwt && '' != $ewt) { echo $bwt; _e($bhTheme_Settings['vertmnu.src'], 'kubrick'); echo $ewt; } echo $bwc; ?>