Instagram Widget by WPZOOM - Version 2.0.6

Version Description

  • Added a new Settings page with a new option to load CSS and JS files everywhere
Download this release

Release Info

Developer WPZOOM
Plugin Icon 128x128 Instagram Widget by WPZOOM
Version 2.0.6
Comparing to
See all releases

Code changes from version 2.0.5 to 2.0.6

class-wpzoom-instagram-assets.php CHANGED
@@ -85,17 +85,19 @@ if ( ! class_exists( 'WPZOOM_Instagram_Widget_Assets ' ) ) {
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__ ),
@@ -156,14 +158,16 @@ if ( ! class_exists( 'WPZOOM_Instagram_Widget_Assets ' ) ) {
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',
@@ -232,18 +236,21 @@ if ( ! class_exists( 'WPZOOM_Instagram_Widget_Assets ' ) ) {
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
  }
85
  public function frontend_register_scripts() {
86
 
87
  global $post;
88
+ $general_options = get_option( 'wpzoom-instagram-general-settings' );
89
 
90
  $should_enqueue = has_block( 'wpzoom/instagram-block' );
91
  $has_reusable_block = self::has_reusable_block( 'wpzoom/instagram-block' );
92
  $is_active_widget = is_active_widget( false, false, 'wpzoom_instagram_widget', true );
93
  $has_shortcode = ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'instagram' ) );
94
  $has_widget_block = self::is_active_block_widget( 'wpzoom/instagram-block' );
95
+ $load_css_js = isset( $general_options['load-css-js'] ) ? true : false;
96
 
97
  $script_asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/scripts/backend/block.asset.php' );
98
  $style_asset_file = include( plugin_dir_path( __FILE__ ) . 'dist/styles/frontend/block.asset.php' );
99
 
100
+ if( is_admin() || $load_css_js || $should_enqueue || $has_reusable_block || $is_active_widget || $has_shortcode || $has_widget_block || isset( $_GET['wpz-insta-widget-preview'] ) ) {
101
  wp_register_script(
102
  'magnific-popup',
103
  plugins_url( 'dist/scripts/library/magnific-popup.js', __FILE__ ),
158
  public function widget_styles() {
159
 
160
  global $post;
161
+ $general_options = get_option( 'wpzoom-instagram-general-settings' );
162
 
163
  $should_enqueue = has_block( 'wpzoom/instagram-block' );
164
  $has_reusable_block = self::has_reusable_block( 'wpzoom/instagram-block' );
165
  $is_active_widget = is_active_widget( false, false, 'wpzoom_instagram_widget', true );
166
  $has_shortcode = ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'instagram' ) );
167
  $has_widget_block = self::is_active_block_widget( 'wpzoom/instagram-block' );
168
+ $load_css_js = isset( $general_options['load-css-js'] ) ? true : false;
169
 
170
+ if( is_admin() || $load_css_js || $should_enqueue || $has_reusable_block || $is_active_widget || $has_shortcode || $has_widget_block || isset( $_GET['wpz-insta-widget-preview'] ) ) {
171
 
172
  wp_enqueue_style(
173
  'swiper-css',
236
  public function enqueue_widget_scripts() {
237
 
238
  global $post;
239
+ $general_options = get_option( 'wpzoom-instagram-general-settings' );
240
 
241
  $should_enqueue = has_block( 'wpzoom/instagram-block' );
242
  $has_reusable_block = self::has_reusable_block( 'wpzoom/instagram-block' );
243
  $is_active_widget = is_active_widget( false, false, 'wpzoom_instagram_widget', true );
244
  $has_shortcode = ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'instagram' ) );
245
+ $has_widget_block = self::is_active_block_widget( 'wpzoom/instagram-block' );
246
+ $load_css_js = isset( $general_options['load-css-js'] ) ? true : false;
247
 
248
+ if( is_admin() || $load_css_js || $should_enqueue || $has_reusable_block || $is_active_widget || $has_shortcode || $has_widget_block || isset( $_GET['wpz-insta-widget-preview'] ) ) {
249
  wp_enqueue_script( 'zoom-instagram-widget-lazy-load' );
250
  wp_enqueue_script( 'magnific-popup' );
251
  wp_enqueue_script( 'swiper-js' );
252
  wp_enqueue_script( 'zoom-instagram-widget' );
253
+ wp_enqueue_script( 'wpz-insta_block-frontend-script' );
254
  }
255
 
256
  }
class-wpzoom-instagram-general-settings.php ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Exit if accessed directly.
4
+ */
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ class WPZOOM_Instagram_General_Settings {
10
+ /**
11
+ * @var WPZOOM_Instagram_General_Settings The reference to *Singleton* instance of this class
12
+ *
13
+ * @since 1.8.4
14
+ */
15
+ private static $instance;
16
+
17
+ /**
18
+ * Main WPZOOM_Instagram_General_Settings Instance.
19
+ *
20
+ * Insures that only one instance of WPZOOM_Instagram_General_Settings exists in memory at any one
21
+ * time. Also prevents needing to define globals all over the place.
22
+ *
23
+ * @since 1.0.0
24
+ * @static
25
+ * @return object|WPZOOM_Instagram_General_Settings The one true WPZOOM_Instagram_General_Settings
26
+ */
27
+ public static function get_instance() {
28
+ if ( null === self::$instance ) {
29
+ self::$instance = new WPZOOM_Instagram_General_Settings();
30
+ }
31
+ return self::$instance;
32
+ }
33
+
34
+ /**
35
+ * Plugin constructor.
36
+ *
37
+ * @since 1.0.0
38
+ */
39
+ function __construct() {
40
+ add_action( 'admin_init', array( $this, 'option_panel_init' ) );
41
+ }
42
+
43
+ /**
44
+ * Add settings panel to select the size for the feature image
45
+ *
46
+ * @since 1.0.0
47
+ */
48
+ public static function settings_page() {
49
+
50
+ if ( ! current_user_can( 'manage_options' ) ){
51
+ wp_die( __( 'You do not have enough permission to view this page', 'instagram-widget-by-wpzoom' ) );
52
+ }
53
+ ?>
54
+ <div class="wrap">
55
+ <?php
56
+
57
+ $widget_settings = new WPZOOM_Instagram_Widget_Settings;
58
+
59
+ $widget_settings->page_header();
60
+
61
+ printf( '<form method="post" action="options.php">' );
62
+ settings_fields( 'wpzoom_instagram_general_settings_group' );
63
+ do_settings_sections( 'wpzoom-instagram-general-settings' );
64
+ submit_button();
65
+ printf( '</form>' );
66
+
67
+ ?>
68
+ </div>
69
+ <?php
70
+ }
71
+
72
+ /**
73
+ * Init options fields and sections
74
+ *
75
+ * @since 1.0.0
76
+ */
77
+ public function option_panel_init() {
78
+
79
+ register_setting(
80
+ 'wpzoom_instagram_general_settings_group',
81
+ 'wpzoom-instagram-general-settings',
82
+ array( $this, 'sanitize_field' )
83
+ );
84
+ add_settings_section(
85
+ 'wpzoom_instagram_general_settings_section',
86
+ esc_html__( 'Global Settings', 'instagram-widget-by-wpzoom' ),
87
+ array( $this, 'section_info' ),
88
+ 'wpzoom-instagram-general-settings'
89
+ );
90
+ add_settings_field(
91
+ 'wpzoom_instagram_general_settings_load_css_js',
92
+ esc_html__( 'Load CSS and JS on all pages', 'instagram-widget-by-wpzoom'),
93
+ array( $this, 'settings_field_load_css_js' ),
94
+ 'wpzoom-instagram-general-settings',
95
+ 'wpzoom_instagram_general_settings_section'
96
+ );
97
+ }
98
+
99
+ /**
100
+ * Output the section info
101
+ *
102
+ * @since 1.0.0
103
+ */
104
+ public function section_info() {}
105
+
106
+ /**
107
+ * Saniteze values from the inputs of the options form
108
+ *
109
+ * @since 1.0.0
110
+ */
111
+ public function sanitize_field( $values ) {
112
+ return $values;
113
+ }
114
+
115
+ public function settings_field_load_css_js() {
116
+
117
+ $settings = get_option( 'wpzoom-instagram-general-settings' );
118
+
119
+ $load_css_js = ! empty( $settings['load-css-js'] ) ? wp_validate_boolean( $settings['load-css-js'] ) : false;
120
+ ?>
121
+ <input class="regular-text code"
122
+ id="wpzoom-instagram-widget-settings_load-css-js"
123
+ name="wpzoom-instagram-general-settings[load-css-js]"
124
+ <?php checked( true, $load_css_js ); ?>
125
+ value="1"
126
+ type="checkbox">
127
+
128
+ <p class="description" id="insta-global-assets-description"><?php _e( 'The plugin loads the CSS/JS assets only if an Instagram block, widget or shortcode is detected on a page. If this doesn\'t happen, enable this option to load the assets on all pages.', 'instagram-widget-by-wpzoom' ); ?></p>
129
+
130
+
131
+ <?php
132
+ }
133
+
134
+
135
+
136
+ }
137
+
138
+ WPZOOM_Instagram_General_Settings::get_instance();
class-wpzoom-instagram-widget-settings.php CHANGED
@@ -407,6 +407,7 @@ class WPZOOM_Instagram_Widget_Settings {
407
  'wpz-insta_user',
408
  'edit-wpz-insta_user',
409
  'instagram_page_wpzoom-instagram-users',
 
410
  'wpz-insta_feed_page_wpzoom-instagram-support',
411
  'settings_page_wpz-insta-connect',
412
  )
@@ -1784,6 +1785,10 @@ class WPZOOM_Instagram_Widget_Settings {
1784
  'name' => __( 'Accounts', 'instagram-widget-by-wpzoom' ),
1785
  'url' => admin_url( 'edit.php?post_type=wpz-insta_user' ),
1786
  ),
 
 
 
 
1787
  'wpz-insta_feed_page_wpzoom-instagram-support' => array(
1788
  'name' => __( 'Support', 'instagram-widget-by-wpzoom' ),
1789
  'url' => admin_url( 'edit.php?post_type=wpz-insta_feed&page=wpzoom-instagram-support' ),
@@ -1813,7 +1818,7 @@ class WPZOOM_Instagram_Widget_Settings {
1813
  $pro_toggle = apply_filters( 'wpz-insta_admin-pro-options-toggle', true );
1814
 
1815
 
1816
- if ( 'toplevel_page_wpzoom-instagram' == $current_screen->id || 'wpz-insta_feed' == $current_screen->post_type || 'wpz-insta_user' == $current_screen->post_type || 'instagram_page_wpzoom-instagram-users' == $current_screen->id || 'wpz-insta_feed_page_wpzoom-instagram-support' == $current_screen->id || 'settings_page_wpz-insta-connect' == $current_screen->id ) {
1817
  ?>
1818
  <footer class="wpz-insta_settings-footer">
1819
  <div class="wpz-insta_settings-footer-wrap">
@@ -2093,6 +2098,14 @@ class WPZOOM_Instagram_Widget_Settings {
2093
 
2094
  $pro_toggle = apply_filters( 'wpz-insta_admin-pro-options-toggle', true );
2095
 
 
 
 
 
 
 
 
 
2096
 
2097
  add_submenu_page(
2098
  'edit.php?post_type=wpz-insta_feed',
407
  'wpz-insta_user',
408
  'edit-wpz-insta_user',
409
  'instagram_page_wpzoom-instagram-users',
410
+ 'wpz-insta_feed_page_wpz-insta_settings',
411
  'wpz-insta_feed_page_wpzoom-instagram-support',
412
  'settings_page_wpz-insta-connect',
413
  )
1785
  'name' => __( 'Accounts', 'instagram-widget-by-wpzoom' ),
1786
  'url' => admin_url( 'edit.php?post_type=wpz-insta_user' ),
1787
  ),
1788
+ 'wpz-insta_feed_page_wpz-insta_settings' => array(
1789
+ 'name' => esc_html__( 'Settings', 'instagram-widget-by-wpzoom' ),
1790
+ 'url' => admin_url( 'edit.php?post_type=wpz-insta_feed&page=wpz-insta_settings' ),
1791
+ ),
1792
  'wpz-insta_feed_page_wpzoom-instagram-support' => array(
1793
  'name' => __( 'Support', 'instagram-widget-by-wpzoom' ),
1794
  'url' => admin_url( 'edit.php?post_type=wpz-insta_feed&page=wpzoom-instagram-support' ),
1818
  $pro_toggle = apply_filters( 'wpz-insta_admin-pro-options-toggle', true );
1819
 
1820
 
1821
+ if ( 'toplevel_page_wpzoom-instagram' == $current_screen->id || 'wpz-insta_feed' == $current_screen->post_type || 'wpz-insta_user' == $current_screen->post_type || 'instagram_page_wpzoom-instagram-users' == $current_screen->id || 'wpz-insta_feed_page_wpz-insta_settings' == $current_screen->id || 'wpz-insta_feed_page_wpzoom-instagram-support' == $current_screen->id || 'settings_page_wpz-insta-connect' == $current_screen->id ) {
1822
  ?>
1823
  <footer class="wpz-insta_settings-footer">
1824
  <div class="wpz-insta_settings-footer-wrap">
2098
 
2099
  $pro_toggle = apply_filters( 'wpz-insta_admin-pro-options-toggle', true );
2100
 
2101
+ add_submenu_page(
2102
+ 'edit.php?post_type=wpz-insta_feed',
2103
+ esc_html__( 'Settings', 'instagram-widget-by-wpzoom' ),
2104
+ esc_html__( 'Settings', 'instagram-widget-by-wpzoom' ),
2105
+ 'manage_options',
2106
+ 'wpz-insta_settings',
2107
+ array( 'WPZOOM_Instagram_General_Settings', 'settings_page' )
2108
+ );
2109
 
2110
  add_submenu_page(
2111
  'edit.php?post_type=wpz-insta_feed',
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.5
7
  * Author: WPZOOM
8
  * Author URI: https://www.wpzoom.com/
9
  * Text Domain: instagram-widget-by-wpzoom
@@ -19,11 +19,12 @@ if ( ! defined( 'ABSPATH' ) ) {
19
  }
20
 
21
  if ( ! defined( 'WPZOOM_INSTAGRAM_VERSION' ) ) {
22
- define( 'WPZOOM_INSTAGRAM_VERSION', '2.0.5' );
23
  }
24
 
25
  require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-image-uploader.php';
26
  require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-settings.php';
 
27
  require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-api.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';
@@ -132,6 +133,7 @@ function wpzoom_instagram_get_default_settings() {
132
  'user-info-avatar' => '',
133
  'user-info-fullname' => '',
134
  'user-info-biography' => '',
 
135
  );
136
  }
137
 
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.6
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.6' );
23
  }
24
 
25
  require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-image-uploader.php';
26
  require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-settings.php';
27
+ require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-general-settings.php';
28
  require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-api.php';
29
  require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget-display.php';
30
  require_once plugin_dir_path( __FILE__ ) . 'class-wpzoom-instagram-widget.php';
133
  'user-info-avatar' => '',
134
  'user-info-fullname' => '',
135
  'user-info-biography' => '',
136
+ 'load-css-js' => '',
137
  );
138
  }
139
 
readme.txt CHANGED
@@ -96,6 +96,9 @@ Yes, you can find the documentation for this plugin with more instructions on ou
96
 
97
  == Changelog ==
98
 
 
 
 
99
  = 2.0.5 =
100
  * Fixed a PHP error
101
 
96
 
97
  == Changelog ==
98
 
99
+ = 2.0.6 =
100
+ * Added a new Settings page with a new option to load CSS and JS files everywhere
101
+
102
  = 2.0.5 =
103
  * Fixed a PHP error
104