';}
pixopoint_menu(); // Adds main menu
if (get_option('suckerfish_secondmenu') == 'on') {pixopoint_menu(2);} // Adds second menu
if (function_exists('pixopoint_studiopress')) {echo '';}
}
// *** Themes with hooks ***
// Hybrid by Justin Tadlock ... http://themehybrid.com/themes/hybrid
add_action('init','remove_header_hybrid'); // Plugin is loaded before the theme, so its remove_action() won't work unless fired later ... hat tip to Justin Tadlock (http://justintadlock.com/)
function remove_header_hybrid() {remove_action( 'hybrid_after_header', 'hybrid_page_nav' );}
add_action( 'hybrid_after_header', 'pixopoint_themesupport' ); // Add new function(s)
// Thematic by Ian Stewart ... http://themeshaper.com/
add_action('init','remove_header_thematic'); // Plugin is loaded before the theme, so its remove_action() won't work unless fired later ... hat tip to Justin Tadlock (http://justintadlock.com/)
function remove_header_thematic() {remove_action( 'thematic_header', 'thematic_access' );}
add_action( 'thematic_header', 'pixopoint_themesupport' ); // Add new function(s)
// Selected StudioPress themes by Brian Gardner ... http://studiopress.com/
// Hacks for CSS issues
// function pixopoint_studiopress() {if (function_exists('studiopress_navigation')) {echo '';}}
// add_action('wp_head', 'pixopoint_studiopress');
// Removes current menu and adds new one
add_action('init','remove_studiopress_navigation'); // Plugin is loaded before the theme, so its remove_action() won't work unless fired later ... hat tip to Justin Tadlock (http://justintadlock.com/)
function remove_studiopress_navigation() {remove_action( 'studiopress_after_header', 'studiopress_navigation' );}
add_action( 'studiopress_after_header', 'pixopoint_themesupport' ); // Add new function(s)
// Thesis
remove_action('thesis_hook_before_header', 'thesis_nav_menu'); // Remove current navigation ... doesn't work :(
add_action('thesis_hook_after_header', 'pixopoint_themesupport');
// add_action('’thesis_hook_before_header', 'pixopoint_themesupport'); // Could be used to add support for Thesis BEFORE header
/* THIS DOESN'T WORK AS IT ADDS THE CODE BEFORE THE HEADER INSTEAD OF AFTER IT - NEED TO FIND A FIX FOR IT!
add_action( 'get_header', 'pixopoint_themesupport', 5 ); // Add new function(s)
*/
// *** Hacks for themes with coding errors ***
// Default (Kubrick) by Michael Heilemann ... http://binarybonsai.com/
function pixopoint_kubrick() {if (function_exists('kubrick_head')) {echo '';}}
add_action('wp_head', 'pixopoint_kubrick');
}
/************************************************************
************************************************************
************* Add content to HEAD section ******************
************************************************************
************************************************************/
add_action('wp_print_scripts', 'suckerfish_mainhead');
function suckerfish_mainhead() {global $pixopoint_menu_version;
// Only load this if not on an admin page
if (!is_admin()) {echo '
';
// Maintenance mode
if ($_SESSION['mln'] == 'on') {echo '
';}
// If we're not using the theme generated CSS, we've disabled CSS or the test CSS is enabled the style.php file is loaded
elseif (get_option('suckerfish_generator') != 'Theme CSS' AND get_option('suckerfish_displaycss') != 'Disable' AND $_SESSION['mln_testcss'] != 'on') {
if (get_option('suckerfish_editingpane') != 'on' OR !current_user_can('manage_options')) { // Don't load if editing pane is on
echo ''; // There is a way to enqueue CSS now which should be used here - will be added in future release
}
}
// If test CSS is activated then loads that (useful for debugging purposes)
elseif ($_SESSION['mln_testcss'] == 'on') {echo '';}
// ******** SCRIPTS TO BE ADDED TO HEAD *******
// Adds script for keyboard accessibility
if (get_option('suckerfish_keyboard') == 'on') {
wp_enqueue_script('sfkeyboard', 'pixopoint-menu/scripts/suckerfish_keyboard.js', array('dependency'), '1', true ); // TRUE makes it load in footer
wp_enqueue_script( 'superfish_init', 'pixopoint-menu/scripts/superfish_settings.js.php', array('dependency'), '1', true ); // TRUE makes it load in footer
}
// Checks if Superfish mode is needed, if not then goes back to suckerfish approach
if (get_option('suckerfish_delay') != '0' || get_option('suckerfish_superfish_arrows') == 'on' || get_option('suckerfish_superfish_speed') != 'instant') {
wp_enqueue_script( 'superfish_init', 'pixopoint-menu/scripts/superfish_settings.js.php', array('dependency'), '1', true ); // TRUE makes it load in footer
}
// Any ideas how to enqueue a script in IE conditional comments?
else {echo '
';
}
}
}
/************************************************************
************************************************************
****** Functions for displaying various menu contents ******
************************************************************
*************************************************************/
// Displays the 'Pages' option
function pages($meta_key='') { // $meta_key has something to do with Gregs custom fields mod
($meta_key==''?$suckerfish_pages_title=get_option('suckerfish_pagestitle'):$suckerfish_pages_title=$meta_key);
$suckerfish_depthpages = get_option('suckerfish_depthpages');
switch ($suckerfish_depthpages){ // Sets nesting of pages
case "Top level only":$suckerfish_depthpagesecho = '&depth=1';break;
case "No nesting":$suckerfish_depthpagesecho = '&depth=-1';break;
case "1 level of children":$suckerfish_depthpagesecho = '&depth=2';break;
case "2 levels of children":$suckerfish_depthpagesecho = '&depth=3';break;
case "Infinite":$suckerfish_depthpagesecho = '&depth=0';break;
case "":$suckerfish_depthpagesecho = '&depth=0';break;
}
if (is_page()&&get_post_custom_values($meta_key)!='') {
$class=' class="current_page_parent current_page_item"';
}
// For putting the pages into a sinle dropdown
if (get_option('suckerfish_pages_singledropdown') == 'on') {
echo '
';
}
// Displays the actual pages
echo ereg_replace("\">]+([\t\n]+)
';
}
}
// Displays the 'Categories' option
function category() {
if (get_option('suckerfish_categorycount') == 'on') {$suckerfish_categorycount = 'show_count=1';} // Adds category count
if (get_option('suckerfish_categoryshowempty') == 'on') {$suckerfish_categoryshowempty = '&hide_empty=0';} // Hides empty categories
// Sets category nesting
$suckerfish_depthcategories = get_option('suckerfish_depthcategories');
switch ($suckerfish_depthcategories){
case "Top level only":$suckerfish_depthcategoriesecho = '&depth=1';break;
case "No nesting":$suckerfish_depthcategoriesecho = '&depth=-1';break;
case "1 level of children":$suckerfish_depthcategoriesecho = '&depth=2';
break;case "2 levels of children":$suckerfish_depthcategoriesecho = '&depth=3';break;
case "Infinite":$suckerfish_depthcategoriesecho = '&depth=0';break;
case "":$suckerfish_depthcategoriesecho = '&depth=0';break;
}
// Sets category order
$suckerfish_categoryorder=get_option('suckerfish_categoryorder');
switch ($suckerfish_categoryorder){
case "My Category Order plugin":$suckerfish_categoryorderecho = '&orderby=order';break;
case "Ascending ID #":$suckerfish_categoryorderecho = '&orderby=id&order=ASC';break;
case "Decending ID #":$suckerfish_categoryorderecho = '&orderby=id&order=DESC';break;
case "Ascending Name":$suckerfish_categoryorderecho = '&orderby=name&order=ASC';break;
case "Decending Name":$suckerfish_categoryorderecho = '&orderby=name&order=DESC';break;
case "":$suckerfish_categoryorderecho = '&orderby=name&order=DESC';break;
}
// If single dropdown is set, then adds the extra HTML
if (get_option('suckerfish_categories_singledropdown') == 'on') {
// If on a category page, then sets the 'current_page_item' class
if (is_category()) {$suckerfish_class=' class="current_page_parent current_page_item"';}
echo '
';
}
// Displays the actual categories
echo implode("
';}
}
// Displays the 'Categories' option when the 'Nest posts' option is used ... note: code written by itsanderson
function categories_and_posts($parent = 0, $depth = 0) {
if ( get_option('suckerfish_categoryshowempty') == 'on' ) {
$suckerfish_categoryshowempty = '&hide_empty=0';
}
$suckerfish_depthcategories = get_option('suckerfish_depthcategories');
switch($suckerfish_depthcategories){
case "Top level only":$suckerfish_depthcategoriesecho=1;break;
case "No nesting":$suckerfish_depthcategoriesecho=-1;break;
case "1 level of children":$suckerfish_depthcategoriesecho=2;break;
case "2 levels of children":$suckerfish_depthcategoriesecho=3;break;
case "Infinite":$suckerfish_depthcategoriesecho=0;break;
case "":$suckerfish_depthcategoriesecho=0;break;
}
$suckerfish_categoryorder=get_option('suckerfish_categoryorder');
switch($suckerfish_categoryorder) {
case "My Category Order plugin":$suckerfish_categoryorderecho='&orderby=order';break;
case "Ascending ID #":$suckerfish_categoryorderecho='&orderby=id&order=ASC';break;
case "Decending ID #":$suckerfish_categoryorderecho='&orderby=id&order=DESC';break;
case "Ascending Name":$suckerfish_categoryorderecho='&orderby=name&order=ASC';break;
case "Decending Name":$suckerfish_categoryorderecho='&orderby=name&order=DESC';break;
case "":$suckerfish_categoryorderecho='&orderby=name&order=DESC';break;
}
$categories = get_categories("child_of=$parent".$suckerfish_categoryshowempty.'&'.get_option('suckerfish_includeexcludecategories').'='.get_option('suckerfish_excludecategories').$suckerfish_categoryorderecho);
$posts = ($parent ? get_posts("category=$parent&numberposts=-1") : array());
if($parent==0){
if(is_category()){$suckerfish_class=' class="current_page_parent current_page_item"';}
//echo '
' . get_option('suckerfish_categoriestitle') . ''; // Used for single dropdown
}
if ((count($categories)&&($suckerfish_depthcategoriesecho<1||$suckerfish_depthcategoriesecho>$depth))||count($posts)){
if($parent!=0){echo '
';}// Remove if statement to create single dropdown
if($suckerfish_depthcategoriesecho<1||$suckerfish_depthcategoriesecho>$depth){foreach($categories as $category){if($category->parent==$parent){echo '
';}// Remove if statement to create single dropdown
}
if ($parent == 0) {echo '
';}
}
// Display the 'Home' option
function home() {
// if on the home page, then add 'current-page-item' class
if (is_home()) {$suckerfish_class=' class="current_page_item"';}
// Add the HTML
echo '
';
}
// Display the 'Links' option
// No these functions do not need to be seperate, but it's all legacy code and I haven't gotten around to cleaning it up yet
function blogroll() {wp_list_bookmarks('title_li=&categorize=0');}
function blogrolldropdown() {
echo '
';
}
// Display the 'Archives' option
// No these functions do not need to be seperate, but it's all legacy code and I haven't gotten around to cleaning it up yet
function archivesmonths() {wp_get_archives('type=monthly');}
function archivesyears() {wp_get_archives('type=yearly');}
function archivesmonthsdropdown() {
if (is_month()) {$suckerfish_class=' class="current_page_parent current_page_item"';}
echo '
';
}
// Display the 'Custom Code 1' option
function custom() {
// Check if to be displayed to non-logged in users or not
if (get_option('suckerfish_customcodelogged1') == 'on') {
// Check if logged in
if (is_user_logged_in()) {
if (!function_exists('pixopoint_mln_custom1php')) {echo get_option('suckerfish_custommenu');} // Check that custom PHP mode is not on
else {pixopoint_mln_custom1php();} // Else load custom PHP
}
}
// Else display to everyone
else {
if (!function_exists('pixopoint_mln_custom1php')) {echo get_option('suckerfish_custommenu');} // Check that custom PHP mode is not on
else {pixopoint_mln_custom1php();} // Else load custom PHP
}
}
// Display the 'Custom Code 2' option
function custom2() {
// Check if to be displayed to non-logged in users or not
if (get_option('suckerfish_customcodelogged2') == 'on') {
// Check if logged in
if (is_user_logged_in()) {
if (!function_exists('pixopoint_mln_custom2php')) {echo get_option('suckerfish_custommenu2');} // Check that custom PHP mode is not on
else {pixopoint_mln_custom2php();} // Else load custom PHP
}
}
else {
if (!function_exists('pixopoint_mln_custom2php')) {echo get_option('suckerfish_custommenu2');} // Check that custom PHP mode is not on
else {pixopoint_mln_custom2php();} // Else load custom PHP
}
}
// Display the 'Custom Code 3' option
function custom3() {
// Check if to be displayed to non-logged in users or not
if (get_option('suckerfish_customcodelogged3') == 'on') {
// Check if logged in
if (is_user_logged_in()) {
if (!function_exists('pixopoint_mln_custom3php')) {echo get_option('suckerfish_custommenu3');} // Check that custom PHP mode is not on
else {pixopoint_mln_custom3php();} // Else load custom PHP
}
}
// Else display to everyone
else {
if (!function_exists('pixopoint_mln_custom3php')) {echo get_option('suckerfish_custommenu3');} // Check that custom PHP mode is not on
else {pixopoint_mln_custom3php();} // Else load custom PHP
}
}
// Display the 'Custom Code 4' option
function custom4() {
// Check if to be displayed to non-logged in users or not
if (get_option('suckerfish_customcodelogged4') == 'on') {
// Check if logged in
if (is_user_logged_in()) {
if (!function_exists('pixopoint_mln_custom4php')) {echo get_option('suckerfish_custommenu4');} // Check that custom PHP mode is not on
else {pixopoint_mln_custom4php();} // Else load custom PHP
}
}
// Else display to everyone
else {
if (!function_exists('pixopoint_mln_custom4php')) {echo get_option('suckerfish_custommenu4');} // Check that custom PHP mode is not on
else {pixopoint_mln_custom4php();} // Else load custom PHP
}
}
// Display the 'Recent Posts' option
function recentposts() {
echo '
';
}
// The rest of the options
// Yes these functions do not need to be seperate, but it's all legacy code and I haven't gotten around to cleaning it up yet
function pages_excludechildren() {$args = array('post_type' => 'page','post_parent' => get_option('suckerfish_excludepages'), /*any parent*/); $suckerfish_excludepageschildren .= get_option('suckerfish_excludepages').','; if(get_option('suckerfish_excludepages') != ''){$attachments = get_children($args);} if ($attachments) {foreach ($attachments as $post) {$suckerfish_excludepageschildren .= $post->ID.',';} } echo '', ereg_replace("\">]+([\t\n]+)
'page','post_parent' => get_option('suckerfish_excludepages'), /*any parent*/); $suckerfish_excludepageschildren .= get_option('suckerfish_excludepages').','; if(get_option('suckerfish_excludepages') != ''){$attachments = get_children($args);} if ($attachments) {foreach ($attachments as $post) {$suckerfish_excludepageschildren .= $post->ID.',';} } if (is_page()) $class=' class="current_page_parent current_page_item"'; echo '
"; }
/************************************************************
*************************************************************
*** The main function used to add the menu to the site *****
*************************************************************
*************************************************************/
function pixopoint_menu($pixo_which=1) {
if ((get_option('suckerfish_secondmenu') == 'on' AND $pixo_which == '2') OR ($pixo_which == '1')) { // Only loads if second menu turned on
echo '
';
// Checks to see if theme CSS should be used and if so serves different IDs
if (get_option('suckerfish_generator') == 'Theme CSS') {echo '
';
}
// If not using theme CSS, then uses regular plugin IDs
else {
echo '
';
}
// If title tags are to be removed, then starts output buffering (title tags removed via ereg_replace)
if (get_option('suckerfish_titletags') == 'on') {ob_start();}
echo '
';
// Menu contents are stored in the 'suckerfish_menucontents' option
if (get_option('suckerfish_menucontents') != '') { // Checks if any menu options are stored
$temp = explode('|', get_option('suckerfish_menucontents')); // Explodes 'suckerfish_menucontents' into an array
foreach ($temp as $set) { // Splits array into two
$set = explode('=', $set);
// The seperator between inactive and active menu items
if ($set[0] == 'XXX') {$XXX=1;}
if ($set[0] == 'ZZZ') {$XXX=2;}
if (($XXX == '' AND $pixo_which == 1) || ($XXX == 1 AND $pixo_which == 2)) { // Crude hack coz couldn't figure out how to finish a foreach early
// 'Pages' option
if ($set[0] == 'pages') {
pages();
}
// 'Categories' option
if ($set[0] == 'categories') {
if (get_option('suckerfish_categories_showchildposts') == 'on') {
if (is_category()) {$suckerfish_class=' class="current_page_parent current_page_item"';} echo '
';}
// 'Home' option
if ($set[0] == 'home') {home();}
// 'Archive' option
if ($set[0] == 'archives') {
if (get_option('suckerfish_archivesdropdown') == 'on' AND get_option('suckerfish_archivesperiod') == 'Months') {archivesmonthsdropdown();}
if (get_option('suckerfish_archivesdropdown') == 'on' AND get_option('suckerfish_archivesperiod') == 'Years') {archivesyearsdropdown();}
if (get_option('suckerfish_archivesdropdown') != 'on' AND get_option('suckerfish_archivesperiod') == 'Months') {archivesmonths();}
if (get_option('suckerfish_archivesdropdown') != 'on' AND get_option('suckerfish_archivesperiod') == 'Years') {archivesyears();}
}
// 'Links' option
if ($set[0] == 'links') {
if (get_option('suckerfish_linkscategorized') == 'on' AND get_option('suckerfish_linksdropdown') == 'on') {blogrollcategoriesdropdown();}
if (get_option('suckerfish_linkscategorized') == 'on' AND get_option('suckerfish_linksdropdown') != 'on') {blogrollcategories();}
if (get_option('suckerfish_linkscategorized') != 'on' AND get_option('suckerfish_linksdropdown') == 'on') {blogrolldropdown();}
if (get_option('suckerfish_linkscategorized') != 'on' AND get_option('suckerfish_linksdropdown') != 'on') {blogroll();}
}
// 'Custom Code 1' option
if ($set[0] == 'customcode1') {custom();}
// 'Custom Code 21' option
if ($set[0] == 'customcode2') {custom2();}
// 'Custom Code 3' option
if ($set[0] == 'customcode3') {custom3();}
// 'Custom Code 4' option
if ($set[0] == 'customcode4') {custom4();}
}
}
}
// Remove title tags (buffering started earlier
if (get_option('suckerfish_titletags') == 'on') {
$pixo_menucontents = ob_get_contents();
ob_end_clean();
$pixo_menucontents = preg_replace('/title=\"(.*?)\"/','',$pixo_menucontents);
$pixo_menucontents = preg_replace('/title=\'(.*?)\'/','',$pixo_menucontents);
echo $pixo_menucontents;
}
// Add the closing tags
echo '
';
}
} // Closes "onlyload if second menu turned on"
/*************************************************************
****** Backwards support for 'Ryans Suckerfish Plugin' ******
******* This needs to stay as we promised to maintain *******
******* long term support for this function to some of ******
***************** our premium support members ***************
*************************************************************/
function suckerfish() {pixopoint_menu(1);}
?>