$site_name,
'separator' => $sep,
'content' => $content
);
} else {
$elements = array(
'site_name' => $site_name
);
}
if(get_tarski_option('swap_title_order')) {
$elements = array_reverse($elements, true);
}
// Filters should return an array
$elements = apply_filters('tarski_doctitle', $elements);
// But if they don't, it won't try to implode
if(check_input($elements, 'array'))
$doctitle = implode(' ', $elements);
echo $doctitle;
}
/**
* add_version_to_styles() - Adds version number to style links.
*
* This makes browsers re-download the CSS file when the version
* number changes, reducing problems that may occur when markup
* changes but the corresponding new CSS is not downloaded.
* @since 2.0.1
* @see tarski_stylesheets()
* @param array $style_array
* @return array $style_array
*/
function add_version_to_styles($style_array) {
if(check_input($style_array, 'array')) {
foreach($style_array as $type => $values) {
if(is_array($values) && $values['url']) {
$style_array[$type]['url'] .= '?v=' . theme_version();
}
}
}
return $style_array;
}
/**
* generate_feed_link() - Returns a properly formatted RSS or Atom feed link
*
* @since 2.1
* @param string $title
* @param string $link
* @param string $type
* @return string
*/
function generate_feed_link($title, $link, $type = '') {
if ( $type == '' )
$type = feed_link_type();
return "";
}
/**
* feed_link_type() - Returns an Atom or RSS feed MIME type
*
* @since 2.1
* @param string $type
* @return string
*/
function feed_link_type($type = '') {
if(empty($type))
$type = get_default_feed();
if($type == 'atom')
return 'application/atom+xml';
else
return 'application/rss+xml';
}
/**
* tarski_headerimage() - Outputs header image.
*
* @since 1.0
* @return string
*/
function tarski_headerimage() {
if(get_theme_mod('header_image')) {
$header_img_url = get_header_image();
} elseif(get_tarski_option('header')) {
if(get_tarski_option('header') != 'blank.gif') {
$header_img_url = get_bloginfo('template_directory') . '/headers/' . get_tarski_option('header');
}
} else {
$header_img_url = get_bloginfo('template_directory') . '/headers/greytree.jpg';
}
if($header_img_url) {
if(get_tarski_option('display_title')) {
$header_img_alt = __('Header image','tarski');
} else {
$header_img_alt = get_bloginfo('name');
}
$header_img_tag = "";
if(!get_tarski_option('display_title') && !is_wp_front_page()) {
$header_img_tag = sprintf(
'%3$s',
__('Return to main page','tarski'),
user_trailingslashit(get_bloginfo('url')),
$header_img_tag
);
}
echo "
$header_img_tag
\n\n";
}
}
/**
* tarski_sitetitle() - Returns site title, wrapped in appropriate markup.
*
* The title on the home page will appear inside an h1 element,
* whereas on other pages it will be a link (to the home page),
* wrapped in a p (paragraph) element.
* @since 1.5
* @return string
*/
function tarski_sitetitle() {
if(get_tarski_option('display_title')) {
$site_title = get_bloginfo('name');
if(!is_wp_front_page()) {
$site_title = sprintf(
'%3$s',
__('Return to main page','tarski'),
user_trailingslashit(get_bloginfo('url')),
$site_title
);
}
if((get_option('show_on_front') == 'posts') && is_home()) {
$site_title = sprintf('
',
get_option('siteurl') . '/wp-admin/',
__('Site Admin','tarski')
);
return $navbar;
}
/**
* wrap_navlist() - Wraps the Tarski navbar in an unordered list element.
*
* Unlike other navbar filters, wrap_navlist() doesn't make $navbar an array
* if it isn't one, since that would result in it outputting an empty
* unordered list. Instead, it simply returns false.
* @since 2.0
* @see tarski_navbar()
* @param string $navbar
* @return string $navbar
*/
function wrap_navlist($navbar) {
if(check_input($navbar, 'array')) {
array_unshift($navbar, '
');
array_push($navbar, '
');
return $navbar;
} else {
return false;
}
}
/**
* tarski_feedlink() - Adds the site feed link to the site navigation.
*
* @since 2.0
* @param boolean $return echo or return?
* @return string $output
*/
function tarski_feedlink() {
include(TARSKIDISPLAY . '/feed_link.php');
}
/**
* tarski_bodyclass() - Returns the classes that should be applied to the document body.
*
* @since 1.2
* @param boolean $return
* @return string $classes
*/
function tarski_bodyclass($return = false) {
if(get_tarski_option('centred_theme')) { // Centred or not
$classes[] = 'centre';
}
if(get_tarski_option('swap_sides')) { // Swapped or not
$classes[] = 'janus';
}
if(get_tarski_option('style')) { // Alternate style
$stylefile = get_tarski_option('style');
$stylename = str_replace('.css', '', $stylefile);
if(is_valid_tarski_style($stylefile)) {
$classes[] = $stylename;
}
}
if(get_bloginfo('text_direction') == 'rtl') {
$classes[] = 'rtl';
}
// Filters should return an array
$classes = apply_filters('tarski_bodyclass', $classes);
// But if they don't, it won't implode
if(is_array($classes))
$classes = implode(' ', $classes);
if($return)
return $classes;
else
echo $classes;
}
/**
* tarski_bodyid() - Outputs the id that should be applied to the document body.
*
* @since 1.7
* @param boolean $return
* @global object $post
* @global object $wp_query
* @return string $body_id
*/
function tarski_bodyid($return = false) {
global $post, $wp_query;
if(is_home()) {
$body_id = 'home';
} elseif(is_search()) {
$body_id = 'search';
} elseif(is_page()) {
$body_id = 'page-'. $post->post_name;
} elseif(is_single()) {
$body_id = 'post-'. $post->post_name;
} elseif(is_category()) {
$cat_ID = intval(get_query_var('cat'));
$category = &get_category($cat_ID);
$body_id = 'cat-'. $category->category_nicename;
} elseif(is_tag()) {
$tag_ID = intval(get_query_var('tag_id'));
$tag = &get_term($tag_ID, 'post_tag');
$body_id = 'tag-'. $tag->slug;
} elseif(is_author()) {
$author = the_archive_author();
$body_id = 'author-'. $author->user_login;
} elseif(is_date()) {
$year = get_query_var('year');
$monthnum = get_query_var('monthnum');
$day = get_query_var('day');
$body_id = "date";
if(is_year()) {
$body_id .= '-'. $year;
} elseif(is_month()) {
$body_id .= '-'. $year. '-'. $monthnum;
} elseif(is_day()) {
$body_id .= '-'. $year. '-'. $monthnum. '-'. $day;
}
} elseif(is_404()) {
$body_id = '404';
} else {
$body_id = 'unknown';
}
$body_id = apply_filters('tarski_bodyid', $body_id);
if($return)
return $body_id;
else
echo $body_id;
}
/**
* tarski_searchform() - Outputs the WordPress search form.
*
* Will only output the search form on pages that aren't a search
* page or a 404, as these pages include the search form earlier
* in the document and the search form relies on the 's' id value,
* which as an HTML id must be unique within the document.
* @since 2.0
*/
function tarski_searchform() {
include_once(TEMPLATEPATH . "/searchform.php");
}
/**
* tarski_credits() - Outputs the site feed and Tarski credits.
*
* @since 1.5
*/
function tarski_credits() {
if(detectWPMU())
$current_site = get_current_site();
include(TARSKIDISPLAY . "/credits.php");
}
?>