Simple Custom Post Order - Version 2.5.0

Version Description

Download this release

Release Info

Developer giucu91
Plugin Icon wp plugin Simple Custom Post Order
Version 2.5.0
Comparing to
See all releases

Code changes from version 2.4.9 to 2.5.0

assets/scporder.js CHANGED
@@ -32,29 +32,35 @@
32
  * Fix for table breaking
33
  */
34
  jQuery(window).load(function () {
35
- jQuery('#the-list').width(jQuery('#the-list').width());
36
 
37
  // make the array for the sizes
38
  var td_array = new Array();
39
  var i = 0;
40
  jQuery('#the-list tr:first-child').find('td').each(function () {
41
  td_array[i] = $(this).outerWidth();
 
42
  i += 1;
43
  });
44
 
45
  jQuery('#the-list').find('tr').each(function () {
46
  var j = 0;
47
  $(this).find('td').each(function () {
48
- $(this).width(td_array[j]);
49
  j += 1;
50
  });
51
  });
52
 
53
  var y = 0;
 
54
  // check if there are no items in the table
55
  if(jQuery('#the-list > tr.no-items').length == 0){
56
  jQuery('#the-list').parent().find('thead').find('th').each(function () {
57
- $(this).width(td_array[y]);
 
 
 
 
 
58
  y += 1;
59
  });
60
  }
32
  * Fix for table breaking
33
  */
34
  jQuery(window).load(function () {
 
35
 
36
  // make the array for the sizes
37
  var td_array = new Array();
38
  var i = 0;
39
  jQuery('#the-list tr:first-child').find('td').each(function () {
40
  td_array[i] = $(this).outerWidth();
41
+ $(this).css('padding','8px 0px');
42
  i += 1;
43
  });
44
 
45
  jQuery('#the-list').find('tr').each(function () {
46
  var j = 0;
47
  $(this).find('td').each(function () {
48
+ $(this).css('padding','8px 0px');
49
  j += 1;
50
  });
51
  });
52
 
53
  var y = 0;
54
+
55
  // check if there are no items in the table
56
  if(jQuery('#the-list > tr.no-items').length == 0){
57
  jQuery('#the-list').parent().find('thead').find('th').each(function () {
58
+ $(this).css('padding','8px 0px');
59
+ y += 1;
60
+ });
61
+
62
+ jQuery('#the-list').parent().find('tfoot').find('th').each(function () {
63
+ $(this).css('padding','8px 0px');
64
  y += 1;
65
  });
66
  }
class-simple-review.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Simple_Review {
4
+
5
+
6
+ private $value;
7
+ private $messages;
8
+ private $link = 'https://wordpress.org/plugins/simple-custom-post-order/#reviews';
9
+ private $slug = 'simple-custom-post-order';
10
+
11
+ function __construct() {
12
+
13
+ $this->messages = array(
14
+ 'notice' => esc_html__( "Hi there! Stoked to see you're using Simple Custom Post Order for a few days now - hope you like it! And if you do, please consider rating it. It would mean the world to us. Keep on rocking!", 'simple-custom-post-order' ),
15
+ 'rate' => esc_html__( 'Rate the plugin', 'simple-custom-post-order' ),
16
+ 'rated' => esc_html__( 'Remind me later', 'simple-custom-post-order' ),
17
+ 'no_rate' => esc_html__( 'Don\'t show again', 'simple-custom-post-order' ),
18
+ );
19
+
20
+ if ( isset( $args['messages'] ) ) {
21
+ $this->messages = wp_parse_args( $args['messages'], $this->messages );
22
+ }
23
+
24
+ add_action( 'init', array( $this, 'init' ) );
25
+
26
+ }
27
+
28
+ public function init() {
29
+ if ( ! is_admin() ) {
30
+ return;
31
+ }
32
+
33
+ $this->value = $this->value();
34
+
35
+ if ( $this->check() ) {
36
+ add_action( 'admin_notices', array( $this, 'five_star_wp_rate_notice' ) );
37
+ add_action( 'wp_ajax_epsilon_simple_review', array( $this, 'ajax' ) );
38
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
39
+ add_action( 'admin_print_footer_scripts', array( $this, 'ajax_script' ) );
40
+ }
41
+
42
+ }
43
+
44
+ private function check() {
45
+
46
+ if ( ! current_user_can('manage_options') ) {
47
+ return false;
48
+ }
49
+
50
+ return( time() > $this->value );
51
+
52
+ }
53
+
54
+ private function value() {
55
+
56
+ $value = get_option( 'simple-rate-time', false );
57
+
58
+ if ( $value ) {
59
+ return $value;
60
+ }
61
+
62
+ $value = time() + DAY_IN_SECONDS;
63
+ update_option( 'simple-rate-time', $value );
64
+
65
+ return $value;
66
+
67
+ }
68
+
69
+ public function five_star_wp_rate_notice() {
70
+
71
+ $url = sprintf( $this->link, $this->slug );
72
+
73
+ ?>
74
+ <div id="<?php echo esc_attr($this->slug) ?>-epsilon-review-notice" class="notice notice-success is-dismissible" style="margin-top:30px;">
75
+ <p><?php echo sprintf( esc_html( $this->messages['notice'] ), $this->value ) ; ?></p>
76
+ <p class="actions">
77
+ <a id="epsilon-rate" href="<?php echo esc_url( $url ) ?>" target="_blank" class="button button-primary epsilon-review-button">
78
+ <?php echo esc_html( $this->messages['rate'] ); ?>
79
+ </a>
80
+ <a id="epsilon-later" href="#" style="margin-left:10px" class="epsilon-review-button"><?php echo esc_html( $this->messages['rated'] ); ?></a>
81
+ <a id="epsilon-no-rate" href="#" style="margin-left:10px" class="epsilon-review-button"><?php echo esc_html( $this->messages['no_rate'] ); ?></a>
82
+ </p>
83
+ </div>
84
+ <?php
85
+ }
86
+
87
+ public function ajax() {
88
+
89
+ check_ajax_referer( 'epsilon-simple-review', 'security' );
90
+
91
+ if ( ! isset( $_POST['check'] ) ) {
92
+ wp_die( 'ok' );
93
+ }
94
+
95
+ $time = get_option( 'simple-rate-time' );
96
+
97
+ if ( 'epsilon-rate' == $_POST['check'] ) {
98
+ $time = time() + YEAR_IN_SECONDS * 5;
99
+ }elseif ( 'epsilon-later' == $_POST['check'] ) {
100
+ $time = time() + WEEK_IN_SECONDS;
101
+ }elseif ( 'epsilon-no-rate' == $_POST['check'] ) {
102
+ $time = time() + YEAR_IN_SECONDS * 5;
103
+ }
104
+
105
+ update_option( 'simple-rate-time', $time );
106
+ wp_die( 'ok' );
107
+
108
+ }
109
+
110
+ public function enqueue() {
111
+ wp_enqueue_script( 'jquery' );
112
+ }
113
+
114
+ public function ajax_script() {
115
+
116
+ $ajax_nonce = wp_create_nonce( "epsilon-simple-review" );
117
+
118
+ ?>
119
+
120
+ <script type="text/javascript">
121
+ jQuery( document ).ready( function( $ ){
122
+
123
+ $( '.epsilon-review-button' ).click( function( evt ){
124
+ var href = $(this).attr('href'),
125
+ id = $(this).attr('id');
126
+
127
+ if ( 'epsilon-rate' != id ) {
128
+ evt.preventDefault();
129
+ }
130
+
131
+ var data = {
132
+ action: 'epsilon_simple_review',
133
+ security: '<?php echo $ajax_nonce; ?>',
134
+ check: id
135
+ };
136
+
137
+ if ( 'epsilon-rated' === id || 'epsilon-rate' === id ) {
138
+ data['epsilon-review'] = 1;
139
+ }
140
+
141
+ $.post( '<?php echo admin_url( 'admin-ajax.php' ) ?>', data, function( response ) {
142
+ $( '#<?php echo $this->slug ?>-epsilon-review-notice' ).slideUp( 'fast', function() {
143
+ $( this ).remove();
144
+ } );
145
+ });
146
+
147
+ } );
148
+
149
+ $('#simple-custom-post-order-epsilon-review-notice .notice-dismiss').click(function(){
150
+
151
+ var data = {
152
+ action: 'epsilon_simple_review',
153
+ security: '<?php echo $ajax_nonce; ?>',
154
+ check: 'epsilon-later'
155
+ };
156
+
157
+ $.post( '<?php echo admin_url( 'admin-ajax.php' ) ?>', data, function( response ) {
158
+ $( '#<?php echo $this->slug ?>-epsilon-review-notice' ).slideUp( 'fast', function() {
159
+ $( this ).remove();
160
+ } );
161
+ });
162
+ });
163
+
164
+ });
165
+ </script>
166
+
167
+ <?php
168
+ }
169
+ }
170
+
171
+ new Simple_Review();
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: silkalns
3
  Tags: custom post order, post order, js post order, page order, posts order, category order, sort posts, sort pages, sort custom posts
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
- Tested up to: 5.3
7
- Stable tag: 2.4.9
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -36,6 +36,10 @@ An answer to that question.
36
 
37
  == Changelog ==
38
 
 
 
 
 
39
  = Version 2.4.9 =
40
  * Fixed "Post order not saving"
41
 
3
  Tags: custom post order, post order, js post order, page order, posts order, category order, sort posts, sort pages, sort custom posts
4
  Requires at least: 4.6
5
  Requires PHP: 5.6
6
+ Tested up to: 5.4
7
+ Stable tag: 2.5.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
36
 
37
  == Changelog ==
38
 
39
+ = Version 2.5.0 =
40
+ * Fixed post list table width when sorting is enabled
41
+ * Review dismiss fix
42
+
43
  = Version 2.4.9 =
44
  * Fixed "Post order not saving"
45
 
simple-custom-post-order.php CHANGED
@@ -3,10 +3,10 @@
3
  * Plugin Name: Simple Custom Post Order
4
  * Plugin URI: https://wordpress.org/plugins-wp/simple-custom-post-order/
5
  * Description: Order Items (Posts, Pages, and Custom Post Types) using a Drag and Drop Sortable JavaScript.
6
- * Version: 2.4.9
7
  * Author: Colorlib
8
  * Author URI: https://colorlib.com/
9
- * Tested up to: 5.3
10
  * Requires: 4.6 or higher
11
  * License: GPLv3 or later
12
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -36,7 +36,7 @@
36
 
37
  define('SCPORDER_URL', plugins_url('', __FILE__));
38
  define('SCPORDER_DIR', plugin_dir_path(__FILE__));
39
- define('SCPORDER_VERSION', '2.4.9');
40
 
41
  $scporder = new SCPO_Engine();
42
 
@@ -46,6 +46,8 @@ class SCPO_Engine {
46
  if (!get_option('scporder_install'))
47
  $this->scporder_install();
48
 
 
 
49
  add_action('admin_menu', array($this, 'admin_menu'));
50
 
51
  add_action('admin_init', array( $this, 'refresh' ) );
@@ -77,6 +79,10 @@ class SCPO_Engine {
77
  add_action('wp_ajax_scpo_reset_order', array($this, 'scpo_ajax_reset_order'));
78
  }
79
 
 
 
 
 
80
  public function scpo_filter_post_types($args,$options){
81
 
82
  if(isset($options['show_advanced_view']) && '1' == $options['show_advanced_view'] ){
@@ -674,4 +680,4 @@ function scporder_uninstall_db() {
674
  $result = $wpdb->query($query);
675
  }
676
  delete_option('scporder_install');
677
- }
3
  * Plugin Name: Simple Custom Post Order
4
  * Plugin URI: https://wordpress.org/plugins-wp/simple-custom-post-order/
5
  * Description: Order Items (Posts, Pages, and Custom Post Types) using a Drag and Drop Sortable JavaScript.
6
+ * Version: 2.5.0
7
  * Author: Colorlib
8
  * Author URI: https://colorlib.com/
9
+ * Tested up to: 5.4
10
  * Requires: 4.6 or higher
11
  * License: GPLv3 or later
12
  * License URI: http://www.gnu.org/licenses/gpl-3.0.html
36
 
37
  define('SCPORDER_URL', plugins_url('', __FILE__));
38
  define('SCPORDER_DIR', plugin_dir_path(__FILE__));
39
+ define('SCPORDER_VERSION', '2.5.0');
40
 
41
  $scporder = new SCPO_Engine();
42
 
46
  if (!get_option('scporder_install'))
47
  $this->scporder_install();
48
 
49
+ $this->load_dependencies();
50
+
51
  add_action('admin_menu', array($this, 'admin_menu'));
52
 
53
  add_action('admin_init', array( $this, 'refresh' ) );
79
  add_action('wp_ajax_scpo_reset_order', array($this, 'scpo_ajax_reset_order'));
80
  }
81
 
82
+ private function load_dependencies() {
83
+ include SCPORDER_DIR . 'class-simple-review.php';
84
+ }
85
+
86
  public function scpo_filter_post_types($args,$options){
87
 
88
  if(isset($options['show_advanced_view']) && '1' == $options['show_advanced_view'] ){
680
  $result = $wpdb->query($query);
681
  }
682
  delete_option('scporder_install');
683
+ }