/** * 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('<a href=\"javascript:void(0);\" onclick=\"ame_ajax_set_sticky(" . $postid . ");return false;\"><img src=\"" . AME_PLUGINFULLURL . "img/" . AME_IMGSET . "nosticky.png\" border=\"0\" alt=\"" . __('Stick this post to the front page') . "\" title=\"" . __('Stick this post to the front page') . "\" /></a>');jQuery('#post-" . $postid . " td, #post-" . $postid . " th').animate( { backgroundColor: '#EAF3FA' }, 300).animate( { backgroundColor: '#F9F9F9' }, 300).animate( { backgroundColor: '#EAF3FA' }, 300).animate( { backgroundColor: '#F9F9F9' }, 300);jQuery('#post-" . $postid . "');"); } else { stick_post($postid); AdminManagementXtended::fireActions('post', $postid, $post); die("jQuery('#stickyicon" . $postid . "').html('<a href=\"javascript:void(0);\" onclick=\"ame_ajax_set_sticky(" . $postid . ");return false;\"><img src=\"" . AME_PLUGINFULLURL . "img/" . AME_IMGSET . "sticky.png\" border=\"0\" alt=\"" . __('Stick this post to the front page') . "\" title=\"" . __('Stick this post to the front page') . "\" /></a>');jQuery('#post-" . $postid . " td, #post-" . $postid . " th').animate( { backgroundColor: '#EAF3FA' }, 300).animate( { backgroundColor: '#F9F9F9' }, 300).animate( { backgroundColor: '#EAF3FA' }, 300).animate( { backgroundColor: '#F9F9F9' }, 300);jQuery('#post-" . $postid . "');"); } }
/** * 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('" . js_escape(__('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('<a href=\"javascript:void(0);\" onclick=\"ame_ajax_set_visibility(" . $catid . ", \\'draft\\', \\'" . $posttype . "\\');return false;\"><img src=\"" . AME_PLUGINFULLURL . "img/" . AME_IMGSET . "visible.png\" border=\"0\" alt=\"" . __('Toggle visibility', 'admin-management-xtended') . "\" title=\"" . __('Toggle visibility', 'admin-management-xtended') . "\" /></a>');jQuery('#" . $posttype . "-" . $catid . " td, #" . $posttype . "-" . $catid . " th').animate( { backgroundColor: '#EAF3FA' }, 300).animate( { backgroundColor: '#F9F9F9' }, 300).animate( { backgroundColor: '#EAF3FA' }, 300).animate( { backgroundColor: '#F9F9F9' }, 300);jQuery('#" . $posttype . "-" . $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('<a href=\"javascript:void(0);\" onclick=\"ame_ajax_set_visibility(" . $catid . ", \\'publish\\', \\'" . $posttype . "\\');return false;\"><img src=\"" . AME_PLUGINFULLURL . "img/" . AME_IMGSET . "hidden.png\" border=\"0\" alt=\"" . __('Toggle visibility', 'admin-management-xtended') . "\" title=\"" . __('Toggle visibility', 'admin-management-xtended') . "\" /></a>');jQuery('#" . $posttype . "-" . $catid . " td, #" . $posttype . "-" . $catid . " th').animate( { backgroundColor: '#EAF3FA' }, 300).animate( { backgroundColor: '#F9F9F9' }, 300).animate( { backgroundColor: '#EAF3FA' }, 300).animate( { backgroundColor: '#F9F9F9' }, 300);jQuery('#" . $posttype . "-" . $catid . "').removeClass('status-publish').addClass('status-draft');"); } }