Example #1
0
	<?php 
    bfa_get_comments();
    // Load Comments template (on single post pages, and static pages, if set on options page):
    ?>
	<?php 
    bfa_next_previous_post_links('Bottom');
    // Displayed on SINGLE post pages if activated at ATO -> Next/Previous Navigation:
    ?>
	<?php 
    bfa_next_previous_page_links('Bottom');
    // Displayed on MULTI post pages if activated at ATO -> Next/Previous Navigation:
    ?>

    <?php 
    if ($bfa_ata['widget_center_bottom'] != '') {
        echo bfa_parse_widget_areas($bfa_ata['widget_center_bottom']);
    }
    ?>

<?php 
    /* END of: If there are any posts */
} else {
    /* If there are no posts: */
    ?>

<?php 
    // Deactivated since 3.6.5
    #include 'bfa://content_not_found';
    // Uses the following static code instead:
    ?>
<h2><?php 
Example #2
0
function bfa_postinfo($postinfo_string)
{
    // one theme option needed below for nofollow trackback / RSS links yes/no
    global $bfa_ata, $post;
    /* replace date format escape placeholders(#) with the actual escpae
    	character (=backslashes). This function removes all backslashes from
    	post info strings to avoid issues with hosts that have magic_quotes_gpc ON.
    	But we want to keep the backslashes inside date items, because they are
    	needed to escape literal strings inside dates */
    $postinfo_string = str_replace("#", "\\", $postinfo_string);
    $postinfo = $postinfo_string;
    // Author public name
    if (strpos($postinfo_string, '%author%') !== FALSE) {
        ob_start();
        the_author();
        $author = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author%", $author, $postinfo);
    }
    // Public name of Author who last modified a post, since WordPress 2.8.
    // Check first if function is available (= if this is WP 2.8+)
    if (function_exists('the_modified_author')) {
        if (strpos($postinfo_string, '%modified-author%') !== FALSE) {
            ob_start();
            the_modified_author();
            $modified_author = ob_get_contents();
            ob_end_clean();
            $postinfo = str_replace("%modified-author%", $modified_author, $postinfo);
        }
    }
    // Author about yourself
    if (strpos($postinfo_string, '%author-description%') !== FALSE) {
        ob_start();
        the_author_meta('description');
        $author_description = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-description%", $author_description, $postinfo);
    }
    // Author login name
    if (strpos($postinfo_string, '%author-login%') !== FALSE) {
        ob_start();
        the_author_meta('user_login');
        $author_login = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-login%", $author_login, $postinfo);
    }
    // Author first name
    if (strpos($postinfo_string, '%author-firstname%') !== FALSE) {
        ob_start();
        the_author_meta('first_name');
        $author_firstname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-firstname%", $author_firstname, $postinfo);
    }
    // Author last name
    if (strpos($postinfo_string, '%author-lastname%') !== FALSE) {
        ob_start();
        the_author_meta('last_name');
        $author_lastname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-lastname%", $author_lastname, $postinfo);
    }
    // Author nickname
    if (strpos($postinfo_string, '%author-nickname%') !== FALSE) {
        ob_start();
        the_author_meta('nickname');
        $author_nickname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-nickname%", $author_nickname, $postinfo);
    }
    // Author ID
    if (strpos($postinfo_string, '%author-id%') !== FALSE) {
        ob_start();
        the_author_meta('ID');
        $author_ID = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-id%", $author_ID, $postinfo);
    }
    // Author email address, clear text in HTML source code
    if (strpos($postinfo_string, '%author-email-clear%') !== FALSE) {
        ob_start();
        the_author_meta('email');
        $author_email_clear = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-email-clear%", $author_email_clear, $postinfo);
    }
    // Author email address obfuscated
    if (strpos($postinfo_string, '%author-email%') !== FALSE) {
        $postinfo = str_replace("%author-email%", antispambot(get_the_author_email()), $postinfo);
    }
    // Author website URL
    if (strpos($postinfo_string, '%author-url%') !== FALSE) {
        ob_start();
        the_author_meta('url');
        $author_url = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-url%", $author_url, $postinfo);
    }
    // Author website link
    if (strpos($postinfo_string, '%author-link%') !== FALSE) {
        ob_start();
        the_author_link();
        $author_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-link%", $author_link, $postinfo);
    }
    // Author posts archive link
    if (strpos($postinfo_string, '%author-posts-link%') !== FALSE) {
        ob_start();
        the_author_posts_link();
        $author_posts_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-posts-link%", $author_posts_link, $postinfo);
    }
    //  LEGACY: %author-linked% replaced by %author-posts-link% in 3.3.2, but displays the same: Author posts archive link
    if (strpos($postinfo_string, '%author-linked%') !== FALSE) {
        ob_start();
        the_author_posts_link();
        $author_posts_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-linked%", $author_posts_link, $postinfo);
    }
    // Author post count
    if (strpos($postinfo_string, '%author-post-count%') !== FALSE) {
        ob_start();
        the_author_posts();
        $author_post_count = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-post-count%", $author_post_count, $postinfo);
    }
    // Author AOL Instant Messenger screenname
    if (strpos($postinfo_string, '%author-aim%') !== FALSE) {
        ob_start();
        the_author_meta('aim');
        $author_aim = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-aim%", $author_aim, $postinfo);
    }
    // Author Yahoo IM ID
    if (strpos($postinfo_string, '%author-yim%') !== FALSE) {
        ob_start();
        the_author_meta('yim');
        $author_yim = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-yim%", $author_yim, $postinfo);
    }
    // Date & Time
    if (strpos($postinfo_string, '%date(') !== FALSE) {
        $postinfo = preg_replace_callback("/%date\\((.*?)'(.*?)'(.*?)\\)%/is", "bfa_parse_date_callback", $postinfo);
    }
    // Date & Time, last modified
    if (strpos($postinfo_string, '%date-modified(') !== FALSE) {
        $postinfo = preg_replace_callback("/%date-modified\\((.*?)'(.*?)'(.*?)\\)%/is", "bfa_parse_date_modified_callback", $postinfo);
    }
    // Tags, linked - since WP 2.3
    if (strpos($postinfo_string, '%tags-linked') !== FALSE) {
        while (strpos($postinfo, '%tags-linked') !== FALSE) {
            $tag_link_options = preg_match("/(.*)%tags-linked\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_link_matches);
            $tags_linked = get_the_tag_list($tag_link_matches[2], $tag_link_matches[4], $tag_link_matches[6]);
            $postinfo = preg_replace("/(.*)%tags-linked\\((.*?)\\)%(.*)/i", "\${1}" . $tags_linked . "\${3}", $postinfo);
        }
    }
    // Tags, linked. If post has no tags, categories are displayed instead -  since WP 2.3
    if (strpos($postinfo_string, '%tags-cats-linked') !== FALSE) {
        while (strpos($postinfo, '%tags-cats-linked') !== FALSE) {
            $tag_link_options = preg_match("/(.*)%tags-cats-linked\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_link_matches);
            ob_start();
            the_tags($tag_link_matches[2], $tag_link_matches[4], $tag_link_matches[6]);
            $tags_cats_linked = ob_get_contents();
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%tags-cats-linked\\((.*?)\\)%(.*)/i", "\${1}" . $tags_cats_linked . "\${3}", $postinfo);
        }
    }
    // Tags, not linked - since WP 2.3
    if (strpos($postinfo_string, '%tags(') !== FALSE) {
        while (strpos($postinfo, '%tags(') !== FALSE) {
            $tag_options = preg_match("/(.*)%tags\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_matches);
            $posttags = get_the_tags();
            if ($posttags) {
                foreach ($posttags as $tag) {
                    $tag_list .= $tag->name . $tag_matches[4];
                }
                // remove last separator
                $tag_list = preg_replace("/" . $tag_matches[4] . "\$/mi", "", $tag_list);
                $tags = $tag_matches[2] . $tag_list . $tag_matches[6];
            } else {
                $tags = "";
            }
            $postinfo = preg_replace("/(.*)%tags\\((.*?)\\)%(.*)/i", "\${1}" . $tags . "\${3}", $postinfo);
        }
    }
    // 1st category
    if (strpos($postinfo_string, '%category%') !== FALSE) {
        $all_categories = get_the_category();
        $category = $all_categories[0]->cat_name;
        $category_notlinked = $category;
        $postinfo = str_replace("%category%", $category_notlinked, $postinfo);
    }
    // 1st category, linked
    if (strpos($postinfo_string, '%category-linked%') !== FALSE) {
        $all_categories = get_the_category();
        $category = $all_categories[0]->cat_name;
        $category_linked = '<a class="' . $category . '" href="' . get_category_link($all_categories[0]->cat_ID) . '">' . $category . '</a>';
        $postinfo = str_replace("%category-linked%", $category_linked, $postinfo);
    }
    // Categories, linked with class name added
    $categories_linked = '';
    if (strpos($postinfo_string, '%categories-linked') !== FALSE) {
        while (strpos($postinfo, '%categories-linked') !== FALSE) {
            $category_linked_separator = preg_match("/(.*)%categories-linked\\('(.*?)'\\)(.*)/i", $postinfo_string, $category_linked_matches);
            ob_start();
            $categories = get_the_category();
            $items_in_categories = count($categories);
            $output = '';
            $categories_count = $items_in_categories;
            if ($categories) {
                foreach ($categories as $category) {
                    $categories_count -= 1;
                    if ($categories_count) {
                        $seperator = $category_linked_matches[2];
                    } else {
                        $seperator = '';
                    }
                    $categories_linked .= '<a class="' . $category->slug . '" href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '">' . $category->cat_name . $seperator . '</a>';
                }
            }
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%categories-linked\\((.*?)\\)%(.*)/i", "\${1}" . $categories_linked . "\${3}", $postinfo);
        }
    }
    // Categories, not linked
    if (strpos($postinfo_string, '%categories(') !== FALSE) {
        while (strpos($postinfo, '%categories(') !== FALSE) {
            $category_separator = preg_match("/(.*)%categories\\('(.*?)'\\)(.*)/i", $postinfo_string, $category_matches);
            $categories = "";
            foreach (get_the_category() as $category) {
                $categories .= $category->cat_name . $category_matches[2];
            }
            // remove last separator
            $categories = preg_replace("/" . $category_matches[2] . "\$/mi", "", $categories);
            $postinfo = preg_replace("/(.*)%categories\\((.*?)\\)%(.*)/i", "\${1}" . $categories . "\${3}", $postinfo);
        }
    }
    // Comment link
    if (strpos($postinfo_string, '%comments(') !== FALSE) {
        while (strpos($postinfo, '%comments(') !== FALSE) {
            $comment_options = preg_match("/(.*)%comments\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $comment_matches);
            if (!comments_open() and $comment_matches[8] == "dontshow") {
                $comment_link = '';
            } else {
                ob_start();
                comments_popup_link($comment_matches[2], $comment_matches[4], $comment_matches[6], 'comments-link', $comment_matches[8]);
                $comment_link = ob_get_contents();
                ob_end_clean();
            }
            if (!comments_open()) {
                if ($post->comment_count == 0) {
                    $comment_link = '<strong>' . $comment_matches[8] . '</strong>';
                } else {
                    $comment_link = $comment_link . ' - <strong>(' . $comment_matches[8] . ')</strong>';
                }
            }
            if (!comments_open() and $comment_matches[8] == "dontshow") {
                $comment_link = '';
            }
            $postinfo = preg_replace("/(.*)%comments\\((.*?)\\)%(.*)/i", "\${1}" . $comment_link . "\${3}", $postinfo);
        }
    }
    // Comments Feed link
    if (strpos($postinfo_string, '%comments-rss') !== FALSE) {
        while (strpos($postinfo, '%comments-rss') !== FALSE) {
            $comments_rss_link_text = preg_match("/(.*)%comments-rss\\('(.*?)'(.*)/i", $postinfo_string, $comments_rss_matches);
            ob_start();
            post_comments_feed_link($comments_rss_matches[2]);
            $comments_rss_link = ob_get_contents();
            ob_end_clean();
            // make link nofollow if set in theme options
            if ($bfa_ata['nofollow'] == "Yes") {
                $comments_rss_link = str_replace('href=', 'rel="nofollow" href=', $comments_rss_link);
            }
            $postinfo = preg_replace("/(.*)%comments-rss\\((.*?)\\)%(.*)/i", "\${1}" . $comments_rss_link . "\${3}", $postinfo);
        }
    }
    // Trackback URL
    if (strpos($postinfo_string, '%trackback%') !== FALSE) {
        $trackback_url = trackback_url(FALSE);
        $postinfo = str_replace("%trackback%", $trackback_url, $postinfo);
    }
    // Trackback Link
    if (strpos($postinfo_string, '%trackback-linked(') !== FALSE) {
        while (strpos($postinfo, '%trackback-linked(') !== FALSE) {
            $trackback_url = trackback_url(FALSE);
            $trackback_link_text = preg_match("/(.*)%trackback-linked\\('(.*?)'(.*)/i", $postinfo_string, $trackback_matches);
            $trackback_link = '<a href="' . $trackback_url . '">' . $trackback_matches[2] . '</a>';
            // make link nofollow if set in theme options
            if ($bfa_ata['nofollow'] == "Yes") {
                $trackback_link = str_replace('href=', 'rel="nofollow" href=', $trackback_link);
            }
            $postinfo = preg_replace("/(.*)%trackback-linked\\((.*?)\\)%(.*)/i", "\${1}" . $trackback_link . "\${3}", $postinfo);
        }
    }
    // Trackback RDF
    if (strpos($postinfo_string, '%trackback-rdf%') !== FALSE) {
        ob_start();
        trackback_rdf();
        $trackback_rdf = "<!-- " . ob_get_contents() . " -->";
        ob_end_clean();
        $postinfo = str_replace("%trackback-rdf%", $trackback_rdf, $postinfo);
    }
    // Permalink
    if (strpos($postinfo_string, '%permalink%') !== FALSE) {
        ob_start();
        the_permalink();
        $permalink = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%permalink%", $permalink, $postinfo);
    }
    // Post ID
    if (strpos($postinfo_string, '%post-id%') !== FALSE) {
        ob_start();
        the_ID();
        $post_id = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%post-id%", $post_id, $postinfo);
    }
    // Post Title
    if (strpos($postinfo_string, '%post-title%') !== FALSE) {
        ob_start();
        the_title();
        $post_title = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%post-title%", $post_title, $postinfo);
    }
    // Edit post
    if (strpos($postinfo_string, '%edit(') !== FALSE) {
        while (strpos($postinfo, '%edit(') !== FALSE) {
            $edit_options = preg_match("/(.*)%edit\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $edit_matches);
            ob_start();
            edit_post_link($edit_matches[4], $edit_matches[2], $edit_matches[6]);
            $edit_link = ob_get_contents();
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%edit\\((.*?)\\)%(.*)/i", "\${1}" . $edit_link . "\${3}", $postinfo);
        }
    }
    // Print
    if (strpos($postinfo_string, '%print(') !== FALSE) {
        while (strpos($postinfo, '%print(') !== FALSE) {
            $print_text = preg_match("/(.*)%print\\('(.*?)'(.*)/i", $postinfo_string, $print_text_matches);
            $print_link = '<a href="javascript:window.print()">' . $print_text_matches[2] . '</a>';
            $postinfo = preg_replace("/(.*)%print\\((.*?)\\)%(.*)/i", "\${1}" . $print_link . "\${3}", $postinfo);
        }
    }
    // For the "WP-Email" plugin
    if (strpos($postinfo_string, '%wp-email%') !== FALSE) {
        $wp_email = function_exists('wp_email') ? email_link($email_post_text = '', $email_page_text = '', $echo = FALSE) : "";
        $postinfo = str_replace("%wp-email%", $wp_email, $postinfo);
    }
    // For the "WP-Print" plugin
    if (strpos($postinfo_string, '%wp-print%') !== FALSE) {
        $wp_print = function_exists('wp_print') ? print_link($print_post_text = '', $print_page_text = '', $echo = FALSE) : "";
        $postinfo = str_replace("%wp-print%", $wp_print, $postinfo);
    }
    // For the "WP-PostViews" plugin
    if (strpos($postinfo_string, '%wp-postviews%') !== FALSE) {
        $wp_postviews = function_exists('the_views') ? the_views($display = FALSE) : "";
        $postinfo = str_replace("%wp-postviews%", $wp_postviews, $postinfo);
    }
    // For the "WP-PostRatings" plugin
    if (strpos($postinfo_string, '%wp-postratings%') !== FALSE) {
        $wp_postratings = function_exists('the_ratings') ? the_ratings($start_tag = 'span', $custom_id = 0, $display = FALSE) : "";
        $postinfo = str_replace("%wp-postratings%", $wp_postratings, $postinfo);
    }
    // For the "Sociable" plugin
    if (strpos($postinfo_string, '%sociable%') !== FALSE) {
        ob_start();
        $sociable = (function_exists('sociable_html2') and function_exists(do_sociable())) ? do_sociable() : "";
        $sociable = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%sociable%", $sociable, $postinfo);
    }
    // For the "Share This" plugin
    if (strpos($postinfo_string, '%share-this%') !== FALSE) {
        ob_start();
        if (function_exists('sharethis_button')) {
            sharethis_button();
            $share_this = ob_get_contents();
        } else {
            $share_this = "";
        }
        ob_end_clean();
        $postinfo = str_replace("%share-this%", $share_this, $postinfo);
    }
    // Images
    if (strpos($postinfo_string, '<image(') !== FALSE) {
        $postinfo = preg_replace_callback("|<image\\((.*?)\\)>|", "bfa_image_files", $postinfo);
    }
    /* The meta = ALL custom fields:values, formatted by Wordpress as
    	unordered list <ul><li>..</li><li>..</li></ul> */
    if (strpos($postinfo_string, '%meta%') !== FALSE) {
        ob_start();
        the_meta();
        $the_meta = ob_get_contents();
        ob_end_clean();
        // 3.4.3.: remove bfa_ata metas */
        $the_meta = preg_replace("/<li>(.*)bfa_ata(.*)<\\/li>/i", "", $the_meta);
        $postinfo = str_replace("%meta%", $the_meta, $postinfo);
    }
    // Single post meta values, not formatted
    if (strpos($postinfo_string, '%meta(') !== FALSE) {
        $postinfo = preg_replace_callback("|%meta\\('(.*?)'\\)%|", "bfa_meta_value", $postinfo);
    }
    // Since 3.6.7, parse widget areas
    $postinfo = bfa_parse_widget_areas($postinfo);
    return $postinfo;
}
Example #3
0
function bfa_footer()
{
    global $bfa_ata, $post;
    $homeURL = get_home_url();
    $footer_content = $bfa_ata['footer_style_content'];
    // page links
    if (strpos($footer_content, '%page') !== FALSE) {
        $footer_content = preg_replace_callback("|%page-(.*?)%|", "bfa_footer_page_links", $footer_content);
    }
    // home link
    if (strpos($footer_content, '%home%') !== FALSE) {
        ob_start();
        echo '<a href="' . $homeURL . '/">';
        bloginfo('name');
        echo '</a>';
        $footer_home_link = ob_get_contents();
        ob_end_clean();
        $footer_content = str_replace("%home%", $footer_home_link, $footer_content);
    }
    // login/logout link
    if (strpos($footer_content, '%loginout%') !== FALSE) {
        ob_start();
        wp_loginout();
        $loginout_link = ob_get_contents();
        ob_end_clean();
        if ($bfa_ata['nofollow'] == "Yes") {
            $loginout_link = str_replace(' href=', ' rel="nofollow" href=', $loginout_link);
        }
        $footer_content = str_replace("%loginout%", $loginout_link, $footer_content);
    }
    // register link
    if (strpos($footer_content, '%register%') !== FALSE) {
        ob_start();
        wp_register();
        $register_link = ob_get_contents();
        ob_end_clean();
        $register_link = str_replace(array('<li>', '</li>'), '', $register_link);
        if ($bfa_ata['nofollow'] == "Yes") {
            $register_link = str_replace(' href=', ' rel="nofollow" href=', $register_link);
        }
        $footer_content = str_replace("%register%", $register_link, $footer_content);
    }
    /* LEGACY up to Atahualpa 3.2 admin link and register link were two different tags, 
    	now they're combined into one tag %register% mimicking the wp_register() function */
    if (strpos($footer_content, '%admin%') !== FALSE) {
        ob_start();
        wp_register();
        $admin_link = ob_get_contents();
        ob_end_clean();
        $admin_link = str_replace(array('<li>', '</li>'), '', $admin_link);
        if ($bfa_ata['nofollow'] == "Yes") {
            $admin_link = str_replace(' href=', ' rel="nofollow" href=', $admin_link);
        }
        $footer_content = str_replace("%admin%", $admin_link, $footer_content);
    }
    // RSS link
    if (strpos($footer_content, '%rss%') !== FALSE) {
        ob_start();
        bloginfo('rss2_url');
        $footer_rss2_url = ob_get_contents();
        ob_end_clean();
        $footer_content = str_replace("%rss%", $footer_rss2_url, $footer_content);
    }
    // Comments RSS link
    if (strpos($footer_content, '%comments-rss%') !== FALSE) {
        ob_start();
        bloginfo('comments_rss2_url');
        $footer_comments_rss2_url = ob_get_contents();
        ob_end_clean();
        $footer_content = str_replace("%comments-rss%", $footer_comments_rss2_url, $footer_content);
    }
    // Current Year
    $footer_content = str_replace("%current-year%", date('Y'), $footer_content);
    // Parse widget areas:
    $result = bfa_parse_widget_areas(bfa_footer_output($footer_content));
    return $result;
}
Example #4
0
function bfa_incl($option)
{
    global $bfa_ata;
    $result = bfa_parse_widget_areas($bfa_ata[$option]);
    echo $result;
}
function bfa_header_config()
{
    global $bfa_ata, $post;
    $templateURI = get_template_directory_uri();
    $homeURL = get_home_url();
    // Since 3.6: bfa_header_config() instead of bfa_header_config($header_items)
    $header_items = $bfa_ata['configure_header'];
    $page_menu_bar = '';
    $cat_menu_bar = '';
    $logo_area = '';
    $header_image = '';
    $horizontal_bar1 = '';
    $horizontal_bar2 = '';
    // Page Menu Bar
    if (strpos($header_items, '%pages') !== FALSE or strpos($header_items, '%page-center') !== FALSE or strpos($header_items, '%page-right') !== FALSE) {
        // Since 3.5.2: New WP 3 menu system:
        if (has_nav_menu('menu1')) {
            if (strpos($header_items, '%pages') !== FALSE) {
                $alignment = "left";
            } elseif (strpos($header_items, '%page-center') !== FALSE) {
                $alignment = "center";
            } else {
                $alignment = "right";
            }
            $page_menu_bar = bfa_new_wp3_menus("menu1", $alignment);
        } else {
            ob_start();
            echo '<div id="menu1">';
            // Left, Right or Centered
            if (strpos($header_items, "%page-right") !== FALSE) {
                echo '<ul id="rmenu2" class="dropdown clearfix rMenu-hor rMenu-hRight rMenu">' . "\n";
            } elseif (strpos($header_items, "%page-center") !== FALSE) {
                echo '<table cellpadding="0" cellspacing="0" style="margin: 0 auto"><tr><td align="center">
				<ul id="rmenu2" class="clearfix rMenu-hor rMenu">' . "\n";
            } else {
                echo '<ul id="rmenu2" class="clearfix rMenu-hor rMenu">' . "\n";
            }
            // "Home" Link?
            if ($bfa_ata['home_page_menu_bar'] != '') {
                echo '<li class="page_item';
                if (is_front_page() or is_home()) {
                    echo ' current_page_item';
                }
                echo '"><a href="' . $homeURL . '/" title="';
                bloginfo('name');
                echo '"><span>' . $bfa_ata['home_page_menu_bar'] . '</span></a></li>' . "\n";
            }
            // Empty setting "levels" same as 0
            if ($bfa_ata['levels_page_menu_bar'] == '') {
                $bfa_ata['levels_page_menu_bar'] = 0;
            }
            echo bfa_hor_pages($bfa_ata['sorting_page_menu_bar'], $bfa_ata['levels_page_menu_bar'], $bfa_ata['titles_page_menu_bar'], $bfa_ata['exclude_page_menu_bar']);
            // Close table if centered
            if (strpos($header_items, "%page-center") !== FALSE) {
                echo '</ul></td></tr></table></div>' . "\n";
            } else {
                echo '</ul></div>' . "\n";
            }
            $page_menu_bar = ob_get_contents();
            ob_end_clean();
        }
    }
    // Category Menu Bar
    if (strpos($header_items, '%cats') !== FALSE or strpos($header_items, '%cat-center') !== FALSE or strpos($header_items, '%cat-right') !== FALSE) {
        // Since 3.5.2: New WP 3 menu system:
        if (has_nav_menu('menu2')) {
            if (strpos($header_items, '%cats') !== FALSE) {
                $alignment = "left";
            } elseif (strpos($header_items, '%cat-center') !== FALSE) {
                $alignment = "center";
            } else {
                $alignment = "right";
            }
            $cat_menu_bar = bfa_new_wp3_menus("menu2", $alignment);
        } else {
            ob_start();
            echo '<div id="menu2">';
            if (strpos($header_items, "%cat-right") !== FALSE) {
                echo '<ul id="rmenu" class="dropdown clearfix rMenu-hor rMenu-hRight rMenu">' . "\n";
            } elseif (strpos($header_items, "%cat-center") !== FALSE) {
                echo '<table cellpadding="0" cellspacing="0" style="margin: 0 auto"><tr><td align="center">
				<ul id="rmenu" class="clearfix rMenu-hor rMenu">' . "\n";
            } else {
                echo '<ul id="rmenu" class="clearfix rMenu-hor rMenu">' . "\n";
            }
            // Home Link?
            if ($bfa_ata['home_cat_menu_bar'] != '') {
                echo '<li class="cat-item';
                if (is_front_page() or is_home()) {
                    echo ' current-cat';
                }
                echo '"><a href="' . $homeURL . '/" title="';
                bloginfo('name');
                echo '">' . $bfa_ata['home_cat_menu_bar'] . '</a></li>' . "\n";
            }
            // Empty setting "levels" same as 0
            if ($bfa_ata['levels_cat_menu_bar'] == '') {
                $bfa_ata['levels_cat_menu_bar'] = 0;
            }
            // Create menu list
            echo bfa_hor_cats($bfa_ata['sorting_cat_menu_bar'], $bfa_ata['order_cat_menu_bar'], $bfa_ata['levels_cat_menu_bar'], $bfa_ata['titles_cat_menu_bar'], $bfa_ata['exclude_cat_menu_bar']);
            // Close table if centered
            if (strpos($header_items, "%cat-center") !== FALSE) {
                echo '</ul></td></tr></table></div>' . "\n";
            } else {
                echo '</ul></div>' . "\n";
            }
            $cat_menu_bar = ob_get_contents();
            ob_end_clean();
        }
    }
    // Logo Area
    if (strpos($header_items, '%logo') !== FALSE) {
        ob_start();
        echo '<table id="logoarea" cellpadding="0" cellspacing="0" border="0" width="100%"><tr>';
        if ($bfa_ata['show_search_box'] == "Yes" and ($bfa_ata['show_posts_icon'] == "Yes" or $bfa_ata['show_email_icon'] == "Yes" or $bfa_ata['show_comments_icon'] == "Yes")) {
            $header_rowspan = 'rowspan="2" ';
        } else {
            $header_rowspan = '';
        }
        // Logo Icon
        if ($bfa_ata['logo'] != "") {
            if ($bfa_ata['images_root'] == "atahualpa") {
                $imgdir = get_template_directory_uri() . '/images/';
            } else {
                if (!isset($bfa_ata['ata_images_dir']) or $bfa_ata['ata_images_dir'] == '') {
                    $img_folder = 'ata-images';
                    $imgdir = content_url() . '/ata-images/';
                } else {
                    $imgdir = content_url() . '/' . $bfa_ata['ata_images_dir'] . '/';
                }
            }
            //$logo = $imgdir.$bfa_ata['logo'];
            $logo = "http://flintriver.org/blog/wp-content/uploads/2010/09/FRWC-New-Logo-JPG-Version-e1409682546156.jpg";
            echo '<td ' . $header_rowspan . 'valign="middle" class="logoarea-logo"><a href="' . $homeURL . '/">';
            echo '<img class="logo" src="' . $logo . '" alt="';
            bloginfo('name');
            echo '" /></a></td>';
        }
        // Blog title and description
        if ($bfa_ata['blog_title_show'] == "Yes" or $bfa_ata['blog_tagline_show'] == "Yes") {
            echo '<td ' . $header_rowspan . 'valign="middle" class="logoarea-title">';
            if ($bfa_ata['blog_title_show'] == "Yes") {
                echo '<h' . $bfa_ata['h_blogtitle'] . ' class="blogtitle"><a href="' . $homeURL . '/">';
                bloginfo('name');
                echo '</a></h' . $bfa_ata['h_blogtitle'] . '>';
            }
            if ($bfa_ata['blog_tagline_show'] == "Yes") {
                echo '<p class="tagline">';
                bloginfo('description');
                echo '</p>';
            }
            echo '</td>';
        }
        // is any feed icon or link active?
        if ($bfa_ata['show_posts_icon'] == "Yes" or $bfa_ata['show_email_icon'] == "Yes" or $bfa_ata['show_comments_icon'] == "Yes") {
            echo '<td class="feed-icons" valign="middle" align="right"><div class="clearfix rss-box">';
        }
        // COMMENT Feed link
        if ($bfa_ata['show_comments_icon'] == "Yes") {
            echo '<a class="comments-icon" ';
            if ($bfa_ata['nofollow'] == "Yes") {
                echo 'rel="nofollow" ';
            }
            echo 'href="';
            bloginfo('comments_rss2_url');
            echo '" title="' . $bfa_ata['comment_feed_link_title'] . '">' . $bfa_ata['comment_feed_link'] . '</a>';
        }
        // Feedburner Email link
        if ($bfa_ata['show_email_icon'] == "Yes") {
            echo '<a class="email-icon" ';
            if ($bfa_ata['nofollow'] == "Yes") {
                echo 'rel="nofollow" ';
            }
            echo 'href="http://' . ($bfa_ata['feedburner_old_new'] == 'New - at feedburner.google.com' ? 'feedburner.google.com/fb/a/mailverify?uri=' : 'www.feedburner.com/fb/a/emailverifySubmit?feedId=') . $bfa_ata['feedburner_email_id'] . '&amp;loc=' . get_locale() . '" title="' . $bfa_ata['email_subscribe_link_title'] . '">' . $bfa_ata['email_subscribe_link'] . '</a>';
        }
        // POSTS Feed link
        if ($bfa_ata['show_posts_icon'] == "Yes") {
            echo '<a class="posts-icon" ';
            if ($bfa_ata['nofollow'] == "Yes") {
                echo 'rel="nofollow" ';
            }
            echo 'href="';
            bloginfo('rss2_url');
            echo '" title="' . $bfa_ata['post_feed_link_title'] . '">' . $bfa_ata['post_feed_link'] . '</a>';
        }
        if ($bfa_ata['show_posts_icon'] == "Yes" or $bfa_ata['show_email_icon'] == "Yes" or $bfa_ata['show_comments_icon'] == "Yes") {
            echo '</div></td>';
            if ($bfa_ata['show_search_box'] == "Yes") {
                echo '</tr><tr>';
            }
        }
        // Search box
        if ($bfa_ata['show_search_box'] == "Yes") {
            echo '<td valign="bottom" class="search-box" align="right"><div class="searchbox">
					<form method="get" class="searchform" action="' . $homeURL . '/">
					<div class="searchbox-form">' . '<input type="text" class="text inputblur" onfocus="this.value=\'' . (get_search_query() ? esc_js(get_search_query()) : '') . '\'" 
						value="' . (get_search_query() ? esc_js(get_search_query()) : esc_attr($bfa_ata['searchbox_text'])) . '" onblur="this.value=\'' . (get_search_query() ? esc_js(get_search_query()) : esc_attr($bfa_ata['searchbox_text'])) . '\'" name="s" />' . '</div>
					</form>
				</div>
				</td>';
        }
        echo '</tr></table>';
        $logo_area = ob_get_contents();
        ob_end_clean();
    }
    // Header Image
    if (strpos($header_items, '%image') !== FALSE) {
        // force 'top left' alignment if rotating and fading is on
        if ($bfa_ata['header_image_javascript'] !== "0" and $bfa_ata['crossslide_fade'] !== "0") {
            $bfa_ata['headerimage_alignment'] = 'top left';
        }
        ob_start();
        $bfa_header_images = bfa_rotating_header_images();
        echo '<div id="imagecontainer-pre" class="header-image-container-pre">';
        echo '    <div id="imagecontainer" class="header-image-container" style="background: url(' . $bfa_header_images[array_rand($bfa_header_images)] . ') ' . $bfa_ata['headerimage_alignment'] . ' no-repeat;">';
        echo '</div>';
        if ($bfa_ata['header_image_clickable'] == "Yes") {
            echo '<div class="clickable"><a class="divclick" title="';
            bloginfo('name');
            echo '" href ="' . $homeURL . '/">&nbsp;</a></div>';
        }
        // Header Code Overlay
        if (isset($bfa_ata['overlay_header_image'])) {
            $overlay_image_code = $bfa_ata['overlay_header_image'];
            // Parse PHP code
            if (strpos($overlay_image_code, '<?php ') !== FALSE) {
                ob_start();
                bfa_incl('overlay_header_image');
                $overlay_image_code = ob_get_contents();
                ob_end_clean();
            }
            echo '<div class="codeoverlay">';
            echo $overlay_image_code;
            echo '</div>';
        }
        if ($bfa_ata['header_opacity_left'] != 0 and $bfa_ata['header_opacity_left'] != '') {
            echo '<div class="opacityleft">&nbsp;</div>';
        }
        if ($bfa_ata['header_opacity_right'] != 0 and $bfa_ata['header_opacity_right'] != '') {
            echo '<div class="opacityright">&nbsp;</div>';
        }
        // END: If Header Opacity
        if ($bfa_ata['overlay_blog_title'] == "Yes" or $bfa_ata['overlay_blog_tagline'] == "Yes") {
            echo '<div class="titleoverlay">';
            if ($bfa_ata['overlay_blog_title'] == "Yes") {
                echo '<h' . $bfa_ata['h_blogtitle'] . ' class="blogtitle"><a href="' . $homeURL . '/">';
                bloginfo('name');
                echo '</a></h' . $bfa_ata['h_blogtitle'] . '>';
            }
            if ($bfa_ata['overlay_blog_tagline'] == "Yes") {
                echo '<p class="tagline">';
                bloginfo('description');
                echo '</p>';
            }
            echo '</div>';
        }
        echo '</div>';
        $header_image = ob_get_contents();
        ob_end_clean();
    }
    // Horizontal bar 1
    if (strpos($header_items, '%bar1') !== FALSE) {
        $horizontal_bar1 = '<div class="horbar1">&nbsp;</div>';
    }
    // Horizontal bar 2
    if (strpos($header_items, '%bar2') !== FALSE) {
        $horizontal_bar2 = '<div class="horbar2">&nbsp;</div>';
    }
    $header_item_numbers = array("%pages", "%page-center", "%page-right", "%cats", "%cat-center", "%cat-right", "%logo", "%image", "%bar1", "%bar2");
    $header_output = array($page_menu_bar, $page_menu_bar, $page_menu_bar, $cat_menu_bar, $cat_menu_bar, $cat_menu_bar, $logo_area, $header_image, $horizontal_bar1, $horizontal_bar2);
    $header_items = trim($header_items);
    $final_header = str_replace($header_item_numbers, $header_output, $header_items);
    // Parse widget areas:
    $final_header = bfa_parse_widget_areas($final_header);
    return $final_header;
}