', '>', $text);
echo $text;
}
if(get_option('tarski_header') == 'blank.gif') {
$noHeaderImage = true;
}
function tarski_header_status() {
global $noHeaderImage;
if($noHeaderImage) {
return 'noheaderimage';
} else {
return 'headerimage';
}
}
function tarski_headerimage() {
if($_SERVER['HTTP_HOST'] == 'themes.wordpress.net') {
$headerImage = 'http://tarskitheme.com/wp-content/themes/tarski/headers/greytree.jpg';
} else {
if(get_option('tarski_header')) {
if(get_option('tarski_header') != 'blank.gif') {
$headerImage = get_bloginfo('template_directory') . '/headers/' . get_option('tarski_header');
}
} else {
$headerImage = get_bloginfo('template_directory') . '/headers/greytree.jpg';
}
}
if($headerImage) {
echo '\n";
}
}
function tarski_title($type = 'title') {
$titleSep = '·';
// tarski_title('header') is for use within the document
if ($type == 'header') {
if(is_home()) { echo '' . get_bloginfo('name') . '
'; }
else { echo '' . get_bloginfo('name') . '
'; }
}
// tarski_title() is for use within the document
else { echo get_bloginfo('name');
if (is_home()) { if (get_bloginfo('description') != '') { echo ' ' . $titleSep . ' ' . get_bloginfo('description'); } }
elseif (is_search()) { echo ' ' . $titleSep . ' Search results'; }
elseif (is_month()) { echo ' ' . $titleSep . ' '; single_month_title(' '); }
else { wp_title($titleSep); }
}
}
function tarski_navbar() {
$current = 'id="nav-current" ';
if(is_home()) { $homeStatus = $current; }
echo "' . __('Home', 'tarski') . "\n";
global $wpdb;
$nav_pages = get_option('tarski_nav_pages');
if($nav_pages) {
$nav_pages = explode(',', $nav_pages);
foreach($nav_pages as $page) {
if(is_page($page)) { $pageStatus = $current; } else { $pageStatus = ''; }
echo ' ' . $wpdb->get_var("SELECT post_title from $wpdb->posts WHERE ID = $page") . '' . "\n";
}
}
global $navbarInclude;
if($navbarInclude) {
echo $navbarInclude . "\n";
}
if(is_user_logged_in()) {
echo '' . __('Site Admin', 'tarski') . '' . "\n";
}
}
function tarski_bodyclass() {
if(get_option('tarski_centered_theme')) {
echo 'center';
} else {
echo 'left';
}
if(get_option('tarski_swap_sides')) {
echo ' janus';
}
if(get_option('tarski_style')) {
echo ' ' . str_replace('.css', '', get_option('tarski_style'));
}
if (is_page() || is_single() || is_404()) {
echo ' single';
}
global $headerImageSet;
if($headerImageSet == false) {
echo ' noheader';
}
}
function tarski_date() {
global $post;
return mysql2date(get_settings('date_format'), $post->post_date);
}
function inject_tarski_js() {
// echo bloginfo('wp_version');
echo "\n\n";
if(file_exists(ABSPATH . 'wp-includes/js/prototype.js')) {
echo '' . "\n";
} else {
echo '' . "\n";
}
if(file_exists(ABSPATH . 'wp-includes/js/scriptaculous/scriptaculous.js')) {
echo '' . "\n";
} else {
echo '' . "\n";
}
/*
echo '' . "\n";
echo "\n";
*/
}
function tarskiupdate() {
global $wpdb, $user_ID;
get_currentuserinfo();
if ( !empty($_POST) ) {
if($_POST['tarski_update_notification'] == __('Turn update notification off?', 'tarski')) {
update_option('tarski_update_notification', 'false');
} elseif($_POST['tarski_update_notification'] == __('Turn update notification on?', 'tarski')) {
update_option('tarski_update_notification', 'true');
}
if (isset($_POST['about_text'])) {
$about = $_POST['about_text'];
update_option('blurb', $about, '','');
}
if (isset($_POST['header_image'])) {
$header = $_POST['header_image'];
$header = @str_replace("-thumb", "", $header);
update_option('tarski_header', $header, '','');
}
update_option('tarski_sidebar_pages', $_POST['sidebar']['pages']);
update_option('tarski_sidebar_links', $_POST['sidebar']['links']);
update_option('tarski_sidebar_comments', $_POST['sidebar']['comments']);
update_option('tarski_sidebar_custom', $_POST['sidebar']['custom']);
update_option('tarski_sidebar_onlyhome', $_POST['sidebar']['onlyhome']);
update_option('tarski_display_title', $_POST['display_title']);
update_option('tarski_display_tagline', $_POST['display_tagline']);
update_option('tarski_hide_categories', $_POST['hide_categories']);
update_option('tarski_use_pages', $_POST['use_pages']);
update_option('tarski_centered_theme', $_POST['centered_theme']);
update_option('tarski_swap_sides', $_POST['swap_sides']);
update_option('tarski_asidescategory', $_POST['asides_category']);
update_option('tarski_style', $_POST['alternate_style']);
update_option('tarski_ajax_tags', $_POST['ajax_tags']);
update_option('tarski_nav_pages', implode(',', $_POST['nav_pages']));
}
}
// if we can't find Tarski installed let's go ahead and install all the options that run Tarski. This should run only one more time for all our existing users, then they will just be getting the upgrade function if it exists.
if (!get_option('tarski_installed')) {
add_option('tarski_installed', $installedVersion, 'This option simply tells us if Tarski has been installed before', $autoload);
add_option('tarski_header', 'greytree.jpg', '', $autoload);
add_option('blurb', __('This is the about text', 'tarski'), __('Allows you to write a small blurb about you and your blog, which will be put on the frontpage', 'tarski'), $autoload);
}
// Here we handle upgrading our users with new options and such. If tarski_installed is in the DB but the version they are running is lower than our current version, trigger this event.
elseif (get_option('tarski_installed') < $installedVersion) {
if(get_option('tarski_installed') < 1.1) {
add_option('tarski_asidescategory', '0', __('ID of a category to display as Asides.', 'tarski'));
}
update_option('tarski_installed', $installedVersion);
}
// This adds the Tarski Options page
add_action('admin_menu', 'tarski_addmenu');
function tarski_addmenu() {
add_submenu_page('themes.php', __('Tarski Options','tarski'), __('Tarski Options','tarski'), 'edit_themes', 'tarski-options', 'tarski_admin');
}
function tarski_admin() {
require(TEMPLATEPATH . '/library/options-page.php');
}
function tarski_get_output($code) {
ob_start();
eval($code);
$return = ob_get_contents();
ob_end_clean();
return $return;
}
// Code shamelessly borrowed from
// http://guff.szub.net/2005/02/26/the-excerpt-reloaded/
function tarski_excerpt($excerpt_length = 120, $allowedtags = '', $filter_type = 'none', $use_more_link = 1, $more_link_text = '(more...)', $force_more = 1, $fakeit = 1, $no_more = 0, $more_tag = 'div', $more_link_title = 'Continue reading this entry', $showdots = 1) {
global $post;
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) { // and it doesn't match cookie
if(is_feed()) { // if this runs in a feed
$output = __('There is no excerpt because this is a protected post.');
} else {
$output = get_the_password_form();
}
}
return $output;
}
if($fakeit == 2) { // force content as excerpt
$text = $post->post_content;
} elseif($fakeit == 1) { // content as excerpt, if no excerpt
$text = (empty($post->post_excerpt)) ? $post->post_content : $post->post_excerpt;
} else { // excerpt no matter what
$text = $post->post_excerpt;
}
if($excerpt_length < 0) {
$output = $text;
} else {
if(!$no_more && strpos($text, '')) {
$text = explode('', $text, 2);
$l = count($text[0]);
$more_link = 1;
} else {
$text = explode(' ', $text);
if(count($text) > $excerpt_length) {
$l = $excerpt_length;
$ellipsis = 1;
} else {
$l = count($text);
$more_link_text = '';
$ellipsis = 0;
}
}
for ($i=0; $i<$l; $i++)
$output .= $text[$i] . ' ';
}
if('all' != $allowed_tags) {
$output = strip_tags($output, $allowedtags);
}
$output = rtrim($output, "\s\n\t\r\0\x0B");
$output = ($fix_tags) ? $output : balanceTags($output);
$output .= ($showdots && $ellipsis) ? '...' : '';
switch($more_tag) {
case('div') :
$tag = 'div';
break;
case('span') :
$tag = 'span';
break;
case('p') :
$tag = 'p';
break;
default :
$tag = 'span';
break;
}
if ($use_more_link && $more_link_text) {
if($force_more) {
$output .= ' <' . $tag . ' class="more-link">' . $more_link_text . '' . $tag . '>' . "\n";
} else {
$output .= ' <' . $tag . ' class="more-link">' . $more_link_text . '' . $tag . '>' . "\n";
}
}
$output = apply_filters($filter_type, $output);
return $output;
}
// Tarski Options page ends here ?>