Image Photo Gallery Final Tiles Grid - Version 3.3.13

Version Description

  • Fixed menu slug
Download this release

Release Info

Developer GreenTreeLabs
Plugin Icon 128x128 Image Photo Gallery Final Tiles Grid
Version 3.3.13
Comparing to
See all releases

Code changes from version 3.0.6 to 3.3.13

Files changed (76) hide show
  1. FinalTilesGalleryLite.php +1493 -1992
  2. admin/add-gallery.php +217 -63
  3. admin/adv.php +0 -0
  4. admin/css/style.css +113 -37
  5. admin/edit-gallery.php +17 -16
  6. admin/galleries.php +0 -45
  7. admin/header.php +18 -4
  8. admin/images/circles.jpg +0 -0
  9. admin/images/modula-strip.jpg +0 -0
  10. admin/images/modula.jpg +0 -0
  11. admin/include/edit-gallery.php +1183 -223
  12. admin/include/fields.php +1099 -0
  13. admin/include/image-list.php +1 -1
  14. admin/overview.php +3 -3
  15. admin/scripts/{final-tiles-grid-gallery-lite-admin.js → final-tiles-gallery-admin.js} +285 -15
  16. admin/support.php +9 -16
  17. admin/tutorial/tutorial-add-image-size.png +0 -0
  18. admin/tutorial/tutorial-add-image.png +0 -0
  19. admin/tutorial/tutorial-add-page.jpg +0 -0
  20. admin/tutorial/tutorial-add.png +0 -0
  21. admin/tutorial/tutorial-dashboard.png +0 -0
  22. admin/tutorial/tutorial-edit-list.jpg +0 -0
  23. admin/tutorial/tutorial-image-added.jpg +0 -0
  24. admin/tutorial/tutorial-image-edit.jpg +0 -0
  25. admin/tutorial/tutorial-image-panel.JPG +0 -0
  26. admin/tutorial/tutorial-images-tab.png +0 -0
  27. admin/tutorial/tutorial-tabs.jpg +0 -0
  28. admin/upgrade.php +0 -4
  29. freemius/.codeclimate.yml +0 -19
  30. freemius/.github/ISSUE_TEMPLATE.md +0 -29
  31. freemius/.travis.yml +0 -11
  32. freemius/assets/css/admin/dialog-boxes.css +2 -2
  33. freemius/assets/img/final-tiles-grid-gallery-lite.jpg +0 -0
  34. freemius/assets/scss/_colors.scss +10 -3
  35. freemius/assets/scss/_load.scss +4 -4
  36. freemius/assets/scss/_mixins.scss +63 -7
  37. freemius/assets/scss/_start.scss +3 -3
  38. freemius/assets/scss/_vars.scss +5 -5
  39. freemius/assets/scss/admin/_ajax-loader.scss +49 -0
  40. freemius/assets/scss/admin/_auto-install.scss +33 -0
  41. freemius/assets/scss/admin/_modal-common.scss +31 -0
  42. freemius/assets/scss/admin/connect.scss +471 -471
  43. freemius/assets/scss/admin/dialog-boxes.scss +3 -1
  44. freemius/composer.json +0 -10
  45. freemius/config.php +8 -0
  46. freemius/gulpfile.js +0 -58
  47. freemius/includes/class-freemius-abstract.php +45 -1
  48. freemius/includes/class-freemius.php +1063 -374
  49. freemius/includes/class-fs-logger.php +5 -3
  50. freemius/includes/class-fs-plugin-updater.php +272 -4
  51. freemius/includes/debug/class-fs-debug-bar-panel.php +1 -1
  52. freemius/includes/debug/debug-bar-start.php +2 -2
  53. freemius/includes/fs-core-functions.php +82 -47
  54. freemius/includes/fs-essential-functions.php +55 -41
  55. freemius/includes/fs-plugin-info-dialog.php +53 -53
  56. freemius/includes/i18n.php +537 -517
  57. freemius/includes/managers/class-fs-admin-menu-manager.php +156 -9
  58. freemius/includes/managers/class-fs-admin-notice-manager.php +312 -312
  59. freemius/includes/sdk/Exceptions/ArgumentNotExistException.php +8 -8
  60. freemius/includes/sdk/Exceptions/EmptyArgumentException.php +8 -8
  61. freemius/includes/sdk/Exceptions/Exception.php +73 -73
  62. freemius/includes/sdk/Exceptions/InvalidArgumentException.php +7 -7
  63. freemius/includes/sdk/Exceptions/OAuthException.php +11 -11
  64. freemius/includes/sdk/Freemius.php +626 -582
  65. freemius/includes/sdk/FreemiusBase.php +188 -188
  66. freemius/languages/freemius-da_DK.mo +0 -0
  67. freemius/languages/freemius-da_DK.po +829 -700
  68. freemius/languages/freemius-en.mo +0 -0
  69. freemius/languages/freemius-en.po +453 -392
  70. freemius/languages/freemius-he.mo +0 -0
  71. freemius/languages/freemius-he.po +825 -695
  72. freemius/languages/freemius-it_IT.mo +0 -0
  73. freemius/languages/freemius-it_IT.po +533 -611
  74. freemius/languages/freemius-ja_JP.mo +0 -0
  75. freemius/languages/freemius-ja_JP.po +700 -571
  76. freemius/languages/freemius.pot +117 -112
FinalTilesGalleryLite.php CHANGED
@@ -1,1992 +1,1493 @@
1
- <?php
2
- /**
3
- Plugin Name: Final Tiles Grid Gallery Lite
4
- Plugin URI: http://codecanyon.net/item/final-tiles-gallery-for-wordpress/5189351?ref=GreenTreeLabs
5
- Description: Wordpress Plugin for creating responsive image galleries. By: Green Tree Labs
6
- Author: Green Tree Labs
7
- Version: 3.0.6
8
- Author URI: http://codecanyon.net/user/GreenTreeLabs
9
- */
10
- define("FTGLITEVERSION", "3.0.6");
11
- // Create a helper function for easy SDK access.
12
- function ftggl_fs() {
13
- global $ftggl_fs;
14
-
15
- if ( ! isset( $ftggl_fs ) ) {
16
- // Include Freemius SDK.
17
- require_once dirname(__FILE__) . '/freemius/start.php';
18
-
19
- $ftggl_fs = fs_dynamic_init( array(
20
- 'id' => '1002',
21
- 'slug' => 'final-tiles-grid-gallery-lite',
22
- 'type' => 'plugin',
23
- 'public_key' => 'pk_d0e075b84d491d510a1d0a21087af',
24
- 'is_premium' => false,
25
- 'has_addons' => false,
26
- 'has_paid_plans' => false,
27
- 'menu' => array(
28
- 'slug' => "ftg-lite-gallery-admin",
29
- 'account' => false,
30
- 'contact' => false,
31
- 'support' => false,
32
- ),
33
- ) );
34
- }
35
-
36
- return $ftggl_fs;
37
- }
38
-
39
- // Init Freemius.
40
- ftggl_fs();
41
- // Signal that SDK was initiated.
42
- do_action( 'ftggl_fs_loaded' );
43
-
44
- function ftggl_fs_custom_connect_message_on_update(
45
- $message,
46
- $user_first_name,
47
- $plugin_title,
48
- $user_login,
49
- $site_link,
50
- $freemius_link
51
- ) {
52
- return sprintf(
53
- __fs( 'hey-x' ) . '<br>' .
54
- __( 'Please help us improve %2$s! If you opt-in, some data about your usage of %2$s will be sent to %5$s. If you skip this, that\'s okay! %2$s will still work just fine.<br><br>The main reason we need this analytics is understanding how admin UI is used and how we can improve it.', 'final-tiles-grid-gallery-lite' ),
55
- $user_first_name,
56
- '<b>' . $plugin_title . '</b>',
57
- '<b>' . $user_login . '</b>',
58
- $site_link,
59
- $freemius_link
60
- );
61
- }
62
-
63
- ftggl_fs()->add_filter('connect_message_on_update', 'ftggl_fs_custom_connect_message_on_update', 10, 6);
64
-
65
- define("PRO_CALL", "<span class='procall'>(<a href='http://1.envato.market/c/288541/275988/4415?u=https%3A%2F%2Fcodecanyon.net%2Fitem%2Ffinal-tiles-wordpress-gallery%2F5189351' target='_blank'>available with PRO version</a>)</span>");
66
- define("PRO_UNLOCK", "<a href='http://1.envato.market/c/288541/275988/4415?u=https%3A%2F%2Fcodecanyon.net%2Fitem%2Ffinal-tiles-wordpress-gallery%2F5189351' target='_blank'>Add unlimited images with PRO version</a>");
67
-
68
-
69
- if (!class_exists("FinalTiles_GalleryLite"))
70
- {
71
- class FinalTiles_GalleryLite
72
- {
73
- private $defaultValues = array(
74
- 'aClass' => '',
75
- 'afterGalleryText' => '',
76
- 'allFilterLabel' => 'All',
77
- 'ajaxLoading' => 'F',
78
- 'backgroundColor' => 'transparent',
79
- 'beforeGalleryText' => '',
80
- 'blank' => 'F',
81
- 'borderColor' => 'transparent',
82
- 'borderRadius' => 0,
83
- 'borderSize' => 0,
84
- 'captionBackgroundColor' => '#000000',
85
- 'captionBehavior' => 'hidden',
86
- 'captionColor' => '#ffffff',
87
- 'captionEasing' => 'linear',
88
- 'captionEffect' => 'fade',
89
- 'captionEffectDuration' => 250,
90
- 'captionEmpty' => 'hide',
91
- 'captionFontSize' => 12,
92
- 'captionFrame' => 'F',
93
- 'captionFrameColor' => '#ffffff',
94
- 'captionFullHeight' => 'T',
95
- 'captionHorizontalAlignment' => 'Center',
96
- 'captionIcon' => 'zoom',
97
- 'captionIconColor' => '#ffffff',
98
- 'captionIconSize' => 12,
99
- 'captionMobileBehavior' => "desktop",
100
- 'captionOpacity' => 80,
101
- 'captionPosition' => 'inside',
102
- 'captionVerticalAlignment' => 'Middle',
103
- 'columns' => 4,
104
- 'columnsPhoneLandscape' => 3,
105
- 'columnsPhonePortrait' => 2,
106
- 'columnsTabletLandscape' => 4,
107
- 'columnsTabletPortrait' => 3,
108
- 'compressHTML' => 'T',
109
- 'customCaptionIcon' =>'',
110
- 'defaultFilter' => '',
111
- 'defaultSize' => 'medium',
112
- 'delay' => 0,
113
- 'disableLightboxGroups' => 'F',
114
- 'enableFacebook' => 'F',
115
- 'enableGplus' => 'F',
116
- 'enablePinterest' => 'F',
117
- 'enableTwitter' => 'F',
118
- 'enlargeImages' => 'T',
119
- 'envatoReferral' => 'GreenTreeLabs',
120
- 'filterClick' => 'F',
121
- 'filters' => '',
122
- 'gridCellSize' => '25',
123
- 'hoverIconRotation' => 'F',
124
- 'hoverRotation' => 0,
125
- 'hoverZoom' => 100,
126
- 'imageSizeFactor' => 90,
127
- 'imageSizeFactorCustom' => '',
128
- 'imageSizeFactorPhoneLandscape' => 60,
129
- 'imageSizeFactorPhonePortrait' => 50,
130
- 'imageSizeFactorTabletLandscape' => 80,
131
- 'imageSizeFactorTabletPortrait' => 70,
132
- 'imagesOrder' => 'user',
133
- 'layout' => 'final',
134
- 'lazyLoad' => false,
135
- 'lightbox' => 'lightbox2',
136
- 'lightboxImageSize' => 'large',
137
- 'loadedHSlide' => 0,
138
- 'loadedRotate' => 0,
139
- 'loadedScale' => 100,
140
- 'loadedVSlide' => 0,
141
- 'loadingBarBackgroundColor' => "#fff",
142
- 'loadingBarColor' => "#fff",
143
- 'loadMethod' => 'sequential',
144
- 'margin' => 10,
145
- 'max_posts' => 0,
146
- 'minTileWidth' => '250',
147
- 'mobileLightbox' => 'swipebox',
148
- 'post_types' => '',
149
- 'recentPostsCaption' => 'title',
150
- 'recentPostsCaptionAutoExcerptLength' => 20,
151
- 'rel' => '',
152
- 'reverseOrder' => false,
153
- 'script' => '',
154
- 'scrollEffect' => 'none',
155
- 'shadowColor' => '#cccccc',
156
- 'shadowSize' => 0,
157
- 'socialIconColor' => '#ffffff',
158
- 'source' => 'images',
159
- 'style' => '',
160
- 'support' => 'F',
161
- 'supportText' => 'Powered by Final Tiles Grid Gallery',
162
- 'tilesPerPage' => 0,
163
- 'titleFontSize' => 14,
164
- 'width' => '100%',
165
- 'wp_field_caption' => 'description',
166
- 'wp_field_title' => 'title'
167
- );
168
-
169
- //Constructor
170
- public function __construct()
171
- {
172
- $this->plugin_name = plugin_basename(__FILE__);
173
- $this->define_constants();
174
- $this->define_db_tables();
175
- $this->FinalTilesdb = $this->create_db_conn();
176
-
177
-
178
- register_activation_hook(__FILE__, array($this, 'activation'));
179
-
180
- add_filter('widget_text', 'do_shortcode');
181
-
182
- add_action('plugins_loaded', array($this, 'create_textdomain'));
183
-
184
- add_action('wp_enqueue_scripts', array($this, 'add_gallery_scripts'));
185
-
186
- //add_action( 'admin_init', array($this,'gallery_admin_init') );
187
- add_action('admin_menu', array($this, 'add_gallery_admin_menu'));
188
-
189
- add_shortcode('FinalTilesGallery', array($this, 'gallery_shortcode_handler'));
190
-
191
- add_action('wp_ajax_save_gallery', array($this, 'save_gallery'));
192
- add_action('wp_ajax_add_new_gallery', array($this, 'add_new_gallery'));
193
- add_action('wp_ajax_delete_gallery', array($this, 'delete_gallery'));
194
- add_action('wp_ajax_clone_gallery', array($this, 'clone_gallery'));
195
- add_action('wp_ajax_save_image', array($this, 'save_image'));
196
- add_action('wp_ajax_add_image', array($this, 'add_image'));
197
- add_action('wp_ajax_save_video', array($this, 'save_video'));
198
- add_action('wp_ajax_sort_images', array($this, 'sort_images'));
199
- add_action('wp_ajax_delete_image', array($this, 'delete_image'));
200
- add_action('wp_ajax_assign_filters', array($this, 'assign_filters'));
201
- add_action('wp_ajax_assign_group', array($this, 'assign_group'));
202
- add_action('wp_ajax_toggle_visibility', array($this, 'toggle_visibility'));
203
- add_action('wp_ajax_refresh_gallery', array($this, 'refresh_gallery'));
204
- add_action('wp_ajax_get_gallery_configuration', array($this, 'get_configuration'));
205
- add_action('wp_ajax_update_gallery_configuration', array($this, 'update_configuration'));
206
- add_action('wp_ajax_get_image_size_url', array($this, 'get_image_size_url'));
207
-
208
- add_filter('mce_buttons', array($this, 'editor_button'));
209
- add_filter('mce_external_plugins', array($this, 'register_editor_plugin'));
210
- add_action('wp_ajax_ftg_shortcode_editor', array($this, 'ftg_shortcode_editor'));
211
-
212
- add_filter('plugin_row_meta', array($this, 'register_links'), 10, 2);
213
-
214
- add_action( 'wp_ajax_load_chunk', array($this, 'load_chunk') );
215
- add_action( 'wp_ajax_nopriv_load_chunk', array($this, 'load_chunk') );
216
-
217
- add_action( 'admin_notices', array( $this, 'review' ) );
218
- add_action( 'wp_ajax_ftg_dismiss_review', array( $this, 'dismiss_review' ) );
219
- add_filter( 'admin_footer_text', array( $this, 'admin_footer' ), 1, 2 );
220
-
221
- $this->resetFields();
222
- }
223
-
224
- public function review()
225
- {
226
- // Verify that we can do a check for reviews.
227
- $review = get_option( 'ftg_review' );
228
- $time = time();
229
- $load = false;
230
- $there_was_review = false;
231
-
232
- if ( ! $review ) {
233
- $review = array(
234
- 'time' => $time,
235
- 'dismissed' => false
236
- );
237
- $load = true;
238
- $there_was_review = false;
239
- } else {
240
- // Check if it has been dismissed or not.
241
- if ( (isset( $review['dismissed'] ) && ! $review['dismissed']) && (isset( $review['time'] ) && (($review['time'] + DAY_IN_SECONDS) <= $time)) ) {
242
- $load = true;
243
- }
244
- }
245
-
246
- // If we cannot load, return early.
247
- if ( ! $load ) {
248
- return;
249
- }
250
-
251
- // Update the review option now.
252
- update_option( 'ftg_review', $review );
253
-
254
- // Run through optins on the site to see if any have been loaded for more than a week.
255
- $valid = false;
256
- $galleries = $this->FinalTilesdb->getGalleries();
257
-
258
- if ( ! $galleries )
259
- {
260
- return;
261
- }
262
-
263
- $with_date = false;
264
- foreach ( $galleries as $gallery )
265
- {
266
- if(! isset($gallery->date))
267
- continue;
268
-
269
- $with_date = true;
270
- $data = $gallery->date;
271
-
272
- // Check the creation date of the local optin. It must be at least one week after.
273
- $created = isset( $data ) ? strtotime( $data ) + (7 * DAY_IN_SECONDS) : false;
274
- if ( ! $created ) {
275
- continue;
276
- }
277
-
278
- if ( $created <= $time ) {
279
- $valid = true;
280
- break;
281
- }
282
- }
283
-
284
- if(! $with_date && count($galleries) > 0 && ! $there_was_review)
285
- {
286
- $valid = true;
287
- }
288
-
289
- // If we don't have a valid optin yet, return.
290
- if ( ! $valid )
291
- {
292
- return;
293
- }
294
-
295
- // We have a candidate! Output a review message.
296
- ?>
297
- <div class="notice notice-info is-dismissible ftg-review-notice">
298
- <p><?php _e( 'Hey, I noticed you created a photo gallery with Final Tiles - that’s awesome! Would you mind give it a 5-star rating on WordPress to help us spread the word and boost our motivation for new featrues?', 'final-tiles-gallery-lite' ); ?></p>
299
- <p><strong><?php _e( 'Diego Imbriani<br>Founder of GreenTreeLabs', 'final-tiles-gallery' ); ?></strong></p>
300
- <p>
301
- <a href="https://wordpress.org/support/plugin/final-tiles-grid-gallery-lite/reviews/?filter=5#new-post" class="ftg-dismiss-review-notice ftg-review-out" target="_blank" rel="noopener"><?php _e( 'Ok, you deserve it', 'final-tiles-gallery-lite' ); ?></a><br>
302
- <a href="#" class="ftg-dismiss-review-notice" rel="noopener"><?php _e( 'Nope, maybe later', 'final-tiles-gallery' ); ?></a><br>
303
- <a href="#" class="ftg-dismiss-review-notice" rel="noopener"><?php _e( 'I already did', 'final-tiles-gallery' ); ?></a><br>
304
- </p>
305
- </div>
306
- <script type="text/javascript">
307
- jQuery(document).ready( function($) {
308
- $(document).on('click', '.ftg-dismiss-review-notice, .ftg-review-notice button', function( event ) {
309
- if ( ! $(this).hasClass('ftg-review-out') ) {
310
- event.preventDefault();
311
- }
312
-
313
- $.post( ajaxurl, {
314
- action: 'ftg_dismiss_review'
315
- });
316
-
317
- $('.ftg-review-notice').remove();
318
- });
319
- });
320
- </script>
321
- <?php
322
- }
323
-
324
- public function dismiss_review() {
325
-
326
- $review = get_option( 'ftg_review' );
327
- if ( ! $review ) {
328
- $review = array();
329
- }
330
-
331
- $review['time'] = time();
332
- $review['dismissed'] = true;
333
-
334
- update_option( 'ftg_review', $review );
335
- die;
336
- }
337
-
338
- public function admin_footer( $text )
339
- {
340
- global $current_screen;
341
- if ( !empty( $current_screen->id ) && strpos( $current_screen->id, 'ftg' ) !== false ) {
342
- $url = 'https://wordpress.org/support/plugin/final-tiles-grid-gallery-lite/reviews/?filter=5#new-post';
343
- $text = sprintf( __( 'Please rate <strong>Final Tiles Gallery</strong> <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> on <a href="%s" target="_blank">WordPress.org</a> to help us spread the word. Thank you from the Final Tiles Gallery team!', 'wpforms' ), $url, $url );
344
- }
345
- return $text;
346
- }
347
-
348
- public function gallery_admin_bar()
349
- {
350
- global $wp_admin_bar;
351
-
352
- $wp_admin_bar->add_menu( array(
353
- 'id' => 'ftg-upgrade-bar',
354
- 'href' => 'http://1.envato.market/c/288541/275988/4415?u=https%3A%2F%2Fcodecanyon.net%2Fitem%2Ffinal-tiles-wordpress-gallery%2F5189351',
355
- 'parent' => 'top-secondary',
356
- 'title' => __('Upgrade to Final Tiles Grid Gallery PRO'),
357
- 'meta' => array('class' => 'ftg-upgrade-to-pro', 'target' => '_blank' ),
358
- ) );
359
- }
360
-
361
-
362
- private function resetFields()
363
- {
364
- $keys = array('name', 'hiddenFor', 'type', 'description', 'default', 'min', 'max', 'mu', 'excludeFrom');
365
-
366
- foreach ($this->fields as $tab_name => $tab) {
367
- foreach ($tab["fields"] as $key => $field) {
368
- //print_r($field);
369
- foreach ($keys as $kk) {
370
- if (!array_key_exists($kk, $field)) {
371
- $this->fields[$tab_name]["fields"][$key][$kk] = "";
372
- }
373
- }
374
- }
375
-
376
- }
377
- //print_r($this->fields);
378
- }
379
-
380
- public function register_links($links, $file)
381
- {
382
- $base = plugin_basename(__FILE__);
383
- if ($file == $base) {
384
- $links[] = '<a href="admin.php?page=ftg-lite-gallery-admin" title="Final Tiles Grid Gallery Dashboard">Dashboard</a>';
385
- $links[] = '<a href="admin.php?page=support" title="Final Tiles Grid Gallery Support">Support</a>';
386
- $links[] = '<a href="https://twitter.com/greentreelabs" title="@GreenTreeLabs on Twitter">Twitter</a>';
387
- $links[] = '<a href="https://www.facebook.com/greentreelabs" title="GreenTreeLabs on Facebook">Facebook</a>';
388
- $links[] = '<a href="https://www.google.com/+GreentreelabsNetjs" title="GreenTreeLabs on Google+">Google+</a>';
389
- }
390
- return $links;
391
-
392
- }
393
-
394
- public function create_db_tables()
395
- {
396
- include_once(WP_PLUGIN_DIR . '/final-tiles-grid-gallery-lite/lib/install-db.php');
397
- install_db();
398
- }
399
-
400
- public function activation()
401
- {
402
-
403
- }
404
-
405
- //Define textdomain
406
- public function create_textdomain()
407
- {
408
- $plugin_dir = basename(dirname(__FILE__));
409
- load_plugin_textdomain('final-tiles-gallery', false, dirname(plugin_basename(__FILE__)) . '/lib/languages/');
410
- }
411
-
412
- //Define constants
413
- public function define_constants()
414
- {
415
- if (!defined('FINALTILESGALLERYLITE_PLUGIN_BASENAME'))
416
- define('FINALTILESGALLERYLITE_PLUGIN_BASENAME', plugin_basename(__FILE__));
417
-
418
- if (!defined('FINALTILESGALLERYLITE_PLUGIN_NAME'))
419
- define('FINALTILESGALLERYLITE_PLUGIN_NAME', trim(dirname(FINALTILESGALLERYLITE_PLUGIN_BASENAME), '/'));
420
-
421
- if (!defined('FINALTILESGALLERYLITE_PLUGIN_DIR'))
422
- define('FINALTILESGALLERYLITE_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . FINALTILESGALLERYLITE_PLUGIN_NAME);
423
- }
424
-
425
- //Define DB tables
426
- public function define_db_tables()
427
- {
428
- global $wpdb;
429
-
430
- $wpdb->FinalTilesGalleries = $wpdb->prefix . 'FinalTiles_gallery';
431
- $wpdb->FinalTilesImages = $wpdb->prefix . 'FinalTiles_gallery_images';
432
- }
433
-
434
-
435
- public function create_db_conn()
436
- {
437
- require('lib/db-class.php');
438
- $FinalTilesdb = FinalTilesLiteDB::getInstance();
439
- return $FinalTilesdb;
440
- }
441
-
442
- public function editor_button($buttons)
443
- {
444
- array_push($buttons, 'separator', 'ftg_shortcode_editor');
445
- return $buttons;
446
- }
447
-
448
- public function register_editor_plugin($plugin_array)
449
- {
450
- $plugin_array['ftg_shortcode_editor'] = plugins_url('/admin/scripts/editor-plugin.js', __file__);
451
- return $plugin_array;
452
- }
453
-
454
- public function ftg_shortcode_editor()
455
- {
456
- $css_path = plugins_url('assets/css/admin.css', __FILE__);
457
- $admin_url = admin_url();
458
-
459
- $galleries = $this->FinalTilesdb->getGalleries(); //load all galleries
460
-
461
- include 'admin/include/tinymce-galleries.php';
462
- wp_die();
463
- }
464
-
465
- public function attachment_fields_to_edit($form, $post)
466
- {
467
- $form["ftg_link"] = array(
468
- "label" => "Link <small>FTG</small>",
469
- "input" => "text",
470
- "value" => get_post_meta($post->ID, "_ftg_link", true),
471
- "helps" => ""
472
- );
473
- $form["ftg_target"] = array(
474
- "label" => "_blank <small>FTG</small>",
475
- "input" => "html",
476
- "html" =>
477
- "<input type='checkbox' name='attachments[{$post->ID}][ftg_target]' id='attachments[{$post->ID}][ftg_target]' value='_mblank' " .
478
- (get_post_meta($post->ID, "_ftg_target", true) == "_mblank" ? "checked" : "")
479
- . " />"
480
- );
481
- return $form;
482
- }
483
-
484
- public function attachment_fields_to_save($post, $attachment)
485
- {
486
- if (isset($attachment['ftg_link'])) {
487
- update_post_meta($post['ID'], '_ftg_link', $attachment['ftg_link']);
488
- }
489
- if (isset($attachment['ftg_target'])) {
490
- update_post_meta($post['ID'], '_ftg_target', $attachment['ftg_target']);
491
- }
492
- return $post;
493
- }
494
-
495
- //Delete gallery
496
- public function delete_gallery()
497
- {
498
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery')) {
499
- $this->FinalTilesdb->deleteGallery(intval($_POST['id']));
500
- }
501
- exit();
502
- }
503
-
504
-
505
- public function update_configuration()
506
- {
507
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery'))
508
- {
509
- $id = $_POST['galleryId'];
510
-
511
- $config = stripslashes($_POST['config']);
512
-
513
- $this->FinalTilesdb->update_config($id, $config);
514
- }
515
- exit();
516
- }
517
-
518
- public function get_configuration()
519
- {
520
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery'))
521
- {
522
- $id = $_POST['galleryId'];
523
-
524
- $gallery = $this->FinalTilesdb->getGalleryConfig($id);
525
-
526
- echo $gallery;
527
- }
528
- exit();
529
- }
530
-
531
- public function get_image_size_url()
532
- {
533
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery'))
534
- {
535
- echo wp_get_attachment_image_url($_POST['id'], $_POST['size'], false);
536
- }
537
- exit();
538
- }
539
-
540
- //Clone gallery
541
- public function clone_gallery()
542
- {
543
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery'))
544
- {
545
- $sourceId = intval($_POST['id']);
546
- $g = $this->FinalTilesdb->getGalleryById($sourceId, true);
547
- $g['name'] .= " (copy)";
548
- $this->FinalTilesdb->addGallery($g);
549
- $id = $this->FinalTilesdb->getNewGalleryId();
550
- $images = $this->FinalTilesdb->getImagesByGalleryId($sourceId);
551
- foreach ($images as &$image) {
552
- $image->Id = null;
553
- $image->gid = $id;
554
- }
555
- $this->FinalTilesdb->addImages($id, $images);
556
- }
557
- exit();
558
- }
559
-
560
- //Add gallery scripts
561
- public function add_gallery_scripts()
562
- {
563
- wp_enqueue_script('jquery');
564
-
565
- wp_register_script('finalTilesGallery', plugins_url() . '/final-tiles-grid-gallery-lite/scripts/script.js', array('jquery'), FTGLITEVERSION);
566
- wp_enqueue_script('finalTilesGallery');
567
-
568
-
569
- wp_register_style('finalTilesGallery_stylesheet', plugins_url() . '/final-tiles-grid-gallery-lite/scripts/ftg.css', array(), FTGLITEVERSION);
570
- wp_enqueue_style('finalTilesGallery_stylesheet');
571
-
572
- wp_register_script('lightbox2_script', plugins_url() . '/final-tiles-grid-gallery-lite/lightbox/lightbox2/js/script.js', array('jquery'));
573
- wp_register_style('lightbox2_stylesheet', plugins_url() . '/final-tiles-grid-gallery-lite/lightbox/lightbox2/css/style.css');
574
-
575
- wp_register_style('fontawesome_stylesheet', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css');
576
- wp_enqueue_style('fontawesome_stylesheet');
577
- }
578
-
579
- //Admin Section - register scripts and styles
580
- public function gallery_admin_init()
581
- {
582
- if (function_exists('wp_enqueue_media')) {
583
- wp_enqueue_media();
584
- }
585
-
586
- $ftg_db_version = '5.0';
587
- $installed_ver = get_option("FinalTiles_gallery_db_version");
588
-
589
- if (!$installed_ver) {
590
- update_option("FinalTiles_gallery_db_version", $ftg_db_version);
591
- }
592
-
593
- $this->FinalTilesdb->updateConfiguration();
594
-
595
- if ($installed_ver != $ftg_db_version) {
596
- $this->create_db_tables();
597
- update_option("FinalTiles_gallery_db_version", $ftg_db_version);
598
- }
599
-
600
- function ftg_lite_get_image_sizes()
601
- {
602
- global $_wp_additional_image_sizes;
603
-
604
- $sizes = array();
605
-
606
- foreach ( get_intermediate_image_sizes() as $_size ) {
607
- if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
608
- $sizes[ $_size ]['width'] = get_option( "{$_size}_size_w" );
609
- $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
610
- $sizes[ $_size ]['crop'] = (bool) get_option( "{$_size}_crop" );
611
- } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
612
- $sizes[ $_size ] = array(
613
- 'width' => $_wp_additional_image_sizes[ $_size ]['width'],
614
- 'height' => $_wp_additional_image_sizes[ $_size ]['height'],
615
- 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'],
616
- );
617
- }
618
- }
619
-
620
- return $sizes;
621
- }
622
-
623
- foreach(ftg_lite_get_image_sizes() as $name => $size)
624
- $this->fields["Links & Lightbox"]["fields"]["lightboxImageSize"]["values"]["Size"] []= $name . "|" . $name . " (" . $size['width'].'x'.$size['height'] . ($size['crop'] ? ' cropped)':')');
625
-
626
- $this->fields["Links & Lightbox"]["fields"]["lightboxImageSize"]["values"]["Size"] []= "full|Original (full)";
627
-
628
- wp_enqueue_script('jquery');
629
- wp_enqueue_script('jquery-ui-dialog');
630
- wp_enqueue_script('jquery-ui-sortable');
631
-
632
- wp_enqueue_script('wp-color-picker');
633
- wp_enqueue_style('wp-color-picker');
634
-
635
- wp_enqueue_script('media-upload');
636
- wp_enqueue_script('thickbox');
637
-
638
- wp_register_style('google-fonts', '//fonts.googleapis.com/css?family=Roboto:400,700,500,300,900');
639
- wp_enqueue_style('google-fonts');
640
- wp_register_style('google-icons', '//cdn.materialdesignicons.com/1.1.34/css/materialdesignicons.min.css', array());
641
- wp_enqueue_style('google-icons');
642
-
643
- wp_register_style('final-tiles-grid-gallery-lite-admin', plugins_url() . '/final-tiles-grid-gallery-lite/admin/css/style.css', array('colors'));
644
- wp_enqueue_style('final-tiles-grid-gallery-lite-admin');
645
-
646
- wp_register_script('materialize', plugins_url() . '/final-tiles-grid-gallery-lite/admin/scripts/materialize.min.js', array('jquery'));
647
- wp_enqueue_script('materialize');
648
-
649
- wp_register_script('final-tiles-grid-gallery-lite', plugins_url() . '/final-tiles-grid-gallery-lite/admin/scripts/final-tiles-grid-gallery-lite-admin.js', array('jquery', 'media-upload', 'thickbox', 'materialize'));
650
- wp_enqueue_script('final-tiles-grid-gallery-lite');
651
-
652
- wp_enqueue_style('thickbox');
653
-
654
- wp_register_style('fontawesome_stylesheet', '//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css');
655
- wp_enqueue_style('fontawesome_stylesheet');
656
- }
657
-
658
- //Create Admin Menu
659
- public function add_gallery_admin_menu()
660
- {
661
- $overview = add_menu_page('Final Tiles Gallery', 'Final Tiles Gallery', 'edit_posts', 'ftg-lite-gallery-admin', array($this, 'add_overview'), plugins_url() . '/final-tiles-grid-gallery-lite/admin/icon.png');
662
- $add_gallery = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> Add Gallery', 'FinalTiles-gallery'), __('Add Gallery', 'FinalTiles-gallery'), 'edit_posts', 'ftg-lite-add-gallery', array($this, 'add_gallery'));
663
- $tutorial = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> Tutorial', 'FinalTiles-gallery'), __('Tutorial', 'FinalTiles-gallery'), 'edit_posts', 'ftg-lite-tutorial', array($this, 'tutorial'));
664
- $support = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> Support', 'FinalTiles-gallery'), __('Support', 'FinalTiles-gallery'), 'edit_posts', 'ftg-lite-support', array($this, 'support'));
665
- $upgrade = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> Upgrade','FinalTiles-gallery'), __('<span style="color:#7cc048">Upgrade</span>','FinalTiles-gallery'), 'edit_posts', 'ftg-lite-gallery-upgrade', array($this, 'upgrade'));
666
-
667
- add_action('load-' . $tutorial, array($this, 'gallery_admin_init'));
668
- add_action('load-' . $overview, array($this, 'gallery_admin_init'));
669
- add_action('load-' . $add_gallery, array($this, 'gallery_admin_init'));
670
- add_action('load-' . $support, array($this, 'gallery_admin_init'));
671
- add_action('load-'.$upgrade, array($this, 'gallery_admin_init'));
672
-
673
- add_action( 'admin_bar_menu', array($this, 'gallery_admin_bar'), 100);
674
- }
675
-
676
- //Create Admin Pages
677
- public function add_overview()
678
- {
679
- global $ftg_fields;
680
- $ftg_fields = $this->fields;
681
-
682
- global $ftg_parent_page;
683
- $ftg_parent_page = "dashboard";
684
-
685
- if (array_key_exists("id", $_GET)) {
686
- include("admin/edit-gallery.php");
687
- } else {
688
- include("admin/overview.php");
689
- }
690
- }
691
-
692
- public function upgrade()
693
- {
694
- include("admin/upgrade.php");
695
- }
696
-
697
- public function other_galleries()
698
- {
699
- include("admin/galleries.php");
700
- }
701
-
702
- public function tutorial()
703
- {
704
- include("admin/tutorial.php");
705
- }
706
-
707
- public function support()
708
- {
709
- include("admin/support.php");
710
- }
711
-
712
- public function add_gallery()
713
- {
714
- global $ftg_fields;
715
- $ftg_fields = $this->fields;
716
- $gallery = null;
717
-
718
- include("admin/add-gallery.php");
719
- }
720
-
721
- public function delete_image()
722
- {
723
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery')) {
724
- foreach (explode(",", $_POST["id"]) as $id) {
725
- $this->FinalTilesdb->deleteImage(intval($id));
726
- }
727
- }
728
- wp_die();
729
- }
730
-
731
- public function toggle_visibility()
732
- {
733
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery'))
734
- {
735
- foreach (explode(",", $_POST["id"]) as $id)
736
- {
737
- $image = $this->FinalTilesdb->getImage($id);
738
- $this->FinalTilesdb->editImage($id, array("hidden" => $image->hidden == 'T' ? 'F' : 'T'));
739
- }
740
- }
741
- wp_die();
742
- }
743
-
744
- public function add_image()
745
- {
746
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery')) {
747
- $gid = intval($_POST['galleryId']);
748
- $enc_images = stripslashes($_POST["enc_images"]);
749
- $images = json_decode($enc_images);
750
-
751
- $result = $this->FinalTilesdb->addImages($gid, $images);
752
-
753
- header("Content-type: application/json");
754
- if ($result === false) {
755
- echo "{\"success\":false}";
756
- } else {
757
- echo "{\"success\":true}";
758
- }
759
- }
760
- wp_die();
761
- }
762
-
763
- public function list_thumbnail_sizes()
764
- {
765
- global $_wp_additional_image_sizes;
766
- $sizes = array();
767
- foreach (get_intermediate_image_sizes() as $s)
768
- {
769
- if (in_array($s, array('thumbnail', 'medium', 'large'))) {
770
- $sizes[$s][0] = get_option($s . '_size_w');
771
- $sizes[$s][1] = get_option($s . '_size_h');
772
- }
773
- else
774
- {
775
- if (isset($_wp_additional_image_sizes) &&
776
- isset($_wp_additional_image_sizes[$s]) &&
777
- $_wp_additional_image_sizes[$s]['width'] > 0 &&
778
- $_wp_additional_image_sizes[$s]['height'] > 0
779
- )
780
- {
781
- $sizes[$s] = array($_wp_additional_image_sizes[$s]['width'], $_wp_additional_image_sizes[$s]['height']);
782
- }
783
- }
784
- }
785
-
786
- return $sizes;
787
- }
788
-
789
- public function sort_images()
790
- {
791
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery')) {
792
- $result = $this->FinalTilesdb->sortImages(explode(',', $_POST['ids']));
793
-
794
- header("Content-type: application/json");
795
- if ($result === false) {
796
- echo "{\"success\":false}";
797
- } else {
798
- echo "{\"success\":true}";
799
- }
800
- }
801
- wp_die();
802
- }
803
-
804
- public function load_chunk()
805
- {
806
- require_once('lib/gallery-class.php');
807
-
808
- if (check_admin_referer('finaltilesgallery', 'finaltilesgallery'))
809
- {
810
- $gid = intval($_POST["gallery"]);
811
- $images = $this->FinalTilesdb->getImagesByGalleryId($gid);
812
-
813
- $FinalTilesGallery = new FinalTilesGalleryLite($gid, $this->FinalTilesdb, $this->defaultValues);
814
- echo $FinalTilesGallery->images_markup();
815
- }
816
- wp_die();
817
- }
818
-
819
- public function refresh_gallery()
820
- {
821
- $this->list_images();
822
- }
823
-
824
- public function save_image()
825
- {
826
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery')) {
827
- $result = false;
828
-
829
- if ($_POST['source'] == 'posts') {
830
- $result = true;
831
- $postId = intval($_POST['post_id']);
832
- $img_url = stripslashes($_POST['img_url']);
833
- update_post_meta($postId, 'ftg_image_url', $img_url);
834
- if (array_key_exists("filters", $_POST) && strlen($_POST['filters'])) {
835
- update_post_meta($postId, 'ftg_filters', $_POST['filters']);
836
- }
837
- } else {
838
- $type = $_POST['type'];
839
- $imageUrl = stripslashes($_POST['img_url']);
840
- $imageCaption = stripslashes($_POST['description']);
841
- $filters = stripslashes($_POST['filters']);
842
- $title = stripslashes($_POST['imageTitle']);
843
- $target = $_POST['target'];
844
- $group = $_POST['group'];
845
- $hidden = $_POST['hidden'];
846
- $link = isset($_POST['link']) ? stripslashes($_POST['link']) : null;
847
- $imageId = intval($_POST['img_id']);
848
- $sortOrder = intval($_POST['sortOrder']);
849
-
850
- $data = array("imagePath" => $imageUrl,
851
- "target" => $target,
852
- "link" => $link,
853
- "imageId" => $imageId,
854
- "description" => $imageCaption,
855
- "filters" => $filters,
856
- "title" => $title,
857
- "group" => $group,
858
- "hidden" => $hidden,
859
- "sortOrder" => $sortOrder);
860
-
861
- if (!empty($_POST["id"])) {
862
- $imageId = intval($_POST['id']);
863
- $result = $this->FinalTilesdb->editImage($imageId, $data);
864
- } else {
865
- $data["gid"] = intval($_POST['galleryId']);
866
- $result = $this->FinalTilesdb->addFullImage($data);
867
- }
868
- }
869
- header("Content-type: application/json");
870
-
871
- if ($result === false) {
872
- echo "{\"success\":false}";
873
- } else {
874
- echo "{\"success\":true}";
875
- }
876
- }
877
- wp_die();
878
- }
879
-
880
- public function list_images()
881
- {
882
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery')) {
883
- $gid = intval($_POST["gid"]);
884
- $imageResults = $this->FinalTilesdb->getImagesByGalleryId($gid);
885
- $gallery = $this->FinalTilesdb->getGalleryById($gid);
886
-
887
- $list_size = "medium";
888
- $column_size = "s6 m3 l3";
889
-
890
- if (isset($_POST['list_size']) && !empty($_POST['list_size'])) {
891
- $list_size = $_POST['list_size'];
892
- }
893
-
894
- setcookie('ftg_imglist_size', $list_size);
895
- $_COOKIE['ftg_imglist_size'] = $list_size;
896
-
897
- if ($list_size == 'small')
898
- $column_size = 's4 m2 l2';
899
- if ($list_size == 'medium')
900
- $column_size = 's6 m3 l3';
901
- if ($list_size == 'big')
902
- $column_size = 's12 m4 l4';
903
-
904
- include('admin/include/image-list.php');
905
- }
906
- wp_die();
907
- }
908
-
909
- public function add_new_gallery()
910
- {
911
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery')) {
912
- $data = $this->defaultValues;
913
-
914
- $data["date"] = date("Y-m-d");
915
- $data["name"] = $_POST['ftg_name'];
916
- $data["description"] = $_POST['ftg_description'];
917
- $data["source"] = $_POST['ftg_source'];
918
- $data["wp_field_caption"] = $_POST['ftg_wp_field_caption'];
919
- $data["wp_field_title"] = $_POST['ftg_wp_field_title'];
920
- $data["captionEffect"] = $_POST['ftg_captionEffect'];
921
- $data["post_categories"] = $_POST["post_categories"];
922
- $data["post_tags"] = $_POST["post_tags"];
923
- $data["layout"] = $_POST["layout"];
924
- $data["defaultWooImageSize"] = $_POST['def_imgsize'];
925
- $data["defaultPostImageSize"] = $_POST['def_imgsize'];
926
- $data["woo_categories"] = $_POST["woo_categories"];
927
-
928
- $result = $this->FinalTilesdb->addGallery($data);
929
- $id = $this->FinalTilesdb->getNewGalleryId();
930
-
931
- if ($id > 0 && array_key_exists('enc_images', $_POST) && strlen($_POST['enc_images'])) {
932
- $enc_images = stripslashes($_POST["enc_images"]);
933
- $images = json_decode($enc_images);
934
- $result = $this->FinalTilesdb->addImages($id, $images);
935
- }
936
-
937
- echo $id;
938
- } else {
939
- echo -1;
940
- }
941
- wp_die();
942
- }
943
-
944
- private function checkboxVal($field)
945
- {
946
- if (isset($_POST[$field]))
947
- return 'T';
948
-
949
- return 'F';
950
- }
951
-
952
- public function save_gallery()
953
- {
954
- if (check_admin_referer('FinalTiles_gallery', 'FinalTiles_gallery')) {
955
- $galleryName = stripslashes($_POST['ftg_name']);
956
- $galleryDescription = stripslashes($_POST['ftg_description']);
957
- $slug = strtolower(str_replace(" ", "", $galleryName));
958
- $margin = intval($_POST['ftg_margin']);
959
- $minTileWidth = intval($_POST['ftg_minTileWidth']);
960
- $gridCellSize = intval($_POST['ftg_gridCellSize']);
961
- $imagesOrder = $_POST['ftg_imagesOrder'];
962
- $width = $_POST['ftg_width'];
963
- $enableTwitter = $this->checkboxVal('ftg_enableTwitter');
964
- $filterClick = $this->checkboxVal('ftg_filterClick');
965
- $enableFacebook = $this->checkboxVal('ftg_enableFacebook');
966
- $enableGplus = $this->checkboxVal('ftg_enableGplus');
967
- $enablePinterest = $this->checkboxVal('ftg_enablePinterest');
968
- $lightbox = $_POST['ftg_lightbox'];
969
- $mobileLightbox = $_POST['ftg_mobileLightbox'];
970
- $blank = $this->checkboxVal('ftg_blank');
971
- $filters = $_POST['ftg_filters'];
972
-
973
- $scrollEffect = $_POST['ftg_scrollEffect'];
974
- $captionBehavior = $_POST['ftg_captionBehavior'];
975
- $captionMobileBehavior = $_POST['ftg_captionMobileBehavior'];
976
- $captionEffect = $_POST['ftg_captionEffect'];
977
- $captionColor = $_POST['ftg_captionColor'];
978
- $captionBackgroundColor = $_POST['ftg_captionBackgroundColor'];
979
- $captionEasing = $_POST['ftg_captionEasing'];
980
- $captionHorizontalAlignment = $_POST['ftg_captionHorizontalAlignment'];
981
- $captionVerticalAlignment = $_POST['ftg_captionVerticalAlignment'];
982
- $captionEmpty = $_POST['ftg_captionEmpty'];
983
- $captionOpacity = intval($_POST['ftg_captionOpacity']);
984
- $borderSize = intval($_POST['ftg_borderSize']);
985
- $borderColor = $_POST['ftg_borderColor'];
986
- $titleFontSize = intval($_POST['ftg_titleFontSize']);
987
- $loadingBarColor = $_POST['ftg_loadingBarColor'];
988
- $loadingBarBackgroundColor = $_POST['ftg_loadingBarBackgroundColor'];
989
- $borderRadius = intval($_POST['ftg_borderRadius']);
990
- $allFilterLabel = $_POST['ftg_allFilterLabel'];
991
- $shadowColor = $_POST['ftg_shadowColor'];
992
- $shadowSize = intval($_POST['ftg_shadowSize']);
993
- $enlargeImages = $this->checkboxVal('ftg_enlargeImages');
994
- $wp_field_caption = $_POST['ftg_wp_field_caption'];
995
- $wp_field_title = $_POST['ftg_wp_field_title'];
996
- $style = $_POST['ftg_style'];
997
- $script = $_POST['ftg_script'];
998
- $loadedScale = intval($_POST['ftg_loadedScale']);
999
- $loadedRotate = intval($_POST['ftg_loadedRotate']);
1000
- $loadedHSlide = intval($_POST['ftg_loadedHSlide']);
1001
- $loadedVSlide = intval($_POST['ftg_loadedVSlide']);
1002
-
1003
- $captionEffectDuration = intval($_POST['ftg_captionEffectDuration']);
1004
- $id = isset($_POST['ftg_gallery_edit']) ? intval($_POST['ftg_gallery_edit']) : 0;
1005
-
1006
- $data = array(
1007
- 'ajaxLoading' => $_POST['ftg_ajaxLoading'],
1008
- 'layout' => $_POST['ftg_layout'],
1009
- 'name' => $galleryName,
1010
- 'slug' => $slug,
1011
- 'description' => $galleryDescription,
1012
- 'lightbox' => $lightbox,
1013
- 'mobileLightbox' => $mobileLightbox,
1014
- 'lightboxImageSize' => $_POST['ftg_lightboxImageSize'],
1015
- 'blank' => $blank,
1016
- 'margin' => $margin,
1017
- 'allFilterLabel' => $allFilterLabel,
1018
- 'minTileWidth' => $minTileWidth,
1019
- 'gridCellSize' => $gridCellSize,
1020
- 'enableTwitter' => $enableTwitter,
1021
- 'backgroundColor' => $_POST['ftg_backgroundColor'],
1022
- 'filterClick' => $filterClick,
1023
- 'disableLightboxGroups' => $this->checkboxVal('ftg_disableLightboxGroups'),
1024
- 'defaultFilter' => $_POST['ftg_filterDef'],
1025
- 'enableFacebook' => $enableFacebook,
1026
- 'enableGplus' => $enableGplus,
1027
- 'enablePinterest' => $enablePinterest,
1028
- 'imagesOrder' => $imagesOrder,
1029
- 'compressHTML' => $this->checkboxVal('ftg_compressHTML'),
1030
- 'loadMethod' => $_POST['ftg_loadMethod'],
1031
- 'socialIconColor' => $_POST['ftg_socialIconColor'],
1032
- 'recentPostsCaption' => $_POST['ftg_recentPostsCaption'],
1033
- 'recentPostsCaptionAutoExcerptLength' => intval($_POST['ftg_recentPostsCaptionAutoExcerptLength']),
1034
- 'captionBehavior' => $captionBehavior,
1035
- 'captionEffect' => $captionEffect,
1036
- 'captionEmpty' => $captionEmpty,
1037
- 'captionFullHeight' => $this->checkboxVal('ftg_captionFullHeight'),
1038
- 'captionBackgroundColor' => $captionBackgroundColor,
1039
- 'captionColor' => $captionColor,
1040
- 'captionFrameColor' => $_POST['ftg_captionFrameColor'],
1041
- 'captionEffectDuration' => $captionEffectDuration,
1042
- 'captionEasing' => $captionEasing,
1043
- 'captionVerticalAlignment' => $captionVerticalAlignment,
1044
- 'captionHorizontalAlignment' => $captionHorizontalAlignment,
1045
- 'captionMobileBehavior' => $captionMobileBehavior,
1046
- 'captionOpacity' => $captionOpacity,
1047
- 'captionIcon' => $_POST['ftg_captionIcon'],
1048
- 'captionFrame' => $this->checkboxVal('ftg_captionFrame'),
1049
- 'customCaptionIcon' => $_POST['ftg_customCaptionIcon'],
1050
- 'captionIconColor' => $_POST['ftg_captionIconColor'],
1051
- 'captionIconSize' => intval($_POST['ftg_captionIconSize']),
1052
- 'captionFontSize' => intval($_POST['ftg_captionFontSize']),
1053
- 'captionPosition' => $_POST['ftg_captionPosition'],
1054
- 'titleFontSize' => intval($_POST['ftg_titleFontSize']),
1055
- 'hoverZoom' => intval($_POST['ftg_hoverZoom']),
1056
- 'hoverRotation' => intval($_POST['ftg_hoverRotation']),
1057
- 'hoverIconRotation' => $this->checkboxVal('ftg_hoverIconRotation'),
1058
- 'filters' => $filters,
1059
- 'wp_field_caption' => $wp_field_caption,
1060
- 'wp_field_title' => $wp_field_title,
1061
- 'borderSize' => $borderSize,
1062
- 'borderColor' => $borderColor,
1063
- 'loadingBarColor' => $loadingBarColor,
1064
- 'loadingBarBackgroundColor' => $loadingBarBackgroundColor,
1065
- 'enlargeImages' => $enlargeImages,
1066
- 'borderRadius' => $borderRadius,
1067
- 'imageSizeFactor' => intval($_POST['ftg_imageSizeFactor']),
1068
- 'imageSizeFactorTabletLandscape' => intval($_POST['ftg_imageSizeFactorTabletLandscape']),
1069
- 'imageSizeFactorTabletPortrait' => intval($_POST['ftg_imageSizeFactorTabletPortrait']),
1070
- 'imageSizeFactorPhoneLandscape' => intval($_POST['ftg_imageSizeFactorPhoneLandscape']),
1071
- 'imageSizeFactorPhonePortrait' => intval($_POST['ftg_imageSizeFactorPhonePortrait']),
1072
- 'imageSizeFactorCustom' => $_POST['ftg_imageSizeFactorCustom'],
1073
-
1074
- 'columns' => intval($_POST['ftg_columns']),
1075
- 'columnsTabletLandscape' => intval($_POST['ftg_columnsTabletLandscape']),
1076
- 'columnsTabletPortrait' => intval($_POST['ftg_columnsTabletPortrait']),
1077
- 'columnsPhoneLandscape' => intval($_POST['ftg_columnsPhoneLandscape']),
1078
- 'columnsPhonePortrait' => intval($_POST['ftg_columnsPhonePortrait']),
1079
-
1080
- 'max_posts' => intval($_POST['ftg_max_posts']),
1081
-
1082
- 'shadowSize' => $shadowSize,
1083
- 'shadowColor' => $shadowColor,
1084
- 'source' => $_POST['ftg_source'],
1085
- 'post_types' => $_POST['ftg_post_types'],
1086
- 'post_categories' => $_POST['ftg_post_categories'],
1087
- 'post_tags' => $_POST['ftg_post_tags'],
1088
- 'tilesPerPage' => intval($_POST['ftg_tilesPerPage']),
1089
- 'woo_categories' => isset($_POST['ftg_woo_categories']) ? $_POST['ftg_woo_categories'] : '',
1090
- 'defaultPostImageSize' => $_POST['ftg_defaultPostImageSize'],
1091
- 'defaultWooImageSize' => isset($_POST['ftg_defaultWooImageSize']) ? $_POST['ftg_defaultWooImageSize'] : '',
1092
- 'width' => $width,
1093
- 'beforeGalleryText' => $_POST['ftg_beforeGalleryText'],
1094
- 'afterGalleryText' => $_POST['ftg_afterGalleryText'],
1095
- 'aClass' => $_POST['ftg_aClass'],
1096
- 'rel' => $_POST['ftg_rel'],
1097
- 'style' => $style,
1098
- 'delay' => intval($_POST['ftg_delay']),
1099
- 'script' => $script,
1100
- 'support' => $this->checkboxVal('ftg_support'),
1101
- 'supportText' => $_POST['ftg_supportText'],
1102
- 'envatoReferral' => $_POST['ftg_envatoReferral'],
1103
- 'scrollEffect' => $scrollEffect,
1104
- 'loadedScale' => $loadedScale,
1105
- 'loadedRotate' => $loadedRotate,
1106
- 'loadedHSlide' => $loadedHSlide,
1107
- 'loadedVSlide' => $loadedVSlide
1108
- );
1109
-
1110
- header("Content-type: application/json");
1111
- if ($id > 0) {
1112
- $result = $this->FinalTilesdb->editGallery($id, $data);
1113
- } else {
1114
- $result = $this->FinalTilesdb->addGallery($data);
1115
- $id = $this->FinalTilesdb->getNewGalleryId();
1116
- }
1117
-
1118
- if ($result)
1119
- echo "{\"success\":true,\"id\":" . $id . "}";
1120
- else
1121
- echo "{\"success\":false}";
1122
- }
1123
-
1124
- wp_die();
1125
- }
1126
-
1127
- public static function get_image_size_links($id)
1128
- {
1129
- $result = array();
1130
- $sizes = get_intermediate_image_sizes();
1131
- $sizes[] = 'full';
1132
-
1133
- foreach ($sizes as $size) {
1134
- $image = wp_get_attachment_image_src($id, $size);
1135
-
1136
- if (!empty($image) && (true == $image[3] || 'full' == $size))
1137
- $result["$image[1]x$image[2]"] = $image[0];
1138
- }
1139
- ksort($result);
1140
- return $result;
1141
- }
1142
-
1143
- //Create gallery
1144
- public function create_gallery($galleryId)
1145
- {
1146
- require_once('lib/gallery-class.php');
1147
- global $FinalTilesGallery;
1148
-
1149
- if (class_exists('FinalTilesGalleryLite')) {
1150
- $FinalTilesGallery = new FinalTilesGalleryLite($galleryId, $this->FinalTilesdb, $this->defaultValues);
1151
- $settings = $FinalTilesGallery->getGallery();
1152
-
1153
- switch ($settings->lightbox) {
1154
- case "magnific":
1155
- wp_enqueue_style('magnific_stylesheet');
1156
- wp_enqueue_script('magnific_script');
1157
- break;
1158
- case "prettyphoto":
1159
- wp_enqueue_style('prettyphoto_stylesheet');
1160
- wp_enqueue_script('prettyphoto_script');
1161
- break;
1162
- case "fancybox":
1163
- wp_enqueue_style('fancybox_stylesheet');
1164
- wp_enqueue_script('fancybox_script');
1165
- break;
1166
- case "colorbox":
1167
- wp_enqueue_style('colorbox_stylesheet');
1168
- wp_enqueue_script('colorbox_script');
1169
- break;
1170
- case "swipebox":
1171
- wp_enqueue_style('swipebox_stylesheet');
1172
- wp_enqueue_script('swipebox_script');
1173
- break;
1174
- case "lightbox2":
1175
- wp_enqueue_style('lightbox2_stylesheet');
1176
- wp_enqueue_script('lightbox2_script');
1177
- break;
1178
- case "image-lightbox":
1179
- wp_enqueue_script('image-lightbox_script');
1180
- case "lightgallery":
1181
- wp_enqueue_style('lightgallery_stylesheet');
1182
- wp_enqueue_script('lightgallery_script');
1183
- break;
1184
- }
1185
-
1186
- switch ($settings->mobileLightbox) {
1187
- default:
1188
- case "magnific":
1189
- wp_enqueue_style('magnific_stylesheet');
1190
- wp_enqueue_script('magnific_script');
1191
- break;
1192
- case "prettyphoto":
1193
- wp_enqueue_style('prettyphoto_stylesheet');
1194
- wp_enqueue_script('prettyphoto_script');
1195
- break;
1196
- case "fancybox":
1197
- wp_enqueue_style('fancybox_stylesheet');
1198
- wp_enqueue_script('fancybox_script');
1199
- break;
1200
- case "colorbox":
1201
- wp_enqueue_style('colorbox_stylesheet');
1202
- wp_enqueue_script('colorbox_script');
1203
- break;
1204
- case "swipebox":
1205
- wp_enqueue_style('swipebox_stylesheet');
1206
- wp_enqueue_script('swipebox_script');
1207
- break;
1208
- case "lightbox2":
1209
- wp_enqueue_style('lightbox2_stylesheet');
1210
- wp_enqueue_script('lightbox2_script');
1211
- break;
1212
- case "image-lightbox":
1213
- wp_enqueue_script('image-lightbox_script');
1214
- case "lightgallery":
1215
- wp_enqueue_style('lightgallery_stylesheet');
1216
- wp_enqueue_script('lightgallery_script');
1217
- break;
1218
- }
1219
-
1220
- return $FinalTilesGallery->render();
1221
- } else {
1222
- return "Gallery not found.";
1223
- }
1224
- }
1225
-
1226
- //Create Short Code
1227
- public function gallery_shortcode_handler($atts)
1228
- {
1229
- return $this->create_gallery($atts['id']);
1230
- }
1231
-
1232
- static public function slugify($text)
1233
- {
1234
- $text = preg_replace('~[^\\pL\d]+~u', '-', $text);
1235
- $text = trim($text, '-');
1236
- if(function_exists("iconv"))
1237
- $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
1238
- $text = strtolower($text);
1239
- $text = preg_replace('~[^-\w]+~', '', $text);
1240
-
1241
- if (empty($text)) {
1242
- return 'n-a';
1243
- }
1244
-
1245
- return $text;
1246
- }
1247
-
1248
- var $fields = array(
1249
-
1250
- "General" => array(
1251
- "icon" => "mdi-settings",
1252
- "fields" => array(
1253
- "name" => array(
1254
- "name" => "Name",
1255
- "hiddenFor" => array("dashboard", "shortcode"),
1256
- "type" => "text",
1257
- "description" => "Name of the gallery, for internal use.",
1258
- "excludeFrom" => array("dashboard", "shortcode")
1259
- ),
1260
- "description" => array(
1261
- "name" => "Description",
1262
- "hiddenFor" => array("dashboard", "shortcode"),
1263
- "type" => "text",
1264
- "description" => "Description of the gallery, for internal use.",
1265
- "excludeFrom" => array("dashboard", "shortcode")
1266
- ),
1267
- "layout" => array(
1268
- "name" => "Layout",
1269
- "type" => "select",
1270
- "description" => "<strong>Final Tiles</strong>: use images with different sizes<br><strong>Masonry</strong>: multi-column layout, use this one if you need images of the same size.",
1271
- "values" => array(
1272
- "Layout" => array(
1273
- "final|Final Tiles", "columns|Masonry"
1274
- )
1275
- ),
1276
- "excludeFrom" => array()
1277
- ),
1278
- "width" => array(
1279
- "name" => "Width",
1280
- "type" => "text",
1281
- "description" => "Width of the gallery in pixels or percentage.",
1282
- "excludeFrom" => array()
1283
- ),
1284
- "margin" => array(
1285
- "name" => "Margin",
1286
- "type" => "number",
1287
- "description" => "Margin between images",
1288
- "mu" => "px",
1289
- "min" => 0,
1290
- "max" => 50,
1291
- "excludeFrom" => array()
1292
- ),
1293
- "columns" => array(
1294
- "name" => "Number of columns",
1295
- "type" => "number",
1296
- "description" => "",
1297
- "mu" => "",
1298
- "min" => 1,
1299
- "max" => 50,
1300
- "excludeFrom" => array()
1301
- ),
1302
- "columnsTabletLandscape" => array(
1303
- "name" => "Number of columns (Tablet landscape)",
1304
- "type" => "number",
1305
- "description" => "",
1306
- "mu" => "",
1307
- "min" => 1,
1308
- "max" => 50,
1309
- "excludeFrom" => array()
1310
- ),
1311
- "columnsTabletPortrait" => array(
1312
- "name" => "Number of columns (Tablet portrait)",
1313
- "type" => "number",
1314
- "description" => "",
1315
- "mu" => "",
1316
- "min" => 1,
1317
- "max" => 50,
1318
- "excludeFrom" => array()
1319
- ),
1320
- "columnsPhoneLandscape" => array(
1321
- "name" => "Number of columns (Phone landscape)",
1322
- "type" => "number",
1323
- "description" => "",
1324
- "mu" => "",
1325
- "min" => 1,
1326
- "max" => 50,
1327
- "excludeFrom" => array()
1328
- ),
1329
- "columnsPhonePortrait" => array(
1330
- "name" => "Number of columns (Phone portrait)",
1331
- "type" => "number",
1332
- "description" => "",
1333
- "mu" => "",
1334
- "min" => 1,
1335
- "max" => 50,
1336
- "excludeFrom" => array()
1337
- ),
1338
- "imageSizeFactor" => array(
1339
- "name" => "Image size factor",
1340
- "type" => "slider",
1341
- "description" => "Percentage of image size, i.e.: if an image of the gallery is 300x200 and the size factor is 50% then the resulting image will be 150x100.
1342
- 90% is a suggested default value, because under some circumstances, the images could be enlarged by the script (to fill gaps and avoid blank spaces between tiles).",
1343
- "default" => 90,
1344
- "min" => 1,
1345
- "max" => 100,
1346
- "mu" => "%",
1347
- "excludeFrom" => array()
1348
- ),
1349
- "imageSizeFactorTabletLandscape" => array(
1350
- "name" => "Image size factor (Tablet Landscape)",
1351
- "type" => "slider",
1352
- "description" => "Image size factor to apply when the viewport is 1024px, typically for tablets with landscape orientation",
1353
- "default" => 80,
1354
- "min" => 1,
1355
- "max" => 100,
1356
- "mu" => "%",
1357
- "excludeFrom" => array()
1358
- ),
1359
- "imageSizeFactorTabletPortrait" => array(
1360
- "name" => "Image size factor Tablet Portrait",
1361
- "type" => "slider",
1362
- "description" => "Image size factor to apply when the viewport is 768px, typically for tablets with portrait orientation",
1363
- "default" => 70,
1364
- "min" => 1,
1365
- "max" => 100,
1366
- "mu" => "%",
1367
- "excludeFrom" => array()
1368
- ),
1369
- "imageSizeFactorPhoneLandscape" => array(
1370
- "name" => "Image size factor Smartphone Landscape",
1371
- "type" => "slider",
1372
- "description" => "Image size factor to apply when the viewport is 640px, typically for smartphones with landscape orientation",
1373
- "default" => 60,
1374
- "min" => 1,
1375
- "max" => 100,
1376
- "mu" => "%",
1377
- "excludeFrom" => array()
1378
- ),
1379
- "imageSizeFactorPhonePortrait" => array(
1380
- "name" => "Image size factor Phone Portrait",
1381
- "type" => "slider",
1382
- "description" => "Image size factor to apply when the viewport is 320px, typically for smartphones with portrait orientation",
1383
- "default" => 50,
1384
- "min" => 1,
1385
- "max" => 100,
1386
- "mu" => "%",
1387
- "excludeFrom" => array()
1388
- ),
1389
- "imageSizeFactorCustom" => array(
1390
- "name" => "Custom image size factor",
1391
- "hiddenFor" => array("dashboard", "shortcode"),
1392
- "type" => "PRO_FEATURE",
1393
- "description" => "Use this field if you need further resolutions.",
1394
- "excludeFrom" => array("dashboard", "shortcode")
1395
- ),
1396
- "minTileWidth" => array(
1397
- "name" => "Tile minimum width",
1398
- "type" => "number",
1399
- "description" => "Minimum width of each tile, <strong>multiply this value for the image size factor to get the real size</strong>.",
1400
- "mu" => "px",
1401
- "min" => 50,
1402
- "max" => 500,
1403
- "default" => 200,
1404
- "excludeFrom" => array()
1405
- ),
1406
- "imagesOrder" => array(
1407
- "name" => "Images order",
1408
- "type" => "select",
1409
- "description" => "Choose the order of the images",
1410
- "default" => "",
1411
- "values" => array(
1412
- "Images order" => array(
1413
- "user|User", "reverse|Reverse", "random|Random"
1414
- )
1415
- ),
1416
- "excludeFrom" => array()
1417
- ),
1418
- "filter" => array(
1419
- "name" => "Filters",
1420
- "type" => "PRO_FEATURE",
1421
- "description" => "Manage here all the filters of this gallery",
1422
- "excludeFrom" => array("dashboard", "shortcode")
1423
- ),
1424
- "filterClick" => array(
1425
- "name" => "Reload Page on filter click",
1426
- "type" => "PRO_FEATURE",
1427
- "description" => "Turn this feature ON if you want to use filters with most lightboxes",
1428
- "excludeFrom" => array()
1429
- ),
1430
-
1431
- "allFilterLabel" => array(
1432
- "name" => "Text for 'All' filter",
1433
- "type" => "PRO_FEATURE",
1434
- "description" => "Write here the label for the 'All' filter",
1435
- "excludeFrom" => array()
1436
- ),
1437
- "gridCellSize" => array(
1438
- "name" => "Size of the grid",
1439
- "type" => "number",
1440
- "default" => 25,
1441
- "min" => 1,
1442
- "max" => 100,
1443
- "mu" => "px",
1444
- "description" => "Tiles are snapped to a virtual grid, <strong>the higher this value the higher the chance to get bottom aligned tiles</strong> (but it needs to crop horizontally).",
1445
- "excludeFrom" => array()
1446
- ),
1447
- "enlargeImages" => array(
1448
- "name" => "Allow image enlargement",
1449
- "type" => "toggle",
1450
- "description" => "Images can be occasionally enlarged to avoid gaps. If you notice a quality loss try to reduce the <strong>Image size factor</strong> parameter.",
1451
- "default" => "T",
1452
- "excludeFrom" => array()
1453
- ),
1454
- "compressHTML" => array(
1455
- "name" => "Compress HTML",
1456
- "type" => "toggle",
1457
- "description" => "Enable or disable HTML compression, some themes prefer uncompressed, switch it off in case of problems.",
1458
- "default" => "T",
1459
- "excludeFrom" => array()
1460
- )
1461
- )
1462
- ),
1463
- "Links & Lightbox" => array(
1464
- "icon" => "mdi-link-variant",
1465
- "fields" => array(
1466
- "lightbox" => array(
1467
- "name" => "Lightbox &amp; Links",
1468
- "type" => "select",
1469
- "description" => "Define here what happens when user click on the images.<br><strong><a href='http://1.envato.market/c/288541/275988/4415?u=https%3A%2F%2Fcodecanyon.net%2Fitem%2Ffinal-tiles-wordpress-gallery%2F5189351' target='_blank'>Buy a PRO license</a></strong> to unlock 5 more lightboxes.",
1470
- "values" => array(
1471
- "Link" => array("|No link", "direct|Direct link to image"),
1472
- "Lightboxes" => array("lightbox2|Lightbox", "everlightbox|EverlightBox")
1473
- ),
1474
- "excludeFrom" => array()
1475
- ),
1476
- "mobileLightbox" => array(
1477
- "name" => "Mobile Lightbox &amp; Links",
1478
- "type" => "PRO_FEATURE",
1479
- "description" => "Define here what happens when user click on the images.",
1480
- "excludeFrom" => array()
1481
- ),
1482
- "lightboxImageSize" => array(
1483
- "name" => "Image size for the lightbox",
1484
- "type" => "select",
1485
- "description" => "",
1486
- "values" => array(
1487
- "Size" => array()
1488
- ),
1489
- "excludeFrom" => array()
1490
- ),
1491
- "disableLightboxGroups" => array(
1492
- "name" => "Disable lightbox grouping",
1493
- "type" => "toggle",
1494
- "description" => "Flag this option if you don't want to group images when opened in a lightbox.",
1495
- "default" => "F",
1496
- "excludeFrom" => array()
1497
- ),
1498
- "blank" => array(
1499
- "name" => "Links target",
1500
- "type" => "toggle",
1501
- "description" => "Open links in a blank page.",
1502
- "excludeFrom" => array()
1503
- ),
1504
- "enableTwitter" => array(
1505
- "name" => "Enable Twitter icon",
1506
- "type" => "toggle",
1507
- "description" => "Enable Twitter sharing.",
1508
- "default" => "F",
1509
- "excludeFrom" => array()
1510
- ),
1511
- "enableFacebook" => array(
1512
- "name" => "Enable Facebook icon",
1513
- "type" => "toggle",
1514
- "description" => "Enable Facebook sharing.",
1515
- "default" => "F",
1516
- "excludeFrom" => array()
1517
- ),
1518
- "enableGplus" => array(
1519
- "name" => "Enable Google Plus icon",
1520
- "type" => "toggle",
1521
- "description" => "Enable Google Plus sharing",
1522
- "default" => "F",
1523
- "excludeFrom" => array()
1524
- ),
1525
- "enablePinterest" => array(
1526
- "name" => "Enable Pinterest icon",
1527
- "type" => "toggle",
1528
- "description" => "Enable Pinterest sharing",
1529
- "default" => "F",
1530
- "excludeFrom" => array()
1531
- ),
1532
- "socialIconColor" => array(
1533
- "name" => "Color of social sharing icons",
1534
- "type" => "color",
1535
- "description" => "Set the color of the social sharing icons",
1536
- "default" => "#ffffff",
1537
- "excludeFrom" => array()
1538
- )
1539
- )
1540
- ),
1541
- "Captions" => array(
1542
- "icon" => "mdi-comment-text-outline",
1543
- "fields" => array(
1544
- "captionBehavior" => array(
1545
- "name" => "Caption behavior",
1546
- "type" => "PRO_FEATURE",
1547
- "description" => "Captions can have two different behaviors: start hidden and shown on mouse over or viceversa.",
1548
- "excludeFrom" => array()
1549
- ),
1550
- "captionMobileBehavior" => array(
1551
- "name" => "Caption mobile behavior",
1552
- "type" => "PRO_FEATURE",
1553
- "description" => "Caption behavior for mobile devices.",
1554
- "excludeFrom" => array()
1555
- ),
1556
- "captionFullHeight" => array(
1557
- "name" => "Caption full height",
1558
- "type" => "PRO_FEATURE",
1559
- "description" => "Enable this option for full height captions. <strong>This is required if you want to use caption icons and caption effects other than <i>fade</i>.</strong>",
1560
- "default" => "T",
1561
- "excludeFrom" => array()
1562
- ),
1563
- "captionEmpty" => array(
1564
- "name" => "Empty captions",
1565
- "type" => "PRO_FEATURE",
1566
- "description" => "Choose if empty caption has to be shown. Consider that empty captions are never shown if <i>Caption full height</i> is switched off.",
1567
- "excludeFrom" => array()
1568
- ),
1569
- "captionIcon" => array(
1570
- "name" => "Caption icon",
1571
- "type" => "select",
1572
- "description" => "Choose the icon for the captions.",
1573
- "values" => array(
1574
- "Icon" => array("|None", "search|Lens", "search-plus|Lens (plus)", "link|Link", "heart|Heart", "heart-o|Heart empty",
1575
- "camera|Camera", "camera-retro|Camera retro", "picture-o|Picture", "star|Star", "star-o|Star empty",
1576
- "sun-o|Sun", "arrows-alt|Arrows", "hand-o-right|Hand")
1577
- ),
1578
- "excludeFrom" => array()
1579
- ),
1580
- "customCaptionIcon" => array(
1581
- "name" => "Custom caption icon",
1582
- "type" => "PRO_FEATURE",
1583
- "description" => "Use this field to insert the class of a FontAwesome icon (i.e.: fa-heart). <a href='http://fontawesome.io/icons/' target='blank'>See all available icons</a>. <strong>This value override the <i>Caption icon</i> value</strong>.",
1584
- "excludeFrom" => array()
1585
- ),
1586
- "captionIconColor" => array(
1587
- "name" => "Caption icon color",
1588
- "type" => "color",
1589
- "description" => "Color of the icon in captions.",
1590
- "default" => "#ffffff",
1591
- "excludeFrom" => array()
1592
- ),
1593
- "captionIconSize" => array(
1594
- "name" => "Caption icon size",
1595
- "type" => "number",
1596
- "description" => "Size of the icon in captions.",
1597
- "default" => 12,
1598
- "min" => 10,
1599
- "max" => 96,
1600
- "mu" => "px",
1601
- "excludeFrom" => array()
1602
- ),
1603
- "captionFontSize" => array(
1604
- "name" => "Caption font size",
1605
- "type" => "number",
1606
- "description" => "Size of the font in captions.",
1607
- "default" => 12,
1608
- "min" => 10,
1609
- "max" => 96,
1610
- "mu" => "px",
1611
- "excludeFrom" => array()
1612
- ),
1613
- "captionEffect" => array(
1614
- "name" => "Caption effect",
1615
- "type" => "PRO_FEATURE",
1616
- "description" => "Effect used to show the captions.",
1617
- "excludeFrom" => array()
1618
- ),
1619
- "captionEasing" => array(
1620
- "name" => "Caption effect easing",
1621
- "type" => "PRO_FEATURE",
1622
- "description" => "Easing function for the caption animation, works better with sliding animations.",
1623
- "excludeFrom" => array()
1624
- ),
1625
- "captionFrame" => array(
1626
- "name" => "Caption frame",
1627
- "type" => "toggle",
1628
- "description" => "Add a frame around the caption",
1629
- "default" => "F",
1630
- "excludeFrom" => array()
1631
- ),
1632
- "captionFrameColor" => array(
1633
- "name" => "Caption frame color",
1634
- "type" => "color",
1635
- "description" => "Color of the frame around the caption",
1636
- "default" => "#ffffff",
1637
- "excludeFrom" => array()
1638
- ),
1639
- "captionColor" => array(
1640
- "name" => "Caption color",
1641
- "type" => "color",
1642
- "description" => "Text color of the captions.",
1643
- "default" => "#ffffff",
1644
- "excludeFrom" => array()
1645
- ),
1646
- "captionEffectDuration" => array(
1647
- "name" => "Caption effect duration",
1648
- "type" => "text",
1649
- "description" => "Duration of the caption animation.",
1650
- "default" => 250,
1651
- "mu" => "ms",
1652
- "min" => 0,
1653
- "max" => 1000,
1654
- "excludeFrom" => array()
1655
- ),
1656
- "captionBackgroundColor" => array(
1657
- "name" => "Caption background color",
1658
- "type" => "color",
1659
- "description" => "Caption background color",
1660
- "default" => "#000000",
1661
- "excludeFrom" => array()
1662
- ),
1663
- "captionOpacity" => array(
1664
- "name" => "Caption opacity",
1665
- "type" => "text",
1666
- "description" => "Opacity of the caption, 0% means 'invisible' while 100% is a plain color without opacity.",
1667
- "default" => 80,
1668
- "min" => 0,
1669
- "max" => 100,
1670
- "mu" => "%",
1671
- "excludeFrom" => array()
1672
- ),
1673
- "wp_field_caption" => array(
1674
- "name" => "WordPress caption field",
1675
- "type" => "select",
1676
- "description" => "WordPress field used for captions. <strong>This field is used ONLY when images are added to the gallery, </strong> however, if you want to ignore captions just set it to '<i>Don't use captions</i>'.",
1677
- "values" => array(
1678
- "Field" => array("none|Don't use captions", "title|Title", "caption|Caption", "description|Description")
1679
- ),
1680
- "excludeFrom" => array("shortcode")
1681
- ),
1682
- "wp_field_title" => array(
1683
- "name" => "WordPress title field",
1684
- "type" => "select",
1685
- "description" => "WordPress field used for titles. <strong>This field is used ONLY when images are added to the gallery, </strong> however, if you want to ignore titles just set it to '<i>Don't use titles</i>'.",
1686
- "values" => array(
1687
- "Field" => array("none|Don't use titles", "title|Title", "description|Description")
1688
- ),
1689
- "excludeFrom" => array("shortcode")
1690
- ),
1691
- "recentPostsCaption" => array(
1692
- "name" => "Recent posts caption",
1693
- "type" => "select",
1694
- "description" => "Field of the post used for captions when using \"Recent posts\" as source.",
1695
- "values" => array(
1696
- "Field" => array("none|Don't use captions", "title|Title", "excerpt|Excerpt", "auto-excerpt|Auto excerpt")
1697
- ),
1698
- "excludeFrom" => array("shortcode")
1699
- ),
1700
- "recentPostsCaptionAutoExcerptLength" => array(
1701
- "name" => "Max number of words for 'Auto excerpt'",
1702
- "type" => "text",
1703
- "description" => "Define the max number of words of the caption when <i>Recent posts caption</i> is set to <i>Auto excerpt</i>.",
1704
- "default" => "20",
1705
- "excludeFrom" => array()
1706
- ),
1707
- "captionVerticalAlignment" => array(
1708
- "name" => "Caption Vertical Alignment",
1709
- "type" => "select",
1710
- "description" => "Choose the vertical alignment of the caption",
1711
- "values" => array("Caption vertical alignment" => array("Top|Top", "Middle|Middle", "Bottom|Bottom")),
1712
- "excludeFrom" => array()
1713
- ),
1714
- "captionHorizontalAlignment" => array(
1715
- "name" => "Caption Horizontal Alignment",
1716
- "type" => "select",
1717
- "description" => "Choose the horizontal alignment of the caption",
1718
- "values" => array("Caption horizontal alignment" => array("Left|Left", "Center|Center", "Right|Right")),
1719
- "excludeFrom" => array()
1720
- ),
1721
- "titleFontSize" => array(
1722
- "name" => "Title font size",
1723
- "type" => "number",
1724
- "description" => "Size of the font in captions.",
1725
- "min" => 10,
1726
- "max" => 96,
1727
- "mu" => "px",
1728
- "excludeFrom" => array()
1729
- ),
1730
-
1731
-
1732
- )
1733
- ),
1734
- "Hover effects" => array(
1735
- "icon" => "mdi-file-image",
1736
- "fields" => array(
1737
- "hoverZoom" => array(
1738
- "name" => "Zoom",
1739
- "type" => "PRO_FEATURE",
1740
- "description" => "Scale value.",
1741
- "default" => 100,
1742
- "min" => 0,
1743
- "max" => 600,
1744
- "mu" => "%",
1745
- "excludeFrom" => array()
1746
- ),
1747
- "hoverRotation" => array(
1748
- "name" => "Rotation",
1749
- "type" => "PRO_FEATURE",
1750
- "description" => "Rotation value in degrees.",
1751
- "min" => 0,
1752
- "max" => 360,
1753
- "mu" => "deg",
1754
- "default" => 0,
1755
- "excludeFrom" => array()
1756
- ),
1757
- "hoverIconRotation" => array(
1758
- "name" => "Rotate icon",
1759
- "type" => "toggle",
1760
- "default" => "F",
1761
- "description" => "Enable rotation of the icon.",
1762
- "excludeFrom" => array()
1763
- )
1764
- )
1765
- ),
1766
- "Image loaded effects" => array(
1767
- "icon" => "mdi-reload",
1768
- "fields" => array(
1769
- "loadedScale" => array(
1770
- "name" => "Scale",
1771
- "description" => "",
1772
- "type" => "slider",
1773
- "min" => 0,
1774
- "max" => 200,
1775
- "mu" => "%",
1776
- "default" => 100,
1777
- "excludeFrom" => array()
1778
- ),
1779
- "loadedRotate" => array(
1780
- "name" => "Rotate",
1781
- "description" => "",
1782
- "type" => "slider",
1783
- "min" => -180,
1784
- "max" => 180,
1785
- "default" => 0,
1786
- "mu" => "deg",
1787
- "excludeFrom" => array()
1788
- ),
1789
- "loadedHSlide" => array(
1790
- "name" => "Horizontal slide",
1791
- "description" => "",
1792
- "type" => "slider",
1793
- "min" => -100,
1794
- "max" => 100,
1795
- "mu" => "px",
1796
- "default" => 0,
1797
- "excludeFrom" => array()
1798
- ),
1799
- "loadedVSlide" => array(
1800
- "name" => "Vertical slide",
1801
- "description" => "",
1802
- "type" => "slider",
1803
- "min" => -100,
1804
- "max" => 100,
1805
- "mu" => "px",
1806
- "default" => 0,
1807
- "excludeFrom" => array()
1808
- )
1809
-
1810
- )
1811
- ),
1812
- "Style" => array(
1813
- "icon" => "mdi-format-paint",
1814
- "fields" => array(
1815
- "borderSize" => array(
1816
- "name" => "Border size",
1817
- "type" => "number",
1818
- "description" => "Size of the border of each image.",
1819
- "default" => 0,
1820
- "min" => 0,
1821
- "max" => 10,
1822
- "mu" => "px",
1823
- "excludeFrom" => array()
1824
- ),
1825
- "borderRadius" => array(
1826
- "name" => "Border radius",
1827
- "type" => "number",
1828
- "description" => "Border radius of the images.",
1829
- "default" => 0,
1830
- "min" => 0,
1831
- "max" => 100,
1832
- "mu" => "px",
1833
- "excludeFrom" => array()
1834
- ),
1835
- "borderColor" => array(
1836
- "name" => "Border color",
1837
- "type" => "color",
1838
- "description" => "Color of the border when size is greater than 0.",
1839
- "default" => "#000000",
1840
- "excludeFrom" => array()
1841
- ),
1842
- "loadingBarColor" => array(
1843
- "name" => "Loading Bar color",
1844
- "type" => "color",
1845
- "description" => "Color of the loading bar",
1846
- "default" => "#000000",
1847
- "excludeFrom" => array()
1848
- ),
1849
- "loadingBarBackgroundColor" => array(
1850
- "name" => "Loading Bar background color",
1851
- "type" => "color",
1852
- "description" => "Background color of the loading bar",
1853
- "default" => "#cccccc",
1854
- "excludeFrom" => array()
1855
- ),
1856
- "shadowSize" => array(
1857
- "name" => "Shadow size",
1858
- "type" => "number",
1859
- "description" => "Shadow size of the images.",
1860
- "default" => 0,
1861
- "min" => 0,
1862
- "max" => 20,
1863
- "mu" => "px",
1864
- "excludeFrom" => array()
1865
- ),
1866
- "shadowColor" => array(
1867
- "name" => "Shadow color",
1868
- "type" => "color",
1869
- "description" => "Color of the shadow when size is greater than 0.",
1870
- "default" => "#000000",
1871
- "excludeFrom" => array()
1872
- ),
1873
- "backgroundColor" => array(
1874
- "name" => "Tile background color",
1875
- "type" => "color",
1876
- "description" => "Background color of tiles",
1877
- "default" => "#fafafa",
1878
- "excludeFrom" => array()
1879
- )
1880
- )
1881
- ),
1882
- "Customizations" => array(
1883
- "icon" => "mdi-puzzle",
1884
- "fields" => array(
1885
- "aClass" => array(
1886
- "name" => "Additional CSS class on A tag",
1887
- "type" => "text",
1888
- "description" => "Use this field if you need to add additional CSS classes to the link that contains the image.",
1889
- "default" => "",
1890
- "excludeFrom" => array()
1891
- ),
1892
- "rel" => array(
1893
- "name" => "Value of 'rel' attribute on the link that contains the image.",
1894
- "type" => "text",
1895
- "description" => "Use this field if you need to add additional CSS classes to the link that contains the image. This is useful mostly to integrate the gallery with other lightbox plugins.",
1896
- "default" => "",
1897
- "excludeFrom" => array()
1898
- ),
1899
- "beforeGalleryText" => array(
1900
- "name" => "Text before gallery",
1901
- "type" => "textarea",
1902
- "description" => "Use this field to add text/html to be placed just before your gallery.",
1903
- "excludeFrom" => array("shortcode")
1904
- ),
1905
- "afterGalleryText" => array(
1906
- "name" => "Text after gallery",
1907
- "type" => "textarea",
1908
- "description" => "Use this field to add text/html to be placed just after your gallery.",
1909
- "excludeFrom" => array("shortcode")
1910
- ),
1911
- "style" => array(
1912
- "name" => "Custom CSS",
1913
- "type" => "textarea",
1914
- "description" => "<strong>Write just the code without using the &lt;style&gt; tag.</strong><br>List of useful selectors:<br>
1915
- <br>
1916
- <ul>
1917
- <li>
1918
- <em>.final-tiles-gallery</em> : gallery container;
1919
- </li>
1920
- <li>
1921
- <em>.final-tiles-gallery .tile-inner</em> : tile content;
1922
- </li>
1923
- <li>
1924
- <em>.final-tiles-gallery .tile-inner .item</em> : image of the tile;
1925
- </li>
1926
- <li>
1927
- <em>.final-tiles-gallery .tile-inner .caption</em> : caption of the tile;
1928
- </li>
1929
- <li>
1930
- <em>.final-tiles-gallery .ftg-filters</em> : filters container
1931
- </li>
1932
- <li>
1933
- <em>.final-tiles-gallery .ftg-filters a</em> : filter
1934
- </li>
1935
- <li>
1936
- <em>.final-tiles-gallery .ftg-filters a.selected</em> : selected filter
1937
- </li>
1938
- </ul>",
1939
- "excludeFrom" => array("shortcode")
1940
- ),
1941
- "script" => array(
1942
- "name" => "Custom scripts",
1943
- "type" => "textarea",
1944
- "description" => "This script will be called after the gallery initialization. Useful for custom lightboxes.
1945
- <br />
1946
- <br />
1947
- <strong>Write just the code without using the &lt;script&gt;&lt;/script&gt; tags</strong>",
1948
- "excludeFrom" => array("shortcode")
1949
- ),
1950
- "delay" => array(
1951
- "name" => "Delay",
1952
- "type" => "text",
1953
- "description" => "Delay (in milliseconds) before firing the gallery. Sometimes it's needed to avoid conflicts with other plugins.",
1954
- "min" => 0,
1955
- "max" => 5000,
1956
- "mu" => "ms",
1957
- "default" => 0,
1958
- "excludeFrom" => array()
1959
- ),
1960
- "support" => array(
1961
- "name" => "Show developer link",
1962
- "type" => "toggle",
1963
- "description" => "I want to support this plugin, show the developer link!",
1964
- "default" => "F",
1965
- "excludeFrom" => array(),
1966
- "excludeFrom" => array()
1967
- ),
1968
- "supportText" => array(
1969
- "name" => "Developer link text",
1970
- "type" => "text",
1971
- "description" => "Text for the developer link",
1972
- "default" => "powered by Final Tiles Grid Gallery",
1973
- "excludeFrom" => array()
1974
- ),
1975
- "envatoReferral" => array(
1976
- "name" => "Envato username for referral",
1977
- "type" => "text",
1978
- "description" => "Enter your Envato username to earn money! Receive 30% of the first purchase or deposit of each referred user. You do not need to activate anything else, you are automatically eligible.",
1979
- "default" => "GreenTreeLabs",
1980
- "excludeFrom" => array()
1981
- )
1982
- )
1983
- )
1984
- );
1985
- }
1986
- }
1987
-
1988
- if (class_exists("FinalTiles_GalleryLite")) {
1989
- global $ob_FinalTiles_GalleryLite;
1990
- $ob_FinalTiles_GalleryLite = new FinalTiles_GalleryLite();
1991
- }
1992
- ?>
1
+ <?php
2
+
3
+ /**
4
+ * Plugin Name: Final Tiles Grid Gallery
5
+ * Plugin URI: https://www.final-tiles-gallery.com
6
+ * Description: Wordpress Plugin for creating responsive image galleries. By: GreenTreeLabs
7
+ * Author: Green Tree Labs
8
+ * Version: 3.3.13
9
+ * Author URI: https://www.greentreelabs.net
10
+ *
11
+ * @fs_premium_only /lightbox-pro/
12
+ *
13
+ */
14
+ define( 'FTGVERSION', '3.3.13' );
15
+ /*
16
+ Changelog:
17
+ 3.3.13
18
+ Fixed menu slug
19
+ 3.3.12
20
+ Lite version code merged with premium
21
+ 3.3.10
22
+ Bug fix (wrong behaviour on mobile with columns layout)
23
+ 3.3.9
24
+ Extended support for PHP versions
25
+ 3.3.8
26
+ Bug fix (Woocommerce categories were ignored)
27
+ 3.3.7
28
+ Bug fix (Youtube videos not showing in lightboxes)
29
+ 3.3.6
30
+ Bug fix (Vimeo videos not showing in lightboxes)
31
+ 3.3.5
32
+ Enhanced compatibility with EverlightBox
33
+ 3.3.4
34
+ Bug fix (woocommerce 3.1.x galleries not working)
35
+ Admin UI minor fixes
36
+ 3.3.3
37
+ Bug fix (wrong behaviour of captions on mobile devices)
38
+ 3.3.2
39
+ Bug fix (videos not using the masonry layout)
40
+ 3.3.1
41
+ Bug fix (videos not visible)
42
+ 3.3.0
43
+ Use gallery options inside shortcode
44
+ Enhanced backend UI
45
+ Added new caption behaviours
46
+ Fix FitVid conflicts
47
+ Added Hover effects and Image loaded effects presets
48
+ Added hover effect duration
49
+ Added new feature: disable grid size below given screen width
50
+ Added title and description to LightGallery
51
+ 3.2.9
52
+ Added support for EverlightBox
53
+ Renamed get_image_sizes function to avoid conflicts
54
+ 3.2.8
55
+ Minor Bug fix
56
+ 3.2.7
57
+ Minor Bug fix
58
+ 3.2.6
59
+ Bug fix
60
+ New feature: choose image size for lightbox
61
+ 3.2.5
62
+ SwipeBox now supports filters
63
+ Download the full size from LighGallery
64
+ Ajax loading (beta)
65
+ 3.2.4
66
+ Bug fix
67
+ 3.2.3
68
+ Bug fix
69
+ 3.2.2
70
+ Bug fix
71
+ 3.2.1
72
+ Bug fix
73
+ 3.2.0
74
+ Lightbox groups
75
+ Hidden images
76
+ 3.1.32
77
+ Added date filter to media panel
78
+ Added support to Enhanced Media Panel
79
+ Lazy loading with multiple image loading
80
+ Pre-selected filter
81
+ 3.1.31
82
+ Enhanced compatibility with other plugins and themes by adding data-class attribute on images
83
+ 3.1.30
84
+ Fixed jQuery issue
85
+ 3.1.29
86
+ Minor bug fix
87
+ 3.1.28
88
+ Bug fix
89
+ 3.1.27
90
+ Alt tag
91
+ 3.1.26
92
+ Bug fix
93
+ 3.1.25
94
+ Bug fix
95
+ 3.1.24
96
+ Bug fix
97
+ 3.1.23
98
+ Fixed bug occuring with Lazy load + Filters
99
+ 3.1.22
100
+ Lazy load
101
+ 3.1.21
102
+ New layout Masonry
103
+ 3.1.20
104
+ Max number of posts for "Recent posts" galleries
105
+ 3.1.19
106
+ Open videos in lightbox
107
+ 3.1.18
108
+ Admin panel enhancements
109
+ Fixed issue about Magnific Popup being loaded even when not needed
110
+ 3.1.17
111
+ New lightbox added: Lightgallery
112
+ Fixed minor bug in Custom CSS (removed slashes)
113
+ 3.1.16
114
+ Fixed bug in 'Recent posts' galleries, now it's possible to link posts
115
+ 3.1.15
116
+ Added new lightbox: LightGallery
117
+ 3.1.14
118
+ Import/Export features, Set title font size, select images by filter (backend), choose mobile lightbox
119
+ 3.1.13
120
+ Fixed issue with some lightboxes on pages with more than one gallery
121
+ 3.1.12
122
+ Solved conflicts with FitVids
123
+ 3.1.11
124
+ [Backend] edit gallery by clicking the tile
125
+ 3.1.10
126
+ Bug fix
127
+ 3.1.9
128
+ Load gallery with a selected filter, choose to reload page after clicking a filter,
129
+ choose gallery from text editor, load scripts from footer for enhanced page load
130
+ 3.1.8
131
+ Updated material design fonts
132
+ 3.1.7
133
+ Fix grid size 0
134
+ 3.1.6
135
+ Minor bug fix
136
+ 3.1.5
137
+ Image loaded effects
138
+ 3.1.4
139
+ Bug fix
140
+ 3.1.3
141
+ Set a custom label for "All" filter, Choose size of images in admin panel, Loading bar color, Loading bar background color, Caption font size, Sequential image loading
142
+ 3.1.2
143
+ PrettyPhoto security fix
144
+ 3.1.1
145
+ Minor bug fix
146
+ 3.1.0
147
+ New Backoffice
148
+ Wizard
149
+ WooCommerce products
150
+ New caption styles
151
+ Earn money with referral
152
+ 3.0.21
153
+ Bug fix
154
+ 3.0.20
155
+ Support for Social Gallery plugin by EpicPlugins
156
+ 3.0.19
157
+ Bug fix
158
+ 3.0.18
159
+ Posts galleries can use lightboxes
160
+ 3.0.17
161
+ Bug fix
162
+ 3.0.16
163
+ Filters available with recent posts
164
+ 3.0.15
165
+ bug fix
166
+ 3.1.14
167
+ New customization fields: before gallery text and after gallery text
168
+ 3.0.13
169
+ Removed unused gallery properties
170
+ Read "Description" field from media panel
171
+ Added delay control
172
+ 3.0.12
173
+ minor bug fix
174
+ 3.0.11
175
+ Image width and height attributes are now ignored
176
+ 3.0.10
177
+ Added compatibility with Cherry themes
178
+ 3.0.9
179
+ Minor bug fix
180
+ 3.0.8
181
+ Minor bug fix
182
+ 3.0.7
183
+ Minor bug fix
184
+ 3.0.6
185
+ Added filters in media panel
186
+ 3.0.5
187
+ Minor bug fix
188
+ 3.0.4
189
+ Minor bug fix
190
+ 3.0.3
191
+ Bug fix
192
+ 3.0.2
193
+ Bug fix
194
+ 3.0.1
195
+ Bug fix
196
+ 3.0
197
+ New grid layout algorithm
198
+ Video support, reverse order option
199
+ Automatic gallery with recent posts, toggle HTML compression, caption behavior on mobile devices, custom caption icon, update to FontAwesone 4.1.0
200
+ 2.1.10
201
+ Lazy loading
202
+ 2.1.9
203
+ Fixed issue with single quote character in captions
204
+ 2.1.8
205
+ Re-activated html compression
206
+ 2.1.7
207
+ Fixed notice messages
208
+ 2.1.6
209
+ Magnific Popup and Lightbox now work with gallery filters
210
+ 2.1.5
211
+ New feature: dynamic image size factor
212
+ 2.1.4
213
+ New fields: CSS class and REL on A tag
214
+ 2.1.3
215
+ Social icons bug fix
216
+
217
+ 2.1.2
218
+ Show empty captions
219
+ Inverted captions (visible then hidden on mouse over)
220
+ Icons in captions
221
+ Admin redesign UI
222
+ Enable/Disable effects on mouse over
223
+ Caption auto height
224
+ Set color of social sharing icons
225
+ Fixed captions
226
+ Loading progress bar
227
+ Minor bugs fixes
228
+ Page with support request instructions
229
+ Page with instructions
230
+ */
231
+ if ( !function_exists( 'ftg_fs' ) ) {
232
+ // Create a helper function for easy SDK access.
233
+ function ftg_fs()
234
+ {
235
+ global $ftg_fs ;
236
+
237
+ if ( !isset( $ftg_fs ) ) {
238
+ // Include Freemius SDK.
239
+ require_once dirname( __FILE__ ) . '/freemius/start.php';
240
+ $ftg_fs = fs_dynamic_init( array(
241
+ 'id' => '1002',
242
+ 'slug' => 'final-tiles-grid-gallery-lite',
243
+ 'type' => 'plugin',
244
+ 'public_key' => 'pk_d0e075b84d491d510a1d0a21087af',
245
+ 'is_premium' => false,
246
+ 'is_premium_only' => false,
247
+ 'has_addons' => false,
248
+ 'has_paid_plans' => true,
249
+ 'menu' => array(
250
+ 'slug' => 'ftg-lite-gallery-admin',
251
+ 'contact' => false,
252
+ 'support' => false,
253
+ ),
254
+ 'is_live' => true,
255
+ ) );
256
+ }
257
+
258
+ return $ftg_fs;
259
+ }
260
+
261
+ }
262
+ // Init Freemius.
263
+ ftg_fs();
264
+ // Signal that SDK was initiated.
265
+ do_action( 'ftg_fs_loaded' );
266
+ if ( !class_exists( 'FinalTiles_Gallery' ) ) {
267
+ class FinalTiles_Gallery
268
+ {
269
+ private $defaultValues = array(
270
+ 'aClass' => '',
271
+ 'afterGalleryText' => '',
272
+ 'allFilterLabel' => 'All',
273
+ 'ajaxLoading' => 'F',
274
+ 'backgroundColor' => 'transparent',
275
+ 'beforeGalleryText' => '',
276
+ 'blank' => 'F',
277
+ 'borderColor' => 'transparent',
278
+ 'borderRadius' => 0,
279
+ 'borderSize' => 0,
280
+ 'captionBackgroundColor' => '#000000',
281
+ 'captionBehavior' => 'none',
282
+ 'captionColor' => '#ffffff',
283
+ 'captionEasing' => 'linear',
284
+ 'captionEffect' => 'slide-from-bottom',
285
+ 'captionEffectDuration' => 250,
286
+ 'captionEmpty' => 'hide',
287
+ 'captionFontSize' => 12,
288
+ 'captionFrame' => 'F',
289
+ 'captionFrameColor' => '#ffffff',
290
+ 'captionHorizontalAlignment' => 'center',
291
+ 'captionIcon' => 'zoom',
292
+ 'captionIconColor' => '#ffffff',
293
+ 'captionIconSize' => 12,
294
+ 'captionMobileBehavior' => 'desktop',
295
+ 'captionOpacity' => 80,
296
+ 'captionPosition' => 'inside',
297
+ 'captionVerticalAlignment' => 'middle',
298
+ 'columns' => 4,
299
+ 'columnsPhoneLandscape' => 3,
300
+ 'columnsPhonePortrait' => 2,
301
+ 'columnsTabletLandscape' => 4,
302
+ 'columnsTabletPortrait' => 3,
303
+ 'compressHTML' => 'T',
304
+ 'customCaptionIcon' => '',
305
+ 'defaultFilter' => '',
306
+ 'defaultSize' => 'medium',
307
+ 'delay' => 0,
308
+ 'disableLightboxGroups' => 'F',
309
+ 'enableFacebook' => 'F',
310
+ 'enableGplus' => 'F',
311
+ 'enablePinterest' => 'F',
312
+ 'enableTwitter' => 'F',
313
+ 'enlargeImages' => 'T',
314
+ 'envatoReferral' => 'GreenTreeLabs',
315
+ 'filterClick' => 'F',
316
+ 'filters' => '',
317
+ 'gridCellSize' => 25,
318
+ 'gridCellSizeDisabledBelow' => 800,
319
+ 'hoverDuration' => 250,
320
+ 'hoverIconRotation' => 'F',
321
+ 'hoverRotation' => 0,
322
+ 'hoverZoom' => 100,
323
+ 'imageSizeFactor' => 90,
324
+ 'imageSizeFactorCustom' => '',
325
+ 'imageSizeFactorPhoneLandscape' => 60,
326
+ 'imageSizeFactorPhonePortrait' => 50,
327
+ 'imageSizeFactorTabletLandscape' => 80,
328
+ 'imageSizeFactorTabletPortrait' => 70,
329
+ 'imagesOrder' => 'user',
330
+ 'layout' => 'final',
331
+ 'lazyLoad' => false,
332
+ 'lightbox' => 'lightbox2',
333
+ 'lightboxImageSize' => 'large',
334
+ 'loadedDuration' => 500,
335
+ 'loadedEasing' => 'ease-out',
336
+ 'loadedHSlide' => 0,
337
+ 'loadedRotateY' => 0,
338
+ 'loadedRotateX' => 0,
339
+ 'loadedScaleY' => 100,
340
+ 'loadedScaleX' => 100,
341
+ 'loadedVSlide' => 0,
342
+ 'loadingBarBackgroundColor' => '#fff',
343
+ 'loadingBarColor' => '#666',
344
+ 'loadMethod' => 'sequential',
345
+ 'margin' => 10,
346
+ 'max_posts' => 0,
347
+ 'minTileWidth' => '250',
348
+ 'mobileLightbox' => 'lightbox',
349
+ 'post_types' => '',
350
+ 'recentPostsCaption' => 'title',
351
+ 'recentPostsCaptionAutoExcerptLength' => 20,
352
+ 'rel' => '',
353
+ 'reverseOrder' => false,
354
+ 'script' => '',
355
+ 'shadowColor' => '#cccccc',
356
+ 'shadowSize' => 0,
357
+ 'socialIconColor' => '#ffffff',
358
+ 'socialIconPosition' => 'bottom',
359
+ 'socialIconStyle' => 'none',
360
+ 'source' => 'images',
361
+ 'style' => '',
362
+ 'support' => 'F',
363
+ 'supportText' => 'Powered by Final Tiles Grid Gallery',
364
+ 'tilesPerPage' => 0,
365
+ 'titleFontSize' => 14,
366
+ 'width' => '100%',
367
+ 'wp_field_caption' => 'description',
368
+ 'wp_field_title' => 'title',
369
+ ) ;
370
+ //Constructor
371
+ public function __construct()
372
+ {
373
+ $this->plugin_name = plugin_basename( __FILE__ );
374
+ $this->define_constants();
375
+ $this->setupFields();
376
+ $this->define_db_tables();
377
+ $this->FinalTilesdb = $this->create_db_conn();
378
+ register_activation_hook( __FILE__, array( $this, 'activation' ) );
379
+ add_filter( 'widget_text', 'do_shortcode' );
380
+ add_action( 'plugins_loaded', array( $this, 'create_textdomain' ) );
381
+ add_action( 'wp_enqueue_scripts', array( $this, 'add_gallery_scripts' ) );
382
+ //add_action( 'admin_init', array($this,'gallery_admin_init') );
383
+ add_action( 'admin_menu', array( $this, 'add_gallery_admin_menu' ) );
384
+ add_shortcode( 'FinalTilesGallery', array( $this, 'gallery_shortcode_handler' ) );
385
+ add_action( 'wp_ajax_save_gallery', array( $this, 'save_gallery' ) );
386
+ add_action( 'wp_ajax_add_new_gallery', array( $this, 'add_new_gallery' ) );
387
+ add_action( 'wp_ajax_delete_gallery', array( $this, 'delete_gallery' ) );
388
+ add_action( 'wp_ajax_clone_gallery', array( $this, 'clone_gallery' ) );
389
+ add_action( 'wp_ajax_save_image', array( $this, 'save_image' ) );
390
+ add_action( 'wp_ajax_add_image', array( $this, 'add_image' ) );
391
+ add_action( 'wp_ajax_save_video', array( $this, 'save_video' ) );
392
+ add_action( 'wp_ajax_sort_images', array( $this, 'sort_images' ) );
393
+ add_action( 'wp_ajax_delete_image', array( $this, 'delete_image' ) );
394
+ add_action( 'wp_ajax_assign_filters', array( $this, 'assign_filters' ) );
395
+ add_action( 'wp_ajax_assign_group', array( $this, 'assign_group' ) );
396
+ add_action( 'wp_ajax_toggle_visibility', array( $this, 'toggle_visibility' ) );
397
+ add_action( 'wp_ajax_refresh_gallery', array( $this, 'refresh_gallery' ) );
398
+ add_action( 'wp_ajax_get_gallery_configuration', array( $this, 'get_configuration' ) );
399
+ add_action( 'wp_ajax_update_gallery_configuration', array( $this, 'update_configuration' ) );
400
+ add_action( 'wp_ajax_get_image_size_url', array( $this, 'get_image_size_url' ) );
401
+ add_filter( 'mce_buttons', array( $this, 'editor_button' ) );
402
+ add_filter( 'mce_external_plugins', array( $this, 'register_editor_plugin' ) );
403
+ add_action( 'wp_ajax_ftg_shortcode_editor', array( $this, 'ftg_shortcode_editor' ) );
404
+ add_filter(
405
+ 'plugin_row_meta',
406
+ array( $this, 'register_links' ),
407
+ 10,
408
+ 2
409
+ );
410
+ add_action( 'wp_ajax_load_chunk', array( $this, 'load_chunk' ) );
411
+ add_action( 'wp_ajax_nopriv_load_chunk', array( $this, 'load_chunk' ) );
412
+ $this->resetFields();
413
+ }
414
+
415
+ private function resetFields()
416
+ {
417
+ $keys = array(
418
+ 'name',
419
+ 'hiddenFor',
420
+ 'type',
421
+ 'description',
422
+ 'default',
423
+ 'min',
424
+ 'max',
425
+ 'mu',
426
+ 'excludeFrom'
427
+ );
428
+ foreach ( $this->fields as $tab_name => $tab ) {
429
+ foreach ( $tab['fields'] as $key => $field ) {
430
+ //print_r($field);
431
+ foreach ( $keys as $kk ) {
432
+ if ( !array_key_exists( $kk, $field ) ) {
433
+ $this->fields[$tab_name]['fields'][$key][$kk] = '';
434
+ }
435
+ }
436
+ }
437
+ }
438
+ }
439
+
440
+ public function register_links( $links, $file )
441
+ {
442
+ $base = plugin_basename( __FILE__ );
443
+
444
+ if ( $file == $base ) {
445
+ $links[] = '<a href="admin.php?page=ftg-lite-gallery-admin" title="Final Tiles Grid Gallery Dashboard">Dashboard</a>';
446
+ $links[] = '<a href="https://www.greentreelabs.net" title="GreenTreeLabs website">GreenTreeLabs</a>';
447
+ $links[] = '<a href="https://twitter.com/greentreelabs" title="@GreenTreeLabs on Twitter">Twitter</a>';
448
+ $links[] = '<a href="https://www.facebook.com/greentreelabs" title="GreenTreeLabs on Facebook">Facebook</a>';
449
+ $links[] = '<a href="https://www.google.com/+GreentreelabsNetjs" title="GreenTreeLabs on Google+">Google+</a>';
450
+ }
451
+
452
+ return $links;
453
+ }
454
+
455
+ public function create_db_tables()
456
+ {
457
+ include_once WP_PLUGIN_DIR . '/final-tiles-grid-gallery-lite/lib/install-db.php';
458
+ install_db();
459
+ }
460
+
461
+ public function activation()
462
+ {
463
+ }
464
+
465
+ //Define textdomain
466
+ public function create_textdomain()
467
+ {
468
+ $plugin_dir = basename( dirname( __FILE__ ) );
469
+ load_plugin_textdomain( 'final-tiles-gallery', false, dirname( plugin_basename( __FILE__ ) ) . '/lib/languages/' );
470
+ }
471
+
472
+ //Define constants
473
+ public function define_constants()
474
+ {
475
+ if ( !defined( 'FINALTILESGALLERY_PLUGIN_BASENAME' ) ) {
476
+ define( 'FINALTILESGALLERY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
477
+ }
478
+ if ( !defined( 'FINALTILESGALLERY_PLUGIN_NAME' ) ) {
479
+ define( 'FINALTILESGALLERY_PLUGIN_NAME', trim( dirname( FINALTILESGALLERY_PLUGIN_BASENAME ), '/' ) );
480
+ }
481
+ if ( !defined( 'FINALTILESGALLERY_PLUGIN_DIR' ) ) {
482
+ define( 'FINALTILESGALLERY_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . FINALTILESGALLERY_PLUGIN_NAME );
483
+ }
484
+ }
485
+
486
+ //Define DB tables
487
+ public function define_db_tables()
488
+ {
489
+ global $wpdb ;
490
+ $wpdb->FinalTilesGalleries = $wpdb->prefix . 'FinalTiles_gallery';
491
+ $wpdb->FinalTilesImages = $wpdb->prefix . 'FinalTiles_gallery_images';
492
+ }
493
+
494
+ public function create_db_conn()
495
+ {
496
+ require 'lib/db-class.php';
497
+ $FinalTilesdb = FinalTilesDB::getInstance();
498
+ return $FinalTilesdb;
499
+ }
500
+
501
+ public function editor_button( $buttons )
502
+ {
503
+ array_push( $buttons, 'separator', 'ftg_shortcode_editor' );
504
+ return $buttons;
505
+ }
506
+
507
+ public function register_editor_plugin( $plugin_array )
508
+ {
509
+ $plugin_array['ftg_shortcode_editor'] = plugins_url( '/admin/scripts/editor-plugin.js', __FILE__ );
510
+ return $plugin_array;
511
+ }
512
+
513
+ public function ftg_shortcode_editor()
514
+ {
515
+ $css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
516
+ $admin_url = admin_url();
517
+ $galleries = $this->FinalTilesdb->getGalleries();
518
+ //load all galleries
519
+ include 'admin/include/tinymce-galleries.php';
520
+ wp_die();
521
+ }
522
+
523
+ public function attachment_fields_to_edit( $form, $post )
524
+ {
525
+ $form['ftg_link'] = array(
526
+ 'label' => 'Link <small>FTG</small>',
527
+ 'input' => 'text',
528
+ 'value' => get_post_meta( $post->ID, '_ftg_link', true ),
529
+ 'helps' => '',
530
+ );
531
+ $form['ftg_target'] = array(
532
+ 'label' => '_blank <small>FTG</small>',
533
+ 'input' => 'html',
534
+ 'html' => "<input type='checkbox' name='attachments[{$post->ID}][ftg_target]' id='attachments[{$post->ID}][ftg_target]' value='_mblank' " . (( get_post_meta( $post->ID, '_ftg_target', true ) == '_mblank' ? 'checked' : '' )) . ' />',
535
+ );
536
+ return $form;
537
+ }
538
+
539
+ public function attachment_fields_to_save( $post, $attachment )
540
+ {
541
+ if ( isset( $attachment['ftg_link'] ) ) {
542
+ update_post_meta( $post['ID'], '_ftg_link', $attachment['ftg_link'] );
543
+ }
544
+ if ( isset( $attachment['ftg_target'] ) ) {
545
+ update_post_meta( $post['ID'], '_ftg_target', $attachment['ftg_target'] );
546
+ }
547
+ return $post;
548
+ }
549
+
550
+ //Delete gallery
551
+ public function delete_gallery()
552
+ {
553
+ if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
554
+ $this->FinalTilesdb->deleteGallery( intval( $_POST['id'] ) );
555
+ }
556
+ die;
557
+ }
558
+
559
+ public function update_configuration()
560
+ {
561
+
562
+ if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
563
+ $id = $_POST['galleryId'];
564
+ $config = stripslashes( $_POST['config'] );
565
+ $this->FinalTilesdb->update_config( $id, $config );
566
+ }
567
+
568
+ die;
569
+ }
570
+
571
+ public function get_configuration()
572
+ {
573
+
574
+ if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
575
+ $id = $_POST['galleryId'];
576
+ $gallery = $this->FinalTilesdb->getGalleryConfig( $id );
577
+ echo $gallery ;
578
+ }
579
+
580
+ die;
581
+ }
582
+
583
+ public function get_image_size_url()
584
+ {
585
+ if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
586
+ echo wp_get_attachment_image_url( $_POST['id'], $_POST['size'], false ) ;
587
+ }
588
+ die;
589
+ }
590
+
591
+ //Clone gallery
592
+ public function clone_gallery()
593
+ {
594
+
595
+ if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
596
+ $sourceId = intval( $_POST['id'] );
597
+ $g = $this->FinalTilesdb->getGalleryById( $sourceId, true );
598
+ $g['name'] .= ' (copy)';
599
+ $this->FinalTilesdb->addGallery( $g );
600
+ $id = $this->FinalTilesdb->getNewGalleryId();
601
+ $images = $this->FinalTilesdb->getImagesByGalleryId( $sourceId );
602
+