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

Version Description

  • Bug fixed: Fix row style bug
Download this release

Release Info

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

Code changes from version 1.3.1.6 to 1.3.1.8

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, 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.0
7
- Stable tag: 1.3.1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -142,6 +142,9 @@ You can create Unlimited Views, in Unlimited websites
142
 
143
  == Changelog ==
144
 
 
 
 
145
  = 1.3.1.6 =
146
  * Improvement: Update page title as "Edit View" in edit View page
147
  * Bug fixed: Fix some warnings in PHP 5.2
@@ -258,6 +261,9 @@ You can create Unlimited Views, in Unlimited websites
258
 
259
  == Upgrade Notice ==
260
 
 
 
 
261
  = 1.3.1.6 =
262
  Improvement: Update page title as "Edit View" in edit View page. Bug fixed: Fix some warnings in PHP 5.2
263
 
4
  Tags: post, posts, page, pages, query, queries, search, display, show, grid, 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.0
7
+ Stable tag: 1.3.1.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
142
 
143
  == Changelog ==
144
 
145
+ = 1.3.1.8 =
146
+ * Bug fixed: Fix row style bug
147
+
148
  = 1.3.1.6 =
149
  * Improvement: Update page title as "Edit View" in edit View page
150
  * Bug fixed: Fix some warnings in PHP 5.2
261
 
262
  == Upgrade Notice ==
263
 
264
+ = 1.3.1.8 =
265
+ Bug fixed: Fix row style bug
266
+
267
  = 1.3.1.6 =
268
  Improvement: Update page title as "Edit View" in edit View page. Bug fixed: Fix some warnings in PHP 5.2
269
 
admin/assets/js/admin.js CHANGED
@@ -538,8 +538,10 @@
538
  var $self = this;
539
  var _prefix = $self.options._prefix;
540
 
541
- var _fn = function () {
542
- $self.options.onload = 0;
 
 
543
 
544
  // Toggle text of this button
545
  $('#' + _prefix + 'show-preview').html(PT_CV_ADMIN.btn.preview.update);
@@ -548,8 +550,8 @@
548
  $self.options.can_preview = 1;
549
  };
550
  // Bind on change input after page load
551
- $('input, select, textarea', '.pt-wrap .tab-content').change(function () {
552
- _fn();
553
  });
554
 
555
  $('body').bind(_prefix + 'preview-btn-toggle', function () {
@@ -562,9 +564,10 @@
562
  *
563
  * @returns {undefined}
564
  */
565
- handy_toggle_excerpt_settings: function () {
566
  var _prefix = this.options._prefix;
567
 
 
568
  var _this_toggle = function (show_content) {
569
  if (!show_content) {
570
  $('#' + _prefix + 'group-excerpt-settings').addClass('hidden');
@@ -582,6 +585,9 @@
582
  $(selector).change(function () {
583
  _this_toggle($(selector).is(':checked'));
584
  });
 
 
 
585
  },
586
 
587
  /**
538
  var $self = this;
539
  var _prefix = $self.options._prefix;
540
 
541
+ var _fn = function ( is_trigger ) {
542
+ if ( ! is_trigger ) {
543
+ $self.options.onload = 0;
544
+ }
545
 
546
  // Toggle text of this button
547
  $('#' + _prefix + 'show-preview').html(PT_CV_ADMIN.btn.preview.update);
550
  $self.options.can_preview = 1;
551
  };
552
  // Bind on change input after page load
553
+ $('input, select, textarea', '.pt-wrap .tab-content').change(function (evt, is_trigger) {
554
+ _fn( is_trigger );
555
  });
556
 
557
  $('body').bind(_prefix + 'preview-btn-toggle', function () {
564
  *
565
  * @returns {undefined}
566
  */
567
+ multi_level_toggle: function () {
568
  var _prefix = this.options._prefix;
569
 
570
+ // For Excerpt Settings
571
  var _this_toggle = function (show_content) {
572
  if (!show_content) {
573
  $('#' + _prefix + 'group-excerpt-settings').addClass('hidden');
585
  $(selector).change(function () {
586
  _this_toggle($(selector).is(':checked'));
587
  });
588
+
589
+ // Handy do other toggle
590
+ $('.pt-wrap').trigger(_prefix + 'multi-level-toggle');
591
  },
592
 
593
  /**
admin/includes/options.php CHANGED
@@ -379,7 +379,7 @@ if ( ! class_exists( 'PT_Options_Framework' ) ) {
379
  // Toggle dependence
380
  $pt_cv_admin_js.dependence_do_all('<?php echo balanceTags( $toggle_data_js ); ?>');
381
 
382
- $pt_cv_admin_js.handy_toggle_excerpt_settings();
383
  });
384
  }(jQuery));
385
  </script>
379
  // Toggle dependence
380
  $pt_cv_admin_js.dependence_do_all('<?php echo balanceTags( $toggle_data_js ); ?>');
381
 
382
+ $pt_cv_admin_js.multi_level_toggle();
383
  });
384
  }(jQuery));
385
  </script>
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.1.6
14
  * Author: PT Guy
15
  * Author URI: http://profiles.wordpress.org/pt-guy
16
  * Text Domain: content-views
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
27
  /*
28
  * Define Constant
29
  */
30
- define( 'PT_CV_VERSION', '1.3.1.6' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.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.3.1.8
14
  * Author: PT Guy
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.8' );
31
  define( 'PT_CV_FILE', __FILE__ );
32
  $pt_cv_path = plugin_dir_path( __FILE__ );
33
  include_once( $pt_cv_path . 'includes/defines.php' );
includes/values.php CHANGED
@@ -1,478 +1,478 @@
1
- <?php
2
- /**
3
- * Define values for input, select...
4
- *
5
- * @package PT_Content_Views
6
- * @author PT Guy <palaceofthemes@gmail.com>
7
- * @license GPL-2.0+
8
- * @link http://www.contentviewspro.com/
9
- * @copyright 2014 PT Guy
10
- */
11
-
12
- if ( ! class_exists( 'PT_CV_Values' ) ) {
13
-
14
- /**
15
- * @name PT_CV_Values
16
- * @todo Define values for input, select...
17
- */
18
- class PT_CV_Values {
19
-
20
- /**
21
- * Get Post Types
22
- *
23
- * @param array $args Array of query parameters
24
- * @param string $excludes_ Array of slug of post types want to exclude from result
25
- *
26
- * @return array
27
- */
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, 'show_ui' => true, '_builtin' => true ), $args );
32
- $args = apply_filters( PT_CV_PREFIX_ . 'post_types', $args );
33
- $post_types = get_post_types( $args, 'objects' );
34
-
35
- foreach ( $post_types as $post_type ) {
36
- if ( in_array( $post_type->name, $excludes ) ) {
37
- continue;
38
- }
39
- $result[$post_type->name] = __( $post_type->labels->singular_name, PT_CV_DOMAIN );
40
- }
41
-
42
- return $result;
43
- }
44
-
45
- /**
46
- * Get list of post types and related taxonomies
47
- *
48
- * @return array
49
- */
50
- static function post_types_vs_taxonomies() {
51
- // Get post types
52
- $args = apply_filters( PT_CV_PREFIX_ . 'post_types', array( 'public' => true, 'show_ui' => true, '_builtin' => true ) );
53
- $post_types = get_post_types( $args );
54
-
55
- // Get taxonomies of post types
56
- $result = array();
57
-
58
- foreach ( $post_types as $post_type ) {
59
- $taxonomy_names = get_object_taxonomies( $post_type );
60
- $result[$post_type] = $taxonomy_names;
61
- }
62
-
63
- return $result;
64
- }
65
-
66
- /**
67
- * Get list of taxonomies
68
- *
69
- * @param array $args Array of query parameters
70
- *
71
- * @return array
72
- */
73
- static function taxonomy_list( $args = array() ) {
74
- $result = array();
75
- $args = array_merge( array( 'public' => true, 'show_ui' => true, '_builtin' => true ), $args );
76
- $args = apply_filters( PT_CV_PREFIX_ . 'taxonomy_list', $args );
77
- $taxonomies = get_taxonomies( $args, 'objects' );
78
-
79
- foreach ( $taxonomies as $taxonomy ) {
80
- $result[$taxonomy->name] = __( $taxonomy->labels->singular_name, PT_CV_DOMAIN );
81
- }
82
-
83
- return $result;
84
- }
85
-
86
- /**
87
- * The logical relationship between taxonomies
88
- *
89
- * @return array
90
- */
91
- static function taxonomy_relation() {
92
- return array(
93
- 'AND' => __( 'AND', PT_CV_DOMAIN ),
94
- 'OR' => __( 'OR', PT_CV_DOMAIN ),
95
- );
96
- }
97
-
98
- /**
99
- * Operator to join. Possible values are 'IN'(default), 'NOT IN', 'AND'.
100
- * @return type
101
- */
102
- static function taxonomy_operators() {
103
- return array(
104
- 'IN' => __( 'IN (A post is displayed only if it associated with one of values in terms list)', PT_CV_DOMAIN ),
105
- 'NOT IN' => __( 'NOT IN (A post is displayed only if it did NOT associated with any values in terms list)', PT_CV_DOMAIN ),
106
- 'AND' => __( 'AND (A post is displayed only if it associated with all values in terms list)', PT_CV_DOMAIN ),
107
- );
108
- }
109
-
110
- /**
111
- * Get taxonomies of Post type
112
- *
113
- * @param string $object Name of the post type, or a post object
114
- * @param string $output The type of output to return, either taxonomy 'names' or 'objects'
115
- *
116
- * @return array
117
- */
118
- static function taxonomy_by_post_type( $object, $output = 'names' ) {
119
- $data = get_object_taxonomies( $object, $output );
120
- $result = array();
121
-
122
- foreach ( (array) $data as $taxonomy ) {
123
- $result[$taxonomy] = self::taxonomy_info( $taxonomy, 'singular_name' );
124
- }
125
-
126
- return $result;
127
- }
128
-
129
- /**
130
- * Get taxonomy information
131
- *
132
- * @param string $taxonomy The name of the taxonomy
133
- * @param string $info Field of metadata want to retrieve
134
- *
135
- * @return string | array
136
- */
137
- static function taxonomy_info( $taxonomy, $info ) {
138
- $data = get_taxonomy( $taxonomy );
139
-
140
- if ( isset( $data->$info ) ) {
141
- $result = $data->$info;
142
- } else {
143
- if ( isset( $data->labels->$info ) ) {
144
- $result = __( $data->labels->$info, PT_CV_DOMAIN );
145
- }
146
- }
147
-
148
- return isset( $result ) ? $result : NULL;
149
- }
150
-
151
- /**
152
- * Get terms of one/many taxonomies
153
- *
154
- * @param string $taxonomy The name of the taxonomy
155
- * @param string $terms_of_taxonomies Array of terms of taxonomies
156
- * @param array $args Array of query parameters
157
- */
158
- static function term_of_taxonomy( $taxonomy, &$terms_of_taxonomies, $args = array() ) {
159
-
160
- $args = array_merge( array( 'hide_empty' => false ), $args );
161
- $terms = get_terms( array( $taxonomy ), $args );
162
-
163
- $term_slug_name = array();
164
- foreach ( $terms as $term ) {
165
- $term_slug_name[$term->slug] = $term->name;
166
- }
167
- $terms_of_taxonomies[$taxonomy] = $term_slug_name;
168
- }
169
-
170
- /**
171
- * Yes no options
172
- *
173
- * @return array
174
- */
175
- static function yes_no( $key = '', $value = '' ) {
176
- $result = array(
177
- 'yes' => __( 'Yes', PT_CV_DOMAIN ),
178
- 'no' => __( 'No', PT_CV_DOMAIN ),
179
- );
180
- if ( ! empty( $key ) ) {
181
- return array( $key => empty( $value ) ? $result[$key] : $value );
182
- }
183
-
184
- return $result;
185
- }
186
-
187
- /**
188
- * Show Hide options
189
- *
190
- * @return array
191
- */
192
- static function show_hide() {
193
- return array(
194
- 'show' => __( 'Show', PT_CV_DOMAIN ),
195
- 'hide' => __( 'Hide', PT_CV_DOMAIN ),
196
- );
197
- }
198
-
199
- /**
200
- * Paging styles
201
- *
202
- * @return array
203
- */
204
- static function pagination_styles() {
205
- $result = array(
206
- 'regular' => __( 'Regular pagination', PT_CV_DOMAIN ),
207
- );
208
-
209
- $result = apply_filters( PT_CV_PREFIX_ . 'pagination_styles', $result );
210
-
211
- return $result;
212
- }
213
-
214
- /**
215
- * Order options
216
- *
217
- * @return array
218
- */
219
- static function orders() {
220
- return array(
221
- 'asc' => __( 'ASC', PT_CV_DOMAIN ),
222
- 'desc' => __( 'DESC', PT_CV_DOMAIN ),
223
- );
224
- }
225
-
226
- /**
227
- * List post status
228
- */
229
- static function post_statuses() {
230
- return array(
231
- 'publish' => __( 'Publish', PT_CV_DOMAIN ),
232
- 'pending' => __( 'Pending', PT_CV_DOMAIN ),
233
- 'draft' => __( 'Draft', PT_CV_DOMAIN ),
234
- 'auto-draft' => __( 'Auto draft', PT_CV_DOMAIN ),
235
- 'future' => __( 'Future', PT_CV_DOMAIN ),
236
- 'private' => __( 'Private', PT_CV_DOMAIN ),
237
- 'inherit' => __( 'Inherit', PT_CV_DOMAIN ),
238
- 'trash' => __( 'Trash', PT_CV_DOMAIN ),
239
- );
240
- }
241
-
242
- /**
243
- * Advanced settings options
244
- *
245
- * @return array
246
- */
247
- static function advanced_settings() {
248
- return array(
249
- 'taxonomy' => __( 'Taxonomy (Categories, Tags...)', PT_CV_DOMAIN ),
250
- 'status' => __( 'Status', PT_CV_DOMAIN ),
251
- 'order' => __( 'Order & Orderby', PT_CV_DOMAIN ),
252
- 'search' => __( 'Search', PT_CV_DOMAIN ),
253
- 'author' => __( 'Author', PT_CV_DOMAIN ),
254
- );
255
- }
256
-
257
- /**
258
- * Show WP author dropdown list by WP wp_dropdown_users functions
259
- *
260
- * @return array
261
- */
262
- static function post_author( $name = 'author', $data = array() ) {
263
- $field_name = PT_CV_PREFIX . $name;
264
- $selected = isset( $data[$field_name] ) ? $data[$field_name] : '';
265
-
266
- return wp_dropdown_users( array( 'name' => $field_name, 'selected' => $selected, 'class' => 'form-control', 'show_option_none' => __( '&mdash; Select &mdash;', PT_CV_DOMAIN ), 'echo' => false ) );
267
- }
268
-
269
- /**
270
- * Show WP author dropdown list
271
- *
272
- * @return array
273
- */
274
- static function user_list() {
275
-
276
- $result = array();
277
- $show = 'display_name';
278
-
279
- $args = array(
280
- 'fields' => array( 'ID', $show ),
281
- 'orderby' => 'display_name',
282
- 'order' => 'ASC',
283
- );
284
-
285
- $users = get_users( $args );
286
- foreach ( (array) $users as $user ) {
287
- $user->ID = (int) $user->ID;
288
- $display = ! empty( $user->$show ) ? $user->$show : '(' . $user->user_login . ')';
289
-
290
- $result[$user->ID] = esc_html( $display );
291
- }
292
-
293
- return $result;
294
- }
295
-
296
- /**
297
- * Get available filters for Order by Content item
298
- */
299
- static function post_regular_orderby() {
300
- $regular_orderby = array(
301
- '' => __( '&mdash; Select &mdash;', PT_CV_DOMAIN ),
302
- 'ID' => __( 'ID', PT_CV_DOMAIN ),
303
- 'title' => __( 'Title', PT_CV_DOMAIN ),
304
- 'date' => __( 'Created date', PT_CV_DOMAIN ),
305
- 'modified' => __( 'Modified date', PT_CV_DOMAIN ),
306
- );
307
-
308
- $result = apply_filters( PT_CV_PREFIX_ . 'regular_orderby', $regular_orderby );
309
-
310
- return $result;
311
- }
312
-
313
- /**
314
- * View type options
315
- *
316
- * @return array
317
- */
318
- static function view_type() {
319
-
320
- $view_type = array(
321
- 'grid' => __( 'Grid', PT_CV_DOMAIN ),
322
- 'collapsible' => __( 'Collapsible List', PT_CV_DOMAIN ),
323
- 'scrollable' => __( 'Scrollable List', PT_CV_DOMAIN ),
324
- );
325
-
326
- $result = apply_filters( PT_CV_PREFIX_ . 'view_type', $view_type );
327
-
328
- return $result;
329
- }
330
-
331
- /**
332
- * Settings of All View Types
333
- *
334
- * @return array
335
- */
336
- static function view_type_settings() {
337
-
338
- $view_type_settings = array();
339
-
340
- // Settings of Grid type
341
- $view_type_settings['grid'] = PT_CV_Settings::view_type_settings_grid();
342
-
343
- // Settings of Collapsible type
344
- $view_type_settings['collapsible'] = PT_CV_Settings::view_type_settings_collapsible();
345
-
346
- // Settings of Scrollable type
347
- $view_type_settings['scrollable'] = PT_CV_Settings::view_type_settings_scrollable();
348
-
349
- $result = apply_filters( PT_CV_PREFIX_ . 'view_type_settings', $view_type_settings );
350
-
351
- return $result;
352
- }
353
-
354
- /**
355
- * Layout format options
356
- *
357
- * @return array
358
- */
359
- static function layout_format() {
360
-
361
- $result = array(
362
- '1-col' => __( '1 column &#8212; All fields inside an output item are shown in one column', PT_CV_DOMAIN ),
363
- '2-col' => __( '2 columns &#8212; Show thumbnail on the left/right side of other fields', PT_CV_DOMAIN ),
364
- );
365
-
366
- $result = apply_filters( PT_CV_PREFIX_ . 'layout_format', $result );
367
-
368
- return $result;
369
- }
370
-
371
- /**
372
- * Open in options
373
- */
374
- static function open_in() {
375
-
376
- $open_in = array(
377
- '_blank' => __( 'New tab', PT_CV_DOMAIN ),
378
- '_self' => __( 'Current tab', PT_CV_DOMAIN ),
379
-
380
- );
381
-
382
- $result = apply_filters( PT_CV_PREFIX_ . 'open_in', $open_in );
383
-
384
- return $result;
385
- }
386
-
387
- /**
388
- * Get all thumbnail sizes
389
- */
390
- static function field_thumbnail_sizes() {
391
- // All available thumbnail sizes
392
- global $_wp_additional_image_sizes;
393
-
394
- $result = $sizes_to_sort = $dimensions_to_sort = array();
395
-
396
- foreach ( get_intermediate_image_sizes() as $size_name ) {
397
- if ( in_array( $size_name, array( 'thumbnail', 'medium', 'large' ) ) ) {
398
- $this_size = array();
399
- $this_size[] = get_option( $size_name . '_size_w' );
400
- $this_size[] = get_option( $size_name . '_size_h' );
401
-
402
- // Add official sizes to result
403
- $result[$size_name] = ucfirst( $size_name ) . ' (' . implode( ' &times; ', $this_size ) . ')';
404
- } else {
405
- if ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[$size_name] ) ) {
406
-
407
- $this_size = array();
408
- $this_size['width'] = $_wp_additional_image_sizes[$size_name]['width'];
409
- $this_size['height'] = $_wp_additional_image_sizes[$size_name]['height'];
410
-
411
- // Calculate sizes value for sorting
412
- $sizes_value = intval( $this_size['width'] ) * intval( $this_size['height'] ) + rand( 1, 10 );
413
-
414
- $dimensions_to_sort[$sizes_value] = $size_name;
415
- } else {
416
- $this_size = array( 0, 0 );
417
- }
418
-
419
- $sizes_to_sort[$size_name] = ucfirst( preg_replace( '/[\-_]/', ' ', $size_name ) ) . ' (' . implode( ' &times; ', $this_size ) . ')';
420
- }
421
- }
422
- // Add full sizes
423
- $result['full'] = __( 'Original resolution (But resize automatically to fit its container)', PT_CV_DOMAIN );
424
-
425
- // Sort custom sizes by index (width * height)
426
- krsort( $dimensions_to_sort );
427
-
428
- // Get array element in ASC sorted order
429
- foreach ( array_reverse( $dimensions_to_sort ) as $size_name ) {
430
- $result[$size_name] = $sizes_to_sort[$size_name];
431
- }
432
-
433
- $result = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_sizes', $result );
434
-
435
- return $result;
436
- }
437
-
438
- /**
439
- * Tab Position
440
- *
441
- * @return array
442
- */
443
- static function tab_position() {
444
-
445
- $tab_position = array(
446
- 'top' => __( 'Top', PT_CV_DOMAIN ),
447
- 'left' => __( 'Left', PT_CV_DOMAIN ),
448
- 'bottom' => __( 'Bottom', PT_CV_DOMAIN ),
449
- 'right' => __( 'Right', PT_CV_DOMAIN ),
450
- );
451
-
452
- $result = apply_filters( PT_CV_PREFIX_ . 'tab_position', $tab_position );
453
-
454
- return $result;
455
-
456
- }
457
-
458
- /**
459
- * Thumbnail Position
460
- *
461
- * @return array
462
- */
463
- static function thumbnail_position() {
464
-
465
- $thumbnail_position = array(
466
- 'left' => __( 'Left', PT_CV_DOMAIN ),
467
- 'right' => __( 'Right', PT_CV_DOMAIN ),
468
- );
469
-
470
- $result = apply_filters( PT_CV_PREFIX_ . 'thumbnail_position', $thumbnail_position );
471
-
472
- return $result;
473
-
474
- }
475
-
476
- }
477
-
478
  }
1
+ <?php
2
+ /**
3
+ * Define values for input, select...
4
+ *
5
+ * @package PT_Content_Views
6
+ * @author PT Guy <palaceofthemes@gmail.com>
7
+ * @license GPL-2.0+
8
+ * @link http://www.contentviewspro.com/
9
+ * @copyright 2014 PT Guy
10
+ */
11
+
12
+ if ( ! class_exists( 'PT_CV_Values' ) ) {
13
+
14
+ /**
15
+ * @name PT_CV_Values
16
+ * @todo Define values for input, select...
17
+ */
18
+ class PT_CV_Values {
19
+
20
+ /**
21
+ * Get Post Types
22
+ *
23
+ * @param array $args Array of query parameters
24
+ * @param string $excludes_ Array of slug of post types want to exclude from result
25
+ *
26
+ * @return array
27
+ */
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, 'show_ui' => true, '_builtin' => true ), $args );
32
+ $args = apply_filters( PT_CV_PREFIX_ . 'post_types', $args );
33
+ $post_types = get_post_types( $args, 'objects' );
34
+
35
+ foreach ( $post_types as $post_type ) {
36
+ if ( in_array( $post_type->name, $excludes ) ) {
37
+ continue;
38
+ }
39
+ $result[$post_type->name] = __( $post_type->labels->singular_name, PT_CV_DOMAIN );
40
+ }
41
+
42
+ return $result;
43
+ }
44
+
45
+ /**
46
+ * Get list of post types and related taxonomies
47
+ *
48
+ * @return array
49
+ */
50
+ static function post_types_vs_taxonomies() {
51
+ // Get post types
52
+ $args = apply_filters( PT_CV_PREFIX_ . 'post_types', array( 'public' => true, 'show_ui' => true, '_builtin' => true ) );
53
+ $post_types = get_post_types( $args );
54
+
55
+ // Get taxonomies of post types
56
+ $result = array();
57
+
58
+ foreach ( $post_types as $post_type ) {
59
+ $taxonomy_names = get_object_taxonomies( $post_type );
60
+ $result[$post_type] = $taxonomy_names;
61
+ }
62
+
63
+ return $result;
64
+ }
65
+
66
+ /**
67
+ * Get list of taxonomies
68
+ *
69
+ * @param array $args Array of query parameters
70
+ *
71
+ * @return array
72
+ */
73
+ static function taxonomy_list( $args = array() ) {
74
+ $result = array();
75
+ $args = array_merge( array( 'public' => true, 'show_ui' => true, '_builtin' => true ), $args );
76
+ $args = apply_filters( PT_CV_PREFIX_ . 'taxonomy_query_args', $args );
77
+ $taxonomies = get_taxonomies( $args, 'objects' );
78
+
79
+ foreach ( $taxonomies as $taxonomy ) {
80
+ $result[$taxonomy->name] = __( $taxonomy->labels->singular_name, PT_CV_DOMAIN );
81
+ }
82
+
83
+ return $result;
84
+ }
85
+
86
+ /**
87
+ * The logical relationship between taxonomies
88
+ *
89
+ * @return array
90
+ */
91
+ static function taxonomy_relation() {
92
+ return array(
93
+ 'AND' => __( 'AND', PT_CV_DOMAIN ),
94
+ 'OR' => __( 'OR', PT_CV_DOMAIN ),
95
+ );
96
+ }
97
+
98
+ /**
99
+ * Operator to join. Possible values are 'IN'(default), 'NOT IN', 'AND'.
100
+ * @return type
101
+ */
102
+ static function taxonomy_operators() {
103
+ return array(
104
+ 'IN' => __( 'IN (A post is displayed only if it associated with one of values in terms list)', PT_CV_DOMAIN ),
105
+ 'NOT IN' => __( 'NOT IN (A post is displayed only if it did NOT associated with any values in terms list)', PT_CV_DOMAIN ),
106
+ 'AND' => __( 'AND (A post is displayed only if it associated with all values in terms list)', PT_CV_DOMAIN ),
107
+ );
108
+ }
109
+
110
+ /**
111
+ * Get taxonomies of Post type
112
+ *
113
+ * @param string $object Name of the post type, or a post object
114
+ * @param string $output The type of output to return, either taxonomy 'names' or 'objects'
115
+ *
116
+ * @return array
117
+ */
118
+ static function taxonomy_by_post_type( $object, $output = 'names' ) {
119
+ $data = get_object_taxonomies( $object, $output );
120
+ $result = array();
121
+
122
+ foreach ( (array) $data as $taxonomy ) {
123
+ $result[$taxonomy] = self::taxonomy_info( $taxonomy, 'singular_name' );
124
+ }
125
+
126
+ return $result;
127
+ }
128
+
129
+ /**
130
+ * Get taxonomy information
131
+ *
132
+ * @param string $taxonomy The name of the taxonomy
133
+ * @param string $info Field of metadata want to retrieve
134
+ *
135
+ * @return string | array
136
+ */
137
+ static function taxonomy_info( $taxonomy, $info ) {
138
+ $data = get_taxonomy( $taxonomy );
139
+
140
+ if ( isset( $data->$info ) ) {
141
+ $result = $data->$info;
142
+ } else {
143
+ if ( isset( $data->labels->$info ) ) {
144
+ $result = __( $data->labels->$info, PT_CV_DOMAIN );
145
+ }
146
+ }
147
+
148
+ return isset( $result ) ? $result : NULL;
149
+ }
150
+
151
+ /**
152
+ * Get terms of one/many taxonomies
153
+ *
154
+ * @param string $taxonomy The name of the taxonomy
155
+ * @param string $terms_of_taxonomies Array of terms of taxonomies
156
+ * @param array $args Array of query parameters
157
+ */
158
+ static function term_of_taxonomy( $taxonomy, &$terms_of_taxonomies, $args = array() ) {
159
+
160
+ $args = array_merge( array( 'hide_empty' => false ), $args );
161
+ $terms = get_terms( array( $taxonomy ), $args );
162
+
163
+ $term_slug_name = array();
164
+ foreach ( $terms as $term ) {
165
+ $term_slug_name[$term->slug] = $term->name;
166
+ }
167
+ $terms_of_taxonomies[$taxonomy] = $term_slug_name;
168
+ }
169
+
170
+ /**
171
+ * Yes no options
172
+ *
173
+ * @return array
174
+ */
175
+ static function yes_no( $key = '', $value = '' ) {
176
+ $result = array(
177
+ 'yes' => __( 'Yes', PT_CV_DOMAIN ),
178
+ 'no' => __( 'No', PT_CV_DOMAIN ),
179
+ );
180
+ if ( ! empty( $key ) ) {
181
+ return array( $key => empty( $value ) ? $result[$key] : $value );
182
+ }
183
+
184
+ return $result;
185
+ }
186
+
187
+ /**
188
+ * Show Hide options
189
+ *
190
+ * @return array
191
+ */
192
+ static function show_hide() {
193
+ return array(
194
+ 'show' => __( 'Show', PT_CV_DOMAIN ),
195
+ 'hide' => __( 'Hide', PT_CV_DOMAIN ),
196
+ );
197
+ }
198
+
199
+ /**
200
+ * Paging styles
201
+ *
202
+ * @return array
203
+ */
204
+ static function pagination_styles() {
205
+ $result = array(
206
+ 'regular' => __( 'Regular pagination', PT_CV_DOMAIN ),
207
+ );
208
+
209
+ $result = apply_filters( PT_CV_PREFIX_ . 'pagination_styles', $result );
210
+
211
+ return $result;
212
+ }
213
+
214
+ /**
215
+ * Order options
216
+ *
217
+ * @return array
218
+ */
219
+ static function orders() {
220
+ return array(
221
+ 'asc' => __( 'ASC', PT_CV_DOMAIN ),
222
+ 'desc' => __( 'DESC', PT_CV_DOMAIN ),
223
+ );
224
+ }
225
+
226
+ /**
227
+ * List post status
228
+ */
229
+ static function post_statuses() {
230
+ return array(
231
+ 'publish' => __( 'Publish', PT_CV_DOMAIN ),
232
+ 'pending' => __( 'Pending', PT_CV_DOMAIN ),
233
+ 'draft' => __( 'Draft', PT_CV_DOMAIN ),
234
+ 'auto-draft' => __( 'Auto draft', PT_CV_DOMAIN ),
235
+ 'future' => __( 'Future', PT_CV_DOMAIN ),
236
+ 'private' => __( 'Private', PT_CV_DOMAIN ),
237
+ 'inherit' => __( 'Inherit', PT_CV_DOMAIN ),
238
+ 'trash' => __( 'Trash', PT_CV_DOMAIN ),
239
+ );
240
+ }
241
+
242
+ /**
243
+ * Advanced settings options
244
+ *
245
+ * @return array
246
+ */
247
+ static function advanced_settings() {
248
+ return array(
249
+ 'taxonomy' => __( 'Taxonomy (Categories, Tags...)', PT_CV_DOMAIN ),
250
+ 'status' => __( 'Status', PT_CV_DOMAIN ),
251
+ 'order' => __( 'Order & Orderby', PT_CV_DOMAIN ),
252
+ 'search' => __( 'Search', PT_CV_DOMAIN ),
253
+ 'author' => __( 'Author', PT_CV_DOMAIN ),
254
+ );
255
+ }
256
+
257
+ /**
258
+ * Show WP author dropdown list by WP wp_dropdown_users functions
259
+ *
260
+ * @return array
261
+ */
262
+ static function post_author( $name = 'author', $data = array() ) {
263
+ $field_name = PT_CV_PREFIX . $name;
264
+ $selected = isset( $data[$field_name] ) ? $data[$field_name] : '';
265
+
266
+ return wp_dropdown_users( array( 'name' => $field_name, 'selected' => $selected, 'class' => 'form-control', 'show_option_none' => __( '&mdash; Select &mdash;', PT_CV_DOMAIN ), 'echo' => false ) );
267
+ }
268
+
269
+ /**
270
+ * Show WP author dropdown list
271
+ *
272
+ * @return array
273
+ */
274
+ static function user_list() {
275
+
276
+ $result = array();
277
+ $show = 'display_name';
278
+
279
+ $args = array(
280
+ 'fields' => array( 'ID', $show ),
281
+ 'orderby' => 'display_name',
282
+ 'order' => 'ASC',
283
+ );
284
+
285
+ $users = get_users( $args );
286
+ foreach ( (array) $users as $user ) {
287
+ $user->ID = (int) $user->ID;
288
+ $display = ! empty( $user->$show ) ? $user->$show : '(' . $user->user_login . ')';
289
+
290
+ $result[$user->ID] = esc_html( $display );
291
+ }
292
+
293
+ return $result;
294
+ }
295
+
296
+ /**
297
+ * Get available filters for Order by Content item
298
+ */
299
+ static function post_regular_orderby() {
300
+ $regular_orderby = array(
301
+ '' => __( '&mdash; Select &mdash;', PT_CV_DOMAIN ),
302
+ 'ID' => __( 'ID', PT_CV_DOMAIN ),
303
+ 'title' => __( 'Title', PT_CV_DOMAIN ),
304
+ 'date' => __( 'Created date', PT_CV_DOMAIN ),
305
+ 'modified' => __( 'Modified date', PT_CV_DOMAIN ),
306
+ );
307
+
308
+ $result = apply_filters( PT_CV_PREFIX_ . 'regular_orderby', $regular_orderby );
309
+
310
+ return $result;
311
+ }
312
+
313
+ /**
314
+ * View type options
315
+ *
316
+ * @return array
317
+ */
318
+ static function view_type() {
319
+
320
+ $view_type = array(
321
+ 'grid' => __( 'Grid', PT_CV_DOMAIN ),
322
+ 'collapsible' => __( 'Collapsible List', PT_CV_DOMAIN ),
323
+ 'scrollable' => __( 'Scrollable List', PT_CV_DOMAIN ),
324
+ );
325
+
326
+ $result = apply_filters( PT_CV_PREFIX_ . 'view_type', $view_type );
327
+
328
+ return $result;
329
+ }
330
+
331
+ /**
332
+ * Settings of All View Types
333
+ *
334
+ * @return array
335
+ */
336
+ static function view_type_settings() {
337
+
338
+ $view_type_settings = array();
339
+
340
+ // Settings of Grid type
341
+ $view_type_settings['grid'] = PT_CV_Settings::view_type_settings_grid();
342
+
343
+ // Settings of Collapsible type
344
+ $view_type_settings['collapsible'] = PT_CV_Settings::view_type_settings_collapsible();
345
+
346
+ // Settings of Scrollable type
347
+ $view_type_settings['scrollable'] = PT_CV_Settings::view_type_settings_scrollable();
348
+
349
+ $result = apply_filters( PT_CV_PREFIX_ . 'view_type_settings', $view_type_settings );
350
+
351
+ return $result;
352
+ }
353
+
354
+ /**
355
+ * Layout format options
356
+ *
357
+ * @return array
358
+ */
359
+ static function layout_format() {
360
+
361
+ $result = array(
362
+ '1-col' => __( '1 column &#8212; All fields inside an output item are shown in one column', PT_CV_DOMAIN ),
363
+ '2-col' => __( '2 columns &#8212; Show thumbnail on the left/right side of other fields', PT_CV_DOMAIN ),
364
+ );
365
+
366
+ $result = apply_filters( PT_CV_PREFIX_ . 'layout_format', $result );
367
+
368
+ return $result;
369
+ }
370
+
371
+ /**
372
+ * Open in options
373
+ */
374
+ static function open_in() {
375
+
376
+ $open_in = array(
377
+ '_blank' => __( 'New tab', PT_CV_DOMAIN ),
378
+ '_self' => __( 'Current tab', PT_CV_DOMAIN ),
379
+
380
+ );
381
+
382
+ $result = apply_filters( PT_CV_PREFIX_ . 'open_in', $open_in );
383
+
384
+ return $result;
385
+ }
386
+
387
+ /**
388
+ * Get all thumbnail sizes
389
+ */
390
+ static function field_thumbnail_sizes() {
391
+ // All available thumbnail sizes
392
+ global $_wp_additional_image_sizes;
393
+
394
+ $result = $sizes_to_sort = $dimensions_to_sort = array();
395
+
396
+ foreach ( get_intermediate_image_sizes() as $size_name ) {
397
+ if ( in_array( $size_name, array( 'thumbnail', 'medium', 'large' ) ) ) {
398
+ $this_size = array();
399
+ $this_size[] = get_option( $size_name . '_size_w' );
400
+ $this_size[] = get_option( $size_name . '_size_h' );
401
+
402
+ // Add official sizes to result
403
+ $result[$size_name] = ucfirst( $size_name ) . ' (' . implode( ' &times; ', $this_size ) . ')';
404
+ } else {
405
+ if ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[$size_name] ) ) {
406
+
407
+ $this_size = array();
408
+ $this_size['width'] = $_wp_additional_image_sizes[$size_name]['width'];
409
+ $this_size['height'] = $_wp_additional_image_sizes[$size_name]['height'];
410
+
411
+ // Calculate sizes value for sorting
412
+ $sizes_value = intval( $this_size['width'] ) * intval( $this_size['height'] ) + rand( 1, 10 );
413
+
414
+ $dimensions_to_sort[$sizes_value] = $size_name;
415
+ } else {
416
+ $this_size = array( 0, 0 );
417
+ }
418
+
419
+ $sizes_to_sort[$size_name] = ucfirst( preg_replace( '/[\-_]/', ' ', $size_name ) ) . ' (' . implode( ' &times; ', $this_size ) . ')';
420
+ }
421
+ }
422
+ // Add full sizes
423
+ $result['full'] = __( 'Original resolution (But resize automatically to fit its container)', PT_CV_DOMAIN );
424
+
425
+ // Sort custom sizes by index (width * height)
426
+ krsort( $dimensions_to_sort );
427
+
428
+ // Get array element in ASC sorted order
429
+ foreach ( array_reverse( $dimensions_to_sort ) as $size_name ) {
430
+ $result[$size_name] = $sizes_to_sort[$size_name];
431
+ }
432
+
433
+ $result = apply_filters( PT_CV_PREFIX_ . 'field_thumbnail_sizes', $result );
434
+
435
+ return $result;
436
+ }
437
+
438
+ /**
439
+ * Tab Position
440
+ *
441
+ * @return array
442
+ */
443
+ static function tab_position() {
444
+
445
+ $tab_position = array(
446
+ 'top' => __( 'Top', PT_CV_DOMAIN ),
447
+ 'left' => __( 'Left', PT_CV_DOMAIN ),
448
+ 'bottom' => __( 'Bottom', PT_CV_DOMAIN ),
449
+ 'right' => __( 'Right', PT_CV_DOMAIN ),
450
+ );
451
+
452
+ $result = apply_filters( PT_CV_PREFIX_ . 'tab_position', $tab_position );
453
+
454
+ return $result;
455
+
456
+ }
457
+
458
+ /**
459
+ * Thumbnail Position
460
+ *
461
+ * @return array
462
+ */
463
+ static function thumbnail_position() {
464
+
465
+ $thumbnail_position = array(
466
+ 'left' => __( 'Left', PT_CV_DOMAIN ),
467
+ 'right' => __( 'Right', PT_CV_DOMAIN ),
468
+ );
469
+
470
+ $result = apply_filters( PT_CV_PREFIX_ . 'thumbnail_position', $thumbnail_position );
471
+
472
+ return $result;
473
+
474
+ }
475
+
476
+ }
477
+
478
  }
public/assets/css/public.css CHANGED
@@ -9,6 +9,9 @@
9
  */
10
 
11
  /* Fix Bootstrap box-sizing "border-box" problem */
 
 
 
12
  .pt-cv-view *,
13
  .pt-cv-view *:before,
14
  .pt-cv-view *:after {
@@ -28,6 +31,10 @@
28
  position: relative;
29
  }
30
 
 
 
 
 
31
  /* Link */
32
  .pt-cv-view a {
33
  /*color: #000;*/
9
  */
10
 
11
  /* Fix Bootstrap box-sizing "border-box" problem */
12
+ .pt-cv-row *,
13
+ .pt-cv-row *:before,
14
+ .pt-cv-row *:after,
15
  .pt-cv-view *,
16
  .pt-cv-view *:before,
17
  .pt-cv-view *:after {
31
  position: relative;
32
  }
33
 
34
+ .pt-cv-row {
35
+ clear: left;
36
+ }
37
+
38
  /* Link */
39
  .pt-cv-view a {
40
  /*color: #000;*/