'lightBlue', '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, both 'sidebar' => array( 'display' => 'right', // right, left, none, both 'widthLeft' => 0, 'widthRight' => 160, 'showDefault' => true, ), # 'sidebar_showDefault' => true, '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 //Added 1.6.x # 'contentAreaWidth' => 570, //width of the content area, sidebar will be calculated 'sidebar_showLinkedInButton' => false, 'sidebarButtons' => array( 'RSS' => array( 'enabled' => true, 'extended' => true, 'label' => '', ), 'twitter' => array( 'enabled' => false, 'URL' => '', 'label' => '', ), 'facebook' => array( 'enabled' => false, 'URL' => '', 'label' => '', ), 'linkedIn' => array( 'enabled' => false, 'URL' => '', 'label' => '', ), 'inSidebar' => 'right', //left, right; in which sidebar the buttons will be included ), 'menus' => array( '1' => array( 'enabled' => true, 'useNavMenus' => true, // false to use legacy menus 'depth' => 3, // 1, 2, 3 (the depth of the menu, 1 being no dropdown) 'align' => 'right', // right, left //options for legacy menus 'display' => 'pages', // pages, categories 'sortBy' => 'post_title', // [CATEGORIES]: name, ID, count, slug [PAGES]: post_title, ID, post_name (slug), menu_order (the page's Order value) 'sortOrder' => 'asc', // asc, desc 'exclude_categories' => '', 'exclude_pages' => '', ), '2' => array( 'enabled' => true, 'useNavMenus' => true, // false to use legacy menus 'depth' => 3, // 1, 2, 3 (the depth of the menu, 1 being no dropdown) 'displayHome' => true, 'displaySeparators' => true, //options for legacy menus 'display' => 'categories', // pages, categories 'sortBy' => 'name', // [CATEGORIES]: name, ID, count, slug [PAGES]: post_title, ID, post_name (slug), menu_order (the page's Order value) 'sortOrder' => 'asc', // asc, desc 'exclude_categories' => '', 'exclude_pages' => '', ), ), 'search' => array( 'enabled' => true, 'position' => 'bottom' //top, bottom ), //'enableSearch' => true, 'useFeedburner' => false, 'feedburnerURL' => '', 'feedburnerCommentsURL' => '', 'copyrightOwner' => '', 'twitterWidget' => array( 'enabled' => true, 'title' => 'Recent Tweets', 'username' => 'twitter', 'height' => 250, 'numTweets' => 4, //1 - 30 'scrollbar' => false, 'showTimestamps' => true, ), 'currentVersion' => '1.6.11', ); return $options; } function arjuna_get_color_schemes() { $colorSchemes = array( 'lightBlue' => __('Light Blue', 'Arjuna'), 'bristolBlue' => __('Bristol Blue', 'Arjuna'), 'darkBlue' => __('Dark Blue', 'Arjuna'), 'regimentalBlue' => __('Regimental Blue', 'Arjuna'), 'khaki' => __('Khaki', 'Arjuna'), 'seaGreen' => __('Sea Green', 'Arjuna'), 'lightRed' => __('Light Red', 'Arjuna'), 'purple' => __('Purple', 'Arjuna'), 'lightGray' => __('Light Gray', 'Arjuna'), 'darkGray' => __('Dark Gray', 'Arjuna'), ); return $colorSchemes; } function arjuna_parse_version($version) { if(substr_count($version, '.') == 1) return (int) (str_replace('.', '', $version) . '0'); else return (int) str_replace('.', '', $version); } /** * Arjuna Load Default Options * * Loads the default options into the DB. * This should ONLY be done when Arjuna is first installed or if a reset has been initiated. */ function arjuna_load_default_options() { //load defaults $options = arjuna_get_default_options(); update_option('arjuna_options', $options); return $options; } /** * Arjuna Upgrade Options * * Compares version numbers and upgrades the DB options accordingly. */ function arjuna_upgrade_options() { //load current defaults $newVersionDefaultOptions = $newVersionOptions = arjuna_get_default_options(); //load options from database $oldVersionOptions = get_option('arjuna_options'); //create options for new version //start by overwriting any existing option values to the new version foreach ( $newVersionOptions as $key => $value ) if ( isset($oldVersionOptions[$key]) && $key != 'currentVersion' ) $newVersionOptions[$key] = $oldVersionOptions[$key]; //find upgrade profiles if(!isset($oldVersionOptions['currentVersion'])) { //old version below 1.6 } else { if(arjuna_parse_version($oldVersionOptions['currentVersion']) >= 139) { $newVersionOptions['search']['enabled'] = $oldVersionOptions['enableSearch']; } } update_option('arjuna_options', $newVersionOptions); return $newVersionOptions; } function arjuna_get_options() { //get options from DB $DBOptions = get_option('arjuna_options'); //get default options $defaultOptions = arjuna_get_default_options(); //is this the first use of Arjuna? if(!$DBOptions) return arjuna_load_default_options(); //determine if there is an upgrade required if(!isset($DBOptions['currentVersion']) || arjuna_parse_version($DBOptions['currentVersion']) < arjuna_parse_version($defaultOptions['currentVersion'])) return arjuna_upgrade_options(); //no upgrade or new installation, continue with DB options return $DBOptions; } add_action('admin_menu', 'arjuna_add_theme_options'); $formErrors = array(); $optionsSaved = false; function arjuna_add_theme_options() { global $optionsSaved, $formErrors; if(isset($_POST['arjuna_save_options'])) { $arjunaColorSchemes = arjuna_get_color_schemes(); /*if(!wp_verify_nonce($_POST['srs_arjuna_nonce'], 'srs_arjuna')) { print "Sorry, your nonce did not verify."; exit; }*/ //nonce checking check_admin_referer('srs_arjuna', 'srs_arjuna_nonce'); $options = arjuna_get_options(); //Menu 1 dropdown $validOptions = array('1', '2', '3'); if(isset($_POST['menus_1_depth'])) { if ( in_array($_POST['menus_1_depth'], $validOptions) ) $options['menus']['1']['depth'] = $_POST['menus_1_depth']; else $options['menus']['1']['depth'] = '3'; } //Menu 1 display $validOptions = array('pages', 'categories'); if(isset($_POST['menus_1_display'])) { if ( in_array($_POST['menus_1_display'], $validOptions) ) $options['menus']['1']['display'] = $_POST['menus_1_display']; else $options['menus']['1']['display'] = 'pages'; } if(isset($_POST['menus_1_display'])) { if ($options['menus']['1']['display']=='pages') { //Menu 1 sorting for PAGES $validOptions = array('post_title', 'ID', 'post_name', 'menu_order'); if ( in_array($_POST['menus_1_sortBy_pages'], $validOptions) ) $options['menus']['1']['sortBy'] = $_POST['menus_1_sortBy_pages']; else $options['menus']['1']['sortBy'] = $validOptions[0]; //Menu 1 sorting order $validOptions = array('asc', 'desc'); if ( in_array($_POST['menus_1_sortOrder_pages'], $validOptions) ) $options['menus']['1']['sortOrder'] = $_POST['menus_1_sortOrder_pages']; else $options['menus']['1']['sortOrder'] = $validOptions[0]; } elseif ($options['menus']['1']['display']=='categories') { //Menu 1 sorting for CATEGORIES $validOptions = array('name', 'ID', 'count', 'slug'); if ( in_array($_POST['menus_1_sortBy_categories'], $validOptions) ) $options['menus']['1']['sortBy'] = $_POST['menus_1_sortBy_categories']; else $options['menus']['1']['sortBy'] = $validOptions[0]; //Menu 1 sorting order $validOptions = array('asc', 'desc'); if ( in_array($_POST['menus_1_sortOrder_categories'], $validOptions) ) $options['menus']['1']['sortOrder'] = $_POST['menus_1_sortOrder_categories']; else $options['menus']['1']['sortOrder'] = $validOptions[0]; } } //Menu 1 show if (isset($_POST['menus_1_enabled'])) $options['menus']['1']['enabled'] = (bool) $_POST['menus_1_enabled']; else $options['menus']['1']['enabled'] = false; //Menu 1 use navigation menu if (isset($_POST['menus_1_useNavMenus'])) $options['menus']['1']['useNavMenus'] = (bool)$_POST['menus_1_useNavMenus']; else $options['menus']['1']['useNavMenus'] = false; //Menu 1 alignment $validOptions = array('right', 'left'); if(isset($_POST['menus_1_align'])) { if ( in_array($_POST['menus_1_align'], $validOptions) ) $options['menus']['1']['align'] = $_POST['menus_1_align']; else $options['menus']['1']['align'] = $validOptions[0]; } // Menu 1 - Exclude items if(isset($_POST['menus_1_exclude_categories'])) { if($_POST['menus_1_exclude_categories']) { $options['menus']['1']['exclude_categories'] = implode(',', $_POST['menus_1_exclude_categories']); } else $options['menus']['1']['exclude_categories'] = ''; } if(isset($_POST['menus_1_exclude_pages'])) { if($_POST['menus_1_exclude_pages']) { $options['menus']['1']['exclude_pages'] = implode(',', $_POST['menus_1_exclude_pages']); } else $options['menus']['1']['exclude_pages'] = ''; } //Menu 2 show if (isset($_POST['menus_2_enabled'])) $options['menus']['2']['enabled'] = (bool) $_POST['menus_2_enabled']; else $options['menus']['2']['enabled'] = false; //Menu 2 use navigation menu if (isset($_POST['menus_2_useNavMenus'])) $options['menus']['2']['useNavMenus'] = (bool)$_POST['menus_2_useNavMenus']; else $options['menus']['2']['useNavMenus'] = false; //Menu 2 dropdown $validOptions = array('1', '2', '3'); if(isset($_POST['menus_2_depth'])) { if ( in_array($_POST['menus_2_depth'], $validOptions) ) $options['menus']['2']['depth'] = $_POST['menus_2_depth']; else $options['menus']['2']['depth'] = '3'; } //Menu 2 display $validOptions = array('pages', 'categories'); if(isset($_POST['menus_2_display'])) { if ( in_array($_POST['menus_2_display'], $validOptions) ) $options['menus']['2']['display'] = $_POST['menus_2_display']; else $options['menus']['2']['display'] = 'pages'; } if(isset($_POST['menus_2_display'])) { if ($options['menus']['2']['display']=='pages') { //Menu 2 sorting for PAGES $validOptions = array('post_title', 'ID', 'post_name', 'menu_order'); if ( in_array($_POST['menus_2_sortBy_pages'], $validOptions) ) $options['menus']['2']['sortBy'] = $_POST['menus_2_sortBy_pages']; else $options['menus']['2']['sortBy'] = $validOptions[0]; //Menu 2 sorting order $validOptions = array('asc', 'desc'); if ( in_array($_POST['menus_2_sortOrder_pages'], $validOptions) ) $options['menus']['2']['sortOrder'] = $_POST['menus_2_sortOrder_pages']; else $options['menus']['2']['sortOrder'] = $validOptions[0]; } elseif ($options['menus']['2']['display']=='categories') { //Menu 2 sorting for CATEGORIES $validOptions = array('name', 'ID', 'count', 'slug'); if ( in_array($_POST['menus_2_sortBy_categories'], $validOptions) ) $options['menus']['2']['sortBy'] = $_POST['menus_2_sortBy_categories']; else $options['menus']['2']['sortBy'] = $validOptions[0]; //Menu 2 sorting order $validOptions = array('asc', 'desc'); if ( in_array($_POST['menus_2_sortOrder_categories'], $validOptions) ) $options['menus']['2']['sortOrder'] = $_POST['menus_2_sortOrder_categories']; else $options['menus']['2']['sortOrder'] = $validOptions[0]; } } //Menu 2 Home Icon if (isset($_POST['menus_2_displayHome'])) $options['menus']['2']['displayHome'] = true; else $options['menus']['2']['displayHome'] = false; //Menu 2 Home Icon if (isset($_POST['menus_2_displaySeparators'])) $options['menus']['2']['displaySeparators'] = true; else $options['menus']['2']['displaySeparators'] = false; // Menu 2 - Exclude items if(isset($_POST['menus_2_exclude_categories'])) { if($_POST['menus_2_exclude_categories']) { $options['menus']['2']['exclude_categories'] = implode(',', $_POST['menus_2_exclude_categories']); } else $options['menus']['2']['exclude_categories'] = ''; } if(isset($_POST['menus_2_exclude_pages'])) { if($_POST['menus_2_exclude_pages']) { $options['menus']['2']['exclude_pages'] = implode(',', $_POST['menus_2_exclude_pages']); } else $options['menus']['2']['exclude_pages'] = ''; } //Header Image if(isset($_POST['headerImage'])) { if ( isset($arjunaColorSchemes[$_POST['headerImage']]) ) $options['headerImage'] = $_POST['headerImage']; else $options['headerImage'] = 'lightBlue'; } //Search if (isset($_POST['search_enabled'])) $options['search']['enabled'] = (bool)$_POST['search_enabled']; else $options['search']['enabled'] = false; $validOptions = array('top', 'bottom'); if(isset($_POST['search_position'])) { if ( in_array($_POST['search_position'], $validOptions) ) $options['search']['position'] = $_POST['search_position']; else $options['search']['position'] = 'bottom'; } //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', 'both'); if(isset($_POST['sidebar_display'])) { if ( in_array($_POST['sidebar_display'], $validOptions) ) $options['sidebar']['display'] = $_POST['sidebar_display']; else $options['sidebar']['display'] = $validOptions[0]; if($options['sidebar']['display'] != 'none') { if(isset($_POST['sidebar_widthLeft'])) $options['sidebar']['widthLeft'] = $_POST['sidebar_widthLeft']; if(isset($_POST['sidebar_widthRight'])) $options['sidebar']['widthRight'] = $_POST['sidebar_widthRight']; } } // 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 buttons $validOptions = array('left', 'right'); if(isset($_POST['sidebarButtons_inSidebar'])) { if ( in_array($_POST['sidebarButtons_inSidebar'], $validOptions) ) $options['sidebarButtons']['inSidebar'] = $_POST['sidebarButtons_inSidebar']; else $options['sidebarButtons']['inSidebar'] = 'right'; } if(isset($_POST['sidebarButtons_RSS_enabled'])) { $options['sidebarButtons']['RSS']['enabled'] = (bool) $_POST['sidebarButtons_RSS_enabled']; $options['sidebarButtons']['RSS']['label'] = $_POST['sidebarButtons_RSS_label']; if(isset($_POST['sidebarButtons_RSS_extended'])) $options['sidebarButtons']['RSS']['extended'] = (bool) $_POST['sidebarButtons_RSS_extended']; else $options['sidebarButtons']['RSS']['extended'] = false; } else { $options['sidebarButtons']['RSS']['enabled'] = false; } if(isset($_POST['sidebarButtons_twitter_enabled'])) { $options['sidebarButtons']['twitter']['enabled'] = (bool) $_POST['sidebarButtons_twitter_enabled']; $options['sidebarButtons']['twitter']['label'] = $_POST['sidebarButtons_twitter_label']; $URL = $_POST['sidebarButtons_twitter_URL']; if ( !preg_match('/twitter\.com/i', $URL) ) { $URL = "http://twitter.com/" . $URL; } elseif ( !preg_match('/http[s]?\:\/\//i', $URL) ) { $URL = "http://" . $URL; } if ( empty($URL) ) { $options['sidebarButtons']['twitter']['enabled'] = false; $options['sidebarButtons']['twitter']['label'] = ''; $options['sidebarButtons']['twitter']['URL'] = ''; } else $options['sidebarButtons']['twitter']['URL'] = $URL; } else { $options['sidebarButtons']['twitter']['enabled'] = false; } if(isset($_POST['sidebarButtons_facebook_enabled'])) { $options['sidebarButtons']['facebook']['enabled'] = (bool) $_POST['sidebarButtons_facebook_enabled']; $options['sidebarButtons']['facebook']['label'] = $_POST['sidebarButtons_facebook_label']; $URL = $_POST['sidebarButtons_facebook_URL']; if ( !preg_match('/facebook\./i', $URL) ) { $URL = "http://facebook.com/" . $URL; } elseif ( !preg_match('/http[s]?\:\/\//i', $URL) ) { $URL = "http://" . $URL; } if ( empty($URL) ) { $options['sidebarButtons']['facebook']['enabled'] = false; $options['sidebarButtons']['facebook']['label'] = ''; $options['sidebarButtons']['facebook']['URL'] = ''; } else $options['sidebarButtons']['facebook']['URL'] = $URL; } else { $options['sidebarButtons']['facebook']['enabled'] = false; } if(isset($_POST['sidebarButtons_linkedIn_enabled'])) { $options['sidebarButtons']['linkedIn']['enabled'] = (bool) $_POST['sidebarButtons_linkedIn_enabled']; $options['sidebarButtons']['linkedIn']['label'] = $_POST['sidebarButtons_linkedIn_label']; $URL = $_POST['sidebarButtons_linkedIn_URL']; if ( !preg_match('/linkedin\./i', $URL) ) { $URL = "http://linkedin.com/" . $URL; } elseif ( !preg_match('/http[s]?\:\/\//i', $URL) ) { $URL = "http://" . $URL; } if ( empty($URL) ) { $options['sidebarButtons']['linkedIn']['enabled'] = false; $options['sidebarButtons']['linkedIn']['label'] = ''; $options['sidebarButtons']['linkedIn']['URL'] = ''; } else $options['sidebarButtons']['linkedIn']['URL'] = $URL; } else { $options['sidebarButtons']['linkedIn']['enabled'] = false; } // 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; //Feedburner if (isset($_POST['useFeedburner'])) $options['useFeedburner'] = (bool)$_POST['useFeedburner']; else $options['useFeedburner'] = false; $URL = $_POST['feedburnerURL']; if ( !preg_match('/feedburner\.com/i', $URL) ) $URL = "http://feeds.feedburner.com/" . $URL; elseif ( !preg_match('/http[s]?\:\/\//i', $URL) ) $URL = "http://" . $URL; if ( empty($URL) ) { $options['useFeedburner'] = false; $options['feedburnerURL'] = ''; } else $options['feedburnerURL'] = $URL; $URL = $_POST['feedburnerCommentsURL']; if(!empty($URL)) { if ( !preg_match('/feedburner\.com/i', $URL) ) $URL = "http://feeds.feedburner.com/" . $URL; elseif ( !preg_match('/http[s]?\:\/\//i', $URL) ) $URL = "http://" . $URL; } //Twitter Widget if (isset($_POST['twitterWidget_enabled'])) $options['twitterWidget']['enabled'] = (bool)$_POST['twitterWidget_enabled']; else $options['twitterWidget']['enabled'] = false; if (isset($_POST['twitterWidget_title'])) $options['twitterWidget']['title'] = $_POST['twitterWidget_title']; else $options['twitterWidget']['title'] = ''; if (isset($_POST['twitterWidget_username'])) $options['twitterWidget']['username'] = $_POST['twitterWidget_username']; else $options['twitterWidget']['username'] = ''; if (isset($_POST['twitterWidget_height'])) $options['twitterWidget']['height'] = (int)$_POST['twitterWidget_height']; else $options['twitterWidget']['height'] = 250; if (isset($_POST['twitterWidget_numTweets'])) $options['twitterWidget']['numTweets'] = (int)$_POST['twitterWidget_numTweets']; else $options['twitterWidget']['numTweets'] = 4; if (isset($_POST['twitterWidget_scrollbar'])) $options['twitterWidget']['scrollbar'] = (bool)$_POST['twitterWidget_scrollbar']; else $options['twitterWidget']['scrollbar'] = false; if (isset($_POST['twitterWidget_showTimestamps'])) $options['twitterWidget']['showTimestamps'] = (bool)$_POST['twitterWidget_showTimestamps']; else $options['twitterWidget']['showTimestamps'] = false; //Copyright Owner if($_POST['coprightOwnerType'] == 'default') $options['copyrightOwner'] = ''; else $options['copyrightOwner'] = $_POST['copyrightOwner']; $options['feedburnerCommentsURL'] = $URL; update_option('arjuna_options', $options); $optionsSaved = true; } if(isset($_POST['removeLogo'])) { $options = arjuna_get_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_theme_options', 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, $arjunaColorSchemes; $options = arjuna_get_options(); if ( $optionsSaved ) echo '

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

'; ?>

SRS Solutions'); ?>
*/ ?>
'; foreach($formErrors as $error) print '

'.$error.'

'; print '
'; ?>


>



>



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

$name) { print '
'; print ''; print '
'; print ''; print '
'; } ?>
/>
/>

', ''); ?>

/>
/>
/>
/>

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

>








/>
/>
/>















>

>







__('Right Sidebar - Top', 'Arjuna'), 'id'=>'right_sidebar_full_top', 'description'=>__('This is the top widget bar in the right sidebar, extending to full width of the sidebar.', 'Arjuna'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

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

', 'after_title' => '

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

', 'after_title' => '

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

', 'after_title' => '

' )); register_sidebar(array( 'name'=> __('Left Sidebar - Top', 'Arjuna'), 'id'=>'left_sidebar_full_top', 'description'=>__('This is the top widget bar in the left sidebar, extending to full width of the sidebar.', 'Arjuna'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

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

', 'after_title' => '

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

', 'after_title' => '

' )); register_sidebar(array( 'name'=>__('Left Sidebar - Bottom', 'Arjuna'), 'id'=>'left_sidebar_full_bottom', 'description'=>__('This is the bottom widget bar in the left sidebar, extending to full width of the sidebar. It will appear below the left and right widget bars.', 'Arjuna'), '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; add_action('init', 'arjuna_textdomain'); function arjuna_textdomain(){ load_theme_textdomain('Arjuna', get_template_directory() . '/languages'); wp_enqueue_script('jquery'); } //CSS add_action('admin_print_styles', 'arjuna_admin_initCSS'); function arjuna_admin_initCSS() { wp_enqueue_style('arjunaAdminCSS', get_template_directory_uri().'/admin/admin.css'); wp_enqueue_style('fionnFarbtasticCSS', get_template_directory_uri().'/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_template_directory_uri() .'/lib/farbtastic/farbtastic.js'); wp_enqueue_script('arjunaAdminJS', get_template_directory_uri() .'/admin/admin.js'); } // 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); } /** * Arjuna Get Time Passed * * We are not using human_time_diff() since it only returns minutes, hours and days. * It lacks support for weeks, months and years, which is helpful for comments in aged posts. */ 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; } add_filter('next_posts_link_attributes', 'arjuna_get_next_page_link_attributes'); function arjuna_get_next_page_link_attributes() { return 'class="older"'; } add_filter('previous_posts_link_attributes', 'arjuna_get_previous_page_link_attributes'); function arjuna_get_previous_page_link_attributes() { return 'class="newer"'; } function arjuna_get_previous_page_link($label) { previous_posts_link('' . $label . ''); } function arjuna_get_next_page_link($label) { next_posts_link('' . $label . ''); return; } // 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) { global $post; 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 = get_comments('status=approve&post_id=' . $id); $comments_by_type = separate_comments($comments); return count($comments_by_type['comment']); } return $count; } function arjuna_is_show_comments() { global $comments_by_type, $post, $id; $arjunaOptions = arjuna_get_options(); $comments = get_comments('status=approve&post_id=' . $id); $comments_by_type = separate_comments($comments); if($post->comment_status == 'open') return true; if(count($comments_by_type['comment'])) return true; if($post->post_type == 'page' && !$arjunaOptions['comments_hideWhenDisabledOnPages']) return true; if($post->post_type == 'post' && !$arjunaOptions['comments_hideWhenDisabledOnPosts']) return true; return false; } function arjuna_is_show_trackbacks() { global $comments_by_type, $post, $id; $arjunaOptions = arjuna_get_options(); $comments = get_comments('status=approve&post_id=' . $id); $comments_by_type = separate_comments($comments); if($post->ping_status == 'open') return true; if(count($comments_by_type['pings'])) return true; if($post->post_type == 'page' && !$arjunaOptions['trackbacks_hideWhenDisabledOnPages']) return true; if($post->post_type == 'post' && !$arjunaOptions['trackbacks_hideWhenDisabledOnPosts']) return true; return false; } function arjuna_get_comments_count() { global $id; $comments = get_comments('status=approve&post_id=' . $id); $comments_by_type = separate_comments($comments); return count($comments_by_type['comment']); } function arjuna_get_trackbacks_count() { global $id; $comments = get_comments('status=approve&post_id=' . $id); $comments_by_type = separate_comments($comments); return count($comments_by_type['pings']); } function arjuna_nav_menus() { register_nav_menus(array( 'header_menu_1' => __('First Header Menu', 'Arjuna'), 'header_menu_2' => __('Second Header Menu', 'Arjuna'), )); } add_action('init', 'arjuna_nav_menus'); function arjuna_redirect_feeds() { global $feed, $withcomments; $arjunaOptions = arjuna_get_options(); if (!is_feed()) return; if(!$arjunaOptions['useFeedburner']) return; if (preg_match('/feedburner/i', $_SERVER['HTTP_USER_AGENT'])) return; if(!$arjunaOptions['useFeedburner']) return; $URL = $arjunaOptions['feedburnerURL']; $commentsURL = $arjunaOptions['feedburnerCommentsURL']; // Get category $category = get_query_var('category_name'); if ($category) { $URL .= '_'.$category; } // Get tag $tag = get_query_var('tag'); if ($tag) { $URL .= '_'.$tag; } // Get search terms $search = get_query_var('s'); if ($feed == 'comments-rss2' || is_single() || $withcomments) { if ($commentsURL) { header("Location: ".$commentsURL); exit; } } else { switch($feed) { case 'feed': case 'rdf': case 'rss': case 'rss2': case 'atom': if ($URL) { // Redirect the feed header("Location: ".$URL); exit; } } } } add_action('template_redirect', 'arjuna_redirect_feeds'); function arjuna_create_twitter_widget($args) { $arjunaOptions = arjuna_get_options(); extract($args); echo $before_widget; echo $before_title . $arjunaOptions['twitterWidget']['title'] . $after_title; //calc width print '
    '; print ''; print ''; echo $after_widget; } function arjuna_create_twitter_widget_control() { print '

    '.__('Please go to Appearance > Arjuna Options to configure your Arjuna twitter widget.', 'Arjuna').'

    '; } add_action('init', 'arjuna_register_twitter_widget'); function arjuna_register_twitter_widget() { wp_register_sidebar_widget( 'arjuna_twitter_widget', __('Arjuna Twitter Profile Widget', 'Arjuna'), 'arjuna_create_twitter_widget', array( 'classname' => 'arjuna_twitter_widget', 'description' => __("Display Twitter Goodies Profile Widget", "Arjuna"), ) ); wp_register_widget_control( 'arjuna_twitter_widget', __('Arjuna Twitter Profile Widget', 'Arjuna'), 'arjuna_create_twitter_widget_control', array('id_base' => 'arjuna_twitter_widget') ); } //fallback for nav menus function arjuna_print_page_menu() { $arjunaOptions = arjuna_get_options(); $html = ''; $html .= ''; print $html; } add_theme_support('automatic-feed-links');