Visual Portfolio, Photo Gallery & Post Grid - Version 1.16.2

Version Description

Download this release

Release Info

Developer nko
Plugin Icon 128x128 Visual Portfolio, Photo Gallery & Post Grid
Version 1.16.2
Comparing to
See all releases

Code changes from version 1.16.1 to 1.16.2

assets/admin/js/elementor.js CHANGED
@@ -2,7 +2,7 @@
2
  * Additional js for Elementor
3
  *
4
  * Name : Visual Portfolio
5
- * Version : 1.16.1
6
  * Author : nK https://nkdev.info
7
  */
8
  import { throttle } from 'throttle-debounce';
2
  * Additional js for Elementor
3
  *
4
  * Name : Visual Portfolio
5
+ * Version : 1.16.2
6
  * Author : nK https://nkdev.info
7
  */
8
  import { throttle } from 'throttle-debounce';
assets/admin/js/layouts-editor.js CHANGED
@@ -1,6 +1,6 @@
1
  /*!
2
  * Name : Visual Portfolio
3
- * Version : 1.16.1
4
  * Author : nK https://nkdev.info
5
  */
6
  import { debounce } from 'throttle-debounce';
1
  /*!
2
  * Name : Visual Portfolio
3
+ * Version : 1.16.2
4
  * Author : nK https://nkdev.info
5
  */
6
  import { debounce } from 'throttle-debounce';
assets/admin/js/mce-dropdown.js CHANGED
@@ -1,6 +1,6 @@
1
  /*!
2
  * Name : Visual Portfolio
3
- * Version : 1.16.1
4
  * Author : nK https://nkdev.info
5
  */
6
  const {
1
  /*!
2
  * Name : Visual Portfolio
3
+ * Version : 1.16.2
4
  * Author : nK https://nkdev.info
5
  */
6
  const {
assets/admin/js/script.js CHANGED
@@ -1,6 +1,6 @@
1
  /*!
2
  * Name : Visual Portfolio
3
- * Version : 1.16.1
4
  * Author : nK https://nkdev.info
5
  */
6
  import { debounce } from 'throttle-debounce';
1
  /*!
2
  * Name : Visual Portfolio
3
+ * Version : 1.16.2
4
  * Author : nK https://nkdev.info
5
  */
6
  import { debounce } from 'throttle-debounce';
assets/admin/js/vc-frontend.js CHANGED
@@ -2,7 +2,7 @@
2
  * Additional js for frontend VC
3
  *
4
  * Name : Visual Portfolio
5
- * Version : 1.16.1
6
  * Author : nK https://nkdev.info
7
  */
8
  const {
2
  * Additional js for frontend VC
3
  *
4
  * Name : Visual Portfolio
5
+ * Version : 1.16.2
6
  * Author : nK https://nkdev.info
7
  */
8
  const {
assets/js/layout-grid.js CHANGED
@@ -59,7 +59,7 @@ if ( typeof window.Isotope !== 'undefined' && typeof window.Isotope.LayoutMode !
59
 
60
  GridMode.prototype.getContainerWidth = function() {
61
  // container is parent if fit width
62
- const isFitWidth = this._getOption( 'fitWidth' );
63
  const container = isFitWidth ? this.element.parentNode : this.element;
64
 
65
  // check that this.size and size are there
59
 
60
  GridMode.prototype.getContainerWidth = function() {
61
  // container is parent if fit width
62
+ const isFitWidth = this._getOption ? this._getOption( 'fitWidth' ) : false;
63
  const container = isFitWidth ? this.element.parentNode : this.element;
64
 
65
  // check that this.size and size are there
assets/js/layout-grid.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=6)}({6:function(t,e,i){t.exports=i(7)},7:function(t,e){var i=window.jQuery,o=window.VPData.screenSizes;if(void 0!==window.Isotope&&void 0!==window.Isotope.LayoutMode){var n=window.Isotope.LayoutMode.modes.fitRows;n&&(n.prototype._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this.horizontalColIndex=0,this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns()},n.prototype.measureColumns=function(){if(this.items=this.isotope.filteredItems,this.getContainerWidth(),!this.columnWidth){var t=this.items[0],e=t&&t.element;this.columnWidth=e&&window.getSize(e).outerWidth||this.containerWidth}var i=this.columnWidth+=this.gutter,o=this.containerWidth+this.gutter,n=o/i,r=i-o%i;n=Math[r&&r<1?"round":"floor"](n),this.cols=Math.max(n,1)},n.prototype.getContainerWidth=function(){var t=this._getOption("fitWidth")?this.element.parentNode:this.element,e=window.getSize(t);this.containerWidth=e&&e.innerWidth},n.prototype._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=Math[e&&e<1?"round":"ceil"](t.size.outerWidth/this.columnWidth);i=Math.min(i,this.cols);var o=this.horizontalColIndex%this.cols;o=i>1&&o+i>this.cols?0:o;var n=t.size.outerWidth&&t.size.outerHeight;this.horizontalColIndex=n?o+i:this.horizontalColIndex;var r=t.size.outerWidth+this.gutter;0!==this.x&&1===this.horizontalColIndex&&(this.x=0,this.y=this.maxY);var s={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=r,s})}i(document).on("initOptions.vpf",(function(t,e){"vpf"===t.namespace&&(e.defaults.gridColumns=3,e.options.gridColumns||(e.options.gridColumns=e.defaults.gridColumns))})),i(document).on("initLayout.vpf",(function(t,e){if("vpf"===t.namespace&&"grid"===e.options.layout){e.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/e.options.gridColumns,"%")});for(var i=e.options.gridColumns-1,n=Math.min(o.length-1,i);n>=0;n--)i>0&&void 0!==o[n]&&e.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/i,"%")},"screen and (max-width: ".concat(o[n],"px)")),i-=1}}))}});
1
+ !function(t){var i={};function e(o){if(i[o])return i[o].exports;var n=i[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,e),n.l=!0,n.exports}e.m=t,e.c=i,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var n in t)e.d(o,n,function(i){return t[i]}.bind(null,n));return o},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=6)}({6:function(t,i,e){t.exports=e(7)},7:function(t,i){var e=window.jQuery,o=window.VPData.screenSizes;if(void 0!==window.Isotope&&void 0!==window.Isotope.LayoutMode){var n=window.Isotope.LayoutMode.modes.fitRows;n&&(n.prototype._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this.horizontalColIndex=0,this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns()},n.prototype.measureColumns=function(){if(this.items=this.isotope.filteredItems,this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&window.getSize(i).outerWidth||this.containerWidth}var e=this.columnWidth+=this.gutter,o=this.containerWidth+this.gutter,n=o/e,r=e-o%e;n=Math[r&&r<1?"round":"floor"](n),this.cols=Math.max(n,1)},n.prototype.getContainerWidth=function(){var t=!!this._getOption&&this._getOption("fitWidth")?this.element.parentNode:this.element,i=window.getSize(t);this.containerWidth=i&&i.innerWidth},n.prototype._getItemLayoutPosition=function(t){t.getSize();var i=t.size.outerWidth%this.columnWidth,e=Math[i&&i<1?"round":"ceil"](t.size.outerWidth/this.columnWidth);e=Math.min(e,this.cols);var o=this.horizontalColIndex%this.cols;o=e>1&&o+e>this.cols?0:o;var n=t.size.outerWidth&&t.size.outerHeight;this.horizontalColIndex=n?o+e:this.horizontalColIndex;var r=t.size.outerWidth+this.gutter;0!==this.x&&1===this.horizontalColIndex&&(this.x=0,this.y=this.maxY);var s={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=r,s})}e(document).on("initOptions.vpf",(function(t,i){"vpf"===t.namespace&&(i.defaults.gridColumns=3,i.options.gridColumns||(i.options.gridColumns=i.defaults.gridColumns))})),e(document).on("initLayout.vpf",(function(t,i){if("vpf"===t.namespace&&"grid"===i.options.layout){i.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/i.options.gridColumns,"%")});for(var e=i.options.gridColumns-1,n=Math.min(o.length-1,e);n>=0;n--)e>0&&void 0!==o[n]&&i.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/e,"%")},"screen and (max-width: ".concat(o[n],"px)")),e-=1}}))}});
assets/js/{script-preview.js → preview.js} RENAMED
@@ -1,6 +1,6 @@
1
  /*!
2
  * Name : Visual Portfolio
3
- * Version : 1.16.1
4
  * Author : nK https://nkdev.info
5
  */
6
  const $ = window.jQuery;
1
  /*!
2
  * Name : Visual Portfolio
3
+ * Version : 1.16.2
4
  * Author : nK https://nkdev.info
5
  */
6
  const $ = window.jQuery;
assets/js/{script-preview.min.js → preview.min.js} RENAMED
File without changes
class-visual-portfolio.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Visual Portfolio
4
  * Description: Portfolio post type with visual editor
5
- * Version: 1.16.1
6
  * Author: nK
7
  * Author URI: https://nkdev.info
8
  * License: GPLv2 or later
2
  /**
3
  * Plugin Name: Visual Portfolio
4
  * Description: Portfolio post type with visual editor
5
+ * Version: 1.16.2
6
  * Author: nK
7
  * Author URI: https://nkdev.info
8
  * License: GPLv2 or later
classes/class-admin.php CHANGED
@@ -154,13 +154,13 @@ class Visual_Portfolio_Admin {
154
  wp_enqueue_style( 'codemirror-addon-matchesonscrollbar', visual_portfolio()->plugin_url . 'assets/vendor/codemirror/addon/search/matchesonscrollbar.css', '', $codemirror_version );
155
  wp_enqueue_style( 'codemirror-theme-eclipse', visual_portfolio()->plugin_url . 'assets/vendor/codemirror/theme/eclipse.css', '', $codemirror_version );
156
 
157
- wp_enqueue_script( 'visual-portfolio-layout-admin', visual_portfolio()->plugin_url . 'assets/admin/js/layouts-editor.min.js', array( 'jquery' ), '1.16.1', true );
158
- wp_enqueue_style( 'visual-portfolio-layout-admin', visual_portfolio()->plugin_url . 'assets/admin/css/layouts-editor.min.css', '', '1.16.1' );
159
  wp_localize_script( 'visual-portfolio-layout-admin', 'VPAdminVariables', $data_init );
160
  }
161
 
162
- wp_enqueue_script( 'visual-portfolio-admin', visual_portfolio()->plugin_url . 'assets/admin/js/script.min.js', array( 'jquery', 'wp-data' ), '1.16.1', true );
163
- wp_enqueue_style( 'visual-portfolio-admin', visual_portfolio()->plugin_url . 'assets/admin/css/style.min.css', '', '1.16.1' );
164
  wp_localize_script( 'visual-portfolio-admin', 'VPAdminVariables', $data_init );
165
  }
166
 
@@ -482,7 +482,7 @@ class Visual_Portfolio_Admin {
482
  if ( ! is_blog_installed() ) {
483
  return;
484
  }
485
- if ( get_option( 'visual_portfolio_updated_caps' ) === '1.16.1' ) {
486
  return;
487
  }
488
 
@@ -559,7 +559,7 @@ class Visual_Portfolio_Admin {
559
  $wp_roles->add_cap( 'administrator', $cap );
560
  }
561
 
562
- update_option( 'visual_portfolio_updated_caps', '1.16.1' );
563
  }
564
 
565
  /**
154
  wp_enqueue_style( 'codemirror-addon-matchesonscrollbar', visual_portfolio()->plugin_url . 'assets/vendor/codemirror/addon/search/matchesonscrollbar.css', '', $codemirror_version );
155
  wp_enqueue_style( 'codemirror-theme-eclipse', visual_portfolio()->plugin_url . 'assets/vendor/codemirror/theme/eclipse.css', '', $codemirror_version );
156
 
157
+ wp_enqueue_script( 'visual-portfolio-layout-admin', visual_portfolio()->plugin_url . 'assets/admin/js/layouts-editor.min.js', array( 'jquery' ), '1.16.2', true );
158
+ wp_enqueue_style( 'visual-portfolio-layout-admin', visual_portfolio()->plugin_url . 'assets/admin/css/layouts-editor.min.css', '', '1.16.2' );
159
  wp_localize_script( 'visual-portfolio-layout-admin', 'VPAdminVariables', $data_init );
160
  }
161
 
162
+ wp_enqueue_script( 'visual-portfolio-admin', visual_portfolio()->plugin_url . 'assets/admin/js/script.min.js', array( 'jquery', 'wp-data' ), '1.16.2', true );
163
+ wp_enqueue_style( 'visual-portfolio-admin', visual_portfolio()->plugin_url . 'assets/admin/css/style.min.css', '', '1.16.2' );
164
  wp_localize_script( 'visual-portfolio-admin', 'VPAdminVariables', $data_init );
165
  }
166
 
482
  if ( ! is_blog_installed() ) {
483
  return;
484
  }
485
+ if ( get_option( 'visual_portfolio_updated_caps' ) === '1.16.2' ) {
486
  return;
487
  }
488
 
559
  $wp_roles->add_cap( 'administrator', $cap );
560
  }
561
 
562
+ update_option( 'visual_portfolio_updated_caps', '1.16.2' );
563
  }
564
 
565
  /**
classes/class-assets.php CHANGED
@@ -85,18 +85,20 @@ class Visual_Portfolio_Assets {
85
  return 0;
86
  }
87
 
88
- return $a['priority'] < $b['priority'] ? -1 : 1;
 
 
 
 
89
  }
90
  );
91
 
92
  foreach ( self::$stored_assets[ $type ] as $name => $data ) {
93
- $val = $data['value'];
94
-
95
- if ( $val ) {
96
  if ( 'script' === $type ) {
97
  wp_enqueue_script( $name );
98
- } elseif ( is_string( $val ) ) {
99
- visual_portfolio()->include_template_style( $name, $val );
100
  } else {
101
  wp_enqueue_style( $name );
102
  }
@@ -245,7 +247,7 @@ class Visual_Portfolio_Assets {
245
  $css = wp_kses( $options['vp_controls_styles'], array( '\'', '\"' ) );
246
  $css = str_replace( '&gt;', '>', $css );
247
 
248
- wp_register_style( $controls_css_handle, false, array(), '1.16.1' );
249
  wp_enqueue_style( $controls_css_handle );
250
  wp_add_inline_style( $controls_css_handle, $css );
251
 
@@ -259,7 +261,7 @@ class Visual_Portfolio_Assets {
259
  $css = wp_kses( $options['vp_custom_css'], array( '\'', '\"' ) );
260
  $css = str_replace( '&gt;', '>', $css );
261
 
262
- wp_register_style( $custom_css_handle, false, array(), '1.16.1' );
263
  wp_enqueue_style( $custom_css_handle );
264
  wp_add_inline_style( $custom_css_handle, $css );
265
 
@@ -343,7 +345,7 @@ class Visual_Portfolio_Assets {
343
  );
344
 
345
  foreach ( $vp_styles as $name => $data ) {
346
- wp_register_style( $name, visual_portfolio()->plugin_url . $data[0], $data[1], '1.16.1' );
347
  }
348
 
349
  // Visual Portfolio JS.
@@ -435,7 +437,7 @@ class Visual_Portfolio_Assets {
435
  );
436
 
437
  foreach ( $vp_scripts as $name => $data ) {
438
- wp_register_script( $name, visual_portfolio()->plugin_url . $data[0], $data[1], '1.16.1', true );
439
  }
440
 
441
  do_action( 'vpf_after_assets_register' );
85
  return 0;
86
  }
87
 
88
+ if ( isset( $a['priority'] ) && isset( $b['priority'] ) ) {
89
+ return $a['priority'] < $b['priority'] ? -1 : 1;
90
+ }
91
+
92
+ return 0;
93
  }
94
  );
95
 
96
  foreach ( self::$stored_assets[ $type ] as $name => $data ) {
97
+ if ( isset( $data['value'] ) && $data['value'] ) {
 
 
98
  if ( 'script' === $type ) {
99
  wp_enqueue_script( $name );
100
+ } elseif ( is_string( $data['value'] ) ) {
101
+ visual_portfolio()->include_template_style( $name, $data['value'] );
102
  } else {
103
  wp_enqueue_style( $name );
104
  }
247
  $css = wp_kses( $options['vp_controls_styles'], array( '\'', '\"' ) );
248
  $css = str_replace( '&gt;', '>', $css );
249
 
250
+ wp_register_style( $controls_css_handle, false, array(), '1.16.2' );
251
  wp_enqueue_style( $controls_css_handle );
252
  wp_add_inline_style( $controls_css_handle, $css );
253
 
261
  $css = wp_kses( $options['vp_custom_css'], array( '\'', '\"' ) );
262
  $css = str_replace( '&gt;', '>', $css );
263
 
264
+ wp_register_style( $custom_css_handle, false, array(), '1.16.2' );
265
  wp_enqueue_style( $custom_css_handle );
266
  wp_add_inline_style( $custom_css_handle, $css );
267
 
345
  );
346
 
347
  foreach ( $vp_styles as $name => $data ) {
348
+ wp_register_style( $name, visual_portfolio()->plugin_url . $data[0], $data[1], '1.16.2' );
349
  }
350
 
351
  // Visual Portfolio JS.
437
  );
438
 
439
  foreach ( $vp_scripts as $name => $data ) {
440
+ wp_register_script( $name, visual_portfolio()->plugin_url . $data[0], $data[1], '1.16.2', true );
441
  }
442
 
443
  do_action( 'vpf_after_assets_register' );
classes/class-elementor-widget.php CHANGED
@@ -24,9 +24,9 @@ class Visual_Portfolio_Elementor_Widget extends \Elementor\Widget_Base {
24
 
25
  if ( $this->is_preview_mode() ) {
26
  wp_register_script( 'iframe-resizer', visual_portfolio()->plugin_url . 'assets/vendor/iframe-resizer/iframeResizer.min.js', '', '4.2.1', true );
27
- wp_register_script( 'visual-portfolio-elementor', visual_portfolio()->plugin_url . 'assets/admin/js/elementor.min.js', array( 'elementor-frontend', 'iframe-resizer', 'jquery' ), '1.16.1', true );
28
 
29
- wp_register_style( 'visual-portfolio-elementor', visual_portfolio()->plugin_url . 'assets/admin/css/elementor.min.css', array(), '1.16.1' );
30
  }
31
  }
32
 
24
 
25
  if ( $this->is_preview_mode() ) {
26
  wp_register_script( 'iframe-resizer', visual_portfolio()->plugin_url . 'assets/vendor/iframe-resizer/iframeResizer.min.js', '', '4.2.1', true );
27
+ wp_register_script( 'visual-portfolio-elementor', visual_portfolio()->plugin_url . 'assets/admin/js/elementor.min.js', array( 'elementor-frontend', 'iframe-resizer', 'jquery' ), '1.16.2', true );
28
 
29
+ wp_register_style( 'visual-portfolio-elementor', visual_portfolio()->plugin_url . 'assets/admin/css/elementor.min.css', array(), '1.16.2' );
30
  }
31
  }
32
 
classes/class-get-portfolio.php CHANGED
@@ -1097,7 +1097,9 @@ class Visual_Portfolio_Get {
1097
  // We need this empty array, because when taxonomy selected,
1098
  // ant posts don't have this taxonomy, we will see all available posts.
1099
  // Related topic: https://wordpress.org/support/topic/exclude-certain-category-from-filter/.
1100
- $query_opts['tax_query'][] = array();
 
 
1101
 
1102
  foreach ( $options['vp_posts_taxonomies'] as $taxonomy ) {
1103
  $taxonomy_name = null;
1097
  // We need this empty array, because when taxonomy selected,
1098
  // ant posts don't have this taxonomy, we will see all available posts.
1099
  // Related topic: https://wordpress.org/support/topic/exclude-certain-category-from-filter/.
1100
+ if ( 'OR' === $options['vp_posts_taxonomies_relation'] ) {
1101
+ $query_opts['tax_query'][] = array();
1102
+ }
1103
 
1104
  foreach ( $options['vp_posts_taxonomies'] as $taxonomy ) {
1105
  $taxonomy_name = null;
classes/class-images.php CHANGED
@@ -131,12 +131,15 @@ class Visual_Portfolio_Images {
131
  $width = $ratio['width'];
132
  $height = $ratio['height'];
133
 
134
- $placeholder = '<svg width="' . $width . '" height="' . $height . '" viewBox="0 0 ' . $width . ' ' . $height . '" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>';
 
 
 
135
 
136
  $escape_search = array( '<', '>', '#', '"' );
137
  $escape_replace = array( '%3c', '%3e', '%23', '\'' );
138
 
139
- return 'data:image/svg+xml,' . str_replace( $escape_search, $escape_replace, $placeholder );
140
  }
141
 
142
  /**
131
  $width = $ratio['width'];
132
  $height = $ratio['height'];
133
 
134
+ // We need to use base64 to prevent rare cases when users use plugins
135
+ // that replaces http to https in xmlns attribute.
136
+ // phpcs:ignore
137
+ $placeholder = base64_encode( '<svg width="' . $width . '" height="' . $height . '" viewBox="0 0 ' . $width . ' ' . $height . '" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>' );
138
 
139
  $escape_search = array( '<', '>', '#', '"' );
140
  $escape_replace = array( '%3c', '%3e', '%23', '\'' );
141
 
142
+ return 'data:image/svg+xml;base64,' . str_replace( $escape_search, $escape_replace, $placeholder );
143
  }
144
 
145
  /**
classes/class-preview.php CHANGED
@@ -192,66 +192,32 @@ class Visual_Portfolio_Preview {
192
  * @param int $id - visual portfolio shortcode id.
193
  */
194
  public function print_template( $id ) {
195
- wp_enqueue_script( 'iframe-resizer-content', visual_portfolio()->plugin_url . 'assets/vendor/iframe-resizer/iframeResizer.contentWindow.min.js', array(), '4.2.1', true );
196
- wp_enqueue_script( 'visual-portfolio-preview', visual_portfolio()->plugin_url . 'assets/js/script-preview.min.js', array( 'jquery' ), '1.16.1', true );
197
-
198
- $class_name = 'vp-preview-wrapper';
199
-
200
- // preview type.
201
- // phpcs:ignore
202
- $type = isset( $_GET['vp_preview_type'] ) ? esc_attr( wp_unslash( $_GET['vp_preview_type'] ) ) : false;
203
-
204
- if ( $type ) {
205
- $class_name .= ' vp-preview-type-' . $type;
206
- }
207
-
208
- ?>
209
- <!DOCTYPE html>
210
- <html <?php language_attributes(); ?> style="margin-top: 0 !important;">
211
- <head>
212
- <meta name="viewport" content="width=device-width">
213
 
214
- <?php wp_head(); ?>
 
215
 
216
- <style type="text/css">
217
- html,
218
- body {
219
- margin: 0 !important;
220
- padding: 0 !important;
221
- }
222
- body:before {
223
- content: none !important;
224
- }
225
- #wpadminbar {
226
- display: none;
227
- }
228
- #vp_preview {
229
- position: relative;
230
- z-index: 99999;
231
- }
232
- .vp-portfolio {
233
- margin-top: 0;
234
- margin-bottom: 0;
235
- }
236
- </style>
237
- </head>
238
 
239
- <body>
240
- <div id="vp_preview" class="<?php echo esc_attr( $class_name ); ?>">
241
- <?php
242
- // phpcs:ignore
243
- echo Visual_Portfolio_Get::get( array( 'id' => $id ) );
244
- ?>
245
- </div>
246
 
247
- <script>
248
- <?php // phpcs:ignore ?>
249
- window.vp_preview_post_data = <?php echo isset( $_POST ) && ! empty( $_POST ) ? json_encode( $_POST ) : '{}'; ?>;
250
- </script>
251
 
252
- <?php wp_footer(); ?>
253
- </body>
254
- </html>
255
- <?php
 
 
 
256
  }
257
  }
192
  * @param int $id - visual portfolio shortcode id.
193
  */
194
  public function print_template( $id ) {
195
+ do_action( 'vpf_preview_template' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
 
197
+ // Hide admin bar.
198
+ add_filter( 'show_admin_bar', '__return_false' );
199
 
200
+ // Enqueue assets.
201
+ wp_enqueue_script( 'iframe-resizer-content', visual_portfolio()->plugin_url . 'assets/vendor/iframe-resizer/iframeResizer.contentWindow.min.js', array(), '4.2.1', true );
202
+ wp_enqueue_script( 'visual-portfolio-preview', visual_portfolio()->plugin_url . 'assets/js/preview.min.js', array( 'jquery' ), '1.16.2', true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
+ // Post data for script.
205
+ wp_localize_script(
206
+ 'visual-portfolio-preview',
207
+ 'vp_preview_post_data',
208
+ // phpcs:ignore
209
+ isset( $_POST ) && ! empty( $_POST ) ? $_POST : array()
210
+ );
211
 
212
+ // Custom styles.
213
+ visual_portfolio()->include_template_style( 'visual-portfolio-preview', 'preview/style' );
 
 
214
 
215
+ // Output template.
216
+ visual_portfolio()->include_template(
217
+ 'preview/preview',
218
+ array(
219
+ 'id' => $id,
220
+ )
221
+ );
222
  }
223
  }
classes/class-supported-themes.php CHANGED
@@ -62,7 +62,7 @@ class Visual_Portfolio_Supported_Themes {
62
  public function wp_enqueue_scripts() {
63
  $theme_compat = $this->get_theme_compatibility_style();
64
  if ( $theme_compat ) {
65
- wp_enqueue_style( $theme_compat['name'], $theme_compat['url'], array(), '1.16.1' );
66
  }
67
  }
68
  }
62
  public function wp_enqueue_scripts() {
63
  $theme_compat = $this->get_theme_compatibility_style();
64
  if ( $theme_compat ) {
65
+ wp_enqueue_style( $theme_compat['name'], $theme_compat['url'], array(), '1.16.2' );
66
  }
67
  }
68
  }
classes/class-tinymce.php CHANGED
@@ -70,7 +70,7 @@ class Visual_Portfolio_TinyMCE {
70
  return;
71
  }
72
 
73
- wp_enqueue_script( 'visual-portfolio-tinymce-localize', visual_portfolio()->plugin_url . 'assets/admin/js/mce-localize.min.js', array(), '1.16.1', true );
74
  wp_localize_script( 'visual-portfolio-tinymce-localize', 'VPTinyMCEOptions', $data_tiny_mce );
75
  }
76
  }
70
  return;
71
  }
72
 
73
+ wp_enqueue_script( 'visual-portfolio-tinymce-localize', visual_portfolio()->plugin_url . 'assets/admin/js/mce-localize.min.js', array(), '1.16.2', true );
74
  wp_localize_script( 'visual-portfolio-tinymce-localize', 'VPTinyMCEOptions', $data_tiny_mce );
75
  }
76
  }
classes/class-vc.php CHANGED
@@ -35,7 +35,7 @@ class Visual_Portfolio_VC {
35
  */
36
  public function admin_enqueue_scripts( $page ) {
37
  if ( 'post.php' === $page || 'post-new.php' === $page ) {
38
- wp_enqueue_script( 'visual-portfolio-vc-frontend', visual_portfolio()->plugin_url . 'assets/admin/js/vc-frontend.min.js', array( 'jquery' ), '1.16.1', true );
39
  }
40
  }
41
 
35
  */
36
  public function admin_enqueue_scripts( $page ) {
37
  if ( 'post.php' === $page || 'post-new.php' === $page ) {
38
+ wp_enqueue_script( 'visual-portfolio-vc-frontend', visual_portfolio()->plugin_url . 'assets/admin/js/vc-frontend.min.js', array( 'jquery' ), '1.16.2', true );
39
  }
40
  }
41
 
languages/visual-portfolio.pot CHANGED
@@ -761,83 +761,83 @@ msgstr ""
761
  msgid " - use this classname for each styles you added. It is the main Visual Portfolio wrapper."
762
  msgstr ""
763
 
764
- #: dist/visual-portfolio/classes/class-assets.php:462
765
  msgid "Couldn't retrieve Visual Portfolio ID."
766
  msgstr ""
767
 
768
- #: dist/visual-portfolio/classes/class-assets.php:464
769
  msgid "Close (Esc)"
770
  msgstr ""
771
 
772
- #: dist/visual-portfolio/classes/class-assets.php:465, dist/visual-portfolio/classes/class-assets.php:483
773
  msgid "Share"
774
  msgstr ""
775
 
776
- #: dist/visual-portfolio/classes/class-assets.php:466
777
  msgid "Toggle fullscreen"
778
  msgstr ""
779
 
780
- #: dist/visual-portfolio/classes/class-assets.php:467
781
  msgid "Zoom in/out"
782
  msgstr ""
783
 
784
- #: dist/visual-portfolio/classes/class-assets.php:468
785
  msgid "Previous (arrow left)"
786
  msgstr ""
787
 
788
- #: dist/visual-portfolio/classes/class-assets.php:469
789
  msgid "Next (arrow right)"
790
  msgstr ""
791
 
792
- #: dist/visual-portfolio/classes/class-assets.php:470
793
  msgid "Share on Facebook"
794
  msgstr ""
795
 
796
- #: dist/visual-portfolio/classes/class-assets.php:471
797
  msgid "Tweet"
798
  msgstr ""
799
 
800
- #: dist/visual-portfolio/classes/class-assets.php:472
801
  msgid "Pin it"
802
  msgstr ""
803
 
804
- #: dist/visual-portfolio/classes/class-assets.php:474
805
  msgid "Close"
806
  msgstr ""
807
 
808
- #: dist/visual-portfolio/classes/class-assets.php:475
809
  msgid "Next"
810
  msgstr ""
811
 
812
- #: dist/visual-portfolio/classes/class-assets.php:476
813
  msgid "Previous"
814
  msgstr ""
815
 
816
- #: dist/visual-portfolio/classes/class-assets.php:477
817
  msgid "The requested content cannot be loaded. <br /> Please try again later."
818
  msgstr ""
819
 
820
- #: dist/visual-portfolio/classes/class-assets.php:478
821
  msgid "Start slideshow"
822
  msgstr ""
823
 
824
- #: dist/visual-portfolio/classes/class-assets.php:479
825
  msgid "Pause slideshow"
826
  msgstr ""
827
 
828
- #: dist/visual-portfolio/classes/class-assets.php:480
829
  msgid "Full screen"
830
  msgstr ""
831
 
832
- #: dist/visual-portfolio/classes/class-assets.php:481
833
  msgid "Thumbnails"
834
  msgstr ""
835
 
836
- #: dist/visual-portfolio/classes/class-assets.php:482
837
  msgid "Download"
838
  msgstr ""
839
 
840
- #: dist/visual-portfolio/classes/class-assets.php:484
841
  msgid "Zoom"
842
  msgstr ""
843
 
@@ -885,28 +885,28 @@ msgstr ""
885
  msgid "No items found."
886
  msgstr ""
887
 
888
- #: dist/visual-portfolio/classes/class-get-portfolio.php:1468
889
  msgid "Default sorting"
890
  msgstr ""
891
 
892
- #: dist/visual-portfolio/classes/class-get-portfolio.php:1469
893
  msgid "Sort by date (newest)"
894
  msgstr ""
895
 
896
- #: dist/visual-portfolio/classes/class-get-portfolio.php:1470
897
  msgid "Sort by date (oldest)"
898
  msgstr ""
899
 
900
- #: dist/visual-portfolio/classes/class-get-portfolio.php:1471
901
  msgid "Sort by title (A-Z)"
902
  msgstr ""
903
 
904
- #: dist/visual-portfolio/classes/class-get-portfolio.php:1472
905
  msgid "Sort by title (Z-A)"
906
  msgstr ""
907
 
908
  #. translators: %s - published in human format.
909
- #: dist/visual-portfolio/classes/class-get-portfolio.php:1580
910
  msgid "%s ago"
911
  msgstr ""
912
 
761
  msgid " - use this classname for each styles you added. It is the main Visual Portfolio wrapper."
762
  msgstr ""
763
 
764
+ #: dist/visual-portfolio/classes/class-assets.php:464
765
  msgid "Couldn't retrieve Visual Portfolio ID."
766
  msgstr ""
767
 
768
+ #: dist/visual-portfolio/classes/class-assets.php:466
769
  msgid "Close (Esc)"
770
  msgstr ""
771
 
772
+ #: dist/visual-portfolio/classes/class-assets.php:467, dist/visual-portfolio/classes/class-assets.php:485
773
  msgid "Share"
774
  msgstr ""
775
 
776
+ #: dist/visual-portfolio/classes/class-assets.php:468
777
  msgid "Toggle fullscreen"
778
  msgstr ""
779
 
780
+ #: dist/visual-portfolio/classes/class-assets.php:469
781
  msgid "Zoom in/out"
782
  msgstr ""
783
 
784
+ #: dist/visual-portfolio/classes/class-assets.php:470
785
  msgid "Previous (arrow left)"
786
  msgstr ""
787
 
788
+ #: dist/visual-portfolio/classes/class-assets.php:471
789
  msgid "Next (arrow right)"
790
  msgstr ""
791
 
792
+ #: dist/visual-portfolio/classes/class-assets.php:472
793
  msgid "Share on Facebook"
794
  msgstr ""
795
 
796
+ #: dist/visual-portfolio/classes/class-assets.php:473
797
  msgid "Tweet"
798
  msgstr ""
799
 
800
+ #: dist/visual-portfolio/classes/class-assets.php:474
801
  msgid "Pin it"
802
  msgstr ""
803
 
804
+ #: dist/visual-portfolio/classes/class-assets.php:476
805
  msgid "Close"
806
  msgstr ""
807
 
808
+ #: dist/visual-portfolio/classes/class-assets.php:477
809
  msgid "Next"
810
  msgstr ""
811
 
812
+ #: dist/visual-portfolio/classes/class-assets.php:478
813
  msgid "Previous"
814
  msgstr ""
815
 
816
+ #: dist/visual-portfolio/classes/class-assets.php:479
817
  msgid "The requested content cannot be loaded. <br /> Please try again later."
818
  msgstr ""
819
 
820
+ #: dist/visual-portfolio/classes/class-assets.php:480
821
  msgid "Start slideshow"
822
  msgstr ""
823
 
824
+ #: dist/visual-portfolio/classes/class-assets.php:481
825
  msgid "Pause slideshow"
826
  msgstr ""
827
 
828
+ #: dist/visual-portfolio/classes/class-assets.php:482
829
  msgid "Full screen"
830
  msgstr ""
831
 
832
+ #: dist/visual-portfolio/classes/class-assets.php:483
833
  msgid "Thumbnails"
834
  msgstr ""
835
 
836
+ #: dist/visual-portfolio/classes/class-assets.php:484
837
  msgid "Download"
838
  msgstr ""
839
 
840
+ #: dist/visual-portfolio/classes/class-assets.php:486
841
  msgid "Zoom"
842
  msgstr ""
843
 
885
  msgid "No items found."
886
  msgstr ""
887
 
888
+ #: dist/visual-portfolio/classes/class-get-portfolio.php:1470
889
  msgid "Default sorting"
890
  msgstr ""
891
 
892
+ #: dist/visual-portfolio/classes/class-get-portfolio.php:1471
893
  msgid "Sort by date (newest)"
894
  msgstr ""
895
 
896
+ #: dist/visual-portfolio/classes/class-get-portfolio.php:1472
897
  msgid "Sort by date (oldest)"
898
  msgstr ""
899
 
900
+ #: dist/visual-portfolio/classes/class-get-portfolio.php:1473
901
  msgid "Sort by title (A-Z)"
902
  msgstr ""
903
 
904
+ #: dist/visual-portfolio/classes/class-get-portfolio.php:1474
905
  msgid "Sort by title (Z-A)"
906
  msgstr ""
907
 
908
  #. translators: %s - published in human format.
909
+ #: dist/visual-portfolio/classes/class-get-portfolio.php:1582
910
  msgid "%s ago"
911
  msgstr ""
912
 
readme.md CHANGED
@@ -5,7 +5,7 @@
5
  * Requires at least: 4.0.0
6
  * Tested up to: 5.3
7
  * Requires PHP: 5.5.9
8
- * Stable tag: 1.16.1
9
  * License: GPLv2 or later
10
  * License URI: <http://www.gnu.org/licenses/gpl-2.0.html>
11
 
@@ -124,6 +124,14 @@ The manual installation method involves downloading our Visual Portfolio plugin
124
 
125
  ## Changelog ##
126
 
 
 
 
 
 
 
 
 
127
  = 1.16.1 =
128
 
129
  * added style fixes for some Twenty themes
5
  * Requires at least: 4.0.0
6
  * Tested up to: 5.3
7
  * Requires PHP: 5.5.9
8
+ * Stable tag: 1.16.2
9
  * License: GPLv2 or later
10
  * License URI: <http://www.gnu.org/licenses/gpl-2.0.html>
11
 
124
 
125
  ## Changelog ##
126
 
127
+ = 1.16.2 =
128
+
129
+ * preview moved to `templates/preview`, so you can override it from themes
130
+ * use base64 for placeholders
131
+ * fixed posts output when taxonomies relation set to AND and no taxonomies selected
132
+ * fixed Grid JS error if used old Isotope script (for example in Bridge theme)
133
+ * fixed notices in PHP 7.4
134
+
135
  = 1.16.1 =
136
 
137
  * added style fixes for some Twenty themes
templates/preview/preview.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Preview template.
4
+ *
5
+ * @var $args
6
+ * @package visual-portfolio
7
+ */
8
+
9
+ if ( ! defined( 'ABSPATH' ) ) {
10
+ exit;
11
+ }
12
+
13
+ // phpcs:ignore
14
+ $class_name = 'vp-preview-wrapper';
15
+
16
+ // preview type.
17
+ // phpcs:ignore
18
+ $type = isset( $_GET['vp_preview_type'] ) ? esc_attr( wp_unslash( $_GET['vp_preview_type'] ) ) : false;
19
+
20
+ if ( $type ) {
21
+ // phpcs:ignore
22
+ $class_name .= ' vp-preview-type-' . $type;
23
+ }
24
+
25
+ ?><!DOCTYPE html>
26
+ <html <?php language_attributes(); ?> style="margin-top: 0 !important;">
27
+ <head>
28
+ <meta name="viewport" content="width=device-width">
29
+
30
+ <?php wp_head(); ?>
31
+ </head>
32
+
33
+ <body <?php body_class( 'vp-preview-body' ); ?>>
34
+ <?php do_action( 'vpf_before_preview_output' ); ?>
35
+
36
+ <div class="entry-content">
37
+ <div id="vp_preview" class="<?php echo esc_attr( $class_name ); ?>">
38
+ <?php
39
+ // phpcs:ignore
40
+ echo Visual_Portfolio_Get::get( array( 'id' => $args['id'] ) );
41
+ ?>
42
+ </div>
43
+ </div>
44
+
45
+ <?php do_action( 'vpf_after_preview_output' ); ?>
46
+
47
+ <?php wp_footer(); ?>
48
+ </body>
49
+ </html>
templates/preview/style.min.css ADDED
@@ -0,0 +1 @@
 
1
+ html,body{margin:0 !important;padding:0 !important}body::before{content:none !important}#wpadminbar{display:none}#vp_preview{position:relative;width:100%;max-width:none;padding:0;margin:0;z-index:99999}.entry-content{padding:0 !important;margin:0 !important}.vp-portfolio{margin-top:0;margin-bottom:0}