Post Types Order - Version 1.9.3.6

Version Description

  • Clear LiteSpeed Cache on order update to reflect on front side
    • WordPress 4.9.1 tag update
Download this release

Release Info

Developer nsp-code
Plugin Icon 128x128 Post Types Order
Version 1.9.3.6
Comparing to
See all releases

Code changes from version 1.9.3.5 to 1.9.3.6

compatibility/LiteSpeed_Cache.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ class PTO_LiteSpeed_Cache
5
+ {
6
+
7
+ function __construct()
8
+ {
9
+
10
+ if( !is_plugin_active( 'litespeed-cache/litespeed-cache.php' ))
11
+ return false;
12
+
13
+ add_action( 'PTO/order_update_complete', array( $this, 'order_update_complete') );
14
+ }
15
+
16
+
17
+ function order_update_complete()
18
+ {
19
+
20
+ if( method_exists( 'LiteSpeed_Cache_API', 'purge_all' ) )
21
+ {
22
+ LiteSpeed_Cache_API::purge_all() ;
23
+ }
24
+
25
+ }
26
+
27
+ }
28
+
29
+ new PTO_LiteSpeed_Cache();
30
+
31
+
32
+ ?>
include/class.cpto.php CHANGED
@@ -34,7 +34,7 @@
34
  include_once(CPTPATH . '/include/class.walkers.php');
35
 
36
  add_action( 'admin_init', array(&$this, 'registerFiles'), 11 );
37
- add_action( 'admin_init', array(&$this, 'checkPost'), 10 );
38
  add_action( 'admin_menu', array(&$this, 'addMenu') );
39
 
40
  add_action('admin_menu', array(&$this, 'plugin_options_menu'));
@@ -303,7 +303,7 @@
303
  wp_enqueue_style( 'CPTStyleSheets');
304
  }
305
 
306
- function checkPost()
307
  {
308
  if ( isset($_GET['page']) && substr($_GET['page'], 0, 17) == 'order-post-types-' )
309
  {
@@ -313,6 +313,10 @@
313
  wp_die('Invalid post type');
314
  }
315
  }
 
 
 
 
316
  }
317
 
318
 
@@ -336,37 +340,43 @@
336
  parse_str($_POST['order'], $data);
337
 
338
  if (is_array($data))
339
- foreach($data as $key => $values )
340
  {
341
- if ( $key == 'item' )
342
  {
343
- foreach( $values as $position => $id )
344
  {
345
-
346
- //sanitize
347
- $id = (int)$id;
348
-
349
- $data = array('menu_order' => $position);
350
- $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
351
-
352
- $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
 
 
 
353
  }
354
- }
355
- else
356
- {
357
- foreach( $values as $position => $id )
358
  {
359
-
360
- //sanitize
361
- $id = (int)$id;
362
-
363
- $data = array('menu_order' => $position, 'post_parent' => str_replace('item_', '', $key));
364
- $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
365
-
366
- $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
 
 
 
367
  }
368
  }
 
369
  }
 
 
 
370
  }
371
 
372
 
@@ -436,6 +446,9 @@
436
 
437
  $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
438
  }
 
 
 
439
 
440
  }
441
 
34
  include_once(CPTPATH . '/include/class.walkers.php');
35
 
36
  add_action( 'admin_init', array(&$this, 'registerFiles'), 11 );
37
+ add_action( 'admin_init', array(&$this, 'admin_init'), 10 );
38
  add_action( 'admin_menu', array(&$this, 'addMenu') );
39
 
40
  add_action('admin_menu', array(&$this, 'plugin_options_menu'));
303
  wp_enqueue_style( 'CPTStyleSheets');
304
  }
305
 
306
+ function admin_init()
307
  {
308
  if ( isset($_GET['page']) && substr($_GET['page'], 0, 17) == 'order-post-types-' )
309
  {
313
  wp_die('Invalid post type');
314
  }
315
  }
316
+
317
+ //add compatibility filters and code
318
+ include_once(CPTPATH . '/compatibility/LiteSpeed_Cache.php');
319
+
320
  }
321
 
322
 
340
  parse_str($_POST['order'], $data);
341
 
342
  if (is_array($data))
 
343
  {
344
+ foreach($data as $key => $values )
345
  {
346
+ if ( $key == 'item' )
347
  {
348
+ foreach( $values as $position => $id )
349
+ {
350
+
351
+ //sanitize
352
+ $id = (int)$id;
353
+
354
+ $data = array('menu_order' => $position);
355
+ $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
356
+
357
+ $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
358
+ }
359
  }
360
+ else
 
 
 
361
  {
362
+ foreach( $values as $position => $id )
363
+ {
364
+
365
+ //sanitize
366
+ $id = (int)$id;
367
+
368
+ $data = array('menu_order' => $position, 'post_parent' => str_replace('item_', '', $key));
369
+ $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
370
+
371
+ $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
372
+ }
373
  }
374
  }
375
+
376
  }
377
+
378
+ //trigger action completed
379
+ do_action('PTO/order_update_complete');
380
  }
381
 
382
 
446
 
447
  $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
448
  }
449
+
450
+ //trigger action completed
451
+ do_action('PTO/order_update_complete');
452
 
453
  }
454
 
post-types-order.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.nsp-code.com
5
  Description: Posts Order and Post Types Objects Order using a Drag and Drop Sortable javascript capability
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
- Version: 1.9.3.5
9
  Text Domain: post-types-order
10
  Domain Path: /languages/
11
  */
5
  Description: Posts Order and Post Types Objects Order using a Drag and Drop Sortable javascript capability
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
+ Version: 1.9.3.6
9
  Text Domain: post-types-order
10
  Domain Path: /languages/
11
  */
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nsp-code, tdgu
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: post order, posts order, sort, post sort, posts sort, post type order, custom order, admin posts order
5
  Requires at least: 2.8
6
- Tested up to: 4.8.1
7
- Stable tag: 1.9.3.5
8
 
9
  Post Order and custom Post Type Objects (custom post types) using a Drag and Drop Sortable JavaScript AJAX interface or default WordPress dashboard.
10
 
@@ -94,6 +94,10 @@ Consider upgrading to our advanced version of this plugin at a very resonable pr
94
 
95
  == Change Log ==
96
 
 
 
 
 
97
  = 1.9.3.5 =
98
  - Fix: updated capability from switch_theme to manage_options within 'Minimum Level to use this plugin' option
99
  - Default admin capability changed from install_plugins to manage_options to prevent DISALLOW_FILE_MODS issue. https://wordpress.org/support/topic/plugin-breaks-when-disallow_file_mods-is-set-to-true/
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: post order, posts order, sort, post sort, posts sort, post type order, custom order, admin posts order
5
  Requires at least: 2.8
6
+ Tested up to: 4.9.1
7
+ Stable tag: 1.9.3.6
8
 
9
  Post Order and custom Post Type Objects (custom post types) using a Drag and Drop Sortable JavaScript AJAX interface or default WordPress dashboard.
10
 
94
 
95
  == Change Log ==
96
 
97
+ = 1.9.3.6 =
98
+ - Clear LiteSpeed Cache on order update to reflect on front side
99
+ - WordPress 4.9.1 tag update
100
+
101
  = 1.9.3.5 =
102
  - Fix: updated capability from switch_theme to manage_options within 'Minimum Level to use this plugin' option
103
  - Default admin capability changed from install_plugins to manage_options to prevent DISALLOW_FILE_MODS issue. https://wordpress.org/support/topic/plugin-breaks-when-disallow_file_mods-is-set-to-true/