Version Description
- Improvement: Prevent negative value for some setting options
Download this release
Release Info
Developer | PT Guy |
Plugin | Content Views – Post Grid & List for WordPress |
Version | 1.6.3.1 |
Comparing to | |
See all releases |
Code changes from version 1.6.3 to 1.6.3.1
- README.txt +4 -1
- admin/assets/js/admin.js +14 -1
- admin/content-views-admin.php +1 -2
- content-views.php +2 -2
- includes/functions.php +11 -0
- includes/html-viewtype.php +6 -3
- includes/html.php +6 -15
- includes/values.php +1 -1
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.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -165,6 +165,9 @@ function my_move_bootstrap( $args ) {
|
|
165 |
|
166 |
== Changelog ==
|
167 |
|
|
|
|
|
|
|
168 |
= 1.6.3 =
|
169 |
* Bug fixed: Date of post is incorrect in some cases
|
170 |
* Bug fixed: Dropdown menu is hidden
|
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.3.1
|
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.3.1 =
|
169 |
+
* Improvement: Prevent negative value for some setting options
|
170 |
+
|
171 |
= 1.6.3 =
|
172 |
* Bug fixed: Date of post is incorrect in some cases
|
173 |
* Bug fixed: Dropdown menu is hidden
|
admin/assets/js/admin.js
CHANGED
@@ -600,12 +600,22 @@
|
|
600 |
// Handy do other toggle
|
601 |
$( '.pt-wrap' ).trigger( _prefix + 'multi-level-toggle' );
|
602 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
603 |
/**
|
604 |
* Custom js for elements
|
605 |
* @returns {undefined}
|
606 |
*/
|
607 |
custom: function () {
|
608 |
-
|
609 |
var $self = this;
|
610 |
var _prefix = $self.options._prefix;
|
611 |
|
@@ -662,6 +672,9 @@
|
|
662 |
return message;
|
663 |
}
|
664 |
};
|
|
|
|
|
|
|
665 |
}
|
666 |
};
|
667 |
}( jQuery ) );
|
600 |
// Handy do other toggle
|
601 |
$( '.pt-wrap' ).trigger( _prefix + 'multi-level-toggle' );
|
602 |
},
|
603 |
+
/**
|
604 |
+
* Validate number: prevent negative value
|
605 |
+
* @returns {undefined}
|
606 |
+
*/
|
607 |
+
validate_number: function () {
|
608 |
+
$( 'input[type="number"]' ).on( 'keypress', function ( event ) {
|
609 |
+
var min = $( this ).prop( 'min' );
|
610 |
+
if ( min == 0 && !( event.charCode >= 48 && event.charCode <= 57 ) )
|
611 |
+
event.preventDefault();
|
612 |
+
} );
|
613 |
+
},
|
614 |
/**
|
615 |
* Custom js for elements
|
616 |
* @returns {undefined}
|
617 |
*/
|
618 |
custom: function () {
|
|
|
619 |
var $self = this;
|
620 |
var _prefix = $self.options._prefix;
|
621 |
|
672 |
return message;
|
673 |
}
|
674 |
};
|
675 |
+
|
676 |
+
// Validate number
|
677 |
+
$self.validate_number();
|
678 |
}
|
679 |
};
|
680 |
}( jQuery ) );
|
admin/content-views-admin.php
CHANGED
@@ -297,8 +297,7 @@ class PT_Content_Views_Admin {
|
|
297 |
* Add a settings page for this plugin to the Settings menu.
|
298 |
*/
|
299 |
// Get user role settings option
|
300 |
-
$
|
301 |
-
$user_role = current_user_can( 'administrator' ) ? 'administrator' : ( isset( $options[ 'access_role' ] ) ? $options[ 'access_role' ] : 'edit_posts' );
|
302 |
|
303 |
$this->plugin_screen_hook_suffix = add_menu_page(
|
304 |
__( 'Content View Settings', $this->plugin_slug ), __( 'Content View Settings', $this->plugin_slug ), $user_role, $this->plugin_slug, array( $this, 'display_plugin_admin_page' ), '', '45.6'
|
297 |
* Add a settings page for this plugin to the Settings menu.
|
298 |
*/
|
299 |
// Get user role settings option
|
300 |
+
$user_role = current_user_can( 'administrator' ) ? 'administrator' : PT_CV_Functions::get_option_value( 'access_role', 'edit_posts' );
|
|
|
301 |
|
302 |
$this->plugin_screen_hook_suffix = add_menu_page(
|
303 |
__( 'Content View Settings', $this->plugin_slug ), __( 'Content View Settings', $this->plugin_slug ), $user_role, $this->plugin_slug, array( $this, 'display_plugin_admin_page' ), '', '45.6'
|
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.3
|
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.3' );
|
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.3.1
|
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.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' );
|
includes/functions.php
CHANGED
@@ -165,6 +165,17 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
165 |
return $content;
|
166 |
}
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
/**
|
169 |
* Generate random string
|
170 |
*
|
165 |
return $content;
|
166 |
}
|
167 |
|
168 |
+
/**
|
169 |
+
* Get value of option Content Views Settings page
|
170 |
+
* @param string $option_name
|
171 |
+
* @param mixed $default
|
172 |
+
* @return mixed
|
173 |
+
*/
|
174 |
+
static function get_option_value( $option_name, $default = '' ) {
|
175 |
+
$options = get_option( PT_CV_OPTION_NAME );
|
176 |
+
return isset( $options[ $option_name ] ) ? $options[ $option_name ] : $default;
|
177 |
+
}
|
178 |
+
|
179 |
/**
|
180 |
* Generate random string
|
181 |
*
|
includes/html-viewtype.php
CHANGED
@@ -57,14 +57,17 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
|
|
57 |
*
|
58 |
* @param array $content_items The array of Raw HTML output (is not wrapped) of each item
|
59 |
* @param array $content The output array
|
|
|
|
|
60 |
*
|
61 |
* @return array Array of rows, each row contains columns
|
62 |
*/
|
63 |
-
static function grid_wrapper( $content_items, &$content
|
|
|
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 );
|
@@ -78,7 +81,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
|
|
78 |
$_span_width = ( $idx == count( $items_per_row ) - 1 ) ? $span_width_last : $span_width;
|
79 |
|
80 |
// Wrap content of item
|
81 |
-
$item_classes = apply_filters( PT_CV_PREFIX_ . 'item_col_class', array( $span_class . $_span_width ), $_span_width );
|
82 |
$item_class = implode( ' ', array_filter( $item_classes ) );
|
83 |
$row_html[] = PT_CV_Html::content_item_wrap( $content_item, $item_class, $post_id );
|
84 |
|
57 |
*
|
58 |
* @param array $content_items The array of Raw HTML output (is not wrapped) of each item
|
59 |
* @param array $content The output array
|
60 |
+
* @param int $column The expected column
|
61 |
+
* @param int $class Predefined class name
|
62 |
*
|
63 |
* @return array Array of rows, each row contains columns
|
64 |
*/
|
65 |
+
static function grid_wrapper( $content_items, &$content, $column = 0,
|
66 |
+
$class = '' ) {
|
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( $column );
|
71 |
|
72 |
// Split items to rows
|
73 |
$columns_item = array_chunk( $content_items, $columns, true );
|
81 |
$_span_width = ( $idx == count( $items_per_row ) - 1 ) ? $span_width_last : $span_width;
|
82 |
|
83 |
// Wrap content of item
|
84 |
+
$item_classes = apply_filters( PT_CV_PREFIX_ . 'item_col_class', array( $span_class . $_span_width, $class ), $_span_width );
|
85 |
$item_class = implode( ' ', array_filter( $item_classes ) );
|
86 |
$row_html[] = PT_CV_Html::content_item_wrap( $content_item, $item_class, $post_id );
|
87 |
|
includes/html.php
CHANGED
@@ -271,7 +271,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
271 |
$dargs = PT_CV_Functions::get_global_variable( 'dargs' );
|
272 |
|
273 |
if ( empty( $content_items ) ) {
|
274 |
-
return '';
|
275 |
}
|
276 |
|
277 |
// Assign as global variable
|
@@ -448,7 +448,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
448 |
$title = __( '(no title)', PT_CV_DOMAIN );
|
449 |
}
|
450 |
|
451 |
-
$title = apply_filters( PT_CV_PREFIX_ . 'field_title_result', $title, $fargs );
|
452 |
|
453 |
$html = sprintf(
|
454 |
'<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr( $title_class ), self::_field_href( $oargs, $post, $title )
|
@@ -798,9 +798,6 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
798 |
// Mark as processed
|
799 |
$pt_cv_glb[ $pt_cv_id ][ 'applied_assets' ] = 1;
|
800 |
|
801 |
-
// Get settings option
|
802 |
-
$options = get_option( PT_CV_OPTION_NAME );
|
803 |
-
|
804 |
// Print inline view styles & scripts
|
805 |
if ( apply_filters( PT_CV_PREFIX_ . 'assets_verbose_loading', 1 ) ) {
|
806 |
$assets = array( 'css', 'js' );
|
@@ -871,11 +868,8 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
871 |
* @param bool $is_admin Whether or not in WP Admin
|
872 |
*/
|
873 |
static function frontend_scripts( $is_admin = false ) {
|
874 |
-
|
875 |
-
|
876 |
-
$options = get_option( PT_CV_OPTION_NAME );
|
877 |
-
|
878 |
-
if ( $is_admin || !isset( $options[ 'unload_bootstrap' ] ) ) {
|
879 |
// Load bootstrap js
|
880 |
PT_CV_Asset::enqueue( 'bootstrap' );
|
881 |
}
|
@@ -927,11 +921,8 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
927 |
* @global bool $is_IE
|
928 |
*/
|
929 |
static function frontend_styles() {
|
930 |
-
|
931 |
-
|
932 |
-
$options = get_option( PT_CV_OPTION_NAME );
|
933 |
-
|
934 |
-
if ( !is_admin() && !isset( $options[ 'unload_bootstrap' ] ) ) {
|
935 |
PT_CV_Asset::enqueue( 'bootstrap', 'style' );
|
936 |
}
|
937 |
|
271 |
$dargs = PT_CV_Functions::get_global_variable( 'dargs' );
|
272 |
|
273 |
if ( empty( $content_items ) ) {
|
274 |
+
return 'empty content_items';
|
275 |
}
|
276 |
|
277 |
// Assign as global variable
|
448 |
$title = __( '(no title)', PT_CV_DOMAIN );
|
449 |
}
|
450 |
|
451 |
+
$title = apply_filters( PT_CV_PREFIX_ . 'field_title_result', $title, $fargs, $post->ID );
|
452 |
|
453 |
$html = sprintf(
|
454 |
'<%1$s class="%2$s">%3$s</%1$s>', $tag, esc_attr( $title_class ), self::_field_href( $oargs, $post, $title )
|
798 |
// Mark as processed
|
799 |
$pt_cv_glb[ $pt_cv_id ][ 'applied_assets' ] = 1;
|
800 |
|
|
|
|
|
|
|
801 |
// Print inline view styles & scripts
|
802 |
if ( apply_filters( PT_CV_PREFIX_ . 'assets_verbose_loading', 1 ) ) {
|
803 |
$assets = array( 'css', 'js' );
|
868 |
* @param bool $is_admin Whether or not in WP Admin
|
869 |
*/
|
870 |
static function frontend_scripts( $is_admin = false ) {
|
871 |
+
$unload_bootstrap = PT_CV_Functions::get_option_value( 'unload_bootstrap' );
|
872 |
+
if ( $is_admin || empty( $unload_bootstrap ) ) {
|
|
|
|
|
|
|
873 |
// Load bootstrap js
|
874 |
PT_CV_Asset::enqueue( 'bootstrap' );
|
875 |
}
|
921 |
* @global bool $is_IE
|
922 |
*/
|
923 |
static function frontend_styles() {
|
924 |
+
$unload_bootstrap = PT_CV_Functions::get_option_value( 'unload_bootstrap' );
|
925 |
+
if ( !is_admin() && empty( $unload_bootstrap ) ) {
|
|
|
|
|
|
|
926 |
PT_CV_Asset::enqueue( 'bootstrap', 'style' );
|
927 |
}
|
928 |
|
includes/values.php
CHANGED
@@ -28,7 +28,7 @@ if ( !class_exists( 'PT_CV_Values' ) ) {
|
|
28 |
static function post_types( $args = array(), $excludes_ = array() ) {
|
29 |
$excludes = array_merge( array( 'attachment' ), $excludes_ );
|
30 |
$result = array();
|
31 |
-
$args = array_merge( array( 'public' => true, '
|
32 |
$args = apply_filters( PT_CV_PREFIX_ . 'post_types', $args );
|
33 |
$post_types = get_post_types( $args, 'objects' );
|
34 |
|
28 |
static function post_types( $args = array(), $excludes_ = array() ) {
|
29 |
$excludes = array_merge( array( 'attachment' ), $excludes_ );
|
30 |
$result = array();
|
31 |
+
$args = array_merge( array( 'public' => true, '_builtin' => true ), $args );
|
32 |
$args = apply_filters( PT_CV_PREFIX_ . 'post_types', $args );
|
33 |
$post_types = get_post_types( $args, 'objects' );
|
34 |
|