global $art_default_options; $art_default_options = array( 'art_header_show_headline' => 1, 'art_header_show_slogan' => 1, 'art_menu_showHome' => 1, 'art_menu_highlight_active_categories' => 1, 'art_menu_homeCaption' => 'Home', 'art_menu_trim_title'=> 1, 'art_menu_trim_len'=> 45, 'art_submenu_trim_len'=> 40, 'art_menu_depth' => 0, 'art_menu_source' => 'Pages', 'art_vmenu_depth' => 0, 'art_vmenu_source' => 'Categories', 'art_sidebars_style_default' => 'block', 'art_sidebars_style_secondary' => 'block', 'art_sidebars_style_top' => 'block', 'art_sidebars_style_bottom' => 'block', 'art_sidebars_style_footer' => 'simple', 'art_metadata_thumbnail_auto' => 0, 'art_metadata_thumbnail_width' => 100, 'art_metadata_thumbnail_height' => 100, 'art_metadata_separator' => ' | ', 'art_metadata_excerpt_auto' => 0, 'art_metadata_excerpt_min_remainder' => 5, 'art_metadata_excerpt_words' => 40, 'art_show_tags_on_404_page' => 0, 'art_show_tags_title_on_404_page' => __('Tag Cloud'), 'art_show_random_posts_on_404_page' => 0, 'art_show_random_posts_title_on_404_page' => __('Random posts'), 'art_comment_use_smilies' => 0, 'art_metadata_excerpt_use_tag_filter' => 0, 'art_metadata_excerpt_allowed_tags' => 'a, abbr, blockquote, b, cite, pre, code, em, label, i, p, strong, ul, ol, li, h1, h2, h3, h4, h5, h6, object, param, embed', 'art_top_single_navigation' => 1, 'art_bottom_single_navigation' => 0, 'art_single_navigation_trim_title' => 1, 'art_single_navigation_trim_len' => 80, 'art_home_top_posts_navigation' => 0, 'art_top_posts_navigation' => 1, 'art_bottom_posts_navigation' => 1, 'art_attachment_size' => 600, 'art_footer_content' => <<Link1 | Link2 | Link3

Copyright © [year]. All Rights Reserved.

EOL ); global $art_default_meta_options; $art_default_meta_options = array( 'art_show_in_menu' => 1, 'art_title_in_menu' => '', 'art_show_page_title' => 1, 'art_show_post_title' => 1, 'art_widget_styles' => 'default' ); function art_get_array_value($arr = array(), $key = null, $def = false){ if (is_array($arr) && isset($arr[$key])){ return $arr[$key]; } return $def; } function art_is_empty_html($str){ return (!is_string($str) || strlen(str_replace(array(' ', ' ', "\n", "\r", "\t"), '', $str)) == 0); } function art_is_vmenu_widget($id){ return (strpos($id, 'vmenu') !== false); } function art_trim_long_str($str, $len = 50, $sep = ' '){ $words = split($sep, $str); $wcount = count($words); while( $wcount > 0 && strlen(join($sep, array_slice($words, 0, $wcount))) > $len) $wcount--; if ($wcount != count($words)) { $str = join($sep, array_slice($words, 0, $wcount)) . '…'; } return $str; } function art_get_current_url() { $pageURL = 'http'; if (is_ssl()) { $pageURL .= 's'; } $pageURL .= '://' . $_SERVER['SERVER_NAME']; if ($_SERVER['SERVER_PORT'] != '80') { $pageURL .= ':' . $_SERVER["SERVER_PORT"]; } $pageURL .= $_SERVER["REQUEST_URI"]; return $pageURL; } function art_remove_last_slash($url) { $len = strlen($url); if ( $len > 0 && $url[$len-1] == '/') { $url = substr($url, 0, -1); } return $url; } function art_is_current_url($url) { // remove # anchor if (strpos( $url, '#' )) { $url = substr($url, 0, strpos( $url, '#')); } $url = art_remove_last_slash($url); $cur = art_remove_last_slash(art_get_current_url()); // compare return ($cur == $url); } function art_prepare_attr($attr = array()) { $attr = wp_parse_args($attr); if (count($attr) == 0) return ''; $result = ''; foreach($attr as $name => $value){ if(empty($name) || empty($value)) continue; $result .= ' ' . strtolower($name) . '="' . esc_attr($value) . '"'; } return $result; } function art_get_menu($args = '') { $args = wp_parse_args( $args, array('source' => 'Pages', 'depth' => 0, 'menu' => null, 'class' => '')); $source = &$args['source']; $menu = &$args['menu']; if (function_exists('get_nav_menu_locations') && $menu != null && is_string($menu)) { // theme location $location = art_get_array_value(get_nav_menu_locations(), $menu); if ($location) { $menu = wp_get_nav_menu_object($location); if($menu) $source = 'Custom Menu'; } } if ($source == 'Custom Menu' && function_exists('wp_nav_menu') && $menu != null) { return art_get_list_menu($args); } if ($source == 'Pages') { return art_get_list_pages(array_merge(array('sort_column' => 'menu_order, post_title'), $args)); } if ($source == 'Categories') { return art_get_list_categories(array_merge(array('title_li'=> false), $args)); } } /* custom menu */ function art_get_list_menu($args = array()) { global $wp_query; $menu_items = wp_get_nav_menu_items($args['menu']->term_id); if(empty($menu_items)) return ''; $home_page_id = (int) get_option('page_for_posts'); $queried_object_id = (int) $wp_query->queried_object_id; $active_ID = null; $IdToKey = array(); foreach ( (array) $menu_items as $key => $menu_item ) { $IdToKey[$menu_item->ID] = $key; if ($menu_item->object_id == $queried_object_id && ( ( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) || ( 'post_type' == $menu_item->type && $wp_query->is_singular ) || ( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax )) ) ) { $active_ID = $menu_item->ID; } elseif ( 'custom' == $menu_item->object ) { if ( art_is_current_url($menu_item->url)) { $active_ID = $menu_item->ID; } } } $current_ID = $active_ID; while ($current_ID && isset($IdToKey[$current_ID])) { $activeIDs[] = $current_ID; $current_item = &$menu_items[$IdToKey[$current_ID]]; $current_item->classes[] = 'active'; $current_ID = $current_item->menu_item_parent; } $sorted_menu_items = array(); foreach ((array) $menu_items as $key => $menu_item) { $sorted_menu_items[$menu_item->menu_order] = wp_setup_nav_menu_item($menu_item); } $items = array(); foreach ($sorted_menu_items as $el) { $id = $el->db_id; $title = $el->title; $classes = empty( $el->classes ) ? array() : (array) $el->classes; $active = in_array('active', $classes); $items[] = new art_MenuItem(array( 'id' => $id, 'active' => $active, 'attr' => array( 'title' => (empty($el->attr_title) ? $title : $el->attr_title), 'target' => $el->target, 'rel' => $el->xfn, 'href' => $el->url, 'class' => join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $el)) ), 'title' => $title, 'parent' => $el->menu_item_parent )); } $walker = new art_MenuWalker(); $items = $walker->walk($items, $args); $items = apply_filters('wp_nav_menu_items', $items, $args); $items = apply_filters("wp_nav_menu_{$menu->slug}_items", $items, $args); return apply_filters('wp_nav_menu', $items, $args); } /* pages */ function art_get_list_pages($args = array()) { global $wp_query; $pages = &get_pages($args); if (empty($pages)) return ''; $IdToKey = array(); $currentID = null; foreach ($pages as $key => $page) { $IdToKey[$page->ID] = $key; } if ($wp_query->is_page) { $currentID = $wp_query->get_queried_object_id(); } $frontID = null; $blogID = null; if ('page' == get_option('show_on_front')) { $frontID = get_option('page_on_front'); if ($frontID && isset($IdToKey[$frontID])) { $frontKey = $IdToKey[$frontID]; $frontPage = $pages[$frontKey]; unset($pages[$frontKey]); $frontPage->post_parent = 0; $frontPage->menu_order = 0; array_unshift($pages, $frontPage); $IdToKey = array(); foreach ($pages as $key => $page) { $IdToKey[$page->ID] = $key; } } if (is_home()) { $blogID = get_option('page_for_posts'); if ($blogID && isset($IdToKey[$blogID])) { $currentID = $blogID; } } } $active_Id = $currentID; $activeIDs = array(); while($active_Id && isset($IdToKey[$active_Id])) { $active = $pages[$IdToKey[$active_Id]]; if ($active && $active->post_status == 'private') break; $activeIDs[] = $active->ID; $active_Id = $active->post_parent; } $items = array(); if (art_get_option('art_menu_showHome') && ('page' != get_option('show_on_front') || (!get_option('page_on_front') && !get_option('page_for_posts')))) { $title = art_get_option('art_menu_homeCaption'); $active = is_home(); $items[] = new art_MenuItem(array( 'id' => 'home', 'active' => $active, 'attr' => array('class' => ($active ? 'active' : ''), 'href' => get_home_url(), 'title' => $title), 'title' => $title, )); } foreach ($pages as $page) { $id = $page->ID; $title = $page->post_title; $active = in_array($id, $activeIDs); $href = (($frontID && $frontID == $id) ? get_option('home') : get_page_link($id)); $items[] = new art_MenuItem(array( 'id' => $id, 'active' => $active, 'attr' => array('class' => ($active ? 'active' : ''), 'href' => $href, 'title' => $title), 'title' => $title, 'parent' => $page->post_parent )); } $walker = new art_MenuWalker(); return $walker->walk($items, $args); } /* categories */ function art_get_list_categories($args = array()) { global $wp_query, $post; $categories = &get_categories($args); if (empty($categories)) return ''; $IdToKey = array(); foreach ($categories as $key => $category){ $IdToKey[$category->term_id] = $key; } $currentID = null; if ($wp_query->is_category) { $currentID = $wp_query->get_queried_object_id(); } $activeID = $currentID; $activeIDs = art_get_category_branch($currentID, $categories, $IdToKey); if(art_get_option('art_menu_highlight_active_categories') && is_single()){ foreach((get_the_category($post->ID)) as $cat) { $activeIDs = array_merge($activeIDs, art_get_category_branch($cat->term_id, $categories, $IdToKey)); } } $items = array(); foreach ($categories as $category) { $id = $category->term_id; $title = $category->name; $desc = (($category->description) ? $category->description : sprintf(__('View all posts in %s'), $title)); $active = in_array($id, $activeIDs); $items[] = new art_MenuItem(array( 'id' => $id, 'active' => $active, 'attr' => array('class' => ($active ? 'active' : ''), 'href' => get_category_link($id), 'title' => $desc), 'title' => $title, 'parent' => $category->parent )); } $walker = new art_MenuWalker(); return $walker->walk($items, $args); } //Helper, return array( 'id', 'parent_id', ... , 'root_id' ) function art_get_category_branch($id, $categories, $IdToKey) { $result = array(); while ($id && isset($IdToKey[$id])) { $result[] = $id; $id = $categories[$IdToKey[$id]]->parent; } return $result; } /* menu item */ class art_MenuItem { var $id; var $active; var $parent; var $attr; var $title; function art_MenuItem($args = '') { $args = wp_parse_args($args, array( 'id' => '', 'active' => false, 'parent' => 0, 'attr' => '', 'title' => '', ) ); $this->id = $args['id']; $this->active = $args['active']; $this->parent = $args['parent']; $this->attr = $args['attr']; $this->title = $args['title']; } function get_start($level){ $class = ($this->active ? 'active' : ''); $title = apply_filters('the_title', $this->title, $this->id); if (art_get_option('art_menu_trim_title')) { $title = art_trim_long_str($title, art_get_option($level == 0 ? 'art_menu_trim_len' : 'art_submenu_trim_len')); } return str_repeat("\t", $level+1) . ' $class)) . '>' . 'attr) . '>' . ($level == 0 ? ' ' : '') . $title . ($level == 0 ? '' : '') . ''. BR; } function get_end($level){ return str_repeat("\t", $level+1) . '' . BR; } } /* menu walker */ class art_MenuWalker { var $child_Ids = array(); var $IdToKey = array(); var $level = 0; var $items; var $depth; var $args; var $class; function walk($items = array(), $args = '') { $args = wp_parse_args($args, array('depth' => 0, 'class' => '')); $this->items = &$items; $this->depth = (int)$args['depth']; $this->class = $args['class']; foreach($items as $key => $item) { $this->IdToKey[$item->id] = $key; if (!isset($this->child_Ids[$item->parent])) { $this->child_Ids[$item->parent] = array(); } $parent = $item->parent; if (!$parent) $parent = 0; $this->child_Ids[$parent][] = $item->id; } $output = ''; if (isset($this->child_Ids[0])) { $this->display($output, $this->child_Ids[0]); } if (art_is_empty_html($output)) return ''; return BR .' $this->class)) .'>' .BR .$output .''.BR; } function display(&$output, $child_Ids) { if (!is_array($child_Ids)) return; $first = true; foreach($child_Ids as $child_Id){ if (!isset($this->IdToKey[$child_Id])) continue; $item = $this->items[$this->IdToKey[$child_Id]]; if ($this->class == 'art-menu' && !$first && $this->level == 0) { $output .= "\t" .'
  • ' . BR; } if ($this->class == 'art-vmenu') { if ($this->level == 0) { if(!$first) { $output .= "\t" .'
  • ' . BR; } } else { if(($this->level == 1) && $first) { $output .= "\t" .'
  • ' . BR; } else { $output .= "\t" .'
  • ' . BR; } } } $output .= $item->get_start($this->level); if ( ($this->depth == 0 || $this->level < ($this->depth-1)) && isset($this->child_Ids[$item->id]) && (count($this->child_Ids[$item->id]) > 0) ) { $this->level++; $output .= str_repeat("\t", $this->level) . ' ($item->active ? 'active' : ''))) . '>' . BR; $this->display($output, $this->child_Ids[$item->id]); $output .= str_repeat("\t", $this->level) . '' . BR; $this->level--; } $output .= $item->get_end($this->level); $first = false; } } } // Not support old wp version if (WP_VERSION < 3.0) return; function art_get_pages( $pages ) { if(is_admin()) return $pages; $excluded_option = get_option('art_show_in_menu'); if (!$excluded_option || !is_array($excluded_option)) return $pages; $excluded_ids = array(); foreach ($excluded_option as $id => $show) { if(!$show) { $excluded_ids[] = $id; } } $excluded_parent_ids = array(); foreach ($pages as $page) { $title = art_get_meta_option($page->ID, 'art_title_in_menu'); if ($title) { $page->post_title = $title; } if (in_array($page->ID, $excluded_ids)){ $excluded_parent_ids[$page->ID] = $page->post_parent; } } $length = count($pages); for ( $i=0; $i<$length; $i++ ) { $page = & $pages[$i]; if (in_array($page->post_parent, $excluded_ids)) { $page->post_parent = art_get_array_value($excluded_parent_ids, $page->post_parent, $page->post_parent); } if (in_array($page->ID, $excluded_ids)) { unset( $pages[$i] ); } } if ( ! is_array( $pages ) ) $pages = (array) $pages; $pages = array_values( $pages ); return $pages; } add_filter('get_pages','art_get_pages'); function art_subscribe_rss(){ return ''. __('RSS Feeds',THEME_NS) .''; } // ads function art_advertisment($atts){ extract(shortcode_atts(array( 'code' => 1, 'align' => 'left', 'inline' => 0 ), $atts)); $ad = art_get_option('art_ad_code_'.$code); if(!empty($ad)): $ad = '
    '.$ad.'
    '; if(!$inline) $ad .= '
    '; return $ad; else: return '

    [ad] '.sprintf(__("Empty ad slot (#%s)!",THEME_NS),esc_attr($code)).'

    '; endif; } function art_go_to_top(){ return sprintf(''.__('Top',THEME_NS).''); } // login function art_login_link(){ if (is_user_logged_in()) return sprintf('',admin_url(),__('Site Admin')); else return sprintf('',wp_login_url(),__('Log in')); } // blog title function art_blog_title(){ return '' . get_bloginfo('name') . ''; } // validate xhtml function art_validate_xhtml(){ return 'XHTML 1.1'; } // validate css function art_validate_css(){ return 'CSS 3.0'; } // current year function art_current_year(){ return date('Y'); } add_shortcode('year', 'art_current_year'); add_shortcode('rss', 'art_subscribe_rss'); add_shortcode('ad', 'art_advertisment'); add_shortcode('top', 'art_go_to_top'); add_shortcode('login-link', 'art_login_link'); add_shortcode('blog-title', 'art_blog_title'); add_shortcode('xhtml', 'art_validate_xhtml'); add_shortcode('css', 'art_validate_css'); add_filter('widget_text', 'do_shortcode'); // Allow [SHORTCODES] in Widgets ?>
    Fatal error: Call to undefined function art_is_empty_html() in /home/safety/public_html/wp-content/themes/SafetyStreets2/library/wrappers.php on line 25