window.location.replace('${_SERVER['REQUEST_URI']}');\n"; exit; } // if no widgets, don't use the widgets sidebar if(!function_exists('register_sidebar') && get_tarski_option('sidebar_type') == 'widgets') { update_tarski_option('sidebar_type', ''); } // set default sidebar type if(!get_tarski_option('sidebar_type')) { // default to widgets if available, otherwise use the Tarski sidebar if(function_exists('register_sidebar')) { update_tarski_option('sidebar_type', 'widgets'); } else { update_tarski_option('sidebar_type','tarski'); } } // Constants file include @include(TEMPLATEPATH . '/constants.php'); // Functions and hooks - important! require(TEMPLATEPATH . '/library/template-functions.php'); require(TEMPLATEPATH . '/library/content-functions.php'); require(TEMPLATEPATH . '/library/tarski-hooks.php'); require(TEMPLATEPATH . '/library/constants-hooks.php'); require(TEMPLATEPATH . '/library/update-notifier.php'); // Localisation load_theme_textdomain('tarski'); // Options page and dashboard injections add_action('admin_head', 'tarski_inject_scripts'); if(!detectWPMU()) { add_action('activity_box_end','update_notifier_dashboard'); } // Widgets if(function_exists('register_sidebar')) { register_sidebar(array( 'name' => __('Main Sidebar','tarski'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => __('Footer Widgets','tarski'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } // custom header API if(function_exists('add_custom_image_header')) { define('HEADER_TEXTCOLOR', ''); define('HEADER_IMAGE', '%s/headers/' . get_tarski_option('header')); // %s is theme dir uri define('HEADER_IMAGE_WIDTH', 720); define('HEADER_IMAGE_HEIGHT', 180); define('NO_HEADER_TEXT', true ); function tarski_admin_header_style() { ?> 'value'); with all options to save queries function update_tarski_options($array) { global $tarski_options; foreach($array as $name => $value) { $tarski_options[$name] = $value; } update_option('tarski_options', serialize($tarski_options)); flush_tarski_options(); } // detect WordPress MultiUser - http://mu.wordpress.org/ function detectWPMU() { return function_exists('is_site_admin'); } // Options page JS and CSS injection function tarski_inject_scripts() { if(substr($_SERVER['REQUEST_URI'], -39, 39) == 'wp-admin/themes.php?page=tarski-options') { // Ugly echo "\n\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; echo "\n"; } } // Update function // I r serious cat. This r serious function. function tarskiupdate() { global $wpdb, $user_ID; get_currentuserinfo(); if ( !empty($_POST) ) { if($_POST['tarski_update_notification'] == __('Turn update notification off?','tarski')) { update_tarski_option('update_notification', 'false'); } elseif($_POST['tarski_update_notification'] == __('Turn update notification on?','tarski')) { update_tarski_option('update_notification', 'true'); } if (isset($_POST['about_text'])) { $about = $_POST['about_text']; update_tarski_option('blurb', $about, '',''); } if (isset($_POST['header_image'])) { $header = $_POST['header_image']; $header = @str_replace("-thumb", "", $header); update_tarski_option('header', $header, '',''); } $nav_pages = implode(',', $_POST['nav_pages']); update_tarski_options(array( 'footer_recent' => $_POST['footer']['recent'], 'sidebar_pages' => $_POST['sidebar']['pages'], 'sidebar_links' => $_POST['sidebar']['links'], 'sidebar_comments' => $_POST['sidebar']['comments'], 'sidebar_custom' => $_POST['sidebar']['custom'], 'sidebar_onlyhome' => $_POST['sidebar']['onlyhome'], 'display_title' => $_POST['display_title'], 'display_tagline' => $_POST['display_tagline'], 'hide_categories' => $_POST['hide_categories'], 'use_pages' => $_POST['use_pages'], 'centered_theme' => $_POST['centered_theme'], 'swap_sides' => $_POST['swap_sides'], 'asidescategory' => $_POST['asides_category'], 'style' => $_POST['alternate_style'], 'ajax_tags' => $_POST['ajax_tags'], 'nav_pages' => $nav_pages, 'sidebar_type' => $_POST['sidebartype'] )); } } // 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_tarski_option('installed')) { add_tarski_option('installed', $installedVersion); add_tarski_option('header', 'greytree.jpg'); add_tarski_option('blurb', __('This is the about text','tarski')); } // 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_tarski_option('installed') < $installedVersion) { if(get_tarski_option('installed') < 1.1) { add_tarski_option('asidescategory', '0'); } update_tarski_option('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) { global $comment, $post; ob_start(); @eval($code); $return = ob_get_contents(); ob_end_clean(); return $return; } // ~fin~ ?>