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

Version Description

  • Update: Important update about caching mechanism
  • Update: Update translation file
Download this release

Release Info

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

Code changes from version 1.3.0.2 to 1.3.1

.htaccess CHANGED
@@ -1,3 +0,0 @@
1
-
2
- # Disable Indexing
3
- Options -Indexes
 
 
 
README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: post, posts, page, pages, query, queries, search, display, show, shortcode, thumbnail, title, content, excerpt, meta, date, author, term, taxonomy, pagination, grid, scrollable, slider, collapsible, list, slide, layout, ui
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
- Stable tag: 1.3.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -144,6 +144,10 @@ You can create Unlimited Views, in Unlimited websites
144
 
145
  == Changelog ==
146
 
 
 
 
 
147
  = 1.3.0.2 =
148
  * Refine Javascript code
149
  * Update description in Setting page
@@ -233,6 +237,9 @@ You can create Unlimited Views, in Unlimited websites
233
 
234
  == Upgrade Notice ==
235
 
 
 
 
236
  = 1.3.0.2 =
237
  Refine Javascript code. Update description in Setting page
238
 
4
  Tags: post, posts, page, pages, query, queries, search, display, show, shortcode, thumbnail, title, content, excerpt, meta, date, author, term, taxonomy, pagination, grid, scrollable, slider, collapsible, list, slide, layout, ui
5
  Requires at least: 3.3
6
  Tested up to: 3.9.1
7
+ Stable tag: 1.3.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
144
 
145
  == Changelog ==
146
 
147
+ = 1.3.1 =
148
+ * Update: Important update about caching mechanism
149
+ * Update: Update translation file
150
+
151
  = 1.3.0.2 =
152
  * Refine Javascript code
153
  * Update description in Setting page
237
 
238
  == Upgrade Notice ==
239
 
240
+ = 1.3.1 =
241
+ Update: Important update about caching mechanism. Update: Update translation file
242
+
243
  = 1.3.0.2 =
244
  Refine Javascript code. Update description in Setting page
245
 
admin/views/view.php CHANGED
@@ -25,13 +25,11 @@ if ( ! empty ( $_GET['id'] ) ) {
25
  if ( $id ) {
26
 
27
  // Get View settings
28
- $settings = PT_CV_Functions::view_get_settings( $id );
 
29
  }
30
  }
31
 
32
- // Store settings
33
- $_SESSION[PT_CV_PREFIX . 'settings'] = $settings;
34
-
35
  // Submit handle
36
  PT_CV_Functions::view_submit();
37
 
25
  if ( $id ) {
26
 
27
  // Get View settings
28
+ global $pt_cv_admin_settings;
29
+ $pt_cv_admin_settings = $settings = PT_CV_Functions::view_get_settings( $id );
30
  }
31
  }
32
 
 
 
 
33
  // Submit handle
34
  PT_CV_Functions::view_submit();
35
 
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.3.0.2
14
  * Author: Palace Of Themes
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
@@ -27,21 +27,22 @@ if ( ! defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.3.0.2' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
- include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
 
33
 
34
  /*
35
  * Include other library files (name ASC)
36
  */
37
- include_once( plugin_dir_path( __FILE__ ) . 'includes/assets.php' );
38
- include_once( plugin_dir_path( __FILE__ ) . 'includes/functions.php' );
39
- include_once( plugin_dir_path( __FILE__ ) . 'includes/hooks.php' );
40
- include_once( plugin_dir_path( __FILE__ ) . 'includes/html-viewtype.php' );
41
- include_once( plugin_dir_path( __FILE__ ) . 'includes/html.php' );
42
- include_once( plugin_dir_path( __FILE__ ) . 'includes/settings.php' );
43
- include_once( plugin_dir_path( __FILE__ ) . 'includes/update.php' );
44
- include_once( plugin_dir_path( __FILE__ ) . 'includes/values.php' );
45
 
46
  /*----------------------------------------------------------------------------*
47
  * Public-Facing Functionality
@@ -50,7 +51,7 @@ include_once( plugin_dir_path( __FILE__ ) . 'includes/values.php' );
50
  /*
51
  * the plugin's class file
52
  */
53
- include_once( plugin_dir_path( __FILE__ ) . 'public/content-views.php' );
54
 
55
  /*
56
  * Register hooks that are fired when the plugin is activated or deactivated.
@@ -71,18 +72,16 @@ add_action( 'plugins_loaded', array( 'PT_Content_Views', 'get_instance' ) );
71
  if ( is_admin() ) {
72
 
73
  // Require Admin side functions
74
- include_once( plugin_dir_path( __FILE__ ) . 'admin/content-views-admin.php' );
75
  add_action( 'plugins_loaded', array( 'PT_Content_Views_Admin', 'get_instance' ) );
76
 
77
  // Require PT Options framework
78
- include_once( plugin_dir_path( __FILE__ ) . 'admin/includes/options.php' );
79
 
80
  // Settings page for the plugin
81
- include_once( plugin_dir_path( __FILE__ ) . 'admin/includes/plugin.php' );
82
  }
83
 
84
- add_action( 'init', array( 'PT_CV_Functions', 'session_start' ), 1 );
85
-
86
  /**
87
  * Common settings
88
  */
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.3.1
14
  * Author: Palace Of Themes
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
27
  /*
28
  * Define Constant
29
  */
30
+ define( 'PT_CV_VERSION', '1.3.1' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
+ $pt_cv_path = plugin_dir_path( __FILE__ );
33
+ include_once( $pt_cv_path . 'includes/defines.php' );
34
 
35
  /*
36
  * Include other library files (name ASC)
37
  */
38
+ include_once( $pt_cv_path . 'includes/assets.php' );
39
+ include_once( $pt_cv_path . 'includes/functions.php' );
40
+ include_once( $pt_cv_path . 'includes/hooks.php' );
41
+ include_once( $pt_cv_path . 'includes/html-viewtype.php' );
42
+ include_once( $pt_cv_path . 'includes/html.php' );
43
+ include_once( $pt_cv_path . 'includes/settings.php' );
44
+ include_once( $pt_cv_path . 'includes/update.php' );
45
+ include_once( $pt_cv_path . 'includes/values.php' );
46
 
47
  /*----------------------------------------------------------------------------*
48
  * Public-Facing Functionality
51
  /*
52
  * the plugin's class file
53
  */
54
+ include_once( $pt_cv_path . 'public/content-views.php' );
55
 
56
  /*
57
  * Register hooks that are fired when the plugin is activated or deactivated.
72
  if ( is_admin() ) {
73
 
74
  // Require Admin side functions
75
+ include_once( $pt_cv_path . 'admin/content-views-admin.php' );
76
  add_action( 'plugins_loaded', array( 'PT_Content_Views_Admin', 'get_instance' ) );
77
 
78
  // Require PT Options framework
79
+ include_once( $pt_cv_path . 'admin/includes/options.php' );
80
 
81
  // Settings page for the plugin
82
+ include_once( $pt_cv_path . 'admin/includes/plugin.php' );
83
  }
84
 
 
 
85
  /**
86
  * Common settings
87
  */
includes/functions.php CHANGED
@@ -159,15 +159,6 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
159
  return ucwords( $slug );
160
  }
161
 
162
- /**
163
- * Start SESSION
164
- */
165
- static function session_start() {
166
- if ( ! session_id() ) {
167
- session_start();
168
- }
169
- }
170
-
171
  /**
172
  * Get thumbnail dimensions
173
  *
@@ -438,10 +429,6 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
438
  return __( 'Empty settings', PT_CV_DOMAIN );
439
  }
440
 
441
- $post_fix = empty( $id ) ? '' : '_frontend';
442
-
443
- $_SESSION[PT_CV_PREFIX . 'settings' . $post_fix] = $settings;
444
-
445
  // Escaped value appropriate for use in a SQL query
446
  global $pt_view_settings;
447
 
@@ -457,29 +444,26 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
457
  // Get view type
458
  $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $pt_view_settings );
459
 
460
- // Store Display settings
461
  global $dargs, $pt_query_args;
462
 
463
- if ( $pargs && isset( $pargs['session_id'] ) ) {
464
- $session_id = $pargs['session_id'];
465
- }
466
-
467
- if ( empty( $session_id ) ) {
468
- $session_id = PT_CV_Functions::string_random();
469
- }
470
 
471
  if ( $session_id ) {
472
-
473
- global $pt_view_sid;
474
- $pt_view_sid = $session_id;
475
-
476
  $session_data = array_merge(
477
  array( '$args' => '', '$dargs' => '' ),
478
- isset( $_SESSION[PT_CV_PREFIX . 'view_' . $session_id] ) ? (array) $_SESSION[PT_CV_PREFIX . 'view_' . $session_id] : array()
479
  );
480
 
481
  $args = $session_data['$args'];
482
  $dargs = $session_data['$dargs'];
 
 
 
 
 
 
 
483
  }
484
 
485
  if ( empty( $args ) || empty( $dargs ) ) {
@@ -490,13 +474,11 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
490
  $dargs = apply_filters( PT_CV_PREFIX_ . 'all_display_settings', $dargs );
491
  $args = apply_filters( PT_CV_PREFIX_ . 'query_parameters', $args );
492
 
493
- // Save settings
494
- if ( ! empty( $session_id ) ) {
495
- $_SESSION[PT_CV_PREFIX . 'view_' . $session_id] = array(
496
- '$args' => $args,
497
- '$dargs' => $dargs,
498
- );
499
- }
500
  }
501
 
502
  // Pagination settings
@@ -572,6 +554,7 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
572
  // Total number of pages
573
  $max_num_pages = ceil( $total_items / $args['posts_per_page'] );
574
 
 
575
  $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $session_id );
576
  }
577
 
@@ -1082,9 +1065,6 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
1082
  $settings = array();
1083
  parse_str( $_POST['data'], $settings );
1084
 
1085
- // Store settings
1086
- $_SESSION[PT_CV_PREFIX . 'settings'] = $settings;
1087
-
1088
  // Show View output
1089
  echo balanceTags( PT_CV_Functions::view_process_settings( null, $settings ) );
1090
 
@@ -1102,25 +1082,16 @@ if ( ! class_exists( 'PT_CV_Functions' ) ) {
1102
  check_ajax_referer( PT_CV_PREFIX_ . 'ajax_nonce', 'ajax_nonce' );
1103
 
1104
  // Session id
1105
- $sid = esc_sql( empty( $_POST['sid'] ) ? '' : $_POST['sid'] );
1106
-
1107
- // Is admin
1108
- $is_admin = ! empty( $_POST['is_admin'] ) ? $_POST['is_admin'] : 0;
1109
-
1110
- $post_fix = $is_admin ? '' : '_frontend';
1111
 
1112
  // Get saved $settings
1113
- if ( isset( $_SESSION[PT_CV_PREFIX . 'settings' . $post_fix] ) ) {
1114
- $settings = $_SESSION[PT_CV_PREFIX . 'settings' . $post_fix];
1115
- } else {
1116
- $settings = '';
1117
- }
1118
 
1119
  // Pagination settings
1120
- $pargs = array( 'session_id' => $sid, 'page' => (int) esc_sql( $_POST['page'] ) );
1121
 
1122
  // Show View output
1123
- echo balanceTags( PT_CV_Functions::view_process_settings( $post_fix, $settings, $pargs ) );
1124
 
1125
  // Must exit
1126
  die;
159
  return ucwords( $slug );
160
  }
161
 
 
 
 
 
 
 
 
 
 
162
  /**
163
  * Get thumbnail dimensions
164
  *
429
  return __( 'Empty settings', PT_CV_DOMAIN );
430
  }
431
 
 
 
 
 
432
  // Escaped value appropriate for use in a SQL query
433
  global $pt_view_settings;
434
 
444
  // Get view type
445
  $view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $pt_view_settings );
446
 
447
+ // Store display settings
448
  global $dargs, $pt_query_args;
449
 
450
+ $session_id = ( $pargs && isset( $pargs['session_id'] ) ) ? $pargs['session_id'] : 0;
 
 
 
 
 
 
451
 
452
  if ( $session_id ) {
 
 
 
 
453
  $session_data = array_merge(
454
  array( '$args' => '', '$dargs' => '' ),
455
+ ( false === ( $saved_settings = get_transient( PT_CV_PREFIX . 'view-data-' . $session_id ) ) ) ? array() : $saved_settings
456
  );
457
 
458
  $args = $session_data['$args'];
459
  $dargs = $session_data['$dargs'];
460
+ } else {
461
+ // Generate session key for pagination
462
+ global $pt_view_sid;
463
+ $pt_view_sid = $session_id = PT_CV_Functions::string_random();
464
+
465
+ // Store settings
466
+ set_transient( PT_CV_PREFIX . 'view-settings-' . $session_id, $settings, 30 * MINUTE_IN_SECONDS );
467
  }
468
 
469
  if ( empty( $args ) || empty( $dargs ) ) {
474
  $dargs = apply_filters( PT_CV_PREFIX_ . 'all_display_settings', $dargs );
475
  $args = apply_filters( PT_CV_PREFIX_ . 'query_parameters', $args );
476
 
477
+ // Store view data
478
+ set_transient( PT_CV_PREFIX . 'view-data-' . $session_id, array(
479
+ '$args' => $args,
480
+ '$dargs' => $dargs,
481
+ ), 30 * MINUTE_IN_SECONDS );
 
 
482
  }
483
 
484
  // Pagination settings
554
  // Total number of pages
555
  $max_num_pages = ceil( $total_items / $args['posts_per_page'] );
556
 
557
+ // Output pagination
558
  $html .= "\n" . PT_CV_Html::pagination_output( $max_num_pages, $session_id );
559
  }
560
 
1065
  $settings = array();
1066
  parse_str( $_POST['data'], $settings );
1067
 
 
 
 
1068
  // Show View output
1069
  echo balanceTags( PT_CV_Functions::view_process_settings( null, $settings ) );
1070
 
1082
  check_ajax_referer( PT_CV_PREFIX_ . 'ajax_nonce', 'ajax_nonce' );
1083
 
1084
  // Session id
1085
+ $session_id = empty( $_POST['sid'] ) ? '' : esc_sql( $_POST['sid'] );
 
 
 
 
 
1086
 
1087
  // Get saved $settings
1088
+ $settings = get_transient( PT_CV_PREFIX . 'view-settings-' . $session_id );
 
 
 
 
1089
 
1090
  // Pagination settings
1091
+ $pargs = array( 'session_id' => $session_id, 'page' => (int) esc_sql( $_POST['page'] ) );
1092
 
1093
  // Show View output
1094
+ echo balanceTags( PT_CV_Functions::view_process_settings( '', $settings, $pargs ) );
1095
 
1096
  // Must exit
1097
  die;
languages/content-views.mo ADDED
Binary file
languages/content-views.po CHANGED
@@ -2,10 +2,9 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Content Views\n"
4
  "POT-Creation-Date: 2014-07-01 23:54+0700\n"
5
- "PO-Revision-Date: 2014-07-01 23:56+0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: PT Guy <support@contentviewspro.com>\n"
8
- "Language: en_US\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -13,8 +12,7 @@ msgstr ""
13
  "X-Poedit-KeywordsList: _e;__\n"
14
  "X-Poedit-Basepath: .\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
- "X-Poedit-SearchPath-0: pt-"
17
- "content-views\n"
18
 
19
  #: content-views-query-and-display-post-page/admin/content-views-admin.php:237
20
  msgid "There is no taxonomy for selected content type"
2
  msgstr ""
3
  "Project-Id-Version: Content Views\n"
4
  "POT-Creation-Date: 2014-07-01 23:54+0700\n"
5
+ "PO-Revision-Date: 2014-08-05 22:44+0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: PT Guy <support@contentviewspro.com>\n"
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "X-Poedit-KeywordsList: _e;__\n"
13
  "X-Poedit-Basepath: .\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Poedit-SearchPath-0: pt-content-views\n"
 
16
 
17
  #: content-views-query-and-display-post-page/admin/content-views-admin.php:237
18
  msgid "There is no taxonomy for selected content type"
public/assets/js/public.js CHANGED
@@ -113,7 +113,6 @@
113
  action : 'pagination_request',
114
  sid : session_id,
115
  page : selected_page,
116
- is_admin : PT_CV_PUBLIC.is_admin,
117
  ajax_nonce: PT_CV_PUBLIC._nonce
118
  };
119
 
113
  action : 'pagination_request',
114
  sid : session_id,
115
  page : selected_page,
 
116
  ajax_nonce: PT_CV_PUBLIC._nonce
117
  };
118
 
public/content-views.php CHANGED
@@ -230,6 +230,7 @@ class PT_Content_Views {
230
  $domain = $this->plugin_slug;
231
  $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
232
 
 
233
  load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
234
  load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( PT_CV_FILE ) ) . '/languages/' );
235
  }
230
  $domain = $this->plugin_slug;
231
  $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
232
 
233
+ // Load translation file in wp-content/languages/content-views/
234
  load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
235
  load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( PT_CV_FILE ) ) . '/languages/' );
236
  }