diff -r 0d9a58d2c515 -r 0d28b7c10758 web/wp-content/themes/thematic/library/extensions/header-extensions.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/wp-content/themes/thematic/library/extensions/header-extensions.php Fri Mar 12 13:29:04 2010 +0000 @@ -0,0 +1,417 @@ +' . "\n"; + $content .= ' $site_name, + 'separator' => $separator, + 'content' => $content + ); + } + else { + $elements = array( + 'content' => $content + ); + } + } else { + $elements = array( + 'site_name' => $site_name + ); + } + + // Filters should return an array + $elements = apply_filters('thematic_doctitle', $elements); + + // But if they don't, it won't try to implode + if(is_array($elements)) { + $doctitle = implode(' ', $elements); + } + else { + $doctitle = $elements; + } + + $doctitle = "\t" . "" . $doctitle . "" . "\n\n"; + + echo $doctitle; +} // end thematic_doctitle + + +// Creates the content-type section +function thematic_create_contenttype() { + $content = "\t"; + $content .= ""; + $content .= "\n\n"; + echo apply_filters('thematic_create_contenttype', $content); +} // end thematic_create_contenttype + +// The master switch for SEO functions +function thematic_seo() { + $content = TRUE; + return apply_filters('thematic_seo', $content); +} + +// Creates the canonical URL +function thematic_canonical_url() { + if (thematic_seo()) { + if ( is_singular() ) { + $canonical_url = "\t"; + $canonical_url .= ''; + $canonical_url .= "\n\n"; + echo apply_filters('thematic_canonical_url', $canonical_url); + } + } +} // end thematic_canonical_url + + +// switch use of thematic_the_excerpt() - default: ON +function thematic_use_excerpt() { + $display = TRUE; + $display = apply_filters('thematic_use_excerpt', $display); + return $display; +} // end thematic_use_excerpt + + +// switch use of thematic_the_excerpt() - default: OFF +function thematic_use_autoexcerpt() { + $display = FALSE; + $display = apply_filters('thematic_use_autoexcerpt', $display); + return $display; +} // end thematic_use_autoexcerpt + + +// Creates the meta-tag description +function thematic_create_description() { + if (thematic_seo()) { + if (is_single() || is_page() ) { + if ( have_posts() ) { + while ( have_posts() ) { + the_post(); + if (thematic_the_excerpt() == "") { + if (thematic_use_autoexcerpt()) { + $content ="\t"; + $content .= ""; + $content .= "\n\n"; + } + } else { + if (thematic_use_excerpt()) { + $content ="\t"; + $content .= ""; + $content .= "\n\n"; + } + } + } + } + } elseif ( is_home() || is_front_page() ) { + $content ="\t"; + $content .= ""; + $content .= "\n\n"; + } + echo apply_filters ('thematic_create_description', $content); + } +} // end thematic_create_description + + +// meta-tag description is switchable using a filter +function thematic_show_description() { + $display = TRUE; + $display = apply_filters('thematic_show_description', $display); + if ($display) { + thematic_create_description(); + } +} // end thematic_show_description + + +// create meta-tag robots +function thematic_create_robots() { + global $paged; + if (thematic_seo()) { + $content = "\t"; + if((is_home() && ($paged < 2 )) || is_front_page() || is_single() || is_page() || is_attachment()) { + $content .= ""; + } elseif (is_search()) { + $content .= ""; + } else { + $content .= ""; + } + $content .= "\n\n"; + if (get_option('blog_public')) { + echo apply_filters('thematic_create_robots', $content); + } + } +} // end thematic_create_robots + + +// meta-tag robots is switchable using a filter +function thematic_show_robots() { + $display = TRUE; + $display = apply_filters('thematic_show_robots', $display); + if ($display) { + thematic_create_robots(); + } +} // end thematic_show_robots + + +// Located in header.php +// creates link to style.css +function thematic_create_stylesheet() { + $content = "\t"; + $content .= ""; + $content .= "\n\n"; + echo apply_filters('thematic_create_stylesheet', $content); +} + + +// rss usage is switchable using a filter +function thematic_show_rss() { + $display = TRUE; + $display = apply_filters('thematic_show_rss', $display); + if ($display) { + $content = "\t"; + $content .= ""; + $content .= "\n"; + echo apply_filters('thematic_rss', $content); + } +} // end thematic_show_rss + + +// comments rss usage is switchable using a filter +function thematic_show_commentsrss() { + $display = TRUE; + $display = apply_filters('thematic_show_commentsrss', $display); + if ($display) { + $content = "\t"; + $content .= ""; + $content .= "\n\n"; + echo apply_filters('thematic_commentsrss', $content); + } +} // end thematic_show_commentsrss + + +// pingback usage is switchable using a filter +function thematic_show_pingback() { + $display = TRUE; + $display = apply_filters('thematic_show_pingback', $display); + if ($display) { + $content = "\t"; + $content .= ""; + $content .= "\n\n"; + echo apply_filters('thematic_pingback_url',$content); + } +} // end thematic_show_pingback + + +// comment reply usage is switchable using a filter +function thematic_show_commentreply() { + $display = TRUE; + $display = apply_filters('thematic_show_commentreply', $display); + if ($display) + if ( is_singular() ) + wp_enqueue_script( 'comment-reply' ); // support for comment threading +} // end thematic_show_commentreply + + +// Load scripts for the jquery Superfish plugin http://users.tpg.com.au/j_birch/plugins/superfish/#examples +function thematic_head_scripts() { + $scriptdir_start = "\t"; + $scriptdir_start .= ''; + + $scripts = "\n"; + $scripts .= $scriptdir_start . 'hoverIntent.js' . $scriptdir_end . "\n"; + $scripts .= $scriptdir_start . 'superfish.js' . $scriptdir_end . "\n"; + $scripts .= $scriptdir_start . 'supersubs.js' . $scriptdir_end . "\n"; + $dropdown_options = $scriptdir_start . 'thematic-dropdowns.js' . $scriptdir_end . "\n"; + + $scripts = $scripts . apply_filters('thematic_dropdown_options', $dropdown_options); + + $scripts .= "\n"; + $scripts .= "\t"; + $scripts .= '' . "\n"; + + // Print filtered scripts + print apply_filters('thematic_head_scripts', $scripts); + +} +add_action('wp_head','thematic_head_scripts'); + + +// Add ID and CLASS attributes to the first