'', '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
\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_list_pages_filter($output) { $output = preg_replace('~]*)>]*)>([^<]*)~', '$3', $output); $re = '~
  • post_parent) $result[] = $page; return $result; } function art_menu_items($hierarchy) { ob_start(); bloginfo('home'); $home = ob_get_clean(); echo '
  • Home
  • '; if (!$hierarchy) add_action('get_pages', 'art_header_page_list_filter'); add_action('wp_list_pages', 'art_list_pages_filter'); wp_list_pages('title_li='); remove_action('wp_list_pages', 'art_list_pages_filter'); if (!$hierarchy) remove_action('get_pages', 'art_header_page_list_filter'); }