Version Description
- April 15 2016 =
- New: [Collapsible list] Show first item by default
- Fix: Blank excerpt when post content was made all by shortcodes
- Fix: Little style issue of numeric text field in WordPress 4.5
- Fix: Remove unwanted styles (uniform.aristo ...) of another plugin in View page (it caused setting options are overlapping each others)
- Update: Uncheck "Show Author", "Show Comment" by default
Download this release
Release Info
Developer | PT Guy |
Plugin | Content Views – Post Grid & List for WordPress |
Version | 1.8.3 |
Comparing to | |
See all releases |
Code changes from version 1.8.2 to 1.8.3
- README.txt +9 -2
- admin/assets/css/admin.css +6 -1
- admin/content-views-admin.php +19 -3
- admin/includes/options.php +2 -2
- content-views.php +2 -2
- includes/functions.php +50 -24
- includes/hooks.php +1 -1
- includes/html-viewtype.php +7 -6
- includes/html.php +27 -19
- includes/settings.php +2 -2
- public/assets/css/public.css +11 -23
- public/assets/js/public.js +9 -16
- public/templates/collapsible/html/main.php +19 -29
README.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: pt-guy
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
|
4 |
Tags: post, post grid, display, recent, posts, recent post, 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.
|
7 |
-
Stable tag: 1.8.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -136,6 +136,13 @@ If you are using "Your latest posts" as home page, you should paste this code `<
|
|
136 |
|
137 |
== Changelog ==
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
= 1.8.2 - April 01 2016 =
|
140 |
* Update: Remove default font-size 14 pixels for post content in View
|
141 |
* Tweak: Show post id as data for item (facilitate to customize individual post style)
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JGUF974QBRKQE
|
4 |
Tags: post, post grid, display, recent, posts, recent post, 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.5
|
7 |
+
Stable tag: 1.8.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
136 |
|
137 |
== Changelog ==
|
138 |
|
139 |
+
= 1.8.3 - April 15 2016 =
|
140 |
+
* New: [Collapsible list] Show first item by default
|
141 |
+
* Fix: Blank excerpt when post content was made all by shortcodes
|
142 |
+
* Fix: Little style issue of numeric text field in WordPress 4.5
|
143 |
+
* Fix: Remove unwanted styles (uniform.aristo ...) of another plugin in View page (it caused setting options are overlapping each others)
|
144 |
+
* Update: Uncheck "Show Author", "Show Comment" by default
|
145 |
+
|
146 |
= 1.8.2 - April 01 2016 =
|
147 |
* Update: Remove default font-size 14 pixels for post content in View
|
148 |
* Tweak: Show post id as data for item (facilitate to customize individual post style)
|
admin/assets/css/admin.css
CHANGED
@@ -18,6 +18,9 @@
|
|
18 |
-webkit-box-shadow: none !important;
|
19 |
box-shadow: none !important;
|
20 |
}
|
|
|
|
|
|
|
21 |
|
22 |
/* Fix Bootstrap box-sizing "border-box" problem */
|
23 |
.pt-wrap *,
|
@@ -80,6 +83,8 @@ html {
|
|
80 |
|
81 |
#pt-cv-form-view .nav .glyphicon {
|
82 |
margin-right: 6px;
|
|
|
|
|
83 |
}
|
84 |
|
85 |
#pt-cv-form-view *, .preview-wrapper label {
|
@@ -95,7 +100,7 @@ html {
|
|
95 |
}
|
96 |
|
97 |
.pt-wrap .tab-content {
|
98 |
-
margin-top:
|
99 |
}
|
100 |
|
101 |
.pt-wrap .form-group.pt-form-group {
|
18 |
-webkit-box-shadow: none !important;
|
19 |
box-shadow: none !important;
|
20 |
}
|
21 |
+
.pt-wrap input[type=number] {
|
22 |
+
height: 34px;
|
23 |
+
}
|
24 |
|
25 |
/* Fix Bootstrap box-sizing "border-box" problem */
|
26 |
.pt-wrap *,
|
83 |
|
84 |
#pt-cv-form-view .nav .glyphicon {
|
85 |
margin-right: 6px;
|
86 |
+
color: rgba(255, 90, 95, 0.8);
|
87 |
+
font-size: 12px;
|
88 |
}
|
89 |
|
90 |
#pt-cv-form-view *, .preview-wrapper label {
|
100 |
}
|
101 |
|
102 |
.pt-wrap .tab-content {
|
103 |
+
margin-top: 10px;
|
104 |
}
|
105 |
|
106 |
.pt-wrap .form-group.pt-form-group {
|
admin/content-views-admin.php
CHANGED
@@ -47,6 +47,7 @@ class PT_Content_Views_Admin {
|
|
47 |
// Load admin style sheet and JavaScript.
|
48 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
49 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
|
|
50 |
add_action( 'admin_print_footer_scripts', array( $this, 'print_footer_scripts' ) );
|
51 |
|
52 |
// Add the options page and menu item.
|
@@ -122,7 +123,6 @@ class PT_Content_Views_Admin {
|
|
122 |
* @return null Return early if no settings page is registered.
|
123 |
*/
|
124 |
public function enqueue_admin_styles() {
|
125 |
-
|
126 |
if ( !isset( $this->plugin_screen_hook_suffix ) ) {
|
127 |
return;
|
128 |
}
|
@@ -191,7 +191,6 @@ class PT_Content_Views_Admin {
|
|
191 |
* @return null Return early if no settings page is registered.
|
192 |
*/
|
193 |
public function enqueue_admin_scripts() {
|
194 |
-
|
195 |
if ( !isset( $this->plugin_screen_hook_suffix ) ) {
|
196 |
return;
|
197 |
}
|
@@ -242,11 +241,28 @@ class PT_Content_Views_Admin {
|
|
242 |
|
243 |
// For Preview
|
244 |
PT_CV_Html::frontend_scripts();
|
245 |
-
|
246 |
PT_CV_Asset::enqueue( 'select2' );
|
247 |
}
|
248 |
}
|
249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
/**
|
251 |
* Print script at footer of WP admin
|
252 |
*/
|
47 |
// Load admin style sheet and JavaScript.
|
48 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
49 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
50 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'remove_unwanted_assets' ), 1000 );
|
51 |
add_action( 'admin_print_footer_scripts', array( $this, 'print_footer_scripts' ) );
|
52 |
|
53 |
// Add the options page and menu item.
|
123 |
* @return null Return early if no settings page is registered.
|
124 |
*/
|
125 |
public function enqueue_admin_styles() {
|
|
|
126 |
if ( !isset( $this->plugin_screen_hook_suffix ) ) {
|
127 |
return;
|
128 |
}
|
191 |
* @return null Return early if no settings page is registered.
|
192 |
*/
|
193 |
public function enqueue_admin_scripts() {
|
|
|
194 |
if ( !isset( $this->plugin_screen_hook_suffix ) ) {
|
195 |
return;
|
196 |
}
|
241 |
|
242 |
// For Preview
|
243 |
PT_CV_Html::frontend_scripts();
|
|
|
244 |
PT_CV_Asset::enqueue( 'select2' );
|
245 |
}
|
246 |
}
|
247 |
|
248 |
+
/**
|
249 |
+
* Remove unwanted assets in View Admin page
|
250 |
+
*/
|
251 |
+
public function remove_unwanted_assets() {
|
252 |
+
if ( !isset( $this->plugin_screen_hook_suffix ) ) {
|
253 |
+
return;
|
254 |
+
}
|
255 |
+
|
256 |
+
$screen = get_current_screen();
|
257 |
+
if ( $this->plugin_screen_hook_suffix == $screen->id || in_array( $screen->id, $this->plugin_sub_screen_hook_suffix ) ) {
|
258 |
+
wp_dequeue_style( 'uniform.aristo' );
|
259 |
+
wp_dequeue_style( 'unifStyleSheet' );
|
260 |
+
wp_dequeue_style( 'ssrc_grid_admin_styles' );
|
261 |
+
wp_dequeue_script( 'ssrc_grid_admin_scripts' );
|
262 |
+
do_action( PT_CV_PREFIX_ . 'remove_unwanted_assets' );
|
263 |
+
}
|
264 |
+
}
|
265 |
+
|
266 |
/**
|
267 |
* Print script at footer of WP admin
|
268 |
*/
|
admin/includes/options.php
CHANGED
@@ -190,6 +190,7 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
|
|
190 |
$id = !empty( $param[ 'id' ] ) ? "id='" . PT_CV_PREFIX . esc_attr( $param[ 'id' ] ) . "'" : '';
|
191 |
$value = isset( $value_ ) ? $value_ : self::field_value( $data, $param, $name );
|
192 |
$description = isset( $param[ 'desc' ] ) ? $param[ 'desc' ] : '';
|
|
|
193 |
|
194 |
// Add extra information of option type
|
195 |
switch ( $type ) {
|
@@ -222,7 +223,6 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
|
|
222 |
case 'password':
|
223 |
case 'number':
|
224 |
case 'url':
|
225 |
-
$placeholder = !empty( $param[ 'placeholder' ] ) ? $param[ 'placeholder' ] : '';
|
226 |
$prepend_text = !empty( $param[ 'prepend_text' ] ) ? $param[ 'prepend_text' ] : '';
|
227 |
$append_text = !empty( $param[ 'append_text' ] ) ? $param[ 'append_text' ] : '';
|
228 |
|
@@ -241,7 +241,7 @@ if ( !class_exists( 'PT_Options_Framework' ) ) {
|
|
241 |
break;
|
242 |
|
243 |
case 'textarea':
|
244 |
-
$html .= "<textarea name='$name' class='$class' $id $extend>$value</textarea>";
|
245 |
break;
|
246 |
|
247 |
case 'checkbox':
|
190 |
$id = !empty( $param[ 'id' ] ) ? "id='" . PT_CV_PREFIX . esc_attr( $param[ 'id' ] ) . "'" : '';
|
191 |
$value = isset( $value_ ) ? $value_ : self::field_value( $data, $param, $name );
|
192 |
$description = isset( $param[ 'desc' ] ) ? $param[ 'desc' ] : '';
|
193 |
+
$placeholder = isset( $param[ 'placeholder' ] ) ? $param[ 'placeholder' ] : '';
|
194 |
|
195 |
// Add extra information of option type
|
196 |
switch ( $type ) {
|
223 |
case 'password':
|
224 |
case 'number':
|
225 |
case 'url':
|
|
|
226 |
$prepend_text = !empty( $param[ 'prepend_text' ] ) ? $param[ 'prepend_text' ] : '';
|
227 |
$append_text = !empty( $param[ 'append_text' ] ) ? $param[ 'append_text' ] : '';
|
228 |
|
241 |
break;
|
242 |
|
243 |
case 'textarea':
|
244 |
+
$html .= "<textarea name='$name' class='$class' $id $extend placeholder='$placeholder' rows=4>$value</textarea>";
|
245 |
break;
|
246 |
|
247 |
case 'checkbox':
|
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.8.
|
15 |
* Author: PT Guy
|
16 |
* Author URI: http://profiles.wordpress.org/pt-guy
|
17 |
* Text Domain: content-views-query-and-display-post-page
|
@@ -26,7 +26,7 @@ if ( !defined( 'WPINC' ) ) {
|
|
26 |
}
|
27 |
|
28 |
// Define Constant
|
29 |
-
define( 'PT_CV_VERSION', '1.8.
|
30 |
define( 'PT_CV_FILE', __FILE__ );
|
31 |
define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
|
32 |
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.8.3
|
15 |
* Author: PT Guy
|
16 |
* Author URI: http://profiles.wordpress.org/pt-guy
|
17 |
* Text Domain: content-views-query-and-display-post-page
|
26 |
}
|
27 |
|
28 |
// Define Constant
|
29 |
+
define( 'PT_CV_VERSION', '1.8.3' );
|
30 |
define( 'PT_CV_FILE', __FILE__ );
|
31 |
define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
|
32 |
include_once( PT_CV_PATH . 'includes/defines.php' );
|
includes/functions.php
CHANGED
@@ -224,22 +224,48 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
224 |
* @param int $num_words
|
225 |
* @return string
|
226 |
*/
|
227 |
-
static function
|
228 |
// Add shortcode which was not added to global $shortcode_tags manually
|
229 |
do_action( PT_CV_PREFIX_ . 'before_strip_shortcodes' );
|
230 |
|
231 |
-
|
232 |
-
|
|
|
|
|
|
|
|
|
233 |
|
234 |
// Recovery global $shortcode_tags
|
235 |
do_action( PT_CV_PREFIX_ . 'after_strip_shortcodes' );
|
236 |
|
237 |
// Strip HTML tags
|
238 |
-
$result = self::
|
|
|
239 |
|
240 |
return self::trim_words( $result, $num_words );
|
241 |
}
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
/**
|
244 |
* Trim string by words length, but keep content/text of HTML tags
|
245 |
*
|
@@ -263,7 +289,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
263 |
* @param string $string
|
264 |
* @return string
|
265 |
*/
|
266 |
-
static function
|
267 |
// Changes double line-breaks in the text into HTML paragraphs (<p>, <br>)
|
268 |
if ( apply_filters( PT_CV_PREFIX_ . 'wpautop', 0 ) ) {
|
269 |
$string = wpautop( $string );
|
@@ -430,7 +456,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
430 |
$text = __( 'View all posts in', PT_CV_TEXTDOMAIN );
|
431 |
$term_name = esc_attr( $term->name );
|
432 |
$class = esc_attr( PT_CV_PREFIX . 'tax-' . PT_CV_Functions::term_slug_sanitize( $term->slug ) );
|
433 |
-
$
|
|
|
434 |
}
|
435 |
|
436 |
// Add this term to terms list of an item
|
@@ -440,8 +467,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
440 |
$pt_cv_glb[ 'item_terms' ][ $post_id ][ PT_CV_Functions::term_slug_sanitize( $term->slug ) ] = $term->name;
|
441 |
}
|
442 |
|
443 |
-
|
444 |
-
return implode(
|
445 |
}
|
446 |
|
447 |
/**
|
@@ -589,8 +616,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
589 |
* @return string HTML output of Content View
|
590 |
*/
|
591 |
static function view_process_settings( $view_id, $settings, $pargs = array() ) {
|
592 |
-
if ( empty( $settings ) ) {
|
593 |
-
return __( 'Empty settings', PT_CV_TEXTDOMAIN );
|
594 |
}
|
595 |
|
596 |
// Check duplicated
|
@@ -614,12 +641,13 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
614 |
}
|
615 |
$pt_cv_glb[ $pt_cv_id ][ 'view_settings' ] = $view_settings;
|
616 |
|
617 |
-
|
618 |
-
$content_type = apply_filters( PT_CV_PREFIX_ . 'content_type', PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $view_settings ), $view_id );
|
619 |
$view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $view_settings );
|
|
|
620 |
|
621 |
$pt_cv_glb[ $pt_cv_id ][ 'content_type' ] = $content_type;
|
622 |
$pt_cv_glb[ $pt_cv_id ][ 'view_type' ] = $view_type;
|
|
|
623 |
|
624 |
// Keep current ID
|
625 |
$pt_cv_cur_id = $view_id;
|
@@ -661,10 +689,6 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
661 |
|
662 |
$content_items = $pt_query = $empty_result = null;
|
663 |
|
664 |
-
// Page number
|
665 |
-
$current_page = self::get_current_page( $pargs, $dargs );
|
666 |
-
$pt_cv_glb[ $pt_cv_id ][ 'current_page' ] = $current_page;
|
667 |
-
|
668 |
// What kind of content to display
|
669 |
$pt_cv_glb[ $pt_cv_id ][ 'display_what' ] = apply_filters( PT_CV_PREFIX_ . 'display_what', 'post' );
|
670 |
|
@@ -755,7 +779,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
755 |
$_class = apply_filters( PT_CV_PREFIX_ . 'content_no_post_found_class', 'alert alert-warning ' . PT_CV_PREFIX . 'no-post' );
|
756 |
|
757 |
// Get no post found text
|
758 |
-
$_text =
|
759 |
|
760 |
// Output HTML
|
761 |
$content_items[] = sprintf( '<div class="%s">%s</div>', esc_attr( $_class ), $_text );
|
@@ -1115,7 +1139,7 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
1115 |
$args[ 'posts_per_page' ] = $posts_per_page;
|
1116 |
|
1117 |
// Get offset
|
1118 |
-
$paged = self::get_current_page( $pargs
|
1119 |
|
1120 |
$offset = $posts_per_page * ( (int) $paged - 1 );
|
1121 |
|
@@ -1399,15 +1423,17 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
1399 |
/**
|
1400 |
* Get current page number
|
1401 |
*/
|
1402 |
-
static function get_current_page( $pargs
|
1403 |
$paged = 1;
|
1404 |
|
1405 |
-
if (
|
1406 |
-
|
1407 |
-
|
|
|
1408 |
|
1409 |
-
|
1410 |
-
|
|
|
1411 |
}
|
1412 |
|
1413 |
return $paged;
|
224 |
* @param int $num_words
|
225 |
* @return string
|
226 |
*/
|
227 |
+
static function cv_trim_words( $text, $num_words = 500 ) {
|
228 |
// Add shortcode which was not added to global $shortcode_tags manually
|
229 |
do_action( PT_CV_PREFIX_ . 'before_strip_shortcodes' );
|
230 |
|
231 |
+
/**
|
232 |
+
* Strip all shortcodes
|
233 |
+
*
|
234 |
+
* $text = strip_shortcodes( $text ); // @version < 1.8.3
|
235 |
+
*/
|
236 |
+
$text = self::cv_strip_shortcodes( $text );
|
237 |
|
238 |
// Recovery global $shortcode_tags
|
239 |
do_action( PT_CV_PREFIX_ . 'after_strip_shortcodes' );
|
240 |
|
241 |
// Strip HTML tags
|
242 |
+
$result = self::cv_strip_tags( $text );
|
243 |
+
|
244 |
|
245 |
return self::trim_words( $result, $num_words );
|
246 |
}
|
247 |
|
248 |
+
/**
|
249 |
+
* strip_shortcodes for CV
|
250 |
+
* @since 1.8.3
|
251 |
+
*
|
252 |
+
* @global array $shortcode_tags
|
253 |
+
* @param type $text
|
254 |
+
*/
|
255 |
+
static function cv_strip_shortcodes( $text ) {
|
256 |
+
global $shortcode_tags;
|
257 |
+
$tagnames = array_keys( $shortcode_tags );
|
258 |
+
$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
|
259 |
+
|
260 |
+
return preg_replace( '/'
|
261 |
+
. '\[' // Opening bracket
|
262 |
+
. '(\/?)'
|
263 |
+
. "($tagregexp)" // All shortcode tags
|
264 |
+
. '[^\]]*' // Shortcode parameters
|
265 |
+
. '\]' // Closing bracket
|
266 |
+
. '/', '', $text );
|
267 |
+
}
|
268 |
+
|
269 |
/**
|
270 |
* Trim string by words length, but keep content/text of HTML tags
|
271 |
*
|
289 |
* @param string $string
|
290 |
* @return string
|
291 |
*/
|
292 |
+
static function cv_strip_tags( $string ) {
|
293 |
// Changes double line-breaks in the text into HTML paragraphs (<p>, <br>)
|
294 |
if ( apply_filters( PT_CV_PREFIX_ . 'wpautop', 0 ) ) {
|
295 |
$string = wpautop( $string );
|
456 |
$text = __( 'View all posts in', PT_CV_TEXTDOMAIN );
|
457 |
$term_name = esc_attr( $term->name );
|
458 |
$class = esc_attr( PT_CV_PREFIX . 'tax-' . PT_CV_Functions::term_slug_sanitize( $term->slug ) );
|
459 |
+
$term_html = "<a href='$href' title='$text $term_name' class='$class'>{$term->name}</a>";
|
460 |
+
$links[] = apply_filters( PT_CV_PREFIX_ . 'post_term_html', $term_html, $term );
|
461 |
}
|
462 |
|
463 |
// Add this term to terms list of an item
|
467 |
$pt_cv_glb[ 'item_terms' ][ $post_id ][ PT_CV_Functions::term_slug_sanitize( $term->slug ) ] = $term->name;
|
468 |
}
|
469 |
|
470 |
+
$separator = apply_filters( PT_CV_PREFIX_ . 'post_terms_separator', ', ' );
|
471 |
+
return implode( $separator, apply_filters( PT_CV_PREFIX_ . 'terms_list', $links, $pt_cv_id ) );
|
472 |
}
|
473 |
|
474 |
/**
|
616 |
* @return string HTML output of Content View
|
617 |
*/
|
618 |
static function view_process_settings( $view_id, $settings, $pargs = array() ) {
|
619 |
+
if ( empty( $settings[ PT_CV_PREFIX . 'view-type' ] ) ) {
|
620 |
+
return sprintf( __( 'Empty settings (View %s is not existed)', PT_CV_TEXTDOMAIN ), "<strong>$view_id</strong>" );
|
621 |
}
|
622 |
|
623 |
// Check duplicated
|
641 |
}
|
642 |
$pt_cv_glb[ $pt_cv_id ][ 'view_settings' ] = $view_settings;
|
643 |
|
644 |
+
$content_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'content-type', $view_settings );
|
|
|
645 |
$view_type = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'view-type', $view_settings );
|
646 |
+
$current_page = self::get_current_page( $pargs );
|
647 |
|
648 |
$pt_cv_glb[ $pt_cv_id ][ 'content_type' ] = $content_type;
|
649 |
$pt_cv_glb[ $pt_cv_id ][ 'view_type' ] = $view_type;
|
650 |
+
$pt_cv_glb[ $pt_cv_id ][ 'current_page' ] = $current_page;
|
651 |
|
652 |
// Keep current ID
|
653 |
$pt_cv_cur_id = $view_id;
|
689 |
|
690 |
$content_items = $pt_query = $empty_result = null;
|
691 |
|
|
|
|
|
|
|
|
|
692 |
// What kind of content to display
|
693 |
$pt_cv_glb[ $pt_cv_id ][ 'display_what' ] = apply_filters( PT_CV_PREFIX_ . 'display_what', 'post' );
|
694 |
|
779 |
$_class = apply_filters( PT_CV_PREFIX_ . 'content_no_post_found_class', 'alert alert-warning ' . PT_CV_PREFIX . 'no-post' );
|
780 |
|
781 |
// Get no post found text
|
782 |
+
$_text = PT_CV_Html::no_post_found();
|
783 |
|
784 |
// Output HTML
|
785 |
$content_items[] = sprintf( '<div class="%s">%s</div>', esc_attr( $_class ), $_text );
|
1139 |
$args[ 'posts_per_page' ] = $posts_per_page;
|
1140 |
|
1141 |
// Get offset
|
1142 |
+
$paged = self::get_current_page( $pargs );
|
1143 |
|
1144 |
$offset = $posts_per_page * ( (int) $paged - 1 );
|
1145 |
|
1423 |
/**
|
1424 |
* Get current page number
|
1425 |
*/
|
1426 |
+
static function get_current_page( $pargs ) {
|
1427 |
$paged = 1;
|
1428 |
|
1429 |
+
if ( PT_CV_Functions::setting_value( PT_CV_PREFIX . 'enable-pagination' ) ) {
|
1430 |
+
if ( !empty( $pargs[ 'page' ] ) ) {
|
1431 |
+
$paged = intval( $pargs[ 'page' ] );
|
1432 |
+
}
|
1433 |
|
1434 |
+
if ( !empty( $_GET[ 'vpage' ] ) && PT_CV_Functions::setting_value( PT_CV_PREFIX . 'pagination-type' ) === 'normal' ) {
|
1435 |
+
$paged = intval( $_GET[ 'vpage' ] );
|
1436 |
+
}
|
1437 |
}
|
1438 |
|
1439 |
return $paged;
|
includes/hooks.php
CHANGED
@@ -136,7 +136,7 @@ if ( !class_exists( 'PT_CV_Hooks' ) ) {
|
|
136 |
|
137 |
// Disable WP 4.4 responsive image
|
138 |
public static function filter_disable_wp_responsive_image( $args ) {
|
139 |
-
if (
|
140 |
if ( isset( $args[ 'sizes' ] ) )
|
141 |
unset( $args[ 'sizes' ] );
|
142 |
if ( isset( $args[ 'srcset' ] ) )
|
136 |
|
137 |
// Disable WP 4.4 responsive image
|
138 |
public static function filter_disable_wp_responsive_image( $args ) {
|
139 |
+
if ( PT_CV_Html::is_responsive_image_disabled() ) {
|
140 |
if ( isset( $args[ 'sizes' ] ) )
|
141 |
unset( $args[ 'sizes' ] );
|
142 |
if ( isset( $args[ 'srcset' ] ) )
|
includes/html-viewtype.php
CHANGED
@@ -66,7 +66,7 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
|
|
66 |
list( $columns, $span_width_last, $span_width, $span_class ) = self::process_column_width( $column );
|
67 |
|
68 |
// Split items to rows
|
69 |
-
$columns_item
|
70 |
|
71 |
// Get HTML of each row
|
72 |
foreach ( $columns_item as $items_per_row ) {
|
@@ -100,14 +100,15 @@ if ( !class_exists( 'PT_CV_Html_ViewType' ) ) {
|
|
100 |
* @return string Collapsible list, wrapped in a "panel-group" div
|
101 |
*/
|
102 |
static function collapsible_wrapper( $content_items, &$content ) {
|
103 |
-
|
104 |
-
$
|
|
|
105 |
|
106 |
-
$
|
107 |
-
foreach ( $content_items as $idx => $content_item ) {
|
108 |
// Replace class in body of collapsible item, to show one (now is the first item)
|
109 |
-
$class = ( $idx == 0 ) ? 'in' : '';
|
110 |
$content_item = str_replace( PT_CV_PREFIX_UPPER . 'CLASS', $class, $content_item );
|
|
|
111 |
|
112 |
// Replace id in {data-parent="#ID"} of each item by generated id
|
113 |
$collapsible_list[] = str_replace( PT_CV_PREFIX_UPPER . 'ID', $random_id, $content_item );
|
66 |
list( $columns, $span_width_last, $span_width, $span_class ) = self::process_column_width( $column );
|
67 |
|
68 |
// Split items to rows
|
69 |
+
$columns_item = array_chunk( $content_items, $columns, true );
|
70 |
|
71 |
// Get HTML of each row
|
72 |
foreach ( $columns_item as $items_per_row ) {
|
100 |
* @return string Collapsible list, wrapped in a "panel-group" div
|
101 |
*/
|
102 |
static function collapsible_wrapper( $content_items, &$content ) {
|
103 |
+
$random_id = PT_CV_Functions::string_random();
|
104 |
+
$idx = 0;
|
105 |
+
$collapsible_list = array();
|
106 |
|
107 |
+
foreach ( $content_items as $post_id => $content_item ) {
|
|
|
108 |
// Replace class in body of collapsible item, to show one (now is the first item)
|
109 |
+
$class = ( $idx++ == 0 ) ? 'in' : '';
|
110 |
$content_item = str_replace( PT_CV_PREFIX_UPPER . 'CLASS', $class, $content_item );
|
111 |
+
$content_item = PT_CV_Html::content_item_wrap( $content_item, 'panel panel-default', $post_id );
|
112 |
|
113 |
// Replace id in {data-parent="#ID"} of each item by generated id
|
114 |
$collapsible_list[] = str_replace( PT_CV_PREFIX_UPPER . 'ID', $random_id, $content_item );
|
includes/html.php
CHANGED
@@ -230,25 +230,23 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
230 |
return '';
|
231 |
}
|
232 |
|
233 |
-
$
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
}
|
239 |
-
|
240 |
-
$extra_class = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'lf-mobile-disable' ) ? PT_CV_PREFIX . 'nolf' : '';
|
241 |
-
$item_class = apply_filters( PT_CV_PREFIX_ . 'content_item_class', array( $class, PT_CV_PREFIX . 'content-item', PT_CV_PREFIX . $dargs[ 'layout-format' ], $extra_class ), $post_id );
|
242 |
$item_filter = apply_filters( PT_CV_PREFIX_ . 'content_item_filter_value', '', $post_id );
|
243 |
|
244 |
-
// Add custom HTML for each item
|
245 |
ob_start();
|
246 |
do_action( PT_CV_PREFIX_ . 'item_extra_html', $post_id );
|
247 |
$html_item .= ob_get_clean();
|
248 |
|
249 |
-
$result = sprintf( '<div class="%s" %s>%s</div>',
|
|
|
|
|
250 |
|
251 |
-
|
|
|
252 |
}
|
253 |
|
254 |
/**
|
@@ -266,7 +264,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
266 |
$dargs = PT_CV_Functions::get_global_variable( 'dargs' );
|
267 |
|
268 |
if ( empty( $content_items ) ) {
|
269 |
-
return PT_CV_Functions::debug_output( 'empty content_items',
|
270 |
}
|
271 |
|
272 |
// Assign as global variable
|
@@ -304,7 +302,6 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
304 |
|
305 |
default :
|
306 |
foreach ( $content_items as $post_id => $content_item ) {
|
307 |
-
// Wrap content of item
|
308 |
$content[] = PT_CV_Html::content_item_wrap( $content_item, '', $post_id );
|
309 |
}
|
310 |
|
@@ -487,12 +484,18 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
487 |
|
488 |
// Get excerpt
|
489 |
if ( $length > 0 ) {
|
490 |
-
|
|
|
|
|
491 |
$full_excerpt = apply_filters( PT_CV_PREFIX_ . 'field_content_excerpt', get_the_content(), $fargs, $post );
|
492 |
|
493 |
// Limit length
|
494 |
-
|
495 |
-
|
|
|
|
|
|
|
|
|
496 |
|
497 |
// Append readmore button
|
498 |
$hide_readmore = apply_filters( PT_CV_PREFIX_ . 'hide_readmore', false, $excerpt, $full_excerpt, $post );
|
@@ -591,7 +594,7 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
591 |
* @since 1.7.5
|
592 |
* able to disable responsive image of WordPress 4.4
|
593 |
*/
|
594 |
-
if (
|
595 |
$gargs[ 'srcset' ] = 1;
|
596 |
}
|
597 |
|
@@ -676,7 +679,8 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
676 |
ob_start();
|
677 |
comments_popup_link( __( '0 Comment', PT_CV_TEXTDOMAIN ), __( '1 Comment', PT_CV_TEXTDOMAIN ), __( '% Comments', PT_CV_TEXTDOMAIN ) );
|
678 |
$comment_content = ob_get_clean();
|
679 |
-
$
|
|
|
680 |
endif;
|
681 |
break;
|
682 |
|
@@ -951,6 +955,10 @@ if ( !class_exists( 'PT_CV_Html' ) ) {
|
|
951 |
return ob_get_clean();
|
952 |
}
|
953 |
|
|
|
|
|
|
|
|
|
954 |
}
|
955 |
|
956 |
}
|
230 |
return '';
|
231 |
}
|
232 |
|
233 |
+
$classes = array( $class );
|
234 |
+
$classes[] = PT_CV_PREFIX . 'content-item';
|
235 |
+
$classes[] = PT_CV_PREFIX . PT_CV_Functions::setting_value( PT_CV_PREFIX . 'layout-format' );
|
236 |
+
$classes[] = PT_CV_Functions::setting_value( PT_CV_PREFIX . 'lf-mobile-disable' ) ? PT_CV_PREFIX . 'nolf' : '';
|
237 |
+
$item_class = apply_filters( PT_CV_PREFIX_ . 'content_item_class', $classes, $post_id );
|
|
|
|
|
|
|
|
|
238 |
$item_filter = apply_filters( PT_CV_PREFIX_ . 'content_item_filter_value', '', $post_id );
|
239 |
|
|
|
240 |
ob_start();
|
241 |
do_action( PT_CV_PREFIX_ . 'item_extra_html', $post_id );
|
242 |
$html_item .= ob_get_clean();
|
243 |
|
244 |
+
$result = sprintf( '<div class="%s" %s>%s</div>', implode( ' ', $item_class ), $item_filter, force_balance_tags( $html_item ) );
|
245 |
+
return apply_filters( PT_CV_PREFIX_ . 'item_final_html', $result, $post_id );
|
246 |
+
}
|
247 |
|
248 |
+
static function no_post_found() {
|
249 |
+
return apply_filters( PT_CV_PREFIX_ . 'content_no_post_found_text', __( 'No posts found!', PT_CV_TEXTDOMAIN ) );
|
250 |
}
|
251 |
|
252 |
/**
|
264 |
$dargs = PT_CV_Functions::get_global_variable( 'dargs' );
|
265 |
|
266 |
if ( empty( $content_items ) ) {
|
267 |
+
return PT_CV_Functions::debug_output( 'empty content_items', self::no_post_found() );
|
268 |
}
|
269 |
|
270 |
// Assign as global variable
|
302 |
|
303 |
default :
|
304 |
foreach ( $content_items as $post_id => $content_item ) {
|
|
|
305 |
$content[] = PT_CV_Html::content_item_wrap( $content_item, '', $post_id );
|
306 |
}
|
307 |
|
484 |
|
485 |
// Get excerpt
|
486 |
if ( $length > 0 ) {
|
487 |
+
$GLOBALS[ 'cv_excerpt_type' ] = 'content';
|
488 |
+
|
489 |
+
// Get manual excerpt, apply filters => modify $GLOBALS[ 'cv_excerpt_type' ] relatively
|
490 |
$full_excerpt = apply_filters( PT_CV_PREFIX_ . 'field_content_excerpt', get_the_content(), $fargs, $post );
|
491 |
|
492 |
// Limit length
|
493 |
+
if ( apply_filters( PT_CV_PREFIX_ . 'trim_excerpt', $GLOBALS[ 'cv_excerpt_type' ] == 'content' ) ) {
|
494 |
+
$trimmed_excerpt = PT_CV_Functions::cv_trim_words( $full_excerpt, $length );
|
495 |
+
$excerpt = apply_filters( PT_CV_PREFIX_ . 'trim_length_excerpt', $trimmed_excerpt, $full_excerpt, $length );
|
496 |
+
} else {
|
497 |
+
$excerpt = $full_excerpt;
|
498 |
+
}
|
499 |
|
500 |
// Append readmore button
|
501 |
$hide_readmore = apply_filters( PT_CV_PREFIX_ . 'hide_readmore', false, $excerpt, $full_excerpt, $post );
|
594 |
* @since 1.7.5
|
595 |
* able to disable responsive image of WordPress 4.4
|
596 |
*/
|
597 |
+
if ( PT_CV_Html::is_responsive_image_disabled() ) {
|
598 |
$gargs[ 'srcset' ] = 1;
|
599 |
}
|
600 |
|
679 |
ob_start();
|
680 |
comments_popup_link( __( '0 Comment', PT_CV_TEXTDOMAIN ), __( '1 Comment', PT_CV_TEXTDOMAIN ), __( '% Comments', PT_CV_TEXTDOMAIN ) );
|
681 |
$comment_content = ob_get_clean();
|
682 |
+
$comment_html = sprintf( '<span class="%s">%s %s</span>', esc_attr( $comment_class ), $prefix_text, $comment_content );
|
683 |
+
$html[ 'comment' ] = apply_filters( PT_CV_PREFIX_ . 'field_comment_html', $comment_html, $post );
|
684 |
endif;
|
685 |
break;
|
686 |
|
955 |
return ob_get_clean();
|
956 |
}
|
957 |
|
958 |
+
static function is_responsive_image_disabled() {
|
959 |
+
return apply_filters( PT_CV_PREFIX_ . 'disable_responsive_image', PT_CV_Functions::setting_value( PT_CV_PREFIX . 'field-thumbnail-nowprpi' ) );
|
960 |
+
}
|
961 |
+
|
962 |
}
|
963 |
|
964 |
}
|
includes/settings.php
CHANGED
@@ -644,7 +644,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
|
|
644 |
'type' => 'checkbox',
|
645 |
'name' => $prefix . 'author',
|
646 |
'options' => PT_CV_Values::yes_no( 'yes', __( 'Show Author', PT_CV_TEXTDOMAIN ) ),
|
647 |
-
'std' => '
|
648 |
),
|
649 |
),
|
650 |
),
|
@@ -683,7 +683,7 @@ if ( !class_exists( 'PT_CV_Settings' ) ) {
|
|
683 |
'type' => 'checkbox',
|
684 |
'name' => $prefix . 'comment',
|
685 |
'options' => PT_CV_Values::yes_no( 'yes', __( 'Show Comment Count', PT_CV_TEXTDOMAIN ) ),
|
686 |
-
'std' => '
|
687 |
),
|
688 |
),
|
689 |
),
|
644 |
'type' => 'checkbox',
|
645 |
'name' => $prefix . 'author',
|
646 |
'options' => PT_CV_Values::yes_no( 'yes', __( 'Show Author', PT_CV_TEXTDOMAIN ) ),
|
647 |
+
'std' => '',
|
648 |
),
|
649 |
),
|
650 |
),
|
683 |
'type' => 'checkbox',
|
684 |
'name' => $prefix . 'comment',
|
685 |
'options' => PT_CV_Values::yes_no( 'yes', __( 'Show Comment Count', PT_CV_TEXTDOMAIN ) ),
|
686 |
+
'std' => '',
|
687 |
),
|
688 |
),
|
689 |
),
|
public/assets/css/public.css
CHANGED
@@ -101,17 +101,6 @@
|
|
101 |
margin-bottom: 0 !important;
|
102 |
}
|
103 |
|
104 |
-
/* For the output which shows only Title */
|
105 |
-
.pt-cv-only-title {
|
106 |
-
padding-bottom: 0;
|
107 |
-
}
|
108 |
-
|
109 |
-
.pt-cv-only-title a {
|
110 |
-
display: list-item;
|
111 |
-
margin-left: 20px;
|
112 |
-
list-style-type: square;
|
113 |
-
}
|
114 |
-
|
115 |
/* Title */
|
116 |
.pt-cv-title {
|
117 |
margin-top: 0 !important;
|
@@ -264,14 +253,13 @@
|
|
264 |
margin-right: 0;
|
265 |
}
|
266 |
/* Caption */
|
267 |
-
.pt-cv-
|
268 |
text-align: left;
|
269 |
-
left: 0;
|
270 |
-
right: 15px;
|
271 |
bottom: 1em;
|
|
|
272 |
}
|
273 |
|
274 |
-
.pt-cv-
|
275 |
text-shadow: none;
|
276 |
}
|
277 |
|
@@ -293,30 +281,30 @@
|
|
293 |
}
|
294 |
|
295 |
/* Caption with image */
|
296 |
-
.pt-cv-
|
297 |
background: rgba(0, 0, 0, 0.6);
|
298 |
text-shadow: 0px 1px 1px #000;
|
299 |
-
left:
|
300 |
-
|
301 |
-
}
|
302 |
|
|
|
303 |
.pt-cv-cap-w-img * {
|
304 |
color: #fff;
|
305 |
}
|
306 |
-
|
307 |
.pt-cv-cap-w-img .pt-cv-title a {
|
308 |
color: #fff !important;
|
309 |
}
|
310 |
|
311 |
/* Caption without image */
|
312 |
-
.pt-cv-cap-wo-img {
|
313 |
position: relative !important;
|
|
|
|
|
|
|
314 |
}
|
315 |
-
|
316 |
.pt-cv-cap-wo-img * {
|
317 |
color: #000;
|
318 |
}
|
319 |
-
|
320 |
.pt-cv-cap-wo-img .pt-cv-readmore {
|
321 |
color: #fff;
|
322 |
}
|
101 |
margin-bottom: 0 !important;
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
/* Title */
|
105 |
.pt-cv-title {
|
106 |
margin-top: 0 !important;
|
253 |
margin-right: 0;
|
254 |
}
|
255 |
/* Caption */
|
256 |
+
.pt-cv-scrollable .pt-cv-carousel-caption {
|
257 |
text-align: left;
|
|
|
|
|
258 |
bottom: 1em;
|
259 |
+
padding: 10px;
|
260 |
}
|
261 |
|
262 |
+
.pt-cv-scrollable .pt-cv-carousel-caption * {
|
263 |
text-shadow: none;
|
264 |
}
|
265 |
|
281 |
}
|
282 |
|
283 |
/* Caption with image */
|
284 |
+
.pt-cv-scrollable .pt-cv-cap-w-img {
|
285 |
background: rgba(0, 0, 0, 0.6);
|
286 |
text-shadow: 0px 1px 1px #000;
|
287 |
+
left: 15px;
|
288 |
+
right: 15px;
|
|
|
289 |
|
290 |
+
}
|
291 |
.pt-cv-cap-w-img * {
|
292 |
color: #fff;
|
293 |
}
|
|
|
294 |
.pt-cv-cap-w-img .pt-cv-title a {
|
295 |
color: #fff !important;
|
296 |
}
|
297 |
|
298 |
/* Caption without image */
|
299 |
+
.pt-cv-scrollable .pt-cv-cap-wo-img {
|
300 |
position: relative !important;
|
301 |
+
bottom: 0 !important;
|
302 |
+
left: 0;
|
303 |
+
right: 0;
|
304 |
}
|
|
|
305 |
.pt-cv-cap-wo-img * {
|
306 |
color: #000;
|
307 |
}
|
|
|
308 |
.pt-cv-cap-wo-img .pt-cv-readmore {
|
309 |
color: #fff;
|
310 |
}
|
public/assets/js/public.js
CHANGED
@@ -12,8 +12,8 @@
|
|
12 |
"use strict";
|
13 |
|
14 |
$.PT_CV_Public = $.PT_CV_Public || { };
|
15 |
-
|
16 |
PT_CV_PUBLIC = PT_CV_PUBLIC || { };
|
|
|
17 |
|
18 |
$.PT_CV_Public = function ( options ) {
|
19 |
this.options = $.extend( { }, options );
|
@@ -27,9 +27,13 @@
|
|
27 |
*/
|
28 |
pagination: function () {
|
29 |
var $self = this;
|
30 |
-
var _prefix = PT_CV_PUBLIC._prefix;
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
33 |
$( '.' + _prefix + 'pagination.' + _prefix + 'ajax' ).each( function () {
|
34 |
var this_ = $( this );
|
35 |
var total_pages = $( this ).attr( 'data-totalpages' );
|
@@ -51,13 +55,8 @@
|
|
51 |
return true;
|
52 |
}
|
53 |
},
|
54 |
-
// When changing page
|
55 |
onPageClicked: function ( e, originalEvent, type, page ) {
|
56 |
-
|
57 |
-
|
58 |
-
$self._setup_pagination( this_, selected_page, function () {
|
59 |
-
PT_CV_PUBLIC.paging = 0;
|
60 |
-
} );
|
61 |
}
|
62 |
} );
|
63 |
} );
|
@@ -72,7 +71,6 @@
|
|
72 |
*/
|
73 |
_setup_pagination: function ( this_, selected_page, callback ) {
|
74 |
var $self = this;
|
75 |
-
var _prefix = PT_CV_PUBLIC._prefix;
|
76 |
|
77 |
PT_CV_PUBLIC.paging = PT_CV_PUBLIC.paging || 0;
|
78 |
// Prevent duplicate processing
|
@@ -121,7 +119,6 @@
|
|
121 |
*/
|
122 |
_get_page: function ( session_id, selected_page, spinner, pages_holder, callback ) {
|
123 |
var $self = this;
|
124 |
-
var _prefix = PT_CV_PUBLIC._prefix;
|
125 |
|
126 |
// Show content of page if it existed
|
127 |
var page_existed = $self._active_page( selected_page, pages_holder, callback );
|
@@ -186,7 +183,6 @@
|
|
186 |
* @returns bool
|
187 |
*/
|
188 |
_active_page: function ( selected_page, pages_holder, callback ) {
|
189 |
-
var _prefix = PT_CV_PUBLIC._prefix;
|
190 |
var page_existed = false;
|
191 |
var page_selector = '#' + _prefix + 'page' + '-' + parseInt( selected_page );
|
192 |
|
@@ -211,10 +207,7 @@
|
|
211 |
};
|
212 |
|
213 |
$( function () {
|
214 |
-
|
215 |
-
|
216 |
-
// Run at page load
|
217 |
-
new $.PT_CV_Public( { _prefix: _prefix } );
|
218 |
} );
|
219 |
|
220 |
}( jQuery ) );
|
12 |
"use strict";
|
13 |
|
14 |
$.PT_CV_Public = $.PT_CV_Public || { };
|
|
|
15 |
PT_CV_PUBLIC = PT_CV_PUBLIC || { };
|
16 |
+
var _prefix = PT_CV_PUBLIC._prefix;
|
17 |
|
18 |
$.PT_CV_Public = function ( options ) {
|
19 |
this.options = $.extend( { }, options );
|
27 |
*/
|
28 |
pagination: function () {
|
29 |
var $self = this;
|
|
|
30 |
|
31 |
+
var fn_show_page = function ( $pager, selected_page ) {
|
32 |
+
$self._setup_pagination( $pager, selected_page, function () {
|
33 |
+
PT_CV_PUBLIC.paging = 0;
|
34 |
+
} );
|
35 |
+
};
|
36 |
+
|
37 |
$( '.' + _prefix + 'pagination.' + _prefix + 'ajax' ).each( function () {
|
38 |
var this_ = $( this );
|
39 |
var total_pages = $( this ).attr( 'data-totalpages' );
|
55 |
return true;
|
56 |
}
|
57 |
},
|
|
|
58 |
onPageClicked: function ( e, originalEvent, type, page ) {
|
59 |
+
fn_show_page( this_, page );
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
} );
|
62 |
} );
|
71 |
*/
|
72 |
_setup_pagination: function ( this_, selected_page, callback ) {
|
73 |
var $self = this;
|
|
|
74 |
|
75 |
PT_CV_PUBLIC.paging = PT_CV_PUBLIC.paging || 0;
|
76 |
// Prevent duplicate processing
|
119 |
*/
|
120 |
_get_page: function ( session_id, selected_page, spinner, pages_holder, callback ) {
|
121 |
var $self = this;
|
|
|
122 |
|
123 |
// Show content of page if it existed
|
124 |
var page_existed = $self._active_page( selected_page, pages_holder, callback );
|
183 |
* @returns bool
|
184 |
*/
|
185 |
_active_page: function ( selected_page, pages_holder, callback ) {
|
|
|
186 |
var page_existed = false;
|
187 |
var page_selector = '#' + _prefix + 'page' + '-' + parseInt( selected_page );
|
188 |
|
207 |
};
|
208 |
|
209 |
$( function () {
|
210 |
+
new $.PT_CV_Public();
|
|
|
|
|
|
|
211 |
} );
|
212 |
|
213 |
}( jQuery ) );
|
public/templates/collapsible/html/main.php
CHANGED
@@ -8,16 +8,15 @@
|
|
8 |
* @link http://www.contentviewspro.com/
|
9 |
* @copyright 2014 PT Guy
|
10 |
*/
|
11 |
-
$html
|
12 |
-
|
13 |
-
$layout
|
14 |
|
15 |
// Prevent the case: there are 2 columns but have not setting for thumbnail position
|
16 |
if ( $layout == '2-col' && !isset( $dargs[ 'field-settings' ][ 'thumbnail' ] ) ) {
|
17 |
$layout = '1-col';
|
18 |
}
|
19 |
|
20 |
-
// Get title
|
21 |
$heading = isset( $fields_html[ 'title' ] ) ? $fields_html[ 'title' ] : '';
|
22 |
unset( $fields_html[ 'title' ] );
|
23 |
|
@@ -28,8 +27,6 @@ switch ( $layout ) {
|
|
28 |
}
|
29 |
break;
|
30 |
case '2-col':
|
31 |
-
|
32 |
-
// Thumbnail html
|
33 |
$thumbnail_html = $fields_html[ 'thumbnail' ];
|
34 |
|
35 |
// Other fields html
|
@@ -41,31 +38,24 @@ switch ( $layout ) {
|
|
41 |
|
42 |
break;
|
43 |
}
|
44 |
-
|
45 |
-
$random_id = PT_CV_Functions::string_random();
|
46 |
-
global $post;
|
47 |
?>
|
48 |
-
|
49 |
-
|
50 |
-
<
|
51 |
-
<a class="panel-title" data-toggle="collapse" data-parent="#<?php echo esc_attr( PT_CV_PREFIX_UPPER . 'ID' ); ?>" href="#<?php echo esc_attr( $random_id ); ?>">
|
52 |
-
<?php
|
53 |
-
// Able to allow some HTML tags here: span, strong...
|
54 |
-
$allowable_tags = (array) apply_filters( PT_CV_PREFIX_ . 'collapsible_heading_tags', array() );
|
55 |
-
echo strip_tags( $heading, implode( '', $allowable_tags ) );
|
56 |
-
?>
|
57 |
-
</a>
|
58 |
<?php
|
59 |
-
//
|
60 |
-
$
|
61 |
-
echo $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
?>
|
63 |
-
</div>
|
64 |
-
<div id="<?php echo esc_attr( $random_id ); ?>" class="panel-collapse collapse <?php echo esc_attr( PT_CV_PREFIX_UPPER . 'CLASS' ); ?>">
|
65 |
-
<div class="panel-body">
|
66 |
-
<?php
|
67 |
-
echo implode( "\n", $html );
|
68 |
-
?>
|
69 |
-
</div>
|
70 |
</div>
|
71 |
</div>
|
8 |
* @link http://www.contentviewspro.com/
|
9 |
* @copyright 2014 PT Guy
|
10 |
*/
|
11 |
+
$html = array();
|
12 |
+
$random_id = PT_CV_Functions::string_random();
|
13 |
+
$layout = $dargs[ 'layout-format' ];
|
14 |
|
15 |
// Prevent the case: there are 2 columns but have not setting for thumbnail position
|
16 |
if ( $layout == '2-col' && !isset( $dargs[ 'field-settings' ][ 'thumbnail' ] ) ) {
|
17 |
$layout = '1-col';
|
18 |
}
|
19 |
|
|
|
20 |
$heading = isset( $fields_html[ 'title' ] ) ? $fields_html[ 'title' ] : '';
|
21 |
unset( $fields_html[ 'title' ] );
|
22 |
|
27 |
}
|
28 |
break;
|
29 |
case '2-col':
|
|
|
|
|
30 |
$thumbnail_html = $fields_html[ 'thumbnail' ];
|
31 |
|
32 |
// Other fields html
|
38 |
|
39 |
break;
|
40 |
}
|
|
|
|
|
|
|
41 |
?>
|
42 |
+
|
43 |
+
<div class="panel-heading">
|
44 |
+
<a class="panel-title" data-toggle="collapse" data-parent="#<?php echo esc_attr( PT_CV_PREFIX_UPPER . 'ID' ); ?>" href="#<?php echo esc_attr( $random_id ); ?>">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<?php
|
46 |
+
// Able to allow some HTML tags here: span, strong...
|
47 |
+
$allowable_tags = (array) apply_filters( PT_CV_PREFIX_ . 'collapsible_heading_tags', array() );
|
48 |
+
echo strip_tags( $heading, implode( '', $allowable_tags ) );
|
49 |
+
?>
|
50 |
+
</a>
|
51 |
+
<?php
|
52 |
+
echo apply_filters( PT_CV_PREFIX_ . 'scrollable_toggle_icon', '' );
|
53 |
+
?>
|
54 |
+
</div>
|
55 |
+
<div id="<?php echo esc_attr( $random_id ); ?>" class="panel-collapse collapse <?php echo esc_attr( PT_CV_PREFIX_UPPER . 'CLASS' ); ?>">
|
56 |
+
<div class="panel-body">
|
57 |
+
<?php
|
58 |
+
echo implode( "\n", $html );
|
59 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
</div>
|
61 |
</div>
|