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

Version Description

  • Security: Fix XSS Vulnerability problem
  • Bug fixed: Plugin does not rendering anything sometimes
  • Bug fixed: Title is missing when move Bootstrap to top of all styles
  • Improvement: Optimize CSS properties
Download this release

Release Info

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

Code changes from version 1.6.1 to 1.6.2

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, grid, column, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
5
  Requires at least: 3.3
6
  Tested up to: 4.2.2
7
- Stable tag: 1.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -165,6 +165,12 @@ function my_move_bootstrap( $args ) {
165
 
166
  == Changelog ==
167
 
 
 
 
 
 
 
168
  = 1.6.1 =
169
  * Update: Update translation function & re-generate .po file
170
  * Bug fixed: Call non-static function
4
  Tags: post, posts, page, pages, query, queries, search, display, show, grid, column, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
5
  Requires at least: 3.3
6
  Tested up to: 4.2.2
7
+ Stable tag: 1.6.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
165
 
166
  == Changelog ==
167
 
168
+ = 1.6.2 =
169
+ * Security: Fix XSS Vulnerability problem
170
+ * Bug fixed: Plugin does not rendering anything sometimes
171
+ * Bug fixed: Title is missing when move Bootstrap to top of all styles
172
+ * Improvement: Optimize CSS properties
173
+
174
  = 1.6.1 =
175
  * Update: Update translation function & re-generate .po file
176
  * Bug fixed: Call non-static function
content-views.php CHANGED
@@ -11,7 +11,7 @@
11
  * Plugin Name: Content Views
12
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
13
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
14
- * Version: 1.6.1
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views
@@ -27,7 +27,7 @@ if ( !defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.6.1' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
11
  * Plugin Name: Content Views
12
  * Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
13
  * Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
14
+ * Version: 1.6.2
15
  * Author: PT Guy
16
  * Author URI: http://profiles.wordpress.org/pt-guy
17
  * Text Domain: content-views
27
  /*
28
  * Define Constant
29
  */
30
+ define( 'PT_CV_VERSION', '1.6.2' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
includes/functions.php CHANGED
@@ -594,17 +594,6 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
594
  $pt_cv_glb[ 'processed_view' ] = array();
595
  }
596
 
597
- // If processed this View => return
598
- // (Same View ID but different shortcode parameters => consider as 2 different Views)
599
- if ( empty( $pargs ) ) {
600
- $sc_params = isset( $pt_cv_glb[ $view_id ][ 'shortcode_params' ] ) ? $pt_cv_glb[ $view_id ][ 'shortcode_params' ] : PT_CV_Functions::string_random();
601
- $vid = $view_id . '-' . md5( serialize( $sc_params ) );
602
- if ( !empty( $pt_cv_glb[ 'processed_view' ][ $vid ] ) ) {
603
- return '';
604
- }
605
- $pt_cv_glb[ 'processed_view' ][ $vid ] = 1;
606
- }
607
-
608
  /**
609
  * 1. Get View settings
610
  */
@@ -614,6 +603,18 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
614
  }
615
  $pt_cv_glb[ $view_id ][ 'view_settings' ] = $view_settings;
616
 
 
 
 
 
 
 
 
 
 
 
 
 
617
  // Get content type
618
  $content_type = apply_filters( PT_CV_PREFIX_ . 'content_type', PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $view_settings ), $id );
619
  $pt_cv_glb[ $view_id ][ 'content_type' ] = $content_type;
@@ -1257,7 +1258,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1257
  $edit_link = admin_url( 'admin.php?page=' . PT_CV_DOMAIN . '-add' );
1258
  if ( !empty( $view_id ) ) {
1259
  $query_args = array( 'id' => $view_id ) + $action;
1260
- $edit_link = add_query_arg( $query_args, $edit_link );
1261
  }
1262
 
1263
  return $edit_link;
@@ -1351,7 +1352,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
1351
  $data_page = sprintf( ' data-page="%s"', $this_page );
1352
  }
1353
 
1354
- $html = sprintf( '<a%s href="%s">%s</a>', $data_page, add_query_arg( 'vpage', $this_page ), $label );
1355
  $class = $class ? sprintf( ' class="%s"', esc_attr( $class ) ) : '';
1356
 
1357
  return sprintf( '<li%s>%s</li>', $class, $html );
594
  $pt_cv_glb[ 'processed_view' ] = array();
595
  }
596
 
 
 
 
 
 
 
 
 
 
 
 
597
  /**
598
  * 1. Get View settings
599
  */
603
  }
604
  $pt_cv_glb[ $view_id ][ 'view_settings' ] = $view_settings;
605
 
606
+ // Check duplicated View
607
+ // (Same View ID but different shortcode parameters => consider as 2 different Views)
608
+ if ( empty( $pargs ) && apply_filters( PT_CV_PREFIX_ . 'check_duplicate', 0, $view_id, $view_settings ) ) {
609
+ $sc_params = isset( $pt_cv_glb[ $view_id ][ 'shortcode_params' ] ) ? $pt_cv_glb[ $view_id ][ 'shortcode_params' ] : PT_CV_Functions::string_random();
610
+ $vid = $view_id . '-' . md5( serialize( $sc_params ) );
611
+ if ( !empty( $pt_cv_glb[ 'processed_view' ][ $vid ] ) ) {
612
+ return '';
613
+ } else {
614
+ $pt_cv_glb[ 'processed_view' ][ $vid ] = 1;
615
+ }
616
+ }
617
+
618
  // Get content type
619
  $content_type = apply_filters( PT_CV_PREFIX_ . 'content_type', PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $view_settings ), $id );
620
  $pt_cv_glb[ $view_id ][ 'content_type' ] = $content_type;
1258
  $edit_link = admin_url( 'admin.php?page=' . PT_CV_DOMAIN . '-add' );
1259
  if ( !empty( $view_id ) ) {
1260
  $query_args = array( 'id' => $view_id ) + $action;
1261
+ $edit_link = esc_url( add_query_arg( $query_args, $edit_link ) );
1262
  }
1263
 
1264
  return $edit_link;
1352
  $data_page = sprintf( ' data-page="%s"', $this_page );
1353
  }
1354
 
1355
+ $html = sprintf( '<a%s href="%s">%s</a>', $data_page, esc_url( add_query_arg( 'vpage', $this_page ) ), $label );
1356
  $class = $class ? sprintf( ' class="%s"', esc_attr( $class ) ) : '';
1357
 
1358
  return sprintf( '<li%s>%s</li>', $class, $html );
includes/html-viewtype.php CHANGED
@@ -20,19 +20,16 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
20
  /**
21
  * Generate class for columns
22
  *
23
- * @global array $dargs
24
- *
25
- * @param array $content_items
26
  *
27
  * @return array
28
  */
29
- static function process_column_width( $content_items ) {
30
-
31
  $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
32
 
33
  // -- Get column span
34
 
35
- $columns = (int) $dargs[ 'number-columns' ];
36
  if ( !$columns ) {
37
  $columns = 1;
38
  }
@@ -67,7 +64,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
67
 
68
  $enable_filter = PT_CV_Functions::get_global_variable( 'enable_filter' );
69
 
70
- list( $columns, $span_width_last, $span_width, $span_class, $row_class ) = self::process_column_width( $content_items );
71
 
72
  // Split items to rows
73
  $columns_item = array_chunk( $content_items, $columns, true );
@@ -195,7 +192,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
195
 
196
  $rows = ( $dargs[ 'number-rows' ] ) ? (int) $dargs[ 'number-rows' ] : 1;
197
 
198
- list( $columns, $span_width_last, $span_width, $span_class, $row_class ) = self::process_column_width( $content_items );
199
 
200
  // Get wrapper class of a scrollable slide
201
  $slide_class = apply_filters( PT_CV_PREFIX_ . 'scrollable_slide_class', 'item' );
20
  /**
21
  * Generate class for columns
22
  *
23
+ * @param int $_columns
 
 
24
  *
25
  * @return array
26
  */
27
+ static function process_column_width( $_columns = 0 ) {
 
28
  $dargs = PT_CV_Functions::get_global_variable( 'dargs' );
29
 
30
  // -- Get column span
31
 
32
+ $columns = $_columns ? $_columns : (int) $dargs[ 'number-columns' ];
33
  if ( !$columns ) {
34
  $columns = 1;
35
  }
64
 
65
  $enable_filter = PT_CV_Functions::get_global_variable( 'enable_filter' );
66
 
67
+ list( $columns, $span_width_last, $span_width, $span_class, $row_class ) = self::process_column_width();
68
 
69
  // Split items to rows
70
  $columns_item = array_chunk( $content_items, $columns, true );
192
 
193
  $rows = ( $dargs[ 'number-rows' ] ) ? (int) $dargs[ 'number-rows' ] : 1;
194
 
195
+ list( $columns, $span_width_last, $span_width, $span_class, $row_class ) = self::process_column_width();
196
 
197
  // Get wrapper class of a scrollable slide
198
  $slide_class = apply_filters( PT_CV_PREFIX_ . 'scrollable_slide_class', 'item' );
includes/html.php CHANGED
@@ -557,7 +557,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
557
  // Don't wrap link
558
  $no_link = apply_filters( PT_CV_PREFIX_ . 'field_href_no_link', 0, $open_in );
559
 
560
- $href = apply_filters( PT_CV_PREFIX_ . 'field_href', get_permalink( $post->ID ) );
561
 
562
  // Change href
563
  if ( $no_link && strpos( $defined_class, 'readmore' ) === false ) {
@@ -611,8 +611,10 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
611
  $dimensions = (array) apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_dimension_output', $dimensions, $fargs );
612
 
613
  // Check if has thumbnail ( has_post_thumbnail doesn't works )
614
- $thumbnail_id = get_post_thumbnail_id( $post_id );
615
- if ( !empty( $thumbnail_id ) ) {
 
 
616
  $thumbnail_size = count( $dimensions ) > 1 ? $dimensions : $dimensions[ 0 ];
617
  $html = wp_get_attachment_image( (int) $thumbnail_id, $thumbnail_size, false, $gargs );
618
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_image', $html, $post_id, $dimensions, $fargs );
557
  // Don't wrap link
558
  $no_link = apply_filters( PT_CV_PREFIX_ . 'field_href_no_link', 0, $open_in );
559
 
560
+ $href = apply_filters( PT_CV_PREFIX_ . 'field_href', get_permalink( $post->ID ), $post );
561
 
562
  // Change href
563
  if ( $no_link && strpos( $defined_class, 'readmore' ) === false ) {
611
  $dimensions = (array) apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_dimension_output', $dimensions, $fargs );
612
 
613
  // Check if has thumbnail ( has_post_thumbnail doesn't works )
614
+ $thumbnail_id = get_post_thumbnail_id( $post_id );
615
+ // Check if user doesn't want to load thumbnail: field_thumbnail_load = 0
616
+ $load_thumbnail = !empty( $thumbnail_id ) && apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_load', 1 );
617
+ if ( $load_thumbnail ) {
618
  $thumbnail_size = count( $dimensions ) > 1 ? $dimensions : $dimensions[ 0 ];
619
  $html = wp_get_attachment_image( (int) $thumbnail_id, $thumbnail_size, false, $gargs );
620
  $html = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_image', $html, $post_id, $dimensions, $fargs );
public/assets/css/public.css CHANGED
@@ -52,7 +52,7 @@
52
 
53
  /* An Item */
54
  .pt-cv-content-item {
55
- padding-bottom: 1.5em;
56
  position: relative;
57
  overflow: hidden;
58
  }
@@ -111,7 +111,7 @@
111
  .pt-cv-meta-fields {
112
  font-size: 13px;
113
  margin-top: 0;
114
- padding-bottom: 10px;
115
  }
116
 
117
  .pt-cv-meta-fields a {
@@ -278,6 +278,7 @@
278
  /* Layout */
279
  .pt-cv-2-col .pt-cv-title {
280
  clear: none !important;
 
281
  }
282
 
283
  /* @Panels-minified */
52
 
53
  /* An Item */
54
  .pt-cv-content-item {
55
+ padding-bottom: 1em;
56
  position: relative;
57
  overflow: hidden;
58
  }
111
  .pt-cv-meta-fields {
112
  font-size: 13px;
113
  margin-top: 0;
114
+ /*padding-bottom: 10px;*/
115
  }
116
 
117
  .pt-cv-meta-fields a {
278
  /* Layout */
279
  .pt-cv-2-col .pt-cv-title {
280
  clear: none !important;
281
+ display: flex;
282
  }
283
 
284
  /* @Panels-minified */
public/assets/js/public.js CHANGED
@@ -38,7 +38,11 @@
38
  var bootstrap_css = $( '#' + selector );
39
  if ( bootstrap_css.length > 0 ) {
40
  bootstrap_css.remove();
41
- $( 'title' ).after( "<!-- Manually move Bootstrap to top of all styles --><link rel='stylesheet' id='" + selector + "' href='" + bootstrap_css.attr( 'href' ) + "' type='text/css' media='all' />" );
 
 
 
 
42
  }
43
  },
44
  /**
38
  var bootstrap_css = $( '#' + selector );
39
  if ( bootstrap_css.length > 0 ) {
40
  bootstrap_css.remove();
41
+
42
+ var title = $( 'title' );
43
+ var title_content = title.html();
44
+ title.after( "<!-- Manually move Bootstrap to top of all styles --><link rel='stylesheet' id='" + selector + "' href='" + bootstrap_css.attr( 'href' ) + "' type='text/css' media='all' />" );
45
+ title.html( title_content );
46
  }
47
  },
48
  /**