All-in-One Video Gallery - Version 1.6.5

Version Description

  • New: Plugin Dashboard.
  • New: Shortcode Builder.
  • New: A mechanism to auto-detect plugin misconfiguration issues with the fixes.
  • New: "Muted" - A setting to turn OFF the audio output of the video by default.
  • New: "include" - A new [aiovg_videos] shortcode attribute to show only the selective videos. Example: [aiovg_videos include="1,2,3"]
  • New: "include" - A new [aiovg_categories] shortcode attribute to show only the selective categories. Example: [aiovg_categories include="1,2,3"]
  • New: "WhatsApp" share button.
  • Tweak: Simplified settings page UI.
  • Tweak: Replaced transients with $_COOKIES to calculate unique video views. The reason $_COOKIES are used is to stop bloating up OPTIONS table with several hundreds of transients.
  • Fix: Same videos repeat again when the videos ordering is to "random" and the pagination is enabled.
  • Fix: [+] few minor bug fixes.
Download this release

Release Info

Developer plugins360
Plugin Icon 128x128 All-in-One Video Gallery
Version 1.6.5
Comparing to
See all releases

Code changes from version 1.6.4 to 1.6.5

Files changed (52) hide show
  1. README.txt +43 -112
  2. admin/admin.php +336 -41
  3. admin/assets/css/admin.css +259 -149
  4. admin/assets/js/admin.js +159 -127
  5. admin/categories.php +33 -19
  6. admin/partials/dashboard.php +55 -0
  7. admin/partials/faq.php +33 -0
  8. admin/partials/issues.php +100 -0
  9. admin/partials/settings.php +66 -9
  10. admin/partials/shortcode-builder.php +401 -125
  11. admin/partials/video-sources.php +110 -66
  12. admin/partials/video-tracks.php +12 -12
  13. admin/partials/welcome.php +0 -188
  14. admin/settings.php +153 -143
  15. admin/shortcode-builder.php +0 -88
  16. admin/videos.php +34 -3
  17. admin/welcome.php +0 -77
  18. all-in-one-video-gallery.php +7 -5
  19. blocks/blocks.php +13 -11
  20. blocks/dist/blocks.build.js +1 -1
  21. blocks/src/blocks/categories/edit.js +9 -9
  22. blocks/src/blocks/categories/index.js +4 -4
  23. blocks/src/blocks/search/edit.js +1 -1
  24. blocks/src/blocks/video/edit.js +7 -0
  25. blocks/src/blocks/video/index.js +4 -0
  26. freemius/assets/img/all-in-one-video-gallery.png +0 -0
  27. includes/functions.php +693 -535
  28. includes/init.php +12 -20
  29. includes/uninstall.php +0 -1
  30. languages/all-in-one-video-gallery.pot +1084 -912
  31. public/assets/css/public.css +12 -11
  32. public/categories.php +36 -7
  33. public/public.php +142 -8
  34. public/templates/categories-template-list.php +1 -20
  35. public/templates/category-thumbnail.php +1 -1
  36. public/templates/player-html5.php +45 -14
  37. public/templates/player-iframe.php +36 -3
  38. public/templates/player.php +1 -0
  39. public/templates/search-form-template-horizontal.php +1 -1
  40. public/templates/search-form-template-vertical.php +1 -1
  41. public/templates/single-video.php +1 -1
  42. public/templates/video-thumbnail-image-left.php +11 -3
  43. public/templates/video-thumbnail.php +11 -3
  44. public/video.php +9 -1
  45. public/videos.php +23 -13
  46. widgets/categories.php +29 -12
  47. widgets/forms/categories.php +18 -18
  48. widgets/forms/video.php +5 -0
  49. widgets/forms/videos.php +1 -1
  50. widgets/search.php +1 -3
  51. widgets/video.php +4 -4
  52. widgets/videos.php +16 -12
README.txt CHANGED
@@ -6,19 +6,19 @@ Tags: video player, video gallery, youtube gallery, vimeo gallery, livestream
6
  Requires at least: 4.7.0
7
  Tested up to: 5.2
8
  Requires PHP: 5.3.0
9
- Stable tag: 1.6.4
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
- Supports any browser & video formats such as MP4, WebM, OGV and embeddable players like YouTube, Vimeo, Dailymotion, Facebook, etc.
14
 
15
  == Description ==
16
 
17
  No coding required. A Responsive & Lightweight video gallery plugin.
18
 
19
- HTML5 Player, Categories, Visual Builder (Gutenberg), Search Form, Comments, Social Sharing and everything you will need to build a YouTube/Vimeo like video sharing website.
20
 
21
- [Demo](https://demo.plugins360.com/all-in-one-video-gallery/) | [Documentation](https://plugins360.com/all-in-one-video-gallery/documentation/) | [Support](https://plugins360.com/support/) | [Premium Version](https://plugins360.com/all-in-one-video-gallery/#premium)
22
 
23
  https://www.youtube.com/watch?v=w47PU9ppuF8
24
 
@@ -31,10 +31,10 @@ https://www.youtube.com/watch?v=w47PU9ppuF8
31
  * HTML5 Player with FLASH fallback.
32
  * Plays anywhere: supports MP4, WebM, OGV and embeddable players like YouTube, Vimeo, Dailymotion & Facebook.
33
  * Player controls: play pause, timer, progress bar, duration, volume, fullscreen
34
- * Playback options: autoplay, loop, preload
35
  * Subtitles.
36
  * Comments.
37
- * Social Sharing (Facebook, Twitter, Google Plus, Linkedin & Pinterest).
38
  * Form to search videos.
39
  * Widgets to list categories, list videos, display a single video player and to search videos.
40
  * Show GDPR consent.
@@ -75,11 +75,27 @@ For more detailed instructions visit plugin [documentation](https://plugins360.c
75
 
76
  == Frequently Asked Questions ==
77
 
78
- = I have a problem what now? =
79
- Please describe your issue and submit a ticket on our plugin support forum, you should receive a reply within 24 hours (except Sunday).
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
- = Getting a 404 error? =
82
- Most likely rewrite rules were not registered properly for some reason. Go to "WordPress Admin Panel => Settings => Permalinks" and click "Save Changes" button without actually changing anything, this should reset the router and fix URLs.
 
 
 
83
 
84
  == Screenshots ==
85
 
@@ -93,6 +109,20 @@ Most likely rewrite rules were not registered properly for some reason. Go to "W
93
 
94
  == Changelog ==
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  = 1.6.4 =
97
 
98
  * Tweak: Updated Freemius SDK (2.3.0).
@@ -113,7 +143,7 @@ Most likely rewrite rules were not registered properly for some reason. Go to "W
113
  * New: Option to delete or NOT delete the associated media files when a video post or category is deleted.
114
  * Tweak: Uses mediaelement.js library files from the WordPress core.
115
  * Tweak: Displays spinner immediately after the play button is clicked.
116
- * Fix: Issues with the gutenberg player block settings.
117
  * Fix: [+] few more minor bug fixes.
118
 
119
  = 1.6.0 =
@@ -198,105 +228,6 @@ Most likely rewrite rules were not registered properly for some reason. Go to "W
198
 
199
  == Upgrade Notice ==
200
 
201
- = 1.6.4 =
202
-
203
- * Tweak: Updated Freemius SDK (2.3.0).
204
- * Fix: Security fix.
205
-
206
- = 1.6.3 =
207
-
208
- * Fix: Unfortunately, there were some bugs in the 1.6.2 release and this is an immediate release which addresses those issues.
209
-
210
- = 1.6.2 =
211
-
212
- * New: Support for Yoast breadcrumbs.
213
- * Tweak: Optimized WP_Query for fast output.
214
- * Fix: [+] few minor bug fixes.
215
-
216
- = 1.6.1 =
217
-
218
- * New: Option to delete or NOT delete the associated media files when a video post or category is deleted.
219
- * Tweak: Uses mediaelement.js library files from the WordPress core.
220
- * Tweak: Displays spinner immediately after the play button is clicked.
221
- * Fix: Issues with the gutenberg player block settings.
222
- * Fix: [+] few more minor bug fixes.
223
-
224
- = 1.6.0 =
225
-
226
- * Fix: Security fix.
227
- * Fix: [+] few minor bug fixes.
228
-
229
- = 1.5.9 =
230
-
231
- * Fix: Fixes a SERIOUS BUG. Pages created infinitely in some WordPress Environments.
232
- * Fix: Replaced "plugins_loaded" hook with "init" hook to initialize the Gutenberg blocks.
233
-
234
- = 1.5.8 =
235
-
236
- * Tweak: "wp_loaded" hook used to insert missing plugin options was updated with a version number check.
237
-
238
- = 1.5.7 =
239
-
240
- * New: Freemius Integration.
241
- * New: PHP 7+ compatibility.
242
- * New: Introduces Template options for both categories and videos.
243
- * Tweak: Code completely revised and rewritten to make the plugin more extensible.
244
- * Tweak: Removed Twitter Bootstrap & Font Awesome libraries and replaced with custom CSS code to keep the plugin lightweight.
245
- * Tweak: Custom Logo & Branding, Custom Context Menu options removed from the FREE version. But, these options will continue to work for our old users.
246
- * Fix: [+] few minor bug fixes.
247
-
248
- = 1.5.6 =
249
-
250
- * New: Gutenberg blocks for the plugin.
251
- * New: Support for Yoast SEO Plugin.
252
- * Fix: [+] few minor bug fixes.
253
-
254
- = 1.5.5 =
255
-
256
- * Fix: Pagination issue in single video pages.
257
-
258
- = 1.5.4 =
259
-
260
- * Fix: Unfortunately, there were some bugs in the 1.5.3 release and this is an immediate release which addresses those issues.
261
-
262
- = 1.5.3 =
263
-
264
- * New: Custom Logo & Branding.
265
- * Tweak: Removed jQuery dependency for the player.
266
- * Fix: Shortcodes not working in the single video page.
267
- * Fix: [+] few minor bug fixes.
268
-
269
- = 1.5.2 =
270
-
271
- * New: Compatible with GDPR.
272
- * Tweak: Disabled the default context menu, and added a custom one.
273
-
274
- = 1.5.1 =
275
-
276
- * Tweak: README.txt update.
277
-
278
- = 1.5.0 =
279
-
280
- * New: Added support for Dailymotion videos.
281
-
282
- = 1.4.0 =
283
-
284
- * Tweak: Updated to the MediaElement version 4.2.8 that includes an important security fix.
285
-
286
- = 1.3.0 =
287
-
288
- * Tweak: "Select a Template" option removed from "WordPress Admin Panel => Video Gallery => Settings[Display] => Video Gallery Pages" settings.
289
- * Fix: "Autoplay" disabled in mobile devices.
290
- * Fix: YouTube playback issues in IOS.
291
-
292
- = 1.2.0 =
293
-
294
- * Fix: Unfortunately, there were some bugs in the 1.1.0 release and this is an immediate release which addresses those issues.
295
-
296
- = 1.1.0 =
297
-
298
- * New: Added support for Facebook videos.
299
-
300
- = 1.0.0 =
301
 
302
- * Initial release.
6
  Requires at least: 4.7.0
7
  Tested up to: 5.2
8
  Requires PHP: 5.3.0
9
+ Stable tag: 1.6.5
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
+ Add responsive video galleries anywhere on your website no coding required. Includes HTML5 Player, Thumbnail Grid, Slider, Popup & more
14
 
15
  == Description ==
16
 
17
  No coding required. A Responsive & Lightweight video gallery plugin.
18
 
19
+ HTML5 Player, Categories, Visual Builder (Gutenberg), Search Form, Comments, Social Sharing and everything you will need to build a YouTube/Vimeo like a video sharing website.
20
 
21
+ [Demo](https://demo.plugins360.com/all-in-one-video-gallery/) | [Documentation](https://plugins360.com/all-in-one-video-gallery/documentation/) | [Support](https://plugins360.com/support/) | [Premium Version](https://plugins360.com/all-in-one-video-gallery/pricing/)
22
 
23
  https://www.youtube.com/watch?v=w47PU9ppuF8
24
 
31
  * HTML5 Player with FLASH fallback.
32
  * Plays anywhere: supports MP4, WebM, OGV and embeddable players like YouTube, Vimeo, Dailymotion & Facebook.
33
  * Player controls: play pause, timer, progress bar, duration, volume, fullscreen
34
+ * Playback options: autoplay, loop, muted, preload
35
  * Subtitles.
36
  * Comments.
37
+ * Social Sharing (Facebook, Twitter, Linkedin, Pinterest & WhatsApp).
38
  * Form to search videos.
39
  * Widgets to list categories, list videos, display a single video player and to search videos.
40
  * Show GDPR consent.
75
 
76
  == Frequently Asked Questions ==
77
 
78
+ = 1. I have installed the plugin. How to build my first Gallery? =
79
+ Thanks for installing our plugin. The plugin dashboard should have all the necessary instructions required to build a gallery. Simply follow that.
80
+
81
+ For more detailed instructions visit plugin [documentation](https://plugins360.com/all-in-one-video-gallery/documentation/)
82
+
83
+ Still Having Issues? We are just an email away. Please write to us describing your issue using the "Contact" form available under our plugin's menu. You should receive a reply within 24 hours (except Sunday).
84
+
85
+ = 2. Can I upload large video files using this plugin? =
86
+ Sure, the plugin doesn't apply any restriction on the uploaded file size. If you're not able to upload large files, then it must be your server configuration which is not suitable for large file uploads. Simply write to your HOST and ask them to increase the upload file size limit.
87
+
88
+ = 3. Can I show my videos in a Popup/Slider? =
89
+ Yes, you can. Kindly refer the instructions below,
90
+
91
+ 1. [Popup](https://plugins360.com/all-in-one-video-gallery/popup/)
92
+ 2. [Slider](https://plugins360.com/all-in-one-video-gallery/slider/)
93
 
94
+ = 4. Does the plugin support third-party page builders like "Elementor", "WPBakery", "Divi", etc.? =
95
+ Yes. Simply, generate your shortcode using the plugin's "Shortcode Builder" and add it in your favourite page builder.
96
+
97
+ = 5. The plugin is not working for me. What should I do now? =
98
+ Please describe your issue and submit a ticket on our plugin support forum, you should receive a reply within 24 hours (except Sunday).
99
 
100
  == Screenshots ==
101
 
109
 
110
  == Changelog ==
111
 
112
+ = 1.6.5 =
113
+
114
+ * New: Plugin Dashboard.
115
+ * New: Shortcode Builder.
116
+ * New: A mechanism to auto-detect plugin misconfiguration issues with the fixes.
117
+ * New: "Muted" - A setting to turn OFF the audio output of the video by default.
118
+ * New: "include" - A new [aiovg_videos] shortcode attribute to show only the selective videos. Example: [aiovg_videos include="1,2,3"]
119
+ * New: "include" - A new [aiovg_categories] shortcode attribute to show only the selective categories. Example: [aiovg_categories include="1,2,3"]
120
+ * New: "WhatsApp" share button.
121
+ * Tweak: Simplified settings page UI.
122
+ * Tweak: Replaced transients with $_COOKIES to calculate unique video views. The reason $_COOKIES are used is to stop bloating up OPTIONS table with several hundreds of transients.
123
+ * Fix: Same videos repeat again when the videos ordering is to "random" and the pagination is enabled.
124
+ * Fix: [+] few minor bug fixes.
125
+
126
  = 1.6.4 =
127
 
128
  * Tweak: Updated Freemius SDK (2.3.0).
143
  * New: Option to delete or NOT delete the associated media files when a video post or category is deleted.
144
  * Tweak: Uses mediaelement.js library files from the WordPress core.
145
  * Tweak: Displays spinner immediately after the play button is clicked.
146
+ * Fix: Issues with the Gutenberg player block settings.
147
  * Fix: [+] few more minor bug fixes.
148
 
149
  = 1.6.0 =
228
 
229
  == Upgrade Notice ==
230
 
231
+ = 1.6.5 =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
 
233
+ Introduces several bug fixes, new features & enhancements. [See changelog](https://wordpress.org/plugins/all-in-one-video-gallery/#developers)
admin/admin.php CHANGED
@@ -46,6 +46,10 @@ class AIOVG_Admin {
46
 
47
  $new_player_settings = array();
48
 
 
 
 
 
49
  if ( ! array_key_exists( 'use_native_controls', $player_settings ) ) {
50
  $new_player_settings['use_native_controls'] = $defaults['aiovg_player_settings']['use_native_controls'];
51
  }
@@ -102,7 +106,7 @@ class AIOVG_Admin {
102
  */
103
  public function enqueue_styles() {
104
  wp_enqueue_style( 'wp-color-picker' );
105
-
106
  wp_enqueue_style(
107
  AIOVG_PLUGIN_SLUG . '-magnific-popup',
108
  AIOVG_PLUGIN_URL . 'public/assets/css/magnific-popup.css',
@@ -110,7 +114,7 @@ class AIOVG_Admin {
110
  '1.1.0',
111
  'all'
112
  );
113
-
114
  wp_enqueue_style(
115
  AIOVG_PLUGIN_SLUG . '-admin',
116
  AIOVG_PLUGIN_URL . 'admin/assets/css/admin.css',
@@ -128,7 +132,7 @@ class AIOVG_Admin {
128
  public function enqueue_scripts() {
129
  wp_enqueue_media();
130
  wp_enqueue_script( 'wp-color-picker' );
131
-
132
  wp_enqueue_script(
133
  AIOVG_PLUGIN_SLUG . '-magnific-popup',
134
  AIOVG_PLUGIN_URL . 'public/assets/js/magnific-popup.min.js',
@@ -136,7 +140,7 @@ class AIOVG_Admin {
136
  '1.1.0',
137
  false
138
  );
139
-
140
  wp_enqueue_script(
141
  AIOVG_PLUGIN_SLUG . '-admin',
142
  AIOVG_PLUGIN_URL . 'admin/assets/js/admin.js',
@@ -149,60 +153,351 @@ class AIOVG_Admin {
149
  AIOVG_PLUGIN_SLUG . '-admin',
150
  'aiovg_admin',
151
  array(
152
- 'ajax_nonce' => wp_create_nonce( 'aiovg_admin_ajax_nonce' )
 
 
 
153
  )
154
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  }
156
-
157
  /**
158
- * Add a settings link on the plugin listing page.
159
  *
160
- * @since 1.0.0
161
- * @param array $links An array of plugin action links.
162
- * @return string $links Array of filtered plugin action links.
163
  */
164
- public function plugin_action_links( $links ) {
165
- $settings_link = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=aiovg_videos&page=aiovg_settings' ), __( 'Settings', 'all-in-one-video-gallery' ) );
166
- array_unshift( $links, $settings_link );
 
 
 
 
 
 
 
167
 
168
- return $links;
 
 
 
 
 
 
 
169
  }
170
-
171
  /**
172
- * Display admin notice.
173
  *
174
- * @since 1.0.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  */
176
- public function admin_notice() {
177
- if ( false == get_option( 'aiovg_admin_notice_dismissed' ) ) : ?>
178
- <div id="aiovg-admin-notice" class="notice notice-info is-dismissible" data-security="<?php echo wp_create_nonce( 'aiovg_admin_notice_nonce' ); ?>">
179
- <p>
180
- <span class="dashicons-before dashicons-playlist-video"></span> <strong><?php _e( 'All-in-One Video Gallery', 'all-in-one-video-gallery' ); ?></strong>
181
- <span class="aiovg-admin-notice-separator"> - </span>
182
- <a href="https://plugins360.com/all-in-one-video-gallery/documentation/" target="_blank"><?php _e( 'Getting Started', 'all-in-one-video-gallery' ); ?></a>
183
- <span class="aiovg-admin-notice-separator"> | </span>
184
- <a href="<?php echo admin_url( 'admin.php?page=all-in-one-video-gallery-contact' ); ?>"><?php _e( 'Contact Us', 'all-in-one-video-gallery' ); ?></a>
185
- <?php if ( aiovg_fs()->is_not_paying() ) : ?>
186
- <span class="aiovg-admin-notice-separator"> | </span>
187
- <a href="<?php echo esc_url( aiovg_fs()->get_upgrade_url() ); ?>" class="aiovg-upgrade-link"><?php _e( 'Upgrade Pro', 'all-in-one-video-gallery' ); ?></a>
188
- <?php endif; ?>
189
- </p>
190
- </div>
191
- <?php endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  }
193
 
194
  /**
195
- * Dismiss admin notice.
196
  *
197
- * @since 1.0.0
 
 
198
  */
199
- public function ajax_callback_dismiss_admin_notice() {
200
- check_ajax_referer( 'aiovg_admin_notice_nonce', 'security' );
 
 
 
 
 
 
201
 
202
- add_option( 'aiovg_admin_notice_dismissed', 1 );
203
- wp_die();
204
  }
205
-
206
  /**
207
  * Sets the extension and mime type for .vtt files.
208
  *
@@ -222,4 +517,4 @@ class AIOVG_Admin {
222
  return $types;
223
  }
224
 
225
- }
46
 
47
  $new_player_settings = array();
48
 
49
+ if ( ! array_key_exists( 'muted', $player_settings ) ) {
50
+ $new_player_settings['muted'] = $defaults['aiovg_player_settings']['muted'];
51
+ }
52
+
53
  if ( ! array_key_exists( 'use_native_controls', $player_settings ) ) {
54
  $new_player_settings['use_native_controls'] = $defaults['aiovg_player_settings']['use_native_controls'];
55
  }
106
  */
107
  public function enqueue_styles() {
108
  wp_enqueue_style( 'wp-color-picker' );
109
+
110
  wp_enqueue_style(
111
  AIOVG_PLUGIN_SLUG . '-magnific-popup',
112
  AIOVG_PLUGIN_URL . 'public/assets/css/magnific-popup.css',
114
  '1.1.0',
115
  'all'
116
  );
117
+
118
  wp_enqueue_style(
119
  AIOVG_PLUGIN_SLUG . '-admin',
120
  AIOVG_PLUGIN_URL . 'admin/assets/css/admin.css',
132
  public function enqueue_scripts() {
133
  wp_enqueue_media();
134
  wp_enqueue_script( 'wp-color-picker' );
135
+
136
  wp_enqueue_script(
137
  AIOVG_PLUGIN_SLUG . '-magnific-popup',
138
  AIOVG_PLUGIN_URL . 'public/assets/js/magnific-popup.min.js',
140
  '1.1.0',
141
  false
142
  );
143
+
144
  wp_enqueue_script(
145
  AIOVG_PLUGIN_SLUG . '-admin',
146
  AIOVG_PLUGIN_URL . 'admin/assets/js/admin.js',
153
  AIOVG_PLUGIN_SLUG . '-admin',
154
  'aiovg_admin',
155
  array(
156
+ 'ajax_nonce' => wp_create_nonce( 'aiovg_admin_ajax_nonce' ),
157
+ 'i18n' => array(
158
+ 'no_issues_slected' => __( 'Please select at least one issue.', 'all-in-one-video-gallery' )
159
+ )
160
  )
161
  );
162
+ }
163
+
164
+ /**
165
+ * Manage form submissions.
166
+ *
167
+ * @since 1.6.5
168
+ */
169
+ public function admin_init() {
170
+ if ( 'POST' == $_SERVER['REQUEST_METHOD'] && ! empty( $_POST['issues'] ) && isset( $_POST['aiovg_issues_nonce'] ) ) {
171
+ // Verify that the nonce is valid
172
+ if ( wp_verify_nonce( $_POST['aiovg_issues_nonce'], 'aiovg_fix_ignore_issues' ) ) {
173
+ $redirect_url = admin_url( 'admin.php?page=all-in-one-video-gallery&tab=issues' );
174
+
175
+ // Fix Issues
176
+ if ( __( 'Apply Fix', 'all-in-one-video-gallery' ) == $_POST['action'] ) {
177
+ $this->fix_issues();
178
+
179
+ $redirect_url = add_query_arg(
180
+ array(
181
+ 'section' => 'found',
182
+ 'success' => 1
183
+ ),
184
+ $redirect_url
185
+ );
186
+ }
187
+
188
+ // Ignore Issues
189
+ if ( __( 'Ignore', 'all-in-one-video-gallery' ) == $_POST['action'] ) {
190
+ $this->ignore_issues();
191
+
192
+ $redirect_url = add_query_arg(
193
+ array(
194
+ 'section' => 'ignored',
195
+ 'success' => 1
196
+ ),
197
+ $redirect_url
198
+ );
199
+ }
200
+
201
+ // Redirect
202
+ wp_redirect( $redirect_url );
203
+ exit;
204
+ }
205
+ }
206
  }
207
+
208
  /**
209
+ * Add plugin's main menu and "Dashboard" menu.
210
  *
211
+ * @since 1.6.5
 
 
212
  */
213
+ public function admin_menu() {
214
+ add_menu_page(
215
+ __( 'All-in-One Video Gallery', 'all-in-one-video-gallery' ),
216
+ __( 'Video Gallery', 'all-in-one-video-gallery' ),
217
+ 'edit_others_aiovg_videos',
218
+ 'all-in-one-video-gallery',
219
+ array( $this, 'display_dashboard_content' ),
220
+ 'dashicons-playlist-video',
221
+ 5
222
+ );
223
 
224
+ add_submenu_page(
225
+ 'all-in-one-video-gallery',
226
+ __( 'All-in-One Video Gallery - Dashboard', 'all-in-one-video-gallery' ),
227
+ __( 'Dashboard', 'all-in-one-video-gallery' ),
228
+ 'edit_others_aiovg_videos',
229
+ 'all-in-one-video-gallery',
230
+ array( $this, 'display_dashboard_content' )
231
+ );
232
  }
233
+
234
  /**
235
+ * Display dashboard page content.
236
  *
237
+ * @since 1.6.5
238
+ */
239
+ public function display_dashboard_content() {
240
+ $tabs = array(
241
+ 'shortcode-builder' => __( 'Shortcode Builder', 'all-in-one-video-gallery' ),
242
+ 'faq' => __( 'FAQ', 'all-in-one-video-gallery' )
243
+ );
244
+
245
+ $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'shortcode-builder';
246
+
247
+ // Issues
248
+ $issues = $this->check_issues();
249
+
250
+ if ( count( $issues['found'] ) || 'issues' == $active_tab ) {
251
+ $tabs['issues'] = __( 'Issues Found', 'all-in-one-video-gallery' );
252
+ }
253
+
254
+ require_once AIOVG_PLUGIN_DIR . 'admin/partials/dashboard.php';
255
+ }
256
+
257
+ /**
258
+ * Check for plugin issues.
259
+ *
260
+ * @since 1.6.5
261
+ * @return array $issues Array of issues found.
262
+ */
263
+ public function check_issues() {
264
+ $issues = array(
265
+ 'found' => array(),
266
+ 'ignored' => array()
267
+ );
268
+
269
+ $_issues = get_option( 'aiovg_issues', $issues );
270
+ $ignored = $_issues['ignored'];
271
+
272
+ // Check: pages_misconfigured
273
+ $page_settings = get_option( 'aiovg_page_settings' );
274
+ $pages = aiovg_get_custom_pages_list();
275
+
276
+ foreach ( $pages as $key => $page ) {
277
+ $issue_found = 0;
278
+ $post_id = $page_settings[ $key ];
279
+
280
+ if ( $post_id > 0 ) {
281
+ $post = get_post( $post_id );
282
+
283
+ if ( empty( $post ) || 'publish' != $post->post_status ) {
284
+ $issue_found = 1;
285
+ } elseif ( ! empty( $pages[ $key ]['content'] ) && false === strpos( $post->post_content, $pages[ $key ]['content'] ) ) {
286
+ $issue_found = 1;
287
+ }
288
+ } else {
289
+ $issue_found = 1;
290
+ }
291
+
292
+ if ( $issue_found ) {
293
+ if ( in_array( 'pages_misconfigured', $ignored ) ) {
294
+ $issues['ignored'][] = 'pages_misconfigured';
295
+ } else {
296
+ $issues['found'][] = 'pages_misconfigured';
297
+ }
298
+
299
+ break;
300
+ }
301
+ }
302
+
303
+ $issues = apply_filters( 'aiovg_check_issues', $issues );
304
+
305
+ // Update
306
+ update_option( 'aiovg_issues', $issues );
307
+
308
+ // Return
309
+ return $issues;
310
+ }
311
+
312
+ /**
313
+ * Apply fixes.
314
+ *
315
+ * @since 1.6.5
316
+ */
317
+ public function fix_issues() {
318
+ $fixed = array();
319
+
320
+ // Apply the fixes
321
+ $_issues = aiovg_sanitize_array( $_POST['issues'] );
322
+
323
+ foreach ( $_issues as $issue ) {
324
+ switch ( $issue ) {
325
+ case 'pages_misconfigured':
326
+ global $wpdb;
327
+
328
+ $page_settings = get_option( 'aiovg_page_settings' );
329
+
330
+ $pages = aiovg_get_custom_pages_list();
331
+ $issue_found = 0;
332
+
333
+ foreach ( $pages as $key => $page ) {
334
+ $post_id = $page_settings[ $key ];
335
+
336
+ if ( $post_id > 0 ) {
337
+ $post = get_post( $post_id );
338
+
339
+ if ( empty( $post ) || 'publish' != $post->post_status ) {
340
+ $issue_found = 1;
341
+ } elseif ( ! empty( $pages[ $key ]['content'] ) && false === strpos( $post->post_content, $pages[ $key ]['content'] ) ) {
342
+ $issue_found = 1;
343
+ }
344
+ } else {
345
+ $issue_found = 1;
346
+ }
347
+
348
+ if ( $issue_found ) {
349
+ $insert_id = 0;
350
+
351
+ if ( ! empty( $pages[ $key ]['content'] ) ) {
352
+ $query = $wpdb->prepare(
353
+ "SELECT ID FROM {$wpdb->posts} WHERE `post_content` LIKE %s",
354
+ sanitize_text_field( $pages[ $key ]['content'] )
355
+ );
356
+
357
+ $ids = $wpdb->get_col( $query );
358
+ } else {
359
+ $ids = array();
360
+ }
361
+
362
+ if ( ! empty( $ids ) ) {
363
+ $insert_id = $ids[0];
364
+
365
+ // If the page is not published
366
+ if ( 'publish' != get_post_status( $insert_id ) ) {
367
+ wp_update_post(
368
+ array(
369
+ 'ID' => $insert_id,
370
+ 'post_status' => 'publish'
371
+ )
372
+ );
373
+ }
374
+ } else {
375
+ $insert_id = wp_insert_post(
376
+ array(
377
+ 'post_title' => $pages[ $key ]['title'],
378
+ 'post_content' => $pages[ $key ]['content'],
379
+ 'post_status' => 'publish',
380
+ 'post_author' => 1,
381
+ 'post_type' => 'page',
382
+ 'comment_status' => 'closed'
383
+ )
384
+ );
385
+ }
386
+
387
+ $page_settings[ $key ] = $insert_id;
388
+ }
389
+ }
390
+
391
+ update_option( 'aiovg_page_settings', $page_settings );
392
+
393
+ $fixed[] = $issue;
394
+ break;
395
+ }
396
+ }
397
+
398
+ $fixed = apply_filters( 'aiovg_fix_issues', $fixed );
399
+
400
+ // Update
401
+ $issues = get_option( 'aiovg_issues', array(
402
+ 'found' => array(),
403
+ 'ignored' => array()
404
+ ));
405
+
406
+ foreach ( $issues['found'] as $index => $issue ) {
407
+ if ( in_array( $issue, $fixed ) ) {
408
+ unset( $issues['found'][ $index ] );
409
+ }
410
+ }
411
+
412
+ foreach ( $issues['ignored'] as $index => $issue ) {
413
+ if ( in_array( $issue, $fixed ) ) {
414
+ unset( $issues['ignored'][ $index ] );
415
+ }
416
+ }
417
+
418
+ update_option( 'aiovg_issues', $issues );
419
+ }
420
+
421
+ /**
422
+ * Ignore issues.
423
+ *
424
+ * @since 1.6.5
425
  */
426
+ public function ignore_issues() {
427
+ $ignored = array();
428
+
429
+ // Ignore the issues
430
+ $_issues = aiovg_sanitize_array( $_POST['issues'] );
431
+
432
+ foreach ( $_issues as $issue ) {
433
+ switch ( $issue ) {
434
+ case 'pages_misconfigured':
435
+ $ignored[] = $issue;
436
+ break;
437
+ }
438
+ }
439
+
440
+ $ignored = apply_filters( 'aiovg_ignore_issues', $ignored );
441
+
442
+ // Update
443
+ $issues = get_option( 'aiovg_issues', array(
444
+ 'found' => array(),
445
+ 'ignored' => array()
446
+ ));
447
+
448
+ foreach ( $issues['found'] as $index => $issue ) {
449
+ if ( in_array( $issue, $ignored ) ) {
450
+ unset( $issues['found'][ $index ] );
451
+ }
452
+ }
453
+
454
+ $issues['ignored'] = array_merge( $issues['ignored'], $ignored );
455
+
456
+ update_option( 'aiovg_issues', $issues );
457
+ }
458
+
459
+ /**
460
+ * Get details of the given issue.
461
+ *
462
+ * @since 1.6.5
463
+ * @param string $issue Issue code.
464
+ * @return array Issue details.
465
+ */
466
+ public function get_issue_details( $issue ) {
467
+ $issues_list = array(
468
+ 'pages_misconfigured' => array(
469
+ 'title' => __( 'Pages Misconfigured', 'all-in-one-video-gallery' ),
470
+ 'description' => sprintf(
471
+ __( 'During activation, our plugin adds few <a href="%s" target="_blank">pages</a> dynamically on your website that are required for the internal logic of the plugin. We found some of those pages are missing, misconfigured or having a wrong shortcode.', 'all-in-one-video-gallery' ),
472
+ esc_url( admin_url( 'admin.php?page=aiovg_settings&tab=advanced&section=aiovg_page_settings' ) )
473
+ )
474
+ )
475
+ );
476
+
477
+ $issues_list = apply_filters( 'aiovg_get_issues_list', $issues_list );
478
+
479
+ return isset( $issues_list[ $issue ] ) ? $issues_list[ $issue ] : '';
480
  }
481
 
482
  /**
483
+ * Add a settings link on the plugin listing page.
484
  *
485
+ * @since 1.0.0
486
+ * @param array $links An array of plugin action links.
487
+ * @return string $links Array of filtered plugin action links.
488
  */
489
+ public function plugin_action_links( $links ) {
490
+ $settings_link = sprintf(
491
+ '<a href="%s">%s</a>',
492
+ esc_url( admin_url( 'admin.php?page=aiovg_settings' ) ),
493
+ __( 'Settings', 'all-in-one-video-gallery' )
494
+ );
495
+
496
+ array_unshift( $links, $settings_link );
497
 
498
+ return $links;
 
499
  }
500
+
501
  /**
502
  * Sets the extension and mime type for .vtt files.
503
  *
517
  return $types;
518
  }
519
 
520
+ }
admin/assets/css/admin.css CHANGED
@@ -7,17 +7,50 @@
7
  text-align: center;
8
  }
9
 
10
- .aiovg-no-border {
11
- border: 0 none;
12
  }
13
 
14
  .aiovg-toggle-fields {
15
  display: none;
16
  }
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  .aiovg-checklist {
19
  max-height: 100px;
20
- padding: 7px 10px;
21
  border: 1px solid #ddd;
22
  box-sizing: border-box;
23
  overflow-y: scroll;
@@ -33,7 +66,30 @@
33
 
34
  .aiovg-checklist label {
35
  display: block;
36
- line-height: 22px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
38
 
39
  .aiovg-pipe-separator {
@@ -54,8 +110,7 @@
54
  }
55
 
56
  .aiovg-notice {
57
- padding: 5px;
58
- border-radius: 2px;
59
  }
60
 
61
  .aiovg-notice-error {
@@ -70,6 +125,15 @@
70
  color: #3c763d;
71
  }
72
 
 
 
 
 
 
 
 
 
 
73
  @media (max-width: 767px) {
74
  .aiovg-hidden-xs {
75
  display: none !important;
@@ -104,21 +168,199 @@
104
 
105
  /*----------------------------------------------------------------------------------------------
106
  *
107
- * Welcome
108
  *
109
  *--------------------------------------------------------------------------------------------*/
110
- #aiovg-welcome .aiovg-badge {
111
- margin-bottom: 0;
 
 
 
 
 
 
112
  background: #0073aa url( '../images/logo.png' ) no-repeat top;
113
  }
114
 
115
- #aiovg-welcome .dashicons-info {
116
- color: #ca4a1f;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
- #aiovg-welcome .dashicons-awards {
120
- font-size: 30px;
121
- margin-right: 10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  }
123
 
124
  /*----------------------------------------------------------------------------------------------
@@ -220,55 +462,13 @@ table.aiovg-table .aiovg-handle {
220
  cursor: move;
221
  }
222
 
223
- .aiovg-radio-list,
224
- .aiovg-checkbox-list {
225
- position: relative;
226
- display: block;
227
- background: transparent !important;
228
- margin: 0;
229
- padding: 1px;
230
- }
231
-
232
- .aiovg-radio-list.horizontal,
233
- .aiovg-checkbox-list.horizontal {
234
- overflow: hidden;
235
- }
236
-
237
- .aiovg-radio-list.horizontal li,
238
- .aiovg-checkbox-list.horizontal li {
239
- float: left;
240
- margin-right: 20px;
241
- }
242
-
243
- .aiovg-radio-list input,
244
- .aiovg-checkbox-list input {
245
- margin-top: -1px;
246
- margin-right: 5px !important;
247
- }
248
-
249
  @media (max-width: 767px) {
250
- table.aiovg-table .aiovg-media-uploader input[type="text"] {
251
- width: 100%;
252
- }
253
-
254
- table.aiovg-table .aiovg-media-uploader .button {
255
- width: 100%;
256
- margin-top: 10px;
257
- text-align: center;
258
- }
259
-
260
  .aiovg-tracks-row td {
261
  display: block !important;
262
  border-bottom: none !important;
263
  }
264
  }
265
 
266
- @media (min-width: 768px) {
267
- table.aiovg-table .aiovg-media-uploader input[type="text"] {
268
- width: 75%;
269
- }
270
- }
271
-
272
  /*----------------------------------------------------------------------------------------------
273
  *
274
  * Categories
@@ -283,10 +483,8 @@ table.aiovg-table .aiovg-handle {
283
  * Settings
284
  *
285
  *--------------------------------------------------------------------------------------------*/
286
- .aiovg-settings h2 {
287
  margin-top: 2em;
288
- padding-bottom: 10px;
289
- border-bottom: 1px dashed #CCC;
290
  }
291
 
292
  .aiovg-settings .search {
@@ -302,95 +500,6 @@ table.aiovg-table .aiovg-handle {
302
  display: none;
303
  }
304
 
305
- /*----------------------------------------------------------------------------------------------
306
- *
307
- * Shortcode Builder
308
- *
309
- *--------------------------------------------------------------------------------------------*/
310
- #aiovg-media-button .dashicons:before {
311
- color: #FFF;
312
- }
313
-
314
- #aiovg-shortcode-builder {
315
- position: relative;
316
- width: auto;
317
- max-width: 500px;
318
- margin: 32px auto;
319
- padding: 20px;
320
- background: #FFF;
321
- }
322
-
323
- #aiovg-shortcode-form .aiovg-shortcode-section-header {
324
- display: block;
325
- margin-bottom: 10px;
326
- padding: 7px;
327
- background: #666;
328
- border: #333;
329
- color: #FFF;
330
- pointer-events: none;
331
- }
332
-
333
- #aiovg-shortcode-form .aiovg-shortcode-section-general .aiovg-shortcode-section-header {
334
- display: none;
335
- }
336
-
337
- #aiovg-shortcode-form .aiovg-shortcode-selector,
338
- #aiovg-shortcode-form .aiovg-shortcode-field {
339
- margin-bottom: 10px;
340
- }
341
-
342
- #aiovg-shortcode-form .aiovg-shortcode-label {
343
- display: block;
344
- margin-bottom: 5px;
345
- font-weight: 500;
346
- }
347
-
348
- #aiovg-shortcode-form label.selectit {
349
- margin-bottom: 0;
350
- }
351
-
352
- #aiovg-shortcode-form .aiovg-shortcode-field-description {
353
- margin: 7px 0;
354
- }
355
-
356
- #aiovg-shortcode-type-categories,
357
- #aiovg-shortcode-type-videos,
358
- #aiovg-shortcode-type-video,
359
- #aiovg-shortcode-type-search_form {
360
- display: none;
361
- }
362
-
363
- .aiovg-shortcode-type-categories #aiovg-shortcode-type-categories,
364
- .aiovg-shortcode-type-videos #aiovg-shortcode-type-videos,
365
- .aiovg-shortcode-type-video #aiovg-shortcode-type-video,
366
- .aiovg-shortcode-type-search_form #aiovg-shortcode-type-search_form {
367
- display: block;
368
- }
369
-
370
- #aiovg-shortcode-type-categories .aiovg-shortcode-field-title,
371
- #aiovg-shortcode-type-categories .aiovg-shortcode-field-ratio {
372
- display: none;
373
- }
374
-
375
- #aiovg-shortcode-type-categories.aiovg-template-grid .aiovg-shortcode-field-hierarchical {
376
- display: none;
377
- }
378
-
379
- #aiovg-shortcode-type-categories.aiovg-template-list .aiovg-shortcode-field-columns,
380
- #aiovg-shortcode-type-categories.aiovg-template-list .aiovg-shortcode-field-show_description {
381
- display: none;
382
- }
383
-
384
- #aiovg-shortcode-type-videos .aiovg-shortcode-field-title,
385
- #aiovg-shortcode-type-videos .aiovg-shortcode-field-exclude,
386
- #aiovg-shortcode-type-videos .aiovg-shortcode-field-ratio,
387
- #aiovg-shortcode-type-videos .aiovg-shortcode-field-show_more,
388
- #aiovg-shortcode-type-videos .aiovg-shortcode-field-more_label,
389
- #aiovg-shortcode-type-videos .aiovg-shortcode-field-more_link,
390
- #aiovg-shortcode-type-videos .aiovg-shortcode-field-excerpt_length {
391
- display: none;
392
- }
393
-
394
  /*----------------------------------------------------------------------------------------------
395
  *
396
  * Widgets
@@ -433,10 +542,11 @@ table.aiovg-table .aiovg-handle {
433
  display: none;
434
  }
435
 
 
436
  .aiovg-widget-form-videos .aiovg-widget-field-exclude,
437
  .aiovg-widget-form-videos .aiovg-widget-field-ratio,
438
  .aiovg-widget-form-videos .aiovg-widget-field-show_count,
439
  .aiovg-widget-form-videos .aiovg-widget-field-excerpt_length,
440
  .aiovg-widget-form-videos .aiovg-widget-field-show_pagination {
441
  display: none;
442
- }
7
  text-align: center;
8
  }
9
 
10
+ .aiovg-text-error {
11
+ color:#b31105;
12
  }
13
 
14
  .aiovg-toggle-fields {
15
  display: none;
16
  }
17
 
18
+ .aiovg-indent {
19
+ padding-left: 25px;
20
+ }
21
+
22
+ .aiovg-no-border {
23
+ border: 0 none;
24
+ }
25
+
26
+ .aiovg-radio,
27
+ .aiovg-checkbox {
28
+ position: relative;
29
+ display: block;
30
+ background: transparent !important;
31
+ margin: 0;
32
+ padding: 1px;
33
+ }
34
+
35
+ .aiovg-radio input,
36
+ .aiovg-checkbox input {
37
+ margin-right: 5px !important;
38
+ }
39
+
40
+ .aiovg-radio.horizontal,
41
+ .aiovg-checkbox.horizontal {
42
+ overflow: hidden;
43
+ }
44
+
45
+ .aiovg-radio.horizontal li,
46
+ .aiovg-checkbox.horizontal li {
47
+ float: left;
48
+ margin-right: 20px;
49
+ }
50
+
51
  .aiovg-checklist {
52
  max-height: 100px;
53
+ padding: 5px 10px;
54
  border: 1px solid #ddd;
55
  box-sizing: border-box;
56
  overflow-y: scroll;
66
 
67
  .aiovg-checklist label {
68
  display: block;
69
+ margin: 5px 0;
70
+ line-height: 1;
71
+ }
72
+
73
+ .aiovg-media-uploader {
74
+ position: relative;
75
+ }
76
+
77
+ .aiovg-media-uploader .aiovg-upload-media {
78
+ position: absolute;
79
+ display: -webkit-flex; /* Safari */
80
+ display: flex;
81
+ top: 0;
82
+ right: 0;
83
+ height: 100%;
84
+ padding: 0 10px;
85
+ -webkit-align-items: center; /* Safari */
86
+ align-items: center;
87
+ }
88
+
89
+ .aiovg-media-uploader a,
90
+ .aiovg-media-uploader a:hover,
91
+ .aiovg-media-uploader a:focus {
92
+ text-decoration: none;
93
  }
94
 
95
  .aiovg-pipe-separator {
110
  }
111
 
112
  .aiovg-notice {
113
+ padding: 7px;
 
114
  }
115
 
116
  .aiovg-notice-error {
125
  color: #3c763d;
126
  }
127
 
128
+ .aiovg-modal {
129
+ position: relative;
130
+ width: auto;
131
+ max-width: 640px;
132
+ margin: 32px auto;
133
+ padding: 20px;
134
+ background: #FFF;
135
+ }
136
+
137
  @media (max-width: 767px) {
138
  .aiovg-hidden-xs {
139
  display: none !important;
168
 
169
  /*----------------------------------------------------------------------------------------------
170
  *
171
+ * Dashboard
172
  *
173
  *--------------------------------------------------------------------------------------------*/
174
+ #aiovg-dashboard h1 {
175
+ font-size: 2.4em;
176
+ font-weight: 300;
177
+ }
178
+
179
+ #aiovg-dashboard .aiovg-badge {
180
+ height: 35px;
181
+ padding-top: 125px;
182
  background: #0073aa url( '../images/logo.png' ) no-repeat top;
183
  }
184
 
185
+ /*----------------------------------------------------------------------------------------------
186
+ *
187
+ * Shortcode Builder
188
+ *
189
+ *--------------------------------------------------------------------------------------------*/
190
+ #aiovg-shortcode-selector {
191
+ margin: 0;
192
+ padding: 15px;
193
+ box-shadow: 1px 1px 5px #ccc;
194
+ }
195
+
196
+ #aiovg-shortcode-selector p {
197
+ margin: 0 0 5px 0;
198
+ }
199
+
200
+ #aiovg-shortcode-builder {
201
+ display: -webkit-flex; /* Safari */
202
+ -webkit-flex-wrap: wrap; /* Safari 6.1+ */
203
+ display: flex;
204
+ flex-wrap: wrap;
205
+ margin: 0 -15px;
206
+ }
207
+
208
+ #aiovg-shortcode-builder .aiovg-left-col,
209
+ #aiovg-shortcode-builder .aiovg-right-col {
210
+ width: 100%;
211
+ }
212
+
213
+ #aiovg-shortcode-builder .aiovg-col-content {
214
+ padding: 15px;
215
+ }
216
+
217
+ .aiovg-shortcode-section {
218
+ box-shadow: 1px 1px 5px #ddd;
219
+ }
220
+
221
+ .aiovg-shortcode-section-header {
222
+ margin: 5px 0 0 0;
223
+ padding: 10px;
224
+ background: #e5e5e5;
225
+ border: 1px solid #ccc;
226
+ font-size: 1.1em;
227
+ font-weight: normal;
228
+ line-height: normal;
229
+ cursor: pointer;
230
+ }
231
+
232
+ .aiovg-shortcode-section-header:hover {
233
+ background: #f9f9f9;
234
+ }
235
+
236
+ .aiovg-shortcode-section-header .dashicons-before {
237
+ color: #006799;
238
+ line-height: 1.1em;
239
  }
240
 
241
+ .aiovg-shortcode-section-header .dashicons-plus {
242
+ display: inline-block;
243
+ }
244
+
245
+ .aiovg-shortcode-section-header .dashicons-minus {
246
+ display: none;
247
+ }
248
+
249
+ .aiovg-active .aiovg-shortcode-section-header .dashicons-plus {
250
+ display: none;
251
+ }
252
+
253
+ .aiovg-active .aiovg-shortcode-section-header .dashicons-minus {
254
+ display: inline-block;
255
+ }
256
+
257
+ .aiovg-shortcode-controls {
258
+ margin: -1px 0 0 0;
259
+ padding: 15px;
260
+ background: #fff;
261
+ border: 1px solid #ccc;
262
+ }
263
+
264
+ .aiovg-shortcode-control {
265
+ margin-bottom: 15px;
266
+ }
267
+
268
+ .aiovg-shortcode-controls .aiovg-shortcode-control:last-child {
269
+ margin-bottom: 0;
270
+ }
271
+
272
+ .aiovg-shortcode-control > label {
273
+ display: block;
274
+ margin-bottom: 7px;
275
+ }
276
+
277
+ .aiovg-shortcode-control .wp-picker-input-wrap label {
278
+ display: inline-block;
279
+ }
280
+
281
+ .aiovg-shortcode-control-title,
282
+ .aiovg-shortcode-control-id,
283
+ .aiovg-shortcode-control-mp4,
284
+ .aiovg-shortcode-control-youtube,
285
+ .aiovg-shortcode-control-vimeo,
286
+ .aiovg-shortcode-control-dailymotion,
287
+ .aiovg-shortcode-control-facebook,
288
+ .aiovg-shortcode-control-ratio,
289
+ .aiovg-shortcode-control-include,
290
+ .aiovg-shortcode-control-exclude,
291
+ .aiovg-shortcode-control-excerpt_length,
292
+ .aiovg-shortcode-control-show_more,
293
+ .aiovg-shortcode-control-more_label,
294
+ .aiovg-shortcode-control-more_link {
295
+ display: none;
296
+ }
297
+
298
+ #aiovg-shortcode-form-video.aiovg-type-default .aiovg-shortcode-control-mp4 {
299
+ display: block;
300
+ }
301
+
302
+ #aiovg-shortcode-form-video.aiovg-type-youtube .aiovg-shortcode-control-youtube {
303
+ display: block;
304
+ }
305
+
306
+ #aiovg-shortcode-form-video.aiovg-type-vimeo .aiovg-shortcode-control-vimeo {
307
+ display: block;
308
+ }
309
+
310
+ #aiovg-shortcode-form-video.aiovg-type-dailymotion .aiovg-shortcode-control-dailymotion {
311
+ display: block;
312
+ }
313
+
314
+ #aiovg-shortcode-form-video.aiovg-type-facebook .aiovg-shortcode-control-facebook {
315
+ display: block;
316
+ }
317
+
318
+ #aiovg-shortcode-form-video .aiovg-shortcode-control-ratio {
319
+ display: block;
320
+ }
321
+
322
+ #aiovg-shortcode-form-categories .aiovg-shortcode-control-id {
323
+ display: block;
324
+ }
325
+
326
+ #aiovg-shortcode-form-categories.aiovg-template-grid .aiovg-shortcode-control-hierarchical {
327
+ display: none;
328
+ }
329
+
330
+ #aiovg-shortcode-form-categories.aiovg-template-list .aiovg-shortcode-control-columns,
331
+ #aiovg-shortcode-form-categories.aiovg-template-list .aiovg-shortcode-control-show_description {
332
+ display: none;
333
+ }
334
+
335
+ @media only screen and (min-width: 768px) {
336
+ #aiovg-shortcode-builder .aiovg-left-col {
337
+ width: 60%;
338
+ }
339
+
340
+ #aiovg-shortcode-builder .aiovg-right-col {
341
+ width: 40%;
342
+ }
343
+ }
344
+
345
+ /*----------------------------------------------------------------------------------------------
346
+ *
347
+ * Issues Manager
348
+ *
349
+ *--------------------------------------------------------------------------------------------*/
350
+ #aiovg-issues {
351
+ margin-top: 1.4em;
352
+ }
353
+
354
+ #aiovg-issues .subsubsub {
355
+ margin: 7px 0;
356
+ }
357
+
358
+ #aiovg-issues input[type=checkbox] {
359
+ margin: 0;
360
+ }
361
+
362
+ #aiovg-issues tfoot td {
363
+ text-align: right;
364
  }
365
 
366
  /*----------------------------------------------------------------------------------------------
462
  cursor: move;
463
  }
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  @media (max-width: 767px) {
 
 
 
 
 
 
 
 
 
 
466
  .aiovg-tracks-row td {
467
  display: block !important;
468
  border-bottom: none !important;
469
  }
470
  }
471
 
 
 
 
 
 
 
472
  /*----------------------------------------------------------------------------------------------
473
  *
474
  * Categories
483
  * Settings
484
  *
485
  *--------------------------------------------------------------------------------------------*/
486
+ .aiovg-settings form {
487
  margin-top: 2em;
 
 
488
  }
489
 
490
  .aiovg-settings .search {
500
  display: none;
501
  }
502
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
503
  /*----------------------------------------------------------------------------------------------
504
  *
505
  * Widgets
542
  display: none;
543
  }
544
 
545
+ .aiovg-widget-form-videos .aiovg-widget-field-include,
546
  .aiovg-widget-form-videos .aiovg-widget-field-exclude,
547
  .aiovg-widget-form-videos .aiovg-widget-field-ratio,
548
  .aiovg-widget-form-videos .aiovg-widget-field-show_count,
549
  .aiovg-widget-form-videos .aiovg-widget-field-excerpt_length,
550
  .aiovg-widget-form-videos .aiovg-widget-field-show_pagination {
551
  display: none;
552
+ }
admin/assets/js/admin.js CHANGED
@@ -1,6 +1,6 @@
1
  (function( $ ) {
2
  'use strict';
3
-
4
  /**
5
  * Display the media uploader.
6
  *
@@ -34,10 +34,6 @@
34
 
35
  // Set the data
36
  switch ( form ) {
37
- case 'videos':
38
- var id = $elem.data( 'format' );
39
- $( '#aiovg-' + id ).val( attachment.url );
40
- break;
41
  case 'tracks':
42
  var id = $elem.closest( 'tr' ).find( '.aiovg-track-src' ).attr( 'id' );
43
  $( '#' + id ).val( attachment.url );
@@ -52,13 +48,15 @@
52
  case 'settings':
53
  $elem.prev( '.aiovg-url' ).val( attachment.url );
54
  break;
 
 
55
  };
56
  });
57
 
58
  // Now display the actual file_frame
59
  file_frame.open();
60
  };
61
-
62
  /**
63
  * Make tracks inside the video form sortable.
64
  *
@@ -100,46 +98,152 @@
100
  */
101
  $(function() {
102
 
103
- // Admin: Dismiss admin notice
104
- $( '#aiovg-admin-notice' ).on( 'click', '.notice-dismiss', function( e ) {
105
- e.preventDefault();
106
-
107
- var data = {
108
- 'action': 'aiovg_dismiss_admin_notice',
109
- 'security': $( '#aiovg-admin-notice' ).data( 'security' )
110
- };
111
-
112
- $.post( ajaxurl, data );
113
  });
 
 
 
114
 
115
- // Settings: Set Section ID
116
- $( '.form-table', '#aiovg-settings' ).each(function() {
117
- var str = $( this ).find( 'tr:first th label' ).attr( 'for' );
118
- var id = str.split( '[' );
119
- id = id[0].replace( /_/g, '-' );
120
 
121
- $( this ).attr( 'id', id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  });
123
 
124
- // Settings: Toggle fields based on the selected categories template
125
- $( 'tr.template', '#aiovg-categories-settings' ).find( 'select' ).on( 'change', function() {
126
  var template = $( this ).val();
127
 
128
- $( '#aiovg-categories-settings' ).removeClass(function( index, classes ) {
129
  var matches = classes.match( /\aiovg-template-\S+/ig );
130
  return ( matches ) ? matches.join(' ') : '';
131
  }).addClass( 'aiovg-template-' + template );
132
- }).trigger( 'change' );
133
 
134
- // Settings: Toggle fields based on the selected videos template
135
- $( 'tr.template', '#aiovg-videos-settings' ).find( 'select' ).on( 'change', function() {
136
  var template = $( this ).val();
137
 
138
- $( '#aiovg-videos-settings' ).removeClass(function( index, classes ) {
139
  var matches = classes.match( /\aiovg-template-\S+/ig );
140
  return ( matches ) ? matches.join(' ') : '';
141
  }).addClass( 'aiovg-template-' + template );
142
- }).trigger( 'change' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
  // Videos: Toggle fields based on the selected video source type
145
  $( '#aiovg-video-type' ).on( 'change', function( e ) {
@@ -177,12 +281,6 @@
177
  }
178
  }).trigger( 'change' );
179
 
180
- // Videos: Display the media uploader when "Upload Media" button clicked
181
- $( '.aiovg-upload-media' ).on( 'click', function( e ) {
182
- e.preventDefault();
183
- aiovg_render_media_uploader( $( this ), 'videos' );
184
- });
185
-
186
  // Videos: Add new subtitle fields when "Add New File" button clicked
187
  $( '#aiovg-add-new-track' ).on( 'click', function( e ) {
188
  e.preventDefault();
@@ -199,7 +297,7 @@
199
  $( '#aiovg-add-new-track' ).trigger( 'click' );
200
  }
201
 
202
- // Videos: Display the media uploader for adding subtitles when "Upload File" button clicked
203
  $( 'body' ).on( 'click', '.aiovg-upload-track', function( e ) {
204
  e.preventDefault();
205
  aiovg_render_media_uploader( $( this ), 'tracks' );
@@ -214,33 +312,21 @@
214
  // Videos: Make the subtitles fields sortable
215
  aiovg_sort_tracks();
216
 
217
- // Categories: Display the media uploader when "Add Image" button clicked
218
  $( '#aiovg-categories-upload-image' ).on( 'click', function( e ) {
219
  e.preventDefault();
220
  aiovg_render_media_uploader( $( this ), 'categories' );
221
  });
222
 
223
- // Categories: Delete the image when "Remove Image" button clicked
224
  $( '#aiovg-categories-remove-image' ).on( 'click', function( e ) {
225
  e.preventDefault();
226
-
227
- var id = parseInt( $( '#aiovg-categories-image-id' ).val() );
228
-
229
- if ( id > 0 ) {
230
- var data = {
231
- 'action': 'aiovg_delete_category_image',
232
- 'attachment_id': id,
233
- 'security': $( '#aiovg_category_image_nonce' ).val()
234
- };
235
 
236
- $.post( ajaxurl, data, function(response) {
237
- $( '#aiovg-categories-image-id' ).val( '' );
238
- $( '#aiovg-categories-image-wrapper' ).html( '' );
239
-
240
- $( '#aiovg-categories-remove-image' ).hide();
241
- $( '#aiovg-categories-upload-image' ).show();
242
- });
243
- };
244
  });
245
 
246
  // Categories: Clear the image field after a category was created
@@ -261,95 +347,41 @@
261
  };
262
  };
263
  });
264
-
265
- // Settings: Initiate color picker
266
- $( '.aiovg-color-picker-field', '#aiovg-settings' ).wpColorPicker();
 
 
 
 
 
 
267
 
268
- // Settings: Browse button
269
  $( '.aiovg-browse', '#aiovg-settings' ).on( 'click', function( e ) {
270
  e.preventDefault();
271
  aiovg_render_media_uploader( $( this ), 'settings' );
272
  });
273
-
274
- // Shortcode Builder: Initialize popup
275
- $( '#aiovg-media-button' ).magnificPopup({
276
- type: 'inline'
277
- });
278
-
279
- // Shortcode Builder: Toggle fields based on the selected shortcode type
280
- $( '#aiovg-shortcode-type' ).on( 'change', function( e ) {
281
- var type = $( this ).val();
282
 
283
- $( '#aiovg-shortcode-form' ).removeClass(function( index, classes ) {
284
- var matches = classes.match( /\aiovg-shortcode-type-\S+/ig );
285
- return ( matches ) ? matches.join(' ') : '';
286
- }).addClass( 'aiovg-shortcode-type-' + type );
287
- }).trigger( 'change' );
288
-
289
- // Shortcode Builder: Toggle fields based on the selected categories template
290
- $( '.aiovg-shortcode-field-template', '#aiovg-shortcode-type-categories' ).find( 'select' ).on( 'change', function() {
291
  var template = $( this ).val();
292
 
293
- $( '#aiovg-shortcode-type-categories' ).removeClass(function( index, classes ) {
294
  var matches = classes.match( /\aiovg-template-\S+/ig );
295
  return ( matches ) ? matches.join(' ') : '';
296
  }).addClass( 'aiovg-template-' + template );
297
  }).trigger( 'change' );
298
 
299
- // Shortcode Builder: Toggle fields based on the selected videos template
300
- $( '.aiovg-shortcode-field-template', '#aiovg-shortcode-type-videos' ).find( 'select' ).on( 'change', function() {
301
  var template = $( this ).val();
302
 
303
- $( '#aiovg-shortcode-type-videos' ).removeClass(function( index, classes ) {
304
  var matches = classes.match( /\aiovg-template-\S+/ig );
305
  return ( matches ) ? matches.join(' ') : '';
306
  }).addClass( 'aiovg-template-' + template );
307
- }).trigger( 'change' );
308
-
309
- // Shortcode Builder: Initiate color picker
310
- $( '.aiovg-color-picker-field', '#aiovg-shortcode-form' ).wpColorPicker();
311
-
312
- // Shortcode Builder: Insert shortcode
313
- $( '#aiovg-insert-shortcode' ).on( 'click', function( e ) {
314
- e.preventDefault();
315
-
316
- var shortcode = $( '#aiovg-shortcode-type' ).val();
317
- var attrs = '';
318
-
319
- $( '.aiovg-shortcode-field', '#aiovg-shortcode-type-' + shortcode ).each(function() {
320
- var $elem = $( this ).find( '.aiovg-shortcode-input' );
321
-
322
- if ( $elem.length ) {
323
- var type = $elem.attr( 'type' );
324
- var name = $elem.attr( 'name' );
325
- var value = $elem.val();
326
- var def = $elem.data( 'default' );
327
-
328
- if ( 'category' == name ) {
329
- value = $( 'input[type="checkbox"]:checked', $elem ).map(function() {
330
- return this.value;
331
- }).get().join( "," );
332
- }
333
-
334
- if ( 'checkbox' == type ) {
335
- value = $elem.is( ':checked' ) ? 1 : 0;
336
- }
337
-
338
- if ( value != def ) {
339
- attrs += ( ' ' + name + '="' + value + '"' );
340
- }
341
- }
342
- });
343
-
344
- window.send_to_editor( '[aiovg_' + shortcode + attrs + ']' );
345
- $.magnificPopup.close();
346
- }).trigger( 'change' );
347
-
348
- // Shortcode Builder: Close shortcode builder
349
- $( '#aiovg-cancel-shortcode-insert' ).on( 'click', function( e ) {
350
- e.preventDefault();
351
- $.magnificPopup.close();
352
- });
353
 
354
  // Categories Widget: Toggle fields based on the selected categories template
355
  $( document ).on( 'change', '.aiovg-widget-form-categories .aiovg-widget-input-template', function() {
1
  (function( $ ) {
2
  'use strict';
3
+
4
  /**
5
  * Display the media uploader.
6
  *
34
 
35
  // Set the data
36
  switch ( form ) {
 
 
 
 
37
  case 'tracks':
38
  var id = $elem.closest( 'tr' ).find( '.aiovg-track-src' ).attr( 'id' );
39
  $( '#' + id ).val( attachment.url );
48
  case 'settings':
49
  $elem.prev( '.aiovg-url' ).val( attachment.url );
50
  break;
51
+ default:
52
+ $elem.closest( '.aiovg-media-uploader' ).find( 'input[type=text]' ).val( attachment.url );
53
  };
54
  });
55
 
56
  // Now display the actual file_frame
57
  file_frame.open();
58
  };
59
+
60
  /**
61
  * Make tracks inside the video form sortable.
62
  *
98
  */
99
  $(function() {
100
 
101
+ // Common: Upload Media
102
+ $( '.aiovg-upload-media' ).on( 'click', function( e ) {
103
+ e.preventDefault();
104
+ aiovg_render_media_uploader( $( this ), 'default' );
 
 
 
 
 
 
105
  });
106
+
107
+ // Common: Initiate color picker
108
+ $( '.aiovg-color-picker' ).wpColorPicker();
109
 
110
+ // Common: Initialize the popup
111
+ $( '.aiovg-modal-button' ).magnificPopup({
112
+ type: 'inline'
113
+ });
 
114
 
115
+ // Dashboard: On shortcode type changed
116
+ $( 'input[type=radio]', '#aiovg-shortcode-selector' ).on( 'change', function( e ) {
117
+ var shortcode = $( 'input[type=radio]:checked', '#aiovg-shortcode-selector' ).val();
118
+
119
+ $( '.aiovg-shortcode-form' ).hide();
120
+ $( '.aiovg-shortcode-instructions' ).hide();
121
+
122
+ $( '#aiovg-shortcode-form-' + shortcode ).show();
123
+ $( '#aiovg-shortcode-instructions-' + shortcode ).show();
124
+ }).trigger( 'change' );
125
+
126
+ // Dashboard: Toggle between field sections
127
+ $( document ).on( 'click', '.aiovg-shortcode-section-header', function( e ) {
128
+ var $elem = $( this ).parent();
129
+
130
+ if ( ! $elem.hasClass( 'aiovg-active' ) ) {
131
+ $( this ).closest( '.aiovg-shortcode-form' )
132
+ .find( '.aiovg-shortcode-section.aiovg-active' )
133
+ .toggleClass( 'aiovg-active' )
134
+ .find( '.aiovg-shortcode-controls' )
135
+ .slideToggle();
136
+ }
137
+
138
+ $elem.toggleClass( 'aiovg-active' )
139
+ .find( '.aiovg-shortcode-controls' )
140
+ .slideToggle();
141
+ });
142
+
143
+ // Dashboard: Toggle fields based on the selected video source type
144
+ $( 'select[name=type]', '#aiovg-shortcode-form-video' ).on( 'change', function() {
145
+ var type = $( this ).val();
146
+
147
+ $( '#aiovg-shortcode-form-video' ).removeClass(function( index, classes ) {
148
+ var matches = classes.match( /\aiovg-type-\S+/ig );
149
+ return ( matches ) ? matches.join(' ') : '';
150
+ }).addClass( 'aiovg-type-' + type );
151
  });
152
 
153
+ // Dashboard: Toggle fields based on the selected videos template
154
+ $( 'select[name=template]', '#aiovg-shortcode-form-videos' ).on( 'change', function() {
155
  var template = $( this ).val();
156
 
157
+ $( '#aiovg-shortcode-form-videos' ).removeClass(function( index, classes ) {
158
  var matches = classes.match( /\aiovg-template-\S+/ig );
159
  return ( matches ) ? matches.join(' ') : '';
160
  }).addClass( 'aiovg-template-' + template );
161
+ });
162
 
163
+ // Dashboard: Toggle fields based on the selected categories template
164
+ $( 'select[name=template]', '#aiovg-shortcode-form-categories' ).on( 'change', function() {
165
  var template = $( this ).val();
166
 
167
+ $( '#aiovg-shortcode-form-categories' ).removeClass(function( index, classes ) {
168
  var matches = classes.match( /\aiovg-template-\S+/ig );
169
  return ( matches ) ? matches.join(' ') : '';
170
  }).addClass( 'aiovg-template-' + template );
171
+ });
172
+
173
+ // Dashboard: Generate shortcode
174
+ $( '#aiovg-generate-shortcode' ).on( 'click', function( e ) {
175
+ e.preventDefault();
176
+
177
+ // Shortcode
178
+ var shortcode = $( 'input[type=radio]:checked', '#aiovg-shortcode-selector' ).val();
179
+
180
+ // Attributes
181
+ var props = {};
182
+
183
+ $( '.aiovg-shortcode-field', '#aiovg-shortcode-form-' + shortcode ).each(function() {
184
+ var $this = $( this );
185
+ var type = $this.attr( 'type' );
186
+ var name = $this.attr( 'name' );
187
+ var value = $this.val();
188
+ var def = 0;
189
+
190
+ if ( 'undefined' !== typeof $this.data( 'default' ) ) {
191
+ def = $this.data( 'default' );
192
+ }
193
+
194
+ // type = checkbox
195
+ if ( 'checkbox' == type ) {
196
+ value = $this.is( ':checked' ) ? 1 : 0;
197
+ } else {
198
+ // name = category
199
+ if ( 'category' == name ) {
200
+ value = $( 'input[type=checkbox]:checked', $this ).map(function() {
201
+ return this.value;
202
+ }).get().join( "," );
203
+ }
204
+ }
205
+
206
+ // Add only if the user input differ from the global configuration
207
+ if ( value != def ) {
208
+ props[ name ] = value;
209
+ }
210
+ });
211
+
212
+ var attrs = shortcode;
213
+ for ( var name in props ) {
214
+ if ( props.hasOwnProperty( name ) ) {
215
+ attrs += ( ' ' + name + '="' + props[ name ] + '"' );
216
+ }
217
+ }
218
+
219
+ // Shortcode output
220
+ $( '#aiovg-shortcode').val( '[aiovg_' + attrs + ']' );
221
+ });
222
+
223
+ // Dashboard: Check/Uncheck all checkboxes in the issues table list
224
+ $( '#aiovg-issues-check-all' ).on( 'change', function( e ) {
225
+ var value = $( this ).is( ':checked' ) ? 1 : 0;
226
+
227
+ if ( value ) {
228
+ $( '.aiovg-issue', '#aiovg-issues' ).prop( 'checked', true );
229
+ } else {
230
+ $( '.aiovg-issue', '#aiovg-issues' ).prop( 'checked', false );
231
+ }
232
+ });
233
+
234
+ // Dashboard: Validate the issues form
235
+ $( '#aiovg-issues-form' ).submit(function() {
236
+ var has_input = 0;
237
+
238
+ $( '.aiovg-issue:checked', '#aiovg-issues' ).each(function() {
239
+ has_input = 1;
240
+ });
241
+
242
+ if ( ! has_input ) {
243
+ alert( aiovg_admin.i18n.no_issues_slected );
244
+ return false;
245
+ }
246
+ });
247
 
248
  // Videos: Toggle fields based on the selected video source type
249
  $( '#aiovg-video-type' ).on( 'change', function( e ) {
281
  }
282
  }).trigger( 'change' );
283
 
 
 
 
 
 
 
284
  // Videos: Add new subtitle fields when "Add New File" button clicked
285
  $( '#aiovg-add-new-track' ).on( 'click', function( e ) {
286
  e.preventDefault();
297
  $( '#aiovg-add-new-track' ).trigger( 'click' );
298
  }
299
 
300
+ // Videos: Upload Tracks
301
  $( 'body' ).on( 'click', '.aiovg-upload-track', function( e ) {
302
  e.preventDefault();
303
  aiovg_render_media_uploader( $( this ), 'tracks' );
312
  // Videos: Make the subtitles fields sortable
313
  aiovg_sort_tracks();
314
 
315
+ // Categories: Upload Image
316
  $( '#aiovg-categories-upload-image' ).on( 'click', function( e ) {
317
  e.preventDefault();
318
  aiovg_render_media_uploader( $( this ), 'categories' );
319
  });
320
 
321
+ // Categories: Remove Image
322
  $( '#aiovg-categories-remove-image' ).on( 'click', function( e ) {
323
  e.preventDefault();
 
 
 
 
 
 
 
 
 
324
 
325
+ $( '#aiovg-categories-image-id' ).val( '' );
326
+ $( '#aiovg-categories-image-wrapper' ).html( '' );
327
+
328
+ $( '#aiovg-categories-remove-image' ).hide();
329
+ $( '#aiovg-categories-upload-image' ).show();
 
 
 
330
  });
331
 
332
  // Categories: Clear the image field after a category was created
347
  };
348
  };
349
  });
350
+
351
+ // Settings: Set Section ID
352
+ $( '.form-table', '#aiovg-settings' ).each(function() {
353
+ var str = $( this ).find( 'tr:first th label' ).attr( 'for' );
354
+ var id = str.split( '[' );
355
+ id = id[0].replace( /_/g, '-' );
356
+
357
+ $( this ).attr( 'id', id );
358
+ });
359
 
360
+ // Settings: Upload Files
361
  $( '.aiovg-browse', '#aiovg-settings' ).on( 'click', function( e ) {
362
  e.preventDefault();
363
  aiovg_render_media_uploader( $( this ), 'settings' );
364
  });
 
 
 
 
 
 
 
 
 
365