true,
'menu.homeCaption' => "Home",
'menu.showHome' => true,
'menu.topItemBegin' => "",
'menu.topItemEnd' => ""
);
load_theme_textdomain('kubrick');
$themename = "MGIFOW_V2";
$default_footer_content = "Contact Us | Terms of Use | Trademarks | Privacy Statement
Copyright © 2009 ".get_bloginfo('name').". All Rights Reserved.";
$options = array (
array( "name" => "HTML",
"desc" => sprintf(__('XHTML: You can use these tags: %s
', 'kubrick'), 'a, abbr, acronym, em, b, i, strike, strong, span'),
"id" => "art_footer_content",
"std" => $default_footer_content,
"type" => "textarea")
);
function art_update_option($key, $value){
update_option($key, (get_magic_quotes_gpc()) ? stripslashes($value) : $value);
}
function art_add_admin() {
global $themename, $shortname, $options;
if ( $_GET['page'] == basename(__FILE__) ) {
if ('save' == $_REQUEST['action'] ) {
foreach ($options as $value) {
if($value['type'] != 'multicheck'){
art_update_option( $value['id'], $_REQUEST[ $value['id'] ] );
}else{
foreach($value['options'] as $mc_key => $mc_value){
$up_opt = $value['id'].'_'.$mc_key;
art_update_option($up_opt, $_REQUEST[$up_opt] );
}
}
}
foreach ($options as $value) {
if($value['type'] != 'multicheck'){
if( isset( $_REQUEST[ $value['id'] ] ) ) { art_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 ] ) ) { art_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__), 'art_admin');
}
function art_admin() {
global $themename, $shortname, $options;
if ( $_REQUEST['saved'] ) echo '
'.$themename.' settings saved.
';
// After the first and before the last ?>
function enable_more_buttons($buttons) {
$buttons[] = 'hr';
return $buttons;
}
add_filter("mce_buttons", "enable_more_buttons");
?>
: |
|
| |
id="li-comment-">
''.'',
'before_title' => '',
'after_title' => '',
'after_widget' => ''.'
'
));
}
function art_normalize_widget_style_tokens($content) {
$bw = '';
$bwt = '';
$ewt = '';
$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 art_sidebar($index = 1)
{
if (!function_exists('dynamic_sidebar')) return false;
ob_start();
$success = dynamic_sidebar($index);
$content = ob_get_clean();
if (!$success) return false;
$content = art_normalize_widget_style_tokens($content);
$replaces = array(
'' => "\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n",
'' => "",
'' => "
\r\n",
'' => "\r\n
\r\n
\r\n
\r\n"
);
$bwt = '';
$ewt = '';
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;
}
function art_activeID($pages){
$result = null;
foreach ($pages as $index => $page){
if (is_page($page->ID)) {
$result = $page;
break;
}
}
while($result && $result->post_parent) {
foreach ($pages as $index => $parent){
$p = get_page($result->post_parent);
if ($p->post_status == 'private') {
$pages[$index]->post_parent = 0;
$result->post_parent = 0;
$childs = array();
$childs = get_page_children( $p->ID, $pages );
foreach ($childs as $key => $child){
$childs[$key]->post_parent = 0;
}
$childs = array();
$childs = get_page_children( $result->ID, $pages );
foreach ($childs as $key => $child){
$childs[$key]->post_parent = 0;
}
}
if ($parent->ID == $result->post_parent) {
$p = get_page($parent->post_parent);
if ($p->post_status != 'private') {
$result = $parent;
break;
} else {
$pages[$index]->post_parent = 0;
$childs = array();
$childs = get_page_children( $parent->ID, $pages );
foreach ($childs as $key => $child){
$childs[$key]->post_parent = 0;
}
}
}
}
}
return ($result ? $result->ID : null);
}
function art_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 $index => $page){
if ($page->ID == $blogID) {
$result = $page;
break;
}
}
while($result && $result->post_parent) {
foreach ($pages as $parent){
if ($parent->ID == $result->post_parent) {
$result = $parent;
breack;
}
}
}
return ($result ? $result->ID : null);
}
function art_process_front(&$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 art_topIDs($pages){
$result = array();
foreach ($pages as $index => $page){
if (!$page->post_parent) $result[]=$page->ID;
else {
$p = get_page($page->post_parent);
if ($p->post_status == 'private') {
$result[]=$page->ID;
$childs = array();
$childs = get_page_children( $page->ID, $pages );
foreach ($childs as $child){
$result[]=$child->ID;
}
}
}
}
return $result;
}
function art_remove_subitems(&$pages){
foreach ($pages as $index => $page)
if ($page->post_parent) unset($pages[$index]);
}
function art_header_page_list_filter($pages)
{
global $artThemeSettings;
art_process_front($pages);
$artThemeSettings['menu.topItemIDs'] = art_topIDs($pages);
$artThemeSettings['menu.activeID'] = art_activeID($pages);
$artThemeSettings['menu.blogID'] = art_blogID($pages);
if (!$artThemeSettings['menu.showSubmenus']) art_remove_subitems($pages);
return $pages;
}
function art_list_pages_filter($output)
{
global $artThemeSettings;
$pref ='page-item-';
if($artThemeSettings['menu.topItemIDs'])
foreach($artThemeSettings['menu.topItemIDs'] as $id){
$output = preg_replace('~]+)>([^<]*)~',
'' . $artThemeSettings['menu.topItemBegin']
. '$5' . $artThemeSettings['menu.topItemEnd'] . '', $output, 1);
}
$frontID = null;
$blogID = null;
if('page' == get_option('show_on_front')) {
$frontID = get_option('page_on_front');
$blogID = $artThemeSettings['menu.blogID'];
}
if ($frontID)
$output = preg_replace('~'.$artThemeSettings['menu.topItemBegin']
. $artThemeSettings['menu.homeCaption'] . $artThemeSettings['menu.topItemEnd'] . '';
add_action('get_pages', 'art_header_page_list_filter');
add_action('wp_list_pages', 'art_list_pages_filter');
wp_list_pages('title_li=&sort_column=menu_order');
remove_action('wp_list_pages', 'art_list_pages_filter');
remove_action('get_pages', 'art_header_page_list_filter');
}
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;
}
?>