'3', // 1, 2, 3 (the depth of the menu, 1 being no dropdown) 'headerMenu1_display' => 'pages', // pages, categories 'headerMenu1_sortBy' => 'post_title', // [CATEGORIES]: name, ID, count, slug [PAGES]: post_title, ID, post_name (slug), menu_order (the page's Order value) 'headerMenu1_sortOrder' => 'asc', // asc, desc 'headerMenu1_alignment' => 'right', // right, left 'headerMenu1_show' => true, 'headerMenu1_disableParentPageLink' => false, 'headerMenu1_exclude_categories' => '', 'headerMenu1_exclude_pages' => '', 'headerMenu2_dropdown' => '3', // 1, 2, 3 (the depth of the menu, 1 being no dropdown) 'headerMenu2_display' => 'categories', // pages, categories 'headerMenu2_sortBy' => 'name', // [CATEGORIES]: name, ID, count, slug [PAGES]: post_title, ID, post_name (slug), menu_order (the page's Order value) 'headerMenu2_sortOrder' => 'asc', // asc, desc 'headerMenu2_displayHomeButton' => true, 'headerMenu2_displaySeparators' => true, 'headerMenu2_show' => true, 'headerMenu2_disableParentPageLink' => false, 'headerMenu2_exclude_categories' => '', 'headerMenu2_exclude_pages' => '', 'headerImage' => 'lightBlue', //lightBlue, darkBlue 'commentDisplay' => 'alt', // alt, left, right 'commentDateFormat' => 'timePassed', // timePassed, date 'comments_hideWhenDisabledOnPages' => true, 'comments_hideWhenDisabledOnPosts' => false, 'trackbacks_hideWhenDisabledOnPages' => true, 'trackbacks_hideWhenDisabledOnPosts' => true, 'footerStyle' => 'style1', // style1, style2 'appendToPageTitle' => 'blogName', // blogName, custom 'appendToPageTitleCustom' => '', 'sidebarDisplay' => 'right', // right, left, none 'sidebarWidth' => 'normal', // small, normal, large 'sidebar_showDefault' => true, 'sidebar_showRSSButton' => true, 'sidebar_showTwitterButton' => false, 'sidebar_showFacebookButton' => false, 'sidebar_twitterURL' => '', 'sidebar_facebookURL' => '', 'sidebar_displayButtonTexts' => false, 'postsShowAuthor' => true, 'postsShowTime' => false, 'posts_showTopPostLinks' => false, 'posts_showBottomPostLinks' => true, 'pages_showInfoBar' => false, 'customCSS' => false, 'customCSS_input' => '', 'pagination' => true, 'pagination_pageRange' => 2, //the number of page buttons to show before and after the current page button 'pagination_pageAnchors' => 1, //the number of buttons to always show at the beginning and end of the pagination bar 'pagination_pageGap' => 1, //the number of pages in a gap before an ellipsis is added //Added 1.5 'excerpts_index' => false, 'excerpts_categoryPages' => true, 'excerpts_archivePages' => true, 'excerpts_searchPages' => true, 'excerpts_authorPages' => false, 'background_color' => '#d9d9d9', 'background_style' => 'gradient_blueish', //if set, overrides background_color 'solidBackground_buttonStyle' => 'default', //will only be used if the background color is solid 'headerLogo' => '', 'headerLogo_width' => 0, 'headerLogo_height' => 0, 'archives_includeTags' => true, 'archives_includeCategories' => true, 'miscellaneous_IE6Notice' => true, 'headerMenus_enableJavaScript' => true, 'headerMenus_effect' => 'slide', //slide, fade, none 'headerMenus_delay' => 500 //in milliseconds ); $optionsSaved = false; function arjuna_create_options() { // Default values $options = $GLOBALS['_arjunaDefaultOptions']; // Overridden values $DBOptions = get_option('arjuna_options'); if ( !is_array($DBOptions) ) $DBOptions = array(); // Merge // Change since Arjuna 1.2: Values that are not used anymore will be deleted foreach ( $options as $key => $value ) if ( isset($DBOptions[$key]) ) $options[$key] = $DBOptions[$key]; update_option('arjuna_options', $options); return $options; } function arjuna_get_options() { static $return = false; if($return !== false) return $return; $options = get_option('arjuna_options'); if(!empty($options) && $options == $GLOBALS['_arjunaDefaultOptions']) $return = $options; else $return = arjuna_create_options(); return $return; } $formErrors = array(); function arjuna_add_theme_options() { global $optionsSaved, $formErrors; if(isset($_POST['arjuna_save_options'])) { $options = arjuna_create_options(); //Menu 1 dropdown $validOptions = array('1', '2', '3'); if(isset($_POST['headerMenu1_dropdown'])) { if ( in_array($_POST['headerMenu1_dropdown'], $validOptions) ) $options['headerMenu1_dropdown'] = $_POST['headerMenu1_dropdown']; else $options['headerMenu1_dropdown'] = '3'; } //Menu 1 display $validOptions = array('pages', 'categories'); if(isset($_POST['headerMenu1_display'])) { if ( in_array($_POST['headerMenu1_display'], $validOptions) ) $options['headerMenu1_display'] = $_POST['headerMenu1_display']; else $options['headerMenu1_display'] = 'pages'; } if(isset($_POST['headerMenu1_display'])) { if ($options['headerMenu1_display']=='pages') { //Menu 1 sorting for PAGES $validOptions = array('post_title', 'ID', 'post_name', 'menu_order'); if ( in_array($_POST['headerMenu1_sortBy_pages'], $validOptions) ) $options['headerMenu1_sortBy'] = $_POST['headerMenu1_sortBy_pages']; else $options['headerMenu1_sortBy'] = $validOptions[0]; //Menu 1 sorting order $validOptions = array('asc', 'desc'); if ( in_array($_POST['headerMenu1_sortOrder_pages'], $validOptions) ) $options['headerMenu1_sortOrder'] = $_POST['headerMenu1_sortOrder_pages']; else $options['headerMenu1_sortOrder'] = $validOptions[0]; } elseif ($options['headerMenu1_display']=='categories') { //Menu 1 sorting for CATEGORIES $validOptions = array('name', 'ID', 'count', 'slug'); if ( in_array($_POST['headerMenu1_sortBy_categories'], $validOptions) ) $options['headerMenu1_sortBy'] = $_POST['headerMenu1_sortBy_categories']; else $options['headerMenu1_sortBy'] = $validOptions[0]; //Menu 1 sorting order $validOptions = array('asc', 'desc'); if ( in_array($_POST['headerMenu1_sortOrder_categories'], $validOptions) ) $options['headerMenu1_sortOrder'] = $_POST['headerMenu1_sortOrder_categories']; else $options['headerMenu1_sortOrder'] = $validOptions[0]; } } //Menu 1 show if (isset($_POST['headerMenu1_show'])) $options['headerMenu1_show'] = true; else $options['headerMenu1_show'] = false; //Menu 1 alignment $validOptions = array('right', 'left'); if(isset($_POST['headerMenu1_alignment'])) { if ( in_array($_POST['headerMenu1_alignment'], $validOptions) ) $options['headerMenu1_alignment'] = $_POST['headerMenu1_alignment']; else $options['headerMenu1_alignment'] = $validOptions[0]; } // Menu 1 - Disable Parent Page Links in if (isset($_POST['headerMenu1_disableParentPageLink'])) $options['headerMenu1_disableParentPageLink'] = true; else $options['headerMenu1_disableParentPageLink'] = false; // Menu 1 - Exclude items if(isset($_POST['headerMenu1_exclude_categories'])) { if($_POST['headerMenu1_exclude_categories']) { $options['headerMenu1_exclude_categories'] = implode(',', $_POST['headerMenu1_exclude_categories']); } else $options['headerMenu1_exclude_categories'] = ''; } if(isset($_POST['headerMenu1_exclude_pages'])) { if($_POST['headerMenu1_exclude_pages']) { $options['headerMenu1_exclude_pages'] = implode(',', $_POST['headerMenu1_exclude_pages']); } else $options['headerMenu1_exclude_pages'] = ''; } //Menu 2 show if (isset($_POST['headerMenu2_show'])) $options['headerMenu2_show'] = true; else $options['headerMenu2_show'] = false; //Menu 2 dropdown $validOptions = array('1', '2', '3'); if(isset($_POST['headerMenu2_dropdown'])) { if ( in_array($_POST['headerMenu2_dropdown'], $validOptions) ) $options['headerMenu2_dropdown'] = $_POST['headerMenu2_dropdown']; else $options['headerMenu2_dropdown'] = '3'; } //Menu 2 display $validOptions = array('pages', 'categories'); if(isset($_POST['headerMenu2_display'])) { if ( in_array($_POST['headerMenu2_display'], $validOptions) ) $options['headerMenu2_display'] = $_POST['headerMenu2_display']; else $options['headerMenu2_display'] = 'pages'; } if(isset($_POST['headerMenu2_display'])) { if ($options['headerMenu2_display']=='pages') { //Menu 2 sorting for PAGES $validOptions = array('post_title', 'ID', 'post_name', 'menu_order'); if ( in_array($_POST['headerMenu2_sortBy_pages'], $validOptions) ) $options['headerMenu2_sortBy'] = $_POST['headerMenu2_sortBy_pages']; else $options['headerMenu2_sortBy'] = $validOptions[0]; //Menu 2 sorting order $validOptions = array('asc', 'desc'); if ( in_array($_POST['headerMenu2_sortOrder_pages'], $validOptions) ) $options['headerMenu2_sortOrder'] = $_POST['headerMenu2_sortOrder_pages']; else $options['headerMenu2_sortOrder'] = $validOptions[0]; } elseif ($options['headerMenu2_display']=='categories') { //Menu 2 sorting for CATEGORIES $validOptions = array('name', 'ID', 'count', 'slug'); if ( in_array($_POST['headerMenu2_sortBy_categories'], $validOptions) ) $options['headerMenu2_sortBy'] = $_POST['headerMenu2_sortBy_categories']; else $options['headerMenu2_sortBy'] = $validOptions[0]; //Menu 2 sorting order $validOptions = array('asc', 'desc'); if ( in_array($_POST['headerMenu2_sortOrder_categories'], $validOptions) ) $options['headerMenu2_sortOrder'] = $_POST['headerMenu2_sortOrder_categories']; else $options['headerMenu2_sortOrder'] = $validOptions[0]; } } //Menu 2 Home Icon if (isset($_POST['headerMenu2_displayHomeButton'])) $options['headerMenu2_displayHomeButton'] = true; else $options['headerMenu2_displayHomeButton'] = false; //Menu 2 Home Icon if (isset($_POST['headerMenu2_displaySeparators'])) $options['headerMenu2_displaySeparators'] = true; else $options['headerMenu2_displaySeparators'] = false; // Menu 2 - Disable Parent Page Links in if (isset($_POST['headerMenu2_disableParentPageLink'])) $options['headerMenu2_disableParentPageLink'] = true; else $options['headerMenu2_disableParentPageLink'] = false; // Menu 2 - Exclude items if(isset($_POST['headerMenu2_exclude_categories'])) { if($_POST['headerMenu2_exclude_categories']) { $options['headerMenu2_exclude_categories'] = implode(',', $_POST['headerMenu2_exclude_categories']); } else $options['headerMenu2_exclude_categories'] = ''; } if(isset($_POST['headerMenu2_exclude_pages'])) { if($_POST['headerMenu2_exclude_pages']) { $options['headerMenu2_exclude_pages'] = implode(',', $_POST['headerMenu2_exclude_pages']); } else $options['headerMenu2_exclude_pages'] = ''; } //Header Image $validOptions = array('lightBlue', 'darkBlue', 'khaki', 'seaGreen', 'lightRed'); if(isset($_POST['headerImage'])) { if ( in_array($_POST['headerImage'], $validOptions) ) $options['headerImage'] = $_POST['headerImage']; else $options['headerImage'] = $validOptions[0]; } //Comment display $validOptions = array('alt', 'left', 'right'); if(isset($_POST['commentDisplay'])) { if ( in_array($_POST['commentDisplay'], $validOptions) ) $options['commentDisplay'] = $_POST['commentDisplay']; else $options['commentDisplay'] = 'alt'; } // Comment display if (isset($_POST['comments_hideWhenDisabledOnPages'])) $options['comments_hideWhenDisabledOnPages'] = true; else $options['comments_hideWhenDisabledOnPages'] = false; if (isset($_POST['comments_hideWhenDisabledOnPosts'])) $options['comments_hideWhenDisabledOnPosts'] = true; else $options['comments_hideWhenDisabledOnPosts'] = false; if (isset($_POST['trackbacks_hideWhenDisabledOnPages'])) $options['trackbacks_hideWhenDisabledOnPages'] = true; else $options['trackbacks_hideWhenDisabledOnPages'] = false; if (isset($_POST['trackbacks_hideWhenDisabledOnPosts'])) $options['trackbacks_hideWhenDisabledOnPosts'] = true; else $options['trackbacks_hideWhenDisabledOnPosts'] = false; //Footer style $validOptions = array('style1', 'style2'); if(isset($_POST['footerStyle'])) { if ( in_array($_POST['footerStyle'], $validOptions) ) $options['footerStyle'] = $_POST['footerStyle']; else $options['footerStyle'] = 'style1'; } //Comment date format $validOptions = array('timePassed', 'date'); if(isset($_POST['commentDateFormat'])) { if ( in_array($_POST['commentDateFormat'], $validOptions) ) $options['commentDateFormat'] = $_POST['commentDateFormat']; else $options['commentDateFormat'] = 'timePassed'; } //Append to page title $validOptions = array('blogName', 'custom'); if(isset($_POST['appendToPageTitle'])) { if ( in_array($_POST['appendToPageTitle'], $validOptions) ) $options['appendToPageTitle'] = $_POST['appendToPageTitle']; else $options['appendToPageTitle'] = 'blogName'; } if(isset($_POST['appendToPageTitle'])) { if ($_POST['appendToPageTitle']=='custom') $options['appendToPageTitleCustom'] = $_POST['appendToPageTitleCustom']; } //Sidebar display $validOptions = array('right', 'left', 'none'); if(isset($_POST['sidebarDisplay'])) { if ( in_array($_POST['sidebarDisplay'], $validOptions) ) $options['sidebarDisplay'] = $_POST['sidebarDisplay']; else $options['sidebarDisplay'] = $validOptions[0]; } // Whether or not to show the default bars (if no widget bars are defined) if (isset($_POST['sidebar_showDefault'])) $options['sidebar_showDefault'] = true; else $options['sidebar_showDefault'] = false; // Sidebar: RSS Button if (isset($_POST['sidebar_showRSSButton'])) $options['sidebar_showRSSButton'] = true; else $options['sidebar_showRSSButton'] = false; // Sidebar: Twitter Button if (isset($_POST['sidebar_showTwitterButton'])) { $twitterURL = trim($_POST['sidebar_twitterURL']); $options['sidebar_showTwitterButton'] = true; if ( !preg_match('/twitter\.com/i', $twitterURL) ) { if(!preg_match('/\.com/i', $twitterURL)) { //Add the twitter host name $twitterURL = "http://twitter.com/" . $twitterURL; } else { $options['sidebar_showTwitterButton'] = false; $twitterURL = ""; } } elseif ( !preg_match('/http[s]?\:\/\//i', $twitterURL) ) { $twitterURL = "http://" . $twitterURL; } elseif ( empty($twitterURL) ) { $options['sidebar_showTwitterButton'] = false; } $options['sidebar_twitterURL'] = $twitterURL; } else $options['sidebar_showTwitterButton'] = false; // Sidebar: Facebook Button if (isset($_POST['sidebar_showFacebookButton'])) { $facebookURL = trim($_POST['sidebar_facebookURL']); $options['sidebar_showFacebookButton'] = true; if ( empty($facebookURL) ) { $options['sidebar_showFacebookButton'] = false; } elseif ( !preg_match('/facebook\./i', $facebookURL) ) { $twitterURL = "http://facebook.com/" . $facebookURL; } elseif ( !preg_match('/http[s]?\:\/\//i', $facebookURL) ) { $facebookURL = "http://" . $facebookURL; } $options['sidebar_facebookURL'] = $facebookURL; } else $options['sidebar_showFacebookButton'] = false; if (isset($_POST['sidebar_displayButtonTexts'])) $options['sidebar_displayButtonTexts'] = true; else $options['sidebar_displayButtonTexts'] = false; //Sidebar Width $validOptions = array('normal', 'small', 'large'); if(isset($_POST['sidebarWidth'])) { if ( in_array($_POST['sidebarWidth'], $validOptions) ) $options['sidebarWidth'] = $_POST['sidebarWidth']; else $options['sidebarWidth'] = $validOptions[0]; } // Posts, Show Author if (isset($_POST['postsShowAuthor'])) $options['postsShowAuthor'] = true; else $options['postsShowAuthor'] = false; // Posts, Show Time if (isset($_POST['postsShowTime'])) $options['postsShowTime'] = true; else $options['postsShowTime'] = false; if (isset($_POST['pages_showInfoBar'])) $options['pages_showInfoBar'] = true; else $options['pages_showInfoBar'] = false; //Navigation links to previous and next posts if (isset($_POST['posts_showTopPostLinks'])) $options['posts_showTopPostLinks'] = true; else $options['posts_showTopPostLinks'] = false; if (isset($_POST['posts_showBottomPostLinks'])) $options['posts_showBottomPostLinks'] = true; else $options['posts_showBottomPostLinks'] = false; if(isset($_POST['pagination'])) { if ($_POST['pagination']=='1') { $options['pagination'] = true; $validOptions = array(1,2,3,4,5); if ( in_array($_POST['pagination_pageRange'], $validOptions) ) $options['pagination_pageRange'] = $_POST['pagination_pageRange']; else $options['pagination_pageRange'] = 3; $validOptions = array(1,2,3); if ( in_array($_POST['pagination_pageAnchors'], $validOptions) ) $options['pagination_pageAnchors'] = $_POST['pagination_pageAnchors']; else $options['pagination_pageAnchors'] = 1; $validOptions = array(1,2,3); if ( in_array($_POST['pagination_pageGap'], $validOptions) ) $options['pagination_pageGap'] = $_POST['pagination_pageGap']; else $options['pagination_pageGap'] = 1; } else $options['pagination'] = false; } //Custom CSS if (isset($_POST['customCSS'])) { if (trim($_POST['customCSS_input'])) { $options['customCSS'] = true; $input = trim($_POST['customCSS_input']); $options['customCSS_input'] = $input; } else { $options['customCSS'] = false; $options['customCSS_input'] = ''; } } else $options['customCSS'] = false; //Background Styles if ($_POST['backgroundStyle'] == '') { $options['background_style'] = ''; $options['background_color'] = $_POST['backgroundColor']; $options['solidBackground_buttonStyle'] = $_POST['backgroundButtonStyle']; } else { $validOptions = array('gradient_blueish', 'gradient_gray', 'gradient_gray_reverse', 'gradient_khaki'); if ( in_array($_POST['backgroundStyle'], $validOptions) ) $options['background_style'] = $_POST['backgroundStyle']; else $options['background_style'] = 'gradient_blueish'; } //Index Pages if (isset($_POST['archives_includeTags'])) $options['archives_includeTags'] = true; else $options['archives_includeTags'] = false; if (isset($_POST['archives_includeCategories'])) $options['archives_includeCategories'] = true; else $options['archives_includeCategories'] = false; //Excerpts if (isset($_POST['excerpts_index'])) $options['excerpts_index'] = true; else $options['excerpts_index'] = false; if (isset($_POST['excerpts_categoryPages'])) $options['excerpts_categoryPages'] = true; else $options['excerpts_categoryPages'] = false; if (isset($_POST['excerpts_archivePages'])) $options['excerpts_archivePages'] = true; else $options['excerpts_archivePages'] = false; if (isset($_POST['excerpts_searchPages'])) $options['excerpts_searchPages'] = true; else $options['excerpts_searchPages'] = false; if (isset($_POST['excerpts_authorPages'])) $options['excerpts_authorPages'] = true; else $options['excerpts_authorPages'] = false; //Logo if(isset($_FILES['headerLogo'])) { if($_FILES['headerLogo']['type']) { if(!eregi('image/', $_FILES['headerLogo']['type'])) { //catch error $formErrors['headerLogo'] = __('The uploaded file is not a valid image. Only JPEG, PNG and GIF is supported.', 'Arjuna'); } else { // check if valid image $info = getimagesize($_FILES['headerLogo']['tmp_name']); $supportedMimeTypes = array('image/gif', 'image/jpeg', 'image/png'); if(!$info || !in_array($info['mime'], $supportedMimeTypes)) { //catch error $formErrors['headerLogo'] = __('The uploaded file is not a valid image. Only JPEG, PNG and GIF is supported.', 'Arjuna'); } else { list($width, $height) = $info; $path = arjuna_get_upload_directory() . '/' . $_FILES['headerLogo']['name']; move_uploaded_file($_FILES['headerLogo']['tmp_name'], $path); $options['headerLogo'] = arjuna_get_upload_url() . '/' . $_FILES['headerLogo']['name']; $options['headerLogo_width'] = $width; $options['headerLogo_height'] = $height; } } } } //Javascript menus if (isset($_POST['headerMenus_enableJavaScript'])) $options['headerMenus_enableJavaScript'] = true; else $options['headerMenus_enableJavaScript'] = false; //IE6 Notice if (isset($_POST['miscellaneous_IE6Notice'])) $options['miscellaneous_IE6Notice'] = true; else $options['miscellaneous_IE6Notice'] = false; update_option('arjuna_options', $options); $optionsSaved = true; } if(isset($_POST['removeLogo'])) { $options = arjuna_create_options(); $options['headerLogo'] = ''; $options['headerLogo_width'] = 0; $options['headerLogo_height'] = 0; update_option('arjuna_options', $options); $optionsSaved = true; } add_theme_page(__('Arjuna Options', 'Arjuna'), __('Arjuna Options', 'Arjuna'), 'edit_themes', basename(__FILE__), 'arjuna_add_theme_page'); } function arjuna_admin_is_panel_open($ID) { if(!isset($_SESSION['arjunaAdminPanels'])) return false; if(!isset($_SESSION['arjunaAdminPanels'][$ID])) return false; if($_SESSION['arjunaAdminPanels'][$ID]) return true; } function arjuna_add_theme_page () { global $optionsSaved, $formErrors; $options = arjuna_get_options(); if ( $optionsSaved ) echo '

'.__('The Arjuna options have been saved.', 'Arjuna').'

'; ?>

SRS Solutions'); ?>
to receive news, updates, and more.
*/ ?>
'; foreach($formErrors as $error) print '

'.$error.'

'; print '
'; ?>


style="display:none;"> */ ?>



style="display:none;">
style="display:none;">
style="display:none;">

style="display:none;">


style="display:none;"> */ ?>



style="display:none;">
style="display:none;">
style="display:none;">

', 'Arjuna'); ?>
style="display:none;">


'backgroundStyle_blueish', 'value' => 'gradient_blueish', 'label' => __('Blueish gradient')), array('id' => 'backgroundStyle_gray', 'value' => 'gradient_gray', 'label' => __('Gray gradient')), array('id' => 'backgroundStyle_grayReverse', 'value' => 'gradient_gray_reverse', 'label' => __('Gray gradient (reverse)')), array('id' => 'backgroundStyle_khaki', 'value' => 'gradient_khaki', 'label' => __('Khaki gradient')) ); foreach($versions as $version): ?>
/>
/>

/>
/>
/>
/>
/>
/>
/>

', ''); ?>

/>
/>
/>


Sidebar Top: Recent Posts and Browse by Tags, Sidebar Left: Categories, Siderbar Right: Meta', 'Arjuna'); ?>








/>
/>
/>





















'Sidebar Top', 'id'=>'sidebar_full_top', 'description'=>'This is the top widget bar in the sidebar, extending to full width of the sidebar.', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name'=>'Sidebar Left', 'id'=>'sidebar_left', 'description'=>'This is the widget bar on the left hand side in the sidebar. It appears right below the top widget bar.', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name'=>'Sidebar Right', 'id'=>'sidebar_right', 'description'=>'This is the widget bar on the right hand side in the sidebar. It appears right below the top widget bar, next to the left widget bar.', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name'=>'Sidebar Bottom', 'id'=>'sidebar_full_bottom', 'description'=>'This is the bottom widget bar in the sidebar, extending to full width of the sidebar. It will appear below the left and right widget bars.', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); /* register_sidebar(array( 'name'=>'header_bar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name'=>'footer_bar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); */ } $GLOBALS['content_width'] = $content_width = 600; // Localization function theme_init(){ load_theme_textdomain('Arjuna', get_template_directory() . '/languages'); } add_action ('init', 'theme_init'); //CSS for plugin page add_action('admin_print_styles', 'arjuna_admin_initCSS'); function arjuna_admin_initCSS() { wp_enqueue_style('arjunaAdminCSS', get_bloginfo('template_url').'/admin.css'); wp_enqueue_style('fionnFarbtasticCSS', get_bloginfo('template_url').'/lib/farbtastic/farbtastic.css'); } //JS for plugin page add_action('admin_print_scripts', 'arjuna_admin_initJS'); function arjuna_admin_initJS() { wp_enqueue_script('fionnFarbtasticJS', get_bloginfo('template_url').'/lib/farbtastic/farbtastic.js'); wp_enqueue_script('arjunaAdminJS', get_bloginfo('template_url').'/admin.js'); } //for WordPress versions below 2.7, include a legacy comments file because threaded comments are not supported yet add_filter( 'comments_template', 'legacy_comments' ); function legacy_comments( $file ) { //is WordPress 2.7 or below? if ( !function_exists('wp_list_comments') ) $file = TEMPLATEPATH . '/comments_legacy.php'; return $file; } // custom comments $commentCount = 0; function arjuna_get_comment($comment, $args, $depth) { global $commentCount; $arjunaOptions = arjuna_get_options(); $GLOBALS['comment'] = $comment; $commentClass = 'comment'; ?>
  • id="comment-">
    # | comment_date_gmt))); } else { print __('on', 'Arjuna').' '.get_comment_time(get_option('date_format')); } ?>. $depth, 'max_depth' => $args['max_depth']))) ?> comment_approved == '0'): ?>

    , WP, as strange as this is, adds it automatically ?>
  • id="comment-">
    # | comment_date_gmt))); } else { print __('on', 'Arjuna').' '.get_comment_time(get_option('date_format')); } ?>. comment_approved == '0'): ?>

    , WP, as strange as this is, adds it automatically ?> ' . $text . '', $link, $text); } function arjuna_get_time_passed($pastTime) { $currentTime = time(); $seconds = $currentTime - $pastTime; if ($seconds > 28944000) { //older than 335 days $years = round($seconds/31557600); //365.25 days return $years==1 ? __('1 year', 'Arjuna') : sprintf(__('%d years', 'Arjuna'), $years); } if ($seconds > 2592000) { //older than 30 days $months = round($seconds/2629800); //1 month (average) return $months==1 ? __('1 month', 'Arjuna') : sprintf(__('%d months', 'Arjuna'), $months); } if ($seconds > 518400) { //older than 6 days $weeks = round($seconds/604800); //1 week return $weeks==1 ? __('1 week', 'Arjuna') : sprintf(__('%d weeks', 'Arjuna'), $weeks); } if ($seconds > 82800) { //older than 23 hours $days = round($seconds/86400); //1 day return $days==1 ? __('1 day', 'Arjuna') : sprintf(__('%d days', 'Arjuna'), $days); } if ($seconds > 3540) { //older than 59 minutes $hours = round($seconds/3600); //1 hour return $hours==1 ? __('1 hour', 'Arjuna') : sprintf(__('%d hours', 'Arjuna'), $hours); } if ($seconds > 59) { //older than 59 seconds $minutes = round($seconds/60); //1 minute return $minutes==1 ? __('1 minute', 'Arjuna') : sprintf(__('%d minutes', 'Arjuna'), $minutes); } return $seconds==1 ? __('1 second', 'Arjuna') : sprintf(__('%d seconds', 'Arjuna'), $seconds); } function has_pages() { global $wp_query; if ( !is_single() && $wp_query->max_num_pages > 1 ) return true; return false; } function arjuna_get_previous_page_link($label) { global $paged; if ( !is_single() && $paged > 1 ) { echo ''. preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', $label ) .''; } } function arjuna_get_next_page_link($label) { global $paged, $wp_query; $max_page = $wp_query->max_num_pages; if ( !$paged ) $paged = 1; $nextpage = intval($paged) + 1; if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) { echo ''. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $label) .''; } } // Returns true if there is at least one other post than the one being viewed currently function arjuna_has_other_posts() { if (get_adjacent_post(false, '', false)) return true; if (get_adjacent_post(false, '', true)) return true; return false; } function arjuna_get_next_post_link($label) { $post = get_adjacent_post(false, '', false); if (!$post) return; echo ''; } function arjuna_get_previous_post_link($label) { $post = get_adjacent_post(false, '', true); if (!$post) return; echo ''; } function arjuna_get_appendToPageTitle() { $arjunaOptions = get_option('arjuna_options'); if ($arjunaOptions['appendToPageTitle']=='blogName') { echo " - "; bloginfo('name'); } elseif ($arjunaOptions['appendToPageTitle']=='custom' && !empty($arjunaOptions['appendToPageTitleCustom'])) { echo " - " . $arjunaOptions['appendToPageTitleCustom']; } } function arjuna_get_custom_CSS() { $arjunaOptions = arjuna_get_options(); if($arjunaOptions['customCSS'] && $arjunaOptions['customCSS_input']) return ''; return ''; } function arjuna_get_pagination($previousLabel, $nextLabel) { $arjunaOptions = arjuna_get_options(); global $wp_query; $currentPage = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $postsPerPage = intval(get_query_var('posts_per_page')); $totalPages = intval(ceil($wp_query->found_posts/$postsPerPage)); if ($totalPages > 1) { $output = ''; $output .= ''; echo $output; } return; } function arjuna_get_post_pagination($previousLabel, $nextLabel) { $arjunaOptions = arjuna_get_options(); global $post, $page, $numpages, $multipage, $more, $pagenow; $currentPage = $page; $totalPages = $numpages; if ($multipage) { $output = ''; $output .= ''; echo $output; } return; } function arjuna_post_pagination_get_url($page) { if($page == 1) return add_query_arg('page', $page, get_permalink()); elseif('' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending'))) return add_query_arg('page', $page, get_permalink()); elseif('page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID) return trailingslashit(get_permalink()) . user_trailingslashit('page/' . $page, 'single_paged'); return trailingslashit(get_permalink()) . user_trailingslashit($page, 'single_paged'); } function arjuna_get_comment_pagination($fragment = '#_comments') { if ( !is_singular() || !get_option('page_comments') ) return; if(get_comment_pages_count() <= 1) return; echo ''; } function arjuna_get_edit_link($label) { global $post; if ( !$url = get_edit_post_link( $post->ID ) ) return; return ''.$label.''; } function arjuna_parseExcludes($IDs, $type) { if(!function_exists('icl_object_id')) return $IDs; $array = explode(',', $IDs); $newArray = array(); foreach($array as $ID) $newArray[] = icl_object_id($ID,$type); return implode(',', $newArray); } function arjuna_get_all_pages($exclude, $include, $depth) { $pages = array(); $parameters = 'depth='.$depth; if($exclude) $parameters .= '&exclude='.$exclude; if($include) $parameters .= '&include='.$include; $wp_pages = get_pages($parameters); foreach($wp_pages as $wp_page) { if($wp_page->post_parent) { //find parent if(!arjuna_get_all_pages_iterator($pages, $wp_page)) $pages[$wp_page->ID] = (object) array( 'ID' => $wp_page->ID, 'title' => $wp_page->post_title, 'children' => array() ); } else { $pages[$wp_page->ID] = (object) array( 'ID' => $wp_page->ID, 'title' => $wp_page->post_title, 'children' => array() ); } } return $pages; } function arjuna_get_all_pages_iterator(&$pages, $wp_page) { foreach($pages as $ID => $page) { if($ID == $wp_page->post_parent) { $pages[$ID]->children[$wp_page->ID] = (object) array( 'ID' => $wp_page->ID, 'title' => $wp_page->post_title, 'children' => array() ); return true; } elseif(!empty($page->children)) { if(arjuna_get_all_pages_iterator($page->children, $wp_page)) return true; } } return false; } function arjuna_admin_walk_pages($pages, $level=0) { if(empty($pages)) return true; foreach($pages as $page) { print ''; if(!empty($page->children)) arjuna_admin_walk_pages($page->children, $level+1); } } function arjuna_get_all_categories($exclude, $include, $depth) { global $_tmp_buffer; $_tmp_buffer = array(); $categories = array(); $parameters = 'depth='.$depth . '&hide_empty=0'; if($exclude) $parameters .= '&exclude='.$exclude; if($include) $parameters .= '&include='.$include; $wp_categories = get_categories($parameters); foreach($wp_categories as $wp_category) { if($wp_category->parent) { //put into buffer if(!isset($_tmp_buffer[$wp_category->parent])) $_tmp_buffer[$wp_category->parent] = array(); $_tmp_buffer[$wp_category->parent][] = (object) array( 'ID' => $wp_category->cat_ID, 'title' => $wp_category->cat_name, 'children' => array() ); } else { $categories[$wp_category->cat_ID] = (object) array( 'ID' => $wp_category->cat_ID, 'title' => $wp_category->cat_name, 'children' => array() ); } } //now use the buffer foreach($categories as $ID => $category) $categories[$ID] = arjuna_get_all_categories_iterator($category); return $categories; } function arjuna_get_all_categories_iterator($category) { global $_tmp_buffer; if(!isset($_tmp_buffer[$category->ID])) return $category; $categories = $_tmp_buffer[$category->ID]; foreach($categories as $key => $cat) $categories[$key] = arjuna_get_all_categories_iterator($cat); $category->children = $categories; return $category; } function arjuna_admin_walk_categories($categories, $level=0) { if(empty($categories)) return true; foreach($categories as $category) { print ''; if(!empty($category->children)) arjuna_admin_walk_categories($category->children, $level+1); } } function arjuna_get_upload_directory() { $uploadpath = wp_upload_dir(); $path = $uploadpath['basedir'] . '/arjuna'; if(!is_dir($path)) @mkdir($path, 0777, true); return $path; } function arjuna_get_upload_url() { $uploadpath = wp_upload_dir(); if ($uploadpath['baseurl']=='') $uploadpath['baseurl'] = get_bloginfo('siteurl').'/wp-content/uploads'; return $uploadpath['baseurl'] . '/arjuna'; } add_filter('get_comments_number', 'arjuna_comment_count', 0); function arjuna_comment_count( $count ) { if (!is_admin()) { global $id; $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id)); return count($comments_by_type['comment']); } return $count; }