Content Views – Post Grid & List for WordPress - Version 1.9.9

Version Description

  • 2017/06/09 =
  • Compatible Fix: Posts of excluded categories in "Ultimate category excluder" plugin don't show in View output
  • Update: Remove SESSION usage & relative functions
  • Improvement: Cleanup View transients from database
Download this release

Release Info

Developer PT Guy
Plugin Icon 128x128 Content Views – Post Grid & List for WordPress
Version 1.9.9
Comparing to
See all releases

Code changes from version 1.9.8.21 to 1.9.9

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: PT Guy
3
  Donate link: https://www.contentviewspro.com/pricing/?utm_source=wporg&utm_medium=link&utm_campaign=donate
4
  Tags: post, posts, page, pages, grid, author, category, categories, tag, responsive, title, thumbnail, content
5
  Requires at least: 3.3
6
- Tested up to: 4.7.5
7
- Stable tag: 1.9.8.21
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -118,6 +118,11 @@ If you are using "Your latest posts" as home page, you should paste this code `<
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
121
  = 1.9.8.21 - 2017/05/24 =
122
  * New: Add setting to not wrap text around image (when show thumbnail on the left/right of text)
123
  * Tweak: Add class to each pagination item
3
  Donate link: https://www.contentviewspro.com/pricing/?utm_source=wporg&utm_medium=link&utm_campaign=donate
4
  Tags: post, posts, page, pages, grid, author, category, categories, tag, responsive, title, thumbnail, content
5
  Requires at least: 3.3
6
+ Tested up to: 4.8
7
+ Stable tag: 1.9.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
118
 
119
  == Changelog ==
120
 
121
+ = 1.9.9 - 2017/06/09 =
122
+ * Compatible Fix: Posts of excluded categories in "Ultimate category excluder" plugin don't show in View output
123
+ * Update: Remove SESSION usage & relative functions
124
+ * Improvement: Cleanup View transients from database
125
+
126
  = 1.9.8.21 - 2017/05/24 =
127
  * New: Add setting to not wrap text around image (when show thumbnail on the left/right of text)
128
  * Tweak: Add class to each pagination item
admin/assets/js/admin.js CHANGED
@@ -188,6 +188,8 @@
188
  } );
189
  } );
190
  } );
 
 
191
  },
192
  /**
193
  * Toggle each dependency group
188
  } );
189
  } );
190
  } );
191
+
192
+ $( '.pt-wrap' ).trigger( 'finish-do-dependence' );
193
  },
194
  /**
195
  * Toggle each dependency group
admin/views/view.php CHANGED
@@ -437,7 +437,7 @@ PT_CV_Functions::view_submit();
437
  // Keyword Settings
438
  'search' => array(
439
  'parent_label' => sprintf( __( 'Filter by %s', 'content-views-query-and-display-post-page' ), __( 'Keyword' ) ),
440
- array(
441
  'label' => array(
442
  'text' => '',
443
  ),
@@ -454,7 +454,7 @@ PT_CV_Functions::view_submit();
454
  'desc' => __( 'Enter keyword to searching for posts', 'content-views-query-and-display-post-page' ) . apply_filters( PT_CV_PREFIX_ . 'searchby_keyword_desc', '' ) . '<br>' . __( 'It will search keyword in title, excerpt, content of posts', 'content-views-query-and-display-post-page' ),
455
  ),
456
  ),
457
- ),
458
  ), // End Keyword Settings
459
  )
460
  ),
437
  // Keyword Settings
438
  'search' => array(
439
  'parent_label' => sprintf( __( 'Filter by %s', 'content-views-query-and-display-post-page' ), __( 'Keyword' ) ),
440
+ apply_filters( PT_CV_PREFIX_ . 'search_settings', array(
441
  'label' => array(
442
  'text' => '',
443
  ),
454
  'desc' => __( 'Enter keyword to searching for posts', 'content-views-query-and-display-post-page' ) . apply_filters( PT_CV_PREFIX_ . 'searchby_keyword_desc', '' ) . '<br>' . __( 'It will search keyword in title, excerpt, content of posts', 'content-views-query-and-display-post-page' ),
455
  ),
456
  ),
457
+ ) ),
458
  ), // End Keyword Settings
459
  )
460
  ),
content-views.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
- * Version: 1.9.8.21
14
  * Author: PT Guy
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views-query-and-display-post-page
@@ -25,13 +25,12 @@ if ( !defined( 'ABSPATH' ) ) {
25
  }
26
 
27
  // Define Constant
28
- define( 'PT_CV_VERSION', '1.9.8.21' );
29
  define( 'PT_CV_FILE', __FILE__ );
30
  define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
31
  include_once( PT_CV_PATH . 'includes/defines.php' );
32
 
33
  // Include library files
34
- include_once( PT_CV_PATH . 'includes/_session.php' );
35
  include_once( PT_CV_PATH . 'includes/formatting.php' );
36
  include_once( PT_CV_PATH . 'includes/assets.php' );
37
  include_once( PT_CV_PATH . 'includes/compatibility.php' );
10
  * Plugin Name: Content Views
11
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
12
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
13
+ * Version: 1.9.9
14
  * Author: PT Guy
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views-query-and-display-post-page
25
  }
26
 
27
  // Define Constant
28
+ define( 'PT_CV_VERSION', '1.9.9' );
29
  define( 'PT_CV_FILE', __FILE__ );
30
  define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
31
  include_once( PT_CV_PATH . 'includes/defines.php' );
32
 
33
  // Include library files
 
34
  include_once( PT_CV_PATH . 'includes/formatting.php' );
35
  include_once( PT_CV_PATH . 'includes/assets.php' );
36
  include_once( PT_CV_PATH . 'includes/compatibility.php' );
includes/_session.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- /**
3
- * Session management
4
- * @since 1.9.0
5
- */
6
- if ( !class_exists( 'CV_Session' ) ) {
7
-
8
- class CV_Session {
9
-
10
- static function _enabled() {
11
- return apply_filters( PT_CV_PREFIX_ . 'session_enable', true );
12
- }
13
-
14
- static function start() {
15
- if ( self::_enabled() && !headers_sent() && !session_id() && @is_writable( session_save_path() ) ) {
16
- @session_start();
17
- }
18
- }
19
-
20
- static function get( $key, $default = false ) {
21
- if ( self::_enabled() && isset( $_SESSION[ $key ] ) ) {
22
- $val = $_SESSION[ $key ];
23
- } else {
24
- $trans = get_transient( $key );
25
- $val = $trans ? $trans : $default;
26
- }
27
-
28
- return $val;
29
- }
30
-
31
- static function set( $key, $val ) {
32
- if ( self::_enabled() && self::_valid() ) {
33
- $_SESSION[ $key ] = $val;
34
- }
35
-
36
- if ( !self::_enabled() || !isset( $_SESSION[ $key ] ) ) {
37
- set_transient( $key, $val, HOUR_IN_SECONDS );
38
- }
39
- }
40
-
41
- static function _valid() {
42
- $sid = session_id();
43
- if ( $sid === "" ) {
44
- return false;
45
- } else {
46
- return preg_match( '/[^-,a-zA-Z0-9]+/', $sid ) === 0;
47
- }
48
- }
49
-
50
- }
51
-
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/compatibility.php CHANGED
@@ -141,3 +141,44 @@ if ( function_exists( 'opRemoveStyles' ) ) {
141
  remove_action( 'wp_print_styles', 'opRemoveStyles', 10 );
142
  }
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  remove_action( 'wp_print_styles', 'opRemoveStyles', 10 );
142
  }
143
 
144
+ add_action( PT_CV_PREFIX_ . 'before_query', 'cv_comp_action_before_query' );
145
+ function cv_comp_action_before_query() {
146
+ /* Fix: Posts don't appear in View output, when excludes categories by "Ultimate category excluder" plugin
147
+ * @since 1.9.9
148
+ */
149
+ if ( function_exists( 'ksuce_exclude_categories' ) ) {
150
+ remove_filter( 'pre_get_posts', 'ksuce_exclude_categories' );
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Backup & restore View settings for pagination
156
+ * @param string $action
157
+ * @param array $view_settings
158
+ */
159
+ function cv_comp_pagination_settings( $action, $view_settings ) {
160
+ global $cv_unique_id;
161
+ if ( $action === 'set' ) {
162
+ $key = $case = '';
163
+
164
+ if ( defined( 'PT_CV_DOING_PREVIEW' ) ) {
165
+ $key = 'preview';
166
+ $case = 'preview';
167
+ } elseif ( isset( $view_settings[ PT_CV_PREFIX . 'rebuild' ] ) ) {
168
+ global $wp_query;
169
+ $key = $wp_query->query_vars_hash;
170
+ $case = 'rebuild';
171
+ } else if ( defined( 'PT_CV_VIEW_REUSE' ) || PT_CV_Functions::get_global_variable( 'reused_view' ) ) {
172
+ $key = md5( serialize( $view_settings[ PT_CV_PREFIX . 'shortcode_atts' ] ) );
173
+ $case = 'reuse';
174
+ }
175
+
176
+ if ( isset( $key, $case ) ) {
177
+ $cv_unique_id = $key;
178
+ set_transient( PT_CV_PREFIX . 'view-settings-' . $cv_unique_id, $view_settings, 30 * MINUTE_IN_SECONDS );
179
+ }
180
+ } else if ( $action === 'get' ) {
181
+ $cv_unique_id = cv_sanitize_vid( $_POST[ 'unid' ] );
182
+ return get_transient( PT_CV_PREFIX . 'view-settings-' . $cv_unique_id );
183
+ }
184
+ }
includes/functions.php CHANGED
@@ -642,23 +642,6 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
642
  $content_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $view_settings );
643
  $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $view_settings );
644
  $current_page = self::get_current_page( $pargs );
645
- $rebuild = isset( $view_settings[ PT_CV_PREFIX . 'rebuild' ] ) ? $view_settings[ PT_CV_PREFIX . 'rebuild' ] : false;
646
- $vdata_key = PT_CV_PREFIX . 'view-data-' . $pt_cv_id;
647
-
648
- /**
649
- * Unique ID for each View instance (even they use same ID but different parameters when reuse View),
650
- * to set & get correct View data for pagination
651
- *
652
- * @since 1.9.5
653
- */
654
- global $cv_unique_id;
655
- # Reset on 1st page
656
- if ( !defined( 'PT_CV_DOING_PAGINATION' ) ) {
657
- $cv_unique_id = PT_CV_Functions::string_random();
658
- }
659
- if ( $cv_unique_id ) {
660
- $vdata_key.= '-' . $cv_unique_id;
661
- }
662
 
663
  $pt_cv_glb[ $pt_cv_id ][ 'content_type' ] = $content_type;
664
  $pt_cv_glb[ $pt_cv_id ][ 'view_type' ] = $view_type;
@@ -667,25 +650,15 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
667
  # Important: store current View ID, prevent it from being modified when process posts which contains View shortcode
668
  $cv_live_id = $view_id;
669
 
670
- if ( defined( 'PT_CV_DOING_PAGINATION' ) ) {
671
- $sdata = CV_Session::get( $vdata_key, array( 'args' => '', 'dargs' => '', 'shortcode_params' => '' ) );
672
- $args = $sdata[ 'args' ];
673
- $dargs = $sdata[ 'dargs' ];
674
- $sc_params = $sdata[ 'shortcode_params' ];
675
- }
676
-
677
- if ( empty( $args ) || empty( $dargs ) ) {
678
- $dargs = PT_CV_Functions::view_display_settings( $view_type, $dargs );
679
- $args = $rebuild ? $rebuild : PT_CV_Functions::view_filter_settings( $content_type, $view_settings );
680
 
681
- // Store view data before get pagination settings
682
- CV_Session::set( $vdata_key, array(
683
- 'args' => $args,
684
- 'dargs' => $dargs,
685
- 'shortcode_params' => $sc_params,
686
- ) );
687
  }
688
-
689
  $pt_cv_glb[ $pt_cv_id ][ 'shortcode_params' ] = $sc_params;
690
 
691
  PT_CV_Functions::view_get_pagination_settings( $dargs, $args, $pargs );
@@ -721,15 +694,13 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
721
  $html = PT_CV_Html::content_items_wrap( $content_items, $current_page, $args[ 'posts_per_page' ], $pt_cv_id );
722
 
723
  // Show pagination
724
- if ( $pt_query && PT_CV_Functions::nonajax_or_firstpage( $dargs, $current_page ) ) {
725
- // Save settings for reusing in pagination
726
- CV_Session::set( PT_CV_PREFIX . 'view-settings-' . $pt_cv_id, $settings );
727
-
728
  // Total post founds
729
  $found_posts = (int) apply_filters( PT_CV_PREFIX_ . 'found_posts', $pt_query->found_posts );
730
 
731
  // Total number of items
732
  $total_items = ( $args[ 'limit' ] > 0 && $found_posts > $args[ 'limit' ] ) ? $args[ 'limit' ] : $found_posts;
 
733
 
734
  // Total number of pages
735
  $items_per_page = (int) PT_CV_Functions::setting_value( PT_CV_PREFIX . 'pagination-items-per-page', $view_settings );
@@ -738,6 +709,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
738
 
739
  // Output pagination
740
  if ( $max_num_pages > 1 ) {
 
 
741
  $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $current_page, $pt_cv_id );
742
  } else {
743
  if ( $max_num_pages == 1 && defined( 'PT_CV_DOING_PREVIEW' ) ) {
@@ -764,6 +737,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
764
  static function get_posts_list( $args, $view_type ) {
765
  $empty_result = false;
766
  $content_items = array();
 
767
 
768
  // The Query
769
  do_action( PT_CV_PREFIX_ . 'before_query' );
@@ -1057,15 +1031,13 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1057
 
1058
  $pagination = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'enable-pagination', $view_settings );
1059
  if ( $pagination ) {
1060
- $prefix = PT_CV_PREFIX . 'pagination-';
1061
- $field_setting = PT_CV_Functions::settings_values_by_prefix( $prefix );
1062
-
1063
- $dargs[ 'pagination-settings' ] = apply_filters( PT_CV_PREFIX_ . 'pagination_settings', $field_setting, $prefix );
1064
  if ( !isset( $dargs[ 'pagination-settings' ][ 'type' ] ) ) {
1065
  $dargs[ 'pagination-settings' ][ 'type' ] = 'ajax';
1066
  }
1067
 
1068
- // Fix grid bug for CVP < 3.5.6
1069
  if ( $dargs[ 'pagination-settings' ][ 'type' ] === 'normal' ) {
1070
  $dargs[ 'pagination-settings' ][ 'style' ] = '';
1071
  }
@@ -1093,10 +1065,9 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1093
  * @param array $dargs The settings array of Fields
1094
  */
1095
  static function view_get_other_settings( &$dargs ) {
1096
- $prefix = PT_CV_PREFIX . 'other-';
1097
- $field_setting = PT_CV_Functions::settings_values_by_prefix( $prefix );
1098
-
1099
- $dargs[ 'other-settings' ] = apply_filters( PT_CV_PREFIX_ . 'other_settings', $field_setting );
1100
  }
1101
 
1102
  /**
@@ -1151,8 +1122,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1151
  if ( $id && !self::duplicated_process( $id, $atts ) ) {
1152
  $settings = PT_CV_Functions::view_get_settings( $id );
1153
  $view_html = PT_CV_Functions::view_process_settings( $id, $settings, null, $atts );
1154
-
1155
- $result = PT_CV_Functions::view_final_output( $view_html );
1156
  do_action( PT_CV_PREFIX_ . 'flushed_output', $result );
1157
 
1158
  return $result;
@@ -1200,12 +1170,12 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1200
 
1201
  if ( !empty( $_POST[ 'data' ] ) ) {
1202
  define( 'PT_CV_DOING_PREVIEW', true );
1203
-
1204
  do_action( PT_CV_PREFIX_ . 'preview_header' );
1205
 
1206
- $settings = array();
1207
  parse_str( $_POST[ 'data' ], $settings );
1208
- $view_id = cv_sanitize_vid( PT_CV_Functions::url_extract_param( 'id' ) );
 
1209
  if ( empty( $view_id ) ) {
1210
  $view_id = PT_CV_Functions::string_random();
1211
  }
@@ -1232,11 +1202,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1232
 
1233
  define( 'PT_CV_DOING_PAGINATION', true );
1234
 
1235
- global $cv_unique_id;
1236
- $cv_unique_id = cv_sanitize_vid( $_POST[ 'unid' ] );
1237
-
1238
  $view_id = cv_sanitize_vid( $_POST[ 'sid' ] );
1239
- $settings = CV_Session::get( PT_CV_PREFIX . 'view-settings-' . $view_id, array() );
1240
  if ( !$settings ) {
1241
  $settings = PT_CV_Functions::view_get_settings( $view_id );
1242
  }
642
  $content_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $view_settings );
643
  $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $view_settings );
644
  $current_page = self::get_current_page( $pargs );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
645
 
646
  $pt_cv_glb[ $pt_cv_id ][ 'content_type' ] = $content_type;
647
  $pt_cv_glb[ $pt_cv_id ][ 'view_type' ] = $view_type;
650
  # Important: store current View ID, prevent it from being modified when process posts which contains View shortcode
651
  $cv_live_id = $view_id;
652
 
653
+ $rebuild = isset( $view_settings[ PT_CV_PREFIX . 'rebuild' ] ) ? $view_settings[ PT_CV_PREFIX . 'rebuild' ] : false;
654
+ $dargs = PT_CV_Functions::view_display_settings( $view_type, $dargs );
655
+ $args = $rebuild ? $rebuild : PT_CV_Functions::view_filter_settings( $content_type, $view_settings );
 
 
 
 
 
 
 
656
 
657
+ if ( $sc_params ) {
658
+ $view_settings[ PT_CV_PREFIX . 'shortcode_atts' ] = $sc_params;
659
+ } elseif ( isset( $view_settings[ PT_CV_PREFIX . 'shortcode_atts' ] ) ) {
660
+ $sc_params = $view_settings[ PT_CV_PREFIX . 'shortcode_atts' ];
 
 
661
  }
 
662
  $pt_cv_glb[ $pt_cv_id ][ 'shortcode_params' ] = $sc_params;
663
 
664
  PT_CV_Functions::view_get_pagination_settings( $dargs, $args, $pargs );
694
  $html = PT_CV_Html::content_items_wrap( $content_items, $current_page, $args[ 'posts_per_page' ], $pt_cv_id );
695
 
696
  // Show pagination
697
+ if ( $pt_query && apply_filters( PT_CV_PREFIX_ . 'show_pagination', PT_CV_Functions::nonajax_or_firstpage( $dargs, $current_page ) ) ) {
 
 
 
698
  // Total post founds
699
  $found_posts = (int) apply_filters( PT_CV_PREFIX_ . 'found_posts', $pt_query->found_posts );
700
 
701
  // Total number of items
702
  $total_items = ( $args[ 'limit' ] > 0 && $found_posts > $args[ 'limit' ] ) ? $args[ 'limit' ] : $found_posts;
703
+ $total_items = apply_filters( PT_CV_PREFIX_ . 'total_posts', $total_items );
704
 
705
  // Total number of pages
706
  $items_per_page = (int) PT_CV_Functions::setting_value( PT_CV_PREFIX . 'pagination-items-per-page', $view_settings );
709
 
710
  // Output pagination
711
  if ( $max_num_pages > 1 ) {
712
+ cv_comp_pagination_settings( 'set', $view_settings );
713
+
714
  $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $current_page, $pt_cv_id );
715
  } else {
716
  if ( $max_num_pages == 1 && defined( 'PT_CV_DOING_PREVIEW' ) ) {
737
  static function get_posts_list( $args, $view_type ) {
738
  $empty_result = false;
739
  $content_items = array();
740
+ $args = apply_filters( PT_CV_PREFIX_ . 'query_params', $args );
741
 
742
  // The Query
743
  do_action( PT_CV_PREFIX_ . 'before_query' );
1031
 
1032
  $pagination = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'enable-pagination', $view_settings );
1033
  if ( $pagination ) {
1034
+ $prefix = PT_CV_PREFIX . 'pagination-';
1035
+ $field_setting = PT_CV_Functions::settings_values_by_prefix( $prefix );
1036
+ $dargs[ 'pagination-settings' ] = apply_filters( PT_CV_PREFIX_ . 'pagination_settings', $field_setting, $prefix );
 
1037
  if ( !isset( $dargs[ 'pagination-settings' ][ 'type' ] ) ) {
1038
  $dargs[ 'pagination-settings' ][ 'type' ] = 'ajax';
1039
  }
1040
 
 
1041
  if ( $dargs[ 'pagination-settings' ][ 'type' ] === 'normal' ) {
1042
  $dargs[ 'pagination-settings' ][ 'style' ] = '';
1043
  }
1065
  * @param array $dargs The settings array of Fields
1066
  */
1067
  static function view_get_other_settings( &$dargs ) {
1068
+ $prefix = PT_CV_PREFIX . 'other-';
1069
+ $field_setting = PT_CV_Functions::settings_values_by_prefix( $prefix );
1070
+ $dargs[ 'other-settings' ] = apply_filters( PT_CV_PREFIX_ . 'other_settings', $field_setting );
 
1071
  }
1072
 
1073
  /**
1122
  if ( $id && !self::duplicated_process( $id, $atts ) ) {
1123
  $settings = PT_CV_Functions::view_get_settings( $id );
1124
  $view_html = PT_CV_Functions::view_process_settings( $id, $settings, null, $atts );
1125
+ $result = PT_CV_Functions::view_final_output( $view_html );
 
1126
  do_action( PT_CV_PREFIX_ . 'flushed_output', $result );
1127
 
1128
  return $result;
1170
 
1171
  if ( !empty( $_POST[ 'data' ] ) ) {
1172
  define( 'PT_CV_DOING_PREVIEW', true );
 
1173
  do_action( PT_CV_PREFIX_ . 'preview_header' );
1174
 
1175
+ $settings = array();
1176
  parse_str( $_POST[ 'data' ], $settings );
1177
+
1178
+ $view_id = cv_sanitize_vid( PT_CV_Functions::url_extract_param( 'id' ) );
1179
  if ( empty( $view_id ) ) {
1180
  $view_id = PT_CV_Functions::string_random();
1181
  }
1202
 
1203
  define( 'PT_CV_DOING_PAGINATION', true );
1204
 
 
 
 
1205
  $view_id = cv_sanitize_vid( $_POST[ 'sid' ] );
1206
+ $settings = cv_comp_pagination_settings( 'get', NULL );
1207
  if ( !$settings ) {
1208
  $settings = PT_CV_Functions::view_get_settings( $view_id );
1209
  }
includes/html.php CHANGED
@@ -664,7 +664,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
664
 
665
  if ( $type == 'normal' || $style == 'regular' ) {
666
  $ul_class = implode( ' ', array( PT_CV_PREFIX . 'pagination', PT_CV_PREFIX . $type, 'pagination' ) );
667
- $pagination_btn = sprintf( '<ul class="%s" data-totalpages="%s" data-sid="%s" data-unid="%s">%s</ul>', $ul_class, esc_attr( $max_num_pages ), esc_attr( $sid ), esc_attr( $cv_unique_id ), PT_CV_Functions::pagination( $max_num_pages, $current_page ) );
668
  } else {
669
  $pagination_btn = apply_filters( PT_CV_PREFIX_ . 'btn_more_html', $pagination_btn, $max_num_pages, $sid );
670
  }
664
 
665
  if ( $type == 'normal' || $style == 'regular' ) {
666
  $ul_class = implode( ' ', array( PT_CV_PREFIX . 'pagination', PT_CV_PREFIX . $type, 'pagination' ) );
667
+ $pagination_btn = sprintf( '<ul class="%s" data-totalpages="%s" data-currentpage="%s" data-sid="%s" data-unid="%s">%s</ul>', $ul_class, esc_attr( $max_num_pages ), esc_attr( $current_page ), esc_attr( $sid ), esc_attr( $cv_unique_id ), PT_CV_Functions::pagination( $max_num_pages, $current_page ) );
668
  } else {
669
  $pagination_btn = apply_filters( PT_CV_PREFIX_ . 'btn_more_html', $pagination_btn, $max_num_pages, $sid );
670
  }
includes/update.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  /**
4
  * Check update, do update
5
  *
@@ -9,6 +8,10 @@
9
  * @link http://www.contentviewspro.com/
10
  * @copyright 2014 PT Guy
11
  */
 
 
 
 
12
  // Compare stored version and current version
13
  $stored_version = get_option( PT_CV_OPTION_VERSION );
14
  if ( $stored_version ) {
@@ -16,13 +19,24 @@ if ( $stored_version ) {
16
  update_option( PT_CV_OPTION_VERSION, PT_CV_VERSION );
17
  }
18
 
 
 
 
 
 
 
 
 
 
19
  // Delete view_count post meta
20
- if ( !get_option( 'pt_cv_version_pro' ) && version_compare( $stored_version, '1.8.8.0', '<=' ) ) {
21
- global $wpdb;
22
- $wpdb->query(
23
- $wpdb->prepare(
24
- "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", '_' . PT_CV_PREFIX_ . 'view_count'
25
- )
26
- );
 
 
27
  }
28
  }
1
  <?php
 
2
  /**
3
  * Check update, do update
4
  *
8
  * @link http://www.contentviewspro.com/
9
  * @copyright 2014 PT Guy
10
  */
11
+ // Exit if accessed directly
12
+ if ( !defined( 'ABSPATH' ) )
13
+ exit;
14
+
15
  // Compare stored version and current version
16
  $stored_version = get_option( PT_CV_OPTION_VERSION );
17
  if ( $stored_version ) {
19
  update_option( PT_CV_OPTION_VERSION, PT_CV_VERSION );
20
  }
21
 
22
+ // Delete transients
23
+ if ( version_compare( $stored_version, '1.9.9', '<' ) ) {
24
+ if ( !(defined( 'DOING_AJAX' ) && DOING_AJAX) ) {
25
+ global $wpdb;
26
+ $sql = "DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_pt-cv-%' OR option_name LIKE '_transient_pt-cv-%'";
27
+ $wpdb->query( $sql );
28
+ }
29
+ }
30
+
31
  // Delete view_count post meta
32
+ if ( version_compare( $stored_version, '1.8.8.0', '<=' ) ) {
33
+ if ( !get_option( 'pt_cv_version_pro' ) ) {
34
+ global $wpdb;
35
+ $wpdb->query(
36
+ $wpdb->prepare(
37
+ "DELETE FROM $wpdb->postmeta WHERE meta_key = %s", '_' . PT_CV_PREFIX_ . 'view_count'
38
+ )
39
+ );
40
+ }
41
  }
42
  }
public/assets/js/cv.js CHANGED
@@ -14,4 +14,4 @@ function(a){var b=function(a,b){this.init(a,b)},c=null;b.prototype={init:functio
14
  * @author PT Guy <http://www.contentviewspro.com/>
15
  * @license GPL-2.0+
16
  */
17
- function(a){"use strict";a.PT_CV_Public=a.PT_CV_Public||{},PT_CV_PUBLIC=PT_CV_PUBLIC||{};var b=PT_CV_PUBLIC._prefix;a.PT_CV_Public=function(b){this.options=a.extend({},b),"undefined"==typeof this.options.skip&&this.pagination()},a.PT_CV_Public.prototype={pagination:function(){var c=this;a("."+b+"pagination."+b+"ajax").each(function(){var b=a(this),d=a(this).attr("data-totalpages"),e=a(this).attr("data-currentpage");a(this).bootstrapPaginator({bootstrapMajorVersion:3,currentPage:e?parseInt(e):1,totalPages:d?parseInt(d):1,numberOfPages:PT_CV_PUBLIC.page_to_show,shouldShowPage:function(a){if(!(d&&10>d))return!0;switch(a){case"first":case"last":return!1;default:return!0}},itemContainerClass:function(a,b,c){var d="cv-pageitem-"+("page"===a?"number":a);return d+" "+(b===c?"active":"")},onPageClicked:function(a,d,e,f){c._setup_pagination(b,f,function(){PT_CV_PUBLIC.paging=0})}})})},_setup_pagination:function(a,c,d){var e=this;if(PT_CV_PUBLIC.paging=PT_CV_PUBLIC.paging||0,!PT_CV_PUBLIC.paging){PT_CV_PUBLIC.paging=1;var f=a.next("."+b+"spinner"),g=a;a.parent("."+b+"pagination-wrapper").length&&(g=a.parent("."+b+"pagination-wrapper"));var h=g.closest("."+b+"wrapper").children("."+b+"view");if(h.hasClass(b+"timeline")&&(h=h.children(".tl-items").first()),g.find("."+b+"more").length>0){var i=h.children("."+b+"page").first();i.length>0&&(h=i)}e._get_page(a,c,f,h,d)}},_get_page:function(c,d,e,f,g){var h=this,i=h._active_page(d,f,g);if(i)return g&&"function"==typeof g&&g(),void a("body").trigger(b+"pagination-finished-simple");var j={action:"pagination_request",sid:c.attr("data-sid"),unid:c.attr("data-unid"),page:d,lang:PT_CV_PUBLIC.lang,ajax_nonce:PT_CV_PUBLIC._nonce,custom_data:window.cvdata};a.ajax({type:"POST",url:PT_CV_PUBLIC.ajaxurl,data:j,beforeSend:function(){e.addClass("active")}}).done(function(c){e.removeClass("active"),c.indexOf(b+"no-post")<0&&f.append(c),h._active_page(d,f,g),g&&"function"==typeof g&&g(),a("body").trigger(b+"pagination-finished",[f,a(c)])})},_active_page:function(c,d){var e=!1,f='[data-id="'+b+"page-"+parseInt(c)+'"]';return d.children(f).length&&(e=!0,d.children().hide(),d.children(f).show(),a("html, body").animate({scrollTop:d.children(f).offset().top-160},1e3)),e}},a(function(){new a.PT_CV_Public})}(jQuery);
14
  * @author PT Guy <http://www.contentviewspro.com/>
15
  * @license GPL-2.0+
16
  */
17
+ function(a){"use strict";a.PT_CV_Public=a.PT_CV_Public||{},PT_CV_PUBLIC=PT_CV_PUBLIC||{};var b=PT_CV_PUBLIC._prefix;a.PT_CV_Public=function(b){this.options=a.extend({},b),"undefined"==typeof this.options.skip&&this.pagination()},a.PT_CV_Public.prototype={pagination:function(){var c=this;a("."+b+"pagination."+b+"ajax").each(function(){var b=a(this),d=a(this).attr("data-totalpages"),e=a(this).attr("data-currentpage");a(this).bootstrapPaginator({bootstrapMajorVersion:3,currentPage:e?parseInt(e):1,totalPages:d?parseInt(d):1,numberOfPages:PT_CV_PUBLIC.page_to_show,shouldShowPage:function(a){if(!(d&&10>d))return!0;switch(a){case"first":case"last":return!1;default:return!0}},itemContainerClass:function(a,b,c){var d="cv-pageitem-"+("page"===a?"number":a);return d+" "+(b===c?"active":"")},onPageClicked:function(a,d,e,f){c._setup_pagination(b,f,function(){PT_CV_PUBLIC.paging=0})}})})},_setup_pagination:function(a,c,d){var e=this;if(PT_CV_PUBLIC.paging=PT_CV_PUBLIC.paging||0,!PT_CV_PUBLIC.paging&&!a.data("disabled")){PT_CV_PUBLIC.paging=1;var f=a.next("."+b+"spinner"),g=a;a.parent("."+b+"pagination-wrapper").length&&(g=a.parent("."+b+"pagination-wrapper"));var h=g.closest("."+b+"wrapper").children("."+b+"view");if(h.hasClass(b+"timeline")&&(h=h.children(".tl-items").first()),g.find("."+b+"more").length>0){var i=h.children("."+b+"page").first();i.length>0&&(h=i)}e._get_page(a,c,f,h,d)}},_get_page:function(c,d,e,f,g){var h=this,i=h._active_page(d,f,g);if(i)return g&&"function"==typeof g&&g(),void a("body").trigger(b+"pagination-finished-simple");a("body").trigger(b+"before-pagination");var j={action:"pagination_request",sid:c.attr("data-sid"),unid:c.attr("data-unid"),page:d,lang:PT_CV_PUBLIC.lang,ajax_nonce:PT_CV_PUBLIC._nonce,custom_data:window.cvdata};a.ajax({type:"POST",url:PT_CV_PUBLIC.ajaxurl,data:j,beforeSend:function(){e.addClass("active")}}).done(function(c){e.removeClass("active"),c.indexOf(b+"no-post")<0&&f.append(c),h._active_page(d,f,g),g&&"function"==typeof g&&g(),a("body").trigger(b+"pagination-finished",[f,a(c)])})},_active_page:function(c,d){var e=!1,f='[data-id="'+b+"page-"+parseInt(c)+'"]';return d.children(f).length&&(e=!0,d.children().hide(),d.children(f).show(),a("html, body").animate({scrollTop:d.children(f).offset().top-160},1e3)),e}},a(function(){new a.PT_CV_Public})}(jQuery);
public/content-views.php CHANGED
@@ -41,8 +41,6 @@ class PT_Content_Views {
41
  // Load plugin text domain
42
  add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ), 11 );
43
 
44
- add_action( 'init', array( 'CV_Session', 'start' ) );
45
-
46
  // Register content
47
  add_action( 'init', array( $this, 'content_register' ) );
48
 
41
  // Load plugin text domain
42
  add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ), 11 );
43
 
 
 
44
  // Register content
45
  add_action( 'init', array( $this, 'content_register' ) );
46