WordPress.org

Plugin Directory

Changeset 373126


Ignore:
Timestamp:
04/15/11 02:33:40 (3 years ago)
Author:
bergius
Message:

fixes a problem with scheduled posts not updating the date, removes left and right parameters and minifies nestedSortable

Location:
cms-page-order/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cms-page-order/trunk/cms-page-order.php

    r373093 r373126  
    44Plugin URI: http://wordpress.org/extend/plugins/cms-page-order/ 
    55Description: Change the page order with quick and easy drag and drop. 
    6 Version: 0.1.1 
     6Version: 0.1.2 
    77Author: Tobias Bergius 
    88Author URI: http://tobiasbergius.se/ 
     
    2323         
    2424*/ 
    25 /* 
    26  * Todo: 
    27  * 
    28  * - Dropdown for post states (set as another state) 
    29  * - Check conflicts on each update 
    30  * - Set admin notice on update? 
    31  * 
    32 */ 
    33  
    34 define( 'CMSPO_VERSION', '0.1.1' ); 
     25 
     26define( 'CMSPO_VERSION', '0.1.2' ); 
    3527define( 'CMSPO_URL', WP_PLUGIN_URL . '/cms-page-order/' ); 
    3628 
     
    6052    wp_enqueue_script( 'jquery-ui-sortable', '', array('jquery'), false ); 
    6153    wp_enqueue_script( 'jquery-ui-effects', '', array('jquery', 'jquery-ui'), false ); 
    62     wp_enqueue_script( 'jquery-ui-nestedsortable', CMSPO_URL . 'scripts/jquery.ui.nestedSortable.js', array('jquery', 'jquery-ui-sortable'), '1.3.3' ); 
     54    wp_enqueue_script( 'jquery-ui-nestedsortable', CMSPO_URL . 'scripts/jquery.ui.nestedSortable-1.3.3.min.js', array('jquery', 'jquery-ui-sortable') ); 
    6355    wp_enqueue_script( 'cms-page-order', CMSPO_URL . 'scripts/cms-page-order.js', array('jquery', 'jquery-ui-sortable', 'jquery-ui-nestedsortable'), CMSPO_VERSION ); 
    6456    wp_register_style( 'cmspo_stylesheet', CMSPO_URL . 'styles/style.css', '', CMSPO_VERSION ); 
     
    115107        $order[1] = 1; 
    116108         
    117         foreach ( $_REQUEST['order'] as $i => $page ) { 
    118              
     109        foreach ( $_REQUEST['order'] as $page ) {            
    119110            $post_id = (int) $page['item_id']; 
    120111            if ($page['parent_id'] == 'root') 
     
    136127             
    137128            $wpdb->update( $wpdb->posts, $data, $where ); 
    138             clean_page_cache($post_id); 
     129            clean_page_cache( $post_id ); 
    139130             
    140131            $order[$page['depth']]++; 
    141132        } 
    142133        global $wp_rewrite; 
    143         $wp_rewrite->flush_rules(false); 
     134        $wp_rewrite->flush_rules( false ); 
    144135    } 
    145136    die(); 
     
    152143    global $wpdb; 
    153144    $state = $_REQUEST['state']; 
    154     $post = $_REQUEST['post']; 
     145    $post_id = $_REQUEST['post']; 
    155146    $not_published = array( 'draft', 'pending', 'private', 'future' ); 
    156          
    157     if ( in_array( $state, $not_published ) ) { 
    158         wp_publish_post($post); 
    159     } 
    160     elseif ( $state == 'password' ) { 
    161         wp_update_post( array( 'ID' => $post, 'post_password' => '' ) ); 
     147     
     148    switch ( $state ) { 
     149        case 'future' : 
     150            $post_date = current_time( 'mysql' ); 
     151            $data = array( 
     152                    'ID' => $post_id, 
     153                    'post_date' => current_time( 'mysql' ), 
     154                    'post_date_gmt' => get_gmt_from_date( $post_date ), 
     155                    'post_status' => 'publish' 
     156            ); 
     157            wp_update_post( $data ); 
     158            break; 
     159        case 'password' : 
     160            wp_update_post( array( 'ID' => $post_id, 'post_password' => '' ) ); 
     161            break; 
     162        default : 
     163            wp_publish_post( $post_id ); 
    162164    } 
    163165    die(); 
     
    340342            } 
    341343             
     344            // Set date_i18n( __( 'M j Y @ H:i' ), strtotime( $page->post_date ) ) as title on scheduled posts 
    342345            $state_labels = null; 
    343346            foreach ( $page_states as $state => $state_name ) { 
  • cms-page-order/trunk/readme.txt

    r373093 r373126  
    55Requires at least: 3.1 
    66Tested up to: 3.2 
    7 Stable tag: 0.1.1 
     7Stable tag: 0.1.2 
    88 
    99Change the page order with quick and easy drag and drop. 
     
    4343== Changelog == 
    4444 
     45= 0.1.2 = 
     46* Fixes a problem with scheduled posts not updating the date when transitioning to publish status 
     47* Page order number now respects depth (resets to 1 at every new level) 
     48* Removing left and right parameters in order array 
     49* Minified nestedSortable 
     50 
    4551= 0.1.1 = 
    4652* Fixes a problem with permalinks not updating 
  • cms-page-order/trunk/scripts/cms-page-order.js

    r371219 r373126  
    2323    // Save changes 
    2424    function saveTree(ui) { 
    25         if ( typeof ui != 'undefined' && typeof ui !== 'undefined' ) 
     25        if ( typeof ui != 'undefined' && typeof ui !== 'undefined' ) { 
    2626            var order = $('.cmspo-sortable').nestedSortable('toArray'); 
     27            for ( var key in order ) { 
     28                delete order[key]['left']; 
     29                delete order[key]['right']; 
     30            } 
     31        } 
    2732         
    2833        var state = new Array(); 
Note: See TracChangeset for help on using the changeset viewer.