'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 'sidebarWidth' => 'normal', // small, normal, large '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' => '', ), ), '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'); if(isset($_POST['sidebarDisplay'])) { if ( in_array($_POST['sidebarDisplay'], $validOptions) ) $options['sidebarDisplay'] = $_POST['sidebarDisplay']; else $options['sidebarDisplay'] = $validOptions[0]; if($options['sidebarDisplay'] != 'none' && isset($_POST['contentAreaWidth'])) { $options['contentAreaWidth'] = $_POST['contentAreaWidth']; } } // 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 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]; } //Sidebar buttons 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').'
'.__('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 .= '