Version Description
Download this release
Release Info
Developer | giucu91 |
Plugin | Gallery – Photo Gallery – Image Gallery |
Version | 2.2.7 |
Comparing to | |
See all releases |
Code changes from version 2.2.6 to 2.2.7
- Modula.php +2 -2
- README.txt +1 -1
- assets/css/modula-cpt.css +12 -4
- assets/css/modula-cpt.min.css +1 -1
- assets/css/modula-importer.css +46 -0
- assets/css/modula.css +2 -4
- assets/css/modula.min.css +1 -1
- assets/js/jquery-modula.js +12 -12
- assets/js/jquery-modula.min.js +1 -1
- assets/js/modula-importer.js +227 -0
- assets/js/wp-modula-conditions.js +36 -1
- changelog.txt +13 -0
- includes/admin/class-modula-admin.php +63 -0
- includes/admin/class-modula-cpt-fields-helper.php +10 -11
- includes/admin/class-modula-cpt.php +16 -18
- includes/admin/class-modula-field-builder.php +2 -3
- includes/admin/class-modula-image.php +11 -9
- includes/admin/class-modula-upsells.php +21 -1
- includes/admin/tabs/about.php +13 -6
- includes/class-modula.php +5 -3
- includes/elementor/class-modula-elementor-widget-activation.php +1 -1
- includes/helper/class-modula-helper.php +23 -0
- includes/migrate/class-modula-importer.php +471 -0
- includes/migrate/envira/class-modula-envira-importer.php +312 -0
- includes/migrate/final-tiles/class-modula-final-tiles-importer.php +367 -0
- includes/migrate/nextgen/class-modula-nextgen-importer.php +445 -0
- includes/migrate/photoblocks/class-modula-photoblocks-importer.php +323 -0
- includes/migrate/tabs/modula-importer-tab.php +140 -0
- includes/migrate/wp-core-gallery/class-modula-wp-core-gallery-importer.php +237 -0
- includes/public/class-modula-shortcode.php +9 -5
Modula.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin URI: https://wp-modula.com/
|
5 |
* Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
|
6 |
* Author: MachoThemes
|
7 |
-
* Version: 2.2.
|
8 |
* Author URI: https://www.machothemes.com/
|
9 |
* License: GPLv3 or later
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -43,7 +43,7 @@
|
|
43 |
*
|
44 |
* @since 2.0.2
|
45 |
*/
|
46 |
-
define( 'MODULA_LITE_VERSION' , '2.2.
|
47 |
define( 'MODULA_PATH' , plugin_dir_path( __FILE__ ) );
|
48 |
define( 'MODULA_URL' , plugin_dir_url( __FILE__ ) );
|
49 |
defined( 'MODULA_PRO_STORE_URL' ) || define( 'MODULA_PRO_STORE_URL' , 'https://wp-modula.com' );
|
4 |
* Plugin URI: https://wp-modula.com/
|
5 |
* Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
|
6 |
* Author: MachoThemes
|
7 |
+
* Version: 2.2.7
|
8 |
* Author URI: https://www.machothemes.com/
|
9 |
* License: GPLv3 or later
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
43 |
*
|
44 |
* @since 2.0.2
|
45 |
*/
|
46 |
+
define( 'MODULA_LITE_VERSION' , '2.2.7' );
|
47 |
define( 'MODULA_PATH' , plugin_dir_path( __FILE__ ) );
|
48 |
define( 'MODULA_URL' , plugin_dir_url( __FILE__ ) );
|
49 |
defined( 'MODULA_PRO_STORE_URL' ) || define( 'MODULA_PRO_STORE_URL' , 'https://wp-modula.com' );
|
README.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: best gallery plugin, image gallery, photo gallery, responsive gallery, wor
|
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 2.2.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 5.3
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 2.2.7
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
assets/css/modula-cpt.css
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
color: #9c9c9c;
|
18 |
cursor: pointer;
|
19 |
position: relative;
|
20 |
-
width:
|
21 |
position: relative;
|
22 |
}
|
23 |
.modula-settings-container .modula-tabs .modula-tab sup {
|
@@ -71,10 +71,10 @@
|
|
71 |
.modula-settings-container .modula-tabs .modula-tab.active-tab:before {
|
72 |
content: "";
|
73 |
position: absolute;
|
74 |
-
left:
|
75 |
-
top:
|
76 |
width: 3px;
|
77 |
-
height: 100
|
78 |
background-color: #57a7c9;
|
79 |
}
|
80 |
.modula-settings-container .modula-tabs .modula-tab.active-tab:after {
|
@@ -1321,3 +1321,11 @@ Ups-sells carousel
|
|
1321 |
#modula-albums-upsell h2 {
|
1322 |
margin: 0 !important;
|
1323 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
color: #9c9c9c;
|
18 |
cursor: pointer;
|
19 |
position: relative;
|
20 |
+
width: 190px;
|
21 |
position: relative;
|
22 |
}
|
23 |
.modula-settings-container .modula-tabs .modula-tab sup {
|
71 |
.modula-settings-container .modula-tabs .modula-tab.active-tab:before {
|
72 |
content: "";
|
73 |
position: absolute;
|
74 |
+
left: -2px;
|
75 |
+
top: -1px;
|
76 |
width: 3px;
|
77 |
+
height: calc( 100% + 2px);
|
78 |
background-color: #57a7c9;
|
79 |
}
|
80 |
.modula-settings-container .modula-tabs .modula-tab.active-tab:after {
|
1321 |
#modula-albums-upsell h2 {
|
1322 |
margin: 0 !important;
|
1323 |
}
|
1324 |
+
|
1325 |
+
.modula-settings-container input[type="number"] {
|
1326 |
+
max-width: 80px;
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
.modula-after-input {
|
1330 |
+
margin-left: 5px;
|
1331 |
+
}
|
assets/css/modula-cpt.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#modula-settings .inside{padding:0;margin:0}.modula-settings-container{display:flex}.modula-settings-container .modula-tabs{background-color:#f8f8f8}.modula-settings-container .modula-tabs .modula-tab{margin:0 10px 0 0;padding:15px 0;color:#9c9c9c;cursor:pointer;position:relative;width:165px;position:relative}.modula-settings-container .modula-tabs .modula-tab sup{margin-left:5px;padding:2px 5px;border-radius:5px;color:#fff;font-size:8px;background:#9c9c9c;display:inline-block;line-height:1;position:relative;top:-2px}.modula-settings-container .modula-tabs .modula-tab.active-tab sup,.modula-settings-container .modula-tabs .modula-tab:hover sup{background-color:#57a7c9}.modula-settings-container .modula-tabs .modula-tab.modula-responsive.active-tab sup,.modula-settings-container .modula-tabs .modula-tab.modula-responsive:hover sup{background:#dc3232}.modula-settings-container .modula-tabs .modula-tab>i{margin-right:10px;margin-left:15px}.modula-settings-container .modula-tabs .modula-tab:after{position:absolute;content:"";width:1px;height:100%;background-color:transparent;top:0;right:-1px}.modula-settings-container .modula-tabs .modula-tab.active-tab:first-child{border-top:0 none}.modula-settings-container .modula-tabs .modula-tab:hover{color:#333}.modula-settings-container .modula-tabs .modula-tab.active-tab{margin:0;padding:15px 10px 15px 0;background-color:#fff;border-bottom:1px solid #ddd;border-top:1px solid #ddd;color:#333}.modula-settings-container .modula-tabs .modula-tab.active-tab:before{content:"";position:absolute;left:0;top:0;width:3px;height:100%;background-color:#57a7c9}.modula-settings-container .modula-tabs .modula-tab.active-tab:after{background-color:#fff}tr label.th-label{color:#23282d;font-weight:600;margin-bottom:10px}.postbox .modula-settings-container table.form-table{margin:0}.postbox .modula-settings-container .form-table-wrapper{padding:0 0 0 20px;box-sizing:border-box}.modula-settings-container .modula-tabs-content{padding:10px 20px;border-left:1px solid #eee;flex-grow:1}.modula-tabs-content>div:not(.active-tab){display:none}.modula-settings-container .modula-tabs-content .tab-content-header{width:100%;padding-bottom:12px;margin-bottom:10px;border-bottom:1px solid #eee;padding-left:20px;padding-right:0;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between}.modula-settings-container .modula-tabs-content .tab-content-header .tab-content-header-actions{display:flex;align-items:center}.modula-settings-container .modula-tabs-content .tab-content-header .tab-content-header-actions>span{margin:0 10px;font-style:italic}.modula-settings-container .modula-tabs-content .tab-content-header .tab-content-header-actions a.button>span{height:auto;line-height:26px;margin-right:10px}#poststuff .modula-settings-container .modula-tabs-content .tab-content-header .tab-content-header-title>h2{font-weight:700;padding:0;display:inline-block}#poststuff .modula-settings-container .modula-tabs-content .tab-content-header .tab-header-description p{margin:0}.modula-settings-container .form-table td p.description{font-size:13px}.modula-settings-container .slider-container{position:relative;height:2px;padding:10px 0;width:25em;box-sizing:border-box;margin-bottom:10px;display:flex;display:flex;justify-content:space-between;align-items:center}.modula-settings-container .slider-container input[type=text]{border:none;text-align:center;padding:2px;margin:0 20px 0 0;font-size:12px;color:#333;border-radius:10px;background-color:#fff;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.16);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.16);box-shadow:inset 0 1px 1px rgba(0,0,0,.16);width:40px;height:22px;cursor:default}.modula-settings-container .slider-container .ui-slider{position:relative;text-align:left;height:2px;border-radius:3px;border:none;display:block;width:100%;background:#d6d6d6;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.modula-settings-container .slider-container .ui-slider .ui-slider-handle{position:absolute;z-index:2;top:-10px;cursor:default;-ms-touch-action:none;touch-action:none;width:18px;height:18px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;background-color:#fff;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.1);-moz-box-shadow:0 1px 1px rgba(0,0,0,.1);box-shadow:0 1px 1px rgba(0,0,0,.1);border:solid 1px #d7d7d7;transform:translateX(-50%)}.modula-settings-container .slider-container .ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0;background:#57a7c9;top:0;bottom:0}.modula-effects-preview{margin-top:20px}.modula-effects-preview .modula-item{width:400px;height:300px;overflow:hidden;position:relative}.modula-effects-preview .modula-item img{position:absolute;min-height:100%;min-width:100%}.modula-effects-preview .modula-item .figc{display:flex;align-items:center;justify-content:center;color:#fff;font-size:11px;text-align:center;position:absolute;left:0;width:100%;height:100%;padding:0}.modula-effects-preview .modula-item .figc h2{font-size:21px!important;color:#fff}.modula-effects-preview .modula-item .figc p{color:#fff;font-size:15px;font-style:normal}.modula .modula-items .modula-item h2{margin:0}.modula .modula-items .modula-item p{margin:0;padding:0}.modula .figc{color:#000;text-align:center;position:absolute;left:0;width:100%;padding:2em}.modula .modula-item .jtg-social a{text-decoration:none;color:#fff;display:inline-block;margin:0 10px 0 0;width:20px;padding:6px 4px;border:0;opacity:0;transition:opacity .3s}.modula .modula-item .jtg-social svg{width:20px;height:16px}.modula .modula-item:hover .jtg-social a{opacity:1}.modula .modula-items .jtg-social{opacity:0;transition:opacity .1s;right:30px;position:absolute;bottom:20px;text-align:right;transition:all .3s}.modula .modula-items .jtg-social{opacity:1}.modula .modula-items .jtg-social a:last-of-type{margin-right:0}.modula .modula-item.effect-pufrobo p.description{margin-bottom:2em}.modula .modula-item.effect-pufrobo .figc{text-align:right}.modula .modula-item.effect-pufrobo h2,.modula .modula-item.effect-pufrobo p{position:absolute;right:30px;left:30px;padding:10px 0}.modula .modula-item:hover img{opacity:.8}.modula .modula-item{background-color:#000}.modula .modula-item.effect-pufrobo p{bottom:20%;line-height:1.5;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0);letter-spacing:1px}.modula .modula-item.effect-pufrobo h2{top:10%;-webkit-transition:-webkit-transform .35s;transition:transform .35s;-webkit-transform:translate3d(0,20px,0);transform:translate3d(0,20px,0)}.modula .modula-item.effect-pufrobo:hover h2{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modula .modula-item.effect-pufrobo h2::after{position:absolute;top:80%;left:0;width:100%;height:4px;background:#fff;content:'';-webkit-transform:translate3d(0,40px,0);transform:translate3d(0,40px,0)}.modula .modula-item.effect-pufrobo h2::after,.modula .modula-item.effect-pufrobo p{opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s}.modula .modula-item.effect-pufrobo:hover h2::after,.modula .modula-item.effect-pufrobo:hover p{margin-top:10px;margin-bottom:5px;opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modula-upsell{background:#f1f1f1;border:0;padding:15px;margin-top:30px}.form-table-wrapper .modula-upsell{border:1px solid #ddd;text-align:center}#poststuff .modula-upsell h2{margin:0 0 20px 0;font-size:16px;font-weight:700;background:#fff;left:-15px;top:-15px;padding:8px 12px;position:relative;width:calc(100% + 6px);border-bottom:1px solid #ddd}.modula-upsell p{margin:0}.modula-upsell p.modula-upsell-description{font-size:13px;line-height:1.5;color:#333;opacity:.8;margin-top:0;margin-bottom:10px;padding:0 10px}.modula-upsell .button{height:31px;line-height:31px;font-weight:700}.modula-upsell .button:first-child{margin-right:10px}.modula-upsell .action-link,.modula-upsell .action-link:hover{background:#51ad31;border-color:#51ad31;color:#fff;font-weight:700}#modula-uploader-container{position:relative;padding-left:10px;padding-right:10px}#modula-uploader-container.modula-resizer-enabled{margin-bottom:20px}.modula-upload-actions{padding:15px 20px;background-color:#f8fcfd;border-bottom:1px solid #ecf6f9;margin-bottom:20px;display:flex;align-items:center;justify-content:space-between;width:100%;box-sizing:border-box}.modula-upload-actions .buttons{flex-shrink:0;width:275px;display:flex}.modula-sources-dropdown{position:relative;border-top:1px solid rgba(255,255,255,0);border-right:1px solid rgba(255,255,255,0);border-left:1px solid rgba(255,255,255,0)}.modula-sources-dropdown:hover{border-color:#ddd;background:#f5f5f5}.modula-sources-dropdown>span{width:28px;height:32px;text-align:center;line-height:28px;cursor:pointer;display:inline-block;font-size:25px;font-weight:700}.modula-sources-dropdown .modula-sources-dropdown-content{position:absolute;right:-1px;bottom:0;transform:translateY(100%);display:none;padding:15px;background-color:#f5f5f5;box-shadow:0 1px 1px rgba(0,0,0,.04);box-sizing:border-box;border:1px solid #ddd}.modula-sources-dropdown:hover .modula-sources-dropdown-content{display:block}.modula-sources-dropdown:hover .modula-sources-dropdown-content:before{content:"";height:1px;width:28px;background-color:#f5f5f5;position:absolute;top:-1px;right:0}.segrip.ui-resizable-se{width:30px;height:30px;background:url(../images/resize-se.svg) no-repeat;background-size:contain;display:none;z-index:100;opacity:1}.modula-resizer-enabled .segrip.ui-resizable-se{display:block}.modula-upload-actions #modula-uploader-browser{border-bottom-right-radius:0;border-top-right-radius:0}.modula-upload-actions #modula-wp-gallery{border-bottom-left-radius:0;border-top-left-radius:0}.wp-core-ui .modula-upload-actions>a{margin:0 5px}#modula-dropzone-container{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,86,132,.9);z-index:250000;display:none;text-align:center;opacity:0;transition:opacity 250ms}#modula-dropzone-container .modula-uploader-window-content{position:absolute;top:10px;left:10px;right:10px;bottom:10px;border:1px dashed #fff}#poststuff #modula-dropzone-container .modula-uploader-window-content h1{margin:-.5em 0 0;position:absolute;top:50%;left:0;right:0;-webkit-transform:translateY(-50%);transform:translateY(-50%);font-size:20px;line-height:28px;font-weight:400;color:#fff;padding:0}.modula-uploader-inline-content{position:relative;min-height:300px;width:100%}.modula-resizer-enabled .modula-uploader-inline-content{min-height:initial}.modula-uploader-inline-content h2{text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}#poststuff .modula-upload-message{font-size:43px;line-height:1;font-weight:400;margin:0;display:none;color:#ebebeb}#poststuff .modula-upload-message .dashicons,#poststuff .modula-upload-message .dashicons-before:before{font-size:43px;width:43px;height:43px}.modula-uploader-inline p{font-size:12px;margin:.5em 0}#poststuff .modula-uploader-inline .modula-upload-instructions{font-size:14px;color:#444;font-weight:400;padding:0}.modula-uploader-footer .max-upload-size{float:left}.modula-uploader-footer .modula-upload-numbers{float:right;opacity:0}.modula-uploader-footer:after{display:block;content:"";clear:both}.upload-progress .modula-upload-numbers{margin:0;line-height:1.4em}.modula-progress-bar{width:100%;max-width:400px;position:relative;height:2px;margin:8px 0 0;border-radius:10px;background:#e5e5e5}.upload-info-container{position:relative;overflow:hidden;flex-grow:1}.upload-info-container .upload-info{padding:5px 0}.upload-info-container .upload-progress{position:absolute;background-color:#f8fcfd;height:100%;display:flex;top:0;left:0;width:100%;flex-direction:column;transition:transform .5s;transform:translateY(100%)}.modula-upload-actions.show-progress .upload-info-container .upload-progress{transform:translateY(0)}.modula-progress-bar .modula-progress-bar-inner{height:2px;min-width:20px;width:0;background:#0085ba;-webkit-transition:width .3s;-moz-transition:width .3s;-ms-transition:width .3s;-o-transition:width .3s;transition:width .3s;border-radius:5px}.modula-uploader-footer.show-progress .modula-progress-bar,.modula-uploader-footer.show-progress .modula-upload-numbers{opacity:1}.modula-uploader-inline-content .modula-single-image,.modula-uploader-inline-content .modula-single-image-placeholder{cursor:move;display:inline-block;padding:0 10px 20px 0;box-sizing:border-box;width:16.66%}.modula-uploader-inline-content .modula-single-image-placeholder:after{width:100%;height:100%;display:inline-block;content:"";position:relative;border:3px dashed #444;padding-top:calc(100% - 6px);box-sizing:border-box}.modula-uploader-inline-content .modula-single-image .modula-single-image-content{position:relative;border:1px solid #d6d6d6;box-sizing:border-box;background-position:center;background-size:cover}.modula-uploader-inline-content .modula-single-image .modula-single-image-content img{display:block;width:100%}#poststuff .modula-uploader-inline-content>.modula-upload-message:only-child{display:block}.modula-uploader-inline-content .modula-single-image .actions{position:absolute;z-index:99;font-size:0;width:100%;height:100%;top:0;left:0;background:rgba(0,0,0,.4);padding:5px;box-sizing:border-box;display:none}.modula-uploader-inline-content .modula-single-image:hover .actions{display:block}.modula-uploader-inline-content .modula-single-image .actions a{width:20px;height:20px;border-radius:100%;border:1px solid #000;background-color:rgba(255,255,255,.8);color:#000;display:block;text-decoration:none;text-align:center;line-height:20px;margin-bottom:5px}.modula-uploader-inline-content .modula-single-image .actions a:hover{background-color:#000;color:#fff}.modula-uploader-inline-content .modula-single-image .actions a span{font-size:16px;width:20px;height:20px;line-height:20px}.modula-uploader-inline-content .modula-single-image .actions a.modula-delete-image{color:#a00a00}.modula-uploader-inline-content .modula-single-image .actions a.modula-delete-image:hover{background-color:#a00a00;color:#fff}.modula-uploader-inline-content:after{content:"";display:block;clear:both}.media-modal .modula-edit-popup.edit-attachment-frame .edit-media-header button.right{border-right:1px solid #ddd}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting{margin:0 0 20px 0;padding:0 0 20px 0;border-bottom:1px solid #ddd}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting span.name{display:block;width:100%;min-width:100%;margin:0;padding:0;text-align:left;font-weight:700;font-size:14px}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting input[type=text],.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting textarea{display:block;width:100%;min-width:100%;margin:0}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting div.description{clear:both;float:left;margin:5px 0 0 0;text-align:left;font-size:13px;font-style:italic;color:#666}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings{margin:0;padding:0;border:none}.media-modal .attachment-info .actions a{display:inline-block}.inline-input{display:inline}.ui-draggable.ui-resizable>.segrip{width:10px;height:10px;background:red;position:absolute;bottom:0;right:0}.ui-draggable.ui-resizable .modula-single-image-content img{display:none}.ui-draggable.ui-resizable .modula-single-image-content{width:100%;height:100%}.ui-draggable.ui-resizable.modula-single-image{padding:0}.packery-drop-placeholder{outline:3px dashed #444;outline-offset:-6px;-webkit-transition:-webkit-transform .2s;transition:transform .2s}.ui-resizable-helper{border:3px dashed #444;box-sizing:border-box}#poststuff #modula-preview-gallery h2.hndle,#poststuff #modula-settings h2.hndle{padding-left:20px}#poststuff #modula-preview-gallery .inside{margin-top:0;padding:0}.modula-edit-popup .attachment-details .setting span.description>span{display:inline-block;float:none;width:auto;min-width:unset;line-height:16px;min-height:16px;margin-top:8px;padding:0;vertical-align:middle;margin-right:0}.modula-edit-popup .attachment-details .setting span.description{text-align:left;vertical-align:middle}.modula-media-modal .attachments-browser .media-toolbar .media-toolbar-secondary{width:100%}.modula-error-container{display:block}.modula-error-container.hide{display:none}.modula-error-container .modula-error{padding:12px;margin-bottom:12px;background:#fff;border-left:4px solid #dc3232;box-shadow:0 0 4px 0 rgba(0,0,0,.1);font-weight:600;margin-top:5px;position:relative;background-color:#dc3232;color:#fff}.modula-error-container .modula-error a{color:#fff}.modula-error-container .modula-error .upload-dismiss-errors{position:absolute;top:50%;right:-5px;padding:10px;transition:none;display:block;text-decoration:none;margin-top:-18px}.modula-error-container .modula-error .upload-dismiss-errors:before{content:"\f153";display:block;font:400 16px/1 dashicons;color:#fff}a.modula-tab-link{text-decoration:none}.modula-tab-link span.dashicons{width:16px;height:16px;line-height:16px;margin-right:3px;vertical-align:text-bottom;font-size:16px;text-decoration:none}#modula-grid{height:100%;position:absolute;overflow:hidden;top:0;left:0;width:100%}#modula-grid .modula-grid-item{background-color:#fafafa;float:left}#modula-grid .modula-grid-item:nth-child(12n){margin-right:0!important}#modula-grid:after{content:"";display:block;clear:both}.modula-tooltip{position:relative;display:inline-block}.modula-tooltip>span{cursor:pointer;color:#0073aa;text-decoration:underline;margin-left:5px}.modula-tooltip .modula-tooltip-content{display:none;position:absolute;top:50%;right:-10px;transform:translate(100% ,-50%);width:300px;background:#000;color:#fff;padding:10px;box-sizing:border-box;z-index:99}.modula-tooltip .modula-tooltip-content:before{content:'';width:0;height:0;border-style:solid;border-width:8px 8px 8px 0;border-color:transparent #000 transparent transparent;display:block;position:absolute;top:50%;left:-8px;transform:translateY(-50%)}.modula-tooltip:hover .modula-tooltip-content{display:block}.modula-helper-guidelines-container{padding:15px 20px;background-color:#f8fcfd;display:flex;align-items:center;border-top:1px solid #ecf6f9}.modula-helper-guidelines-container .onoffswitch{margin-top:0}.modula-helper-guidelines-wrapper .modula-helper-guidelines-label{margin-left:5px}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image .modula-single-image-content{background:#eee!important;position:relative;overflow:hidden}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image-content:before{content:"";display:block;padding-top:100%}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image-content img{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image-content.landscape img{max-height:100%}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image-content.portrait img{max-width:100%}.modula-toggle{position:relative;position:relative;user-select:none;display:inline-block}.modula-toggle__items{box-sizing:border-box;display:inline-block;position:relative}.modula-toggle__items>*{box-sizing:inherit}.modula-toggle__input[type=checkbox]{border-radius:2px;border:2px solid #6c7781;margin-right:12px;transition:none;height:100%;left:0;top:0;margin:0;padding:0;opacity:0;position:absolute;width:100%;z-index:1}.modula-toggle__track{background-color:#fff;border:2px solid #6c7781;border-radius:9px;display:inline-block;height:18px;width:36px;vertical-align:top;transition:background .2s ease}.modula-toggle__thumb{background-color:#6c7781;border:5px solid #6c7781;border-radius:50%;display:block;height:10px;width:10px;position:absolute;left:4px;top:4px;transition:transform .2s ease}.modula-toggle__off{position:absolute;right:6px;top:6px;color:#6c7781;fill:currentColor}.modula-toggle__on{position:absolute;top:6px;left:8px;border:1px solid #fff;outline:1px solid transparent;outline-offset:-1px;display:none}.modula-toggle__input[type=checkbox]:checked+.modula-toggle__items .modula-toggle__track{background-color:#11a0d2;border:9px solid transparent}.modula-toggle__input[type=checkbox]:checked+.modula-toggle__items .modula-toggle__thumb{background-color:#fff;border-width:0;transform:translateX(18px)}.modula-toggle__input[type=checkbox]:checked+.modula-toggle__items .modula-toggle__off{display:none}.modula-toggle__input[type=checkbox]:checked+.modula-toggle__items .modula-toggle__on{display:inline-block}p.description.alert{color:red}tr.troubleshoot-subfield.hide{display:none}.modula-copy-shortcode{display:flex;align-items:center;flex-wrap:wrap}.modula-copy-shortcode input{margin:0;border-top-right-radius:0;border-bottom-right-radius:0;flex-grow:1}.modula-copy-shortcode span{width:100%}.wp-core-ui .modula-copy-shortcode a.button-primary{height:30px;border-top-left-radius:0;border-bottom-left-radius:0}@keyframes carousel{0%{transform:translateX(0);opacity:1!important}50%{transform:translateX(0);opacity:1!important}51%{transform:translateX(-100%);opacity:1!important}99%{transform:translateX(-100%);opacity:1!important}100%{transform:translateX(-200%);opacity:1!important}}.modula-upsells-carousel-wrapper{position:relative;display:flex;overflow:hidden}.modula-upsells-carousel{flex-shrink:0;position:relative;display:block;width:100%}.modula-upsells-carousel .modula-upsell-item{position:relative;width:100%;flex-shrink:0;margin-top:0;left:-15px}.modula-upsells-carousel .modula-upsell-item{text-align:center}.modula-upsells-carousel .modula-upsell-item ul.modula-upsells-list{padding-left:40px}.modula-upsells-carousel .modula-upsell-item ul li{position:relative;list-style-type:none!important;text-align:left}#modula-albums-upsell .modula-upsells-carousel .modula-upsell-item ul li{display:inline-block;margin:0 15px 15px 35px}.modula-upsells-carousel .modula-upsell-item ul li:before{font-family:Dashicons;content:"\f147";position:absolute;left:-30px;font-size:14px;color:green;background-color:#fff;padding:0 3px;border-radius:50%;border:1px solid #ddd;top:-1px}#modula-albums-upsell>button.handlediv,#modula-albums-upsell>h2.hndle.ui-sortable-handle,#modula-sorting-upsell>button.handlediv,#modula-sorting-upsell>h2.hndle.ui-sortable-handle{display:none}#modula-albums-upsell>.inside,#modula-sorting-upsell>.inside{padding:0;margin:0 auto}#modula_troubleshooting_option .modula-select label{margin-right:10px}#modula_troubleshooting_option .modula-select label:last-child{margin-right:0}#modula-albums-upsell h2{margin:0!important}
|
1 |
+
#modula-settings .inside{padding:0;margin:0}.modula-settings-container{display:flex}.modula-settings-container .modula-tabs{background-color:#f8f8f8}.modula-settings-container .modula-tabs .modula-tab{margin:0 10px 0 0;padding:15px 0;color:#9c9c9c;cursor:pointer;position:relative;width:165px;position:relative}.modula-settings-container .modula-tabs .modula-tab sup{margin-left:5px;padding:2px 5px;border-radius:5px;color:#fff;font-size:8px;background:#9c9c9c;display:inline-block;line-height:1;position:relative;top:-2px}.modula-settings-container .modula-tabs .modula-tab.active-tab sup,.modula-settings-container .modula-tabs .modula-tab:hover sup{background-color:#57a7c9}.modula-settings-container .modula-tabs .modula-tab.modula-responsive.active-tab sup,.modula-settings-container .modula-tabs .modula-tab.modula-responsive:hover sup{background:#dc3232}.modula-settings-container .modula-tabs .modula-tab>i{margin-right:10px;margin-left:15px}.modula-settings-container .modula-tabs .modula-tab:after{position:absolute;content:"";width:1px;height:100%;background-color:transparent;top:0;right:-1px}.modula-settings-container .modula-tabs .modula-tab.active-tab:first-child{border-top:0 none}.modula-settings-container .modula-tabs .modula-tab:hover{color:#333}.modula-settings-container .modula-tabs .modula-tab.active-tab{margin:0;padding:15px 10px 15px 0;background-color:#fff;border-bottom:1px solid #ddd;border-top:1px solid #ddd;color:#333}.modula-settings-container .modula-tabs .modula-tab.active-tab:before{content:"";position:absolute;left:-2px;top:-1px;width:3px;height:calc(100% + 2px);background-color:#57a7c9}.modula-settings-container .modula-tabs .modula-tab.active-tab:after{background-color:#fff}tr label.th-label{color:#23282d;font-weight:600;margin-bottom:10px}.postbox .modula-settings-container table.form-table{margin:0}.postbox .modula-settings-container .form-table-wrapper{padding:0 0 0 20px;box-sizing:border-box}.modula-settings-container .modula-tabs-content{padding:10px 20px;border-left:1px solid #eee;flex-grow:1}.modula-tabs-content>div:not(.active-tab){display:none}.modula-settings-container .modula-tabs-content .tab-content-header{width:100%;padding-bottom:12px;margin-bottom:10px;border-bottom:1px solid #eee;padding-left:20px;padding-right:0;box-sizing:border-box;display:flex;align-items:center;justify-content:space-between}.modula-settings-container .modula-tabs-content .tab-content-header .tab-content-header-actions{display:flex;align-items:center}.modula-settings-container .modula-tabs-content .tab-content-header .tab-content-header-actions>span{margin:0 10px;font-style:italic}.modula-settings-container .modula-tabs-content .tab-content-header .tab-content-header-actions a.button>span{height:auto;line-height:26px;margin-right:10px}#poststuff .modula-settings-container .modula-tabs-content .tab-content-header .tab-content-header-title>h2{font-weight:700;padding:0;display:inline-block}#poststuff .modula-settings-container .modula-tabs-content .tab-content-header .tab-header-description p{margin:0}.modula-settings-container .form-table td p.description{font-size:13px}.modula-settings-container .slider-container{position:relative;height:2px;padding:10px 0;width:25em;box-sizing:border-box;margin-bottom:10px;display:flex;display:flex;justify-content:space-between;align-items:center}.modula-settings-container .slider-container input[type=text]{border:none;text-align:center;padding:2px;margin:0 20px 0 0;font-size:12px;color:#333;border-radius:10px;background-color:#fff;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.16);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.16);box-shadow:inset 0 1px 1px rgba(0,0,0,.16);width:40px;height:22px;cursor:default}.modula-settings-container .slider-container .ui-slider{position:relative;text-align:left;height:2px;border-radius:3px;border:none;display:block;width:100%;background:#d6d6d6;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.modula-settings-container .slider-container .ui-slider .ui-slider-handle{position:absolute;z-index:2;top:-10px;cursor:default;-ms-touch-action:none;touch-action:none;width:18px;height:18px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px;background-color:#fff;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.1);-moz-box-shadow:0 1px 1px rgba(0,0,0,.1);box-shadow:0 1px 1px rgba(0,0,0,.1);border:solid 1px #d7d7d7;transform:translateX(-50%)}.modula-settings-container .slider-container .ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0;background:#57a7c9;top:0;bottom:0}.modula-effects-preview{margin-top:20px}.modula-effects-preview .modula-item{width:400px;height:300px;overflow:hidden;position:relative}.modula-effects-preview .modula-item img{position:absolute;min-height:100%;min-width:100%}.modula-effects-preview .modula-item .figc{display:flex;align-items:center;justify-content:center;color:#fff;font-size:11px;text-align:center;position:absolute;left:0;width:100%;height:100%;padding:0}.modula-effects-preview .modula-item .figc h2{font-size:21px!important;color:#fff}.modula-effects-preview .modula-item .figc p{color:#fff;font-size:15px;font-style:normal}.modula .modula-items .modula-item h2{margin:0}.modula .modula-items .modula-item p{margin:0;padding:0}.modula .figc{color:#000;text-align:center;position:absolute;left:0;width:100%;padding:2em}.modula .modula-item .jtg-social a{text-decoration:none;color:#fff;display:inline-block;margin:0 10px 0 0;width:20px;padding:6px 4px;border:0;opacity:0;transition:opacity .3s}.modula .modula-item .jtg-social svg{width:20px;height:16px}.modula .modula-item:hover .jtg-social a{opacity:1}.modula .modula-items .jtg-social{opacity:0;transition:opacity .1s;right:30px;position:absolute;bottom:20px;text-align:right;transition:all .3s}.modula .modula-items .jtg-social{opacity:1}.modula .modula-items .jtg-social a:last-of-type{margin-right:0}.modula .modula-item.effect-pufrobo p.description{margin-bottom:2em}.modula .modula-item.effect-pufrobo .figc{text-align:right}.modula .modula-item.effect-pufrobo h2,.modula .modula-item.effect-pufrobo p{position:absolute;right:30px;left:30px;padding:10px 0}.modula .modula-item:hover img{opacity:.8}.modula .modula-item{background-color:#000}.modula .modula-item.effect-pufrobo p{bottom:20%;line-height:1.5;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0);letter-spacing:1px}.modula .modula-item.effect-pufrobo h2{top:10%;-webkit-transition:-webkit-transform .35s;transition:transform .35s;-webkit-transform:translate3d(0,20px,0);transform:translate3d(0,20px,0)}.modula .modula-item.effect-pufrobo:hover h2{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modula .modula-item.effect-pufrobo h2::after{position:absolute;top:80%;left:0;width:100%;height:4px;background:#fff;content:'';-webkit-transform:translate3d(0,40px,0);transform:translate3d(0,40px,0)}.modula .modula-item.effect-pufrobo h2::after,.modula .modula-item.effect-pufrobo p{opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s}.modula .modula-item.effect-pufrobo:hover h2::after,.modula .modula-item.effect-pufrobo:hover p{margin-top:10px;margin-bottom:5px;opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modula-upsell{background:#f1f1f1;border:0;padding:15px;margin-top:30px}.form-table-wrapper .modula-upsell{border:1px solid #ddd;text-align:center}#poststuff .modula-upsell h2{margin:0 0 20px 0;font-size:16px;font-weight:700;background:#fff;left:-15px;top:-15px;padding:8px 12px;position:relative;width:calc(100% + 6px);border-bottom:1px solid #ddd}.modula-upsell p{margin:0}.modula-upsell p.modula-upsell-description{font-size:13px;line-height:1.5;color:#333;opacity:.8;margin-top:0;margin-bottom:10px;padding:0 10px}.modula-upsell .button{height:31px;line-height:31px;font-weight:700}.modula-upsell .button:first-child{margin-right:10px}.modula-upsell .action-link,.modula-upsell .action-link:hover{background:#51ad31;border-color:#51ad31;color:#fff;font-weight:700}#modula-uploader-container{position:relative;padding-left:10px;padding-right:10px}#modula-uploader-container.modula-resizer-enabled{margin-bottom:20px}.modula-upload-actions{padding:15px 20px;background-color:#f8fcfd;border-bottom:1px solid #ecf6f9;margin-bottom:20px;display:flex;align-items:center;justify-content:space-between;width:100%;box-sizing:border-box}.modula-upload-actions .buttons{flex-shrink:0;width:275px;display:flex}.modula-sources-dropdown{position:relative;border-top:1px solid rgba(255,255,255,0);border-right:1px solid rgba(255,255,255,0);border-left:1px solid rgba(255,255,255,0)}.modula-sources-dropdown:hover{border-color:#ddd;background:#f5f5f5}.modula-sources-dropdown>span{width:28px;height:32px;text-align:center;line-height:28px;cursor:pointer;display:inline-block;font-size:25px;font-weight:700}.modula-sources-dropdown .modula-sources-dropdown-content{position:absolute;right:-1px;bottom:0;transform:translateY(100%);display:none;padding:15px;background-color:#f5f5f5;box-shadow:0 1px 1px rgba(0,0,0,.04);box-sizing:border-box;border:1px solid #ddd}.modula-sources-dropdown:hover .modula-sources-dropdown-content{display:block}.modula-sources-dropdown:hover .modula-sources-dropdown-content:before{content:"";height:1px;width:28px;background-color:#f5f5f5;position:absolute;top:-1px;right:0}.segrip.ui-resizable-se{width:30px;height:30px;background:url(../images/resize-se.svg) no-repeat;background-size:contain;display:none;z-index:100;opacity:1}.modula-resizer-enabled .segrip.ui-resizable-se{display:block}.modula-upload-actions #modula-uploader-browser{border-bottom-right-radius:0;border-top-right-radius:0}.modula-upload-actions #modula-wp-gallery{border-bottom-left-radius:0;border-top-left-radius:0}.wp-core-ui .modula-upload-actions>a{margin:0 5px}#modula-dropzone-container{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,86,132,.9);z-index:250000;display:none;text-align:center;opacity:0;transition:opacity 250ms}#modula-dropzone-container .modula-uploader-window-content{position:absolute;top:10px;left:10px;right:10px;bottom:10px;border:1px dashed #fff}#poststuff #modula-dropzone-container .modula-uploader-window-content h1{margin:-.5em 0 0;position:absolute;top:50%;left:0;right:0;-webkit-transform:translateY(-50%);transform:translateY(-50%);font-size:20px;line-height:28px;font-weight:400;color:#fff;padding:0}.modula-uploader-inline-content{position:relative;min-height:300px;width:100%}.modula-resizer-enabled .modula-uploader-inline-content{min-height:initial}.modula-uploader-inline-content h2{text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}#poststuff .modula-upload-message{font-size:43px;line-height:1;font-weight:400;margin:0;display:none;color:#ebebeb}#poststuff .modula-upload-message .dashicons,#poststuff .modula-upload-message .dashicons-before:before{font-size:43px;width:43px;height:43px}.modula-uploader-inline p{font-size:12px;margin:.5em 0}#poststuff .modula-uploader-inline .modula-upload-instructions{font-size:14px;color:#444;font-weight:400;padding:0}.modula-uploader-footer .max-upload-size{float:left}.modula-uploader-footer .modula-upload-numbers{float:right;opacity:0}.modula-uploader-footer:after{display:block;content:"";clear:both}.upload-progress .modula-upload-numbers{margin:0;line-height:1.4em}.modula-progress-bar{width:100%;max-width:400px;position:relative;height:2px;margin:8px 0 0;border-radius:10px;background:#e5e5e5}.upload-info-container{position:relative;overflow:hidden;flex-grow:1}.upload-info-container .upload-info{padding:5px 0}.upload-info-container .upload-progress{position:absolute;background-color:#f8fcfd;height:100%;display:flex;top:0;left:0;width:100%;flex-direction:column;transition:transform .5s;transform:translateY(100%)}.modula-upload-actions.show-progress .upload-info-container .upload-progress{transform:translateY(0)}.modula-progress-bar .modula-progress-bar-inner{height:2px;min-width:20px;width:0;background:#0085ba;-webkit-transition:width .3s;-moz-transition:width .3s;-ms-transition:width .3s;-o-transition:width .3s;transition:width .3s;border-radius:5px}.modula-uploader-footer.show-progress .modula-progress-bar,.modula-uploader-footer.show-progress .modula-upload-numbers{opacity:1}.modula-uploader-inline-content .modula-single-image,.modula-uploader-inline-content .modula-single-image-placeholder{cursor:move;display:inline-block;padding:0 10px 20px 0;box-sizing:border-box;width:16.66%}.modula-uploader-inline-content .modula-single-image-placeholder:after{width:100%;height:100%;display:inline-block;content:"";position:relative;border:3px dashed #444;padding-top:calc(100% - 6px);box-sizing:border-box}.modula-uploader-inline-content .modula-single-image .modula-single-image-content{position:relative;border:1px solid #d6d6d6;box-sizing:border-box;background-position:center;background-size:cover}.modula-uploader-inline-content .modula-single-image .modula-single-image-content img{display:block;width:100%}#poststuff .modula-uploader-inline-content>.modula-upload-message:only-child{display:block}.modula-uploader-inline-content .modula-single-image .actions{position:absolute;z-index:99;font-size:0;width:100%;height:100%;top:0;left:0;background:rgba(0,0,0,.4);padding:5px;box-sizing:border-box;display:none}.modula-uploader-inline-content .modula-single-image:hover .actions{display:block}.modula-uploader-inline-content .modula-single-image .actions a{width:20px;height:20px;border-radius:100%;border:1px solid #000;background-color:rgba(255,255,255,.8);color:#000;display:block;text-decoration:none;text-align:center;line-height:20px;margin-bottom:5px}.modula-uploader-inline-content .modula-single-image .actions a:hover{background-color:#000;color:#fff}.modula-uploader-inline-content .modula-single-image .actions a span{font-size:16px;width:20px;height:20px;line-height:20px}.modula-uploader-inline-content .modula-single-image .actions a.modula-delete-image{color:#a00a00}.modula-uploader-inline-content .modula-single-image .actions a.modula-delete-image:hover{background-color:#a00a00;color:#fff}.modula-uploader-inline-content:after{content:"";display:block;clear:both}.media-modal .modula-edit-popup.edit-attachment-frame .edit-media-header button.right{border-right:1px solid #ddd}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting{margin:0 0 20px 0;padding:0 0 20px 0;border-bottom:1px solid #ddd}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting span.name{display:block;width:100%;min-width:100%;margin:0;padding:0;text-align:left;font-weight:700;font-size:14px}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting input[type=text],.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting textarea{display:block;width:100%;min-width:100%;margin:0}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings .setting div.description{clear:both;float:left;margin:5px 0 0 0;text-align:left;font-size:13px;font-style:italic;color:#666}.media-modal .modula-edit-popup .attachment-details .attachment-info .settings{margin:0;padding:0;border:none}.media-modal .attachment-info .actions a{display:inline-block}.inline-input{display:inline}.ui-draggable.ui-resizable>.segrip{width:10px;height:10px;background:red;position:absolute;bottom:0;right:0}.ui-draggable.ui-resizable .modula-single-image-content img{display:none}.ui-draggable.ui-resizable .modula-single-image-content{width:100%;height:100%}.ui-draggable.ui-resizable.modula-single-image{padding:0}.packery-drop-placeholder{outline:3px dashed #444;outline-offset:-6px;-webkit-transition:-webkit-transform .2s;transition:transform .2s}.ui-resizable-helper{border:3px dashed #444;box-sizing:border-box}#poststuff #modula-preview-gallery h2.hndle,#poststuff #modula-settings h2.hndle{padding-left:20px}#poststuff #modula-preview-gallery .inside{margin-top:0;padding:0}.modula-edit-popup .attachment-details .setting span.description>span{display:inline-block;float:none;width:auto;min-width:unset;line-height:16px;min-height:16px;margin-top:8px;padding:0;vertical-align:middle;margin-right:0}.modula-edit-popup .attachment-details .setting span.description{text-align:left;vertical-align:middle}.modula-media-modal .attachments-browser .media-toolbar .media-toolbar-secondary{width:100%}.modula-error-container{display:block}.modula-error-container.hide{display:none}.modula-error-container .modula-error{padding:12px;margin-bottom:12px;background:#fff;border-left:4px solid #dc3232;box-shadow:0 0 4px 0 rgba(0,0,0,.1);font-weight:600;margin-top:5px;position:relative;background-color:#dc3232;color:#fff}.modula-error-container .modula-error a{color:#fff}.modula-error-container .modula-error .upload-dismiss-errors{position:absolute;top:50%;right:-5px;padding:10px;transition:none;display:block;text-decoration:none;margin-top:-18px}.modula-error-container .modula-error .upload-dismiss-errors:before{content:"\f153";display:block;font:400 16px/1 dashicons;color:#fff}a.modula-tab-link{text-decoration:none}.modula-tab-link span.dashicons{width:16px;height:16px;line-height:16px;margin-right:3px;vertical-align:text-bottom;font-size:16px;text-decoration:none}#modula-grid{height:100%;position:absolute;overflow:hidden;top:0;left:0;width:100%}#modula-grid .modula-grid-item{background-color:#fafafa;float:left}#modula-grid .modula-grid-item:nth-child(12n){margin-right:0!important}#modula-grid:after{content:"";display:block;clear:both}.modula-tooltip{position:relative;display:inline-block}.modula-tooltip>span{cursor:pointer;color:#0073aa;text-decoration:underline;margin-left:5px}.modula-tooltip .modula-tooltip-content{display:none;position:absolute;top:50%;right:-10px;transform:translate(100% ,-50%);width:300px;background:#000;color:#fff;padding:10px;box-sizing:border-box;z-index:99}.modula-tooltip .modula-tooltip-content:before{content:'';width:0;height:0;border-style:solid;border-width:8px 8px 8px 0;border-color:transparent #000 transparent transparent;display:block;position:absolute;top:50%;left:-8px;transform:translateY(-50%)}.modula-tooltip:hover .modula-tooltip-content{display:block}.modula-helper-guidelines-container{padding:15px 20px;background-color:#f8fcfd;display:flex;align-items:center;border-top:1px solid #ecf6f9}.modula-helper-guidelines-container .onoffswitch{margin-top:0}.modula-helper-guidelines-wrapper .modula-helper-guidelines-label{margin-left:5px}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image .modula-single-image-content{background:#eee!important;position:relative;overflow:hidden}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image-content:before{content:"";display:block;padding-top:100%}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image-content img{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image-content.landscape img{max-height:100%}.modula-creative-gallery.modula-uploader-inline-content .modula-single-image-content.portrait img{max-width:100%}.modula-toggle{position:relative;position:relative;user-select:none;display:inline-block}.modula-toggle__items{box-sizing:border-box;display:inline-block;position:relative}.modula-toggle__items>*{box-sizing:inherit}.modula-toggle__input[type=checkbox]{border-radius:2px;border:2px solid #6c7781;margin-right:12px;transition:none;height:100%;left:0;top:0;margin:0;padding:0;opacity:0;position:absolute;width:100%;z-index:1}.modula-toggle__track{background-color:#fff;border:2px solid #6c7781;border-radius:9px;display:inline-block;height:18px;width:36px;vertical-align:top;transition:background .2s ease}.modula-toggle__thumb{background-color:#6c7781;border:5px solid #6c7781;border-radius:50%;display:block;height:10px;width:10px;position:absolute;left:4px;top:4px;transition:transform .2s ease}.modula-toggle__off{position:absolute;right:6px;top:6px;color:#6c7781;fill:currentColor}.modula-toggle__on{position:absolute;top:6px;left:8px;border:1px solid #fff;outline:1px solid transparent;outline-offset:-1px;display:none}.modula-toggle__input[type=checkbox]:checked+.modula-toggle__items .modula-toggle__track{background-color:#11a0d2;border:9px solid transparent}.modula-toggle__input[type=checkbox]:checked+.modula-toggle__items .modula-toggle__thumb{background-color:#fff;border-width:0;transform:translateX(18px)}.modula-toggle__input[type=checkbox]:checked+.modula-toggle__items .modula-toggle__off{display:none}.modula-toggle__input[type=checkbox]:checked+.modula-toggle__items .modula-toggle__on{display:inline-block}p.description.alert{color:red}tr.troubleshoot-subfield.hide{display:none}.modula-copy-shortcode{display:flex;align-items:center;flex-wrap:wrap}.modula-copy-shortcode input{margin:0;border-top-right-radius:0;border-bottom-right-radius:0;flex-grow:1}.modula-copy-shortcode span{width:100%}.wp-core-ui .modula-copy-shortcode a.button-primary{height:30px;border-top-left-radius:0;border-bottom-left-radius:0}@keyframes carousel{0%{transform:translateX(0);opacity:1!important}50%{transform:translateX(0);opacity:1!important}51%{transform:translateX(-100%);opacity:1!important}99%{transform:translateX(-100%);opacity:1!important}100%{transform:translateX(-200%);opacity:1!important}}.modula-upsells-carousel-wrapper{position:relative;display:flex;overflow:hidden}.modula-upsells-carousel{flex-shrink:0;position:relative;display:block;width:100%}.modula-upsells-carousel .modula-upsell-item{position:relative;width:100%;flex-shrink:0;margin-top:0;left:-15px}.modula-upsells-carousel .modula-upsell-item{text-align:center}.modula-upsells-carousel .modula-upsell-item ul.modula-upsells-list{padding-left:40px}.modula-upsells-carousel .modula-upsell-item ul li{position:relative;list-style-type:none!important;text-align:left}#modula-albums-upsell .modula-upsells-carousel .modula-upsell-item ul li{display:inline-block;margin:0 15px 15px 35px}.modula-upsells-carousel .modula-upsell-item ul li:before{font-family:Dashicons;content:"\f147";position:absolute;left:-30px;font-size:14px;color:green;background-color:#fff;padding:0 3px;border-radius:50%;border:1px solid #ddd;top:-1px}#modula-albums-upsell>button.handlediv,#modula-albums-upsell>h2.hndle.ui-sortable-handle,#modula-sorting-upsell>button.handlediv,#modula-sorting-upsell>h2.hndle.ui-sortable-handle{display:none}#modula-albums-upsell>.inside,#modula-sorting-upsell>.inside{padding:0;margin:0 auto}.cm-s-dracula .CodeMirror-gutters,.cm-s-dracula.CodeMirror{background-color:#282a36!important;color:#f8f8f2!important;border:none}.cm-s-dracula .CodeMirror-gutters{color:#282a36}.cm-s-dracula .CodeMirror-cursor{border-left:solid thin #f8f8f0}.cm-s-dracula .CodeMirror-linenumber{color:#6d8a88}.cm-s-dracula .CodeMirror-selected{background:rgba(255,255,255,.1)}.cm-s-dracula .CodeMirror-line::selection,.cm-s-dracula .CodeMirror-line>span::selection,.cm-s-dracula .CodeMirror-line>span>span::selection{background:rgba(255,255,255,.1)}.cm-s-dracula .CodeMirror-line::-moz-selection,.cm-s-dracula .CodeMirror-line>span::-moz-selection,.cm-s-dracula .CodeMirror-line>span>span::-moz-selection{background:rgba(255,255,255,.1)}.cm-s-dracula span.cm-comment{color:#6272a4}.cm-s-dracula span.cm-string,.cm-s-dracula span.cm-string-2{color:#f1fa8c}.cm-s-dracula span.cm-number{color:#bd93f9}.cm-s-dracula span.cm-variable{color:#50fa7b}.cm-s-dracula span.cm-variable-2{color:#fff}.cm-s-dracula span.cm-def{color:#50fa7b}.cm-s-dracula span.cm-operator{color:#ff79c6}.cm-s-dracula span.cm-keyword{color:#ff79c6}.cm-s-dracula span.cm-atom{color:#bd93f9}.cm-s-dracula span.cm-meta{color:#f8f8f2}.cm-s-dracula span.cm-tag{color:#ff79c6}.cm-s-dracula span.cm-attribute{color:#50fa7b}.cm-s-dracula span.cm-qualifier{color:#50fa7b}.cm-s-dracula span.cm-property{color:#66d9ef}.cm-s-dracula span.cm-builtin{color:#50fa7b}.cm-s-dracula span.cm-type,.cm-s-dracula span.cm-variable-3{color:#ffb86c}.cm-s-dracula .CodeMirror-activeline-background{background:rgba(255,255,255,.1)}.cm-s-dracula .CodeMirror-matchingbracket{text-decoration:underline;color:#fff!important}#modula_troubleshooting_option .modula-select label{margin-right:10px}#modula_troubleshooting_option .modula-select label:last-child{margin-right:0}#modula-albums-upsell h2{margin:0!important}.modula-settings-container input[type=number]{max-width:80px}.modula-after-input{margin-left:5px}
|
assets/css/modula-importer.css
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.modula .modula-importer-row.hide,
|
2 |
+
.modula .select-all-wrapper.hide,
|
3 |
+
.modula label[data-id="delete-old-entries"].hide,
|
4 |
+
.modula input[type="submit"].hide,
|
5 |
+
.modula .select-all-checkbox.hide,
|
6 |
+
.modula .select-all-checkbox-wrapper.hide,
|
7 |
+
.modula-importer-upsell-wrapper.hide{
|
8 |
+
display: none;
|
9 |
+
}
|
10 |
+
|
11 |
+
.imported-check {
|
12 |
+
display:inline-block;
|
13 |
+
margin-left:10px;
|
14 |
+
}
|
15 |
+
|
16 |
+
|
17 |
+
.imported-check:before {
|
18 |
+
font-size: 20px;
|
19 |
+
color: #00b894;
|
20 |
+
}
|
21 |
+
|
22 |
+
.modula-importer-checkbox-wrapper {
|
23 |
+
margin-bottom:10px;
|
24 |
+
}
|
25 |
+
|
26 |
+
.modula-importer-gallery-status {
|
27 |
+
color:blue;
|
28 |
+
}
|
29 |
+
|
30 |
+
.modula-importer-upsell-wrapper {
|
31 |
+
background:#fff;
|
32 |
+
border:1px solid #dddddd;
|
33 |
+
padding:15px;
|
34 |
+
margin-bottom:25px;
|
35 |
+
}
|
36 |
+
|
37 |
+
.modula-importer-upsell-wrapper .modula-importer-upsell-buttons {
|
38 |
+
margin-top:25px;
|
39 |
+
}
|
40 |
+
.modula-importer-upsell-wrapper .modula-importer-upsell-buttons a {
|
41 |
+
margin-right:15px;
|
42 |
+
}
|
43 |
+
|
44 |
+
.modula-importer-checkbox-wrapper .modula-tooltip span {
|
45 |
+
color:red !important;
|
46 |
+
}
|
assets/css/modula.css
CHANGED
@@ -42,9 +42,9 @@
|
|
42 |
display: block;
|
43 |
}
|
44 |
|
45 |
-
|
46 |
font-size:14px;
|
47 |
-
}
|
48 |
.modula .modula-items .modula-item .caption .icon {
|
49 |
font-size:14px;
|
50 |
position:absolute;
|
@@ -54,7 +54,6 @@
|
|
54 |
}
|
55 |
.modula .modula-items .modula-item .figc {
|
56 |
color: #fff;
|
57 |
-
font-size:11px;
|
58 |
text-align: center;
|
59 |
position: absolute;
|
60 |
left: 0;
|
@@ -321,7 +320,6 @@ body .modula .filters.vertical-filters.both-vertical + .modula-items {
|
|
321 |
color: #fff;
|
322 |
display: inline-block;
|
323 |
margin:0 10px 0 0;
|
324 |
-
width: 20px;
|
325 |
padding: 6px 4px;
|
326 |
border: 0;
|
327 |
opacity: 0;
|
42 |
display: block;
|
43 |
}
|
44 |
|
45 |
+
/*.modula .modula-items .modula-item .description {
|
46 |
font-size:14px;
|
47 |
+
}*/
|
48 |
.modula .modula-items .modula-item .caption .icon {
|
49 |
font-size:14px;
|
50 |
position:absolute;
|
54 |
}
|
55 |
.modula .modula-items .modula-item .figc {
|
56 |
color: #fff;
|
|
|
57 |
text-align: center;
|
58 |
position: absolute;
|
59 |
left: 0;
|
320 |
color: #fff;
|
321 |
display: inline-block;
|
322 |
margin:0 10px 0 0;
|
|
|
323 |
padding: 6px 4px;
|
324 |
border: 0;
|
325 |
opacity: 0;
|
assets/css/modula.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.modula .modula-items .modula-item{position:absolute;overflow:hidden;transition:transform .3s ease-out,opacity .2s linear,top .3s,left .6s;opacity:0;box-sizing:border-box}.modula .modula-items .modula-item>a{display:block;position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background:0 0}.modula .modula-items .modula-item .jtg-social{z-index:10}.modula .modula-items .modula-item.tg-loaded{transform:scale(1) translate(0,0) rotate(0)!important;opacity:1}.modula .modula-items .modula-item.tg-loaded img.pic{display:block;opacity:1}.modula .modula-items .modula-item img.pic{font-size:12px;position:absolute;display:none;opacity:0;max-width:999em!important;transition:width .3s,height .3s,transform .3s linear,opacity .2s linear}.modula .modula-items .modula-item img.pic.lazyload,.modula .modula-items .modula-item img.pic.lazyloaded{display:block}.modula .modula-items .modula-item .
|
1 |
+
.modula .modula-items .modula-item{position:absolute;overflow:hidden;transition:transform .3s ease-out,opacity .2s linear,top .3s,left .6s;opacity:0;box-sizing:border-box}.modula .modula-items .modula-item>a{display:block;position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background:0 0}.modula .modula-items .modula-item .jtg-social{z-index:10}.modula .modula-items .modula-item.tg-loaded{transform:scale(1) translate(0,0) rotate(0)!important;opacity:1}.modula .modula-items .modula-item.tg-loaded img.pic{display:block;opacity:1}.modula .modula-items .modula-item img.pic{font-size:12px;position:absolute;display:none;opacity:0;max-width:999em!important;transition:width .3s,height .3s,transform .3s linear,opacity .2s linear}.modula .modula-items .modula-item img.pic.lazyload,.modula .modula-items .modula-item img.pic.lazyloaded{display:block}.modula .modula-items .modula-item .caption .icon{font-size:14px;position:absolute;left:50%;top:50%;margin:-12px 0 0 -8px}.modula .modula-items .modula-item .figc{color:#fff;text-align:center;position:absolute;left:0;width:100%;padding:0}.modula .modula-items .hidden .figc{display:none}.modula .modula-items .hidden:hover .figc{display:block}.modula .modula-items .visible .figc{display:block}.modula .modula-items .always-visible .figc{display:block}.modula .modula-items .visible:hover .figc{display:none}.modula .modula-items .caption span.text{display:block;padding:10px}.modula .modula-items .caption span.title{font-size:14px;font-weight:700}.modula .filters{margin:20px 0 20px 0}.modula .filters.vertical-filters{margin-top:0}.modula .filters a{text-decoration:none;display:inline-block;color:#333;outline:0;transition:350ms ease-in}.modula .filters.menu--dfefault a{border-bottom:2px solid transparent}.modula .filters.colored a{border:0;color:#fff}.modula .filters:not(.styled-menu) a.selected,.modula .filters:not(.styled-menu) a:hover{border-bottom-color:#333;border-bottom:1px solid}body .modula .modula-item{width:100%}body .modula.vertical-filters .modula-items{width:80%;float:left}body .modula:after{content:"";display:block;clear:both}.modula.vertical-filters .filters{width:20%;float:left}body .modula .filters.vertical-filters.both-vertical+.modula-items{width:60%}.modula .filters.vertical-filters a{display:block;margin-bottom:15px}.modula .filters.vertical-filters.colored a{border-radius:5px;text-align:center;background:#fff;border:1px solid #3498db;color:#3498db}.modula .filters.vertical-filters.colored a.selected,.modula .filters.vertical-filters.colored a:hover{background:#fff;color:#8e44ad;border-color:#8e44ad}.modula .filters.horizontal-filters.colored a{display:inline-block;padding:0 30px;margin-right:2px;background:#3498db;position:relative;border:0}.modula .filters.horizontal-filters.colored a.selected,.modula .filters.horizontal-filters.colored a:hover{background:#8e44ad}.modula .filters.horizontal-filters.colored a:before{position:absolute;content:'';left:0;top:0;width:0;height:0;border:none;border-bottom-color:currentcolor;border-bottom-style:none;border-bottom-width:medium;border-left-color:currentcolor;border-left-style:none;border-left-width:medium;border-left:solid 17px #fff;border-bottom:solid 41px transparent;z-index:1;transition:.4s}.modula .filters.horizontal-filters.colored a:after{position:absolute;content:'';right:0;top:0;width:0;height:0;border:none;border-bottom-color:currentcolor;border-bottom-style:none;border-bottom-width:medium;border-left-color:currentcolor;border-left-style:none;border-left-width:medium;border-left:solid 17px transparent;border-bottom:solid 41px #fff;z-index:1;transition:.4s}.filter-by-wrapper{text-align:center;margin-bottom:25px;text-transform:uppercase}.filter-by-wrapper span{cursor:pointer}.filter-by-wrapper span:after{content:"";margin-left:15px;width:0;height:0;border-style:solid;border-width:15px 10px 0 10px;border-color:#0470e3 transparent transparent transparent;display:inline-block}.filter-by-wrapper.opened span:after{content:"";width:0;height:0;border-style:solid;border-width:0 10px 15px 10px;border-color:transparent transparent #d500ff transparent;display:inline-block}.modula .filters.vertical-filters a{margin-bottom:0}.menu__list li.menu__item{margin:15px}@media all and (min-width:1025px){.filter-by-wrapper{display:none!important}.modula-gallery .filters{display:block!important}}@media all and (max-width:1024px){.modula .filters.vertical-filters.both-vertical+.modula-items,.modula.vertical-filters .filters,.modula.vertical-filters .modula-items{width:100%!important;float:none}.menu__list{padding:0}.menu__list li.menu__item{margin:0}}.modula .jtg-social a{box-shadow:none}.lightbox .lb-image{max-width:999em}.modula .jtg-social svg{width:20px;height:16px}.modula .modula-items .modula-item .jtg-title{margin:0}.modula .modula-items .modula-item p{margin:0;padding:0}.modula .figc{color:#000;text-align:center;position:absolute;left:0;width:100%;padding:2em}.modula .modula-item .jtg-social a{text-decoration:none;color:#fff;display:inline-block;margin:0 10px 0 0;padding:6px 4px;border:0;opacity:0;transition:opacity .3s}.modula .modula-item:hover .jtg-social a{opacity:1}.modula .modula-items .jtg-social{opacity:0;transition:opacity .1s;right:30px;position:absolute;bottom:20px;text-align:right;transition:all .3s}.modula .modula-items .jtg-social{opacity:1}.modula .modula-items .jtg-social a:last-of-type{margin-right:0}.modula .modula-item.effect-pufrobo p.description{margin-bottom:2em}.modula .modula-item.effect-pufrobo .figc{text-align:right}.modula .modula-item.effect-pufrobo .jtg-title,.modula .modula-item.effect-pufrobo p{position:absolute;right:30px;left:30px;padding:10px 0}.modula .modula-item:hover img,.modula .modula-items .modula-item.tg-loaded:hover img.pic{opacity:.8}.modula .modula-item{background-color:#000}.modula .modula-item.effect-pufrobo p{bottom:20%;line-height:1.5;-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0);letter-spacing:1px}.modula .modula-item.effect-pufrobo .jtg-title{top:10%;-webkit-transition:-webkit-transform .35s;transition:transform .35s;-webkit-transform:translate3d(0,20px,0);transform:translate3d(0,20px,0)}.modula .modula-item.effect-pufrobo:hover .jtg-title{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modula .modula-item.effect-pufrobo .jtg-title::after{position:absolute;top:80%;left:0;width:100%;height:4px;background:#fff;content:'';-webkit-transform:translate3d(0,40px,0);transform:translate3d(0,40px,0)}.modula .modula-item.effect-pufrobo .jtg-title::after,.modula .modula-item.effect-pufrobo p{opacity:0;-webkit-transition:opacity .35s,-webkit-transform .35s;transition:opacity .35s,transform .35s}.modula .modula-item.effect-pufrobo:hover .jtg-title::after,.modula .modula-item.effect-pufrobo:hover p{margin-top:10px;margin-bottom:5px;opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modula .modula-items .modula-item.effect-pufrobo .figc.no-title.no-description .jtg-title:after{display:none}.modula .modula-items .modula-item.effect-appear .figc .jtg-title:before,.modula .modula-items .modula-item.effect-comodo .figc .jtg-title:before,.modula .modula-items .modula-item.effect-crafty .figc .jtg-title:before,.modula .modula-items .modula-item.effect-curtain .figc .jtg-title:before,.modula .modula-items .modula-item.effect-fluid-up .figc .jtg-title:before,.modula .modula-items .modula-item.effect-hide .figc .jtg-title:before,.modula .modula-items .modula-item.effect-lens .figc .jtg-title:before,.modula .modula-items .modula-item.effect-pufrobo .figc .jtg-title:before,.modula .modula-items .modula-item.effect-quiet .figc .jtg-title:before,.modula .modula-items .modula-item.effect-reflex .figc .jtg-title:before,.modula .modula-items .modula-item.effect-seemo .figc .jtg-title:before{display:none}#lightbox.lightbox{position:fixed;top:50%!important;transform:translateY(-50%)}@media all and (max-height:680px){#lightbox.lightbox .lb-image,.lb-container,.lb-outerContainer{max-height:80vh;width:auto!important;display:inline-block}}.modula .modula-items .modula-item>a{cursor:zoom-in}
|
assets/js/jquery-modula.js
CHANGED
@@ -15,6 +15,17 @@ jQuery(document).on( 'vc-full-width-row-single vc-full-width-row', function( eve
|
|
15 |
}
|
16 |
});
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
; (function ($, window, document, undefined) {
|
19 |
|
20 |
|
@@ -634,16 +645,5 @@ jQuery( document ).ready( function($){
|
|
634 |
$( '#' + modulaID ).modulaGallery( modulaSettings );
|
635 |
|
636 |
});
|
637 |
-
});
|
638 |
|
639 |
-
|
640 |
-
jQuery('.modula-item').on('click', function(e){
|
641 |
-
window.location.hash = "#";
|
642 |
-
window.addEventListener('popstate', onBackDown, false);
|
643 |
-
window.addEventListener('backbutton', onBackDown, false);
|
644 |
-
function onBackDown() {
|
645 |
-
this.event.preventDefault();
|
646 |
-
jQuery('.lb-close').click();
|
647 |
-
this.window.location.hash = "";
|
648 |
-
}
|
649 |
-
});
|
15 |
}
|
16 |
});
|
17 |
|
18 |
+
// Compatibility with Elementor
|
19 |
+
jQuery( window ).on( 'elementor/frontend/init', function(){
|
20 |
+
if ( window.elementorFrontend ) {
|
21 |
+
window.elementorFrontend.hooks.addAction( 'frontend/element_ready/global', function( $scope ) {
|
22 |
+
if( jQuery( 'body' ).find( '.modula' ).length > 0 ){
|
23 |
+
jQuery( window ).trigger( 'modula-update' );
|
24 |
+
}
|
25 |
+
});
|
26 |
+
}
|
27 |
+
});
|
28 |
+
|
29 |
; (function ($, window, document, undefined) {
|
30 |
|
31 |
|
645 |
$( '#' + modulaID ).modulaGallery( modulaSettings );
|
646 |
|
647 |
});
|
|
|
648 |
|
649 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/jquery-modula.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
"use strict";!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.ResizeSensor=t()}("undefined"!=typeof window?window:this,function(){if("undefined"==typeof window)return null;var e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)};function t(e,t){var i=Object.prototype.toString.call(e),n="[object Array]"===i||"[object NodeList]"===i||"[object HTMLCollection]"===i||"[object Object]"===i||"undefined"!=typeof jQuery&&e instanceof jQuery||"undefined"!=typeof Elements&&e instanceof Elements,o=0,s=e.length;if(n)for(;o<s;o++)t(e[o]);else t(e)}function i(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}var n=function(o,s){function r(){var e,t,i=[];this.add=function(e){i.push(e)},this.call=function(){for(e=0,t=i.length;e<t;e++)i[e].call()},this.remove=function(n){var o=[];for(e=0,t=i.length;e<t;e++)i[e]!==n&&o.push(i[e]);i=o},this.length=function(){return i.length}}t(o,function(t){!function(t,n){if(t)if(t.resizedAttached)t.resizedAttached.add(n);else{t.resizedAttached=new r,t.resizedAttached.add(n),t.resizeSensor=document.createElement("div"),t.resizeSensor.dir="ltr",t.resizeSensor.className="resize-sensor";var o="position: absolute; left: -10px; top: -10px; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;",s="position: absolute; left: 0; top: 0; transition: 0s;";t.resizeSensor.style.cssText=o,t.resizeSensor.innerHTML='<div class="resize-sensor-expand" style="'+o+'"><div style="'+s+'"></div></div><div class="resize-sensor-shrink" style="'+o+'"><div style="'+s+' width: 200%; height: 200%"></div></div>',t.appendChild(t.resizeSensor);var d=window.getComputedStyle(t).getPropertyPriority("position");"absolute"!==d&&"relative"!==d&&"fixed"!==d&&(t.style.position="relative");var c,l,a=t.resizeSensor.childNodes[0],h=a.childNodes[0],f=t.resizeSensor.childNodes[1],u=i(t),v=u.width,p=u.height,z=function(){var e=0===t.offsetWidth&&0===t.offsetHeight;if(e){var i=t.style.display;t.style.display="block"}h.style.width="100000px",h.style.height="100000px",a.scrollLeft=1e5,a.scrollTop=1e5,f.scrollLeft=1e5,f.scrollTop=1e5,e&&(t.style.display=i)};t.resizeSensor.resetSensor=z;var y=function(){l=0,c&&(v=void 0,p=void 0,t.resizedAttached&&t.resizedAttached.call())},w=function(){var n=i(t),o=n.width,s=n.height;(c=o!=v||s!=p)&&!l&&(l=e(y)),z()},g=function(e,t,i){e.attachEvent?e.attachEvent("on"+t,i):e.addEventListener(t,i)};g(a,"scroll",w),g(f,"scroll",w),e(z)}}(t,s)}),this.detach=function(e){n.detach(o,e)},this.reset=function(){o.resizeSensor.resetSensor()}};return n.reset=function(e,i){t(e,function(e){e.resizeSensor.resetSensor()})},n.detach=function(e,i){t(e,function(e){e&&(e.resizedAttached&&"function"==typeof i&&(e.resizedAttached.remove(i),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached))})},n});
|
2 |
-
function tg_getURLParameter(t){return decodeURIComponent((new RegExp("[?|&]"+t+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null}jQuery(document).on("vc-full-width-row-single vc-full-width-row",function(t,i){0<jQuery("body").find(".modula").length&&jQuery(window).trigger("modula-update")}),function(d,a,c,t){var o="modulaGallery",e={resizer:"/",margin:10,keepArea:!0,type:"creative-gallery",columns:12,gutter:10,enableTwitter:!1,enableFacebook:!1,enableGplus:!1,enablePinterest:!1,enableLinkedin:!1,lazyLoad:0};function s(t,i){this.element=t,this.$element=d(t),this.$itemsCnt=this.$element.find(".modula-items"),this.$items=this.$itemsCnt.find(".modula-item"),this.options=d.extend({},e,i),this._defaults=e,this._name=o,this.tiles=[],this.$tilesCnt=null,this.completed=!1,this.lastWidth=0,this.resizeTO=0,this.isPackeryActive=!1,this.init()}s.prototype.trunc=function(t){return Math.trunc?Math.trunc(t):(t=+t,isFinite(t)?t-t%1||(t<0?-0:0===t?t:0):t)},s.prototype.createCustomGallery=function(){var h,t=this.$element.width(),r=this,l=this.options.columns,i=c.documentElement.clientWidth;"1"==this.options.enableResponsive&&(i<=568?l=this.options.mobileColumns:i<=768&&(l=this.options.tabletColumns)),h=0<this.options.gutter?(t-this.options.gutter*(l-1))/l:Math.floor(t/l*1e3)/1e3,this.$items.not(".jtg-hidden").each(function(t,i){var e,n,o,s,a={};e=d(i).data("width"),n=d(i).data("height"),12<e&&(e=12),"1"==r.options.enableResponsive&&(o=e,s=n,1==l?n=(e=1)*s/o:((e=Math.round(l*o/12))<1&&(e=1),(n=Math.round(e*s/o))<1&&(n=1))),a.width=h*e+r.options.gutter*(e-1),a.height=Math.round(h)*n+r.options.gutter*(n-1),d(i).data("size",a).addClass("tiled").addClass(a.width>a.height?"tile-h":"tile-v").data("position"),d(i).css(d(i).data("size")),d(i).find(".figc").css({width:d(i).data("size").width,height:d(i).data("size").height})}),this.isPackeryActive&&this.$itemsCnt.packery("destroy"),this.$itemsCnt.packery({itemSelector:".modula-item",gutter:parseInt(r.options.gutter),columnWidth:h,resize:!1}),this.isPackeryActive=!0},s.prototype.createGrid=function(){var n=this;this.options.width&&this.$itemsCnt.width(this.options.width),this.options.height&&this.$itemsCnt.height(this.options.height),this.$itemsCnt.data("area",this.$itemsCnt.width()*this.$itemsCnt.height()),this.lastWidth=this.$itemsCnt.width();for(var t=0;t<this.$items.not(".jtg-hidden").length;t++)this.tiles.push(n.getSlot());this.tiles.sort(function(t,i){return t.position-i.position}),this.$items.not(".jtg-hidden").each(function(t,i){var e=n.tiles[t];d(i).data("size",e).addClass("tiled").addClass(e.width>e.height?"tile-h":"tile-v").data("position")}),this.$items.each(function(t,i){d(i).css(d(i).data("size")),d(i).find(".figc").css({width:d(i).data("size").width,height:d(i).data("size").height})}),this.completed=!0},s.prototype.getSlot=function(){if(0==this.tiles.length)return e={top:0,left:0,width:this.$itemsCnt.width(),height:this.$itemsCnt.height(),area:this.$itemsCnt.width()*this.$itemsCnt.height(),position:0};for(var t=0,i=0;i<this.tiles.length;i++){(e=this.tiles[i]).area>this.tiles[t].area&&(t=i)}var e={},n=this.tiles[t];if(n.width>n.height){var o=n.width/2*this.options.randomFactor;n.prevWidth=n.width,n.width=Math.floor(n.width/2+o*(Math.random()-.5)),e={top:n.top,left:n.left+n.width+this.options.margin,width:n.prevWidth-n.width-this.options.margin,height:n.height}}else{o=n.height/2*this.options.randomFactor;n.prevHeight=n.height,n.height=Math.floor(n.height/2+o*(Math.random()-.5)),e={left:n.left,top:n.top+n.height+this.options.margin,width:n.width,height:n.prevHeight-n.height-this.options.margin}}return e.area=e.width*e.height,e.position=1e3*e.top+e.left,n.position=1e3*n.top+n.left,this.tiles[t]=n,this.tiles[t].area=n.width*n.height,e},s.prototype.reset=function(){var e=this;e.tiles=[],"custom-grid"===e.options.type?(e.createCustomGallery(),e.$itemsCnt.packery()):"creative-gallery"==this.options.type&&e.createGrid(),e.$itemsCnt.find(".pic").each(function(t,i){e.placeImage(t)}),e.lastWidth=e.$itemsCnt.width()},s.prototype.onResize=function(i){i.lastWidth!=i.$itemsCnt.width()&&(clearTimeout(i.resizeTO),i.resizeTO=setTimeout(function(){if(i.options.keepArea){var t=i.$itemsCnt.data("area");i.$itemsCnt.height(t/i.$itemsCnt.width())}i.reset()},100))},s.prototype.placeImage=function(t){var i=this.$items.eq(t),e=i.find(".pic"),n=i.data("size"),o=e.data("size");if(e.parent()!=i&&(n={width:e.parent().width(),height:e.parent().height()}),void 0!==n&&void 0!==o){var s=n.width/n.height,a=o.width/o.height,h=e.data("valign")?e.data("valign"):"middle",r=e.data("halign")?e.data("halign"):"center",l={top:"auto",bottom:"auto",left:"auto",right:"auto",width:"auto",height:"auto",margin:"0",maxWidth:"999em"};if(a<s)switch(l.width=n.width,l.left=0,h){case"top":l.top=0;break;case"middle":l.top=0-(n.width*(1/a)-n.height)/2;break;case"bottom":l.bottom=0}else switch(l.height=n.height,l.top=0,r){case"left":l.left=0;break;case"center":l.left=0-(n.height*a-n.width)/2;break;case"right":l.right=0}e.css(l)}},s.prototype.loadImage=function(t){var i=this,e=i.$items.eq(t).find(".pic"),n=new Image;n.onerror=function(){console.log("error loading image ["+t+"] : "+this.src),t+1<i.$items.length&&i.loadImage(t+1)},n.onload=function(){e.data("size",{width:this.width,height:this.height}),i.placeImage(t),i.$items.eq(t).addClass("tg-loaded"),t+1<i.$items.length&&i.loadImage(t+1)};var o=e.data("src");n.src=o,e.attr("src",o)},s.prototype.init=function(){var o=this;d(c).trigger("modula_api_before_init",[o]),this.$itemsCnt.css({position:"relative",zIndex:1,"min-height":"10px"}),this.$items.addClass("tile"),this.$items.find(".pic").removeAttr("src"),"custom-grid"===this.options.type?this.createCustomGallery():"creative-gallery"==this.options.type&&this.createGrid(),"1"!=o.options.lazyLoad&&this.loadImage(0),d(a).resize(function(){o.onResize(o)}),d(a).on("modula-update",function(){o.onResize(o)}),d(c).on("lazyloaded",function(t){var i,e,n=d(t.target);"modula"==n.data("source")&&(n.data("size",{width:n.width(),height:n.height()}),(i=n.parents(".modula-item")).addClass("tg-loaded"),e=o.$items.index(i),o.placeImage(e))}),this.setupSocial(),this.options.onComplete&&this.options.onComplete(),d(c).trigger("modula_api_after_init",[o])},s.prototype.setupSocial=function(){this.options.enableTwitter&&i(this.$items,this),this.options.enableFacebook&&n(this.$items,this),this.options.enablePinterest&&r(this.$items,this),this.options.enableLinkedin&&l(this.$items,this),this.options.enableWhatsapp&&h(this.$items,this)},s.prototype.destroy=function(){this.isPackeryActive&&(this.$itemsCnt.packery("destroy"),this.isPackeryActive=!1)};var i=function(t,n){t.find(".modula-icon-twitter").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".caption"),e=n.options.twitterText||c.title;return!n.options.twitterText&&1==i.length&&0<i.text().length&&(e=d.trim(i.text())),a.open("https://twitter.com/intent/tweet?url="+encodeURI(location.href.split("#")[0])+"&text="+encodeURI(e),"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},n=function(t,o){t.find(".modula-icon-facebook").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".pic"),e=d(this).parents(".tile:first").find(".caption");o.options.facebookText||c.title;!o.options.facebookText&&1==e.length&&0<e.text().length&&d.trim(e.text());i.attr("src");var n="//www.facebook.com/sharer.php?u="+location.href;return a.open(n,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},h=function(t,e){t.find(".modula-icon-whatsapp").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".caption");e.options.whatsappText||c.title;return!e.options.whatsappText&&1==i.length&&0<i.text().length&&d.trim(i.text()),a.open("https://api.whatsapp.com/send?text="+encodeURI(a.location.href.split("#")[0])+"&preview_url=true","ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},r=function(t,s){t.find(".modula-icon-pinterest").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".pic"),e=d(this).parents(".tile:first").find(".caption"),n=s.options.facebookText||c.title;!s.options.facebookText&&1==e.length&&0<e.text().length&&(n=d.trim(e.text()));var o="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(n);1==i.length&&(o+="&media="+function(t){var i=c.createElement("img");return i.src=t,t=i.src,i.src=null,t}(i.attr("src")));return a.open(o,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},l=function(t,i){t.find(".modula-icon-linkedin").click(function(t){t.preventDefault();var i="//linkedin.com/shareArticle?mini=true&url="+ +encodeURI(location.href);return a.open(i,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})};d.fn[o]=function(i){var e,n=arguments;return i===t||"object"==typeof i?this.each(function(){d.data(this,"plugin_"+o)||d.data(this,"plugin_"+o,new s(this,i))}):"string"==typeof i&&"_"!==i[0]&&"init"!==i?(this.each(function(){var t=d.data(this,"plugin_"+o);t instanceof s&&"function"==typeof t[i]&&(e=t[i].apply(t,Array.prototype.slice.call(n,1))),"destroy"===i&&d.data(this,"plugin_"+o,null)}),e!==t?e:this):void 0}}(jQuery,window,document),jQuery(document).ready(function(e){var t=e(".modula-gallery");e.each(t,function(){var t=e(this).attr("id"),i=e(this).data("config");e("#"+t).modulaGallery(i)})})
|
1 |
"use strict";!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.ResizeSensor=t()}("undefined"!=typeof window?window:this,function(){if("undefined"==typeof window)return null;var e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return window.setTimeout(e,20)};function t(e,t){var i=Object.prototype.toString.call(e),n="[object Array]"===i||"[object NodeList]"===i||"[object HTMLCollection]"===i||"[object Object]"===i||"undefined"!=typeof jQuery&&e instanceof jQuery||"undefined"!=typeof Elements&&e instanceof Elements,o=0,s=e.length;if(n)for(;o<s;o++)t(e[o]);else t(e)}function i(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}var n=function(o,s){function r(){var e,t,i=[];this.add=function(e){i.push(e)},this.call=function(){for(e=0,t=i.length;e<t;e++)i[e].call()},this.remove=function(n){var o=[];for(e=0,t=i.length;e<t;e++)i[e]!==n&&o.push(i[e]);i=o},this.length=function(){return i.length}}t(o,function(t){!function(t,n){if(t)if(t.resizedAttached)t.resizedAttached.add(n);else{t.resizedAttached=new r,t.resizedAttached.add(n),t.resizeSensor=document.createElement("div"),t.resizeSensor.dir="ltr",t.resizeSensor.className="resize-sensor";var o="position: absolute; left: -10px; top: -10px; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;",s="position: absolute; left: 0; top: 0; transition: 0s;";t.resizeSensor.style.cssText=o,t.resizeSensor.innerHTML='<div class="resize-sensor-expand" style="'+o+'"><div style="'+s+'"></div></div><div class="resize-sensor-shrink" style="'+o+'"><div style="'+s+' width: 200%; height: 200%"></div></div>',t.appendChild(t.resizeSensor);var d=window.getComputedStyle(t).getPropertyPriority("position");"absolute"!==d&&"relative"!==d&&"fixed"!==d&&(t.style.position="relative");var c,l,a=t.resizeSensor.childNodes[0],h=a.childNodes[0],f=t.resizeSensor.childNodes[1],u=i(t),v=u.width,p=u.height,z=function(){var e=0===t.offsetWidth&&0===t.offsetHeight;if(e){var i=t.style.display;t.style.display="block"}h.style.width="100000px",h.style.height="100000px",a.scrollLeft=1e5,a.scrollTop=1e5,f.scrollLeft=1e5,f.scrollTop=1e5,e&&(t.style.display=i)};t.resizeSensor.resetSensor=z;var y=function(){l=0,c&&(v=void 0,p=void 0,t.resizedAttached&&t.resizedAttached.call())},w=function(){var n=i(t),o=n.width,s=n.height;(c=o!=v||s!=p)&&!l&&(l=e(y)),z()},g=function(e,t,i){e.attachEvent?e.attachEvent("on"+t,i):e.addEventListener(t,i)};g(a,"scroll",w),g(f,"scroll",w),e(z)}}(t,s)}),this.detach=function(e){n.detach(o,e)},this.reset=function(){o.resizeSensor.resetSensor()}};return n.reset=function(e,i){t(e,function(e){e.resizeSensor.resetSensor()})},n.detach=function(e,i){t(e,function(e){e&&(e.resizedAttached&&"function"==typeof i&&(e.resizedAttached.remove(i),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached))})},n});
|
2 |
+
function tg_getURLParameter(t){return decodeURIComponent((new RegExp("[?|&]"+t+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||null}jQuery(document).on("vc-full-width-row-single vc-full-width-row",function(t,i){0<jQuery("body").find(".modula").length&&jQuery(window).trigger("modula-update")}),jQuery(window).on("elementor/frontend/init",function(){window.elementorFrontend&&window.elementorFrontend.hooks.addAction("frontend/element_ready/global",function(t){0<jQuery("body").find(".modula").length&&jQuery(window).trigger("modula-update")})}),function(d,a,c,t){var o="modulaGallery",e={resizer:"/",margin:10,keepArea:!0,type:"creative-gallery",columns:12,gutter:10,enableTwitter:!1,enableFacebook:!1,enableGplus:!1,enablePinterest:!1,enableLinkedin:!1,lazyLoad:0};function s(t,i){this.element=t,this.$element=d(t),this.$itemsCnt=this.$element.find(".modula-items"),this.$items=this.$itemsCnt.find(".modula-item"),this.options=d.extend({},e,i),this._defaults=e,this._name=o,this.tiles=[],this.$tilesCnt=null,this.completed=!1,this.lastWidth=0,this.resizeTO=0,this.isPackeryActive=!1,this.init()}s.prototype.trunc=function(t){return Math.trunc?Math.trunc(t):(t=+t,isFinite(t)?t-t%1||(t<0?-0:0===t?t:0):t)},s.prototype.createCustomGallery=function(){var h,t=this.$element.width(),r=this,l=this.options.columns,i=c.documentElement.clientWidth;"1"==this.options.enableResponsive&&(i<=568?l=this.options.mobileColumns:i<=768&&(l=this.options.tabletColumns)),h=0<this.options.gutter?(t-this.options.gutter*(l-1))/l:Math.floor(t/l*1e3)/1e3,this.$items.not(".jtg-hidden").each(function(t,i){var e,n,o,s,a={};e=d(i).data("width"),n=d(i).data("height"),12<e&&(e=12),"1"==r.options.enableResponsive&&(o=e,s=n,1==l?n=(e=1)*s/o:((e=Math.round(l*o/12))<1&&(e=1),(n=Math.round(e*s/o))<1&&(n=1))),a.width=h*e+r.options.gutter*(e-1),a.height=Math.round(h)*n+r.options.gutter*(n-1),d(i).data("size",a).addClass("tiled").addClass(a.width>a.height?"tile-h":"tile-v").data("position"),d(i).css(d(i).data("size")),d(i).find(".figc").css({width:d(i).data("size").width,height:d(i).data("size").height})}),this.isPackeryActive&&this.$itemsCnt.packery("destroy"),this.$itemsCnt.packery({itemSelector:".modula-item",gutter:parseInt(r.options.gutter),columnWidth:h,resize:!1}),this.isPackeryActive=!0},s.prototype.createGrid=function(){var n=this;this.options.width&&this.$itemsCnt.width(this.options.width),this.options.height&&this.$itemsCnt.height(this.options.height),this.$itemsCnt.data("area",this.$itemsCnt.width()*this.$itemsCnt.height()),this.lastWidth=this.$itemsCnt.width();for(var t=0;t<this.$items.not(".jtg-hidden").length;t++)this.tiles.push(n.getSlot());this.tiles.sort(function(t,i){return t.position-i.position}),this.$items.not(".jtg-hidden").each(function(t,i){var e=n.tiles[t];d(i).data("size",e).addClass("tiled").addClass(e.width>e.height?"tile-h":"tile-v").data("position")}),this.$items.each(function(t,i){d(i).css(d(i).data("size")),d(i).find(".figc").css({width:d(i).data("size").width,height:d(i).data("size").height})}),this.completed=!0},s.prototype.getSlot=function(){if(0==this.tiles.length)return e={top:0,left:0,width:this.$itemsCnt.width(),height:this.$itemsCnt.height(),area:this.$itemsCnt.width()*this.$itemsCnt.height(),position:0};for(var t=0,i=0;i<this.tiles.length;i++){(e=this.tiles[i]).area>this.tiles[t].area&&(t=i)}var e={},n=this.tiles[t];if(n.width>n.height){var o=n.width/2*this.options.randomFactor;n.prevWidth=n.width,n.width=Math.floor(n.width/2+o*(Math.random()-.5)),e={top:n.top,left:n.left+n.width+this.options.margin,width:n.prevWidth-n.width-this.options.margin,height:n.height}}else{o=n.height/2*this.options.randomFactor;n.prevHeight=n.height,n.height=Math.floor(n.height/2+o*(Math.random()-.5)),e={left:n.left,top:n.top+n.height+this.options.margin,width:n.width,height:n.prevHeight-n.height-this.options.margin}}return e.area=e.width*e.height,e.position=1e3*e.top+e.left,n.position=1e3*n.top+n.left,this.tiles[t]=n,this.tiles[t].area=n.width*n.height,e},s.prototype.reset=function(){var e=this;e.tiles=[],"custom-grid"===e.options.type?(e.createCustomGallery(),e.$itemsCnt.packery()):"creative-gallery"==this.options.type&&e.createGrid(),e.$itemsCnt.find(".pic").each(function(t,i){e.placeImage(t)}),e.lastWidth=e.$itemsCnt.width()},s.prototype.onResize=function(i){i.lastWidth!=i.$itemsCnt.width()&&(clearTimeout(i.resizeTO),i.resizeTO=setTimeout(function(){if(i.options.keepArea){var t=i.$itemsCnt.data("area");i.$itemsCnt.height(t/i.$itemsCnt.width())}i.reset()},100))},s.prototype.placeImage=function(t){var i=this.$items.eq(t),e=i.find(".pic"),n=i.data("size"),o=e.data("size");if(e.parent()!=i&&(n={width:e.parent().width(),height:e.parent().height()}),void 0!==n&&void 0!==o){var s=n.width/n.height,a=o.width/o.height,h=e.data("valign")?e.data("valign"):"middle",r=e.data("halign")?e.data("halign"):"center",l={top:"auto",bottom:"auto",left:"auto",right:"auto",width:"auto",height:"auto",margin:"0",maxWidth:"999em"};if(a<s)switch(l.width=n.width,l.left=0,h){case"top":l.top=0;break;case"middle":l.top=0-(n.width*(1/a)-n.height)/2;break;case"bottom":l.bottom=0}else switch(l.height=n.height,l.top=0,r){case"left":l.left=0;break;case"center":l.left=0-(n.height*a-n.width)/2;break;case"right":l.right=0}e.css(l)}},s.prototype.loadImage=function(t){var i=this,e=i.$items.eq(t).find(".pic"),n=new Image;n.onerror=function(){console.log("error loading image ["+t+"] : "+this.src),t+1<i.$items.length&&i.loadImage(t+1)},n.onload=function(){e.data("size",{width:this.width,height:this.height}),i.placeImage(t),i.$items.eq(t).addClass("tg-loaded"),t+1<i.$items.length&&i.loadImage(t+1)};var o=e.data("src");n.src=o,e.attr("src",o)},s.prototype.init=function(){var o=this;d(c).trigger("modula_api_before_init",[o]),this.$itemsCnt.css({position:"relative",zIndex:1,"min-height":"10px"}),this.$items.addClass("tile"),this.$items.find(".pic").removeAttr("src"),"custom-grid"===this.options.type?this.createCustomGallery():"creative-gallery"==this.options.type&&this.createGrid(),"1"!=o.options.lazyLoad&&this.loadImage(0),d(a).resize(function(){o.onResize(o)}),d(a).on("modula-update",function(){o.onResize(o)}),d(c).on("lazyloaded",function(t){var i,e,n=d(t.target);"modula"==n.data("source")&&(n.data("size",{width:n.width(),height:n.height()}),(i=n.parents(".modula-item")).addClass("tg-loaded"),e=o.$items.index(i),o.placeImage(e))}),this.setupSocial(),this.options.onComplete&&this.options.onComplete(),d(c).trigger("modula_api_after_init",[o])},s.prototype.setupSocial=function(){this.options.enableTwitter&&i(this.$items,this),this.options.enableFacebook&&n(this.$items,this),this.options.enablePinterest&&r(this.$items,this),this.options.enableLinkedin&&l(this.$items,this),this.options.enableWhatsapp&&h(this.$items,this)},s.prototype.destroy=function(){this.isPackeryActive&&(this.$itemsCnt.packery("destroy"),this.isPackeryActive=!1)};var i=function(t,n){t.find(".modula-icon-twitter").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".caption"),e=n.options.twitterText||c.title;return!n.options.twitterText&&1==i.length&&0<i.text().length&&(e=d.trim(i.text())),a.open("https://twitter.com/intent/tweet?url="+encodeURI(location.href.split("#")[0])+"&text="+encodeURI(e),"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},n=function(t,o){t.find(".modula-icon-facebook").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".pic"),e=d(this).parents(".tile:first").find(".caption");o.options.facebookText||c.title;!o.options.facebookText&&1==e.length&&0<e.text().length&&d.trim(e.text());i.attr("src");var n="//www.facebook.com/sharer.php?u="+location.href;return a.open(n,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},h=function(t,e){t.find(".modula-icon-whatsapp").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".caption");e.options.whatsappText||c.title;return!e.options.whatsappText&&1==i.length&&0<i.text().length&&d.trim(i.text()),a.open("https://api.whatsapp.com/send?text="+encodeURI(a.location.href.split("#")[0])+"&preview_url=true","ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},r=function(t,s){t.find(".modula-icon-pinterest").click(function(t){t.preventDefault();var i=d(this).parents(".tile:first").find(".pic"),e=d(this).parents(".tile:first").find(".caption"),n=s.options.facebookText||c.title;!s.options.facebookText&&1==e.length&&0<e.text().length&&(n=d.trim(e.text()));var o="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(n);1==i.length&&(o+="&media="+function(t){var i=c.createElement("img");return i.src=t,t=i.src,i.src=null,t}(i.attr("src")));return a.open(o,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},l=function(t,i){t.find(".modula-icon-linkedin").click(function(t){t.preventDefault();var i="//linkedin.com/shareArticle?mini=true&url="+ +encodeURI(location.href);return a.open(i,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})};d.fn[o]=function(i){var e,n=arguments;return i===t||"object"==typeof i?this.each(function(){d.data(this,"plugin_"+o)||d.data(this,"plugin_"+o,new s(this,i))}):"string"==typeof i&&"_"!==i[0]&&"init"!==i?(this.each(function(){var t=d.data(this,"plugin_"+o);t instanceof s&&"function"==typeof t[i]&&(e=t[i].apply(t,Array.prototype.slice.call(n,1))),"destroy"===i&&d.data(this,"plugin_"+o,null)}),e!==t?e:this):void 0}}(jQuery,window,document),jQuery(document).ready(function(e){var t=e(".modula-gallery");e.each(t,function(){var t=e(this).attr("id"),i=e(this).data("config");e("#"+t).modulaGallery(i)})});
|
assets/js/modula-importer.js
ADDED
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
"use strict";
|
3 |
+
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Modula Importer
|
7 |
+
*
|
8 |
+
* @type {{init: init, runAjaxs: runAjaxs, ajaxTimeout: null, counts: number, processAjax: processAjax, ajaxRequests: [], completed: number, updateImported: updateImported, ajaxStarted: number, source: string}}
|
9 |
+
*/
|
10 |
+
var modulaImporter = {
|
11 |
+
counts: 0,
|
12 |
+
completed: 0,
|
13 |
+
ajaxRequests: [],
|
14 |
+
ajaxStarted: 0,
|
15 |
+
ajaxTimeout: null,
|
16 |
+
source: '',
|
17 |
+
modulaGalleryIds: {},
|
18 |
+
|
19 |
+
|
20 |
+
init: function () {
|
21 |
+
|
22 |
+
$('.modula-importer-wrapper input[type="submit"]').click(function (e) {
|
23 |
+
e.preventDefault();
|
24 |
+
modulaImporter.source = $(this).parents('.modula-importer-wrapper').attr('source');
|
25 |
+
modulaImporter.completed = 0;
|
26 |
+
|
27 |
+
// Check if gallery was selected
|
28 |
+
var galleries = $('#modula_importer_' + modulaImporter.source + ' input[name=gallery]:checked');
|
29 |
+
if ( 0 == galleries.length ) {
|
30 |
+
alert(modula_importer.empty_gallery_selection);
|
31 |
+
return false;
|
32 |
+
}
|
33 |
+
|
34 |
+
// Disable input
|
35 |
+
$('#modula_importer_' + modulaImporter.source + ' :input').prop('disabled', true);
|
36 |
+
|
37 |
+
// Get array of IDs
|
38 |
+
var id_array = [];
|
39 |
+
$(galleries).each(function (i) {
|
40 |
+
if ( 'wp_core' == modulaImporter.source ) {
|
41 |
+
id_array[i] = $(this).attr('data-id');
|
42 |
+
} else {
|
43 |
+
id_array[i] = $(this).val();
|
44 |
+
}
|
45 |
+
|
46 |
+
});
|
47 |
+
|
48 |
+
modulaImporter.counts = id_array.length;
|
49 |
+
modulaImporter.processAjax(id_array);
|
50 |
+
|
51 |
+
});
|
52 |
+
|
53 |
+
},
|
54 |
+
|
55 |
+
processAjax: function (galleries_ids) {
|
56 |
+
|
57 |
+
var delete_entries = 'keep';
|
58 |
+
|
59 |
+
if ( $('#delete-old-entries').prop('checked') ) {
|
60 |
+
delete_entries = 'delete';
|
61 |
+
}
|
62 |
+
|
63 |
+
galleries_ids.forEach(function (gallery_id) {
|
64 |
+
|
65 |
+
var status = $('#modula_importer_' + modulaImporter.source + ' label[data-id=' + gallery_id + ']');
|
66 |
+
var id = gallery_id;
|
67 |
+
var $gallery_title = false;
|
68 |
+
$(status).removeClass().addClass('importing');
|
69 |
+
$('span', $(status)).html(modula_importer.importing);
|
70 |
+
// For WP core galleries in case we have multiple galleries in same page
|
71 |
+
if('wp_core' == modulaImporter.source){
|
72 |
+
$gallery_title = $('input#wp_core-galleries-'+id).next('a').text();
|
73 |
+
}
|
74 |
+
|
75 |
+
if ( 'wp_core' == modulaImporter.source ) {
|
76 |
+
id = JSON.parse($('#modula_importer_wp_core input[data-id=' + gallery_id + ']').val());
|
77 |
+
}
|
78 |
+
|
79 |
+
var opts = {
|
80 |
+
url: modula_importer.ajax,
|
81 |
+
type: 'post',
|
82 |
+
async: true,
|
83 |
+
cache: false,
|
84 |
+
dataType: 'json',
|
85 |
+
data: {
|
86 |
+
action: 'modula_importer_' + modulaImporter.source + '_gallery_import',
|
87 |
+
id: id,
|
88 |
+
nonce: modula_importer.nonce,
|
89 |
+
clean: delete_entries,
|
90 |
+
gallery_title : $gallery_title
|
91 |
+
},
|
92 |
+
success: function (response) {
|
93 |
+
|
94 |
+
modulaImporter.completed = modulaImporter.completed + 1;
|
95 |
+
|
96 |
+
if ( !response.success ) {
|
97 |
+
status.find('span').text(response.message);
|
98 |
+
|
99 |
+
// don't need to updateImported for core galleries
|
100 |
+
if ( modulaImporter.counts == modulaImporter.completed && 'wp_core' != modulaImporter.source ) {
|
101 |
+
modulaImporter.updateImported(false, delete_entries);
|
102 |
+
|
103 |
+
}
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
modulaImporter.modulaGalleryIds[gallery_id] = response.modula_gallery_id;
|
108 |
+
|
109 |
+
// Display result from AJAX call
|
110 |
+
status.find('span').html(response.message);
|
111 |
+
|
112 |
+
// Remove one ajax from queue
|
113 |
+
modulaImporter.ajaxStarted = modulaImporter.ajaxStarted - 1;
|
114 |
+
|
115 |
+
// don't need to updateImported for core galleries
|
116 |
+
if ( modulaImporter.counts == modulaImporter.completed && 'wp_core' != modulaImporter.source ) {
|
117 |
+
modulaImporter.updateImported(modulaImporter.modulaGalleryIds, delete_entries);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
};
|
121 |
+
modulaImporter.ajaxRequests.push(opts);
|
122 |
+
|
123 |
+
});
|
124 |
+
modulaImporter.runAjaxs();
|
125 |
+
|
126 |
+
},
|
127 |
+
|
128 |
+
runAjaxs: function () {
|
129 |
+
var currentAjax;
|
130 |
+
|
131 |
+
while ( modulaImporter.ajaxStarted < 5 && modulaImporter.ajaxRequests.length > 0 ) {
|
132 |
+
modulaImporter.ajaxStarted = modulaImporter.ajaxStarted + 1;
|
133 |
+
currentAjax = modulaImporter.ajaxRequests.shift();
|
134 |
+
$.ajax(currentAjax);
|
135 |
+
|
136 |
+
}
|
137 |
+
|
138 |
+
if ( modulaImporter.ajaxRequests.length > 0 ) {
|
139 |
+
modulaImporter.ajaxTimeout = setTimeout(function () {
|
140 |
+
console.log('Delayed 1s');
|
141 |
+
modulaImporter.runAjaxs();
|
142 |
+
}, 1000);
|
143 |
+
} else {
|
144 |
+
$('#modula_importer_' + modulaImporter.source + ' :input').prop('disabled', false);
|
145 |
+
}
|
146 |
+
|
147 |
+
},
|
148 |
+
// Update imported galleries
|
149 |
+
updateImported: function (galleries_obj, delete_entries) {
|
150 |
+
|
151 |
+
var data = {
|
152 |
+
action: 'modula_importer_' + modulaImporter.source + '_gallery_imported_update',
|
153 |
+
galleries: galleries_obj,
|
154 |
+
clean: delete_entries,
|
155 |
+
nonce: modula_importer.nonce,
|
156 |
+
};
|
157 |
+
|
158 |
+
$.post(ajaxurl, data, function (response) {
|
159 |
+
window.location.href = response;
|
160 |
+
});
|
161 |
+
}
|
162 |
+
|
163 |
+
};
|
164 |
+
|
165 |
+
$(document).ready(function () {
|
166 |
+
|
167 |
+
// Get galleries from sources
|
168 |
+
$('#modula_select_gallery_source').on('change', function () {
|
169 |
+
var targetID = $(this).val();
|
170 |
+
|
171 |
+
// Hide the response if user goes through sources again
|
172 |
+
if ( $('body').find('.update-complete').length ) {
|
173 |
+
$('body').find('.update-complete').hide();
|
174 |
+
}
|
175 |
+
|
176 |
+
var data = {
|
177 |
+
action: 'modula_importer_get_galleries',
|
178 |
+
nonce: modula_importer.nonce,
|
179 |
+
source: targetID
|
180 |
+
};
|
181 |
+
|
182 |
+
$.post(ajaxurl, data, function (response) {
|
183 |
+
|
184 |
+
if ( !response ) {
|
185 |
+
return;
|
186 |
+
}
|
187 |
+
|
188 |
+
$('#modula-' + targetID + '-importer').removeClass('hide');
|
189 |
+
$('#modula-' + targetID + '-importer').find('.modula-found-galleries').html(response);
|
190 |
+
$('.modula-importer-row').not($('#modula-' + targetID + '-importer')).addClass('hide');
|
191 |
+
if ( 'none' != targetID && $('#modula-' + targetID + '-importer').find('input[type="checkbox"]').not('#select-all-' + targetID).length > 0 ) {
|
192 |
+
$('.select-all-wrapper').removeClass('hide');
|
193 |
+
} else {
|
194 |
+
$('#modula-' + targetID + '-importer .modula-importer-upsell-wrapper').addClass('hide');
|
195 |
+
$('#modula-' + targetID + '-importer .select-all-checkbox,#modula-' + targetID + '-importer .select-all-checkbox-wrapper').addClass('hide');
|
196 |
+
$('#modula-' + targetID + '-importer').find('input[type="submit"]').addClass('hide');
|
197 |
+
$('.select-all-wrapper').addClass('hide');
|
198 |
+
}
|
199 |
+
});
|
200 |
+
|
201 |
+
});
|
202 |
+
|
203 |
+
// Select all galleries from respective source
|
204 |
+
$('body').on('click', '.modula-all-selection', function (e) {
|
205 |
+
e.preventDefault();
|
206 |
+
|
207 |
+
var checkboxes = $(this).parents('td').find('input[type="checkbox"]');
|
208 |
+
if ( '#select_all' == $(this).attr('href') ) {
|
209 |
+
checkboxes.each(function () {
|
210 |
+
if ( $(this).is(':visible') ) {
|
211 |
+
checkboxes.prop('checked', true);
|
212 |
+
}
|
213 |
+
});
|
214 |
+
} else {
|
215 |
+
checkboxes.each(function () {
|
216 |
+
if ( $(this).is(':visible') ) {
|
217 |
+
checkboxes.prop('checked', false);
|
218 |
+
}
|
219 |
+
});
|
220 |
+
}
|
221 |
+
});
|
222 |
+
|
223 |
+
// Init importer
|
224 |
+
modulaImporter.init();
|
225 |
+
});
|
226 |
+
|
227 |
+
})(jQuery);
|
assets/js/wp-modula-conditions.js
CHANGED
@@ -21,7 +21,9 @@ var modulaGalleryConditions = Backbone.Model.extend({
|
|
21 |
this.listenTo( wp.Modula.Settings, 'change:lightbox', this.changedLightbox );
|
22 |
this.listenTo( wp.Modula.Settings, 'change:disableSocial', this.disableSocial );
|
23 |
this.listenTo( wp.Modula.Settings, 'change:cursor', this.changedCursor );
|
24 |
-
|
|
|
|
|
25 |
},
|
26 |
|
27 |
initValues: function(){
|
@@ -31,6 +33,9 @@ var modulaGalleryConditions = Backbone.Model.extend({
|
|
31 |
this.changedCursor( false, wp.Modula.Settings.get( 'cursor' ) );
|
32 |
this.changedLightbox( false, wp.Modula.Settings.get( 'lightbox' ) );
|
33 |
this.disableSocial (false, wp.Modula.Settings.get('disableSocial') );
|
|
|
|
|
|
|
34 |
},
|
35 |
|
36 |
changedType: function( settings, value ){
|
@@ -96,6 +101,36 @@ var modulaGalleryConditions = Backbone.Model.extend({
|
|
96 |
rows.filter( '[data-container="enableTwitter"],[data-container="enableWhatsapp"],[data-container="enableFacebook"],[data-container="enableLinkedin"],[data-container="enablePinterest"],[data-container="socialIconColor"],[data-container="socialIconSize"], [data-container="socialIconPadding"]').prop('checked',1).show();
|
97 |
|
98 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
})
|
21 |
this.listenTo( wp.Modula.Settings, 'change:lightbox', this.changedLightbox );
|
22 |
this.listenTo( wp.Modula.Settings, 'change:disableSocial', this.disableSocial );
|
23 |
this.listenTo( wp.Modula.Settings, 'change:cursor', this.changedCursor );
|
24 |
+
this.listenTo( wp.Modula.Settings, 'change:enable_responsive', this.changedResponsiveness );
|
25 |
+
this.listenTo( wp.Modula.Settings, 'change:hide_title', this.hideTitle);
|
26 |
+
this.listenTo( wp.Modula.Settings, 'change:hide_description', this.hideCaption);
|
27 |
},
|
28 |
|
29 |
initValues: function(){
|
33 |
this.changedCursor( false, wp.Modula.Settings.get( 'cursor' ) );
|
34 |
this.changedLightbox( false, wp.Modula.Settings.get( 'lightbox' ) );
|
35 |
this.disableSocial (false, wp.Modula.Settings.get('disableSocial') );
|
36 |
+
this.changedResponsiveness ( false, wp.Modula.Settings.get('enable_responsive') );
|
37 |
+
this.hideTitle ( false, wp.Modula.Settings.get( 'hide_title' ) );
|
38 |
+
this.hideCaption ( false, wp.Modula.Settings.get( 'hide_description') );
|
39 |
},
|
40 |
|
41 |
changedType: function( settings, value ){
|
101 |
rows.filter( '[data-container="enableTwitter"],[data-container="enableWhatsapp"],[data-container="enableFacebook"],[data-container="enableLinkedin"],[data-container="enablePinterest"],[data-container="socialIconColor"],[data-container="socialIconSize"], [data-container="socialIconPadding"]').prop('checked',1).show();
|
102 |
|
103 |
}
|
104 |
+
},
|
105 |
+
|
106 |
+
changedResponsiveness: function( settings, value){
|
107 |
+
var rows = this.get( 'rows' );
|
108 |
+
|
109 |
+
if( 1 == value ) {
|
110 |
+
rows.filter( '[data-container="tablet_columns"],[data-container="mobile_columns"]').show();
|
111 |
+
}else {
|
112 |
+
rows.filter( '[data-container="tablet_columns"],[data-container="mobile_columns"]').hide();
|
113 |
+
}
|
114 |
+
},
|
115 |
+
|
116 |
+
hideTitle: function( settings, value ) {
|
117 |
+
var rows = this.get( 'rows' );
|
118 |
+
|
119 |
+
if( 1 == value ) {
|
120 |
+
rows.filter( '[data-container="titleColor"],[data-container="titleFontSize"],[data-container="mobileTitleFontSize"]').hide();
|
121 |
+
}else {
|
122 |
+
rows.filter( '[data-container="titleColor"],[data-container="titleFontSize"],[data-container="mobileTitleFontSize"]').show();
|
123 |
+
}
|
124 |
+
},
|
125 |
+
|
126 |
+
hideCaption: function( settings, value ) {
|
127 |
+
var rows = this.get( 'rows' );
|
128 |
+
|
129 |
+
if( 1 == value ) {
|
130 |
+
rows.filter( '[data-container="captionColor"],[data-container="captionFontSize"],[data-container="mobileCaptionFontSize"]').hide();
|
131 |
+
}else {
|
132 |
+
rows.filter( '[data-container="captionColor"],[data-container="captionFontSize"],[data-container="mobileCaptionFontSize"]').show();
|
133 |
+
}
|
134 |
}
|
135 |
|
136 |
})
|
changelog.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 2.2.6 - 18/02/2020 =
|
2 |
Improved Custom CSS textarea
|
3 |
Improved how the lightbox closes
|
1 |
+
= 2.2.7 - 09/03/2020 =
|
2 |
+
Fixed incompatibility with Elementor stretched rows.
|
3 |
+
Fixed incompatibility with isotope.js
|
4 |
+
Renamed our registered files name
|
5 |
+
Fixed title/caption font size to reflect theme default
|
6 |
+
Fixed scroll to top when opening lightbox
|
7 |
+
If Title/Caption is hidden then hide settings also
|
8 |
+
Hide settings if toggle is OFF for custom responsiveness
|
9 |
+
Added Migrate functionality. Now it's easier to migrate from another gallery to Modula
|
10 |
+
Improved social media icons in preview
|
11 |
+
Delete resized images when deleting attachment
|
12 |
+
Added Import/Export sub-menu entry and tutorial
|
13 |
+
|
14 |
= 2.2.6 - 18/02/2020 =
|
15 |
Improved Custom CSS textarea
|
16 |
Improved how the lightbox closes
|
includes/admin/class-modula-admin.php
CHANGED
@@ -22,6 +22,47 @@ class Modula_Admin {
|
|
22 |
|
23 |
add_action( 'wp_ajax_modula_save_images', array( $this, 'save_images' ) );
|
24 |
add_action( 'wp_ajax_modula_save_image', array( $this, 'save_image' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
}
|
27 |
|
@@ -38,6 +79,8 @@ class Modula_Admin {
|
|
38 |
|
39 |
add_submenu_page( 'edit.php?post_type=modula-gallery', esc_html__( 'Extensions', 'modula-best-grid-gallery' ), esc_html__( 'Extensions', 'modula-best-grid-gallery' ), 'manage_options', 'modula-addons', array( $this, 'show_addons' ) );
|
40 |
|
|
|
|
|
41 |
}
|
42 |
|
43 |
public function show_submenu() {
|
@@ -259,6 +302,26 @@ class Modula_Admin {
|
|
259 |
|
260 |
<?php
|
261 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
}
|
263 |
|
264 |
new Modula_Admin();
|
22 |
|
23 |
add_action( 'wp_ajax_modula_save_images', array( $this, 'save_images' ) );
|
24 |
add_action( 'wp_ajax_modula_save_image', array( $this, 'save_image' ) );
|
25 |
+
add_action( 'delete_attachment', array( $this, 'delete_resized_image') ) ;
|
26 |
+
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
public function delete_resized_image( $post_id ) {
|
31 |
+
|
32 |
+
$post = get_post( $post_id );
|
33 |
+
|
34 |
+
if ( 'attachment' !== $post->post_type ) {
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
|
38 |
+
// Get the metadata
|
39 |
+
$metadata = wp_get_attachment_metadata( $post_id );
|
40 |
+
if ( ! $metadata ) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
$info = pathinfo( $metadata['file'] );
|
44 |
+
$uploads = wp_upload_dir();
|
45 |
+
$filename = $info['filename'];
|
46 |
+
$file_dir = $uploads['basedir'] .'/'. $info['dirname'];
|
47 |
+
$ext = $info['extension'];
|
48 |
+
|
49 |
+
if ( ! isset( $metadata['image_meta']['resized_images'] ) ) {
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
|
53 |
+
if ( count( $metadata['image_meta']['resized_images'] ) > 0 ) {
|
54 |
+
|
55 |
+
foreach ( $metadata['image_meta']['resized_images'] as $value ) {
|
56 |
+
$size = "-" . $value;
|
57 |
+
|
58 |
+
// Format the files in the appropriate format
|
59 |
+
$file = $file_dir . '/' . $filename . $size . '.' . $ext;
|
60 |
+
// Delete found files
|
61 |
+
wp_delete_file_from_directory( $file, $file_dir);
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
}
|
66 |
|
67 |
}
|
68 |
|
79 |
|
80 |
add_submenu_page( 'edit.php?post_type=modula-gallery', esc_html__( 'Extensions', 'modula-best-grid-gallery' ), esc_html__( 'Extensions', 'modula-best-grid-gallery' ), 'manage_options', 'modula-addons', array( $this, 'show_addons' ) );
|
81 |
|
82 |
+
add_submenu_page( 'edit.php?post_type=modula-gallery', esc_html__( 'Import/Export', 'modula-best-grid-gallery' ), esc_html__( 'Import/Export', 'modula-best-grid-gallery' ), 'manage_options', 'modula-import-export', array( $this, 'import_export_doc' ) );
|
83 |
+
|
84 |
}
|
85 |
|
86 |
public function show_submenu() {
|
302 |
|
303 |
<?php
|
304 |
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Add Import/Export tutorial
|
308 |
+
*
|
309 |
+
* @since 2.2.7
|
310 |
+
*/
|
311 |
+
public function import_export_doc() {
|
312 |
+
?>
|
313 |
+
<div class="wrap">
|
314 |
+
<h3><?php esc_html_e('Import Galleries','modula-best-grid-gallery'); ?></h3>
|
315 |
+
<p><?php esc_html_e('In order to import exported galleries head over to "Tools -> Import" or click','modula-best-grid-gallery'); ?> <a href="<?php echo admin_url('import.php'); ?>"><?php esc_html_e('here.','mdula-best-grid-gallery'); ?></a></p>
|
316 |
+
<p><?php echo '<a href="'.esc_url('https://wordpress.org/plugins/wordpress-importer/').'" target="_blank">'.esc_html__('Install Wordpress Importer','modula-best-grid-gallery').'</a>'.esc_html__('( if not installed ). If installed, click on Wordpress "Run importer". After that select the export file you desire and click "Upload file and import".','modula-best-grid-gallery'); ?></p>
|
317 |
+
</div>
|
318 |
+
<br />
|
319 |
+
<h3><?php esc_html_e('Export Galleries','modula-best-grid-gallery'); ?></h3>
|
320 |
+
<p><?php esc_html_e('In order to export Modula galleries head over to "Tools -> Export" or click','modula-best-grid-gallery'); ?> <a href="<?php echo admin_url('export.php'); ?>"><?php esc_html_e('here.','mdula-best-grid-gallery'); ?></a></p>
|
321 |
+
<p><?php echo esc_html__('Select "Galleries" and click "Download Export File". An export file will be created and downloaded, which will be used to import the galleries somewhere else.','modula-best-grid-gallery'); ?></p>
|
322 |
+
</div>
|
323 |
+
<?php
|
324 |
+
}
|
325 |
}
|
326 |
|
327 |
new Modula_Admin();
|
includes/admin/class-modula-cpt-fields-helper.php
CHANGED
@@ -281,6 +281,14 @@ class Modula_CPT_Fields_Helper {
|
|
281 |
"description" => esc_html__( 'The title font size in pixels (set to 0 to use the theme defaults).', 'modula-best-grid-gallery' ),
|
282 |
'priority' => 40,
|
283 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
"hide_description" => array(
|
285 |
"name" => esc_html__( 'Hide Caption', 'modula-best-grid-gallery' ),
|
286 |
"type" => "toggle",
|
@@ -303,14 +311,6 @@ class Modula_CPT_Fields_Helper {
|
|
303 |
"description" => esc_html__( 'The caption font size in pixels (set to 0 to use theme defaults).', 'modula-best-grid-gallery' ),
|
304 |
'priority' => 80,
|
305 |
),
|
306 |
-
"mobileTitleFontSize" => array(
|
307 |
-
"name" => esc_html__( 'Mobile Title Font Size', 'modula-best-grid-gallery' ),
|
308 |
-
"type" => "number",
|
309 |
-
"after" => 'px',
|
310 |
-
"default" => 12,
|
311 |
-
"description" => esc_html__( 'The title font size in pixels (set to 0 to use the theme defaults) for mobile view.', 'modula-best-grid-gallery' ),
|
312 |
-
'priority' => 90,
|
313 |
-
),
|
314 |
"mobileCaptionFontSize" => array(
|
315 |
"name" => esc_html__( 'Mobile Caption Font Size', 'modula-best-grid-gallery' ),
|
316 |
"type" => "number",
|
@@ -371,9 +371,8 @@ class Modula_CPT_Fields_Helper {
|
|
371 |
),
|
372 |
"socialIconSize" => array(
|
373 |
"name" => esc_html__( 'Size of social sharing icons', 'modula-best-grid-gallery' ),
|
374 |
-
"type" => "
|
375 |
-
"
|
376 |
-
"max" => 20,
|
377 |
"description" => esc_html__( '16 will be the default value. '),
|
378 |
"default" => 16,
|
379 |
'priority' => 50,
|
281 |
"description" => esc_html__( 'The title font size in pixels (set to 0 to use the theme defaults).', 'modula-best-grid-gallery' ),
|
282 |
'priority' => 40,
|
283 |
),
|
284 |
+
"mobileTitleFontSize" => array(
|
285 |
+
"name" => esc_html__( 'Mobile Title Font Size', 'modula-best-grid-gallery' ),
|
286 |
+
"type" => "number",
|
287 |
+
"after" => 'px',
|
288 |
+
"default" => 12,
|
289 |
+
"description" => esc_html__( 'The title font size in pixels (set to 0 to use the theme defaults) for mobile view.', 'modula-best-grid-gallery' ),
|
290 |
+
'priority' => 40,
|
291 |
+
),
|
292 |
"hide_description" => array(
|
293 |
"name" => esc_html__( 'Hide Caption', 'modula-best-grid-gallery' ),
|
294 |
"type" => "toggle",
|
311 |
"description" => esc_html__( 'The caption font size in pixels (set to 0 to use theme defaults).', 'modula-best-grid-gallery' ),
|
312 |
'priority' => 80,
|
313 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
"mobileCaptionFontSize" => array(
|
315 |
"name" => esc_html__( 'Mobile Caption Font Size', 'modula-best-grid-gallery' ),
|
316 |
"type" => "number",
|
371 |
),
|
372 |
"socialIconSize" => array(
|
373 |
"name" => esc_html__( 'Size of social sharing icons', 'modula-best-grid-gallery' ),
|
374 |
+
"type" => "number",
|
375 |
+
"after" => "px",
|
|
|
376 |
"description" => esc_html__( '16 will be the default value. '),
|
377 |
"default" => 16,
|
378 |
'priority' => 50,
|
includes/admin/class-modula-cpt.php
CHANGED
@@ -65,28 +65,26 @@ class Modula_CPT {
|
|
65 |
'show_in_rest' => true,
|
66 |
) );
|
67 |
|
68 |
-
$this->metaboxes =
|
69 |
'modula-preview-gallery' => array(
|
70 |
-
'title'
|
71 |
'callback' => 'output_gallery_images',
|
72 |
-
'context'
|
|
|
73 |
),
|
74 |
-
'modula-albums-upsell' => array(
|
75 |
-
'title' => esc_html__('Albums Upsell', 'modula-best-grid-gallery'),
|
76 |
-
'callback' => 'output_upsell_albums',
|
77 |
-
'context' => 'normal',
|
78 |
-
),
|
79 |
'modula-settings' => array(
|
80 |
-
'title'
|
81 |
'callback' => 'output_gallery_settings',
|
82 |
-
'context'
|
|
|
83 |
),
|
84 |
'modula-shortcode' => array(
|
85 |
-
'title'
|
86 |
'callback' => 'output_gallery_shortcode',
|
87 |
-
'context'
|
|
|
88 |
),
|
89 |
-
)
|
90 |
|
91 |
$this->cpt_name = apply_filters( 'modula_cpt_name', 'modula-gallery' );
|
92 |
|
@@ -95,11 +93,7 @@ class Modula_CPT {
|
|
95 |
/* Fire our meta box setup function on the post editor screen. */
|
96 |
add_action( 'load-post.php', array( $this, 'meta_boxes_setup' ) );
|
97 |
add_action( 'load-post-new.php', array( $this, 'meta_boxes_setup' ) );
|
98 |
-
|
99 |
add_action( 'admin_menu', array($this, 'replace_submit_meta_box') );
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
|
104 |
add_filter( 'views_edit-modula-gallery', array( $this, 'add_extensions_tab' ), 10, 1 );
|
105 |
|
@@ -143,11 +137,15 @@ class Modula_CPT {
|
|
143 |
public function add_meta_boxes() {
|
144 |
|
145 |
global $post;
|
|
|
146 |
|
|
|
|
|
|
|
147 |
foreach ( $this->metaboxes as $metabox_id => $metabox ) {
|
148 |
|
149 |
if ( 'modula-shortcode' == $metabox_id && 'auto-draft' == $post->post_status ) {
|
150 |
-
|
151 |
}
|
152 |
|
153 |
add_meta_box(
|
65 |
'show_in_rest' => true,
|
66 |
) );
|
67 |
|
68 |
+
$this->metaboxes = array(
|
69 |
'modula-preview-gallery' => array(
|
70 |
+
'title' => esc_html__( 'Gallery', 'modula-best-grid-gallery' ),
|
71 |
'callback' => 'output_gallery_images',
|
72 |
+
'context' => 'normal',
|
73 |
+
'priority' => 10,
|
74 |
),
|
|
|
|
|
|
|
|
|
|
|
75 |
'modula-settings' => array(
|
76 |
+
'title' => esc_html__( 'Settings', 'modula-best-grid-gallery' ),
|
77 |
'callback' => 'output_gallery_settings',
|
78 |
+
'context' => 'normal',
|
79 |
+
'priority' => 20,
|
80 |
),
|
81 |
'modula-shortcode' => array(
|
82 |
+
'title' => esc_html__( 'Shortcode', 'modula-best-grid-gallery' ),
|
83 |
'callback' => 'output_gallery_shortcode',
|
84 |
+
'context' => 'side',
|
85 |
+
'priority' => 10,
|
86 |
),
|
87 |
+
);
|
88 |
|
89 |
$this->cpt_name = apply_filters( 'modula_cpt_name', 'modula-gallery' );
|
90 |
|
93 |
/* Fire our meta box setup function on the post editor screen. */
|
94 |
add_action( 'load-post.php', array( $this, 'meta_boxes_setup' ) );
|
95 |
add_action( 'load-post-new.php', array( $this, 'meta_boxes_setup' ) );
|
|
|
96 |
add_action( 'admin_menu', array($this, 'replace_submit_meta_box') );
|
|
|
|
|
|
|
97 |
|
98 |
add_filter( 'views_edit-modula-gallery', array( $this, 'add_extensions_tab' ), 10, 1 );
|
99 |
|
137 |
public function add_meta_boxes() {
|
138 |
|
139 |
global $post;
|
140 |
+
$this->metaboxes = apply_filters( 'modula_cpt_metaboxes', $this->metaboxes );
|
141 |
|
142 |
+
// Sort tabs based on priority.
|
143 |
+
uasort( $this->metaboxes, array( 'Modula_Helper', 'sort_data_by_priority' ) );
|
144 |
+
|
145 |
foreach ( $this->metaboxes as $metabox_id => $metabox ) {
|
146 |
|
147 |
if ( 'modula-shortcode' == $metabox_id && 'auto-draft' == $post->post_status ) {
|
148 |
+
continue;
|
149 |
}
|
150 |
|
151 |
add_meta_box(
|
includes/admin/class-modula-field-builder.php
CHANGED
@@ -341,7 +341,6 @@ class Modula_Field_Builder {
|
|
341 |
$html .= '</div>';
|
342 |
break;
|
343 |
case "custom_code":
|
344 |
-
|
345 |
$html = '<div class="modula-code-editor" data-syntax="' . esc_attr( $field['syntax'] ) . '">';
|
346 |
$html .= '<textarea data-setting="' . esc_attr( $field['id'] ) . '" name="modula-settings[' . esc_attr( $field['id'] ) . ']" id="modula-' . esc_attr( $field['id'] ) . '-customcode" class="large-text code modula-custom-editor-field" rows="10" cols="50">' . wp_kses_post($value) . '</textarea>';
|
347 |
$html .= '</div>';
|
@@ -426,7 +425,7 @@ class Modula_Field_Builder {
|
|
426 |
}elseif ( 'pufrobo' == $key ) {
|
427 |
// Pufrobo Effect
|
428 |
$effect .= '<div class="panel panel-pufrobo modula-items clearfix">';
|
429 |
-
$effect .= '<div class="modula-item effect-pufrobo"><img src="' . MODULA_URL . '/assets/images/effect.jpg" class="pic"><div class="figc"><div class="figc-inner"><h2>Lorem ipsum</h2><p class="description">Quisque diam erat, mollisvitae enim eget</p><div class="jtg-social"><a class="fa fa-twitter" href="#">' . Modula_Helper::get_icon( 'twitter' ) . '</a><a class="fa fa-facebook" href="#">' . Modula_Helper::get_icon( 'facebook' ) . '</a><a class="fa fa-pinterest" href="#">' . Modula_Helper::get_icon( 'pinterest' ) . '</a></div></div></div></div>';
|
430 |
$effect .= '<div class="effect-compatibility">';
|
431 |
$effect .= '<p class="description">' . esc_html__( 'This effect is compatible with:', 'modula-best-grid-gallery' );
|
432 |
$effect .= '<span><strong> ' . esc_html__( 'Title', 'modula-best-grid-gallery' ) . '</strong></span>,';
|
@@ -450,7 +449,7 @@ class Modula_Field_Builder {
|
|
450 |
break;
|
451 |
}
|
452 |
|
453 |
-
return $html;
|
454 |
|
455 |
}
|
456 |
|
341 |
$html .= '</div>';
|
342 |
break;
|
343 |
case "custom_code":
|
|
|
344 |
$html = '<div class="modula-code-editor" data-syntax="' . esc_attr( $field['syntax'] ) . '">';
|
345 |
$html .= '<textarea data-setting="' . esc_attr( $field['id'] ) . '" name="modula-settings[' . esc_attr( $field['id'] ) . ']" id="modula-' . esc_attr( $field['id'] ) . '-customcode" class="large-text code modula-custom-editor-field" rows="10" cols="50">' . wp_kses_post($value) . '</textarea>';
|
346 |
$html .= '</div>';
|
425 |
}elseif ( 'pufrobo' == $key ) {
|
426 |
// Pufrobo Effect
|
427 |
$effect .= '<div class="panel panel-pufrobo modula-items clearfix">';
|
428 |
+
$effect .= '<div class="modula-item effect-pufrobo"><img src="' . MODULA_URL . '/assets/images/effect.jpg" class="pic"><div class="figc"><div class="figc-inner"><h2>Lorem ipsum</h2><p class="description">Quisque diam erat, mollisvitae enim eget</p><div class="jtg-social"><a class="fa fa-twitter" href="#">' . Modula_Helper::get_icon( 'twitter' ) . '</a><a class="fa fa-facebook" href="#">' . Modula_Helper::get_icon( 'facebook' ) . '</a><a class="fa fa-pinterest" href="#">' . Modula_Helper::get_icon( 'pinterest' ) . '</a><a class="fa fa-whatsapp" href="#">' . Modula_Helper::get_icon( 'whatsapp' ). '</a><a class="fa fa-linkedin" href="#">' . Modula_Helper::get_icon( 'linkedin' ) .'</a></div></div></div></div>';
|
429 |
$effect .= '<div class="effect-compatibility">';
|
430 |
$effect .= '<p class="description">' . esc_html__( 'This effect is compatible with:', 'modula-best-grid-gallery' );
|
431 |
$effect .= '<span><strong> ' . esc_html__( 'Title', 'modula-best-grid-gallery' ) . '</strong></span>,';
|
449 |
break;
|
450 |
}
|
451 |
|
452 |
+
return apply_filters( "modula_render_field_type", $html, $field, $value );
|
453 |
|
454 |
}
|
455 |
|
includes/admin/class-modula-image.php
CHANGED
@@ -50,7 +50,7 @@ class Modula_Image {
|
|
50 |
return $return;
|
51 |
break;
|
52 |
}
|
53 |
-
|
54 |
}else{
|
55 |
return new WP_Error( 'modula-gallery-error-no-url', esc_html__( 'No image with this ID.', 'modula-best-grid-gallery' ) );
|
56 |
}
|
@@ -183,6 +183,7 @@ class Modula_Image {
|
|
183 |
public function resize_image( $url, $width = null, $height = null, $crop = false, $align = 'c', $quality = 100, $retina = false, $data = array(), $force_overwrite = false ) {
|
184 |
|
185 |
global $wpdb;
|
|
|
186 |
|
187 |
// Get common vars.
|
188 |
$args = array( $url, $width, $height, $crop, $align, $quality, $retina, $data );
|
@@ -226,11 +227,11 @@ class Modula_Image {
|
|
226 |
}
|
227 |
|
228 |
|
229 |
-
|
230 |
// If the file doesn't exist yet, we need to create it.
|
231 |
if ( ! file_exists( $dest_file_name ) || ( file_exists( $dest_file_name ) && $force_overwrite ) ) {
|
232 |
// We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
|
233 |
-
$
|
|
|
234 |
|
235 |
// Load the WordPress image editor.
|
236 |
$editor = wp_get_image_editor( $file_path );
|
@@ -299,17 +300,18 @@ class Modula_Image {
|
|
299 |
// Add the resized dimensions and alignment to original image metadata, so the images
|
300 |
// can be deleted when the original image is delete from the Media Library.
|
301 |
if ( $get_attachment ) {
|
302 |
-
$metadata = wp_get_attachment_metadata( $get_attachment
|
303 |
|
304 |
if ( isset( $metadata['image_meta'] ) ) {
|
305 |
-
$md = $saved['width'] . 'x' . $saved['height'];
|
306 |
|
307 |
-
|
308 |
-
$md .= $align ? "_${align}" : "_c";
|
309 |
-
}
|
310 |
|
|
|
|
|
|
|
|
|
311 |
$metadata['image_meta']['resized_images'][] = $md;
|
312 |
-
wp_update_attachment_metadata( $get_attachment
|
313 |
}
|
314 |
}
|
315 |
|
50 |
return $return;
|
51 |
break;
|
52 |
}
|
53 |
+
|
54 |
}else{
|
55 |
return new WP_Error( 'modula-gallery-error-no-url', esc_html__( 'No image with this ID.', 'modula-best-grid-gallery' ) );
|
56 |
}
|
183 |
public function resize_image( $url, $width = null, $height = null, $crop = false, $align = 'c', $quality = 100, $retina = false, $data = array(), $force_overwrite = false ) {
|
184 |
|
185 |
global $wpdb;
|
186 |
+
$upload_dir = wp_upload_dir();
|
187 |
|
188 |
// Get common vars.
|
189 |
$args = array( $url, $width, $height, $crop, $align, $quality, $retina, $data );
|
227 |
}
|
228 |
|
229 |
|
|
|
230 |
// If the file doesn't exist yet, we need to create it.
|
231 |
if ( ! file_exists( $dest_file_name ) || ( file_exists( $dest_file_name ) && $force_overwrite ) ) {
|
232 |
// We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
|
233 |
+
$_wp_attached_file = str_replace( $upload_dir['baseurl'] . '/' , '', $url );
|
234 |
+
$get_attachment = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key='_wp_attached_file' AND meta_value='%s'", $_wp_attached_file ) );
|
235 |
|
236 |
// Load the WordPress image editor.
|
237 |
$editor = wp_get_image_editor( $file_path );
|
300 |
// Add the resized dimensions and alignment to original image metadata, so the images
|
301 |
// can be deleted when the original image is delete from the Media Library.
|
302 |
if ( $get_attachment ) {
|
303 |
+
$metadata = wp_get_attachment_metadata( $get_attachment );
|
304 |
|
305 |
if ( isset( $metadata['image_meta'] ) ) {
|
|
|
306 |
|
307 |
+
$md = $suffix;
|
|
|
|
|
308 |
|
309 |
+
if( ! isset( $metadata['image_meta']['resized_images'] ) ) {
|
310 |
+
$metadata['image_meta']['resized_images'] = array();
|
311 |
+
}
|
312 |
+
|
313 |
$metadata['image_meta']['resized_images'][] = $md;
|
314 |
+
wp_update_attachment_metadata( $get_attachment, $metadata );
|
315 |
}
|
316 |
}
|
317 |
|
includes/admin/class-modula-upsells.php
CHANGED
@@ -18,7 +18,7 @@ class Modula_Upsells {
|
|
18 |
add_filter( 'modula_password_protect_tab_content', array( $this, 'password_protect_tab_upsell' ) );
|
19 |
add_filter( 'modula_watermark_tab_content', array( $this, 'watermark_tab_upsell' ) );
|
20 |
add_filter( 'modula_slideshow_tab_content', array( $this, 'slideshow_tab_upsell' ) );
|
21 |
-
|
22 |
|
23 |
/* Fire our meta box setup function on the post editor screen. */
|
24 |
add_action( 'load-post.php', array( $this, 'meta_boxes_setup' ) );
|
@@ -26,6 +26,26 @@ class Modula_Upsells {
|
|
26 |
|
27 |
}
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
public function generate_upsell_box( $title, $description, $tab ) {
|
30 |
|
31 |
$upsell_box = '<div class="modula-upsell">';
|
18 |
add_filter( 'modula_password_protect_tab_content', array( $this, 'password_protect_tab_upsell' ) );
|
19 |
add_filter( 'modula_watermark_tab_content', array( $this, 'watermark_tab_upsell' ) );
|
20 |
add_filter( 'modula_slideshow_tab_content', array( $this, 'slideshow_tab_upsell' ) );
|
21 |
+
add_filter( 'modula_cpt_metaboxes',array( $this, 'albums_upsell_meta' ) );
|
22 |
|
23 |
/* Fire our meta box setup function on the post editor screen. */
|
24 |
add_action( 'load-post.php', array( $this, 'meta_boxes_setup' ) );
|
26 |
|
27 |
}
|
28 |
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Add Albums Upsell Metabox
|
32 |
+
*
|
33 |
+
* @param $met
|
34 |
+
* @return mixed
|
35 |
+
* @since 2.2.7
|
36 |
+
*/
|
37 |
+
public function albums_upsell_meta( $met ) {
|
38 |
+
|
39 |
+
$met['modula-albums-upsell'] = array(
|
40 |
+
'title' => esc_html__( 'Albums Upsell', 'modula-best-grid-gallery' ),
|
41 |
+
'callback' => 'output_upsell_albums',
|
42 |
+
'context' => 'normal',
|
43 |
+
'priority' => 5,
|
44 |
+
);
|
45 |
+
|
46 |
+
return $met;
|
47 |
+
}
|
48 |
+
|
49 |
public function generate_upsell_box( $title, $description, $tab ) {
|
50 |
|
51 |
$upsell_box = '<div class="modula-upsell">';
|
includes/admin/tabs/about.php
CHANGED
@@ -1,12 +1,19 @@
|
|
1 |
<?php
|
2 |
$issues = array(
|
3 |
'fix' => array(
|
4 |
-
esc_html__( '
|
5 |
-
esc_html__( '
|
6 |
-
esc_html__( 'Fixed
|
7 |
-
esc_html__( '
|
8 |
-
esc_html__( '
|
|
|
9 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
);
|
11 |
?>
|
12 |
<div class="row modula-about-row">
|
@@ -23,7 +30,7 @@ $issues = array(
|
|
23 |
<div class="modula-about-content">
|
24 |
<?php if (!empty($issues)) { ?>
|
25 |
|
26 |
-
<h2><?php printf(esc_html__('Version %s addressed %s bugs', 'modula-best-grid-gallery'), MODULA_LITE_VERSION, count( $issues['fix'] ) ); ?></h2>
|
27 |
<ul class="modula-about-list">
|
28 |
<?php
|
29 |
foreach ($issues as $key => $iss) {
|
1 |
<?php
|
2 |
$issues = array(
|
3 |
'fix' => array(
|
4 |
+
esc_html__( 'Fixed incompatibility with isotope.js', 'modula-best-grid-gallery' ),
|
5 |
+
esc_html__( 'Renamed our registered files name', 'modula-best-grid-gallery' ),
|
6 |
+
esc_html__( 'Fixed title/caption font size to reflect theme default', 'modula-best-grid-gallery' ),
|
7 |
+
esc_html__( 'Fixed scroll to top when opening lightbox', 'modula-best-grid-gallery' ),
|
8 |
+
esc_html__( 'If Title/Caption is hidden then hide settings also', 'modula-best-grid-gallery' ),
|
9 |
+
esc_html__( 'Hide settings if toggle is OFF for custom responsiveness ', 'modula-best-grid-gallery' ),
|
10 |
),
|
11 |
+
'feature' => array(
|
12 |
+
esc_html__( 'Added Migrate functionality. Now it\'s easier to migrate from another gallery to Modula', 'modula-best-grid-gallery' ),
|
13 |
+
esc_html__( 'Improved social media icons in preview', 'modula-best-grid-gallery' ),
|
14 |
+
esc_html__( 'Delete resized images when deleting attachment', 'modula-best-grid-gallery' ),
|
15 |
+
esc_html__( 'Added Import/Export sub-menu entry and tutorial', 'modula-best-grid-gallery' ),
|
16 |
+
)
|
17 |
);
|
18 |
?>
|
19 |
<div class="row modula-about-row">
|
30 |
<div class="modula-about-content">
|
31 |
<?php if (!empty($issues)) { ?>
|
32 |
|
33 |
+
<h2><?php printf(esc_html__('Version %s addressed %s bugs and added %s features', 'modula-best-grid-gallery'), MODULA_LITE_VERSION, count( $issues['fix'] ),count( $issues['feature'] ) ); ?></h2>
|
34 |
<ul class="modula-about-list">
|
35 |
<?php
|
36 |
foreach ($issues as $key => $iss) {
|
includes/class-modula.php
CHANGED
@@ -59,6 +59,7 @@ class Modula {
|
|
59 |
require_once MODULA_PATH . 'includes/libraries/class-modula-review.php';
|
60 |
require_once MODULA_PATH . 'includes/uninstall/class-modula-uninstall.php';
|
61 |
require_once MODULA_PATH . 'includes/update/class-modula-update.php';
|
|
|
62 |
|
63 |
}
|
64 |
|
@@ -90,6 +91,7 @@ class Modula {
|
|
90 |
add_filter('upload_mimes', array($this,'modula_upload_mime_types'));
|
91 |
add_filter('file_is_displayable_image', array($this,'modula_webp_display'), 10, 2);
|
92 |
|
|
|
93 |
new Modula_CPT();
|
94 |
|
95 |
}
|
@@ -101,8 +103,8 @@ class Modula {
|
|
101 |
}
|
102 |
|
103 |
if ( apply_filters( 'modula_show_upsells', true ) ) {
|
104 |
-
|
105 |
-
|
106 |
|
107 |
$upgrades = Modula_Upgrades::get_instance();
|
108 |
$upgrades->initialize_admin();
|
@@ -181,7 +183,7 @@ class Modula {
|
|
181 |
wp_enqueue_style( 'wp-color-picker' );
|
182 |
// Enqueue Code Editor for Custom CSS
|
183 |
wp_enqueue_code_editor(array('type' => 'text/css'));
|
184 |
-
wp_enqueue_style( 'jquery-ui', MODULA_URL . 'assets/css/jquery-ui.min.css', null, MODULA_LITE_VERSION );
|
185 |
wp_enqueue_style( 'modula-cpt-style', MODULA_URL . 'assets/css/modula-cpt.css', null, MODULA_LITE_VERSION );
|
186 |
|
187 |
wp_enqueue_script( 'modula-resize-senzor', MODULA_URL . 'assets/js/resizesensor.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
|
59 |
require_once MODULA_PATH . 'includes/libraries/class-modula-review.php';
|
60 |
require_once MODULA_PATH . 'includes/uninstall/class-modula-uninstall.php';
|
61 |
require_once MODULA_PATH . 'includes/update/class-modula-update.php';
|
62 |
+
require_once MODULA_PATH . 'includes/migrate/class-modula-importer.php';
|
63 |
|
64 |
}
|
65 |
|
91 |
add_filter('upload_mimes', array($this,'modula_upload_mime_types'));
|
92 |
add_filter('file_is_displayable_image', array($this,'modula_webp_display'), 10, 2);
|
93 |
|
94 |
+
// Initiate modula cpts
|
95 |
new Modula_CPT();
|
96 |
|
97 |
}
|
103 |
}
|
104 |
|
105 |
if ( apply_filters( 'modula_show_upsells', true ) ) {
|
106 |
+
new Modula_Upsells();
|
107 |
+
}
|
108 |
|
109 |
$upgrades = Modula_Upgrades::get_instance();
|
110 |
$upgrades->initialize_admin();
|
183 |
wp_enqueue_style( 'wp-color-picker' );
|
184 |
// Enqueue Code Editor for Custom CSS
|
185 |
wp_enqueue_code_editor(array('type' => 'text/css'));
|
186 |
+
wp_enqueue_style( 'modula-jquery-ui', MODULA_URL . 'assets/css/jquery-ui.min.css', null, MODULA_LITE_VERSION );
|
187 |
wp_enqueue_style( 'modula-cpt-style', MODULA_URL . 'assets/css/modula-cpt.css', null, MODULA_LITE_VERSION );
|
188 |
|
189 |
wp_enqueue_script( 'modula-resize-senzor', MODULA_URL . 'assets/js/resizesensor.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
|
includes/elementor/class-modula-elementor-widget-activation.php
CHANGED
@@ -68,7 +68,7 @@ class Modula_Elementor_Widget_Activation {
|
|
68 |
|
69 |
do_action( 'modula_elementor_before_enqueue_scripts' );
|
70 |
|
71 |
-
wp_enqueue_script( 'packery' );
|
72 |
wp_enqueue_script( 'modula-lazysizes' );
|
73 |
wp_enqueue_script( 'modula' );
|
74 |
|
68 |
|
69 |
do_action( 'modula_elementor_before_enqueue_scripts' );
|
70 |
|
71 |
+
wp_enqueue_script( 'modula-packery' );
|
72 |
wp_enqueue_script( 'modula-lazysizes' );
|
73 |
wp_enqueue_script( 'modula' );
|
74 |
|
includes/helper/class-modula-helper.php
CHANGED
@@ -168,5 +168,28 @@ class Modula_Helper {
|
|
168 |
return 'rgba(' . absint( $red ) . ',' . absint( $green ) . ',' . absint( $blue ) . ',' . floatval( $alpha ) . ')';
|
169 |
|
170 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
}
|
168 |
return 'rgba(' . absint( $red ) . ',' . absint( $green ) . ',' . absint( $blue ) . ',' . floatval( $alpha ) . ')';
|
169 |
|
170 |
}
|
171 |
+
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Function to insert array into array after index
|
175 |
+
*
|
176 |
+
* @param $key
|
177 |
+
* @param array $array
|
178 |
+
* @param $new_key
|
179 |
+
* @param $new_value
|
180 |
+
* @return array
|
181 |
+
* @since 2.2.7
|
182 |
+
*/
|
183 |
+
public static function array_insert_after( $key, array &$array, $new_key, $new_value ) {
|
184 |
+
$new = array();
|
185 |
+
foreach ( $array as $k => $value ) {
|
186 |
+
$new[ $k ] = $value;
|
187 |
+
if ( $k === $key ) {
|
188 |
+
$new[ $new_key ] = $new_value;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
return $new;
|
192 |
+
|
193 |
+
}
|
194 |
|
195 |
}
|
includes/migrate/class-modula-importer.php
ADDED
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Exit if accessed directly.
|
4 |
+
if (!defined('ABSPATH')) {
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
|
8 |
+
class Modula_Importer {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Holds the class object.
|
12 |
+
*
|
13 |
+
* @since 2.2.7
|
14 |
+
*
|
15 |
+
* @var object
|
16 |
+
*/
|
17 |
+
public static $instance;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Primary class constructor.
|
21 |
+
*
|
22 |
+
* @since 2.2.7
|
23 |
+
*/
|
24 |
+
public function __construct() {
|
25 |
+
|
26 |
+
// Add Importer Tab
|
27 |
+
add_filter('modula_admin_page_tabs', array($this, 'add_importer_tab'));
|
28 |
+
|
29 |
+
// Render Importer tab
|
30 |
+
add_action('modula_admin_tab_importer', array($this, 'render_importer_tab'));
|
31 |
+
|
32 |
+
// Include required scripts for import
|
33 |
+
add_action('admin_enqueue_scripts', array($this, 'admin_importer_scripts'));
|
34 |
+
|
35 |
+
add_action('admin_menu',array($this,'migrator_menu'));
|
36 |
+
|
37 |
+
// Required files
|
38 |
+
require_once MODULA_PATH . 'includes/migrate/nextgen/class-modula-nextgen-importer.php';
|
39 |
+
require_once MODULA_PATH . 'includes/migrate/envira/class-modula-envira-importer.php';
|
40 |
+
require_once MODULA_PATH . 'includes/migrate/final-tiles/class-modula-final-tiles-importer.php';
|
41 |
+
require_once MODULA_PATH . 'includes/migrate/photoblocks/class-modula-photoblocks-importer.php';
|
42 |
+
require_once MODULA_PATH . 'includes/migrate/wp-core-gallery/class-modula-wp-core-gallery-importer.php';
|
43 |
+
|
44 |
+
// Load the plugin.
|
45 |
+
$this->init();
|
46 |
+
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Add sub-menu entry for Migrate
|
51 |
+
*/
|
52 |
+
public function migrator_menu() {
|
53 |
+
add_submenu_page( 'edit.php?post_type=modula-gallery', esc_html__( 'Migrate', 'modula-best-grid-gallery' ), esc_html__( 'Migrate', 'modula-best-grid-gallery' ), 'manage_options', 'edit.php?post_type=modula-gallery&page=modula&modula-tab=importer' );
|
54 |
+
}
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Loads the plugin into WordPress.
|
59 |
+
*
|
60 |
+
* @since 2.2.7
|
61 |
+
*/
|
62 |
+
public function init() {
|
63 |
+
|
64 |
+
// Load admin only components.
|
65 |
+
if (is_admin()) {
|
66 |
+
add_filter('modula_uninstall_db_options',array($this,'uninstall_options'),16,1);
|
67 |
+
add_action('wp_ajax_modula_importer_get_galleries',array($this,'get_source_galleries'));
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Enqueue import script
|
75 |
+
*
|
76 |
+
* @since 2.2.7
|
77 |
+
*/
|
78 |
+
public function admin_importer_scripts() {
|
79 |
+
|
80 |
+
$screen = get_current_screen();
|
81 |
+
|
82 |
+
// only enqueue script if we are in Modula Settings page
|
83 |
+
if ('modula-gallery' == $screen->post_type && 'modula-gallery_page_modula' == $screen->base ) {
|
84 |
+
|
85 |
+
$ajax_url = admin_url('admin-ajax.php');
|
86 |
+
$nonce = wp_create_nonce('modula-importer');
|
87 |
+
$empty_gallery = esc_html__('Please choose at least one gallery to migrate.', 'modula-best-grid-gallery');
|
88 |
+
|
89 |
+
wp_enqueue_style('modula-importer', MODULA_URL . 'assets/css/modula-importer.css', array(), MODULA_LITE_VERSION);
|
90 |
+
wp_enqueue_script('modula-importer', MODULA_URL . 'assets/js/modula-importer.js', array('jquery'), MODULA_LITE_VERSION, true);
|
91 |
+
wp_localize_script(
|
92 |
+
'modula-importer',
|
93 |
+
'modula_importer',
|
94 |
+
array(
|
95 |
+
'ajax' => $ajax_url,
|
96 |
+
'nonce' => $nonce,
|
97 |
+
'importing' => '<span style="color:green">' . esc_html__(' Migration started...', 'modula-best-grid-gallery') . '</span>',
|
98 |
+
'empty_gallery_selection' => $empty_gallery,
|
99 |
+
)
|
100 |
+
);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Add Importer tab
|
107 |
+
*
|
108 |
+
* @param $tabs
|
109 |
+
* @return mixed
|
110 |
+
*
|
111 |
+
* @since 2.2.7
|
112 |
+
*/
|
113 |
+
public function add_importer_tab($tabs) {
|
114 |
+
$tabs['importer'] = array(
|
115 |
+
'label' => esc_html__('Migrate galleries', 'modula-best-grid-gallery'),
|
116 |
+
'priority' => 50,
|
117 |
+
);
|
118 |
+
|
119 |
+
return $tabs;
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Render Importer tab
|
125 |
+
*
|
126 |
+
* @since 2.2.7
|
127 |
+
*/
|
128 |
+
public function render_importer_tab() {
|
129 |
+
include 'tabs/modula-importer-tab.php';
|
130 |
+
}
|
131 |
+
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Add migrate DB options to uninstall
|
135 |
+
*
|
136 |
+
* @param $options_array
|
137 |
+
* @return mixed
|
138 |
+
*
|
139 |
+
* @since 2.2.7
|
140 |
+
*/
|
141 |
+
public function uninstall_options($options_array){
|
142 |
+
array_push($options_array,'modula_importer');
|
143 |
+
|
144 |
+
return $options_array;
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Get gallery sources
|
149 |
+
*
|
150 |
+
* @return mixed
|
151 |
+
*
|
152 |
+
* @since 2.2.7
|
153 |
+
*/
|
154 |
+
public function get_sources() {
|
155 |
+
|
156 |
+
global $wpdb;
|
157 |
+
$sources = array();
|
158 |
+
|
159 |
+
// Assume they are none
|
160 |
+
$envira = false;
|
161 |
+
$nextgen = false;
|
162 |
+
$final_tiles = false;
|
163 |
+
$photoblolcks = false;
|
164 |
+
$wp_core = false;
|
165 |
+
|
166 |
+
$envira = $wpdb->get_results(" SELECT COUNT(ID) FROM " . $wpdb->prefix . "posts WHERE post_type ='envira'");
|
167 |
+
|
168 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "ngg_gallery'")) {
|
169 |
+
$nextgen = $wpdb->get_results(" SELECT COUNT(gid) FROM " . $wpdb->prefix . "ngg_gallery");
|
170 |
+
}
|
171 |
+
|
172 |
+
// Seems like on some servers tables are saved lowercase
|
173 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "finaltiles_gallery'")) {
|
174 |
+
$final_tiles = $wpdb->get_results(" SELECT COUNT(Id) FROM " . $wpdb->prefix . "finaltiles_gallery");
|
175 |
+
}
|
176 |
+
|
177 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "FinalTiles_gallery'")) {
|
178 |
+
$final_tiles = $wpdb->get_results(" SELECT COUNT(Id) FROM " . $wpdb->prefix . "FinalTiles_gallery");
|
179 |
+
}
|
180 |
+
|
181 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "photoblocks'")) {
|
182 |
+
$photoblolcks = $wpdb->get_results(" SELECT COUNT(id) FROM " . $wpdb->prefix . "photoblocks");
|
183 |
+
}
|
184 |
+
|
185 |
+
$sql = "SELECT COUNT(ID) FROM " . $wpdb->prefix . "posts WHERE `post_content` LIKE '%[galler%' AND `post_status` = 'publish'";
|
186 |
+
$wp_core = $wpdb->get_results($sql);
|
187 |
+
|
188 |
+
// Need to get this so we can handle the object to check if mysql returned 0
|
189 |
+
$envira_return = (NULL != $envira) ? get_object_vars($envira[0]) : false;
|
190 |
+
$nextgen_return = (NULL != $nextgen) ? get_object_vars($nextgen[0]) : false;
|
191 |
+
$final_tiles_return = (NULL != $final_tiles) ? get_object_vars($final_tiles[0]) : false;
|
192 |
+
$photoblocks_return = (NULL != $photoblolcks) ? get_object_vars($photoblolcks[0]) : false;
|
193 |
+
$wp_core_return = (NULL != $wp_core) ? get_object_vars($wp_core[0]) : false;
|
194 |
+
|
195 |
+
// Check to see if there are any entries and insert into array
|
196 |
+
if ($envira && NULL != $envira && !empty($envira) && $envira_return && '0' != $envira_return['COUNT(ID)']) {
|
197 |
+
$sources['envira'] = 'Envira Gallery';
|
198 |
+
}
|
199 |
+
if ($nextgen && NULL != $nextgen && !empty($nextgen) && $nextgen_return && '0' != $nextgen_return['COUNT(gid)']) {
|
200 |
+
$sources['nextgen'] = 'NextGEN Gallery';
|
201 |
+
}
|
202 |
+
if ($final_tiles && NULL != $final_tiles && !empty($final_tiles) && $final_tiles_return && '0' != $final_tiles_return['COUNT(Id)']) {
|
203 |
+
$sources['final_tiles'] = 'Final Tiles Gallery';
|
204 |
+
}
|
205 |
+
if ($photoblolcks && NULL != $photoblolcks && !empty($photoblolcks) && $photoblocks_return && '0' != $photoblocks_return['COUNT(id)']) {
|
206 |
+
$sources['photoblocks'] = 'PhotoBlocks';
|
207 |
+
}
|
208 |
+
if ($wp_core && NULL != $wp_core && !empty($wp_core) && $wp_core_return && '0' != $wp_core_return['COUNT(ID)'] ) {
|
209 |
+
$sources['wp_core'] = 'WP Core Galleries';
|
210 |
+
}
|
211 |
+
|
212 |
+
if (!empty($sources)) {
|
213 |
+
return $sources;
|
214 |
+
}
|
215 |
+
|
216 |
+
return false;
|
217 |
+
}
|
218 |
+
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Get galleries for sources
|
222 |
+
*
|
223 |
+
* @since 2.2.7
|
224 |
+
*/
|
225 |
+
public function get_source_galleries() {
|
226 |
+
|
227 |
+
check_ajax_referer('modula-importer', 'nonce');
|
228 |
+
$source = isset($_POST['source']) ? $_POST['source'] : false;
|
229 |
+
|
230 |
+
if (!$source || 'none' == $source) {
|
231 |
+
echo esc_html__('There is no source selected', 'modula-best-grid-gallery');
|
232 |
+
wp_die();
|
233 |
+
}
|
234 |
+
|
235 |
+
$import_settings = get_option('modula_importer');
|
236 |
+
$import_settings = wp_parse_args($import_settings, array('galleries' => array()));
|
237 |
+
$galleries = array();
|
238 |
+
$html = '';
|
239 |
+
|
240 |
+
switch ($source) {
|
241 |
+
case 'envira' :
|
242 |
+
$gal_source = Modula_Envira_Importer::get_instance();
|
243 |
+
$galleries = $gal_source->get_galleries();
|
244 |
+
break;
|
245 |
+
case 'nextgen':
|
246 |
+
$gal_source = Modula_Nextgen_Importer::get_instance();
|
247 |
+
$galleries = $gal_source->get_galleries();
|
248 |
+
break;
|
249 |
+
case 'final_tiles' :
|
250 |
+
$gal_source = Modula_Final_Tiles_Importer::get_instance();
|
251 |
+
$galleries = $gal_source->get_galleries();
|
252 |
+
break;
|
253 |
+
case 'photoblocks':
|
254 |
+
$gal_source = Modula_Photoblocks_Importer::get_instance();
|
255 |
+
$galleries = $gal_source->get_galleries();
|
256 |
+
break;
|
257 |
+
case 'wp_core':
|
258 |
+
$gal_source = Modula_WP_Core_Gallery_Importer::get_instance();
|
259 |
+
$galleries = $gal_source->get_galleries();
|
260 |
+
break;
|
261 |
+
}
|
262 |
+
|
263 |
+
|
264 |
+
// Although this isn't necessary, sources have been checked before in tab
|
265 |
+
// it is best if we do another check, just to be sure.
|
266 |
+
if (!isset($galleries['valid_galleries']) && isset($galleries['empty_galleries']) && count($galleries['empty_galleries']) > 0) {
|
267 |
+
printf(esc_html__('While we’ve found %s gallery(ies) we could import , we were unable to find any images associated with it(them). There’s no content for us to import .','modula-best-grid-gallery'),count($galleries['empty_galleries']));
|
268 |
+
wp_die();
|
269 |
+
}
|
270 |
+
|
271 |
+
foreach ($galleries['valid_galleries'] as $key => $gallery) {
|
272 |
+
$imported = false;
|
273 |
+
switch ( $source ) {
|
274 |
+
case 'envira':
|
275 |
+
$id = $gallery->ID;
|
276 |
+
$modula_gallery = get_post_type( $import_settings['galleries'][ $source ][ $id ] );
|
277 |
+
|
278 |
+
if ( isset( $import_settings['galleries'][$source] ) && 'modula-gallery' == $modula_gallery ) {
|
279 |
+
$imported = true;
|
280 |
+
}
|
281 |
+
|
282 |
+
$title = '<a href="' . admin_url( '/post.php?post=' . $gallery->ID . '&action=edit' ) . '" target="_blank">' . esc_html( $gallery->post_title ) . '</a>';
|
283 |
+
$count = $gal_source->images_count( $gallery->ID );
|
284 |
+
break;
|
285 |
+
case 'final_tiles' :
|
286 |
+
$id = $gallery->Id;
|
287 |
+
$modula_gallery = get_post_type( $import_settings['galleries'][ $source ][ $id ] );
|
288 |
+
if ( isset( $import_settings['galleries'][$source] ) && 'modula-gallery' == $modula_gallery ) {
|
289 |
+
$imported = true;
|
290 |
+
}
|
291 |
+
|
292 |
+
$ftg_config = json_decode( $gallery->configuration );
|
293 |
+
$title = '<a href="' . admin_url( 'admin.php?page=ftg-lite-gallery-admin&id=' . $gallery->Id ) . '" target="_blank"> ' . esc_html( $ftg_config->name ) . '</a>';
|
294 |
+
$count = $gal_source->images_count( $gallery->Id );
|
295 |
+
break;
|
296 |
+
case 'nextgen':
|
297 |
+
$id = $gallery->gid;
|
298 |
+
$modula_gallery = get_post_type( $import_settings['galleries'][ $source ][ $id ] );
|
299 |
+
if ( isset( $import_settings['galleries'][$source] ) && 'modula-gallery' == $modula_gallery ) {
|
300 |
+
$imported = true;
|
301 |
+
}
|
302 |
+
$title = '<a href="' . wp_nonce_url( admin_url( 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $gallery->gid ) ) . '" target="_blank">' . esc_html( $gallery->title ) . '</a>';
|
303 |
+
$count = $gal_source->images_count( $gallery->gid );
|
304 |
+
break;
|
305 |
+
case
|
306 |
+
'photoblocks':
|
307 |
+
$id = $gallery->id;
|
308 |
+
$modula_gallery = get_post_type( $import_settings['galleries'][ $source ][ $id ] );
|
309 |
+
if ( isset( $import_settings['galleries'][$source] ) && 'modula-gallery' == $modula_gallery ) {
|
310 |
+
$imported = true;
|
311 |
+
}
|
312 |
+
$title = '<a href="' . admin_url( 'admin.php?page=photoblocks-edit&id=' . $gallery->id ) . '" target="_blank"> ' . esc_html( $gallery->name ) . '</a>';
|
313 |
+
$count = $gal_source->images_count( $gallery->id );
|
314 |
+
break;
|
315 |
+
case 'wp_core':
|
316 |
+
$id = $gallery['page_id'] . '-' . $gallery['gal_nr'];
|
317 |
+
$value = json_encode( array( 'id' => $gallery['page_id'], 'shortcode' => $gallery['shortcode'] ) );
|
318 |
+
$title = '<a href="' . admin_url( '/post.php?post=' . absint( $gallery['page_id'] ) . '&action=edit' ) . '" target="_blank">' . esc_html( $gallery['title'] ) . '</a>';
|
319 |
+
$count = $gallery['images'];
|
320 |
+
break;
|
321 |
+
default:
|
322 |
+
$id = $gallery->ID;
|
323 |
+
$modula_gallery = get_post_type( $import_settings['galleries'][ $source ][ $id ] );
|
324 |
+
|
325 |
+
if ( isset( $import_settings['galleries'][ $source ] ) && 'modula-gallery' == $modula_gallery ) {
|
326 |
+
$imported = true;
|
327 |
+
}
|
328 |
+
$title = $gallery->post_title;
|
329 |
+
|
330 |
+
}
|
331 |
+
|
332 |
+
// Small fix for wp_core galleries
|
333 |
+
$val = ($value) ? $value : $id;
|
334 |
+
|
335 |
+
$html .= '<div class="modula-importer-checkbox-wrapper">' .
|
336 |
+
'<label for="' . esc_attr( $source ) . '-galleries-' . esc_attr( $id ) . '"' .
|
337 |
+
' data-id="' . esc_attr( $id ) . '" ' . ( $imported ? ' class="imported"' : '' ) . '>' .
|
338 |
+
'<input type="checkbox" name="gallery"' .
|
339 |
+
' id="' . esc_attr( $source ) . '-galleries-' . esc_attr( $id ) . '"' .
|
340 |
+
' data-id="'.esc_attr($id).'" value="' . esc_attr( $val ) . '"/>';
|
341 |
+
// Title is escaped above
|
342 |
+
$html .= $title ;
|
343 |
+
|
344 |
+
|
345 |
+
|
346 |
+
if(20 < $count){
|
347 |
+
$lite = '<div class="tab-header-tooltip-container modula-tooltip"><span>[?]</span><div class="tab-header-description modula-tooltip-content">';
|
348 |
+
$lite .= esc_html__('You currently have ','modula-best-grid-gallery');
|
349 |
+
$lite .= absint($count);
|
350 |
+
$lite .= esc_html__(' images in your gallery and only 20 will be imported. If you want to import al, please buy the PRO version and import them after that. ','modula-best-grid-gallery');
|
351 |
+
$lite .= '</div></div>';
|
352 |
+
}
|
353 |
+
|
354 |
+
// Display text on LITE. On PRO version
|
355 |
+
$lite = apply_filters( 'modula_lite_migration_text', $lite );
|
356 |
+
$html .= $lite;
|
357 |
+
|
358 |
+
$html .= '<span class="modula-importer-gallery-status">';
|
359 |
+
|
360 |
+
if ( $imported ) {
|
361 |
+
$html .= '<i class="imported-check dashicons dashicons-yes"></i>';
|
362 |
+
}
|
363 |
+
|
364 |
+
$html .= '</span></label></div>';
|
365 |
+
|
366 |
+
}
|
367 |
+
|
368 |
+
echo $html;
|
369 |
+
wp_die();
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
/**
|
374 |
+
* Prepare gallery images
|
375 |
+
*
|
376 |
+
*
|
377 |
+
* @param $source
|
378 |
+
* @param $data
|
379 |
+
* @return 0|array|bool|mixed|object|null
|
380 |
+
*
|
381 |
+
* @since 2.2.7
|
382 |
+
*/
|
383 |
+
public function prepare_images($source,$data){
|
384 |
+
|
385 |
+
global $wpdb;
|
386 |
+
$images = array();
|
387 |
+
$limit = '20';
|
388 |
+
$limit = (int)apply_filters('modula_importer_migrate_limit',$limit);
|
389 |
+
|
390 |
+
switch ($source){
|
391 |
+
case 'envira':
|
392 |
+
$images = get_post_meta($data, '_eg_gallery_data', true);
|
393 |
+
$images = array_slice($images['gallery'],0,$limit,true);
|
394 |
+
break;
|
395 |
+
case 'nextgen':
|
396 |
+
// Get images from NextGEN Gallery
|
397 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "ngg_pictures
|
398 |
+
WHERE galleryid = %d
|
399 |
+
ORDER BY sortorder ASC,
|
400 |
+
imagedate ASC",
|
401 |
+
$data);
|
402 |
+
|
403 |
+
$images = $wpdb->get_results($sql);
|
404 |
+
$images = array_slice($images,0,$limit,true);
|
405 |
+
break;
|
406 |
+
case 'final_tiles':
|
407 |
+
// Seems like on some servers tables are saved lowercase
|
408 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "finaltiles_gallery'")) {
|
409 |
+
// Get images from Final Tiles
|
410 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "finaltiles_gallery_images
|
411 |
+
WHERE gid = %d
|
412 |
+
ORDER BY 'setOrder' ASC",
|
413 |
+
$data);
|
414 |
+
$images = $wpdb->get_results($sql);
|
415 |
+
$images = array_slice($images,0,$limit,true);
|
416 |
+
}
|
417 |
+
|
418 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "FinalTiles_gallery'")) {
|
419 |
+
// Get images from Final Tiles
|
420 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "FinalTiles_gallery_images
|
421 |
+
WHERE gid = %d
|
422 |
+
ORDER BY 'setOrder' ASC",
|
423 |
+
$data);
|
424 |
+
$images = $wpdb->get_results($sql);
|
425 |
+
$images = array_slice($images,0,$limit,true);
|
426 |
+
}
|
427 |
+
break;
|
428 |
+
case 'photoblocks':
|
429 |
+
// Get gallery
|
430 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "photoblocks
|
431 |
+
WHERE id = %d LIMIT 1",
|
432 |
+
$data);
|
433 |
+
$gallery = $wpdb->get_row($sql);
|
434 |
+
$blocks = json_decode($gallery->blocks);
|
435 |
+
$blocks = array_slice($blocks,0,$limit,true);
|
436 |
+
$gallery->blocks = json_encode($blocks);
|
437 |
+
$images = $gallery;
|
438 |
+
break;
|
439 |
+
case 'wp_core':
|
440 |
+
$images = explode(',', $data);
|
441 |
+
$images = array_slice($images,0,$limit,true);
|
442 |
+
break;
|
443 |
+
|
444 |
+
}
|
445 |
+
|
446 |
+
if($images){
|
447 |
+
return $images;
|
448 |
+
}
|
449 |
+
|
450 |
+
return false;
|
451 |
+
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Returns the singleton instance of the class.
|
456 |
+
*
|
457 |
+
* @return object The Modula_Importer object.
|
458 |
+
*
|
459 |
+
* @since 2.2.7
|
460 |
+
*/
|
461 |
+
public static function get_instance() {
|
462 |
+
|
463 |
+
if (!isset(self::$instance) && !(self::$instance instanceof Modula_Importer)) {
|
464 |
+
self::$instance = new Modula_Importer();
|
465 |
+
}
|
466 |
+
|
467 |
+
return self::$instance;
|
468 |
+
}
|
469 |
+
}
|
470 |
+
|
471 |
+
$modula_importer = Modula_Importer::get_instance();
|
includes/migrate/envira/class-modula-envira-importer.php
ADDED
@@ -0,0 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly.
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
class Modula_Envira_Importer {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Holds the class object.
|
11 |
+
*
|
12 |
+
* @var object
|
13 |
+
*
|
14 |
+
* @since 2.2.7
|
15 |
+
*/
|
16 |
+
public static $instance;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Primary class constructor.
|
20 |
+
*
|
21 |
+
* @since 1.0.0
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
|
25 |
+
// Add AJAX
|
26 |
+
add_action('wp_ajax_modula_importer_envira_gallery_import', array($this, 'envira_gallery_import'));
|
27 |
+
add_action('wp_ajax_modula_importer_envira_gallery_imported_update', array($this, 'update_imported'));
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get all Envira Galleries
|
34 |
+
*
|
35 |
+
* @return mixed
|
36 |
+
*
|
37 |
+
* @since 2.2.7
|
38 |
+
*/
|
39 |
+
public function get_galleries() {
|
40 |
+
|
41 |
+
global $wpdb;
|
42 |
+
|
43 |
+
$galleries = $wpdb->get_results(" SELECT * FROM " . $wpdb->prefix . "posts WHERE post_type = 'envira' AND post_status = 'publish'");
|
44 |
+
$empty_galleries = array();
|
45 |
+
|
46 |
+
if (count($galleries) != 0) {
|
47 |
+
foreach ($galleries as $key => $gallery) {
|
48 |
+
$count = $this->images_count($gallery->ID);
|
49 |
+
|
50 |
+
if ($count == 0) {
|
51 |
+
unset($galleries[$key]);
|
52 |
+
$empty_galleries[$key] = $gallery;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
if (count($galleries) != 0) {
|
57 |
+
$return_galleries['valid_galleries'] = $galleries;
|
58 |
+
}
|
59 |
+
if (count($empty_galleries) != 0) {
|
60 |
+
$return_galleries['empty_galleries'] = $empty_galleries;
|
61 |
+
}
|
62 |
+
|
63 |
+
if (count($return_galleries) != 0) {
|
64 |
+
return $return_galleries;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Get gallery image count
|
74 |
+
*
|
75 |
+
* @param $id
|
76 |
+
* @return int
|
77 |
+
*
|
78 |
+
* @since 2.2.7
|
79 |
+
*/
|
80 |
+
public function images_count($id){
|
81 |
+
|
82 |
+
$images = get_post_meta($id, '_eg_gallery_data', true);
|
83 |
+
$count = count($images['gallery']);
|
84 |
+
|
85 |
+
return $count;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Imports a gallery from Envira to Modula
|
90 |
+
*
|
91 |
+
* @param string $gallery_id
|
92 |
+
*
|
93 |
+
* @since 2.2.7
|
94 |
+
*/
|
95 |
+
public function envira_gallery_import($gallery_id = '') {
|
96 |
+
|
97 |
+
global $wpdb;
|
98 |
+
$modula_importer = Modula_Importer::get_instance();
|
99 |
+
|
100 |
+
// Set max execution time so we don't timeout
|
101 |
+
ini_set('max_execution_time', 0);
|
102 |
+
set_time_limit(0);
|
103 |
+
|
104 |
+
// If no gallery ID, get from AJAX request
|
105 |
+
if (empty($gallery_id)) {
|
106 |
+
|
107 |
+
// Run a security check first.
|
108 |
+
check_ajax_referer('modula-importer', 'nonce');
|
109 |
+
|
110 |
+
if (!isset($_POST['id'])) {
|
111 |
+
$this->modula_import_result(false, esc_html__('No gallery was selected', 'modula-best-grid-gallery'),false);
|
112 |
+
}
|
113 |
+
|
114 |
+
$gallery_id = absint($_POST['id']);
|
115 |
+
|
116 |
+
}
|
117 |
+
|
118 |
+
$imported_galleries = get_option('modula_importer');
|
119 |
+
// If already migrated don't migrate
|
120 |
+
|
121 |
+
if ( isset( $imported_galleries['galleries']['envira'][ $gallery_id ] ) ) {
|
122 |
+
|
123 |
+
$modula_gallery = get_post_type( $imported_galleries['galleries']['envira'][ $gallery_id ] );
|
124 |
+
|
125 |
+
if ( 'modula-gallery' == $modula_gallery ) {
|
126 |
+
// Trigger delete function if option is set to delete
|
127 |
+
if ( isset($_POST['clean']) && 'delete' == $_POST['clean'] ) {
|
128 |
+
$this->clean_entries( $gallery_id );
|
129 |
+
}
|
130 |
+
$this->modula_import_result( false, esc_html__( 'Gallery already migrated!', 'modula-best-grid-gallery' ), false );
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
|
135 |
+
// Get all images attached to the gallery
|
136 |
+
$modula_images = array();
|
137 |
+
|
138 |
+
// get gallery data so we can get title, description and alt from envira
|
139 |
+
$envira_gallery_data = $modula_importer->prepare_images('envira',$gallery_id);
|
140 |
+
|
141 |
+
if (isset($envira_gallery_data) && count($envira_gallery_data) > 0) {
|
142 |
+
foreach ($envira_gallery_data as $imageID => $image) {
|
143 |
+
|
144 |
+
$envira_image_title = ( !isset( $image['title'] ) || '' != $image['title'] ) ? $image['title'] : '';
|
145 |
+
|
146 |
+
$envira_image_caption = ( !isset( $image['caption'] ) || '' != $image['caption'] ) ? $image['caption'] : wp_get_attachment_caption( $imageID );
|
147 |
+
|
148 |
+
$envira_image_alt = ( !isset( $image['alt'] ) || '' != $image['alt'] ) ? $image['alt'] : get_post_meta( $imageID, '_wp_attachment_image_alt', TRUE );
|
149 |
+
$envira_image_url = ( !isset( $image['link'] ) || '' != $image['link'] ) ? $image['link'] : '';
|
150 |
+
$target = ( isset( $image['link_new_window'] ) && '1' == $image['link_new_window'] ) ? 1 : 0;
|
151 |
+
|
152 |
+
|
153 |
+
$modula_images[] = array(
|
154 |
+
'id' => absint($imageID),
|
155 |
+
'alt' => sanitize_text_field($envira_image_alt),
|
156 |
+
'title' => sanitize_text_field($envira_image_title),
|
157 |
+
'description' => wp_filter_post_kses($envira_image_caption),
|
158 |
+
'halign' => 'center',
|
159 |
+
'valign' => 'middle',
|
160 |
+
'link' => esc_url_raw($envira_image_url),
|
161 |
+
'target' => absint($target),
|
162 |
+
'width' => 2,
|
163 |
+
'height' => 2,
|
164 |
+
'filters' => ''
|
165 |
+
);
|
166 |
+
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
if (count($modula_images) == 0) {
|
171 |
+
// Trigger delete function if option is set to delete
|
172 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
173 |
+
$this->clean_entries($gallery_id);
|
174 |
+
}
|
175 |
+
$this->modula_import_result(false, esc_html__('No images found in gallery. Skipping gallery...', 'modula-best-grid-gallery'),false);
|
176 |
+
}
|
177 |
+
|
178 |
+
// Get Modula Gallery defaults, used to set modula-settings metadata
|
179 |
+
$modula_settings = Modula_CPT_Fields_Helper::get_defaults();
|
180 |
+
|
181 |
+
// Create Modula CPT
|
182 |
+
$modula_gallery_id = wp_insert_post(array(
|
183 |
+
'post_type' => 'modula-gallery',
|
184 |
+
'post_status' => 'publish',
|
185 |
+
'post_title' => sanitize_text_field(get_the_title($gallery_id)),
|
186 |
+
));
|
187 |
+
|
188 |
+
// Attach meta modula-settings to Modula CPT
|
189 |
+
update_post_meta($modula_gallery_id, 'modula-settings', $modula_settings);
|
190 |
+
// Attach meta modula-images to Modula CPT
|
191 |
+
update_post_meta($modula_gallery_id, 'modula-images', $modula_images);
|
192 |
+
|
193 |
+
$envira_shortcodes = '[envira-gallery id="' . $gallery_id . '"]';
|
194 |
+
$envira_slug = get_post_field('post_name',$gallery_id);
|
195 |
+
$envira_slug_shortcode = '[envira-gallery slug="' . $envira_slug . '"]';
|
196 |
+
$modula_shortcode = '[modula id="' . $modula_gallery_id . '"]';
|
197 |
+
|
198 |
+
// Replace Envira id shortcode with Modula Shortcode in Posts, Pages and CPTs
|
199 |
+
$sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content, '%s', '%s')",
|
200 |
+
$envira_shortcodes, $modula_shortcode);
|
201 |
+
$wpdb->query($sql);
|
202 |
+
|
203 |
+
// Replace Envira slug shortcode with Modula Shortcode in Posts, Pages and CPTs
|
204 |
+
$sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content, '%s', '%s')",
|
205 |
+
$envira_slug_shortcode, $modula_shortcode);
|
206 |
+
$wpdb->query($sql);
|
207 |
+
|
208 |
+
// Trigger delete function if option is set to delete
|
209 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
210 |
+
$this->clean_entries($gallery_id);
|
211 |
+
}
|
212 |
+
|
213 |
+
$this->modula_import_result(true, wp_kses_post('<i class="imported-check dashicons dashicons-yes"></i>'),$modula_gallery_id );
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Update imported galleries
|
218 |
+
*
|
219 |
+
*
|
220 |
+
* @since 2.2.7
|
221 |
+
*/
|
222 |
+
public function update_imported() {
|
223 |
+
|
224 |
+
check_ajax_referer('modula-importer', 'nonce');
|
225 |
+
|
226 |
+
$galleries = $_POST['galleries'];
|
227 |
+
|
228 |
+
$importer_settings = get_option('modula_importer');
|
229 |
+
|
230 |
+
// first check if array
|
231 |
+
if(!is_array($importer_settings)){
|
232 |
+
$importer_settings = array();
|
233 |
+
}
|
234 |
+
|
235 |
+
if (!isset($importer_settings['galleries']['envira'])) {
|
236 |
+
$importer_settings['galleries']['envira'] = array();
|
237 |
+
}
|
238 |
+
|
239 |
+
if ( is_array( $galleries ) && count( $galleries ) > 0 ) {
|
240 |
+
foreach ( $galleries as $key => $value ) {
|
241 |
+
$importer_settings['galleries']['envira'][ absint($key) ] = absint($value);
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
// Remember that this gallery has been imported
|
246 |
+
update_option('modula_importer', $importer_settings);
|
247 |
+
|
248 |
+
// Set url for migration complete
|
249 |
+
$url = admin_url('edit.php?post_type=modula-gallery&page=modula&modula-tab=importer&migration=complete');
|
250 |
+
|
251 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
252 |
+
// Set url for migration and cleaning complete
|
253 |
+
$url = admin_url('edit.php?post_type=modula-gallery&page=modula&modula-tab=importer&migration=complete&delete=complete');
|
254 |
+
}
|
255 |
+
|
256 |
+
echo $url;
|
257 |
+
wp_die();
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Returns result
|
262 |
+
*
|
263 |
+
* @param $success
|
264 |
+
* @param $message
|
265 |
+
* @param $gallery_id
|
266 |
+
*
|
267 |
+
* @since 2.2.7
|
268 |
+
*/
|
269 |
+
public function modula_import_result( $success, $message, $gallery_id = false ) {
|
270 |
+
echo json_encode( array(
|
271 |
+
'success' => (bool)$success,
|
272 |
+
'message' => (string)$message,
|
273 |
+
'modula_gallery_id' => $gallery_id
|
274 |
+
) );
|
275 |
+
die;
|
276 |
+
}
|
277 |
+
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Returns the singleton instance of the class.
|
281 |
+
*
|
282 |
+
* @since 2.2.7
|
283 |
+
*/
|
284 |
+
public static function get_instance() {
|
285 |
+
|
286 |
+
if (!isset(self::$instance) && !(self::$instance instanceof Modula_Envira_Importer)) {
|
287 |
+
self::$instance = new Modula_Envira_Importer();
|
288 |
+
}
|
289 |
+
|
290 |
+
return self::$instance;
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Delete old entries from database
|
296 |
+
*
|
297 |
+
* @param $gallery_id
|
298 |
+
*
|
299 |
+
* @since 2.2.7
|
300 |
+
*/
|
301 |
+
public function clean_entries($gallery_id){
|
302 |
+
global $wpdb;
|
303 |
+
$sql = $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = $gallery_id" );
|
304 |
+
$sql_meta = $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = $gallery_id" );
|
305 |
+
$wpdb->query( $sql );
|
306 |
+
$wpdb->query( $sql_meta );
|
307 |
+
}
|
308 |
+
|
309 |
+
}
|
310 |
+
|
311 |
+
// Load the class.
|
312 |
+
$modula_envira_importer = Modula_Envira_Importer::get_instance();
|
includes/migrate/final-tiles/class-modula-final-tiles-importer.php
ADDED
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly.
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
class Modula_Final_Tiles_Importer {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Holds the class object.
|
11 |
+
*
|
12 |
+
* @var object
|
13 |
+
*
|
14 |
+
* @since 2.2.7
|
15 |
+
*/
|
16 |
+
public static $instance;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Primary class constructor.
|
20 |
+
*
|
21 |
+
* @since 2.2.7
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
|
25 |
+
// Add AJAX
|
26 |
+
add_action('wp_ajax_modula_importer_final_tiles_gallery_import', array($this, 'final_tiles_gallery_import'));
|
27 |
+
add_action('wp_ajax_modula_importer_final_tiles_gallery_imported_update', array($this, 'update_imported'));
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get all Final Tiles Galleries
|
33 |
+
*
|
34 |
+
* @return mixed
|
35 |
+
*
|
36 |
+
* @since 2.2.7
|
37 |
+
*/
|
38 |
+
public function get_galleries() {
|
39 |
+
|
40 |
+
global $wpdb;
|
41 |
+
$empty_galleries = array();
|
42 |
+
|
43 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "finaltiles_gallery'")) {
|
44 |
+
$galleries = $wpdb->get_results(" SELECT * FROM " . $wpdb->prefix . "finaltiles_gallery");
|
45 |
+
if (count($galleries) != 0) {
|
46 |
+
foreach ($galleries as $key => $gallery) {
|
47 |
+
$count = $this->images_count($gallery->Id);
|
48 |
+
|
49 |
+
if ($count == 0) {
|
50 |
+
unset($galleries[$key]);
|
51 |
+
$empty_galleries[$key] = $gallery;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
if (count($galleries) != 0) {
|
56 |
+
$return_galleries['valid_galleries'] = $galleries;
|
57 |
+
}
|
58 |
+
if (count($empty_galleries) != 0) {
|
59 |
+
$return_galleries['empty_galleries'] = $empty_galleries;
|
60 |
+
}
|
61 |
+
|
62 |
+
if (count($return_galleries) != 0) {
|
63 |
+
return $return_galleries;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "FinalTiles_gallery'" ) ) {
|
69 |
+
$galleries = $wpdb->get_results( " SELECT * FROM " . $wpdb->prefix . "FinalTiles_gallery" );
|
70 |
+
if ( count( $galleries ) != 0 ) {
|
71 |
+
foreach ( $galleries as $key => $gallery ) {
|
72 |
+
$count = $this->images_count( $gallery->Id );
|
73 |
+
|
74 |
+
if ( $count == 0 ) {
|
75 |
+
unset( $galleries[ $key ] );
|
76 |
+
$empty_galleries[ $key ] = $gallery;
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
if ( count( $galleries ) != 0 ) {
|
81 |
+
$return_galleries['valid_galleries'] = $galleries;
|
82 |
+
}
|
83 |
+
if ( count( $empty_galleries ) != 0 ) {
|
84 |
+
$return_galleries['empty_galleries'] = $empty_galleries;
|
85 |
+
}
|
86 |
+
|
87 |
+
if ( count( $return_galleries ) != 0 ) {
|
88 |
+
return $return_galleries;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
return false;
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Get gallery image count
|
99 |
+
*
|
100 |
+
* @param $id
|
101 |
+
* @return int
|
102 |
+
*
|
103 |
+
* @since 2.2.7
|
104 |
+
*/
|
105 |
+
public function images_count($id){
|
106 |
+
global $wpdb;
|
107 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "finaltiles_gallery'")) {
|
108 |
+
// Get images from Final Tiles
|
109 |
+
$sql = $wpdb->prepare("SELECT COUNT(Id) FROM " . $wpdb->prefix . "finaltiles_gallery_images
|
110 |
+
WHERE gid = %d ",
|
111 |
+
$id);
|
112 |
+
$images = $wpdb->get_results($sql);
|
113 |
+
}
|
114 |
+
|
115 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "FinalTiles_gallery'")) {
|
116 |
+
// Get images from Final Tiles
|
117 |
+
$sql = $wpdb->prepare("SELECT COUNT(Id) FROM " . $wpdb->prefix . "FinalTiles_gallery_images
|
118 |
+
WHERE gid = %d",
|
119 |
+
$id);
|
120 |
+
$images = $wpdb->get_results($sql);
|
121 |
+
}
|
122 |
+
|
123 |
+
$count = get_object_vars($images[0]);
|
124 |
+
$count = $count['COUNT(Id)'];
|
125 |
+
|
126 |
+
return $count;
|
127 |
+
}
|
128 |
+
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Imports a gallery from Final Tiles to Modula
|
132 |
+
*
|
133 |
+
* @param string $gallery_id
|
134 |
+
*
|
135 |
+
* @since 2.2.7
|
136 |
+
*/
|
137 |
+
public function final_tiles_gallery_import($gallery_id = '') {
|
138 |
+
|
139 |
+
global $wpdb;
|
140 |
+
$modula_importer = Modula_Importer::get_instance();
|
141 |
+
|
142 |
+
// Set max execution time so we don't timeout
|
143 |
+
ini_set('max_execution_time', 0);
|
144 |
+
set_time_limit(0);
|
145 |
+
|
146 |
+
// If no gallery ID, get from AJAX request
|
147 |
+
if (empty($gallery_id)) {
|
148 |
+
|
149 |
+
// Run a security check first.
|
150 |
+
check_ajax_referer('modula-importer', 'nonce');
|
151 |
+
|
152 |
+
if (!isset($_POST['id'])) {
|
153 |
+
$this->modula_import_result(false, esc_html__('No gallery was selected', 'modula-best-grid-gallery'),false);
|
154 |
+
}
|
155 |
+
|
156 |
+
$gallery_id = absint($_POST['id']);
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
$imported_galleries = get_option('modula_importer');
|
161 |
+
|
162 |
+
// If already migrated don't migrate
|
163 |
+
if ( isset( $imported_galleries['galleries']['final_tiles'][ $gallery_id ] ) ) {
|
164 |
+
|
165 |
+
$modula_gallery = get_post_type( $imported_galleries['galleries']['final_tiles'][ $gallery_id ] );
|
166 |
+
|
167 |
+
if ( 'modula-gallery' == $modula_gallery ) {
|
168 |
+
// Trigger delete function if option is set to delete
|
169 |
+
if ( isset($_POST['clean']) && 'delete' == $_POST['clean'] ) {
|
170 |
+
$this->clean_entries( $gallery_id );
|
171 |
+
}
|
172 |
+
$this->modula_import_result( false, esc_html__( 'Gallery already migrated!', 'modula-best-grid-gallery' ), false );
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
// Seems like on some servers tables are saved lowercase
|
177 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "finaltiles_gallery'")) {
|
178 |
+
|
179 |
+
// Get gallery configuration
|
180 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "finaltiles_gallery
|
181 |
+
WHERE id = %d",
|
182 |
+
$gallery_id);
|
183 |
+
$gallery = $wpdb->get_row($sql);
|
184 |
+
}
|
185 |
+
|
186 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '" . $wpdb->prefix . "FinalTiles_gallery'")) {
|
187 |
+
|
188 |
+
// Get gallery configuration
|
189 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "FinalTiles_gallery
|
190 |
+
WHERE id = %d",
|
191 |
+
$gallery_id);
|
192 |
+
$gallery = $wpdb->get_row($sql);
|
193 |
+
}
|
194 |
+
|
195 |
+
$images = $modula_importer->prepare_images('final_tiles',$gallery_id);
|
196 |
+
|
197 |
+
$gallery_config = json_decode($gallery->configuration);
|
198 |
+
|
199 |
+
// Build Modula Gallery modula-images metadata
|
200 |
+
$modula_images = array();
|
201 |
+
if (is_array($images) && count($images) > 0) {
|
202 |
+
// Add each image to Media Library
|
203 |
+
foreach ($images as $image) {
|
204 |
+
|
205 |
+
$modula_images[] = array(
|
206 |
+
'id' => absint($image->imageId),
|
207 |
+
'alt' => sanitize_text_field($image->alt),
|
208 |
+
'title' => sanitize_text_field($image->title),
|
209 |
+
'description' => wp_filter_post_kses($image->description),
|
210 |
+
'halign' => 'center',
|
211 |
+
'valign' => 'middle',
|
212 |
+
'link' => esc_url_raw($image->link),
|
213 |
+
'target' => (isset($image->target) && '_blank' == $image->target ) ? 1 : 0,
|
214 |
+
'width' => 2,
|
215 |
+
'height' => 2,
|
216 |
+
'filters' => ''
|
217 |
+
);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
if (count($modula_images) == 0) {
|
222 |
+
// Trigger delete function if option is set to delete
|
223 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
224 |
+
$this->clean_entries($gallery_id);
|
225 |
+
}
|
226 |
+
$this->modula_import_result(false, esc_html__('No images found in gallery. Skipping gallery...', 'modula-best-grid-gallery'),false);
|
227 |
+
}
|
228 |
+
|
229 |
+
// Get Modula Gallery defaults, used to set modula-settings metadata
|
230 |
+
$modula_settings = Modula_CPT_Fields_Helper::get_defaults();
|
231 |
+
|
232 |
+
|
233 |
+
// Create Modula CPT
|
234 |
+
$modula_gallery_id = wp_insert_post(array(
|
235 |
+
'post_type' => 'modula-gallery',
|
236 |
+
'post_status' => 'publish',
|
237 |
+
'post_title' => sanitize_text_field($gallery_config->name),
|
238 |
+
));
|
239 |
+
|
240 |
+
// Attach meta modula-settings to Modula CPT
|
241 |
+
update_post_meta($modula_gallery_id, 'modula-settings', $modula_settings);
|
242 |
+
|
243 |
+
// Attach meta modula-images to Modula CPT
|
244 |
+
update_post_meta($modula_gallery_id, 'modula-images', $modula_images);
|
245 |
+
|
246 |
+
$ftg_shortcode = '[FinalTilesGallery id="' . $gallery_id . '"]';
|
247 |
+
$modula_shortcode = '[modula id="' . $modula_gallery_id . '"]';
|
248 |
+
|
249 |
+
// Replace Final Tiles Grid Gallery shortcode with Modula Shortcode in Posts, Pages and CPTs
|
250 |
+
$sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content, '%s', '%s')",
|
251 |
+
$ftg_shortcode, $modula_shortcode);
|
252 |
+
$wpdb->query($sql);
|
253 |
+
|
254 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
255 |
+
$this->clean_entries($gallery_id);
|
256 |
+
}
|
257 |
+
|
258 |
+
$this->modula_import_result(true, wp_kses_post('<i class="imported-check dashicons dashicons-yes"></i>'),$modula_gallery_id);
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Update imported galleries
|
263 |
+
*
|
264 |
+
*
|
265 |
+
* @since 2.2.7
|
266 |
+
*/
|
267 |
+
public function update_imported() {
|
268 |
+
|
269 |
+
check_ajax_referer('modula-importer', 'nonce');
|
270 |
+
$importer_settings = get_option('modula_importer');
|
271 |
+
$galleries = $_POST['galleries'];
|
272 |
+
|
273 |
+
if(!is_array($importer_settings)){
|
274 |
+
$importer_settings = array();
|
275 |
+
}
|
276 |
+
|
277 |
+
if (!isset($importer_settings['galleries']['final_tiles'])) {
|
278 |
+
$importer_settings['galleries']['final_tiles'] = array();
|
279 |
+
}
|
280 |
+
|
281 |
+
if ( is_array( $galleries ) && count( $galleries ) > 0 ) {
|
282 |
+
foreach ( $galleries as $key => $value ) {
|
283 |
+
$importer_settings['galleries']['final_tiles'][ absint($key) ] = absint($value);
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
+
update_option('modula_importer', $importer_settings);
|
288 |
+
|
289 |
+
// Set url for migration complete
|
290 |
+
$url = admin_url('edit.php?post_type=modula-gallery&page=modula&modula-tab=importer&migration=complete');
|
291 |
+
|
292 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
293 |
+
// Set url for migration and cleaning complete
|
294 |
+
$url = admin_url('edit.php?post_type=modula-gallery&page=modula&modula-tab=importer&migration=complete&delete=complete');
|
295 |
+
}
|
296 |
+
|
297 |
+
echo $url;
|
298 |
+
wp_die();
|
299 |
+
|
300 |
+
|
301 |
+
}
|
302 |
+
|
303 |
+
|
304 |
+
/**
|
305 |
+
* Returns result
|
306 |
+
*
|
307 |
+
* @param $success
|
308 |
+
* @param $message
|
309 |
+
*
|
310 |
+
* @since 2.2.7
|
311 |
+
*/
|
312 |
+
public function modula_import_result($success, $message,$modula_gallery_id = false) {
|
313 |
+
echo json_encode(array(
|
314 |
+
'success' => (bool)$success,
|
315 |
+
'message' => (string)$message,
|
316 |
+
'modula_gallery_id' => $modula_gallery_id
|
317 |
+
));
|
318 |
+
die;
|
319 |
+
}
|
320 |
+
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Returns the singleton instance of the class.
|
324 |
+
*
|
325 |
+
* @since 2.2.7
|
326 |
+
*/
|
327 |
+
public static function get_instance() {
|
328 |
+
|
329 |
+
if (!isset(self::$instance) && !(self::$instance instanceof Modula_Final_Tiles_Importer)) {
|
330 |
+
self::$instance = new Modula_Final_Tiles_Importer();
|
331 |
+
}
|
332 |
+
|
333 |
+
return self::$instance;
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Delete old entries from database
|
339 |
+
*
|
340 |
+
* @param $gallery_id
|
341 |
+
*
|
342 |
+
* @since 2.2.7
|
343 |
+
*/
|
344 |
+
public function clean_entries($gallery_id){
|
345 |
+
global $wpdb;
|
346 |
+
|
347 |
+
if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "finaltiles_gallery'" ) ) {
|
348 |
+
$sql = $wpdb->prepare( "DELETE FROM " . $wpdb->prefix . "finaltiles_gallery WHERE Id = $gallery_id" );
|
349 |
+
$sql_meta = $wpdb->prepare( "DELETE FROM " . $wpdb->prefix . "finaltiles_gallery_images WHERE gid = $gallery_id" );
|
350 |
+
|
351 |
+
|
352 |
+
$wpdb->query( $sql );
|
353 |
+
$wpdb->query( $sql_meta );
|
354 |
+
}
|
355 |
+
|
356 |
+
if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $wpdb->prefix . "FinalTiles_gallery'" ) ) {
|
357 |
+
$sql_2 = $wpdb->prepare( "DELETE FROM " . $wpdb->prefix . "FinalTiles_gallery WHERE Id = $gallery_id" );
|
358 |
+
$sql_meta_2 = $wpdb->prepare( "DELETE FROM " . $wpdb->prefix . "FinalTiles_gallery_images WHERE gid = $gallery_id" );
|
359 |
+
|
360 |
+
$wpdb->query( $sql_2 );
|
361 |
+
$wpdb->query( $sql_meta_2 );
|
362 |
+
}
|
363 |
+
}
|
364 |
+
}
|
365 |
+
|
366 |
+
// Load the class.
|
367 |
+
$modula_final_tiles_importer = Modula_Final_Tiles_Importer::get_instance();
|
includes/migrate/nextgen/class-modula-nextgen-importer.php
ADDED
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly.
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
class Modula_Nextgen_Importer {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Holds the class object.
|
11 |
+
*
|
12 |
+
* @var object
|
13 |
+
*
|
14 |
+
* @since 2.2.7
|
15 |
+
*/
|
16 |
+
public static $instance;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Primary class constructor.
|
20 |
+
*
|
21 |
+
* @since 2.2.7
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
|
25 |
+
// Add AJAX
|
26 |
+
add_action('wp_ajax_modula_importer_nextgen_gallery_import', array($this, 'nextgen_gallery_import'));
|
27 |
+
add_action('wp_ajax_modula_importer_nextgen_gallery_imported_update', array($this, 'update_imported'));
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get all NextGEN Galleries
|
33 |
+
*
|
34 |
+
* @return mixed
|
35 |
+
*
|
36 |
+
* @since 2.2.7
|
37 |
+
*/
|
38 |
+
public function get_galleries() {
|
39 |
+
|
40 |
+
global $wpdb;
|
41 |
+
$empty_galleries = array();
|
42 |
+
|
43 |
+
if(!$wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix . "ngg_gallery'")){
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
|
47 |
+
$galleries = $wpdb->get_results(" SELECT * FROM " . $wpdb->prefix . "ngg_gallery");
|
48 |
+
if (count($galleries) != 0) {
|
49 |
+
foreach ($galleries as $key => $gallery) {
|
50 |
+
$count = $this->images_count($gallery->gid);
|
51 |
+
|
52 |
+
if ($count == 0) {
|
53 |
+
unset($galleries[$key]);
|
54 |
+
$empty_galleries[$key] = $gallery;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
if (count($galleries) != 0) {
|
59 |
+
$return_galleries['valid_galleries'] = $galleries;
|
60 |
+
}
|
61 |
+
if (count($empty_galleries) != 0) {
|
62 |
+
$return_galleries['empty_galleries'] = $empty_galleries;
|
63 |
+
}
|
64 |
+
|
65 |
+
if (count($return_galleries) != 0) {
|
66 |
+
return $return_galleries;
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
return false;
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get gallery image count
|
76 |
+
*
|
77 |
+
* @param $id
|
78 |
+
* @return int
|
79 |
+
*
|
80 |
+
* @since 2.2.7
|
81 |
+
*/
|
82 |
+
public function images_count($id){
|
83 |
+
global $wpdb;
|
84 |
+
|
85 |
+
$sql = $wpdb->prepare("SELECT COUNT(pid) FROM " . $wpdb->prefix . "ngg_pictures
|
86 |
+
WHERE galleryid = %d ",
|
87 |
+
$id);
|
88 |
+
|
89 |
+
$images = $wpdb->get_results($sql);
|
90 |
+
$count = get_object_vars($images[0]);
|
91 |
+
$count = $count['COUNT(pid)'];
|
92 |
+
|
93 |
+
return $count;
|
94 |
+
}
|
95 |
+
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Imports a gallery from NextGEN into Modula
|
99 |
+
*
|
100 |
+
* @param string $gallery_id
|
101 |
+
*
|
102 |
+
* @since 2.2.7
|
103 |
+
*/
|
104 |
+
public function nextgen_gallery_import($gallery_id = '') {
|
105 |
+
|
106 |
+
global $wpdb;
|
107 |
+
$modula_importer = Modula_Importer::get_instance();
|
108 |
+
|
109 |
+
// Set max execution time so we don't timeout
|
110 |
+
ini_set( 'max_execution_time', 0 );
|
111 |
+
set_time_limit( 0 );
|
112 |
+
|
113 |
+
// If no gallery ID, get from AJAX request
|
114 |
+
if ( empty( $gallery_id ) ) {
|
115 |
+
|
116 |
+
// Run a security check first.
|
117 |
+
check_ajax_referer( 'modula-importer', 'nonce' );
|
118 |
+
|
119 |
+
if ( !isset( $_POST['id'] ) ) {
|
120 |
+
$this->modula_import_result( false, esc_html__( 'No gallery was selected', 'modula-best-grid-gallery' ), false );
|
121 |
+
}
|
122 |
+
|
123 |
+
$gallery_id = absint( $_POST['id'] );
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
$imported_galleries = get_option( 'modula_importer' );
|
128 |
+
|
129 |
+
if ( isset( $imported_galleries['galleries']['nextgen'][ $gallery_id ] ) ) {
|
130 |
+
|
131 |
+
$modula_gallery = get_post_type( $imported_galleries['galleries']['nextgen'][ $gallery_id ] );
|
132 |
+
// If already migrated don't migrate
|
133 |
+
if ( 'modula-gallery' == $modula_gallery ) {
|
134 |
+
|
135 |
+
// Trigger delete function if option is set to delete
|
136 |
+
if ( isset($_POST['clean']) && 'delete' == $_POST['clean'] ) {
|
137 |
+
$this->clean_entries( $gallery_id );
|
138 |
+
}
|
139 |
+
$this->modula_import_result( false, esc_html__( 'Gallery already migrated!', 'modula-best-grid-gallery' ), false );
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
// Get image path
|
144 |
+
$sql = $wpdb->prepare("SELECT path, title, galdesc, pageid
|
145 |
+
FROM " . $wpdb->prefix . "ngg_gallery
|
146 |
+
WHERE gid = %d
|
147 |
+
LIMIT 1",
|
148 |
+
$gallery_id);
|
149 |
+
$gallery = $wpdb->get_row($sql);
|
150 |
+
|
151 |
+
$images = $modula_importer->prepare_images('nextgen',$gallery_id);
|
152 |
+
$attachments = array();
|
153 |
+
|
154 |
+
if (is_array($images) && count($images) > 0) {
|
155 |
+
// Add each image to Media Library
|
156 |
+
foreach ($images as $image) {
|
157 |
+
|
158 |
+
// Store image in WordPress Media Library
|
159 |
+
$attachment = $this->add_image_to_library($gallery->path, $image->filename, $image->description, $image->alttext);
|
160 |
+
|
161 |
+
if ($attachment !== false ) {
|
162 |
+
|
163 |
+
// Add to array of attachments
|
164 |
+
$attachments[] = $attachment;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
if (count($attachments) == 0) {
|
170 |
+
// Trigger delete function if option is set to delete
|
171 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
172 |
+
$this->clean_entries($gallery_id);
|
173 |
+
}
|
174 |
+
$this->modula_import_result(false, esc_html__('No images found in gallery. Skipping gallery...', 'modula-best-grid-gallery'),false);
|
175 |
+
}
|
176 |
+
|
177 |
+
// Get Modula Gallery defaults, used to set modula-settings metadata
|
178 |
+
$modula_settings = Modula_CPT_Fields_Helper::get_defaults();
|
179 |
+
|
180 |
+
// Build Modula Gallery modula-images metadata
|
181 |
+
$modula_images = array();
|
182 |
+
foreach ($attachments as $attachment) {
|
183 |
+
$modula_images[] = array(
|
184 |
+
'id' => absint($attachment['ID']),
|
185 |
+
'alt' => sanitize_text_field($attachment['alt']),
|
186 |
+
'title' => sanitize_text_field($attachment['title']),
|
187 |
+
'description' => wp_filter_post_kses($attachment['caption']),
|
188 |
+
'halign' => 'center',
|
189 |
+
'valign' => 'middle',
|
190 |
+
'link' => esc_url_raw($attachment['src']),
|
191 |
+
'target' => '',
|
192 |
+
'width' => 2,
|
193 |
+
'height' => 2,
|
194 |
+
'filters' => ''
|
195 |
+
);
|
196 |
+
}
|
197 |
+
|
198 |
+
// Create Modula CPT
|
199 |
+
$modula_gallery_id = wp_insert_post(array(
|
200 |
+
'post_type' => 'modula-gallery',
|
201 |
+
'post_status' => 'publish',
|
202 |
+
'post_title' => sanitize_text_field($gallery->title),
|
203 |
+
));
|
204 |
+
|
205 |
+
// Attach meta modula-settings to Modula CPT
|
206 |
+
update_post_meta($modula_gallery_id, 'modula-settings', $modula_settings);
|
207 |
+
|
208 |
+
// Attach meta modula-images to Modula CPT
|
209 |
+
update_post_meta($modula_gallery_id, 'modula-images', $modula_images);
|
210 |
+
|
211 |
+
$nextgen_shortcode = '[ngg_images gallery_ids="' . $gallery_id . '"]';
|
212 |
+
$nextgen_shortcode_2 = '[ngg src="galleries" ids="' . $gallery_id . '" display="basic_thumbnail" thumbnail_crop="0"]';
|
213 |
+
$modula_shortcode = '[modula id="' . $modula_gallery_id . '"]';
|
214 |
+
|
215 |
+
// Replace NextGEN shortcode with Modula Shortcode in Posts, Pages and CPTs
|
216 |
+
$sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content, '%s', '%s')",
|
217 |
+
$nextgen_shortcode, $modula_shortcode);
|
218 |
+
$sql_2 = $wpdb->prepare("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content, '%s', '%s')",
|
219 |
+
$nextgen_shortcode_2, $modula_shortcode);
|
220 |
+
$wpdb->query($sql);
|
221 |
+
$wpdb->query($sql_2);
|
222 |
+
|
223 |
+
//@todo : gutenberg block replacement functionality
|
224 |
+
/*$sql_gutenberg = "SELECT * FROM " . $wpdb->prefix . "posts WHERE `post_content` LIKE '%wp:imagely/nextgen-gallery%'";
|
225 |
+
$galleries_gutenberg = $wpdb->get_results($sql_gutenberg);
|
226 |
+
|
227 |
+
if(count($galleries_gutenberg) > 0){
|
228 |
+
foreach($galleries_gutenberg as $gutenberg){
|
229 |
+
$content = $gutenberg->post_content;
|
230 |
+
$search_string = '/ids\s*=\s*\"([\s\S]*?)\"/';
|
231 |
+
$pattern = '/<!-- wp:imagely/nextgen-gallery -->\s*\[\s*ngg\s*ids\s*=\s*\"([\s\S]*?)\"/';
|
232 |
+
$result = preg_match_all($pattern, $content, $matches);
|
233 |
+
var_dump($content,$result);die();
|
234 |
+
if ( $result && $result > 0 ) {
|
235 |
+
var_dump($matches[0]);die();
|
236 |
+
foreach ( $matches[0] as $sc ) {
|
237 |
+
}
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
}*/
|
242 |
+
|
243 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
244 |
+
$this->clean_entries($gallery_id);
|
245 |
+
}
|
246 |
+
$this->modula_import_result(true, wp_kses_post('<i class="imported-check dashicons dashicons-yes"></i>'),$modula_gallery_id);
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Update imported galleries
|
251 |
+
*
|
252 |
+
*
|
253 |
+
* @since 2.2.7
|
254 |
+
*/
|
255 |
+
public function update_imported() {
|
256 |
+
|
257 |
+
check_ajax_referer('modula-importer', 'nonce');
|
258 |
+
$galleries = $_POST['galleries'];
|
259 |
+
$importer_settings = get_option('modula_importer');
|
260 |
+
|
261 |
+
if(!is_array($importer_settings)){
|
262 |
+
$importer_settings = array();
|
263 |
+
}
|
264 |
+
|
265 |
+
if (!isset($importer_settings['galleries']['nextgen'])) {
|
266 |
+
$importer_settings['galleries']['nextgen'] = array();
|
267 |
+
}
|
268 |
+
|
269 |
+
if ( is_array( $galleries ) && count( $galleries ) > 0 ) {
|
270 |
+
foreach ( $galleries as $key => $value ) {
|
271 |
+
$importer_settings['galleries']['nextgen'][ absint($key) ] = absint($value);
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
update_option('modula_importer', $importer_settings);
|
276 |
+
|
277 |
+
// Set url if migration complete
|
278 |
+
$url = admin_url('edit.php?post_type=modula-gallery&page=modula&modula-tab=importer&migration=complete');
|
279 |
+
|
280 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
281 |
+
// Set url if migration and cleaning complete
|
282 |
+
$url = admin_url('edit.php?post_type=modula-gallery&page=modula&modula-tab=importer&migration=complete&delete=complete');
|
283 |
+
}
|
284 |
+
|
285 |
+
echo $url;
|
286 |
+
wp_die();
|
287 |
+
}
|
288 |
+
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Add image to library
|
292 |
+
*
|
293 |
+
* @param $source_path
|
294 |
+
* @param $source_file
|
295 |
+
* @param $description
|
296 |
+
* @param $alt
|
297 |
+
* @return mixed
|
298 |
+
*
|
299 |
+
* @since 2.2.7
|
300 |
+
*/
|
301 |
+
public function add_image_to_library($source_path, $source_file, $description, $alt) {
|
302 |
+
|
303 |
+
global $wpdb;
|
304 |
+
$sql = $wpdb->prepare(
|
305 |
+
"SELECT * FROM $wpdb->posts WHERE guid LIKE %s",
|
306 |
+
'%/'.$source_file
|
307 |
+
);
|
308 |
+
|
309 |
+
$queried = $wpdb->get_results( $sql );
|
310 |
+
|
311 |
+
if (count($queried) > 0) {
|
312 |
+
return array(
|
313 |
+
'ID' => $queried[0]->ID,
|
314 |
+
'title' => $queried[0]->post_title,
|
315 |
+
'alt' => get_post_meta($queried[0]->ID, '_wp_attachment_image_alt', true),
|
316 |
+
'caption' => $queried[0]->post_content
|
317 |
+
);
|
318 |
+
}
|
319 |
+
|
320 |
+
// Get full path and filename
|
321 |
+
$source_file_path = ABSPATH . $source_path . '/' . $source_file;
|
322 |
+
|
323 |
+
// Get WP upload dir
|
324 |
+
$uploadDir = wp_upload_dir();
|
325 |
+
|
326 |
+
// Create destination file paths and URLs
|
327 |
+
$destination_file = wp_unique_filename($uploadDir['path'], $source_file);
|
328 |
+
$destination_file_path = $uploadDir['path'] . '/' . $destination_file;
|
329 |
+
$destination_url = $uploadDir['url'] . '/' . $destination_file;
|
330 |
+
|
331 |
+
// Check file is valid
|
332 |
+
$wp_filetype = wp_check_filetype($source_file, null);
|
333 |
+
extract($wp_filetype);
|
334 |
+
|
335 |
+
if ((!$type || !$ext) && !current_user_can('unfiltered_upload')) {
|
336 |
+
return false;
|
337 |
+
}
|
338 |
+
|
339 |
+
$result = copy($source_file_path, $destination_file_path);
|
340 |
+
|
341 |
+
if (!$result) {
|
342 |
+
|
343 |
+
return false;
|
344 |
+
}
|
345 |
+
|
346 |
+
// Set file permissions
|
347 |
+
$stat = stat($destination_file_path);
|
348 |
+
$perms = $stat['mode'] & 0000666;
|
349 |
+
chmod($destination_file_path, $perms);
|
350 |
+
|
351 |
+
// Apply upload filters
|
352 |
+
$return = apply_filters('wp_handle_upload', array(
|
353 |
+
'file' => $destination_file_path,
|
354 |
+
'url' => $destination_url,
|
355 |
+
'type' => $type,
|
356 |
+
));
|
357 |
+
|
358 |
+
// Construct the attachment array
|
359 |
+
$attachment = array(
|
360 |
+
'post_mime_type' => sanitize_text_field($type),
|
361 |
+
'guid' => esc_url_raw($destination_url),
|
362 |
+
'post_title' => sanitize_text_field($alt),
|
363 |
+
'post_name' => sanitize_text_field($alt),
|
364 |
+
'post_content' => wp_filter_post_kses($description),
|
365 |
+
);
|
366 |
+
|
367 |
+
// Save as attachment
|
368 |
+
$attachmentID = wp_insert_attachment($attachment, $destination_file_path);
|
369 |
+
|
370 |
+
// Update attachment metadata
|
371 |
+
if (!is_wp_error($attachmentID)) {
|
372 |
+
$metadata = wp_generate_attachment_metadata($attachmentID, $destination_file_path);
|
373 |
+
wp_update_attachment_metadata($attachmentID, wp_generate_attachment_metadata($attachmentID, $destination_file_path));
|
374 |
+
}
|
375 |
+
|
376 |
+
update_post_meta($attachmentID, '_wp_attachment_image_alt', $alt);
|
377 |
+
$attachment = get_post($attachmentID);
|
378 |
+
$attachment->post_excerpt = $description;
|
379 |
+
wp_update_post($attachment);
|
380 |
+
|
381 |
+
// Return attachment data
|
382 |
+
return array(
|
383 |
+
'ID' => $attachmentID,
|
384 |
+
'src' => $destination_url,
|
385 |
+
'title' => $alt,
|
386 |
+
'alt' => $alt,
|
387 |
+
'caption' => $description,
|
388 |
+
);
|
389 |
+
|
390 |
+
}
|
391 |
+
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Returns result
|
395 |
+
*
|
396 |
+
* @param $success
|
397 |
+
* @param $message
|
398 |
+
* @param $modula_gallery_id
|
399 |
+
*
|
400 |
+
* @since 2.2.7
|
401 |
+
*/
|
402 |
+
public function modula_import_result( $success, $message, $modula_gallery_id = false ) {
|
403 |
+
echo json_encode( array(
|
404 |
+
'success' => (bool)$success,
|
405 |
+
'message' => (string)$message,
|
406 |
+
'modula_gallery_id' => $modula_gallery_id
|
407 |
+
) );
|
408 |
+
die;
|
409 |
+
}
|
410 |
+
|
411 |
+
|
412 |
+
/**
|
413 |
+
* Returns the singleton instance of the class.
|
414 |
+
*
|
415 |
+
* @since 2.2.7
|
416 |
+
*/
|
417 |
+
public static function get_instance() {
|
418 |
+
|
419 |
+
if (!isset(self::$instance) && !(self::$instance instanceof Modula_Nextgen_Importer)) {
|
420 |
+
self::$instance = new Modula_Nextgen_Importer();
|
421 |
+
}
|
422 |
+
|
423 |
+
return self::$instance;
|
424 |
+
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Delete old entries from database
|
429 |
+
*
|
430 |
+
* @param $gallery_id
|
431 |
+
*
|
432 |
+
* @since 2.2.7
|
433 |
+
*/
|
434 |
+
public function clean_entries($gallery_id){
|
435 |
+
global $wpdb;
|
436 |
+
$sql = $wpdb->prepare( "DELETE FROM ".$wpdb->prefix ."ngg_gallery WHERE gid = $gallery_id" );
|
437 |
+
$sql_meta = $wpdb->prepare( "DELETE FROM ".$wpdb->prefix ."ngg_pictures WHERE galleryid = $gallery_id" );
|
438 |
+
$wpdb->query( $sql );
|
439 |
+
$wpdb->query( $sql_meta );
|
440 |
+
}
|
441 |
+
|
442 |
+
}
|
443 |
+
|
444 |
+
// Load the class.
|
445 |
+
$modula_nextgen_importer = Modula_Nextgen_Importer::get_instance();
|
includes/migrate/photoblocks/class-modula-photoblocks-importer.php
ADDED
@@ -0,0 +1,323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly.
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
class Modula_Photoblocks_Importer {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Holds the class object.
|
11 |
+
*
|
12 |
+
* @var object
|
13 |
+
*
|
14 |
+
* @since 2.2.7
|
15 |
+
*/
|
16 |
+
public static $instance;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Primary class constructor.
|
20 |
+
*
|
21 |
+
* @since 2.2.7
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
|
25 |
+
// Add AJAX
|
26 |
+
add_action('wp_ajax_modula_importer_photoblocks_gallery_import', array($this, 'photoblocks_gallery_import'));
|
27 |
+
add_action('wp_ajax_modula_importer_photoblocks_gallery_imported_update', array($this, 'update_imported'));
|
28 |
+
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Get all Gallery PhotoBlocks galleries
|
33 |
+
*
|
34 |
+
* @return mixed
|
35 |
+
*
|
36 |
+
* @since 2.2.7
|
37 |
+
*/
|
38 |
+
public function get_galleries() {
|
39 |
+
|
40 |
+
global $wpdb;
|
41 |
+
$empty_galleries = array();
|
42 |
+
|
43 |
+
if(!$wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix . "photoblocks'")){
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
$galleries = $wpdb->get_results(" SELECT * FROM " . $wpdb->prefix . "photoblocks");
|
47 |
+
if (count($galleries) != 0) {
|
48 |
+
foreach ($galleries as $key => $gallery) {
|
49 |
+
$count = $this->images_count($gallery->id);
|
50 |
+
|
51 |
+
if ($count == 0) {
|
52 |
+
unset($galleries[$key]);
|
53 |
+
$empty_galleries[$key] = $gallery;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
if (count($galleries) != 0) {
|
58 |
+
$return_galleries['valid_galleries'] = $galleries;
|
59 |
+
}
|
60 |
+
if (count($empty_galleries) != 0) {
|
61 |
+
$return_galleries['empty_galleries'] = $empty_galleries;
|
62 |
+
}
|
63 |
+
|
64 |
+
if (count($return_galleries) != 0) {
|
65 |
+
return $return_galleries;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
return false;
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Get gallery image count
|
75 |
+
*
|
76 |
+
* @param $id
|
77 |
+
* @return int
|
78 |
+
*
|
79 |
+
* @since 2.2.7
|
80 |
+
*/
|
81 |
+
public function images_count($id){
|
82 |
+
global $wpdb;
|
83 |
+
|
84 |
+
$sql = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "photoblocks
|
85 |
+
WHERE id = %d LIMIT 1",
|
86 |
+
$id);
|
87 |
+
$gallery = $wpdb->get_row($sql);
|
88 |
+
$blocks = json_decode($gallery->blocks);
|
89 |
+
$count = count($blocks);
|
90 |
+
|
91 |
+
return $count;
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Imports a gallery from PhotoBlocks to Modula
|
97 |
+
*
|
98 |
+
* @since 2.2.7
|
99 |
+
*/
|
100 |
+
public function photoblocks_gallery_import($gallery_id = '') {
|
101 |
+
|
102 |
+
global $wpdb;
|
103 |
+
$modula_importer = Modula_Importer::get_instance();
|
104 |
+
|
105 |
+
// Set max execution time so we don't timeout
|
106 |
+
ini_set('max_execution_time', 0);
|
107 |
+
set_time_limit(0);
|
108 |
+
|
109 |
+
// If no gallery ID, get from AJAX request
|
110 |
+
if (empty($gallery_id)) {
|
111 |
+
|
112 |
+
// Run a security check first.
|
113 |
+
check_ajax_referer('modula-importer', 'nonce');
|
114 |
+
|
115 |
+
if (!isset($_POST['id'])) {
|
116 |
+
$this->modula_import_result(false, esc_html__('No gallery was selected', 'modula-best-grid-gallery'),false);
|
117 |
+
}
|
118 |
+
|
119 |
+
$gallery_id = absint($_POST['id']);
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
$imported_galleries = get_option( 'modula_importer' );
|
124 |
+
// If already migrated don't migrate
|
125 |
+
if ( isset( $imported_galleries['galleries']['photoblocks'][ $gallery_id ] ) ) {
|
126 |
+
|
127 |
+
$modula_gallery = get_post_type( $imported_galleries['galleries']['photoblocks'][ $gallery_id ] );
|
128 |
+
|
129 |
+
if ( 'modula-gallery' == $modula_gallery ) {
|
130 |
+
// Trigger delete function if option is set to delete
|
131 |
+
if ( isset($_POST['clean']) && 'delete' == $_POST['clean'] ) {
|
132 |
+
$this->clean_entries( $gallery_id );
|
133 |
+
}
|
134 |
+
$this->modula_import_result( false, esc_html__( 'Gallery already migrated!', 'modula-best-grid-gallery' ), false );
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
$gallery = $modula_importer->prepare_images('photoblocks',$gallery_id);
|
139 |
+
|
140 |
+
$gallery_blocks = json_decode($gallery->blocks);
|
141 |
+
$gallery_data = json_decode($gallery->data);
|
142 |
+
$images = array();
|
143 |
+
|
144 |
+
foreach ($gallery_blocks as $block) {
|
145 |
+
|
146 |
+
if (NULL != $block->image->id) {
|
147 |
+
|
148 |
+
$images[] = array(
|
149 |
+
'id' => $block->image->id,
|
150 |
+
'description' => ( NULL != $block->caption->description->text ) ? $block->caption->description->text : '',
|
151 |
+
'title' => ( NULL != $block->caption->title->text ) ? $block->caption->title->text : '',
|
152 |
+
'alt' => ( NULL != $block->image->alt ) ? $block->image->alt : '',
|
153 |
+
'link' => ( NULL != $block->click->link ) ? $block->click->link : '',
|
154 |
+
'target' => ( NULL != $block->click->target && '_blank' == $block->click->target ) ? 1 : 0,
|
155 |
+
'width' => ( NULL != $block->geometry->colspan ) ? 3 * absint( $block->geometry->colspan ) : 1,
|
156 |
+
'height' => ( NULL != $block->geometry->rowspan ) ? 3 * absint( $block->geometry->rowspan ) : 1
|
157 |
+
|
158 |
+
);
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
// Build Modula Gallery modula-images metadata
|
163 |
+
$modula_images = array();
|
164 |
+
if (is_array($images) && count($images) > 0) {
|
165 |
+
// Add each image to Media Library
|
166 |
+
foreach ($images as $image) {
|
167 |
+
$image_src = wp_get_attachment_image_src($image['id'],'full');
|
168 |
+
$modula_images[] = array(
|
169 |
+
'id' => absint($image['id']),
|
170 |
+
'alt' => sanitize_text_field($image['alt']),
|
171 |
+
'title' => sanitize_text_field($image['title']),
|
172 |
+
'description' => wp_filter_post_kses($image['description']),
|
173 |
+
'halign' => 'center',
|
174 |
+
'valign' => 'middle',
|
175 |
+
'link' => esc_url_raw($image['link']),
|
176 |
+
'target' => absint($image['target']),
|
177 |
+
'width' => absint($image['width']),
|
178 |
+
'height' => absint($image['height']),
|
179 |
+
'filters' => ''
|
180 |
+
);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
if (count($modula_images) == 0) {
|
185 |
+
// Trigger delete function if option is set to delete
|
186 |
+
if(isset($_POST['clean']) && 'delete' == $_POST['clean']){
|
187 |
+
$this->clean_entries($gallery_id);
|
188 |
+
}
|
189 |
+
$this->modula_import_result(false, esc_html__('No images found in gallery. Skipping gallery...', 'modula-best-grid-gallery'),false);
|
190 |
+
}
|
191 |
+
|
192 |
+
// Get Modula Gallery defaults, used to set modula-settings metadata
|
193 |
+
$default_modula_settings = Modula_CPT_Fields_Helper::get_defaults();
|
194 |
+
|
195 |
+
$modula_settings = array(
|
196 |
+
'type' => 'custom-grid',
|
197 |
+
);
|
198 |
+
|
199 |
+
$modula_settings = wp_parse_args( $modula_settings, $default_modula_settings );
|
200 |
+
|
201 |
+
// Create Modula CPT
|
202 |
+
$modula_gallery_id = wp_insert_post(array(
|
203 |
+
'post_type' => 'modula-gallery',
|
204 |
+
'post_status' => 'publish',
|
205 |
+
'post_title' => sanitize_text_field($gallery_data->name),
|
206 |
+
));
|
207 |
+
|
208 |
+
|
209 |
+
// Attach meta modula-settings to Modula CPT
|
210 |
+
update_post_meta($modula_gallery_id, 'modula-settings', $modula_settings);
|
211 |
+
|
212 |
+
// Attach meta modula-images to Modula CPT
|
213 |
+
update_post_meta($modula_gallery_id, 'modula-images', $modula_images);
|
214 |
+
|
215 |
+
$ftg_shortcode = '[photoblocks id=' . $gallery_id . ']';
|
216 |
+
$modula_shortcode = '[modula id="' . $modula_gallery_id . '"]';
|
217 |
+
|
218 |
+
// Replace Gallery PhotoBlocks shortcode with Modula Shortcode in Posts, Pages and CPTs
|
219 |
+
$sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content, '%s', '%s')",
|
220 |
+
$ftg_shortcode, $modula_shortcode);
|
221 |
+
$wpdb->query($sql);
|
222 |
+
|
223 |
+
if($_POST['clean'] && 'delete' == $_POST['clean']){
|
224 |
+
$this->clean_entries($gallery_id);
|
225 |
+
}
|
226 |
+
|
227 |
+
$this->modula_import_result(true, wp_kses_post('<i class="imported-check dashicons dashicons-yes"></i>'),$modula_gallery_id);
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Update imported galleries
|
232 |
+
*
|
233 |
+
*
|
234 |
+
* @since 2.2.7
|
235 |
+
*/
|
236 |
+
public function update_imported() {
|
237 |
+
|
238 |
+
check_ajax_referer('modula-importer', 'nonce');
|
239 |
+
|
240 |
+
$galleries = $_POST['galleries'];
|
241 |
+
$importer_settings = get_option('modula_importer');
|
242 |
+
|
243 |
+
if(!is_array($importer_settings)){
|
244 |
+
$importer_settings = array();
|
245 |
+
}
|
246 |
+
|
247 |
+
if (!isset($importer_settings['galleries']['photoblocks'])) {
|
248 |
+
$importer_settings['galleries']['photoblocks'] = array();
|
249 |
+
}
|
250 |
+
|
251 |
+
if ( is_array( $galleries ) && count( $galleries ) > 0 ) {
|
252 |
+
foreach ( $galleries as $key => $value ) {
|
253 |
+
$importer_settings['galleries']['photoblocks'][ absint($key) ] = absint($value);
|
254 |
+
}
|
255 |
+
}
|
256 |
+
// Remember that this gallery has been imported
|
257 |
+
update_option('modula_importer', $importer_settings);
|
258 |
+
|
259 |
+
// Set url for migration complete
|
260 |
+
$url = admin_url('edit.php?post_type=modula-gallery&page=modula&modula-tab=importer&migration=complete');
|
261 |
+
|
262 |
+
if($_POST['clean'] && 'delete' == $_POST['clean']){
|
263 |
+
// Set url for migration and cleaning complete
|
264 |
+
$url = admin_url('edit.php?post_type=modula-gallery&page=modula&modula-tab=importer&migration=complete&delete=complete');
|
265 |
+
}
|
266 |
+
|
267 |
+
echo $url;
|
268 |
+
wp_die();
|
269 |
+
}
|
270 |
+
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Returns result
|
274 |
+
*
|
275 |
+
* @param $success
|
276 |
+
* @param $message
|
277 |
+
* @param bool $modula_gallery_id
|
278 |
+
*
|
279 |
+
* @since 2.2.7
|
280 |
+
*/
|
281 |
+
public function modula_import_result($success, $message, $modula_gallery_id = false) {
|
282 |
+
echo json_encode(array(
|
283 |
+
'success' => (bool)$success,
|
284 |
+
'message' => (string)$message,
|
285 |
+
'modula_gallery_id' => $modula_gallery_id
|
286 |
+
));
|
287 |
+
die;
|
288 |
+
}
|
289 |
+
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Returns the singleton instance of the class.
|
293 |
+
*
|
294 |
+
* @since 2.2.7
|
295 |
+
*/
|
296 |
+
public static function get_instance() {
|
297 |
+
|
298 |
+
if (!isset(self::$instance) && !(self::$instance instanceof Modula_Photoblocks_Importer)) {
|
299 |
+
self::$instance = new Modula_Photoblocks_Importer();
|
300 |
+
}
|
301 |
+
|
302 |
+
return self::$instance;
|
303 |
+
|
304 |
+
}
|
305 |
+
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Delete old entries from database
|
309 |
+
*
|
310 |
+
* @param $gallery_id
|
311 |
+
*
|
312 |
+
* @since 2.2.7
|
313 |
+
*/
|
314 |
+
public function clean_entries($gallery_id){
|
315 |
+
global $wpdb;
|
316 |
+
$sql = $wpdb->prepare( "DELETE FROM ".$wpdb->prefix ."photoblocks WHERE id = $gallery_id" );
|
317 |
+
$wpdb->query( $sql );
|
318 |
+
}
|
319 |
+
|
320 |
+
}
|
321 |
+
|
322 |
+
// Load the class.
|
323 |
+
$modula_photoblocks_importer = Modula_Photoblocks_Importer::get_instance();
|
includes/migrate/tabs/modula-importer-tab.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly.
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
// Assume everything is false.
|
8 |
+
$sources = false;
|
9 |
+
$galleries = false;
|
10 |
+
|
11 |
+
$migrate = isset($_GET['migration']) ? $_GET['migration'] : false;
|
12 |
+
$delete = isset($_GET['delete']) ? $_GET['delete'] : false;
|
13 |
+
|
14 |
+
$modula_importer = Modula_Importer::get_instance();
|
15 |
+
$sources = $modula_importer->get_sources();
|
16 |
+
|
17 |
+
$sources = apply_filters('modula_importable_galleries', $sources);
|
18 |
+
?>
|
19 |
+
|
20 |
+
<div class="row">
|
21 |
+
<table class="form-table">
|
22 |
+
<tbody>
|
23 |
+
<tr valign="top">
|
24 |
+
<th scope="row" valign="top">
|
25 |
+
<?php esc_html_e('Gallery source', 'modula-best-grid-gallery'); ?>
|
26 |
+
<div class="tab-header-tooltip-container modula-tooltip"><span>[?]</span>
|
27 |
+
<div class="tab-header-description modula-tooltip-content">
|
28 |
+
<?php esc_html_e('Select from which source would you like to migrate the gallery.', 'modula-best-grid-gallery') ?>
|
29 |
+
<?php esc_html_e('Migrating galleries will also replace the shortcode of the gallery with the new Modula shortcode in pages and posts.', 'modula-best-grid-gallery') ?>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
</th>
|
33 |
+
<td>
|
34 |
+
<select name="modula_select_gallery_source" id="modula_select_gallery_source">
|
35 |
+
<option value="none"><?php echo ($sources && count($sources) > 0) ? esc_html('Select gallery source', 'modula-best-grid-gallery') : esc_html('No galleries detected', 'modula-best-grid-gallery'); ?></option>
|
36 |
+
<?php
|
37 |
+
if ($sources) {
|
38 |
+
foreach ($sources as $source => $label) {
|
39 |
+
echo '<option value="' . esc_attr($source) . '"> ' . esc_html($label) . '</option>';
|
40 |
+
}
|
41 |
+
}
|
42 |
+
?>
|
43 |
+
</select>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
</tbody>
|
47 |
+
</table>
|
48 |
+
</div>
|
49 |
+
<!-- Select all checkbox-->
|
50 |
+
<div class="row select-all-wrapper hide">
|
51 |
+
<table class="form-table">
|
52 |
+
<tbody>
|
53 |
+
<tr valign="top">
|
54 |
+
<th scope="row" valign="top">
|
55 |
+
<?php echo esc_html__('Gallery database entries.', 'modula-best-grid-gallery'); ?>
|
56 |
+
<div class="tab-header-tooltip-container modula-tooltip"><span>[?]</span>
|
57 |
+
<div class="tab-header-description modula-tooltip-content">
|
58 |
+
<?php esc_html_e('Check this if you want to delete remnants or data entries in the database from the migrated galleries.', 'modula-best-grid-gallery') ?>
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
</th>
|
62 |
+
<td>
|
63 |
+
<div>
|
64 |
+
<label for="delete-old-entries"
|
65 |
+
data-id="delete-old-entries" >
|
66 |
+
<input type="checkbox" name="delete-old-entries"
|
67 |
+
id="delete-old-entries"
|
68 |
+
value="" />
|
69 |
+
<?php echo esc_html__('Delete old gallery entries.', 'modula-best-grid-gallery'); ?>
|
70 |
+
</label>
|
71 |
+
</div>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
</tbody>
|
75 |
+
</table>
|
76 |
+
</div>
|
77 |
+
<div class="update-complete">
|
78 |
+
<?php
|
79 |
+
if ($migrate && !$delete) {
|
80 |
+
echo '<h3>' . esc_html__('All done, good job! All galleries have been migrated.', 'modula-best-grid-gallery') . '</h3>';
|
81 |
+
}
|
82 |
+
|
83 |
+
if ($migrate && $delete) {
|
84 |
+
echo '<h3>' . esc_html__('All done, good job! All galleries have been migrated and old entries have been deleted.', 'modula-best-grid-gallery') . '</h3>';
|
85 |
+
}
|
86 |
+
|
87 |
+
?>
|
88 |
+
</div>
|
89 |
+
<?php
|
90 |
+
if ($sources) {
|
91 |
+
foreach ($sources as $source => $label) {
|
92 |
+
?>
|
93 |
+
|
94 |
+
<div id="modula-<?php echo esc_attr($source); ?>-importer" class="row modula-importer-row hide">
|
95 |
+
<div id="modula_importer_<?php echo esc_attr($source); ?>" class="modula-importer-wrapper" source="<?php echo esc_attr($source); ?>">
|
96 |
+
<table class="form-table">
|
97 |
+
<tbody>
|
98 |
+
<tr valign="top">
|
99 |
+
<th scope="row" valign="top">
|
100 |
+
<?php echo esc_html('Galleries to import', 'modula-best-grid-gallery'); ?>
|
101 |
+
</th>
|
102 |
+
<td>
|
103 |
+
<div class="modula-importer-checkbox-wrapper">
|
104 |
+
<a href="#select_all"
|
105 |
+
class="modula-all-selection"><?php esc_html_e( 'Select all', 'modula-best-grid-gallery' ); ?></a>
|
106 |
+
/ <a href="#deselect_all"
|
107 |
+
class="modula-all-selection"><?php esc_html_e( 'Deselect all', 'modula-best-grid-gallery' ); ?></a>
|
108 |
+
</div>
|
109 |
+
<div class="modula-found-galleries"></div>
|
110 |
+
</td>
|
111 |
+
</tr>
|
112 |
+
<tr valign="top">
|
113 |
+
<th scope="row" valign="top">
|
114 |
+
</th>
|
115 |
+
<td>
|
116 |
+
<div>
|
117 |
+
<?php
|
118 |
+
$upsell = '<div class="modula-importer-upsell-wrapper">';
|
119 |
+
$upsell .= esc_html__('By upgrading to the PRO version of Modula, you can remove the 20 images/gallery limit. Every PRO purchase includes several extensions.', 'modula-best-grid-gallery');
|
120 |
+
$upsell .= '<div class="modula-importer-upsell-buttons">';
|
121 |
+
$upsell .= '<a href="https://wp-modula.com/pricing/?utm_source=modula-lite&utm_campaign=litevspro#lite-vs-pro" class="button button-secondary" target="_blank">' . esc_html__('LITE vs PRO', 'modula-best-grid-gallery') . '</a>';
|
122 |
+
$upsell .= '<a href="https://wp-modula.com/pricing/?utm_source=modula-importer&utm_campaign=upsell" class="button button-primary" target="_blank">' . esc_html__('Upgrade to PRO', 'modula-best-grid-gallery') . '</a>';
|
123 |
+
$upsell .= '</div> </div>';
|
124 |
+
|
125 |
+
$upsell = apply_filters('modula_importer_upsells', $upsell);
|
126 |
+
|
127 |
+
echo $upsell;
|
128 |
+
?>
|
129 |
+
<?php submit_button(__('Migrate', 'modula-best-grid-gallery'), 'primary', 'modula-importer-submit-' . $source, false); ?>
|
130 |
+
</div>
|
131 |
+
</td>
|
132 |
+
</tr>
|
133 |
+
</tbody>
|
134 |
+
</table>
|
135 |
+
</div>
|
136 |
+
</div>
|
137 |
+
<?php
|
138 |
+
}
|
139 |
+
}
|
140 |
+
?>
|
includes/migrate/wp-core-gallery/class-modula-wp-core-gallery-importer.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly.
|
3 |
+
if (!defined('ABSPATH')) {
|
4 |
+
exit;
|
5 |
+
}
|
6 |
+
|
7 |
+
class Modula_WP_Core_Gallery_Importer {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Holds the class object.
|
11 |
+
*
|
12 |
+
* @var object
|
13 |
+
*
|
14 |
+
* @since 2.2.7
|
15 |
+
*/
|
16 |
+
public static $instance;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Primary class constructor.
|
20 |
+
*
|
21 |
+
* @since 2.2.7
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
|
25 |
+
// Add AJAX
|
26 |
+
add_action('wp_ajax_modula_importer_wp_core_gallery_import', array($this, 'wp_core_gallery_import'));
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Get all posts/pages that have wp core galleries
|
32 |
+
*
|
33 |
+
* @return mixed
|
34 |
+
*
|
35 |
+
* @since 2.2.7
|
36 |
+
*/
|
37 |
+
public function get_galleries() {
|
38 |
+
|
39 |
+
global $wpdb;
|
40 |
+
$empty_galleries = array();
|
41 |
+
|
42 |
+
$post_in = "'post','page'";
|
43 |
+
$post_types = get_post_types(array('show_in_menu' => true,'public'=>true));
|
44 |
+
|
45 |
+
foreach($post_types as $post_type){
|
46 |
+
// exclude previous set and attachment from sql query
|
47 |
+
if($post_type != 'post' && $post_type != 'page' && $post_type != 'attachment'){
|
48 |
+
$post_in .= ",'".$post_type."'";
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
$sql = "SELECT * FROM " . $wpdb->prefix . "posts WHERE `post_content` LIKE '%[galler%' AND `post_type` IN ($post_in)";
|
53 |
+
$galleries = $wpdb->get_results($sql);
|
54 |
+
|
55 |
+
if (count($galleries) != 0) {
|
56 |
+
$i = 1;
|
57 |
+
foreach($galleries as $gallery){
|
58 |
+
$content = $gallery->post_content;
|
59 |
+
$search_string = '[gallery';
|
60 |
+
$pattern = '/\\' . $search_string . '[\s\S]*?\]/';
|
61 |
+
$result = preg_match_all($pattern, $content, $matches);
|
62 |
+
|
63 |
+
if ( $result && $result > 0 ) {
|
64 |
+
foreach ( $matches[0] as $sc ) {
|
65 |
+
|
66 |
+
$pattern = '/ids\s*=\s*\"([\s\S]*?)\"/';
|
67 |
+
$result = preg_match( $pattern, $sc, $gallery_ids );
|
68 |
+
$images = ( $gallery_ids[1] && NULL != $gallery_ids[1] ) ? explode( ',', $gallery_ids[1] ) : false;
|
69 |
+
|
70 |
+
// if there are images we should build our array
|
71 |
+
if ( $images && count( $images ) != 0 ) {
|
72 |
+
// need all of these because multiple galleries can be found on 1 post type
|
73 |
+
$core_gal[ $i ]['title'] = '#' . $i . ' from ' . $gallery->post_title;
|
74 |
+
// need shortcode so that we can search only for that string when we replace/migrate
|
75 |
+
$core_gal[ $i ]['shortcode'] = $sc;
|
76 |
+
$core_gal[ $i ]['images'] = count( $images );
|
77 |
+
$core_gal[ $i ]['page_id'] = $gallery->ID;
|
78 |
+
// need gallery number to prevent double id and double selecting
|
79 |
+
$core_gal[ $i ]['gal_nr'] = $i;
|
80 |
+
}
|
81 |
+
$i++;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
if (count($core_gal) != 0) {
|
87 |
+
$return_galleries['valid_galleries'] = $core_gal;
|
88 |
+
}
|
89 |
+
|
90 |
+
if (count($return_galleries) != 0) {
|
91 |
+
return $return_galleries;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Replace WP Core gallery and create Modula gallery
|
102 |
+
*
|
103 |
+
* @param array $galery_atts
|
104 |
+
*
|
105 |
+
* @since 2.2.7
|
106 |
+
*/
|
107 |
+
public function wp_core_gallery_import($galery_atts = array()) {
|
108 |
+
|
109 |
+
global $wpdb;
|
110 |
+
$modula_importer = Modula_Importer::get_instance();
|
111 |
+
|
112 |
+
// Set max execution time so we don't timeout
|
113 |
+
ini_set('max_execution_time', 0);
|
114 |
+
set_time_limit(0);
|
115 |
+
|
116 |
+
// If no gallery ID, get from AJAX request
|
117 |
+
if (empty($galery_atts)) {
|
118 |
+
|
119 |
+
// Run a security check first.
|
120 |
+
check_ajax_referer('modula-importer', 'nonce');
|
121 |
+
|
122 |
+
if (!isset($_POST['id'])) {
|
123 |
+
$this->modula_import_result(false, esc_html__('No gallery was selected', 'modula-best-grid-gallery'));
|
124 |
+
}
|
125 |
+
|
126 |
+
// Need to make replace so we can search our shortcode in content
|
127 |
+
$galery_atts = str_replace('\"','"',$_POST['id']);
|
128 |
+
}
|
129 |
+
|
130 |
+
|
131 |
+
// Get page with gallery
|
132 |
+
$post = get_post($galery_atts['id']);
|
133 |
+
$content = $post->post_content;
|
134 |
+
$search_string = $galery_atts['shortcode'];
|
135 |
+
$result = preg_match_all($search_string, $content, $matches);
|
136 |
+
|
137 |
+
if ($result && $result > 0) {
|
138 |
+
|
139 |
+
foreach ($matches[0] as $sc) {
|
140 |
+
$modula_images = array();
|
141 |
+
$pattern = '/ids\s*=\s*\"([\s\S]*?)\"/';
|
142 |
+
$result = preg_match($pattern, $sc, $gallery_ids);
|
143 |
+
$image_ids = $modula_importer->prepare_images('wp_core',$gallery_ids[1]);
|
144 |
+
$gallery_image_ids = $gallery_ids[0];
|
145 |
+
|
146 |
+
foreach ($image_ids as $image) {
|
147 |
+
|
148 |
+
$img = get_post($image);
|
149 |
+
if ($img) {
|
150 |
+
// Build Modula Gallery modula-images metadata
|
151 |
+
$modula_images[] = array(
|
152 |
+
'id' => absint($image),
|
153 |
+
'alt' => sanitize_text_field(get_post_meta( $image, '_wp_attachment_image_alt', true )),
|
154 |
+
'title' => sanitize_text_field($img->post_title),
|
155 |
+
'description' => wp_filter_post_kses($img->post_content),
|
156 |
+
'halign' => 'center',
|
157 |
+
'valign' => 'middle',
|
158 |
+
'link' => esc_url_raw($img->guid),
|
159 |
+
'target' => '',
|
160 |
+
'width' => 2,
|
161 |
+
'height' => 2,
|
162 |
+
'filters' => ''
|
163 |
+
);
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
if (count($modula_images) == 0) {
|
168 |
+
$this->modula_import_result(false, esc_html__('No images found in gallery. Skipping gallery...', 'modula-best-grid-gallery'));
|
169 |
+
}
|
170 |
+
|
171 |
+
// Get Modula Gallery defaults, used to set modula-settings metadata
|
172 |
+
$modula_settings = Modula_CPT_Fields_Helper::get_defaults();
|
173 |
+
|
174 |
+
// Create Modula CPT
|
175 |
+
$modula_gallery_id = wp_insert_post(array(
|
176 |
+
'post_type' => 'modula-gallery',
|
177 |
+
'post_status' => 'publish',
|
178 |
+
'post_title' => sanitize_text_field($_POST['gallery_title']),
|
179 |
+
));
|
180 |
+
|
181 |
+
|
182 |
+
// Attach meta modula-settings to Modula CPT
|
183 |
+
update_post_meta($modula_gallery_id, 'modula-settings', $modula_settings);
|
184 |
+
|
185 |
+
// Attach meta modula-images to Modula CPT
|
186 |
+
update_post_meta($modula_gallery_id, 'modula-images', $modula_images);
|
187 |
+
|
188 |
+
$wp_core_shortcode = $galery_atts['shortcode'];
|
189 |
+
$modula_shortcode = '[modula id="' . $modula_gallery_id . '"]';
|
190 |
+
|
191 |
+
// Replace Gallery PhotoBlocks shortcode with Modula Shortcode in Posts, Pages and CPTs
|
192 |
+
$sql = $wpdb->prepare("UPDATE " . $wpdb->prefix . "posts SET post_content = REPLACE(post_content, '%s', '%s')",
|
193 |
+
$wp_core_shortcode, $modula_shortcode);
|
194 |
+
$wpdb->query($sql);
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
$this->modula_import_result(true, wp_kses_post('<i class="imported-check dashicons dashicons-yes"></i>'));
|
199 |
+
}
|
200 |
+
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Returns result
|
204 |
+
*
|
205 |
+
* @param $success
|
206 |
+
* @param $message
|
207 |
+
*
|
208 |
+
* @since 2.2.7
|
209 |
+
*/
|
210 |
+
public function modula_import_result($success, $message) {
|
211 |
+
echo json_encode(array(
|
212 |
+
'success' => (bool)$success,
|
213 |
+
'message' => (string)$message,
|
214 |
+
));
|
215 |
+
die;
|
216 |
+
}
|
217 |
+
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Returns the singleton instance of the class.
|
221 |
+
*
|
222 |
+
* @since 2.2.7
|
223 |
+
*/
|
224 |
+
public static function get_instance() {
|
225 |
+
|
226 |
+
if (!isset(self::$instance) && !(self::$instance instanceof Modula_WP_Core_Gallery_Importer)) {
|
227 |
+
self::$instance = new Modula_WP_Core_Gallery_Importer();
|
228 |
+
}
|
229 |
+
|
230 |
+
return self::$instance;
|
231 |
+
|
232 |
+
}
|
233 |
+
|
234 |
+
}
|
235 |
+
|
236 |
+
// Load the class.
|
237 |
+
$wp_core_importer = Modula_WP_Core_Gallery_Importer::get_instance();
|
includes/public/class-modula-shortcode.php
CHANGED
@@ -33,7 +33,7 @@ class Modula_Shortcode {
|
|
33 |
|
34 |
// Scripts necessary for some galleries
|
35 |
wp_register_script( 'modula-lightbox2', MODULA_URL . 'assets/js/lightbox.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
|
36 |
-
wp_register_script( 'packery', MODULA_URL . 'assets/js/packery.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
|
37 |
wp_register_script( 'modula-lazysizes', MODULA_URL . 'assets/js/lazysizes.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
|
38 |
|
39 |
// @todo: minify all css & js for a better optimization.
|
@@ -113,7 +113,7 @@ class Modula_Shortcode {
|
|
113 |
}
|
114 |
|
115 |
if ( 'custom-grid' == $type ) {
|
116 |
-
wp_enqueue_script( 'packery' );
|
117 |
}
|
118 |
|
119 |
if ( '1' == $settings['lazy_load'] ) {
|
@@ -162,7 +162,7 @@ class Modula_Shortcode {
|
|
162 |
// Gallery container attributes
|
163 |
'gallery_container' => array(
|
164 |
'id' => $gallery_id,
|
165 |
-
'class' =>
|
166 |
),
|
167 |
|
168 |
// Items container attributes
|
@@ -229,7 +229,7 @@ class Modula_Shortcode {
|
|
229 |
}
|
230 |
|
231 |
if ( $settings['socialIconSize'] ) {
|
232 |
-
$css .= "#{$gallery_id} .modula-item .jtg-social svg { height: " . absint($settings['socialIconSize']) . "px; width: " . absint( $settings['socialIconSize' ] ) . "px }";
|
233 |
}
|
234 |
|
235 |
if ( $settings['socialIconPadding'] ) {
|
@@ -264,7 +264,11 @@ class Modula_Shortcode {
|
|
264 |
$css .= "#{$gallery_id} .modula-items{height:" . absint( $settings['height'] ) . "px;}";
|
265 |
}
|
266 |
|
267 |
-
|
|
|
|
|
|
|
|
|
268 |
if ( '' != $settings['titleColor'] ) {
|
269 |
$css .= "#{$gallery_id} .modula-items .figc .jtg-title { color:" . Modula_Helper::sanitize_rgba_colour($settings['titleColor']) . "; }";
|
270 |
}else{
|
33 |
|
34 |
// Scripts necessary for some galleries
|
35 |
wp_register_script( 'modula-lightbox2', MODULA_URL . 'assets/js/lightbox.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
|
36 |
+
wp_register_script( 'modula-packery', MODULA_URL . 'assets/js/packery.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
|
37 |
wp_register_script( 'modula-lazysizes', MODULA_URL . 'assets/js/lazysizes.js', array( 'jquery' ), MODULA_LITE_VERSION, true );
|
38 |
|
39 |
// @todo: minify all css & js for a better optimization.
|
113 |
}
|
114 |
|
115 |
if ( 'custom-grid' == $type ) {
|
116 |
+
wp_enqueue_script( 'modula-packery' );
|
117 |
}
|
118 |
|
119 |
if ( '1' == $settings['lazy_load'] ) {
|
162 |
// Gallery container attributes
|
163 |
'gallery_container' => array(
|
164 |
'id' => $gallery_id,
|
165 |
+
'class' => apply_filters( 'modula_gallery_extra_classes', 'modula modula-gallery', $settings ),
|
166 |
),
|
167 |
|
168 |
// Items container attributes
|
229 |
}
|
230 |
|
231 |
if ( $settings['socialIconSize'] ) {
|
232 |
+
$css .= "#{$gallery_id} .modula-item .jtg-social svg { height: " . absint($settings['socialIconSize']) . "px; width: " . absint( $settings['socialIconSize' ] ) . "px; }";
|
233 |
}
|
234 |
|
235 |
if ( $settings['socialIconPadding'] ) {
|
264 |
$css .= "#{$gallery_id} .modula-items{height:" . absint( $settings['height'] ) . "px;}";
|
265 |
}
|
266 |
|
267 |
+
if ( '' != $settings['captionFontSize'] && 0 != $settings['captionFontSize'] ) {
|
268 |
+
$css .= "#{$gallery_id} .modula-items .figc p.description { font-size:" . absint($settings['captionFontSize']) . "px; }";
|
269 |
+
}
|
270 |
+
|
271 |
+
$css .= "#{$gallery_id} .modula-items .figc p.description { color:" . Modula_Helper::sanitize_rgba_colour($settings['captionColor']) . ";}";
|
272 |
if ( '' != $settings['titleColor'] ) {
|
273 |
$css .= "#{$gallery_id} .modula-items .figc .jtg-title { color:" . Modula_Helper::sanitize_rgba_colour($settings['titleColor']) . "; }";
|
274 |
}else{
|