'.__("Settings").''; array_unshift( $links, $settings_link ); } return $links; } // CSS needed for the jump menu // Places the menu on the top or the bottom of the screen (depending on options) function wpjm_editpost_css() { echo " "; } // Some javascript to help the edit drop down list work function wpjm_js() { // jqueryfunctions.js (general jquery scripts) & jquery wp_enqueue_script( 'jquery-functions', get_option( 'siteurl' ).'/wp-content/plugins/wp-jump-menu/assets/js/jqueryfunctions.js', array( 'jquery' ) ); // colorpicker.js - used for the color picker wp_enqueue_script( 'jquery-colorpicker', get_option( 'siteurl' ).'/wp-content/plugins/wp-jump-menu/assets/js/colorpicker/js/colorpicker.js', array( 'jquery' ) ); } // Put a bar across the bottom of the screen that offers to help... // This is the plugins display function that shows the jump menu bar function wpjm_custom_footer() { echo '
'; } function wpjm_page_dropdown(){ require_once( ABSPATH . 'wp-config.php' ); // Drop Down Function if ( ! function_exists( 'wpjm_pdd_get_page_level' ) ) { function wpjm_pdd_get_page_level( $pd_page ) { if ( $pd_page->post_parent == 0 ) return 0; else { $pd_i = 0; $pd_parent = get_post( $pd_page->post_parent ); // Get initial page's parent $pd_loop = 1; while ( $pd_i < 10 ) { $pd_i++; if ( $pd_parent->post_parent == 0 ) // If this post parent is a root, then end the loop return $pd_i; else // Otherwise, get the parent to the parent and try again $pd_parent = get_post( $pd_parent->post_parent ); } } } } // Page Title Function if ( ! function_exists( 'wpjm_get_page_title' ) ) { function wpjm_get_page_title ($pd_title) { if ( strlen($pd_title) > 50 ) { return substr( $pd_title, 0, 50)."..."; } else { return $pd_title; } } } // Get Pages $pd_pages = get_pages('sort_column='.get_option('wpjm_sortpagesby').'&sort_order='.get_option('wpjm_sortpages')); $pd_total_pages = count($pd_pages); // Get Posts $pd_posts = get_posts('orderby='.get_option('wpjm_sortpostsby').'&order='.get_option('wpjm_sortposts').'&numberposts='.get_option('wpjm_numberposts')); $pd_total_posts = count($pd_posts); // Get Custom Post Types settings (will iterate through later) $custom_post_types = get_option('wpjm_customPostTypes'); // Start echoing the select menu echo ''; } /* Plugin Installation Function */ function wpjm_install() { add_option("wpjm_position",'top'); add_option("wpjm_sortpagesby",'menu_order'); add_option("wpjm_sortpages",'ASC'); add_option("wpjm_sortpostsby",'date'); add_option("wpjm_sortposts",'DESC'); add_option("wpjm_numberposts",'-1'); add_option("wpjm_backgroundColor",'333333'); add_option("wpjm_fontColor",'ffffff'); add_option("wpjm_borderColor",'aaaaaa'); add_option("wpjm_customPostTypes",''); add_option("wpjm_logoIcon",''); add_option("wpjm_logoWidth",'0'); add_option("wpjm_linkColor",'aaaaaa'); add_option("wpjm_message","Brought to you by Krill Web Design."); } // Add the WPJM Menu function wpjm_menu() { add_options_page('Jump Menu Options','Jump Menu Options', 8, 'wpjm-options', 'wpjm_options'); } // Update Options on Save if (isset($_POST['save_post_page_values'])) { // Update Options update_option("wpjm_position", $_POST['wpjm_position']); update_option("wpjm_sortpagesby",$_POST['wpjm_sortpagesby']); update_option("wpjm_sortpages",$_POST['wpjm_sortpages']); update_option("wpjm_sortpostsby",$_POST['wpjm_sortpostsby']); update_option("wpjm_sortposts",$_POST['wpjm_sortposts']); update_option("wpjm_numberposts",$_POST['wpjm_numberposts']); update_option("wpjm_backgroundColor", $_POST['wpjm_backgroundColor']); update_option("wpjm_fontColor",$_POST['wpjm_fontColor']); update_option("wpjm_borderColor",$_POST['wpjm_borderColor']); $custom_post_types = (is_array($_POST['wpjm_customPostTypes'])?implode(",",$_POST['wpjm_customPostTypes']):$_POST['wpjm_customPostTypes']); update_option("wpjm_customPostTypes", $custom_post_types); update_option("wpjm_logoIcon", $_POST['wpjm_logoIcon']); if (!function_exists('file_exists')) { if ($_POST['wpjm_logoIcon'] && file_exists($_POST['wpjm_logoIcon'])) { $logo_width_obj = getimagesize($_POST['wpjm_logoIcon']); $logo_width = $logo_width_obj[0]; update_option("wpjm_logoWidth", $logo_width); } } else { update_option("wpjm_logoWidth", $_POST['wpjm_logoWidth']); } update_option("wpjm_linkColor", $_POST['wpjm_linkColor']); update_option("wpjm_message", stripslashes($_POST['wpjm_message'])); $message = "Options updated successfully!"; } /** * The options page */ function wpjm_options() { // Update success message if ( isset( $_POST['save_post_page_values'] ) ) { $message = "Options updated successfully!"; } // Get Options $wpjm_position = get_option("wpjm_position"); $wpjm_sortpagesby = get_option("wpjm_sortpagesby"); $wpjm_sortpages = get_option("wpjm_sortpages"); $wpjm_sortpostsby = get_option("wpjm_sortpostsby"); $wpjm_sortposts = get_option("wpjm_sortposts"); $wpjm_numberposts = get_option("wpjm_numberposts"); $wpjm_backgroundColor = get_option("wpjm_backgroundColor"); $wpjm_fontColor = get_option("wpjm_fontColor"); $wpjm_borderColor = get_option("wpjm_borderColor"); $wpjm_logoIcon = get_option("wpjm_logoIcon"); $wpjm_logoWidth = get_option("wpjm_logoWidth"); $wpjm_message = get_option("wpjm_message"); $wpjm_linkColor = get_option("wpjm_linkColor"); $wpjm_customPostTypes = get_option("wpjm_customPostTypes"); ?>