Image Photo Gallery Final Tiles Grid - Version 2.0.8

Version Description

  • Admin panel enhancements: now you can see the preview image for each gallery on the dashboard
Download this release

Release Info

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

Version 2.0.8

Files changed (51) hide show
  1. FinalTilesGalleryLite.php +1499 -0
  2. admin/add-gallery.php +147 -0
  3. admin/adv.php +24 -0
  4. admin/css/colors.css +0 -0
  5. admin/css/colors.less +326 -0
  6. admin/css/materialize.css +5726 -0
  7. admin/css/materialize.min.css +16 -0
  8. admin/css/style.css +634 -0
  9. admin/css/style.less +751 -0
  10. admin/edit-gallery.php +82 -0
  11. admin/facebook.php +12 -0
  12. admin/font/material-design-icons/LICENSE.txt +428 -0
  13. admin/font/material-design-icons/Material-Design-Icons.eot +0 -0
  14. admin/font/material-design-icons/Material-Design-Icons.svg +751 -0
  15. admin/font/material-design-icons/Material-Design-Icons.ttf +0 -0
  16. admin/font/material-design-icons/Material-Design-Icons.woff +0 -0
  17. admin/font/roboto/Roboto-Bold.ttf +0 -0
  18. admin/font/roboto/Roboto-Light.ttf +0 -0
  19. admin/font/roboto/Roboto-Medium.ttf +0 -0
  20. admin/font/roboto/Roboto-Regular.ttf +0 -0
  21. admin/font/roboto/Roboto-Thin.ttf +0 -0
  22. admin/galleries.php +45 -0
  23. admin/header.php +4 -0
  24. admin/icon.png +0 -0
  25. admin/images/circles.jpg +0 -0
  26. admin/images/colors.jpg +0 -0
  27. admin/images/modula.jpg +0 -0
  28. admin/include/edit-gallery.php +359 -0
  29. admin/include/image-list.php +89 -0
  30. admin/include/tinymce-galleries.php +87 -0
  31. admin/overview.php +174 -0
  32. admin/scripts/editor-plugin.js +32 -0
  33. admin/scripts/final-tiles-gallery-admin.js +748 -0
  34. admin/scripts/materialize.min.js +9 -0
  35. admin/support.php +38 -0
  36. admin/tutorial.php +15 -0
  37. assets/banner-772x250.jpg +0 -0
  38. icon.png +0 -0
  39. lib/db-class.php +309 -0
  40. lib/gallery-class.php +514 -0
  41. lib/install-db.php +68 -0
  42. lib/languages/final-tiles-gallery.pot +475 -0
  43. lightbox/lightbox2/css/style.css +202 -0
  44. lightbox/lightbox2/img/close.png +0 -0
  45. lightbox/lightbox2/img/loading.gif +0 -0
  46. lightbox/lightbox2/img/next.png +0 -0
  47. lightbox/lightbox2/img/prev.png +0 -0
  48. lightbox/lightbox2/js/script.js +1 -0
  49. readme.txt +148 -0
  50. scripts/ftg.css +560 -0
  51. scripts/script.js +564 -0
FinalTilesGalleryLite.php ADDED
@@ -0,0 +1,1499 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: 2.0.8
8
+ Author URI: http://codecanyon.net/user/GreenTreeLabs
9
+ */
10
+
11
+ define("FTGLITEVERSION", "2.0.8");
12
+ define("PRO_CALL", "<span class='procall'>(<a href='http://www.final-tiles-gallery.com/wordpress/pro.html' target='_blank'>available with PRO version</a>)</span>");
13
+ define("PRO_UNLOCK", "<a href='http://www.final-tiles-gallery.com/wordpress/pro.html' target='_blank'>Add unlimited images with PRO version</a>");
14
+
15
+ if (!class_exists("FinalTiles_GalleryLite"))
16
+ {
17
+ class FinalTiles_GalleryLite
18
+ {
19
+ //Constructor
20
+ public function __construct()
21
+ {
22
+ $this->plugin_name = plugin_basename(__FILE__);
23
+ $this->define_constants();
24
+ $this->define_db_tables();
25
+ $this->FinalTilesdb = $this->create_db_conn();
26
+
27
+
28
+ register_activation_hook( __FILE__, array($this, 'activation'));
29
+
30
+ add_filter('widget_text', 'do_shortcode');
31
+
32
+ add_action('init', array($this, 'create_textdomain'));
33
+
34
+ add_action('wp_enqueue_scripts', array($this, 'add_gallery_scripts'));
35
+
36
+ //add_action( 'admin_init', array($this,'gallery_admin_init') );
37
+ add_action( 'admin_menu', array($this, 'add_gallery_admin_menu') );
38
+
39
+ add_shortcode( 'FinalTilesGallery', array($this, 'gallery_shortcode_handler') );
40
+
41
+ add_action('wp_ajax_save_gallery', array($this,'save_gallery'));
42
+ add_action('wp_ajax_add_new_gallery', array($this,'add_new_gallery'));
43
+ add_action('wp_ajax_delete_gallery', array($this,'delete_gallery'));
44
+ add_action('wp_ajax_clone_gallery', array($this,'clone_gallery'));
45
+ add_action('wp_ajax_save_image', array($this,'save_image'));
46
+ add_action('wp_ajax_add_image', array($this,'add_image'));
47
+ add_action('wp_ajax_save_video', array($this,'save_video'));
48
+ add_action('wp_ajax_sort_images', array($this,'sort_images'));
49
+ add_action('wp_ajax_delete_image', array($this,'delete_image'));
50
+ add_action('wp_ajax_refresh_gallery', array($this,'refresh_gallery'));
51
+
52
+
53
+ add_filter('mce_buttons', array($this, 'editor_button'));
54
+ add_filter('mce_external_plugins', array($this, 'register_editor_plugin'));
55
+ add_action('wp_ajax_ftg_shortcode_editor', array($this, 'ftg_shortcode_editor'));
56
+
57
+ add_filter( 'plugin_row_meta',array( $this, 'register_links' ),10,2);
58
+
59
+
60
+
61
+ $this->resetFields();
62
+ }
63
+
64
+ public function gallery_admin_bar()
65
+ {
66
+ global $wp_admin_bar;
67
+
68
+ $wp_admin_bar->add_menu( array(
69
+ 'id' => 'ftg-upgrade-bar',
70
+ 'href' => 'http://www.final-tiles-gallery.com/wordpress/pro.html',
71
+ 'parent' => 'top-secondary',
72
+ 'title' => __('Upgrade to Final Tiles Grid Gallery PRO'),
73
+ 'meta' => array('class' => 'ftg-upgrade-to-pro', 'target' => '_blank' ),
74
+ ) );
75
+ }
76
+
77
+ private function resetFields()
78
+ {
79
+ $keys = array('name', 'hiddenFor', 'type', 'description', 'default', 'min', 'max', 'mu', 'excludeFrom');
80
+
81
+ foreach ($this->fields as $tab_name => $tab)
82
+ {
83
+ foreach ($tab["fields"] as $key => $field)
84
+ {
85
+ //print_r($field);
86
+ foreach ($keys as $kk)
87
+ {
88
+ if(!array_key_exists($kk, $field)) {
89
+ $this->fields[$tab_name]["fields"][$key][$kk] = "";
90
+ }
91
+ }
92
+ }
93
+
94
+ }
95
+ //print_r($this->fields);
96
+ }
97
+
98
+ public function register_links($links, $file)
99
+ {
100
+ $base = plugin_basename(__FILE__);
101
+ if ($file == $base) {
102
+ $links[] = '<a href="admin.php?page=FinalTiles-gallery-admin" title="Final Tiles Grid Gallery Dashboard">Dashboard</a>';
103
+ $links[] = '<a href="admin.php?page=support" title="Final Tiles Grid Gallery Support">Support</a>';
104
+ $links[] = '<a href="https://twitter.com/greentreelabs" title="@GreenTreeLabs on Twitter">Twitter</a>';
105
+ $links[] = '<a href="https://www.facebook.com/greentreelabs" title="GreenTreeLabs on Facebook">Facebook</a>';
106
+ $links[] = '<a href="https://www.google.com/+GreentreelabsNetjs" title="GreenTreeLabs on Google+">Google+</a>';
107
+ }
108
+ return $links;
109
+
110
+ }
111
+
112
+ public function create_db_tables()
113
+ {
114
+ include_once (WP_PLUGIN_DIR . '/final-tiles-grid-gallery-lite/lib/install-db.php');
115
+ install_db();
116
+ //ftg_nullable();
117
+ }
118
+
119
+ public function activation()
120
+ {
121
+ $this->add_gallery_options();
122
+ $this->FinalTilesdb->updateConfiguration();
123
+ }
124
+
125
+ //Define textdomain
126
+ public function create_textdomain()
127
+ {
128
+ $plugin_dir = basename(dirname(__FILE__));
129
+ load_plugin_textdomain( 'final-tiles-gallery', false, $plugin_dir.'/lib/languages' );
130
+ }
131
+
132
+ //Define constants
133
+ public function define_constants()
134
+ {
135
+ if ( ! defined( 'FINALTILESGALLERY_PLUGIN_BASENAME' ) )
136
+ define( 'FINALTILESGALLERY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
137
+
138
+ if ( ! defined( 'FINALTILESGALLERY_PLUGIN_NAME' ) )
139
+ define( 'FINALTILESGALLERY_PLUGIN_NAME', trim( dirname( FINALTILESGALLERY_PLUGIN_BASENAME ), '/' ) );
140
+
141
+ if ( ! defined( 'FINALTILESGALLERY_PLUGIN_DIR' ) )
142
+ define( 'FINALTILESGALLERY_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . FINALTILESGALLERY_PLUGIN_NAME );
143
+ }
144
+
145
+ //Define DB tables
146
+ public function define_db_tables()
147
+ {
148
+ global $wpdb;
149
+
150
+ $wpdb->FinalTilesGalleries = $wpdb->prefix . 'FinalTiles_gallery';
151
+ $wpdb->FinalTilesImages = $wpdb->prefix . 'FinalTiles_gallery_images';
152
+ }
153
+
154
+
155
+ public function create_db_conn()
156
+ {
157
+ require('lib/db-class.php');
158
+ $FinalTilesdb = FinalTilesLiteDB::getInstance();
159
+ return $FinalTilesdb;
160
+ }
161
+
162
+ public function editor_button($buttons)
163
+ {
164
+ array_push($buttons, 'separator', 'ftg_shortcode_editor');
165
+ return $buttons;
166
+ }
167
+
168
+ public function register_editor_plugin($plugin_array)
169
+ {
170
+ $plugin_array['ftg_shortcode_editor'] = plugins_url('/admin/scripts/editor-plugin.js',__file__);
171
+ return $plugin_array;
172
+ }
173
+
174
+ public function ftg_shortcode_editor()
175
+ {
176
+ $css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
177
+ $admin_url = admin_url();
178
+
179
+ $galleries = $this->FinalTilesdb->getGalleries(); //load all galleries
180
+
181
+ include 'admin/include/tinymce-galleries.php';
182
+ die();
183
+ }
184
+
185
+ public function attachment_fields_to_edit($form, $post)
186
+ {
187
+ $form["ftg_link"] = array(
188
+ "label" => "Link <small>FTG</small>",
189
+ "input" => "text",
190
+ "value" => get_post_meta($post->ID, "_ftg_link", true),
191
+ "helps" => ""
192
+ );
193
+ $form["ftg_target"] = array(
194
+ "label" => "_blank <small>FTG</small>",
195
+ "input" => "html",
196
+ "html" =>
197
+ "<input type='checkbox' name='attachments[{$post->ID}][ftg_target]' id='attachments[{$post->ID}][ftg_target]' value='_mblank' ".
198
+ (get_post_meta($post->ID, "_ftg_target", true) == "_mblank" ? "checked" : "")
199
+ ." />"
200
+ );
201
+ return $form;
202
+ }
203
+
204
+ public function attachment_fields_to_save($post, $attachment)
205
+ {
206
+ if(isset($attachment['ftg_link'])){
207
+ update_post_meta($post['ID'], '_ftg_link', $attachment['ftg_link']);
208
+ }
209
+ if(isset($attachment['ftg_target'])){
210
+ update_post_meta($post['ID'], '_ftg_target', $attachment['ftg_target']);
211
+ }
212
+ return $post;
213
+ }
214
+
215
+ //Add gallery options
216
+ public function add_gallery_options()
217
+ {
218
+ $gallery_options = array(
219
+ 'margin' => 10,
220
+ 'defaultSize' => 'medium',
221
+ 'width' => '100%',
222
+ 'minTileWidth' => '100',
223
+ 'gridCellSize' => '25',
224
+ 'lightbox' => 'lightbox',
225
+ 'recentPostsCaption' => 'title',
226
+ 'captionIcon' => 'zoom',
227
+ 'reverseOrder' => false,
228
+ 'captionIconColor' => '#ffffff',
229
+ 'captionBackgroundColor' => '#000000',
230
+ 'captionColor' => '#ffffff',
231
+ 'captionEffectDuration' => 250,
232
+ 'captionOpacity' => 80,
233
+ 'borderSize' => 0,
234
+ 'borderRadius' => 0,
235
+ 'shadowSize' => 0,
236
+ 'imageSizeFactor' => 90,
237
+ 'imageSizeFactorTabletLandscape' => 80,
238
+ 'imageSizeFactorTabletPortrait' => 70,
239
+ 'imageSizeFactorPhoneLandscape' => 60,
240
+ 'imageSizeFactorPhonePortrait' => 50,
241
+ 'imageSizeFactorCustom' => '',
242
+ 'enlargeImages' => 'T',
243
+ 'wp_field_caption' => 'description',
244
+ 'captionBehavior' => 'hidden',
245
+ 'captionFullHeight' => 'T',
246
+ 'captionEmpty' => 'hide',
247
+ 'captionEffect' => 'fade',
248
+ 'captionEasing' => 'linear',
249
+ 'captionMobileBehavior' => "desktop",
250
+ 'scrollEffect' => 'none',
251
+ 'hoverZoom' => 100,
252
+ 'hoverRotation' => 0,
253
+ 'source' => 'images',
254
+ 'delay' => 0,
255
+ 'socialIconColor' => '#ffffff',
256
+ 'support' => 'F',
257
+ 'loadedScale' => 100,
258
+ 'loadedRotate' => 0,
259
+ 'loadedHSlide' => 0,
260
+ 'loadedVSlide' => 0
261
+
262
+ );
263
+
264
+ update_option('FinalTiles_gallery_options', $gallery_options);
265
+ }
266
+
267
+ //Delete gallery
268
+ public function delete_gallery()
269
+ {
270
+ if(check_admin_referer('FinalTiles_gallery','FinalTiles_gallery'))
271
+ {
272
+ $this->FinalTilesdb->deleteGallery(intval($_POST['id']));
273
+ }
274
+ exit();
275
+ }
276
+
277
+ //Clone gallery
278
+ public function clone_gallery()
279
+ {
280
+ if(check_admin_referer('FinalTiles_gallery','FinalTiles_gallery'))
281
+ {
282
+ $sourceId = intval($_POST['id']);
283
+ $g = $this->FinalTilesdb->getGalleryById($sourceId, true);
284
+ $g['name'] .= " (copy)";
285
+ $this->FinalTilesdb->addGallery($g);
286
+ $id = $this->FinalTilesdb->getNewGalleryId();
287
+ $images = $this->FinalTilesdb->getImagesByGalleryId($sourceId);
288
+ foreach($images as &$image)
289
+ {
290
+ $image->Id = null;
291
+ $image->gid = $id;
292
+ }
293
+ $this->FinalTilesdb->addImages($id, $images);
294
+ }
295
+ exit();
296
+ }
297
+
298
+ //Add gallery scripts
299
+ public function add_gallery_scripts()
300
+ {
301
+ wp_enqueue_script('jquery');
302
+
303
+ wp_register_script('finalTilesGallery', WP_PLUGIN_URL . '/final-tiles-grid-gallery-lite/scripts/script.js', array('jquery'), FTGLITEVERSION);
304
+ wp_enqueue_script('finalTilesGallery');
305
+
306
+
307
+ wp_register_style('finalTilesGallery_stylesheet', WP_PLUGIN_URL . '/final-tiles-grid-gallery-lite/scripts/ftg.css', array(), FTGLITEVERSION);
308
+ wp_enqueue_style('finalTilesGallery_stylesheet');
309
+
310
+ wp_register_script('lightbox2_script', WP_PLUGIN_URL . '/final-tiles-grid-gallery-lite/lightbox/lightbox2/js/script.js', array('jquery'));
311
+ wp_register_style('lightbox2_stylesheet', WP_PLUGIN_URL . '/final-tiles-grid-gallery-lite/lightbox/lightbox2/css/style.css');
312
+
313
+ wp_register_style('fontawesome_stylesheet', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css');
314
+ wp_enqueue_style('fontawesome_stylesheet');
315
+
316
+ }
317
+
318
+ //Admin Section - register scripts and styles
319
+ public function gallery_admin_init()
320
+ {
321
+ if(function_exists( 'wp_enqueue_media' ))
322
+ {
323
+ wp_enqueue_media();
324
+ }
325
+ //wp_enqueue_script( 'custom-header' );
326
+ wp_register_style('google-fonts', '//fonts.googleapis.com/css?family=Roboto:400,700,500,300,900');
327
+ wp_enqueue_style('google-fonts');
328
+
329
+ wp_register_style('google-icons', '//cdn.materialdesignicons.com/1.1.34/css/materialdesignicons.min.css', array());
330
+ wp_enqueue_style('google-icons');
331
+
332
+
333
+ wp_enqueue_script('jquery');
334
+ wp_enqueue_script('jquery-ui-dialog');
335
+ wp_enqueue_script('jquery-ui-sortable');
336
+
337
+ wp_enqueue_script( 'wp-color-picker' );
338
+ wp_enqueue_style( 'wp-color-picker' );
339
+
340
+ wp_enqueue_script('media-upload');
341
+ wp_enqueue_script('thickbox');
342
+
343
+ wp_register_style('final-tiles-gallery-admin', WP_PLUGIN_URL . '/final-tiles-grid-gallery-lite/admin/css/style.css', array('colors'), FTGLITEVERSION);
344
+ wp_enqueue_style('final-tiles-gallery-admin');
345
+
346
+ wp_register_script('materialize', WP_PLUGIN_URL . '/final-tiles-grid-gallery-lite/admin/scripts/materialize.min.js', array('jquery'));
347
+ wp_enqueue_script('materialize');
348
+
349
+ wp_register_script('final-tiles-gallery', WP_PLUGIN_URL . '/final-tiles-grid-gallery-lite/admin/scripts/final-tiles-gallery-admin.js', array('jquery','media-upload','thickbox', 'materialize'), FTGLITEVERSION);
350
+ wp_enqueue_script('final-tiles-gallery');
351
+
352
+ wp_enqueue_style('thickbox');
353
+
354
+ wp_register_style('fontawesome_stylesheet', '//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css');
355
+ wp_enqueue_style('fontawesome_stylesheet');
356
+
357
+ $ftg_db_version = '3.1';
358
+ $installed_ver = get_option( "FinalTiles_gallery_db_version" );
359
+
360
+
361
+ if( $installed_ver != $ftg_db_version )
362
+ {
363
+ $this->create_db_tables();
364
+ update_option( "FinalTiles_gallery_db_version", $ftg_db_version );
365
+ }
366
+ }
367
+
368
+ public function FinalTiles_gallery_admin_style_load()
369
+ {
370
+ wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-darkness/jquery-ui.min.css');
371
+ }
372
+
373
+ //Create Admin Menu
374
+ public function add_gallery_admin_menu()
375
+ {
376
+ $overview = add_menu_page('Final Tiles Gallery', 'Final Tiles Gallery', 'edit_posts', 'ftg-lite-gallery-admin', array($this, 'add_overview'), WP_PLUGIN_URL . '/final-tiles-grid-gallery-lite/admin/icon.png');
377
+ $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'));
378
+ $plugins = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> Other galleries','FinalTiles-gallery'), __('Other galleries','FinalTiles-gallery'), 'edit_posts', 'ftg-lite-gallery-others', array($this, 'other_galleries'));
379
+ $tutorial = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> Tutorial','FinalTiles-gallery'), __('Tutorial','FinalTiles-gallery'), 'edit_posts', 'ftg-lite-tutorial', array($this, 'tutorial'));
380
+ $support = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> Support','FinalTiles-gallery'), __('Support','FinalTiles-gallery'), 'edit_posts', 'ftg-lite-support', array($this, 'support'));
381
+
382
+ add_action('admin_print_styles-'.$add_gallery, array($this, 'FinalTiles_gallery_admin_style_load'));
383
+ // add_action('admin_print_styles-'.$edit_gallery, array($this, 'FinalTiles_gallery_admin_style_load'));
384
+
385
+ add_action('load-'.$tutorial, array($this, 'gallery_admin_init'));
386
+ add_action('load-'.$overview, array($this, 'gallery_admin_init'));
387
+ add_action('load-'.$plugins, array($this, 'gallery_admin_init'));
388
+ add_action('load-'.$add_gallery, array($this, 'gallery_admin_init'));
389
+ // add_action('load-'.$edit_gallery, array($this, 'gallery_admin_init'));
390
+ add_action('load-'.$support, array($this, 'gallery_admin_init'));
391
+
392
+ add_action( 'admin_bar_menu', array($this, 'gallery_admin_bar'), 100);
393
+ }
394
+
395
+ //Create Admin Pages
396
+ public function add_overview()
397
+ {
398
+ global $ftg_fields;
399
+ $ftg_fields = $this->fields;
400
+
401
+ global $ftg_parent_page;
402
+ $ftg_parent_page = "dashboard";
403
+
404
+ if(array_key_exists("id", $_GET))
405
+ {
406
+ include("admin/edit-gallery.php");
407
+ }
408
+ else
409
+ {
410
+ include("admin/overview.php");
411
+ }
412
+ }
413
+
414
+ public function other_galleries()
415
+ {
416
+ include("admin/galleries.php");
417
+ }
418
+
419
+ public function tutorial()
420
+ {
421
+ include("admin/tutorial.php");
422
+ }
423
+
424
+ public function support()
425
+ {
426
+ include("admin/support.php");
427
+ }
428
+
429
+
430
+
431
+ public function add_gallery()
432
+ {
433
+ global $ftg_fields;
434
+ $ftg_fields = $this->fields;
435
+ $gallery = null;
436
+
437
+ include("admin/add-gallery.php");
438
+ }
439
+
440
+ public function delete_image()
441
+ {
442
+ if(check_admin_referer('FinalTiles_gallery','FinalTiles_gallery'))
443
+ {
444
+ foreach (explode(",", $_POST["id"]) as $id) {
445
+ $this->FinalTilesdb->deleteImage(intval($id));
446
+ }
447
+ }
448
+ die();
449
+ }
450
+
451
+
452
+
453
+ public function add_image()
454
+ {
455
+ if(check_admin_referer('FinalTiles_gallery','FinalTiles_gallery'))
456
+ {
457
+ $gid = intval($_POST['galleryId']);
458
+ $enc_images = stripslashes($_POST["enc_images"]);
459
+ $images = json_decode($enc_images);
460
+
461
+ $result = $this->FinalTilesdb->addImages($gid, $images);
462
+
463
+ header("Content-type: application/json");
464
+ if($result === false)
465
+ {
466
+ print "{\"success\":false}";
467
+ }
468
+ else
469
+ {
470
+ print "{\"success\":true}";
471
+ }
472
+ }
473
+ die();
474
+ }
475
+
476
+ public function list_thumbnail_sizes()
477
+ {
478
+ global $_wp_additional_image_sizes;
479
+ $sizes = array();
480
+ foreach( get_intermediate_image_sizes() as $s )
481
+ {
482
+ $sizes[ $s ] = array( 0, 0 );
483
+ if( in_array( $s, array( 'thumbnail', 'medium', 'large' ) ) )
484
+ {
485
+ $sizes[ $s ][0] = get_option( $s . '_size_w' );
486
+ $sizes[ $s ][1] = get_option( $s . '_size_h' );
487
+ }
488
+ else
489
+ {
490
+ if( isset( $_wp_additional_image_sizes ) &&
491
+ isset( $_wp_additional_image_sizes[ $s ] ))
492
+ $sizes[ $s ] = array( $_wp_additional_image_sizes[ $s ]['width'], $_wp_additional_image_sizes[ $s ]['height'], );
493
+ }
494
+ }
495
+
496
+ return $sizes;
497
+ }
498
+
499
+ public function sort_images()
500
+ {
501
+ if(check_admin_referer('FinalTiles_gallery','FinalTiles_gallery'))
502
+ {
503
+ $result = $this->FinalTilesdb->sortImages(explode(',', $_POST['ids']));
504
+
505
+ header("Content-type: application/json");
506
+ if($result === false)
507
+ {
508
+ print "{\"success\":false}";
509
+ }
510
+ else
511
+ {
512
+ print "{\"success\":true}";
513
+ }
514
+ }
515
+ die();
516
+ }
517
+
518
+ public function refresh_gallery()
519
+ {
520
+ if($_POST['source'] == 'images')
521
+ $this->list_images();
522
+ if($_POST['source'] == 'posts')
523
+ $this->list_posts(null);
524
+ if($_POST['source'] == 'woocommerce')
525
+ $this->list_posts('product');
526
+ }
527
+
528
+
529
+
530
+ public function save_image()
531
+ {
532
+ if(check_admin_referer('FinalTiles_gallery','FinalTiles_gallery'))
533
+ {
534
+ $result = false;
535
+
536
+ $type = $_POST['type'];
537
+ $imageUrl = stripslashes($_POST['img_url']);
538
+ $imageCaption = stripslashes($_POST['description']);
539
+ $target = $_POST['target'];
540
+ $link = isset($_POST['link']) ? stripslashes($_POST['link']) : null;
541
+ $imageId = intval($_POST['img_id']);
542
+ $sortOrder = intval($_POST['sortOrder']);
543
+
544
+ $data = array("imagePath" => $imageUrl,
545
+ "target" => $target,
546
+ "link" => $link,
547
+ "imageId" => $imageId,
548
+ "description" => $imageCaption,
549
+ "sortOrder" => $sortOrder);
550
+ if(!empty($_POST["id"]))
551
+ {
552
+ $imageId = intval($_POST['id']);
553
+ $result = $this->FinalTilesdb->editImage($imageId, $data);
554
+ }
555
+ else
556
+ {
557
+ $data["gid"] = intval($_POST['galleryId']);
558
+ $result = $this->FinalTilesdb->addFullImage($data);
559
+ }
560
+
561
+ header("Content-type: application/json");
562
+
563
+ if($result === false)
564
+ {
565
+ print "{\"success\":false}";
566
+ }
567
+ else
568
+ {
569
+ print "{\"success\":true}";
570
+ }
571
+ }
572
+ die();
573
+ }
574
+
575
+
576
+
577
+ public function list_images()
578
+ {
579
+ if(check_admin_referer('FinalTiles_gallery','FinalTiles_gallery'))
580
+ {
581
+
582
+ $gid = intval($_POST["gid"]);
583
+ $imageResults = $this->FinalTilesdb->getImagesByGalleryId($gid);
584
+
585
+ $list_size = "medium";
586
+ $column_size = "s2 m2";
587
+
588
+ if(isset($_POST['list_size']) && !empty($_POST['list_size']))
589
+ {
590
+ $list_size = $_POST['list_size'];
591
+ }
592
+
593
+ setcookie('ftg_imglist_size', $list_size);
594
+ $_COOKIE['ftg_imglist_size'] = $list_size;
595
+
596
+ if($list_size == 'small')
597
+ $column_size = 's1 m1';
598
+ if($list_size == 'medium')
599
+ $column_size = 's2 m2';
600
+ if($list_size == 'big')
601
+ $column_size = 's3 m3';
602
+
603
+ include('admin/include/image-list.php');
604
+ }
605
+ die();
606
+ }
607
+
608
+ public function add_new_gallery()
609
+ {
610
+ if(check_admin_referer('add_new_gallery', 'ftg'))
611
+ {
612
+ $data = get_option('FinalTiles_gallery_options');
613
+
614
+ $data["name"] = $_POST['ftg_name'];
615
+ $data["description"] = $_POST['ftg_description'];
616
+ $data["source"] = $_POST['ftg_source'];
617
+ $data["wp_field_caption"] = $_POST['ftg_wp_field_caption'];
618
+ $data["captionEffect"] = $_POST['ftg_captionEffect'];
619
+
620
+ $result = $this->FinalTilesdb->addGallery($data);
621
+ $id = $this->FinalTilesdb->getNewGalleryId();
622
+
623
+ if($id > 0 && array_key_exists('enc_images', $_POST) && strlen($_POST['enc_images']))
624
+ {
625
+ $enc_images = stripslashes($_POST["enc_images"]);
626
+ $images = json_decode($enc_images);
627
+ $images = array_slice($images, 0, 40/2);
628
+ $result = $this->FinalTilesdb->addImages($id, $images);
629
+ }
630
+
631
+ print $id;
632
+ }
633
+ else
634
+ {
635
+ print -1;
636
+ }
637
+ die();
638
+ }
639
+
640
+ private function checkboxVal($field)
641
+ {
642
+ if(isset($_POST[$field]))
643
+ return 'T';
644
+
645
+ return 'F';
646
+ }
647
+
648
+ public function save_gallery()
649
+ {
650
+ if(check_admin_referer('FinalTiles_gallery','FinalTiles_gallery'))
651
+ {
652
+ $galleryName = stripslashes($_POST['ftg_name']);
653
+ $galleryDescription = stripslashes($_POST['ftg_description']);
654
+ $slug = strtolower(str_replace(" ", "", $galleryName));
655
+ $margin = intval($_POST['ftg_margin']);
656
+ $minTileWidth = intval($_POST['ftg_minTileWidth']);
657
+ $gridCellSize = intval($_POST['ftg_gridCellSize']);
658
+ $imagesOrder = $_POST['ftg_imagesOrder'];
659
+ $width = $_POST['ftg_width'];
660
+ $enableTwitter = $this->checkboxVal('ftg_enableTwitter');
661
+ $enableFacebook = $this->checkboxVal('ftg_enableFacebook');
662
+ $enableGplus = $this->checkboxVal('ftg_enableGplus');
663
+ $enablePinterest = $this->checkboxVal('ftg_enablePinterest');
664
+ $lightbox = $_POST['ftg_lightbox'];
665
+ $blank = $this->checkboxVal('ftg_blank');
666
+ $imageSizeFactor = intval($_POST['ftg_imageSizeFactor']);
667
+ $scrollEffect = $_POST['ftg_scrollEffect'];
668
+ $captionBehavior = $_POST['ftg_captionBehavior'];
669
+ $captionEffect = $_POST['ftg_captionEffect'];
670
+ $captionColor = $_POST['ftg_captionColor'];
671
+ $captionBackgroundColor = $_POST['ftg_captionBackgroundColor'];
672
+ $captionEasing = $_POST['ftg_captionEasing'];
673
+ $captionEmpty = $_POST['ftg_captionEmpty'];
674
+ $captionOpacity = intval($_POST['ftg_captionOpacity']);
675
+ $borderSize = intval($_POST['ftg_borderSize']);
676
+ $borderColor = $_POST['ftg_borderColor'];
677
+ $loadingBarColor=$_POST['ftg_loadingBarColor'];
678
+ $loadingBarBackgroundColor=$_POST['ftg_loadingBarBackgroundColor'];
679
+ $borderRadius = intval($_POST['ftg_borderRadius']);
680
+ $shadowColor = $_POST['ftg_shadowColor'];
681
+ $shadowSize = intval($_POST['ftg_shadowSize']);
682
+ $enlargeImages = $this->checkboxVal('ftg_enlargeImages');
683
+ $backgroundColor = $_POST['ftg_backgroundColor'];
684
+ $wp_field_caption = $_POST['ftg_wp_field_caption'];
685
+ $style = $_POST['ftg_style'];
686
+ $script = $_POST['ftg_script'];
687
+ $loadedScale=intval($_POST['ftg_loadedScale']);
688
+ $loadedRotate=intval($_POST['ftg_loadedRotate']);
689
+ $loadedHSlide=intval($_POST['ftg_loadedHSlide']);
690
+ $loadedVSlide=intval($_POST['ftg_loadedVSlide']);
691
+
692
+ $captionEffectDuration = intval($_POST['ftg_captionEffectDuration']);
693
+ $id = isset($_POST['ftg_gallery_edit']) ? intval($_POST['ftg_gallery_edit']) : 0;
694
+
695
+ $data = array('name' => $galleryName,
696
+ 'slug' => $slug,
697
+ 'description' => $galleryDescription,
698
+ 'lightbox' => $lightbox,
699
+ 'blank' => $blank,
700
+ 'margin' => $margin,
701
+ 'minTileWidth' => $minTileWidth,
702
+ 'gridCellSize' => $gridCellSize,
703
+ 'shuffle' => $shuffle,
704
+ 'enableTwitter' => $enableTwitter,
705
+ 'enableFacebook' => $enableFacebook,
706
+ 'enableGplus' => $enableGplus,
707
+ 'enablePinterest' => $enablePinterest,
708
+ 'imagesOrder' => $imagesOrder,
709
+ 'compressHTML' => $this->checkboxVal('ftg_compressHTML'),
710
+ 'sequentialImageLoading' =>$this->checkboxVal('ftg_sequentialImageLoading'),
711
+ 'socialIconColor' => $_POST['ftg_socialIconColor'],
712
+ 'recentPostsCaption' => $_POST['ftg_recentPostsCaption'],
713
+ 'recentPostsCaptionAutoExcerptLength' => intval($_POST['ftg_recentPostsCaptionAutoExcerptLength']),
714
+ 'captionBehavior' => $captionBehavior,
715
+ 'captionEffect' => $captionEffect,
716
+ 'captionEmpty' => $captionEmpty,
717
+ 'captionFullHeight' => $this->checkboxVal('ftg_captionFullHeight'),
718
+ 'captionBackgroundColor' => $captionBackgroundColor,
719
+ 'captionColor' => $captionColor,
720
+ 'captionFrame' => $_POST['ftg_captionFrame'],
721
+ 'captionFrameColor' => $_POST['ftg_captionFrameColor'],
722
+ 'captionEffectDuration' => $captionEffectDuration,
723
+ 'captionEasing' => $captionEasing,
724
+ 'captionOpacity' => $captionOpacity,
725
+ 'captionIcon' => $_POST['ftg_captionIcon'],
726
+ 'captionFrame' => $this->checkboxVal('ftg_captionFrame'),
727
+ 'captionFrameColor' => $_POST['ftg_captionFrameColor'],
728
+ 'customCaptionIcon' => $_POST['ftg_customCaptionIcon'],
729
+ 'captionIconColor' => $_POST['ftg_captionIconColor'],
730
+ 'captionIconSize' => intval($_POST['ftg_captionIconSize']),
731
+ 'captionFontSize' => intval($_POST['ftg_captionFontSize']),
732
+ 'hoverZoom' => intval($_POST['ftg_hoverZoom']),
733
+ 'hoverRotation' => intval($_POST['ftg_hoverRotation']),
734
+ 'hoverIconRotation' => $this->checkboxVal('ftg_hoverIconRotation'),
735
+ 'wp_field_caption' => $wp_field_caption,
736
+ 'borderSize' => $borderSize,
737
+ 'borderColor' => $borderColor,
738
+ 'loadingBarColor'=>$loadingBarColor,
739
+ 'loadingBarBackgroundColor'=>$loadingBarBackgroundColor,
740
+ 'enlargeImages' => $enlargeImages,
741
+ 'backgroundColor' => $backgroundColor,
742
+ 'borderRadius' => $borderRadius,
743
+ 'imageSizeFactor' => $imageSizeFactor,
744
+ 'imageSizeFactorTabletLandscape' => intval($_POST['ftg_imageSizeFactorTabletLandscape']),
745
+ 'imageSizeFactorTabletPortrait' => intval($_POST['ftg_imageSizeFactorTabletPortrait']),
746
+ 'imageSizeFactorPhoneLandscape' => intval($_POST['ftg_imageSizeFactorPhoneLandscape']),
747
+ 'imageSizeFactorPhonePortrait' => intval($_POST['ftg_imageSizeFactorPhonePortrait']),
748
+ 'imageSizeFactorCustom' => $_POST['ftg_imageSizeFactorCustom'],
749
+ 'shadowSize' => $shadowSize,
750
+ 'shadowColor' => $shadowColor,
751
+ 'source' => $_POST['ftg_source'],
752
+ 'post_types' => $_POST['ftg_post_types'],
753
+ 'post_categories' => $_POST['ftg_post_categories'],
754
+ 'post_tags' => $_POST['ftg_post_tags'],
755
+ 'woo_categories' => $_POST['ftg_woo_categories'],
756
+ 'defaultPostImageSize' => $_POST['ftg_defaultPostImageSize'],
757
+ 'defaultWooImageSize' => $_POST['ftg_defaultWooImageSize'],
758
+ 'width' => $width,
759
+ 'beforeGalleryText' => $_POST['ftg_beforeGalleryText'],
760
+ 'afterGalleryText' => $_POST['ftg_afterGalleryText'],
761
+ 'aClass' => $_POST['ftg_aClass'],
762
+ 'rel' => $_POST['ftg_rel'],
763
+ 'style' => $style,
764
+ 'delay' => intval($_POST['ftg_delay']),
765
+ 'script' => $script,
766
+ 'support' => $this->checkboxVal('ftg_support'),
767
+ 'supportText' => $_POST['ftg_supportText'],
768
+ 'envatoReferral' => $_POST['ftg_envatoReferral'],
769
+ 'scrollEffect' => $scrollEffect,
770
+ 'loadedScale' => $loadedScale,
771
+ 'loadedRotate' => $loadedRotate,
772
+ 'loadedHSlide' => $loadedHSlide,
773
+ 'loadedVSlide' => $loadedVSlide
774
+ );
775
+
776
+ header("Content-type: application/json");
777
+ if($id > 0)
778
+ {
779
+ $result = $this->FinalTilesdb->editGallery($id, $data);
780
+ }
781
+ else
782
+ {
783
+ $result = $this->FinalTilesdb->addGallery($data);
784
+ $id = $this->FinalTilesdb->getNewGalleryId();
785
+ }
786
+
787
+ if($result)
788
+ print "{\"success\":true,\"id\":" . $id ."}";
789
+ else
790
+ print "{\"success\":false}";
791
+ }
792
+ die();
793
+ }
794
+
795
+ //Create gallery
796
+ public function create_gallery($galleryId)
797
+ {
798
+ require_once('lib/gallery-class.php');
799
+ global $FinalTilesGallery;
800
+
801
+ if (class_exists('FinalTilesGallery')) {
802
+ $FinalTilesGallery = new FinalTilesGallery($galleryId, $this->FinalTilesdb);
803
+ $settings = $FinalTilesGallery->getGallery();
804
+ switch($settings->lightbox)
805
+ {
806
+ default:
807
+ case "magnific":
808
+ wp_enqueue_style('magnific_stylesheet');
809
+ wp_enqueue_script('magnific_script');
810
+ break;
811
+ case "prettyphoto":
812
+ wp_enqueue_style('prettyphoto_stylesheet');
813
+ wp_enqueue_script('prettyphoto_script');
814
+ break;
815
+ case "fancybox":
816
+ wp_enqueue_style('fancybox_stylesheet');
817
+ wp_enqueue_script('fancybox_script');
818
+ break;
819
+ case "colorbox":
820
+ wp_enqueue_style('colorbox_stylesheet');
821
+ wp_enqueue_script('colorbox_script');
822
+ break;
823
+ case "swipebox":
824
+ wp_enqueue_style('swipebox_stylesheet');
825
+ wp_enqueue_script('swipebox_script');
826
+ break;
827
+ case "lightbox2":
828
+ wp_enqueue_style('lightbox2_stylesheet');
829
+ wp_enqueue_script('lightbox2_script');
830
+ break;
831
+ case "image-lightbox":
832
+ wp_enqueue_script('image-lightbox_script');
833
+ break;
834
+ }
835
+ return $FinalTilesGallery->render();
836
+ }
837
+ else {
838
+ return "Gallery not found.";
839
+ }
840
+ }
841
+
842
+ //Create Short Code
843
+ public function gallery_shortcode_handler($atts) {
844
+ return $this->create_gallery($atts['id']);
845
+ }
846
+
847
+ static public function slugify($text)
848
+ {
849
+ $text = preg_replace('~[^\\pL\d]+~u', '-', $text);
850
+ $text = trim($text, '-');
851
+ $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
852
+ $text = strtolower($text);
853
+ $text = preg_replace('~[^-\w]+~', '', $text);
854
+
855
+ if (empty($text))
856
+ {
857
+ return 'n-a';
858
+ }
859
+
860
+ return $text;
861
+ }
862
+
863
+ var $fields = array(
864
+
865
+ "General" => array(
866
+ "icon" => "mdi mdi-settings",
867
+ "fields" => array(
868
+ "name" => array(
869
+ "name" => "Name",
870
+ "hiddenFor" => array("dashboard", "shortcode"),
871
+ "type" => "text",
872
+ "description" => "Name of the gallery, for internal use.",
873
+ "excludeFrom" => array("dashboard", "shortcode")
874
+ ),
875
+ "description" => array(
876
+ "name" => "Description",
877
+ "hiddenFor" => array("dashboard", "shortcode"),
878
+ "type" => "text",
879
+ "description" => "Description of the gallery, for internal use.",
880
+ "excludeFrom" => array("dashboard", "shortcode")
881
+ ),
882
+ "width" => array(
883
+ "name" => "Width",
884
+ "type" => "text",
885
+ "description" => "Width of the gallery in pixels or percentage.",
886
+ "excludeFrom" => array()
887
+ ),
888
+ "margin" => array(
889
+ "name" => "Margin",
890
+ "type" => "number",
891
+ "description" => "Margin between images",
892
+ "mu" => "px",
893
+ "min" => 0,
894
+ "max" => 50,
895
+ "excludeFrom" => array()
896
+ ),
897
+ "imageSizeFactor" => array(
898
+ "name" => "Image size factor",
899
+ "type" => "slider",
900
+ "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.
901
+ 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).",
902
+ "default" => 90,
903
+ "min" => 1,
904
+ "max" => 100,
905
+ "mu" => "%",
906
+ "excludeFrom" => array()
907
+ ),
908
+ "imageSizeFactorTabletLandscape" => array(
909
+ "name" => "Image size factor Tablet Landscape",
910
+ "type" => "slider",
911
+ "description" => "Image size factor to apply when the viewport is 1024px, typically for tablets with landscape orientation",
912
+ "default" => 80,
913
+ "min" => 1,
914
+ "max" => 100,
915
+ "mu" => "%",
916
+ "excludeFrom" => array()
917
+ ),
918
+ "imageSizeFactorTabletPortrait" => array(
919
+ "name" => "Image size factor Tablet Portrait",
920
+ "type" => "slider",
921
+ "description" => "Image size factor to apply when the viewport is 768px, typically for tablets with portrait orientation",
922
+ "default" => 70,
923
+ "min" => 1,
924
+ "max" => 100,
925
+ "mu" => "%",
926
+ "excludeFrom" => array()
927
+ ),
928
+ "imageSizeFactorPhoneLandscape" => array(
929
+ "name" => "Image size factor Smartphone Landscape",
930
+ "type" => "slider",
931
+ "description" => "Image size factor to apply when the viewport is 640px, typically for smartphones with landscape orientation",
932
+ "default" => 60,
933
+ "min" => 1,
934
+ "max" => 100,
935
+ "mu" => "%",
936
+ "excludeFrom" => array()
937
+ ),
938
+ "imageSizeFactorPhonePortrait" => array(
939
+ "name" => "Image size factor Phone Portrait",
940
+ "type" => "slider",
941
+ "description" => "Image size factor to apply when the viewport is 320px, typically for smartphones with portrait orientation",
942
+ "default" => 50,
943
+ "min" => 1,
944
+ "max" => 100,
945
+ "mu" => "%",
946
+ "excludeFrom" => array()
947
+ ),
948
+ "imageSizeFactorCustom" => array(
949
+ "name" => "Custom image size factor",
950
+ "hiddenFor" => array("dashboard", "shortcode"),
951
+ "type" => "custom_isf",
952
+ "description" => "Use this field if you need further resolutions.",
953
+ "excludeFrom" => array("dashboard", "shortcode")
954
+ ),
955
+ "minTileWidth" => array(
956
+ "name" => "Tile minimum width",
957
+ "type" => "number",
958
+ "description" => "Minimum width of each tile, <strong>multiply this value for the image size factor to get the real size</strong>.",
959
+ "mu" => "px",
960
+ "min" => 50,
961
+ "max" => 500,
962
+ "default" => 200,
963
+ "excludeFrom" => array()
964
+ ),
965
+ "imagesOrder" => array(
966
+ "name" => "Images order",
967
+ "type" => "PRO_FEATURE",
968
+ "description" => "Choose the order of the images",
969
+ "default" => "",
970
+ "values" => array(
971
+ "Images order" => array(
972
+ "user|User", "reverse|Reverse", "random|Random"
973
+ )
974
+ ),
975
+ "excludeFrom" => array()
976
+ ),
977
+ "filter" => array(
978
+ "name" => "Filters",
979
+ "type" => "PRO_FEATURE",
980
+ "description" => "Manage here all the filters of this gallery",
981
+ "excludeFrom" => array("dashboard", "shortcode")
982
+ ),
983
+ "gridCellSize" => array(
984
+ "name" => "Size of the grid",
985
+ "type" => "number",
986
+ "default" => 25,
987
+ "min" => 1,
988
+ "max" => 100,
989
+ "mu" => "px",
990
+ "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).",
991
+ "excludeFrom" => array()
992
+ ),
993
+ "enlargeImages" => array(
994
+ "name" => "Allow image enlargement",
995
+ "type" => "toggle",
996
+ "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.",
997
+ "default" => "T",
998
+ "excludeFrom" => array()
999
+ ),
1000
+ "scrollEffect" => array(
1001
+ "name" => "Scroll effect",
1002
+ "type" => "PRO_FEATURE",
1003
+ "description" => "Effect on tiles when scrolling the page",
1004
+ "values" => array(
1005
+ "Scroll effect" => array(
1006
+ "none|None", "slide|Sliding tiles", "zoom|Zoom", "rotate-left|Left rotation", "rotate-right|Right rotation"
1007
+ )
1008
+ ),
1009
+ "excludeFrom" => array()
1010
+ ),
1011
+ "compressHTML" => array(
1012
+ "name" => "Compress HTML",
1013
+ "type" => "toggle",
1014
+ "description" => "Enable or disable HTML compression, some themes prefer uncompressed, switch it off in case of problems.",
1015
+ "default" => "T",
1016
+ "excludeFrom" => array()
1017
+ ),
1018
+ "sequentialImageLoading"=>array(
1019
+ "name"=>"Sequential image loading",
1020
+ "type"=>"toggle",
1021
+ "description"=>"Load images sequentially for higher performances. N.B.: search engines won't index your images if sequential loading is activated.",
1022
+ "default"=>"T",
1023
+ "excludeFrom"=>array()
1024
+ ),
1025
+ )
1026
+ ),
1027
+ "Links & Lightbox" => array(
1028
+ "icon" => "mdi mdi-link-variant",
1029
+ "fields" => array(
1030
+ "lightbox" => array(
1031
+ "name" => "Lightbox &amp; Links",
1032
+ "type" => "select",
1033
+ "description" => "Define here what happens when user click on the images.<br><strong>Buy a PRO license</strong> to unlock 5 more lightboxes.",
1034
+ "values" => array(
1035
+ "Link" => array("|No link", "direct|Direct link to image"),
1036
+ "Lightboxes" => array("lightbox2|Lightbox")
1037
+ ),
1038
+ "excludeFrom" => array()
1039
+ ),
1040
+ "blank" => array(
1041
+ "name" => "Links target",
1042
+ "type" => "toggle",
1043
+ "description" => "Open links in a blank page.",
1044
+ "excludeFrom" => array()
1045
+ ),
1046
+ "enableTwitter" => array(
1047
+ "name" => "Enable Twitter icon",
1048
+ "type" => "toggle",
1049
+ "description" => "Enable Twitter sharing.",
1050
+ "default" => "F",
1051
+ "excludeFrom" => array()
1052
+ ),
1053
+ "enableFacebook" => array(
1054
+ "name" => "Enable Facebook icon",
1055
+ "type" => "toggle",
1056
+ "description" => "Enable Facebook sharing.",
1057
+ "default" => "F",
1058
+ "excludeFrom" => array()
1059
+ ),
1060
+ "enableGplus" => array(
1061
+ "name" => "Enable Google Plus icon",
1062
+ "type" => "toggle",
1063
+ "description" => "Enable Google Plus sharing",
1064
+ "default" => "F",
1065
+ "excludeFrom" => array()
1066
+ ),
1067
+ "enablePinterest" => array(
1068
+ "name" => "Enable Pinterest icon",
1069
+ "type" => "toggle",
1070
+ "description" => "Enable Pinterest sharing",
1071
+ "default" => "F",
1072
+ "excludeFrom" => array()
1073
+ ),
1074
+ "socialIconColor" => array(
1075
+ "name" => "Color of social sharing icons",
1076
+ "type" => "color",
1077
+ "description" => "Set the color of the social sharing icons",
1078
+ "default" => "#ffffff",
1079
+ "excludeFrom" => array()
1080
+ )
1081
+ )
1082
+ ),
1083
+ "Captions" => array(
1084
+ "icon" => "mdi mdi-comment-text-outline",
1085
+ "fields" => array(
1086
+ "captionBehavior" => array(
1087
+ "name" => "Caption behavior",
1088
+ "type" => "PRO_FEATURE",
1089
+ "description" => "Captions can have two different behaviors: start hidden and shown on mouse over or viceversa.",
1090
+ "values" => array(
1091
+ "Behavior" => array(
1092
+ "hidden|Hidden, then show it on mouse over",
1093
+ "visible|Visible, then hide it on mouse over",
1094
+ "always-visible|Always visible"
1095
+ )
1096
+ ),
1097
+ "excludeFrom" => array()
1098
+ ),
1099
+ "captionMobileBehavior" => array(
1100
+ "name" => "Caption mobile behavior",
1101
+ "type" => "PRO_FEATURE",
1102
+ "description" => "Caption behavior for mobile devices.",
1103
+ "values" => array(
1104
+ "Behavior" => array(
1105
+ "desktop|Same as desktop",
1106
+ "none|Never show captions",
1107
+ "hidden|Hidden, then show it on touch",
1108
+ "visible|Visible, then hide it on touch",
1109
+ "always-visible|Always visible"
1110
+ )
1111
+ ),
1112
+ "excludeFrom" => array()
1113
+ ),
1114
+ "captionFullHeight" => array(
1115
+ "name" => "Caption full height",
1116
+ "type" => "PRO_FEATURE",
1117
+ "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>",
1118
+ "default" => "T",
1119
+ "excludeFrom" => array()
1120
+ ),
1121
+ "captionEmpty" => array(
1122
+ "name" => "Empty captions",
1123
+ "type" => "PRO_FEATURE",
1124
+ "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.",
1125
+ "values" => array(
1126
+ "Empty captions" => array(
1127
+ "hide|Don't show empty captions",
1128
+ "show|Show empty captions"
1129
+ )
1130
+ ),
1131
+ "excludeFrom" => array()
1132
+ ),
1133
+ "captionIcon" => array(
1134
+ "name" => "Caption icon",
1135
+ "type" => "select",
1136
+ "description" => "Choose the icon for the captions.",
1137
+ "values" => array(
1138
+ "Icon" => array("|None", "search|Lens", "search-plus|Lens (plus)", "link|Link", "heart|Heart", "heart-o|Heart empty",
1139
+ "camera|Camera", "camera-retro|Camera retro", "picture-o|Picture", "star|Star", "star-o|Star empty",
1140
+ "sun-o|Sun", "arrows-alt|Arrows", "hand-o-right|Hand")
1141
+ ),
1142
+ "excludeFrom" => array()
1143
+ ),
1144
+ "customCaptionIcon" => array(
1145
+ "name" => "Custom caption icon",
1146
+ "type" => "PRO_FEATURE",
1147
+ "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>.",
1148
+ "excludeFrom" => array()
1149
+ ),
1150
+ "captionIconColor" => array(
1151
+ "name" => "C