Version Description
- 10/01/2022 =
- Removed: Google Plus
- Fixed: Gallery images Would not show
- Fixed: Lightbox Settings would not save properly
- Fixed: Image upload modal would display a strange countour
Download this release
Release Info
Developer | raldea89 |
Plugin | Image Photo Gallery Final Tiles Grid |
Version | 3.5.2 |
Comparing to | |
See all releases |
Code changes from version 3.5.1 to 3.5.2
- FinalTilesGalleryLite.php +1554 -1557
- admin/add-gallery.php +285 -285
- admin/bundle.css +2032 -2032
- admin/css/gutenberg_block.css +3 -3
- admin/css/materialize.css +8706 -8706
- admin/css/style.css +1165 -1162
- admin/facebook.php +11 -11
- admin/header.php +9 -9
- admin/images/everlightbox-reviews.png +0 -0
- admin/images/everlightbox.png +0 -0
- admin/images/photoblocks.png +0 -0
- admin/include/fields.php +1109 -1117
- admin/include/tinymce-galleries.php +87 -87
- admin/overview.php +238 -238
- admin/scripts/admin.js +20 -20
- admin/scripts/editor-plugin.js +31 -31
- admin/scripts/final-tiles-gallery-admin.js +18 -17
- admin/scripts/materialize.min.js +0 -6821
FinalTilesGalleryLite.php
CHANGED
@@ -1,1558 +1,1555 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin Name: Final Tiles Grid Gallery - Image Gallery
|
5 |
-
* Description: Wordpress Plugin for creating responsive image galleries.
|
6 |
-
* Version: 3.5.
|
7 |
-
* Author: WPChill
|
8 |
-
* Author URI: https://wpchill.com
|
9 |
-
* Tested up to: 5.
|
10 |
-
* Requires: 5.2 or higher
|
11 |
-
* License: GPLv3 or later
|
12 |
-
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
-
* Requires PHP: 5.6
|
14 |
-
* Text Domain: final-tiles-grid-gallery-lite
|
15 |
-
* Domain Path: /languages
|
16 |
-
*
|
17 |
-
* Copyright 2015-2019 GreenTreeLabs diego@greentreelabs.net
|
18 |
-
* Copyright 2019-2020 MachoThemes office@machothemes.com
|
19 |
-
* SVN commit with proof of ownership transfer: https://plugins.trac.wordpress.org/changeset/2163481/
|
20 |
-
* NOTE: MachoThemes took ownership of this plugin on: 09/26/2019 08:49:37 AM as can be seen from the above SVN commit.
|
21 |
-
* Copyright 2020 WPChill heyyy@wpchill.com
|
22 |
-
*
|
23 |
-
* Original Plugin URI: https://greentreelabs.net/final-tiles-gallery-lite/
|
24 |
-
* Original Author URI: https://greentreelabs.net
|
25 |
-
* Original Author: https://profiles.wordpress.org/greentreealbs/
|
26 |
-
*
|
27 |
-
*/
|
28 |
-
define( "FTGVERSION", "3.5.
|
29 |
-
// Create a helper function for easy SDK access.
|
30 |
-
|
31 |
-
if ( !function_exists( 'ftg_fs' ) ) {
|
32 |
-
// Create a helper function for easy SDK access.
|
33 |
-
function ftg_fs()
|
34 |
-
{
|
35 |
-
global $ftg_fs ;
|
36 |
-
|
37 |
-
if ( !isset( $ftg_fs ) ) {
|
38 |
-
// Activate multisite network integration.
|
39 |
-
if ( !defined( 'WP_FS__PRODUCT_1002_MULTISITE' ) ) {
|
40 |
-
define( 'WP_FS__PRODUCT_1002_MULTISITE', true );
|
41 |
-
}
|
42 |
-
// Include Freemius SDK.
|
43 |
-
require_once dirname( __FILE__ ) . '/freemius/start.php';
|
44 |
-
$ftg_fs = fs_dynamic_init( array(
|
45 |
-
'id' => '1002',
|
46 |
-
'slug' => 'final-tiles-grid-gallery-lite',
|
47 |
-
'type' => 'plugin',
|
48 |
-
'public_key' => 'pk_d0e075b84d491d510a1d0a21087af',
|
49 |
-
'is_premium' => false,
|
50 |
-
'has_addons' => false,
|
51 |
-
'has_paid_plans' => true,
|
52 |
-
'trial' => array(
|
53 |
-
'days' => 14,
|
54 |
-
'is_require_payment' => true,
|
55 |
-
),
|
56 |
-
'has_affiliation' => 'all',
|
57 |
-
'menu' => array(
|
58 |
-
'slug' => 'ftg-lite-gallery-admin',
|
59 |
-
),
|
60 |
-
'is_live' => true,
|
61 |
-
) );
|
62 |
-
}
|
63 |
-
|
64 |
-
return $ftg_fs;
|
65 |
-
}
|
66 |
-
|
67 |
-
// Init Freemius.
|
68 |
-
ftg_fs();
|
69 |
-
// Signal that SDK was initiated.
|
70 |
-
do_action( 'ftg_fs_loaded' );
|
71 |
-
}
|
72 |
-
|
73 |
-
function activate_finaltilesgallery()
|
74 |
-
{
|
75 |
-
global $wpdb ;
|
76 |
-
include_once 'lib/install-db.php';
|
77 |
-
FinalTiles_Gallery::define_db_tables();
|
78 |
-
FinalTilesdb::updateConfiguration();
|
79 |
-
|
80 |
-
if ( is_multisite() ) {
|
81 |
-
foreach ( $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" ) as $blog_id ) {
|
82 |
-
switch_to_blog( $blog_id );
|
83 |
-
install_db();
|
84 |
-
restore_current_blog();
|
85 |
-
}
|
86 |
-
} else {
|
87 |
-
install_db();
|
88 |
-
}
|
89 |
-
|
90 |
-
}
|
91 |
-
|
92 |
-
define( "FTG_PLAN", "free" );
|
93 |
-
if ( !class_exists( 'FinalTiles_Gallery' ) ) {
|
94 |
-
class FinalTiles_Gallery
|
95 |
-
{
|
96 |
-
private $defaultValues = array(
|
97 |
-
'aClass' => '',
|
98 |
-
'afterGalleryText' => '',
|
99 |
-
'allFilterLabel' => 'All',
|
100 |
-
'ajaxLoading' => 'F',
|
101 |
-
'backgroundColor' => 'transparent',
|
102 |
-
'beforeGalleryText' => '',
|
103 |
-
'blank' => 'F',
|
104 |
-
'borderColor' => 'transparent',
|
105 |
-
'borderRadius' => 0,
|
106 |
-
'borderSize' => 0,
|
107 |
-
'captionBackgroundColor' => '#000000',
|
108 |
-
'captionBehavior' => 'none',
|
109 |
-
'captionColor' => '#ffffff',
|
110 |
-
'captionCustomFields' => '',
|
111 |
-
'captionEasing' => 'linear',
|
112 |
-
'captionEffect' => 'slide-from-bottom',
|
113 |
-
'captionEffectDuration' => 250,
|
114 |
-
'captionEmpty' => 'hide',
|
115 |
-
'captionFontSize' => 12,
|
116 |
-
'captionFrame' => 'F',
|
117 |
-
'captionFrameColor' => '#ffffff',
|
118 |
-
'captionHorizontalAlignment' => 'center',
|
119 |
-
'captionIcon' => 'zoom',
|
120 |
-
'captionIconColor' => '#ffffff',
|
121 |
-
'captionIconSize' => 12,
|
122 |
-
'captionMobileBehavior' => "desktop",
|
123 |
-
'captionOpacity' => 80,
|
124 |
-
'captionPosition' => 'inside',
|
125 |
-
'captionVerticalAlignment' => 'middle',
|
126 |
-
'categoriesAsFilters' => 'F',
|
127 |
-
'columns' => 4,
|
128 |
-
'columnsPhoneLandscape' => 3,
|
129 |
-
'columnsPhonePortrait' => 2,
|
130 |
-
'columnsTabletLandscape' => 4,
|
131 |
-
'columnsTabletPortrait' => 3,
|
132 |
-
'compressHTML' => 'T',
|
133 |
-
'customCaptionIcon' => '',
|
134 |
-
'defaultFilter' => '',
|
135 |
-
'defaultSize' => 'medium',
|
136 |
-
'delay' => 0,
|
137 |
-
'disableLightboxGroups' => 'F',
|
138 |
-
'enableFacebook' => 'F',
|
139 |
-
'
|
140 |
-
'
|
141 |
-
'
|
142 |
-
'
|
143 |
-
'
|
144 |
-
'
|
145 |
-
'
|
146 |
-
'
|
147 |
-
'
|
148 |
-
'
|
149 |
-
'
|
150 |
-
'
|
151 |
-
'
|
152 |
-
'
|
153 |
-
'
|
154 |
-
'
|
155 |
-
'
|
156 |
-
'
|
157 |
-
'
|
158 |
-
'
|
159 |
-
'
|
160 |
-
'
|
161 |
-
'
|
162 |
-
'
|
163 |
-
'
|
164 |
-
'
|
165 |
-
'
|
166 |
-
'
|
167 |
-
'
|
168 |
-
'
|
169 |
-
'
|
170 |
-
'
|
171 |
-
'
|
172 |
-
'
|
173 |
-
'
|
174 |
-
'
|
175 |
-
'
|
176 |
-
'
|
177 |
-
'
|
178 |
-
'
|
179 |
-
'
|
180 |
-
'
|
181 |
-
'
|
182 |
-
'
|
183 |
-
'
|
184 |
-
'
|
185 |
-
'
|
186 |
-
'
|
187 |
-
'
|
188 |
-
'
|
189 |
-
'
|
190 |
-
'
|
191 |
-
'
|
192 |
-
'
|
193 |
-
'
|
194 |
-
'
|
195 |
-
'
|
196 |
-
'
|
197 |
-
'
|
198 |
-
'
|
199 |
-
'
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
$this->
|
206 |
-
$this->
|
207 |
-
$this->
|
208 |
-
$this->
|
209 |
-
|
210 |
-
|
211 |
-
add_action( '
|
212 |
-
add_action( '
|
213 |
-
|
214 |
-
add_action( '
|
215 |
-
|
216 |
-
|
217 |
-
add_action( '
|
218 |
-
add_action( '
|
219 |
-
add_action( '
|
220 |
-
add_action( '
|
221 |
-
add_action( '
|
222 |
-
add_action( '
|
223 |
-
add_action( '
|
224 |
-
add_action( '
|
225 |
-
add_action( '
|
226 |
-
add_action( '
|
227 |
-
add_action( '
|
228 |
-
add_action( '
|
229 |
-
add_action( '
|
230 |
-
add_action( '
|
231 |
-
add_action( '
|
232 |
-
|
233 |
-
add_filter( '
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
'
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
);
|
242 |
-
add_action( '
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
add_action( '
|
247 |
-
|
248 |
-
|
249 |
-
'
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
'wp-
|
271 |
-
'wp-
|
272 |
-
'wp-
|
273 |
-
'wp-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
'
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
'
|
287 |
-
|
288 |
-
|
289 |
-
$galleries
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
'
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
'
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
$
|
309 |
-
$
|
310 |
-
$
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
'
|
316 |
-
|
317 |
-
|
318 |
-
$
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
$
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
$
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
$
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
$review['
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
$
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
'
|
432 |
-
'
|
433 |
-
'
|
434 |
-
'
|
435 |
-
'
|
436 |
-
'
|
437 |
-
'
|
438 |
-
'
|
439 |
-
|
440 |
-
)
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
$links[] = '<a href="
|
460 |
-
$links[] = '<a href="https://
|
461 |
-
$links[] = '<a href="https://
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
$wpdb->
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
$FinalTilesdb
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
$plugin_array
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
$
|
534 |
-
$
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
"
|
545 |
-
"
|
546 |
-
"
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
"
|
551 |
-
"input"
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
$
|
582 |
-
$
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
$
|
594 |
-
$gallery
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
$
|
615 |
-
$g
|
616 |
-
$g
|
617 |
-
$this->FinalTilesdb->
|
618 |
-
$
|
619 |
-
|
620 |
-
|
621 |
-
$image->
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
'finalTilesGallery',
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
);
|
641 |
-
|
642 |
-
|
643 |
-
'
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
);
|
648 |
-
|
649 |
-
|
650 |
-
wp_register_style( '
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
$
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
'
|
680 |
-
'
|
681 |
-
'
|
682 |
-
|
683 |
-
|
684 |
-
$sizes[$_size]['
|
685 |
-
$sizes[$_size]['
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
'
|
690 |
-
'
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
wp_enqueue_script( 'jquery' );
|
704 |
-
wp_enqueue_script( 'jquery-ui-
|
705 |
-
wp_enqueue_script( '
|
706 |
-
|
707 |
-
|
708 |
-
wp_enqueue_script( '
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
'
|
720 |
-
'
|
721 |
-
'
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
'Final Tiles Gallery',
|
735 |
-
'
|
736 |
-
'
|
737 |
-
'
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
'
|
743 |
-
esc_html__( '
|
744 |
-
|
745 |
-
'
|
746 |
-
'
|
747 |
-
|
748 |
-
);
|
749 |
-
add_action( 'load-' . $
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
$
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
"
|
775 |
-
"
|
776 |
-
"
|
777 |
-
"
|
778 |
-
"
|
779 |
-
|
780 |
-
);
|
781 |
-
$
|
782 |
-
$
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
$
|
816 |
-
$
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
$
|
824 |
-
$
|
825 |
-
|
826 |
-
'
|
827 |
-
'
|
828 |
-
'
|
829 |
-
'
|
830 |
-
'
|
831 |
-
'
|
832 |
-
|
833 |
-
);
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
$
|
845 |
-
$
|
846 |
-
|
847 |
-
"
|
848 |
-
"
|
849 |
-
"
|
850 |
-
"
|
851 |
-
"
|
852 |
-
|
853 |
-
);
|
854 |
-
$
|
855 |
-
$
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
$
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
$
|
928 |
-
$
|
929 |
-
$
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
$sizes[$s][
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
$
|
987 |
-
$
|
988 |
-
$FinalTilesGallery
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
$
|
1010 |
-
$
|
1011 |
-
$
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
$
|
1018 |
-
$
|
1019 |
-
$
|
1020 |
-
$
|
1021 |
-
$
|
1022 |
-
$
|
1023 |
-
$
|
1024 |
-
$
|
1025 |
-
$
|
1026 |
-
$
|
1027 |
-
$
|
1028 |
-
$
|
1029 |
-
|
1030 |
-
"
|
1031 |
-
"
|
1032 |
-
"
|
1033 |
-
"
|
1034 |
-
"
|
1035 |
-
"
|
1036 |
-
"
|
1037 |
-
"
|
1038 |
-
"
|
1039 |
-
"
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
$
|
1045 |
-
|
1046 |
-
|
1047 |
-
$
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
$
|
1071 |
-
$
|
1072 |
-
|
1073 |
-
"
|
1074 |
-
"
|
1075 |
-
|
1076 |
-
);
|
1077 |
-
$
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
$
|
1108 |
-
$
|
1109 |
-
$
|
1110 |
-
$
|
1111 |
-
$
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
$
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
$data = $
|
1137 |
-
$data["
|
1138 |
-
$data["
|
1139 |
-
$data["
|
1140 |
-
$data["
|
1141 |
-
$data["
|
1142 |
-
$data["
|
1143 |
-
$data["
|
1144 |
-
$data["
|
1145 |
-
$data["
|
1146 |
-
$data["
|
1147 |
-
$
|
1148 |
-
$
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
$
|
1153 |
-
$
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
$
|
1178 |
-
$
|
1179 |
-
$
|
1180 |
-
$
|
1181 |
-
$
|
1182 |
-
$
|
1183 |
-
$
|
1184 |
-
$
|
1185 |
-
$
|
1186 |
-
$
|
1187 |
-
$
|
1188 |
-
$
|
1189 |
-
$
|
1190 |
-
$
|
1191 |
-
$
|
1192 |
-
$
|
1193 |
-
$
|
1194 |
-
$
|
1195 |
-
$
|
1196 |
-
$
|
1197 |
-
$
|
1198 |
-
$
|
1199 |
-
$
|
1200 |
-
$
|
1201 |
-
$
|
1202 |
-
$
|
1203 |
-
$
|
1204 |
-
$
|
1205 |
-
$
|
1206 |
-
$
|
1207 |
-
$
|
1208 |
-
$
|
1209 |
-
$
|
1210 |
-
$
|
1211 |
-
$
|
1212 |
-
$
|
1213 |
-
$
|
1214 |
-
$
|
1215 |
-
$
|
1216 |
-
$
|
1217 |
-
$
|
1218 |
-
$
|
1219 |
-
$
|
1220 |
-
$
|
1221 |
-
$
|
1222 |
-
|
1223 |
-
|
1224 |
-
'
|
1225 |
-
'
|
1226 |
-
'
|
1227 |
-
'
|
1228 |
-
'
|
1229 |
-
'
|
1230 |
-
'
|
1231 |
-
'
|
1232 |
-
'
|
1233 |
-
'
|
1234 |
-
'
|
1235 |
-
'
|
1236 |
-
'
|
1237 |
-
'
|
1238 |
-
'
|
1239 |
-
'
|
1240 |
-
'
|
1241 |
-
'
|
1242 |
-
'
|
1243 |
-
'
|
1244 |
-
'
|
1245 |
-
'
|
1246 |
-
'
|
1247 |
-
'
|
1248 |
-
'
|
1249 |
-
'
|
1250 |
-
'
|
1251 |
-
'
|
1252 |
-
'
|
1253 |
-
'
|
1254 |
-
'
|
1255 |
-
'
|
1256 |
-
'
|
1257 |
-
'
|
1258 |
-
'
|
1259 |
-
'
|
1260 |
-
'
|
1261 |
-
'
|
1262 |
-
'
|
1263 |
-
'
|
1264 |
-
'
|
1265 |
-
'
|
1266 |
-
'
|
1267 |
-
'
|
1268 |
-
'
|
1269 |
-
'
|
1270 |
-
'
|
1271 |
-
'
|
1272 |
-
'
|
1273 |
-
'
|
1274 |
-
'
|
1275 |
-
'
|
1276 |
-
'
|
1277 |
-
'
|
1278 |
-
'
|
1279 |
-
'
|
1280 |
-
'
|
1281 |
-
'
|
1282 |
-
'
|
1283 |
-
'
|
1284 |
-
'
|
1285 |
-
'
|
1286 |
-
'
|
1287 |
-
'
|
1288 |
-
'
|
1289 |
-
'
|
1290 |
-
'
|
1291 |
-
'
|
1292 |
-
'
|
1293 |
-
'
|
1294 |
-
'
|
1295 |
-
'
|
1296 |
-
'
|
1297 |
-
'
|
1298 |
-
'
|
1299 |
-
'
|
1300 |
-
'
|
1301 |
-
'
|
1302 |
-
'
|
1303 |
-
'
|
1304 |
-
'
|
1305 |
-
'
|
1306 |
-
'
|
1307 |
-
'
|
1308 |
-
'
|
1309 |
-
'
|
1310 |
-
'
|
1311 |
-
'
|
1312 |
-
'
|
1313 |
-
'
|
1314 |
-
'
|
1315 |
-
'
|
1316 |
-
'
|
1317 |
-
'
|
1318 |
-
'
|
1319 |
-
'
|
1320 |
-
'
|
1321 |
-
'
|
1322 |
-
'
|
1323 |
-
'
|
1324 |
-
'
|
1325 |
-
'
|
1326 |
-
'
|
1327 |
-
'
|
1328 |
-
'
|
1329 |
-
'
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
)
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
$
|
1338 |
-
}
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
$
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
$
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
)
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
wp_enqueue_script( '
|
1411 |
-
break;
|
1412 |
-
case "
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
wp_enqueue_script( '
|
1445 |
-
|
1446 |
-
|
1447 |
-
wp_enqueue_script( '
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
add_action( 'admin_enqueue_scripts', 'ftg_admin_script' );
|
1556 |
-
}
|
1557 |
-
|
1558 |
Â
register_activation_hook( __FILE__, 'activate_finaltilesgallery' );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin Name: Final Tiles Grid Gallery - Image Gallery
|
5 |
+
* Description: Wordpress Plugin for creating responsive image galleries.
|
6 |
+
* Version: 3.5.2
|
7 |
+
* Author: WPChill
|
8 |
+
* Author URI: https://wpchill.com
|
9 |
+
* Tested up to: 5.8
|
10 |
+
* Requires: 5.2 or higher
|
11 |
+
* License: GPLv3 or later
|
12 |
+
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
+
* Requires PHP: 5.6
|
14 |
+
* Text Domain: final-tiles-grid-gallery-lite
|
15 |
+
* Domain Path: /languages
|
16 |
+
*
|
17 |
+
* Copyright 2015-2019 GreenTreeLabs diego@greentreelabs.net
|
18 |
+
* Copyright 2019-2020 MachoThemes office@machothemes.com
|
19 |
+
* SVN commit with proof of ownership transfer: https://plugins.trac.wordpress.org/changeset/2163481/
|
20 |
+
* NOTE: MachoThemes took ownership of this plugin on: 09/26/2019 08:49:37 AM as can be seen from the above SVN commit.
|
21 |
+
* Copyright 2020 WPChill heyyy@wpchill.com
|
22 |
+
*
|
23 |
+
* Original Plugin URI: https://greentreelabs.net/final-tiles-gallery-lite/
|
24 |
+
* Original Author URI: https://greentreelabs.net
|
25 |
+
* Original Author: https://profiles.wordpress.org/greentreealbs/
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
define( "FTGVERSION", "3.5.2" );
|
29 |
+
// Create a helper function for easy SDK access.
|
30 |
+
|
31 |
+
if ( !function_exists( 'ftg_fs' ) ) {
|
32 |
+
// Create a helper function for easy SDK access.
|
33 |
+
function ftg_fs()
|
34 |
+
{
|
35 |
+
global $ftg_fs ;
|
36 |
+
|
37 |
+
if ( !isset( $ftg_fs ) ) {
|
38 |
+
// Activate multisite network integration.
|
39 |
+
if ( !defined( 'WP_FS__PRODUCT_1002_MULTISITE' ) ) {
|
40 |
+
define( 'WP_FS__PRODUCT_1002_MULTISITE', true );
|
41 |
+
}
|
42 |
+
// Include Freemius SDK.
|
43 |
+
require_once dirname( __FILE__ ) . '/freemius/start.php';
|
44 |
+
$ftg_fs = fs_dynamic_init( array(
|
45 |
+
'id' => '1002',
|
46 |
+
'slug' => 'final-tiles-grid-gallery-lite',
|
47 |
+
'type' => 'plugin',
|
48 |
+
'public_key' => 'pk_d0e075b84d491d510a1d0a21087af',
|
49 |
+
'is_premium' => false,
|
50 |
+
'has_addons' => false,
|
51 |
+
'has_paid_plans' => true,
|
52 |
+
'trial' => array(
|
53 |
+
'days' => 14,
|
54 |
+
'is_require_payment' => true,
|
55 |
+
),
|
56 |
+
'has_affiliation' => 'all',
|
57 |
+
'menu' => array(
|
58 |
+
'slug' => 'ftg-lite-gallery-admin',
|
59 |
+
),
|
60 |
+
'is_live' => true,
|
61 |
+
) );
|
62 |
+
}
|
63 |
+
|
64 |
+
return $ftg_fs;
|
65 |
+
}
|
66 |
+
|
67 |
+
// Init Freemius.
|
68 |
+
ftg_fs();
|
69 |
+
// Signal that SDK was initiated.
|
70 |
+
do_action( 'ftg_fs_loaded' );
|
71 |
+
}
|
72 |
+
|
73 |
+
function activate_finaltilesgallery()
|
74 |
+
{
|
75 |
+
global $wpdb ;
|
76 |
+
include_once 'lib/install-db.php';
|
77 |
+
FinalTiles_Gallery::define_db_tables();
|
78 |
+
FinalTilesdb::updateConfiguration();
|
79 |
+
|
80 |
+
if ( is_multisite() ) {
|
81 |
+
foreach ( $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" ) as $blog_id ) {
|
82 |
+
switch_to_blog( $blog_id );
|
83 |
+
install_db();
|
84 |
+
restore_current_blog();
|
85 |
+
}
|
86 |
+
} else {
|
87 |
+
install_db();
|
88 |
+
}
|
89 |
+
|
90 |
+
}
|
91 |
+
|
92 |
+
define( "FTG_PLAN", "free" );
|
93 |
+
if ( !class_exists( 'FinalTiles_Gallery' ) ) {
|
94 |
+
class FinalTiles_Gallery
|
95 |
+
{
|
96 |
+
private $defaultValues = array(
|
97 |
+
'aClass' => '',
|
98 |
+
'afterGalleryText' => '',
|
99 |
+
'allFilterLabel' => 'All',
|
100 |
+
'ajaxLoading' => 'F',
|
101 |
+
'backgroundColor' => 'transparent',
|
102 |
+
'beforeGalleryText' => '',
|
103 |
+
'blank' => 'F',
|
104 |
+
'borderColor' => 'transparent',
|
105 |
+
'borderRadius' => 0,
|
106 |
+
'borderSize' => 0,
|
107 |
+
'captionBackgroundColor' => '#000000',
|
108 |
+
'captionBehavior' => 'none',
|
109 |
+
'captionColor' => '#ffffff',
|
110 |
+
'captionCustomFields' => '',
|
111 |
+
'captionEasing' => 'linear',
|
112 |
+
'captionEffect' => 'slide-from-bottom',
|
113 |
+
'captionEffectDuration' => 250,
|
114 |
+
'captionEmpty' => 'hide',
|
115 |
+
'captionFontSize' => 12,
|
116 |
+
'captionFrame' => 'F',
|
117 |
+
'captionFrameColor' => '#ffffff',
|
118 |
+
'captionHorizontalAlignment' => 'center',
|
119 |
+
'captionIcon' => 'zoom',
|
120 |
+
'captionIconColor' => '#ffffff',
|
121 |
+
'captionIconSize' => 12,
|
122 |
+
'captionMobileBehavior' => "desktop",
|
123 |
+
'captionOpacity' => 80,
|
124 |
+
'captionPosition' => 'inside',
|
125 |
+
'captionVerticalAlignment' => 'middle',
|
126 |
+
'categoriesAsFilters' => 'F',
|
127 |
+
'columns' => 4,
|
128 |
+
'columnsPhoneLandscape' => 3,
|
129 |
+
'columnsPhonePortrait' => 2,
|
130 |
+
'columnsTabletLandscape' => 4,
|
131 |
+
'columnsTabletPortrait' => 3,
|
132 |
+
'compressHTML' => 'T',
|
133 |
+
'customCaptionIcon' => '',
|
134 |
+
'defaultFilter' => '',
|
135 |
+
'defaultSize' => 'medium',
|
136 |
+
'delay' => 0,
|
137 |
+
'disableLightboxGroups' => 'F',
|
138 |
+
'enableFacebook' => 'F',
|
139 |
+
'enablePinterest' => 'F',
|
140 |
+
'enableTwitter' => 'F',
|
141 |
+
'enlargeImages' => 'T',
|
142 |
+
'filterClick' => 'F',
|
143 |
+
'filters' => '',
|
144 |
+
'gridCellSize' => 25,
|
145 |
+
'gridCellSizeDisabledBelow' => 800,
|
146 |
+
'hoverDuration' => 250,
|
147 |
+
'hoverIconRotation' => 'F',
|
148 |
+
'hoverRotation' => 0,
|
149 |
+
'hoverZoom' => 100,
|
150 |
+
'imageSizeFactor' => 30,
|
151 |
+
'imageSizeFactorCustom' => '',
|
152 |
+
'imageSizeFactorPhoneLandscape' => 30,
|
153 |
+
'imageSizeFactorPhonePortrait' => 20,
|
154 |
+
'imageSizeFactorTabletLandscape' => 30,
|
155 |
+
'imageSizeFactorTabletPortrait' => 20,
|
156 |
+
'imagesOrder' => 'user',
|
157 |
+
'layout' => 'final',
|
158 |
+
'lazyLoad' => false,
|
159 |
+
'lightbox' => 'lightbox2',
|
160 |
+
'lightboxImageSize' => 'large',
|
161 |
+
'lightboxOptions' => '',
|
162 |
+
'lightboxOptionsMobile' => '',
|
163 |
+
'loadedDuration' => 500,
|
164 |
+
'loadedEasing' => 'ease-out',
|
165 |
+
'loadedHSlide' => 0,
|
166 |
+
'loadedRotateY' => 0,
|
167 |
+
'loadedRotateX' => 0,
|
168 |
+
'loadedScaleY' => 100,
|
169 |
+
'loadedScaleX' => 100,
|
170 |
+
'loadedVSlide' => 0,
|
171 |
+
'loadingBarBackgroundColor' => "#fff",
|
172 |
+
'loadingBarColor' => "#666",
|
173 |
+
'loadMethod' => 'sequential',
|
174 |
+
'margin' => 10,
|
175 |
+
'max_posts' => 0,
|
176 |
+
'minTileWidth' => '250',
|
177 |
+
'mobileLightbox' => 'lightbox2',
|
178 |
+
'post_types' => '',
|
179 |
+
'post_taxonomies' => '',
|
180 |
+
'recentPostsCaption' => 'title',
|
181 |
+
'recentPostsCaptionAutoExcerptLength' => 20,
|
182 |
+
'rel' => '',
|
183 |
+
'reverseOrder' => false,
|
184 |
+
'script' => '',
|
185 |
+
'shadowColor' => '#cccccc',
|
186 |
+
'shadowSize' => 0,
|
187 |
+
'socialIconColor' => '#ffffff',
|
188 |
+
'socialIconPosition' => 'bottom',
|
189 |
+
'socialIconStyle' => 'none',
|
190 |
+
'source' => 'images',
|
191 |
+
'style' => '',
|
192 |
+
'support' => 'F',
|
193 |
+
'supportText' => 'Powered by Final Tiles Grid Gallery',
|
194 |
+
'taxonomyOperator' => 'OR',
|
195 |
+
'tilesPerPage' => 0,
|
196 |
+
'titleFontSize' => 14,
|
197 |
+
'width' => '100%',
|
198 |
+
'wp_field_caption' => 'description',
|
199 |
+
'wp_field_title' => 'title',
|
200 |
+
) ;
|
201 |
+
//Constructor
|
202 |
+
public function __construct()
|
203 |
+
{
|
204 |
+
$this->plugin_name = plugin_basename( __FILE__ );
|
205 |
+
$this->define_constants();
|
206 |
+
$this->setupFields();
|
207 |
+
$this->define_db_tables();
|
208 |
+
$this->FinalTilesdb = $this->create_db_conn();
|
209 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
210 |
+
add_action( 'init', array( $this, 'create_textdomain' ) );
|
211 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'add_gallery_scripts' ) );
|
212 |
+
//add_action( 'admin_init', array($this,'gallery_admin_init') );
|
213 |
+
add_action( 'admin_menu', array( $this, 'add_gallery_admin_menu' ) );
|
214 |
+
add_action( 'init', array( $this, 'register_gutenberg_block' ) );
|
215 |
+
add_shortcode( 'FinalTilesGallery', array( $this, 'gallery_shortcode_handler' ) );
|
216 |
+
add_action( 'wp_ajax_save_gallery', array( $this, 'save_gallery' ) );
|
217 |
+
add_action( 'wp_ajax_add_new_gallery', array( $this, 'add_new_gallery' ) );
|
218 |
+
add_action( 'wp_ajax_delete_gallery', array( $this, 'delete_gallery' ) );
|
219 |
+
add_action( 'wp_ajax_clone_gallery', array( $this, 'clone_gallery' ) );
|
220 |
+
add_action( 'wp_ajax_save_image', array( $this, 'save_image' ) );
|
221 |
+
add_action( 'wp_ajax_add_image', array( $this, 'add_image' ) );
|
222 |
+
add_action( 'wp_ajax_save_video', array( $this, 'save_video' ) );
|
223 |
+
add_action( 'wp_ajax_sort_images', array( $this, 'sort_images' ) );
|
224 |
+
add_action( 'wp_ajax_delete_image', array( $this, 'delete_image' ) );
|
225 |
+
add_action( 'wp_ajax_assign_filters', array( $this, 'assign_filters' ) );
|
226 |
+
add_action( 'wp_ajax_assign_group', array( $this, 'assign_group' ) );
|
227 |
+
add_action( 'wp_ajax_toggle_visibility', array( $this, 'toggle_visibility' ) );
|
228 |
+
add_action( 'wp_ajax_refresh_gallery', array( $this, 'refresh_gallery' ) );
|
229 |
+
add_action( 'wp_ajax_get_gallery_configuration', array( $this, 'get_configuration' ) );
|
230 |
+
add_action( 'wp_ajax_update_gallery_configuration', array( $this, 'update_configuration' ) );
|
231 |
+
add_action( 'wp_ajax_get_image_size_url', array( $this, 'get_image_size_url' ) );
|
232 |
+
add_filter( 'mce_buttons', array( $this, 'editor_button' ) );
|
233 |
+
add_filter( 'mce_external_plugins', array( $this, 'register_editor_plugin' ) );
|
234 |
+
add_action( 'wp_ajax_ftg_shortcode_editor', array( $this, 'ftg_shortcode_editor' ) );
|
235 |
+
add_filter(
|
236 |
+
'plugin_row_meta',
|
237 |
+
array( $this, 'register_links' ),
|
238 |
+
10,
|
239 |
+
2
|
240 |
+
);
|
241 |
+
add_action( 'wp_ajax_load_chunk', array( $this, 'load_chunk' ) );
|
242 |
+
add_action( 'wp_ajax_nopriv_load_chunk', array( $this, 'load_chunk' ) );
|
243 |
+
|
244 |
+
if ( ftg_fs()->is_not_paying() ) {
|
245 |
+
add_action( 'admin_notices', array( $this, 'review' ) );
|
246 |
+
add_action( 'wp_ajax_ftg_dismiss_review', array( $this, 'dismiss_review' ) );
|
247 |
+
add_filter(
|
248 |
+
'admin_footer_text',
|
249 |
+
array( $this, 'admin_footer' ),
|
250 |
+
1,
|
251 |
+
2
|
252 |
+
);
|
253 |
+
}
|
254 |
+
|
255 |
+
$this->resetFields();
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Register Gutenberg Block
|
260 |
+
*/
|
261 |
+
public function register_gutenberg_block()
|
262 |
+
{
|
263 |
+
if ( !function_exists( 'register_block_type' ) ) {
|
264 |
+
// Gutenberg is not active.
|
265 |
+
return;
|
266 |
+
}
|
267 |
+
// Register block js script
|
268 |
+
wp_register_script( 'ftg-gallery-block', plugins_url( 'scripts/gutenberg_block.js', __FILE__ ), array(
|
269 |
+
'wp-blocks',
|
270 |
+
'wp-i18n',
|
271 |
+
'wp-element',
|
272 |
+
'wp-editor',
|
273 |
+
'wp-components'
|
274 |
+
) );
|
275 |
+
// Editor CSS
|
276 |
+
wp_register_style( 'ftg-gallery-block-editor', plugins_url( 'admin/css/gutenberg_block.css', __FILE__ ), array( 'wp-edit-blocks' ) );
|
277 |
+
// Register block
|
278 |
+
register_block_type( 'ftg/gallery', array(
|
279 |
+
'editor_style' => 'ftg-gallery-block-editor',
|
280 |
+
'editor_script' => 'ftg-gallery-block',
|
281 |
+
) );
|
282 |
+
// Set block translation
|
283 |
+
wp_set_script_translations( 'FinalTiles-gallery', 'final-tiles-gallery', dirname( plugin_basename( __FILE__ ) ) . '/lib/languages/' );
|
284 |
+
$galls = [ [
|
285 |
+
'value' => 0,
|
286 |
+
'label' => esc_html__( 'Select gallery', 'final-tiles-grid-gallery-lite' ),
|
287 |
+
] ];
|
288 |
+
$galleries = $this->FinalTilesdb->getGalleries();
|
289 |
+
if ( $galleries ) {
|
290 |
+
foreach ( $galleries as $g ) {
|
291 |
+
$galls[] = [
|
292 |
+
'value' => $g->Id,
|
293 |
+
'label' => $g->name,
|
294 |
+
];
|
295 |
+
}
|
296 |
+
}
|
297 |
+
// send list of galleries to block
|
298 |
+
wp_localize_script( 'ftg-gallery-block', 'ftg_galleries', array(
|
299 |
+
'items' => $galls,
|
300 |
+
'add_new_galler_url' => admin_url( 'admin.php?page=ftg-add-gallery' ),
|
301 |
+
) );
|
302 |
+
}
|
303 |
+
|
304 |
+
public function review()
|
305 |
+
{
|
306 |
+
// Verify that we can do a check for reviews.
|
307 |
+
$review = get_option( 'ftg_review' );
|
308 |
+
$time = time();
|
309 |
+
$load = false;
|
310 |
+
$there_was_review = false;
|
311 |
+
|
312 |
+
if ( !$review ) {
|
313 |
+
$review = array(
|
314 |
+
'time' => $time,
|
315 |
+
'dismissed' => false,
|
316 |
+
);
|
317 |
+
$load = true;
|
318 |
+
$there_was_review = false;
|
319 |
+
} else {
|
320 |
+
// Check if it has been dismissed or not.
|
321 |
+
if ( isset( $review['dismissed'] ) && !$review['dismissed'] && (isset( $review['time'] ) && $review['time'] + DAY_IN_SECONDS <= $time) ) {
|
322 |
+
$load = true;
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
// If we cannot load, return early.
|
327 |
+
if ( !$load ) {
|
328 |
+
return;
|
329 |
+
}
|
330 |
+
// Update the review option now.
|
331 |
+
update_option( 'ftg_review', $review );
|
332 |
+
// Run through optins on the site to see if any have been loaded for more than a week.
|
333 |
+
$valid = false;
|
334 |
+
$galleries = $this->FinalTilesdb->getGalleries();
|
335 |
+
if ( !$galleries ) {
|
336 |
+
return;
|
337 |
+
}
|
338 |
+
$with_date = false;
|
339 |
+
foreach ( $galleries as $gallery ) {
|
340 |
+
if ( !isset( $gallery->date ) ) {
|
341 |
+
continue;
|
342 |
+
}
|
343 |
+
$with_date = true;
|
344 |
+
$data = $gallery->date;
|
345 |
+
// Check the creation date of the local optin. It must be at least one week after.
|
346 |
+
$created = ( isset( $data ) ? strtotime( $data ) + 7 * DAY_IN_SECONDS : false );
|
347 |
+
if ( !$created ) {
|
348 |
+
continue;
|
349 |
+
}
|
350 |
+
|
351 |
+
if ( $created <= $time ) {
|
352 |
+
$valid = true;
|
353 |
+
break;
|
354 |
+
}
|
355 |
+
|
356 |
+
}
|
357 |
+
if ( !$with_date && count( $galleries ) > 0 && !$there_was_review ) {
|
358 |
+
$valid = true;
|
359 |
+
}
|
360 |
+
// If we don't have a valid option yet, return.
|
361 |
+
if ( !$valid ) {
|
362 |
+
return;
|
363 |
+
}
|
364 |
+
// We have a candidate! Output a review message.
|
365 |
+
?>
|
366 |
+
<div class="notice notice-info is-dismissible ftg-review-notice">
|
367 |
+
<p><?php
|
368 |
+
esc_html_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-grid-gallery-lite' );
|
369 |
+
?></p>
|
370 |
+
<p><strong><?php
|
371 |
+
esc_html_e( 'MachoThemes', 'final-tiles-grid-gallery-lite' );
|
372 |
+
?></strong></p>
|
373 |
+
<p>
|
374 |
+
<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
|
375 |
+
esc_html_e( 'Ok, you deserve it', 'final-tiles-grid-gallery-lite' );
|
376 |
+
?></a><br>
|
377 |
+
<a href="#" class="ftg-dismiss-review-notice" rel="noopener"><?php
|
378 |
+
esc_html_e( 'Nope, maybe later', 'final-tiles-grid-gallery-lite' );
|
379 |
+
?></a><br>
|
380 |
+
<a href="#" class="ftg-dismiss-review-notice" rel="noopener"><?php
|
381 |
+
esc_html_e( 'I already did', 'final-tiles-grid-gallery-lite' );
|
382 |
+
?></a><br>
|
383 |
+
</p>
|
384 |
+
</div>
|
385 |
+
<script type="text/javascript">
|
386 |
+
jQuery(document).ready( function($) {
|
387 |
+
$(document).on('click', '.ftg-dismiss-review-notice, .ftg-review-notice button', function( event ) {
|
388 |
+
if ( ! $(this).hasClass('ftg-review-out') ) {
|
389 |
+
event.preventDefault();
|
390 |
+
}
|
391 |
+
|
392 |
+
$.post( ajaxurl, {
|
393 |
+
action: 'ftg_dismiss_review'
|
394 |
+
});
|
395 |
+
|
396 |
+
$('.ftg-review-notice').remove();
|
397 |
+
});
|
398 |
+
});
|
399 |
+
</script>
|
400 |
+
<?php
|
401 |
+
}
|
402 |
+
|
403 |
+
public function dismiss_review()
|
404 |
+
{
|
405 |
+
$review = get_option( 'ftg_review' );
|
406 |
+
if ( !$review ) {
|
407 |
+
$review = array();
|
408 |
+
}
|
409 |
+
$review['time'] = time();
|
410 |
+
$review['dismissed'] = true;
|
411 |
+
update_option( 'ftg_review', $review );
|
412 |
+
die;
|
413 |
+
}
|
414 |
+
|
415 |
+
public function admin_footer( $text )
|
416 |
+
{
|
417 |
+
global $current_screen ;
|
418 |
+
|
419 |
+
if ( !empty($current_screen->id) && strpos( $current_screen->id, 'ftg' ) !== false ) {
|
420 |
+
$url = esc_url( 'https://wordpress.org/support/plugin/final-tiles-grid-gallery-lite/reviews/?filter=5#new-post' );
|
421 |
+
$text = sprintf( __( 'Please rate <strong>Final Tiles Gallery</strong> <a href="%s" target="_blank">★★★★★</a> on <a href="%s" target="_blank">WordPress.org</a> to help us spread the word. Thank you from the Final Tiles Gallery team!', 'final-tiles-grid-gallery-lite' ), $url, $url );
|
422 |
+
}
|
423 |
+
|
424 |
+
return $text;
|
425 |
+
}
|
426 |
+
|
427 |
+
private function resetFields()
|
428 |
+
{
|
429 |
+
$keys = array(
|
430 |
+
'name',
|
431 |
+
'hiddenFor',
|
432 |
+
'type',
|
433 |
+
'description',
|
434 |
+
'default',
|
435 |
+
'min',
|
436 |
+
'max',
|
437 |
+
'mu',
|
438 |
+
'excludeFrom'
|
439 |
+
);
|
440 |
+
foreach ( $this->fields as $tab_name => $tab ) {
|
441 |
+
foreach ( $tab["fields"] as $key => $field ) {
|
442 |
+
//print_r($field);
|
443 |
+
foreach ( $keys as $kk ) {
|
444 |
+
if ( !array_key_exists( $kk, $field ) ) {
|
445 |
+
$this->fields[$tab_name]["fields"][$key][$kk] = "";
|
446 |
+
}
|
447 |
+
}
|
448 |
+
}
|
449 |
+
}
|
450 |
+
//print_r($this->fields);
|
451 |
+
}
|
452 |
+
|
453 |
+
public function register_links( $links, $file )
|
454 |
+
{
|
455 |
+
$base = plugin_basename( __FILE__ );
|
456 |
+
|
457 |
+
if ( $file == $base ) {
|
458 |
+
$links[] = '<a href="admin.php?page=ftg-lite-gallery-admin" title="Final Tiles Grid Gallery Dashboard">Dashboard</a>';
|
459 |
+
$links[] = '<a href="https://www.machothemes.com/" title="MachoThemes website">MachoThemes</a>';
|
460 |
+
$links[] = '<a href="https://twitter.com/machothemes" title="@MachoThemes on Twitter">Twitter</a>';
|
461 |
+
$links[] = '<a href="https://www.facebook.com/machothemes" title="MachoThemes on Facebook">Facebook</a>';
|
462 |
+
}
|
463 |
+
|
464 |
+
return $links;
|
465 |
+
}
|
466 |
+
|
467 |
+
/*public function create_db_tables()
|
468 |
+
{
|
469 |
+
include_once 'lib/install-db.php';
|
470 |
+
install_db();
|
471 |
+
}
|
472 |
+
|
473 |
+
public function activation()
|
474 |
+
{
|
475 |
+
|
476 |
+
}*/
|
477 |
+
//Define textdomain
|
478 |
+
public function create_textdomain()
|
479 |
+
{
|
480 |
+
$plugin_dir = basename( dirname( __FILE__ ) );
|
481 |
+
load_plugin_textdomain( 'final-tiles-grid-gallery-lite', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
482 |
+
foreach ( $this->fields as $s => $section ) {
|
483 |
+
foreach ( $section["fields"] as $f => $field ) {
|
484 |
+
$this->fields[$s]["fields"][$f]["description"] = esc_html__( $this->fields[$s]["fields"][$f]["description"], 'final-tiles-grid-gallery-lite' );
|
485 |
+
}
|
486 |
+
}
|
487 |
+
}
|
488 |
+
|
489 |
+
//Define constants
|
490 |
+
public function define_constants()
|
491 |
+
{
|
492 |
+
if ( !defined( 'FINALTILESGALLERY_PLUGIN_BASENAME' ) ) {
|
493 |
+
define( 'FINALTILESGALLERY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
494 |
+
}
|
495 |
+
if ( !defined( 'FINALTILESGALLERY_PLUGIN_NAME' ) ) {
|
496 |
+
define( 'FINALTILESGALLERY_PLUGIN_NAME', trim( dirname( FINALTILESGALLERY_PLUGIN_BASENAME ), '/' ) );
|
497 |
+
}
|
498 |
+
if ( !defined( 'FINALTILESGALLERY_PLUGIN_DIR' ) ) {
|
499 |
+
define( 'FINALTILESGALLERY_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . FINALTILESGALLERY_PLUGIN_NAME );
|
500 |
+
}
|
501 |
+
}
|
502 |
+
|
503 |
+
//Define DB tables
|
504 |
+
public static function define_db_tables()
|
505 |
+
{
|
506 |
+
global $wpdb ;
|
507 |
+
$wpdb->FinalTilesGalleries = $wpdb->prefix . 'FinalTiles_gallery';
|
508 |
+
$wpdb->FinalTilesImages = $wpdb->prefix . 'FinalTiles_gallery_images';
|
509 |
+
}
|
510 |
+
|
511 |
+
public function create_db_conn()
|
512 |
+
{
|
513 |
+
require 'lib/db-class.php';
|
514 |
+
$FinalTilesdb = FinalTilesDB::getInstance();
|
515 |
+
return $FinalTilesdb;
|
516 |
+
}
|
517 |
+
|
518 |
+
public function editor_button( $buttons )
|
519 |
+
{
|
520 |
+
array_push( $buttons, 'separator', 'ftg_shortcode_editor' );
|
521 |
+
return $buttons;
|
522 |
+
}
|
523 |
+
|
524 |
+
public function register_editor_plugin( $plugin_array )
|
525 |
+
{
|
526 |
+
$plugin_array['ftg_shortcode_editor'] = plugins_url( '/admin/scripts/editor-plugin.js', __FILE__ );
|
527 |
+
return $plugin_array;
|
528 |
+
}
|
529 |
+
|
530 |
+
public function ftg_shortcode_editor()
|
531 |
+
{
|
532 |
+
$css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
|
533 |
+
$admin_url = admin_url();
|
534 |
+
$galleries = $this->FinalTilesdb->getGalleries();
|
535 |
+
//load all galleries
|
536 |
+
include 'admin/include/tinymce-galleries.php';
|
537 |
+
wp_die();
|
538 |
+
}
|
539 |
+
|
540 |
+
public function attachment_fields_to_edit( $form, $post )
|
541 |
+
{
|
542 |
+
$form["ftg_link"] = array(
|
543 |
+
"label" => "Link <small>FTG</small>",
|
544 |
+
"input" => "text",
|
545 |
+
"value" => get_post_meta( $post->ID, "_ftg_link", true ),
|
546 |
+
"helps" => "",
|
547 |
+
);
|
548 |
+
$form["ftg_target"] = array(
|
549 |
+
"label" => "_blank <small>FTG</small>",
|
550 |
+
"input" => "html",
|
551 |
+
"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" : "" )) . " />",
|
552 |
+
);
|
553 |
+
return $form;
|
554 |
+
}
|
555 |
+
|
556 |
+
public function attachment_fields_to_save( $post, $attachment )
|
557 |
+
{
|
558 |
+
if ( isset( $attachment['ftg_link'] ) ) {
|
559 |
+
update_post_meta( $post['ID'], '_ftg_link', esc_url_raw( $attachment['ftg_link'] ) );
|
560 |
+
}
|
561 |
+
if ( isset( $attachment['ftg_target'] ) ) {
|
562 |
+
update_post_meta( $post['ID'], '_ftg_target', sanitize_text_field( $attachment['ftg_target'] ) );
|
563 |
+
}
|
564 |
+
return $post;
|
565 |
+
}
|
566 |
+
|
567 |
+
//Delete gallery
|
568 |
+
public function delete_gallery()
|
569 |
+
{
|
570 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
571 |
+
$this->FinalTilesdb->deleteGallery( intval( $_POST['id'] ) );
|
572 |
+
}
|
573 |
+
return array();
|
574 |
+
}
|
575 |
+
|
576 |
+
public function update_configuration()
|
577 |
+
{
|
578 |
+
|
579 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
580 |
+
$id = $_POST['galleryId'];
|
581 |
+
$config = stripslashes( $_POST['config'] );
|
582 |
+
$this->FinalTilesdb->update_config( $id, $config );
|
583 |
+
}
|
584 |
+
|
585 |
+
exit;
|
586 |
+
}
|
587 |
+
|
588 |
+
public function get_configuration()
|
589 |
+
{
|
590 |
+
|
591 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
592 |
+
$id = $_POST['galleryId'];
|
593 |
+
$gallery = $this->FinalTilesdb->getGalleryConfig( $id );
|
594 |
+
echo $gallery ;
|
595 |
+
}
|
596 |
+
|
597 |
+
exit;
|
598 |
+
}
|
599 |
+
|
600 |
+
public function get_image_size_url()
|
601 |
+
{
|
602 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
603 |
+
echo wp_get_attachment_image_url( $_POST['id'], $_POST['size'], false ) ;
|
604 |
+
}
|
605 |
+
exit;
|
606 |
+
}
|
607 |
+
|
608 |
+
//Clone gallery
|
609 |
+
public function clone_gallery()
|
610 |
+
{
|
611 |
+
|
612 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
613 |
+
$sourceId = intval( $_POST['id'] );
|
614 |
+
$g = $this->FinalTilesdb->getGalleryById( $sourceId, true );
|
615 |
+
$g['name'] .= " (copy)";
|
616 |
+
$this->FinalTilesdb->addGallery( $g );
|
617 |
+
$id = $this->FinalTilesdb->getNewGalleryId();
|
618 |
+
$images = $this->FinalTilesdb->getImagesByGalleryId( $sourceId, 0, 0 );
|
619 |
+
foreach ( $images as &$image ) {
|
620 |
+
$image->Id = null;
|
621 |
+
$image->gid = $id;
|
622 |
+
}
|
623 |
+
$this->FinalTilesdb->addImages( $id, $images );
|
624 |
+
}
|
625 |
+
|
626 |
+
return array();
|
627 |
+
}
|
628 |
+
|
629 |
+
//Add gallery scripts
|
630 |
+
public function add_gallery_scripts()
|
631 |
+
{
|
632 |
+
wp_enqueue_script( 'jquery' );
|
633 |
+
wp_register_script(
|
634 |
+
'finalTilesGallery',
|
635 |
+
plugins_url( 'scripts/jquery.finalTilesGallery.js', __FILE__ ),
|
636 |
+
array( 'jquery' ),
|
637 |
+
FTGVERSION,
|
638 |
+
true
|
639 |
+
);
|
640 |
+
wp_enqueue_script( 'finalTilesGallery' );
|
641 |
+
wp_register_style(
|
642 |
+
'finalTilesGallery_stylesheet',
|
643 |
+
plugins_url( 'scripts/ftg.css', __FILE__ ),
|
644 |
+
array(),
|
645 |
+
FTGVERSION
|
646 |
+
);
|
647 |
+
wp_enqueue_style( 'finalTilesGallery_stylesheet' );
|
648 |
+
wp_register_script( 'lightbox2_script', plugins_url( 'lightbox/lightbox2/js/script.js', __FILE__ ), array( 'jquery' ) );
|
649 |
+
wp_register_style( 'lightbox2_stylesheet', plugins_url( 'lightbox/lightbox2/css/style.css', __FILE__ ) );
|
650 |
+
wp_register_style( 'fontawesome_stylesheet', '//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css' );
|
651 |
+
wp_enqueue_style( 'fontawesome_stylesheet' );
|
652 |
+
}
|
653 |
+
|
654 |
+
//Admin Section - register scripts and styles
|
655 |
+
public function gallery_admin_init()
|
656 |
+
{
|
657 |
+
if ( function_exists( 'wp_enqueue_media' ) ) {
|
658 |
+
wp_enqueue_media();
|
659 |
+
}
|
660 |
+
$ftg_db_version = '20190518';
|
661 |
+
$installed_ver = get_option( "FinalTiles_gallery_db_version" );
|
662 |
+
if ( !$installed_ver || empty($installed_ver) ) {
|
663 |
+
update_option( "FinalTiles_gallery_db_version", $ftg_db_version );
|
664 |
+
}
|
665 |
+
|
666 |
+
if ( $installed_ver != $ftg_db_version ) {
|
667 |
+
activate_finaltilesgallery();
|
668 |
+
update_option( "FinalTiles_gallery_db_version", $ftg_db_version );
|
669 |
+
}
|
670 |
+
|
671 |
+
function ftg_get_image_sizes()
|
672 |
+
{
|
673 |
+
global $_wp_additional_image_sizes ;
|
674 |
+
$sizes = array();
|
675 |
+
foreach ( get_intermediate_image_sizes() as $_size ) {
|
676 |
+
|
677 |
+
if ( in_array( $_size, array(
|
678 |
+
'thumbnail',
|
679 |
+
'medium',
|
680 |
+
'medium_large',
|
681 |
+
'large'
|
682 |
+
) ) ) {
|
683 |
+
$sizes[$_size]['width'] = get_option( "{$_size}_size_w" );
|
684 |
+
$sizes[$_size]['height'] = get_option( "{$_size}_size_h" );
|
685 |
+
$sizes[$_size]['crop'] = (bool) get_option( "{$_size}_crop" );
|
686 |
+
} elseif ( isset( $_wp_additional_image_sizes[$_size] ) ) {
|
687 |
+
$sizes[$_size] = array(
|
688 |
+
'width' => $_wp_additional_image_sizes[$_size]['width'],
|
689 |
+
'height' => $_wp_additional_image_sizes[$_size]['height'],
|
690 |
+
'crop' => $_wp_additional_image_sizes[$_size]['crop'],
|
691 |
+
);
|
692 |
+
}
|
693 |
+
|
694 |
+
}
|
695 |
+
return $sizes;
|
696 |
+
}
|
697 |
+
|
698 |
+
foreach ( ftg_get_image_sizes() as $name => $size ) {
|
699 |
+
$this->fields["Links & Lightbox"]["fields"]["lightboxImageSize"]["values"]["Size"][] = $name . "|" . $name . " (" . $size['width'] . 'x' . $size['height'] . (( $size['crop'] ? ' cropped)' : ')' ));
|
700 |
+
}
|
701 |
+
$this->fields["Links & Lightbox"]["fields"]["lightboxImageSize"]["values"]["Size"][] = "full|Original (full)";
|
702 |
+
wp_enqueue_script( 'jquery' );
|
703 |
+
wp_enqueue_script( 'jquery-ui-dialog' );
|
704 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
705 |
+
wp_enqueue_script( 'wp-color-picker' );
|
706 |
+
wp_enqueue_style( 'wp-color-picker' );
|
707 |
+
wp_enqueue_script( 'media-upload' );
|
708 |
+
wp_enqueue_script( 'thickbox' );
|
709 |
+
wp_register_style( 'google-fonts', '//fonts.googleapis.com/css?family=Roboto:400,700,500,300,900' );
|
710 |
+
wp_enqueue_style( 'google-fonts' );
|
711 |
+
wp_register_style( 'google-icons', '//cdn.materialdesignicons.com/1.9.32/css/materialdesignicons.min.css', array() );
|
712 |
+
wp_enqueue_style( 'google-icons' );
|
713 |
+
wp_register_style( 'final-tiles-gallery-admin', plugins_url( 'admin/css/style.css', __FILE__ ), array( 'colors' ) );
|
714 |
+
wp_enqueue_style( 'final-tiles-gallery-admin' );
|
715 |
+
wp_register_script( 'materialize', plugins_url( 'admin/scripts/materialize.min.js', __FILE__ ), array( 'jquery' ) );
|
716 |
+
wp_enqueue_script( 'materialize' );
|
717 |
+
wp_register_script( 'final-tiles-gallery', plugins_url( 'admin/scripts/final-tiles-gallery-admin.js', __FILE__ ), array(
|
718 |
+
'jquery',
|
719 |
+
'media-upload',
|
720 |
+
'thickbox',
|
721 |
+
'materialize'
|
722 |
+
) );
|
723 |
+
wp_enqueue_script( 'final-tiles-gallery' );
|
724 |
+
wp_enqueue_style( 'thickbox' );
|
725 |
+
wp_register_style( 'fontawesome_stylesheet', '//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.css' );
|
726 |
+
wp_enqueue_style( 'fontawesome_stylesheet' );
|
727 |
+
}
|
728 |
+
|
729 |
+
//Create Admin Menu
|
730 |
+
public function add_gallery_admin_menu()
|
731 |
+
{
|
732 |
+
$overview = add_menu_page(
|
733 |
+
'Final Tiles Gallery',
|
734 |
+
'Final Tiles Gallery',
|
735 |
+
'edit_posts',
|
736 |
+
'ftg-lite-gallery-admin',
|
737 |
+
array( $this, 'add_overview' ),
|
738 |
+
plugins_url( 'admin/icon.png', __FILE__ )
|
739 |
+
);
|
740 |
+
$add_gallery = add_submenu_page(
|
741 |
+
'ftg-lite-gallery-admin',
|
742 |
+
esc_html__( 'FinalTiles Gallery >> Add Gallery', 'final-tiles-grid-gallery-lite' ),
|
743 |
+
esc_html__( 'Add Gallery', 'final-tiles-grid-gallery-lite' ),
|
744 |
+
'edit_posts',
|
745 |
+
'ftg-add-gallery',
|
746 |
+
array( $this, 'add_gallery' )
|
747 |
+
);
|
748 |
+
add_action( 'load-' . $overview, array( $this, 'gallery_admin_init' ) );
|
749 |
+
add_action( 'load-' . $add_gallery, array( $this, 'gallery_admin_init' ) );
|
750 |
+
/*if(! class_exists("PhotoBlocks"))
|
751 |
+
{
|
752 |
+
$photoblocks = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> PhotoBlocks', 'FinalTiles-gallery'), __('PhotoBlocks', 'FinalTiles-gallery'), 'edit_posts', 'ftg-photoblocks', array($this, 'photoblocks'));
|
753 |
+
add_action('load-' . $photoblocks, array($this, 'gallery_admin_init'));
|
754 |
+
}
|
755 |
+
|
756 |
+
if(! class_exists("EverlightBox"))
|
757 |
+
{
|
758 |
+
$everlightbox = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> EverlightBox', 'FinalTiles-gallery'), __('EverlightBox', 'FinalTiles-gallery'), 'edit_posts', 'ftg-everlightbox', array($this, 'everlightbox'));
|
759 |
+
add_action('load-' . $everlightbox, array($this, 'gallery_admin_init'));
|
760 |
+
}*/
|
761 |
+
}
|
762 |
+
|
763 |
+
//Create Admin Pages
|
764 |
+
public function add_overview()
|
765 |
+
{
|
766 |
+
global $ftg_fields ;
|
767 |
+
$ftg_fields = $this->fields;
|
768 |
+
global $ftg_parent_page ;
|
769 |
+
$ftg_parent_page = "dashboard";
|
770 |
+
|
771 |
+
if ( array_key_exists( "id", $_GET ) ) {
|
772 |
+
$woocommerce_post_types = array(
|
773 |
+
"product",
|
774 |
+
"product_variation",
|
775 |
+
"shop_order",
|
776 |
+
"shop_order_refund",
|
777 |
+
"shop_coupon",
|
778 |
+
"shop_webhook"
|
779 |
+
);
|
780 |
+
$wp_post_types = array( "revision", "nav_menu_item" );
|
781 |
+
$excluded_post_types = array_merge( $wp_post_types, $woocommerce_post_types );
|
782 |
+
$woo_categories = $this->getWooCategories();
|
783 |
+
include "admin/edit-gallery.php";
|
784 |
+
} else {
|
785 |
+
include "admin/overview.php";
|
786 |
+
}
|
787 |
+
|
788 |
+
}
|
789 |
+
|
790 |
+
public function tutorial()
|
791 |
+
{
|
792 |
+
include "admin/tutorial.php";
|
793 |
+
}
|
794 |
+
|
795 |
+
public function support()
|
796 |
+
{
|
797 |
+
include "admin/support.php";
|
798 |
+
}
|
799 |
+
|
800 |
+
public function photoblocks()
|
801 |
+
{
|
802 |
+
include "admin/photoblocks.php";
|
803 |
+
}
|
804 |
+
|
805 |
+
public function everlightbox()
|
806 |
+
{
|
807 |
+
include "admin/everlightbox.php";
|
808 |
+
}
|
809 |
+
|
810 |
+
private function getWooCategories()
|
811 |
+
{
|
812 |
+
|
813 |
+
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
814 |
+
$taxonomy = 'product_cat';
|
815 |
+
$orderby = 'name';
|
816 |
+
$show_count = 0;
|
817 |
+
// 1 for yes, 0 for no
|
818 |
+
$pad_counts = 0;
|
819 |
+
// 1 for yes, 0 for no
|
820 |
+
$hierarchical = 1;
|
821 |
+
// 1 for yes, 0 for no
|
822 |
+
$title = '';
|
823 |
+
$empty = 0;
|
824 |
+
$args = array(
|
825 |
+
'taxonomy' => $taxonomy,
|
826 |
+
'orderby' => $orderby,
|
827 |
+
'show_count' => $show_count,
|
828 |
+
'pad_counts' => $pad_counts,
|
829 |
+
'hierarchical' => $hierarchical,
|
830 |
+
'title_li' => $title,
|
831 |
+
'hide_empty' => $empty,
|
832 |
+
);
|
833 |
+
return get_categories( $args );
|
834 |
+
} else {
|
835 |
+
return array();
|
836 |
+
}
|
837 |
+
|
838 |
+
}
|
839 |
+
|
840 |
+
public function add_gallery()
|
841 |
+
{
|
842 |
+
global $ftg_fields ;
|
843 |
+
$ftg_fields = $this->fields;
|
844 |
+
$gallery = null;
|
845 |
+
$woocommerce_post_types = array(
|
846 |
+
"product",
|
847 |
+
"product_variation",
|
848 |
+
"shop_order",
|
849 |
+
"shop_order_refund",
|
850 |
+
"shop_coupon",
|
851 |
+
"shop_webhook"
|
852 |
+
);
|
853 |
+
$wp_post_types = array( "revision", "nav_menu_item" );
|
854 |
+
$excluded_post_types = array_merge( $wp_post_types, $woocommerce_post_types );
|
855 |
+
$woo_categories = $this->getWooCategories();
|
856 |
+
include "admin/add-gallery.php";
|
857 |
+
}
|
858 |
+
|
859 |
+
public function delete_image()
|
860 |
+
{
|
861 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
862 |
+
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
863 |
+
$this->FinalTilesdb->deleteImage( intval( $id ) );
|
864 |
+
}
|
865 |
+
}
|
866 |
+
wp_die();
|
867 |
+
}
|
868 |
+
|
869 |
+
public function assign_filters()
|
870 |
+
{
|
871 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
872 |
+
|
873 |
+
if ( $_POST['source'] == 'posts' ) {
|
874 |
+
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
875 |
+
update_post_meta( intval( $id ), 'ftg_filters', sanitize_text_field( $_POST['filters'] ) );
|
876 |
+
}
|
877 |
+
} else {
|
878 |
+
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
879 |
+
$result = $this->FinalTilesdb->editImage( $id, array(
|
880 |
+
"filters" => sanitize_text_field( $_POST["filters"] ),
|
881 |
+
) );
|
882 |
+
}
|
883 |
+
}
|
884 |
+
|
885 |
+
}
|
886 |
+
wp_die();
|
887 |
+
}
|
888 |
+
|
889 |
+
public function toggle_visibility()
|
890 |
+
{
|
891 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
892 |
+
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
893 |
+
$image = $this->FinalTilesdb->getImage( $id );
|
894 |
+
$this->FinalTilesdb->editImage( $id, array(
|
895 |
+
"hidden" => ( $image->hidden == 'T' ? 'F' : 'T' ),
|
896 |
+
) );
|
897 |
+
}
|
898 |
+
}
|
899 |
+
wp_die();
|
900 |
+
}
|
901 |
+
|
902 |
+
public function assign_group()
|
903 |
+
{
|
904 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
905 |
+
|
906 |
+
if ( $_POST['source'] == 'posts' ) {
|
907 |
+
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
908 |
+
update_post_meta( intval( $id ), 'ftg_group', sanitize_text_field( $_POST['group'] ) );
|
909 |
+
}
|
910 |
+
} else {
|
911 |
+
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
912 |
+
$result = $this->FinalTilesdb->editImage( $id, array(
|
913 |
+
"group" => sanitize_text_field( $_POST["group"] ),
|
914 |
+
) );
|
915 |
+
}
|
916 |
+
}
|
917 |
+
|
918 |
+
}
|
919 |
+
wp_die();
|
920 |
+
}
|
921 |
+
|
922 |
+
public function add_image()
|
923 |
+
{
|
924 |
+
|
925 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
926 |
+
$gid = intval( $_POST['galleryId'] );
|
927 |
+
$enc_images = stripslashes( $_POST["enc_images"] );
|
928 |
+
$images = json_decode( $enc_images );
|
929 |
+
$result = $this->FinalTilesdb->addImages( $gid, $images );
|
930 |
+
header( "Content-type: application/json" );
|
931 |
+
|
932 |
+
if ( $result === false ) {
|
933 |
+
echo "{\"success\":false}" ;
|
934 |
+
} else {
|
935 |
+
echo "{\"success\":true}" ;
|
936 |
+
}
|
937 |
+
|
938 |
+
}
|
939 |
+
|
940 |
+
wp_die();
|
941 |
+
}
|
942 |
+
|
943 |
+
public function list_thumbnail_sizes()
|
944 |
+
{
|
945 |
+
global $_wp_additional_image_sizes ;
|
946 |
+
$sizes = array();
|
947 |
+
foreach ( get_intermediate_image_sizes() as $s ) {
|
948 |
+
|
949 |
+
if ( in_array( $s, array( 'thumbnail', 'medium', 'large' ) ) ) {
|
950 |
+
$sizes[$s][0] = get_option( $s . '_size_w' );
|
951 |
+
$sizes[$s][1] = get_option( $s . '_size_h' );
|
952 |
+
} else {
|
953 |
+
if ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[$s] ) && $_wp_additional_image_sizes[$s]['width'] > 0 && $_wp_additional_image_sizes[$s]['height'] > 0 ) {
|
954 |
+
$sizes[$s] = array( $_wp_additional_image_sizes[$s]['width'], $_wp_additional_image_sizes[$s]['height'] );
|
955 |
+
}
|
956 |
+
}
|
957 |
+
|
958 |
+
}
|
959 |
+
return $sizes;
|
960 |
+
}
|
961 |
+
|
962 |
+
public function sort_images()
|
963 |
+
{
|
964 |
+
|
965 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
966 |
+
$result = $this->FinalTilesdb->sortImages( explode( ',', $_POST['ids'] ) );
|
967 |
+
header( "Content-type: application/json" );
|
968 |
+
|
969 |
+
if ( $result === false ) {
|
970 |
+
echo "{\"success\":false}" ;
|
971 |
+
} else {
|
972 |
+
echo "{\"success\":true}" ;
|
973 |
+
}
|
974 |
+
|
975 |
+
}
|
976 |
+
|
977 |
+
wp_die();
|
978 |
+
}
|
979 |
+
|
980 |
+
public function load_chunk()
|
981 |
+
{
|
982 |
+
require_once 'lib/gallery-class.php';
|
983 |
+
|
984 |
+
if ( check_admin_referer( 'finaltilesgallery', 'finaltilesgallery' ) ) {
|
985 |
+
$gid = intval( $_POST["gallery"] );
|
986 |
+
$images = $this->FinalTilesdb->getImagesByGalleryId( $gid, 0, 0 );
|
987 |
+
$FinalTilesGallery = new FinalTilesGallery( $gid, $this->FinalTilesdb, $this->defaultValues );
|
988 |
+
echo $FinalTilesGallery->images_markup() ;
|
989 |
+
}
|
990 |
+
|
991 |
+
wp_die();
|
992 |
+
}
|
993 |
+
|
994 |
+
public function refresh_gallery()
|
995 |
+
{
|
996 |
+
if ( $_POST['source'] == 'images' ) {
|
997 |
+
$this->list_images();
|
998 |
+
}
|
999 |
+
}
|
1000 |
+
|
1001 |
+
public function save_image()
|
1002 |
+
{
|
1003 |
+
|
1004 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
1005 |
+
$result = false;
|
1006 |
+
|
1007 |
+
if ( $_POST['source'] == 'posts' ) {
|
1008 |
+
$result = true;
|
1009 |
+
$postId = intval( $_POST['post_id'] );
|
1010 |
+
$img_url = stripslashes( $_POST['img_url'] );
|
1011 |
+
update_post_meta( $postId, 'ftg_image_url', esc_url_raw( $img_url ) );
|
1012 |
+
if ( array_key_exists( "filters", $_POST ) && strlen( $_POST['filters'] ) ) {
|
1013 |
+
update_post_meta( $postId, 'ftg_filters', sanitize_text_field( $_POST['filters'] ) );
|
1014 |
+
}
|
1015 |
+
} else {
|
1016 |
+
$type = sanitize_text_field( $_POST['type'] );
|
1017 |
+
$imageUrl = stripslashes( $_POST['img_url'] );
|
1018 |
+
$imageCaption = wp_kses_post( $_POST['description'] );
|
1019 |
+
$filters = stripslashes( $_POST['filters'] );
|
1020 |
+
$title = wp_kses_post( $_POST['imageTitle'] );
|
1021 |
+
$target = sanitize_text_field( $_POST['target'] );
|
1022 |
+
$group = sanitize_text_field( $_POST['group'] );
|
1023 |
+
$alt = sanitize_text_field( $_POST['alt'] );
|
1024 |
+
$hidden = $this->checkboxVal( 'hidden' );
|
1025 |
+
$link = ( isset( $_POST['link'] ) ? stripslashes( $_POST['link'] ) : null );
|
1026 |
+
$imageId = intval( $_POST['img_id'] );
|
1027 |
+
$sortOrder = intval( $_POST['sortOrder'] );
|
1028 |
+
$data = array(
|
1029 |
+
"imagePath" => $imageUrl,
|
1030 |
+
"target" => $target,
|
1031 |
+
"link" => $link,
|
1032 |
+
"imageId" => $imageId,
|
1033 |
+
"description" => $imageCaption,
|
1034 |
+
"filters" => $filters,
|
1035 |
+
"title" => $title,
|
1036 |
+
"group" => $group,
|
1037 |
+
"alt" => $alt,
|
1038 |
+
"hidden" => $hidden,
|
1039 |
+
"sortOrder" => $sortOrder,
|
1040 |
+
);
|
1041 |
+
|
1042 |
+
if ( !empty($_POST["id"]) ) {
|
1043 |
+
$imageId = intval( $_POST['id'] );
|
1044 |
+
$result = $this->FinalTilesdb->editImage( $imageId, $data );
|
1045 |
+
} else {
|
1046 |
+
$data["gid"] = intval( $_POST['galleryId'] );
|
1047 |
+
$result = $this->FinalTilesdb->addFullImage( $data );
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
header( "Content-type: application/json" );
|
1053 |
+
|
1054 |
+
if ( $result === false ) {
|
1055 |
+
echo "{\"success\":false}" ;
|
1056 |
+
} else {
|
1057 |
+
echo "{\"success\":true}" ;
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
wp_die();
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
public function save_video()
|
1066 |
+
{
|
1067 |
+
|
1068 |
+
if ( check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
|
1069 |
+
$result = false;
|
1070 |
+
$type = ( isset( $_POST['type'] ) ? $_POST['type'] : "" );
|
1071 |
+
$data = array(
|
1072 |
+
"imagePath" => stripslashes( $_POST["embed"] ),
|
1073 |
+
"filters" => sanitize_text_field( $_POST['filters'] ),
|
1074 |
+
"gid" => intval( $_POST['galleryId'] ),
|
1075 |
+
);
|
1076 |
+
$id = ( isset( $_POST['id'] ) ? intval( $_POST['id'] ) : "" );
|
1077 |
+
$step = ( isset( $_POST['step'] ) ? $_POST['step'] : "" );
|
1078 |
+
if ( !empty($step) ) {
|
1079 |
+
|
1080 |
+
if ( $step == "add" ) {
|
1081 |
+
$result = $this->FinalTilesdb->addVideo( $data );
|
1082 |
+
} else {
|
1083 |
+
if ( $step == "edit" ) {
|
1084 |
+
$result = $this->FinalTilesdb->editVideo( $id, $data );
|