query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_excerpt = %s WHERE ID = %d", stripslashes( $new_mediadesc ), $postid ) ); $ame_media_desc = '' . $new_mediadesc . ''; $ame_media_desc .= ' ' . __( 'Edit' ) . ''; do_action( 'edit_attachment', $postid ); die( "jQuery('span#ame_mediadesc" . $postid . "').fadeOut('fast', function() { jQuery('span#ame_mediadesc" . $postid . "').html('" . addslashes_gpc( $ame_media_desc ) . "').fadeIn('fast'); });" ); } /** * SACK response function for saving comment status for a post * * @since 1.2.0 * @author scripts@schloebe.de */ function ame_ajax_set_commentstatus() { global $wpdb; $postid = intval( $_POST['postid'] ); $q_status = intval( $_POST['comment_status'] ); ($q_status == '1') ? $status = 'open' : $status = 'closed'; $posttype = 'post'; $post = get_post( $postid ); if( $status == 'open' ) { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET comment_status = %s WHERE ID = %d", $status, $postid ) ); AdminManagementXtended::fireActions( 'post', $postid, $post ); die( "jQuery('#commentstatus" . $postid . "').html('\""');jQuery('#post-" . $postid . " td, #post-" . $postid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);" ); } else { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET comment_status = %s WHERE ID = %d", $status, $postid ) ); AdminManagementXtended::fireActions( 'post', $postid, $post ); die( "jQuery('#commentstatus" . $postid . "').html('\""');jQuery('#post-" . $postid . " td, #post-" . $postid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);" ); } } /** * SACK response function for saving page order * * @since 1.1.0 * @author scripts@schloebe.de */ function ame_get_pageorder() { global $wpdb; $pageorder2 = $_POST['pageordertable2']; parse_str( $pageorder2 ); $i = 0; foreach ( $pageordertable as $value ) { $has_parent = get_post( $value ); if( $value != '0' && empty( $has_parent->post_parent ) ) { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = %d WHERE ID = %d AND post_type = 'page'", $i, $value ) ); $i++; } } die( "jQuery(\"#ame_ordersave_loader\").html('');" ); } /** * SACK response function for saving post tags * * @since 1.3.0 * @author scripts@schloebe.de */ function ame_ajax_save_tags() { global $wpdb; $postid = intval( $_POST['postid'] ); $ame_tags = $_POST['new_tags']; $tagarray = explode( ",", trim( $ame_tags ) ); wp_set_post_tags( $postid, $tagarray ); unset( $GLOBALS['tag_cache'] ); $tags = get_the_tags( $postid ); $ame_post_tags = ''; $ame_post_tags_plain = ''; if( ! empty( $tags ) ) { $out = array(); foreach ( $tags as $c ) { $out[] = ' ' . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'post_tag', 'display' ) ) . ''; $out2[] = esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'post_tag', 'display' ) ); } $ame_post_tags .= join( ', ', $out ); $ame_post_tags_plain .= join( ', ', $out2 ); } else { $ame_post_tags .= __( 'No Tags' ); $ame_post_tags_plain .= ''; } $ame_post_tags .= ' ' . __( 'Edit' ) . ''; $post = get_post( $postid ); do_action( 'edit_post', $postid, $post ); do_action( 'save_post', $postid, $post ); die( "jQuery('span#ame_tags" . $postid . "').fadeOut('fast', function() { jQuery('span#ame_tags" . $postid . "').html('" . addslashes_gpc( $ame_post_tags ) . "').fadeIn('fast'); });" ); } /** * SACK response function for getting post categories and compiling them into a category checklist * * @since 2.3.5 * @author scripts@schloebe.de * @uses wp_category_checklist() */ function ame_ajax_get_categories() { global $wpdb, $post; $ame_id = intval( $_POST['postid'] ); ; echo '
'; echo '
'; echo '' . __( 'Check All' ) . '' . __( 'Uncheck All' ) . ''; echo '

'; echo ''; echo '
'; echo get_submit_button( __( 'Save' ), 'button button-primary primary large', 'save', false, 'onclick="ame_ajax_save_categories(' . $ame_id . ');return false;"' ); echo " "; echo get_submit_button( __( 'Cancel' ), 'button button-secondary secondary', 'cancel', false, 'onclick="tb_remove();"' ); echo '
'; echo '
'; die( "" ); } /** * SACK response function for saving post categories * * @since 1.2.0 * @author scripts@schloebe.de */ function ame_ajax_save_categories() { global $wpdb, $post; $postid = intval( $_POST['postid'] ); $ame_cats = $_POST['ame_cats']; $ame_categories = substr( $ame_cats, 0, - 1 ); $catarray = explode( ",", $ame_categories ); wp_set_post_categories( $postid, $catarray ); unset( $GLOBALS['category_cache'] ); $categories = get_the_category( $postid ); $ame_post_cats = ""; if( ! empty( $categories ) ) { $out = array(); foreach ( $categories as $c ) { $out[] = ' ' . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) . ''; } $ame_post_cats = join( ', ', $out ); } else { $ame_post_cats = __( 'Uncategorized' ); } do_action( 'edit_post', $postid, get_post( $postid ) ); do_action( 'save_post', $postid, get_post( $postid ) ); die( "re_init();jQuery('span#ame_category" . $postid . "').fadeOut('fast', function() { jQuery('a#thickboxlink" . $postid . "').show(); jQuery('span#ame_category" . $postid . "').html('" . addslashes_gpc( $ame_post_cats ) . "').fadeIn('fast'); });" ); } /** * SACK response function for saving draft post visibility option * * @since 0.9 * @author scripts@schloebe.de */ function ame_toggle_showinvisposts() { global $wpdb; $status = intval( $_POST['status'] ); update_option( "ame_toggle_showinvisposts", $status ); die( "location.reload();" ); } /** * SACK response function for toggling button image sets option * * @since 1.3.0 * @author scripts@schloebe.de */ function ame_ajax_toggle_imageset() { global $wpdb; $setid = intval( $_POST['setid'] ); update_option( "ame_imgset", "set" . $setid ); die( "location.reload();" ); } /** * SACK response function for saving order input option * * @since 1.0 * @author scripts@schloebe.de */ function ame_toggle_orderoptions() { global $wpdb; $status = intval( $_POST['status'] ); update_option( "ame_show_orderoptions", $status ); die( "location.reload();" ); } /** * SACK response function for displaying the slug edit form inline * * @since 1.0 * @author scripts@schloebe.de */ function ame_slug_edit() { global $wpdb; $catid = intval( $_POST['category_id'] ); if( is_string( $_POST['posttype'] ) ) $posttype = $_POST['posttype']; if( $posttype == 'post' ) { $postnumber = '1'; } elseif( $posttype == 'page' ) { $postnumber = '2'; } $curpostslug = $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM $wpdb->posts WHERE ID = %d", $catid ) ); $cols = intval( $_POST['col_no'] ); $addHTML = "
"; die( "jQuery('#post-" . $catid . "').after( \"" . $addHTML . "\" ); jQuery('#post-" . $catid . "').hide();" ); } /** * SACK response function for displaying the author edit form inline * * @since 1.7.0 * @author scripts@schloebe.de */ function ame_author_edit() { global $wpdb, $current_user; $postid = intval( $_POST['post_id'] ); $cols = intval( $_POST['col_no'] ); if( is_string( $_POST['posttype'] ) ) $posttype = $_POST['posttype']; if( $posttype == 'post' ) { $typenumber = '1'; } elseif( $posttype == 'page' ) { $typenumber = '2'; } if( $typenumber == '1' && ! current_user_can( 'edit_post', $postid ) ) { die( "alert('" . esc_js( __( 'You are not allowed to change the post author as this user.' ) ) . "');" ); return; } elseif( $typenumber == '2' && ! current_user_can( 'edit_page', $postid ) ) { die( "alert('" . esc_js( __( 'You are not allowed to change the page author as this user.' ) ) . "');" ); return; } $post = get_post( $postid ); $authors = get_users( array( 'user_id' => $current_user->ID ) ); // TODO: ROLE SYSTEM if( $post->post_author && ! in_array( $post->post_author, $authors ) ) $authors[] = $post->post_author; if( $authors && count( $authors ) > 1 ) { $output = wp_dropdown_users( array( 'echo' => 0,'who' => 'authors','name' => 'author-' . $postid,'selected' => empty( $post->ID ) ? $current_user->ID : $post->post_author,'include_selected' => true ) ); } else { if( $typenumber == '1' ) { die( "alert('" . esc_js( __( 'You are not allowed to change the post author as this user.' ) ) . "');" ); return; } elseif( $typenumber == '2' ) { die( "alert('" . esc_js( __( 'You are not allowed to change the page author as this user.' ) ) . "');" ); return; } } $output = str_replace( "\n", "", $output ); $addHTML = "" . $output . "
"; die( "jQuery('#post-" . $postid . "').after( \"" . $addHTML . "\" ); jQuery('#post-" . $postid . "').hide();" ); } /** * SACK response function for saving page order from direct input * * @since 1.0 * @author scripts@schloebe.de */ function ame_save_order() { global $wpdb; $catid = intval( $_POST['category_id'] ); $neworderid = intval( $_POST['new_orderid'] ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET menu_order = %d WHERE ID = %d", $neworderid, $catid ) ); die( "jQuery('span#ame_order_loader" . $catid . "').hide(); jQuery('#post-" . $catid . " td, #post-" . $catid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);" ); } /** * SACK response function for saving page slug * * @since 1.0 * @author scripts@schloebe.de */ function ame_save_slug() { global $wpdb; $catid = intval( $_POST['category_id'] ); $new_slug = $_POST['new_slug']; if( empty( $new_slug ) || $new_slug == '' ) { $postinfo = get_post( $catid, ARRAY_A ); $new_slug = $postinfo['post_title']; } $new_slug = sanitize_title( $new_slug ); if( is_string( $_POST['typenumber'] ) ) $posttype = $_POST['typenumber']; if( $posttype == '1' ) { $posttype = 'post'; } elseif( $posttype == '2' ) { $posttype = 'page'; } $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $new_slug, $catid ) ); $post = get_post( $catid ); AdminManagementXtended::fireActions( 'post', $catid, $post ); die( "jQuery('#post-" . $catid . "').show(); jQuery('#alterpost-" . $catid . "').hide(); jQuery('#post-" . $catid . " td, #post-" . $catid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);" ); } /** * SACK response function for saving post author * * @since 1.7.0 * @author scripts@schloebe.de */ function ame_save_author() { global $wpdb; $catid = intval( $_POST['category_id'] ); $newauthorid = intval( $_POST['newauthor'] ); if( is_string( $_POST['typenumber'] ) ) $posttype = $_POST['typenumber']; if( $posttype == '1' ) { $posttype = 'post'; } elseif( $posttype == '2' ) { $posttype = 'page'; } $post = get_post( $catid ); AdminManagementXtended::fireActions( 'post', $catid, $post ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE ID = %d", $newauthorid, $catid ) ); die( "jQuery('#post-" . $catid . "').show(); jQuery('#post-" . $catid . " td, #post-" . $catid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300); jQuery('#alterpost-" . $catid . "').hide(); jQuery(\"a[href^='edit.php?author=" . $catid . "'], a[href^='edit-pages.php?author=" . $catid . "']\").html('" . $newauthorid . "');" ); } /** * SACK response function for saving post//page title * * @since 0.7 * @author scripts@schloebe.de */ function ame_save_title() { global $wpdb; $postid = intval( $_POST['category_id'] ); $new_title = $_POST['new_title']; $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_title = %s WHERE ID = %d", stripslashes( $new_title ), $postid ) ); $new_title = apply_filters( 'the_title', $new_title ); $post = get_post( $postid ); AdminManagementXtended::fireActions( 'post', $postid, $post ); die( "jQuery('a[href*=\'post.php?post=" . $postid . "&action=edit\']').html('" . $new_title . "'); jQuery('#post-" . $postid . "').show(); jQuery('#alterpost-" . $postid . "').hide(); jQuery('#post-" . $postid . " td, #post-" . $postid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);" ); } /** * SACK response function for saving post/page date * * @since 0.7 * @author scripts@schloebe.de */ function ame_set_date() { global $wpdb; $catid = intval( substr( $_POST['category_id'], 10, 5 ) ); $newpostdate = date( "Y-m-d H:i:s", strtotime( $_POST['pickedDate'] ) ); $newpostdate_gmt = get_gmt_from_date( $newpostdate ); if( is_string( $_POST['posttype'] ) ) $posttype = $_POST['posttype']; $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date = %s WHERE ID = %d", $newpostdate, $catid ) ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date_gmt = %s WHERE ID = %d", $newpostdate_gmt, $catid ) ); if( strtotime( current_time( 'mysql' ) ) < strtotime( $newpostdate ) ) { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_status = 'future' WHERE ID = %d", $catid ) ); $post = get_post( $catid ); AdminManagementXtended::fireActions( 'post', $catid, $post ); die( "jQuery('#post-" . $catid . " abbr').html('" . date( __( 'Y/m/d' ), strtotime( $newpostdate ) ) . "'); jQuery('#post-" . $catid . "').removeClass('status-publish').addClass('status-future'); jQuery('#post-" . $catid . " td, #post-" . $catid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);" ); } elseif( strtotime( current_time( 'mysql' ) ) > strtotime( $newpostdate ) ) { if( $posttype == 'post' && ! current_user_can( 'publish_posts' ) ) { die( "alert('" . esc_js( __( 'You are not allowed to edit this post.' ) ) . "');" ); return; } // $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_status = 'publish' WHERE ID = %d", $catid ) ); $post = get_post( $catid ); AdminManagementXtended::fireActions( 'post', $catid, $post ); die( "jQuery('#post-" . $catid . " abbr').html('" . date( __( 'Y/m/d' ), strtotime( $newpostdate ) ) . "'); jQuery('#post-" . $catid . "').removeClass('status-future').addClass('status-publish'); jQuery('#post-" . $catid . " td, #post-" . $catid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);" ); } } /** * SACK response function for toggling post/page visibility * * @since 0.7 * @author scripts@schloebe.de */ function ame_toggle_visibility() { global $wpdb; $catid = intval( $_POST['category_id'] ); if( is_string( $_POST['vis_status'] ) ) $status = $_POST['vis_status']; if( is_string( $_POST['posttype'] ) ) $posttype = $_POST['posttype']; $post_status = get_post_status( $catid ); if( $status == 'publish' ) { if( $posttype == 'post' && ! current_user_can( 'publish_posts' ) ) { die( "alert('" . esc_js( __( 'Sorry, you do not have the right to publish this post.' ) ) . "');" ); return; } if( $posttype == 'post' && $post_status == 'pending' ) { $postdate = current_time( 'mysql' ); $postdate_gmt = get_gmt_from_date( $postdate ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date = %s WHERE ID = %d", $postdate, $catid ) ); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date_gmt = %s WHERE ID = %d", $postdate_gmt, $catid ) ); } $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_status = %s WHERE ID = %d", $status, $catid ) ); $post = get_post( $catid ); AdminManagementXtended::fireActions( 'post', $catid, $post ); die( "jQuery('#visicon" . $catid . "').html('\""');jQuery('#post-" . $catid . " td, #post-" . $catid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);jQuery('#post-" . $catid . "').removeClass('status-draft').addClass('status-publish');" ); } else { $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_status = %s WHERE ID = %d", $status, $catid ) ); $post = get_post( $catid ); AdminManagementXtended::fireActions( 'post', $catid, $post ); die( "jQuery('#visicon$catid').html('\""');jQuery('#post-" . $catid . " td, #post-" . $catid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);jQuery('#post-" . $catid . "').removeClass('status-publish').addClass('status-draft');" ); } } /** * SACK response function for toggling post/page sticky * * @since 2.3.0 * @author scripts@schloebe.de */ function ame_toggle_sticky() { global $wpdb; $postid = intval( $_POST['post_id'] ); $post = get_post( $postid ); if( is_sticky( $postid ) ) { unstick_post( $postid ); AdminManagementXtended::fireActions( 'post', $postid, $post ); die( "jQuery('#stickyicon" . $postid . "').html('\""');jQuery('#post-" . $postid . " td, #post-" . $postid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);jQuery('#post-" . $postid . "');" ); } else { stick_post( $postid ); AdminManagementXtended::fireActions( 'post', $postid, $post ); die( "jQuery('#stickyicon" . $postid . "').html('\""');jQuery('#post-" . $postid . " td, #post-" . $postid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);jQuery('#post-" . $postid . "');" ); } } /** * SACK response function for toggling page exclusion status * * @since 2.1.0 * @author scripts@schloebe.de * @link http://plugins.trac.wordpress.org/browser/exclude-pages/trunk/exclude_pages.php#L162 */ function ame_toggle_excludestatus() { $pageid = intval( $_POST['pageid'] ); $statusid = intval( $_POST['statusid'] ); $excluded_ids = ep_get_excluded_ids(); if( $statusid == 1 ) { array_push( $excluded_ids, $pageid ); $excluded_ids = array_unique( $excluded_ids ); } else { $index = array_search( $pageid, $excluded_ids ); if( $index !== false ) unset( $excluded_ids[$index] ); } $excluded_ids_str = implode( ',', $excluded_ids ); ep_set_option( EP_OPTION_NAME, $excluded_ids_str, "Comma separated list of post and page IDs to exclude when returning pages from the get_pages function." ); if( $statusid == 0 ) { $e_status = 1; $e_img = '_off'; } else { $e_status = 0; $e_img = ''; } die( "jQuery('#excludepagewrap$pageid').html('\""');jQuery('#post-" . $pageid . " td, #post-" . $pageid . " th').animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300).animate( { opacity: 0 }, 300).animate( { opacity: 1 }, 300);" ); } if( function_exists( 'add_action' ) ) { add_action( 'wp_ajax_ame_toggle_visibility', 'ame_toggle_visibility' ); add_action( 'wp_ajax_ame_set_date', 'ame_set_date' ); add_action( 'wp_ajax_ame_save_title', 'ame_save_title' ); add_action( 'wp_ajax_ame_save_slug', 'ame_save_slug' ); add_action( 'wp_ajax_ame_slug_edit', 'ame_slug_edit' ); add_action( 'wp_ajax_ame_save_order', 'ame_save_order' ); add_action( 'wp_ajax_ame_toggle_orderoptions', 'ame_toggle_orderoptions' ); add_action( 'wp_ajax_ame_toggle_showinvisposts', 'ame_toggle_showinvisposts' ); add_action( 'wp_ajax_ame_get_pageorder', 'ame_get_pageorder' ); add_action( 'wp_ajax_ame_ajax_save_categories', 'ame_ajax_save_categories' ); add_action( 'wp_ajax_ame_ajax_get_categories', 'ame_ajax_get_categories' ); add_action( 'wp_ajax_ame_ajax_set_commentstatus', 'ame_ajax_set_commentstatus' ); add_action( 'wp_ajax_ame_ajax_save_tags', 'ame_ajax_save_tags' ); add_action( 'wp_ajax_ame_ajax_toggle_imageset', 'ame_ajax_toggle_imageset' ); add_action( 'wp_ajax_ame_ajax_save_mediadesc', 'ame_ajax_save_mediadesc' ); add_action( 'wp_ajax_ame_author_edit', 'ame_author_edit' ); add_action( 'wp_ajax_ame_save_author', 'ame_save_author' ); add_action( 'wp_ajax_ame_toggle_excludestatus', 'ame_toggle_excludestatus' ); add_action( 'wp_ajax_ame_toggle_sticky', 'ame_toggle_sticky' ); } /* ************************************************ */ /* Write JS into our admin header */ /* ************************************************ */ /** * Writes the javascript stuff into page header needed for the JS popout calendar * * @since 0.7 * @author scripts@schloebe.de * @author Jeff Cole */ function ame_js_jquery_datepicker_header() { $current_page = basename( $_SERVER['PHP_SELF'], ".php" ); $posttype = ""; if( $current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page' ) { $posttype = "post"; } elseif( $current_page == 'edit' ) { $posttype = "post"; } elseif( $current_page == 'edit-pages' ) { $posttype = "page"; } if( ($current_page == 'edit-pages' || ($current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page')) && get_option( 'ame_show_orderoptions' ) == '2' ) { echo " \n"; } if( $current_page == 'edit' && ! isset( $_GET['page'] ) ) { echo "\n"; } echo "\n"; echo "\n"; if( $current_page == 'edit-pages' || $current_page == 'edit' ) { if( $current_page == 'edit-pages' || ($current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page') ) $ame_column_heading = __( 'Edit Page Order:', 'admin-management-xtended' ); else $ame_column_heading = __( 'Edit Post Order:', 'admin-management-xtended' ); if( get_option( 'ame_show_orderoptions' ) == '0' ) { $dnd_text = ($current_page != 'edit' || ($current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page')) ? " " . __( 'Drag & Drop', 'admin-management-xtended' ) . "" : ""; echo "\n"; } elseif( get_option( 'ame_show_orderoptions' ) == '1' ) { $dnd_text = ($current_page != 'edit' || ($current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page')) ? " " . __( 'Drag & Drop', 'admin-management-xtended' ) . "" : ""; echo "\n"; } elseif( get_option( 'ame_show_orderoptions' ) == '2' ) { $dnd_text = ($current_page != 'edit' || ( $current_page == 'edit' && isset($_GET['post_type']) && $_GET['post_type'] == 'page' )) ? " " . __( 'Drag & Drop', 'admin-management-xtended' ) . "[?]" . "" : ""; echo "\n"; } } if( $current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] != 'page' ) { if( get_option( 'ame_toggle_showinvisposts' ) == '1' && ! isset( $_GET['page'] ) ) { echo "\n"; } elseif( get_option( 'ame_toggle_showinvisposts' ) == '0' && ! isset( $_GET['page'] ) ) { echo "\n"; } } if( get_option( 'ame_toggle_showinvisposts' ) == '0' && ! isset( $_GET['page'] ) ) { if( ! isset( $_GET['post_status'] ) ) { echo '' . "\n"; } } } /** * Writes javascript stuff into page header needed for the plugin and calls for the SACK library * * @since 0.7 * @author scripts@schloebe.de */ function ame_js_admin_header() { wp_print_scripts( array( 'sack' ) ); $posttype = 'post'; $revisionL10n = __( "Post Revisions", 'admin-management-xtended' ); $current_page = basename( $_SERVER['PHP_SELF'], ".php" ); if( $current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page' ) { $posttype = 'post'; } elseif( $current_page == 'edit' ) { $posttype = 'post'; } elseif( $current_page == 'link-manager' ) { $posttype = 'link'; } if( $current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page' ) { $revisionL10n = __( "Page Revisions", 'admin-management-xtended' ); } elseif( $current_page == 'edit' ) { $revisionL10n = __( "Post Revisions", 'admin-management-xtended' ); } elseif( $current_page == 'edit-pages' ) { $revisionL10n = __( "Page Revisions", 'admin-management-xtended' ); } ?> ' . "\n"; echo ' ' . "\n"; if( $current_page == 'edit' && ! isset( $_GET['page'] ) ) { echo '' . "\n"; } elseif( $current_page == 'edit-pages' || ($current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page') && ! isset( $_GET['page'] ) ) { echo '' . "\n"; } } /** * Returns the output for the 'change image set' link * * @since 1.3.0 * @author scripts@schloebe.de * * @return string */ function ame_changeImgSet() { if( get_option( "ame_imgset" ) == 'set1' ) { $imgset = '2'; } elseif( get_option( "ame_imgset" ) == 'set2' ) { $imgset = '1'; } return ' ' . __( 'Change image set', 'admin-management-xtended' ) . ''; } $current_page = basename( $_SERVER['PHP_SELF'], ".php" ); if( function_exists( 'add_action' ) ) { if( ($current_page == 'edit' || $current_page == 'edit-pages') && ! isset( $_GET['page'] ) ) { function ame_enqueue_stuff_edit() { wp_enqueue_style( array( 'thickbox' ) ); wp_enqueue_script( array( 'thickbox' ) ); wp_enqueue_script( 'date', AME_PLUGINFULLURL . "js/jquery-addons/date.js", array( 'jquery' ), AME_VERSION ); wp_enqueue_script( 'datePicker', AME_PLUGINFULLURL . "js/jquery-addons/jquery.datePicker.js", array( 'jquery' ), AME_VERSION ); wp_enqueue_script( 'ame_gui-modificators', AME_PLUGINFULLURL . "js/gui-modificators.js", array( 'sack' ), AME_VERSION ); wp_enqueue_script( 'ame_miscscripts', AME_PLUGINFULLURL . "js/functions.js", array( 'sack' ), AME_VERSION ); } add_action( 'admin_head', 'ame_css_admin_header' ); add_action( 'admin_print_scripts', 'ame_js_admin_header' ); add_action( 'admin_head', 'ame_js_jquery_datepicker_header' ); add_action( 'admin_enqueue_scripts', 'ame_enqueue_stuff_edit' ); if( ame_locale_exists() === true ) { function ame_enqueue_script_localdate() { $cur_locale = get_locale(); wp_enqueue_script( 'localdate', AME_PLUGINFULLURL . "js/jquery-addons/date_" . $cur_locale . ".js", array( 'jquery' ), AME_VERSION ); } add_action( 'admin_enqueue_scripts', 'ame_enqueue_script_localdate' ); } if( ($current_page == 'edit-pages' || ($current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] == 'page')) && get_option( 'ame_show_orderoptions' ) == '2' && ! isset( $_GET['page'] ) ) { function ame_enqueue_script_tablednd() { wp_enqueue_script( 'tablednd', AME_PLUGINFULLURL . "js/jquery-addons/jquery.tablednd.js", array( 'jquery' ), AME_VERSION ); } add_action( 'admin_enqueue_scripts', 'ame_enqueue_script_tablednd' ); } } /** * * @since 1.8.0 */ if( $current_page == 'link-manager' ) { function ame_enqueue_stuff_linkmanager() { wp_enqueue_style( array( 'thickbox' ) ); wp_enqueue_script( array( 'thickbox' ) ); wp_enqueue_script( 'ame_gui-modificators', AME_PLUGINFULLURL . "js/gui-modificators.js", array( 'sack' ), AME_VERSION ); wp_enqueue_script( 'ame_miscscripts', AME_PLUGINFULLURL . "js/functions.js", array( 'sack' ), AME_VERSION ); } add_action( 'admin_print_scripts', 'ame_js_admin_header' ); add_action( 'admin_head', 'ame_css_admin_header' ); add_action( 'admin_enqueue_scripts', 'ame_enqueue_stuff_linkmanager' ); } if( $current_page == 'upload' ) { function ame_enqueue_stuff_upload() { wp_enqueue_script( 'ame_gui-modificators', AME_PLUGINFULLURL . "js/gui-modificators.js", array( 'sack' ), AME_VERSION ); wp_enqueue_script( 'ame_miscscripts', AME_PLUGINFULLURL . "js/functions.js", array( 'sack' ), AME_VERSION ); } add_action( 'admin_print_scripts', 'ame_js_admin_header' ); add_action( 'admin_enqueue_scripts', 'ame_enqueue_stuff_upload' ); } if( $current_page == 'edit' && isset( $_GET['post_type'] ) && $_GET['post_type'] != 'page' && ! isset( $_GET['page'] ) ) { function ame_enqueue_stuff_editpost() { wp_enqueue_script( array( 'suggest' ) ); } add_action( 'admin_enqueue_scripts', 'ame_enqueue_stuff_editpost' ); } /** * * @since 2.3.0 */ if( $current_page == 'edit-tags' ) { function ame_enqueue_stuff_edittags() { wp_enqueue_script( 'ame_gui-modificators', AME_PLUGINFULLURL . "js/gui-modificators.js", array( 'sack' ), AME_VERSION ); } add_action( 'admin_print_scripts', 'ame_js_admin_header' ); add_action( 'admin_enqueue_scripts', 'ame_enqueue_stuff_edittags' ); } } ?>