Version Description
- JS and CSS assets from the plugin will be loaded only on pages showing an Instagram feed
- Minor bug fixes and improvements
Download this release
Release Info
Developer | WPZOOM |
Plugin | Instagram Widget by WPZOOM |
Version | 2.0.3 |
Comparing to | |
See all releases |
Code changes from version 2.0.2 to 2.0.3
- class-wpzoom-instagram-assets.php +387 -0
- class-wpzoom-instagram-block.php +0 -52
- class-wpzoom-instagram-widget-after-setup.php +2 -1
- class-wpzoom-instagram-widget-display.php +1 -18
- class-wpzoom-instagram-widget-settings.php +5 -0
- class-wpzoom-instagram-widget.php +1 -85
- instagram-widget-by-wpzoom.php +4 -2
- readme.txt +4 -0
class-wpzoom-instagram-assets.php
ADDED
@@ -0,0 +1,387 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Enqueue CSS/JS of the plugin.
|
5 |
+
*
|
6 |
+
* @since 2.0.2
|
7 |
+
* @package WPZOOM_Instagram_Widget
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit;
|
13 |
+
}
|
14 |
+
|
15 |
+
if ( ! class_exists( 'WPZOOM_Instagram_Widget_Assets ' ) ) {
|
16 |
+
/**
|
17 |
+
* Main WPZOOM_Instagram_Widget_Assets Class.
|
18 |
+
*
|
19 |
+
* @since 2.0.2
|
20 |
+
*/
|
21 |
+
class WPZOOM_Instagram_Widget_Assets {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* This plugin's instance.
|
25 |
+
*
|
26 |
+
* @var WPZOOM_Instagram_Widget_Assets
|
27 |
+
* @since 2.0.2
|
28 |
+
*/
|
29 |
+
private static $instance;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Provides singleton instance.
|
33 |
+
*
|
34 |
+
* @since 2.0.2
|
35 |
+
* @return self instance
|
36 |
+
*/
|
37 |
+
public static function instance() {
|
38 |
+
|
39 |
+
if ( null === self::$instance ) {
|
40 |
+
self::$instance = new WPZOOM_Instagram_Widget_Assets();
|
41 |
+
}
|
42 |
+
|
43 |
+
return self::$instance;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* The base directory path.
|
48 |
+
*
|
49 |
+
* @var string $_dir
|
50 |
+
*/
|
51 |
+
private $_dir;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* The base URL path.
|
55 |
+
*
|
56 |
+
* @var string $_url
|
57 |
+
*/
|
58 |
+
private $_url;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* The Constructor.
|
62 |
+
*/
|
63 |
+
public function __construct() {
|
64 |
+
|
65 |
+
add_action( 'enqueue_block_assets', array( $this, 'frontend_register_scripts' ), 5 );
|
66 |
+
add_action( 'enqueue_block_assets', array( $this, 'widget_styles' ), 5 );
|
67 |
+
|
68 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'register_block_assets' ) );
|
69 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'widget_styles' ) );
|
70 |
+
|
71 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'widget_styles' ) );
|
72 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'register_widget_scripts' ) );
|
73 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_widget_scripts' ) );
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Enqueue styles and scripts for SiteOrigin Page Builder.
|
77 |
+
*/
|
78 |
+
add_action( 'siteorigin_panel_enqueue_admin_scripts', array( $this, 'widget_styles' ) );
|
79 |
+
add_action( 'siteorigin_panel_enqueue_admin_scripts', array( $this, 'register_widget_scripts' ) );
|
80 |
+
add_action( 'siteorigin_panel_enqueue_admin_scripts', array( $this, 'enqueue_widget_scripts' ) );
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
public function frontend_register_scripts() {
|
86 |
+
|
87 |
+
global $post;
|
88 |
+
|
89 |
+
$should_enqueue = has_block( 'wpzoom/instagram-block' );
|
90 |
+
$has_reusable_block = self::has_reusable_block( 'wpzoom/instagram-block' );
|
91 |
+
$is_active_widget = is_active_widget( false, false, 'wpzoom_instagram_widget', true );
|
92 |
+
$has_shortcode = ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'instagram' ) );
|
93 |
+
$has_widget_block = self::is_active_block_widget( 'wpzoom/instagram-block' );
|
94 |
+
|
95 |
+
$script_asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/scripts/backend/block.asset.php' );
|
96 |
+
$style_asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/styles/frontend/block.asset.php' );
|
97 |
+
|
98 |
+
if( is_admin() || $should_enqueue || $has_reusable_block || $is_active_widget || $has_shortcode || $has_widget_block || isset( $_GET['wpz-insta-widget-preview'] ) ) {
|
99 |
+
wp_register_script(
|
100 |
+
'magnific-popup',
|
101 |
+
plugins_url( 'dist/scripts/library/magnific-popup.js', __FILE__ ),
|
102 |
+
array( 'jquery', 'underscore', 'wp-util' ),
|
103 |
+
filemtime( plugin_dir_path( __FILE__ ) . 'dist/scripts/library/magnific-popup.js' ),
|
104 |
+
true
|
105 |
+
);
|
106 |
+
|
107 |
+
wp_register_script(
|
108 |
+
'swiper-js',
|
109 |
+
plugins_url( 'dist/scripts/library/swiper.js', __FILE__ ),
|
110 |
+
array(),
|
111 |
+
'7.0.0-alpha.21'
|
112 |
+
);
|
113 |
+
|
114 |
+
wp_register_script(
|
115 |
+
'wpz-insta_block-frontend-script',
|
116 |
+
plugins_url( 'dist/scripts/frontend/block.js', __FILE__ ),
|
117 |
+
array( 'jquery', 'underscore', 'magnific-popup', 'swiper-js' ),
|
118 |
+
$script_asset_file['version']
|
119 |
+
);
|
120 |
+
|
121 |
+
wp_register_style(
|
122 |
+
'magnific-popup',
|
123 |
+
plugins_url( 'dist/styles/library/magnific-popup.css', __FILE__ ),
|
124 |
+
array( 'dashicons' ),
|
125 |
+
WPZOOM_INSTAGRAM_VERSION
|
126 |
+
);
|
127 |
+
|
128 |
+
wp_register_style(
|
129 |
+
'wpz-insta_block-frontend-style',
|
130 |
+
plugins_url( 'dist/styles/frontend/block.css', __FILE__ ),
|
131 |
+
array( 'magnific-popup', 'swiper-css' ),
|
132 |
+
$style_asset_file['version']
|
133 |
+
);
|
134 |
+
}
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
|
139 |
+
public function register_block_assets() {
|
140 |
+
|
141 |
+
$script_asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/scripts/backend/block.asset.php' );
|
142 |
+
$style_asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/styles/frontend/block.asset.php' );
|
143 |
+
|
144 |
+
wp_register_script(
|
145 |
+
'wpz-insta_block-backend-script',
|
146 |
+
plugins_url( 'dist/scripts/backend/block.js', __FILE__ ),
|
147 |
+
$script_asset_file['dependencies'],
|
148 |
+
$script_asset_file['version']
|
149 |
+
);
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* Load widget specific styles.
|
155 |
+
*/
|
156 |
+
public function widget_styles() {
|
157 |
+
|
158 |
+
global $post;
|
159 |
+
|
160 |
+
$should_enqueue = has_block( 'wpzoom/instagram-block' );
|
161 |
+
$has_reusable_block = self::has_reusable_block( 'wpzoom/instagram-block' );
|
162 |
+
$is_active_widget = is_active_widget( false, false, 'wpzoom_instagram_widget', true );
|
163 |
+
$has_shortcode = ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'instagram' ) );
|
164 |
+
$has_widget_block = self::is_active_block_widget( 'wpzoom/instagram-block' );
|
165 |
+
|
166 |
+
if( is_admin() || $should_enqueue || $has_reusable_block || $is_active_widget || $has_shortcode || $has_widget_block || isset( $_GET['wpz-insta-widget-preview'] ) ) {
|
167 |
+
|
168 |
+
wp_enqueue_style(
|
169 |
+
'swiper-css',
|
170 |
+
plugin_dir_url( __FILE__ ) . 'dist/styles/library/swiper.css',
|
171 |
+
array(),
|
172 |
+
'7.0.0-alpha.21'
|
173 |
+
);
|
174 |
+
|
175 |
+
wp_enqueue_style(
|
176 |
+
'zoom-instagram-widget',
|
177 |
+
plugin_dir_url( __FILE__ ) . 'dist/styles/frontend/index.css',
|
178 |
+
array( 'dashicons', 'wpz-insta_block-frontend-style' ),
|
179 |
+
WPZOOM_INSTAGRAM_VERSION
|
180 |
+
);
|
181 |
+
|
182 |
+
wp_enqueue_style(
|
183 |
+
'magnific-popup',
|
184 |
+
plugin_dir_url( __FILE__ ) . 'dist/styles/library/magnific-popup.css',
|
185 |
+
array( 'dashicons' ),
|
186 |
+
WPZOOM_INSTAGRAM_VERSION
|
187 |
+
);
|
188 |
+
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Register widget specific scripts.
|
194 |
+
*/
|
195 |
+
public function register_widget_scripts() {
|
196 |
+
wp_register_script(
|
197 |
+
'zoom-instagram-widget-lazy-load',
|
198 |
+
plugin_dir_url( __FILE__ ) . 'dist/scripts/library/lazy.js',
|
199 |
+
array( 'jquery' ),
|
200 |
+
filemtime( plugin_dir_path( __FILE__ ) . 'dist/scripts/library/lazy.js' ),
|
201 |
+
true
|
202 |
+
);
|
203 |
+
|
204 |
+
wp_register_script(
|
205 |
+
'magnific-popup',
|
206 |
+
plugin_dir_url( __FILE__ ) . 'dist/scripts/library/magnific-popup.js',
|
207 |
+
array( 'jquery', 'underscore', 'wp-util' ),
|
208 |
+
filemtime( plugin_dir_path( __FILE__ ) . 'dist/scripts/library/magnific-popup.js' ),
|
209 |
+
true
|
210 |
+
);
|
211 |
+
|
212 |
+
wp_register_script(
|
213 |
+
'swiper-js',
|
214 |
+
plugin_dir_url( __FILE__ ) . 'dist/scripts/library/swiper.js',
|
215 |
+
array(),
|
216 |
+
'7.0.0-alpha.21',
|
217 |
+
true
|
218 |
+
);
|
219 |
+
|
220 |
+
wp_register_script(
|
221 |
+
'zoom-instagram-widget',
|
222 |
+
plugin_dir_url( __FILE__ ) . 'dist/scripts/frontend/index.js',
|
223 |
+
array( 'jquery', 'underscore', 'wp-util', 'magnific-popup', 'swiper-js' ),
|
224 |
+
WPZOOM_INSTAGRAM_VERSION,
|
225 |
+
true
|
226 |
+
);
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Load widget specific scripts.
|
231 |
+
*/
|
232 |
+
public function enqueue_widget_scripts() {
|
233 |
+
|
234 |
+
global $post;
|
235 |
+
|
236 |
+
$should_enqueue = has_block( 'wpzoom/instagram-block' );
|
237 |
+
$has_reusable_block = self::has_reusable_block( 'wpzoom/instagram-block' );
|
238 |
+
$is_active_widget = is_active_widget( false, false, 'wpzoom_instagram_widget', true );
|
239 |
+
$has_shortcode = ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'instagram' ) );
|
240 |
+
$has_widget_block = self::is_active_block_widget( 'wpzoom/instagram-block' );
|
241 |
+
|
242 |
+
if( is_admin() || $should_enqueue || $has_reusable_block || $is_active_widget || $has_shortcode || $has_widget_block || isset( $_GET['wpz-insta-widget-preview'] ) ) {
|
243 |
+
wp_enqueue_script( 'zoom-instagram-widget-lazy-load' );
|
244 |
+
wp_enqueue_script( 'magnific-popup' );
|
245 |
+
wp_enqueue_script( 'swiper-js' );
|
246 |
+
wp_enqueue_script( 'zoom-instagram-widget' );
|
247 |
+
}
|
248 |
+
|
249 |
+
}
|
250 |
+
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Check the widget block based area has the block
|
254 |
+
*
|
255 |
+
* @since 2.0.2
|
256 |
+
* @param string $block_name The block name.
|
257 |
+
* @return boolean Return true if post content has provided block name as reusable block, else return false.
|
258 |
+
*/
|
259 |
+
public static function is_active_block_widget( $blockname ) {
|
260 |
+
|
261 |
+
$widget_blocks = get_option( 'widget_block' );
|
262 |
+
$text_widgets = get_option( 'widget_text' );
|
263 |
+
|
264 |
+
foreach( (array) $text_widgets as $text_widget ) {
|
265 |
+
if ( ! empty( $text_widget['text'] ) && has_shortcode( $text_widget['text'], 'instagram' ) ) {
|
266 |
+
return true;
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
foreach( (array) $widget_blocks as $widget_block ) {
|
271 |
+
if ( ! empty( $widget_block['content'] ) && ( has_block( $blockname, $widget_block['content'] ) || has_shortcode( $widget_block['content'], 'instagram' ) ) ) {
|
272 |
+
return true;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
return false;
|
277 |
+
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* Check the post content has reusable block
|
282 |
+
*
|
283 |
+
* @since 2.0.2
|
284 |
+
* @param string $block_name The block name.
|
285 |
+
* @param int $post_id The post ID.
|
286 |
+
* @param int $reusable_block_id The reusable block post ID.
|
287 |
+
* @param boolean|int $content The post content.
|
288 |
+
* @return boolean Return true if post content has provided block name as reusable block, else return false.
|
289 |
+
*/
|
290 |
+
public static function has_reusable_block( $block_name, $post_id = 0, $reusable_block_id = 0, $content = '' ) {
|
291 |
+
$has_reusable_block = false;
|
292 |
+
$post_id = $post_id > 0 ? $post_id : get_the_ID();
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Loop reusable blocks to get needed block
|
296 |
+
*
|
297 |
+
* @since 2.0.2
|
298 |
+
*/
|
299 |
+
if ( ! empty( self::get_reusable_block( absint( $reusable_block_id ) ) ) ) {
|
300 |
+
$args = array(
|
301 |
+
'post_type' => 'wp_block',
|
302 |
+
'posts_per_page' => -1,
|
303 |
+
'post_status' => 'publish',
|
304 |
+
);
|
305 |
+
$query = new WP_Query( $args );
|
306 |
+
|
307 |
+
while ( $query->have_posts() ) {
|
308 |
+
$query->the_post();
|
309 |
+
if ( absint( $reusable_block_id ) === get_the_ID() ) {
|
310 |
+
$content = get_post_field( 'post_content', get_the_ID() );
|
311 |
+
if ( has_block( $block_name, $content ) ) {
|
312 |
+
$has_reusable_block = true;
|
313 |
+
return $has_reusable_block;
|
314 |
+
}
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
// Reset global post variable. After this point, we are back to the Main Query object.
|
319 |
+
wp_reset_postdata();
|
320 |
+
}
|
321 |
+
|
322 |
+
// Early return if $has_reusable_block is true.
|
323 |
+
if ( true === $has_reusable_block ) {
|
324 |
+
return;
|
325 |
+
}
|
326 |
+
|
327 |
+
if ( empty( $content ) ) {
|
328 |
+
$content = get_post_field( 'post_content', $post_id );
|
329 |
+
}
|
330 |
+
|
331 |
+
if ( $content ) {
|
332 |
+
if ( has_block( 'block', $content ) ) {
|
333 |
+
// Check reusable blocks.
|
334 |
+
$blocks = parse_blocks( $content );
|
335 |
+
|
336 |
+
if ( ! is_array( $blocks ) || empty( $blocks ) ) {
|
337 |
+
return false;
|
338 |
+
}
|
339 |
+
|
340 |
+
foreach ( $blocks as $block ) {
|
341 |
+
if ( $block['blockName'] === 'core/block' && ! empty( $block['attrs']['ref'] ) ) {
|
342 |
+
$reusable_block_id = absint( $block['attrs']['ref'] );
|
343 |
+
|
344 |
+
if ( has_block( $block_name, $reusable_block_id ) ) {
|
345 |
+
return true;
|
346 |
+
} elseif ( ! empty( self::get_reusable_block( $reusable_block_id ) ) ) {
|
347 |
+
return true;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
}
|
351 |
+
} elseif ( has_block( $block_name, $content ) ) {
|
352 |
+
return true;
|
353 |
+
} elseif ( has_shortcode( $content, 'reblex' ) ) {
|
354 |
+
return true;
|
355 |
+
} else {
|
356 |
+
return false;
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
return false;
|
361 |
+
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Get reusable block.
|
365 |
+
*
|
366 |
+
* @since 2.0.2
|
367 |
+
* @param int $id Reusable block id.
|
368 |
+
* @return string Reusable block post content.
|
369 |
+
*/
|
370 |
+
public static function get_reusable_block( $id ) {
|
371 |
+
$post = '';
|
372 |
+
|
373 |
+
if ( ! is_string( $id ) && $id > 0 ) {
|
374 |
+
$wp_post = get_post( $id );
|
375 |
+
if ( $wp_post instanceof WP_Post ) {
|
376 |
+
$post = $wp_post->post_content;
|
377 |
+
}
|
378 |
+
}
|
379 |
+
|
380 |
+
return $post;
|
381 |
+
}
|
382 |
+
|
383 |
+
}
|
384 |
+
|
385 |
+
}
|
386 |
+
|
387 |
+
WPZOOM_Instagram_Widget_Assets::instance();
|
class-wpzoom-instagram-block.php
CHANGED
@@ -49,58 +49,6 @@ class Wpzoom_Instagram_Block {
|
|
49 |
* Initialize the block.
|
50 |
*/
|
51 |
public function init() {
|
52 |
-
$script_asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/scripts/backend/block.asset.php' );
|
53 |
-
$style_asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/styles/frontend/block.asset.php' );
|
54 |
-
|
55 |
-
wp_register_script(
|
56 |
-
'wpz-insta_block-backend-script',
|
57 |
-
plugins_url( 'dist/scripts/backend/block.js', __FILE__ ),
|
58 |
-
$script_asset_file['dependencies'],
|
59 |
-
$script_asset_file['version']
|
60 |
-
);
|
61 |
-
|
62 |
-
wp_register_script(
|
63 |
-
'magnific-popup',
|
64 |
-
plugins_url( 'dist/scripts/library/magnific-popup.js', __FILE__ ),
|
65 |
-
array( 'jquery', 'underscore', 'wp-util' ),
|
66 |
-
filemtime( plugin_dir_path( __FILE__ ) . 'dist/scripts/library/magnific-popup.js' ),
|
67 |
-
true
|
68 |
-
);
|
69 |
-
|
70 |
-
wp_register_script(
|
71 |
-
'swiper-js',
|
72 |
-
plugins_url( 'dist/scripts/library/swiper.js', __FILE__ ),
|
73 |
-
array(),
|
74 |
-
'7.0.0-alpha.21'
|
75 |
-
);
|
76 |
-
|
77 |
-
wp_register_script(
|
78 |
-
'wpz-insta_block-frontend-script',
|
79 |
-
plugins_url( 'dist/scripts/frontend/block.js', __FILE__ ),
|
80 |
-
array( 'jquery', 'underscore', 'magnific-popup', 'swiper-js' ),
|
81 |
-
$script_asset_file['version']
|
82 |
-
);
|
83 |
-
|
84 |
-
wp_register_style(
|
85 |
-
'magnific-popup',
|
86 |
-
plugins_url( 'dist/styles/library/magnific-popup.css', __FILE__ ),
|
87 |
-
array( 'dashicons' ),
|
88 |
-
WPZOOM_INSTAGRAM_VERSION
|
89 |
-
);
|
90 |
-
|
91 |
-
wp_enqueue_style(
|
92 |
-
'swiper-css',
|
93 |
-
plugins_url( 'dist/styles/library/swiper.css', __FILE__ ),
|
94 |
-
array(),
|
95 |
-
'7.0.0-alpha.21'
|
96 |
-
);
|
97 |
-
|
98 |
-
wp_register_style(
|
99 |
-
'wpz-insta_block-frontend-style',
|
100 |
-
plugins_url( 'dist/styles/frontend/block.css', __FILE__ ),
|
101 |
-
array( 'magnific-popup', 'swiper-css' ),
|
102 |
-
$style_asset_file['version']
|
103 |
-
);
|
104 |
|
105 |
register_block_type(
|
106 |
'wpzoom/instagram-block',
|
49 |
* Initialize the block.
|
50 |
*/
|
51 |
public function init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
register_block_type(
|
54 |
'wpzoom/instagram-block',
|
class-wpzoom-instagram-widget-after-setup.php
CHANGED
@@ -39,7 +39,8 @@ class Wpzoom_Instagram_Widget_After_Setup {
|
|
39 |
public function init() {
|
40 |
|
41 |
//Run only once
|
42 |
-
|
|
|
43 |
return;
|
44 |
}
|
45 |
|
39 |
public function init() {
|
40 |
|
41 |
//Run only once
|
42 |
+
$run_once = get_option( 'wpzoom_run_only_once_01' );
|
43 |
+
if ( !empty( $run_once ) ) {
|
44 |
return;
|
45 |
}
|
46 |
|
class-wpzoom-instagram-widget-display.php
CHANGED
@@ -7,7 +7,7 @@ defined( 'ABSPATH' ) or die;
|
|
7 |
/**
|
8 |
* WPZOOM Instagram Widget Display class
|
9 |
*
|
10 |
-
* @package
|
11 |
*/
|
12 |
class Wpzoom_Instagram_Widget_Display {
|
13 |
/**
|
@@ -48,26 +48,9 @@ class Wpzoom_Instagram_Widget_Display {
|
|
48 |
|
49 |
$this->is_pro = apply_filters( 'wpz-insta_is-pro', false );
|
50 |
|
51 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
52 |
-
|
53 |
add_shortcode( 'instagram', array( $this, 'get_shortcode_output' ) );
|
54 |
}
|
55 |
|
56 |
-
/**
|
57 |
-
* Enqueue some needed scripts on the frontend.
|
58 |
-
*
|
59 |
-
* @return void
|
60 |
-
*/
|
61 |
-
public function enqueue_scripts() {
|
62 |
-
wp_enqueue_script(
|
63 |
-
'zoom-instagram-widget-lazy-load',
|
64 |
-
plugin_dir_url( __FILE__ ) . 'dist/scripts/library/lazy.js',
|
65 |
-
array( 'jquery' ),
|
66 |
-
filemtime( plugin_dir_path( __FILE__ ) . 'dist/scripts/library/lazy.js' ),
|
67 |
-
true
|
68 |
-
);
|
69 |
-
}
|
70 |
-
|
71 |
/**
|
72 |
* Returns the markup for the feed with the given ID.
|
73 |
*
|
7 |
/**
|
8 |
* WPZOOM Instagram Widget Display class
|
9 |
*
|
10 |
+
* @package WPZOOM_Instagram_Widget
|
11 |
*/
|
12 |
class Wpzoom_Instagram_Widget_Display {
|
13 |
/**
|
48 |
|
49 |
$this->is_pro = apply_filters( 'wpz-insta_is-pro', false );
|
50 |
|
|
|
|
|
51 |
add_shortcode( 'instagram', array( $this, 'get_shortcode_output' ) );
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
/**
|
55 |
* Returns the markup for the feed with the given ID.
|
56 |
*
|
class-wpzoom-instagram-widget-settings.php
CHANGED
@@ -140,6 +140,11 @@ class WPZOOM_Instagram_Widget_Settings {
|
|
140 |
}
|
141 |
|
142 |
public function init() {
|
|
|
|
|
|
|
|
|
|
|
143 |
register_post_type(
|
144 |
'wpz-insta_user',
|
145 |
array(
|
140 |
}
|
141 |
|
142 |
public function init() {
|
143 |
+
|
144 |
+
if( !current_user_can( 'manage_options' ) ) {
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
register_post_type(
|
149 |
'wpz-insta_user',
|
150 |
array(
|
class-wpzoom-instagram-widget.php
CHANGED
@@ -46,15 +46,6 @@ class Wpzoom_Instagram_Widget extends WP_Widget {
|
|
46 |
'username' => '',
|
47 |
);
|
48 |
|
49 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'styles' ) );
|
50 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Enqueue styles and scripts for SiteOrigin Page Builder.
|
54 |
-
*/
|
55 |
-
add_action( 'siteorigin_panel_enqueue_admin_scripts', array( $this, 'styles' ) );
|
56 |
-
add_action( 'siteorigin_panel_enqueue_admin_scripts', array( $this, 'register_scripts' ) );
|
57 |
-
add_action( 'siteorigin_panel_enqueue_admin_scripts', array( $this, 'enqueue_scripts' ) );
|
58 |
}
|
59 |
|
60 |
/**
|
@@ -100,79 +91,6 @@ class Wpzoom_Instagram_Widget extends WP_Widget {
|
|
100 |
return trim( $caption );
|
101 |
}
|
102 |
|
103 |
-
/**
|
104 |
-
* Load widget specific styles.
|
105 |
-
*/
|
106 |
-
public function styles() {
|
107 |
-
wp_enqueue_style(
|
108 |
-
'zoom-instagram-widget',
|
109 |
-
plugin_dir_url( __FILE__ ) . 'dist/styles/frontend/index.css',
|
110 |
-
array( 'dashicons' ),
|
111 |
-
WPZOOM_INSTAGRAM_VERSION
|
112 |
-
);
|
113 |
-
|
114 |
-
wp_enqueue_style(
|
115 |
-
'magnific-popup',
|
116 |
-
plugin_dir_url( __FILE__ ) . 'dist/styles/library/magnific-popup.css',
|
117 |
-
array( 'dashicons' ),
|
118 |
-
WPZOOM_INSTAGRAM_VERSION
|
119 |
-
);
|
120 |
-
|
121 |
-
wp_enqueue_style(
|
122 |
-
'swiper-css',
|
123 |
-
plugin_dir_url( __FILE__ ) . 'dist/styles/library/swiper.css',
|
124 |
-
array(),
|
125 |
-
'7.0.0-alpha.21'
|
126 |
-
);
|
127 |
-
}
|
128 |
-
|
129 |
-
/**
|
130 |
-
* Register widget specific scripts.
|
131 |
-
*/
|
132 |
-
public function register_scripts() {
|
133 |
-
wp_register_script(
|
134 |
-
'zoom-instagram-widget-lazy-load',
|
135 |
-
plugin_dir_url( __FILE__ ) . 'dist/scripts/library/lazy.js',
|
136 |
-
array( 'jquery' ),
|
137 |
-
filemtime( plugin_dir_path( __FILE__ ) . 'dist/scripts/library/lazy.js' ),
|
138 |
-
true
|
139 |
-
);
|
140 |
-
|
141 |
-
wp_register_script(
|
142 |
-
'magnific-popup',
|
143 |
-
plugin_dir_url( __FILE__ ) . 'dist/scripts/library/magnific-popup.js',
|
144 |
-
array( 'jquery', 'underscore', 'wp-util' ),
|
145 |
-
filemtime( plugin_dir_path( __FILE__ ) . 'dist/scripts/library/magnific-popup.js' ),
|
146 |
-
true
|
147 |
-
);
|
148 |
-
|
149 |
-
wp_register_script(
|
150 |
-
'swiper-js',
|
151 |
-
plugin_dir_url( __FILE__ ) . 'dist/scripts/library/swiper.js',
|
152 |
-
array(),
|
153 |
-
'7.0.0-alpha.21',
|
154 |
-
true
|
155 |
-
);
|
156 |
-
|
157 |
-
wp_register_script(
|
158 |
-
'zoom-instagram-widget',
|
159 |
-
plugin_dir_url( __FILE__ ) . 'dist/scripts/frontend/index.js',
|
160 |
-
array( 'jquery', 'underscore', 'wp-util', 'magnific-popup', 'swiper-js' ),
|
161 |
-
WPZOOM_INSTAGRAM_VERSION,
|
162 |
-
true
|
163 |
-
);
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Load widget specific scripts.
|
168 |
-
*/
|
169 |
-
public function enqueue_scripts() {
|
170 |
-
wp_enqueue_script( 'zoom-instagram-widget-lazy-load' );
|
171 |
-
wp_enqueue_script( 'magnific-popup' );
|
172 |
-
wp_enqueue_script( 'swiper-js' );
|
173 |
-
wp_enqueue_script( 'zoom-instagram-widget' );
|
174 |
-
}
|
175 |
-
|
176 |
/**
|
177 |
* Front-end display of widget.
|
178 |
*
|
@@ -185,8 +103,6 @@ class Wpzoom_Instagram_Widget extends WP_Widget {
|
|
185 |
|
186 |
$this->api = Wpzoom_Instagram_Widget_API::getInstance();
|
187 |
|
188 |
-
$this->enqueue_scripts();
|
189 |
-
|
190 |
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
191 |
|
192 |
echo $args['before_widget'];
|
@@ -656,7 +572,7 @@ class Wpzoom_Instagram_Widget extends WP_Widget {
|
|
656 |
<p style="color: #d54e21">
|
657 |
<?php
|
658 |
printf(
|
659 |
-
__( '
|
660 |
admin_url( 'edit.php?post_type=wpz-insta_user' ),
|
661 |
esc_url( 'https://www.wpzoom.com/documentation/instagram-widget/how-to-insert-the-widget-in-the-block-editor/' ),
|
662 |
esc_url( 'https://www.wpzoom.com/documentation/instagram-widget/instagram-widget-how-to-embed-the-instagram-shortcode-in-elementor/' )
|
46 |
'username' => '',
|
47 |
);
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
/**
|
91 |
return trim( $caption );
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
/**
|
95 |
* Front-end display of widget.
|
96 |
*
|
103 |
|
104 |
$this->api = Wpzoom_Instagram_Widget_API::getInstance();
|
105 |
|
|
|
|
|
106 |
$instance = wp_parse_args( (array) $instance, $this->defaults );
|
107 |
|
108 |
echo $args['before_widget'];
|
572 |
<p style="color: #d54e21">
|
573 |
<?php
|
574 |
printf(
|
575 |
+
__( 'We highly recommend adding your <a href="%1$s" target="_blank">Instagram Feeds</a> using the new <a href="%2$s" target="_blank">Gutenberg block</a> or <a href="%3$s" target="_blank">shortcode</a>.', 'instagram-widget-by-wpzoom' ),
|
576 |
admin_url( 'edit.php?post_type=wpz-insta_user' ),
|
577 |
esc_url( 'https://www.wpzoom.com/documentation/instagram-widget/how-to-insert-the-widget-in-the-block-editor/' ),
|
578 |
esc_url( 'https://www.wpzoom.com/documentation/instagram-widget/instagram-widget-how-to-embed-the-instagram-shortcode-in-elementor/' )
|
instagram-widget-by-wpzoom.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WPZOOM Instagram Widget & Block
|
4 |
* Plugin URI: https://www.wpzoom.com/plugins/instagram-widget/
|
5 |
* Description: Instagram Widget is a customizable and responsive plugin, made to help you gain even more followers by showcasing your Instagram feed on your WordPress website.
|
6 |
-
* Version: 2.0.
|
7 |
* Author: WPZOOM
|
8 |
* Author URI: https://www.wpzoom.com/
|
9 |
* Text Domain: instagram-widget-by-wpzoom
|
@@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
19 |
}
|
20 |
|
21 |
if ( ! defined( 'WPZOOM_INSTAGRAM_VERSION' ) ) {
|
22 |
-
define( 'WPZOOM_INSTAGRAM_VERSION', '2.0.
|
23 |
}
|
24 |
|
25 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-image-uploader.php';
|
@@ -28,6 +28,8 @@ require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-api.ph
|
|
28 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-display.php';
|
29 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget.php';
|
30 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-block.php';
|
|
|
|
|
31 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-after-setup.php';
|
32 |
|
33 |
add_action( 'widgets_init', 'zoom_instagram_widget_register' );
|
3 |
* Plugin Name: WPZOOM Instagram Widget & Block
|
4 |
* Plugin URI: https://www.wpzoom.com/plugins/instagram-widget/
|
5 |
* Description: Instagram Widget is a customizable and responsive plugin, made to help you gain even more followers by showcasing your Instagram feed on your WordPress website.
|
6 |
+
* Version: 2.0.3
|
7 |
* Author: WPZOOM
|
8 |
* Author URI: https://www.wpzoom.com/
|
9 |
* Text Domain: instagram-widget-by-wpzoom
|
19 |
}
|
20 |
|
21 |
if ( ! defined( 'WPZOOM_INSTAGRAM_VERSION' ) ) {
|
22 |
+
define( 'WPZOOM_INSTAGRAM_VERSION', '2.0.3' );
|
23 |
}
|
24 |
|
25 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-image-uploader.php';
|
28 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-display.php';
|
29 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget.php';
|
30 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-block.php';
|
31 |
+
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-assets.php';
|
32 |
+
|
33 |
require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-after-setup.php';
|
34 |
|
35 |
add_action( 'widgets_init', 'zoom_instagram_widget_register' );
|
readme.txt
CHANGED
@@ -96,6 +96,10 @@ Yes, you can find the documentation for this plugin with more instructions on ou
|
|
96 |
|
97 |
== Changelog ==
|
98 |
|
|
|
|
|
|
|
|
|
99 |
= 2.0.2 =
|
100 |
* Fixing some issues with the legacy widget
|
101 |
|
96 |
|
97 |
== Changelog ==
|
98 |
|
99 |
+
= 2.0.3 =
|
100 |
+
* JS and CSS assets from the plugin will be loaded only on pages showing an Instagram feed
|
101 |
+
* Minor bug fixes and improvements
|
102 |
+
|
103 |
= 2.0.2 =
|
104 |
* Fixing some issues with the legacy widget
|
105 |
|