Version Description
- Validated HTML markup
Download this release
Release Info
Developer | machothemes |
Plugin | ![]() |
Version | 1.3.2 |
Comparing to | |
See all releases |
Code changes from version 1.3.1 to 1.3.2
- Modula.php +1281 -1281
- README.txt +268 -265
- admin/add-gallery.php +121 -121
- admin/css/materialdesignicons.css +5107 -5107
- admin/css/materialize.css +5702 -5702
- admin/css/style.css +1481 -1481
- admin/edit-gallery.php +393 -393
- admin/fix.php +108 -108
- admin/font/material-design-icons/license.txt +95 -95
- admin/font/material-design-icons/materialdesignicons-webfont.eot +0 -0
- admin/font/material-design-icons/materialdesignicons-webfont.svg +3804 -3804
- admin/font/material-design-icons/materialdesignicons-webfont.ttf +0 -0
- admin/font/material-design-icons/materialdesignicons-webfont.woff +0 -0
- admin/font/material-design-icons/materialdesignicons-webfont.woff2 +0 -0
- admin/font/modula/modula-icons.svg +19 -19
- admin/font/roboto/Roboto-Bold-webfont.eot +0 -0
- admin/font/roboto/Roboto-Bold-webfont.svg +592 -592
- admin/font/roboto/Roboto-Bold-webfont.ttf +0 -0
- admin/font/roboto/Roboto-Bold-webfont.woff +0 -0
- admin/font/roboto/Roboto-Light-webfont.eot +0 -0
- admin/font/roboto/Roboto-Light-webfont.svg +640 -640
- admin/font/roboto/Roboto-Light-webfont.ttf +0 -0
- admin/font/roboto/Roboto-Light-webfont.woff +0 -0
- admin/font/roboto/Roboto-Regular-webfont.eot +0 -0
- admin/font/roboto/Roboto-Regular-webfont.svg +620 -620
- admin/font/roboto/Roboto-Regular-webfont.ttf +0 -0
- admin/font/roboto/Roboto-Regular-webfont.woff +0 -0
- admin/header.php +3 -3
- admin/import.php +81 -81
- admin/include/image-list.php +68 -68
- admin/include/tinymce-galleries.php +83 -83
- admin/overview.php +176 -176
- admin/scripts/editor-plugin.js +31 -31
- admin/scripts/materialize.js +10021 -10021
- admin/scripts/materialize.min.js +5 -5
- admin/scripts/modula-admin.js +1038 -1038
- admin/tutorial.php +9 -9
- admin/upgrade.php +29 -29
- admin/welcome-screen/assets/welcome.css +86 -86
- admin/welcome-screen/sections/comparison-table.php +90 -90
- admin/welcome-screen/sections/getting-started.php +133 -133
- lib/class-epsilon-plugin-request.php +224 -224
- lib/class-modula-feedback.php +251 -251
- lib/db-class.php +192 -192
- lib/gallery-class.php +368 -369
- lib/install-db.php +42 -42
- scripts/effects.css +124 -124
- scripts/jquery.modula.js +547 -547
- scripts/materialize.min.js +8 -8
- scripts/modula.css +167 -167
Modula.php
CHANGED
@@ -1,1281 +1,1281 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name:
|
4 |
-
* Plugin URI: https://wp-modula.com/
|
5 |
-
* Description: Modula is one of the best & most creative WordPress gallery plugins. Use it to create a great grid or
|
6 |
-
* masonry image gallery.
|
7 |
-
* Author: Macho Themes
|
8 |
-
* Version: 1.3.
|
9 |
-
* Author URI: https://www.machothemes.com/
|
10 |
-
*/
|
11 |
-
|
12 |
-
define( 'MODULA_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
|
13 |
-
define( 'MODULA_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
|
14 |
-
|
15 |
-
function modula_lite_create_db_tables() {
|
16 |
-
include_once( WP_PLUGIN_DIR . '/modula-best-grid-gallery/lib/install-db.php' );
|
17 |
-
modula_lite_install_db();
|
18 |
-
}
|
19 |
-
|
20 |
-
if ( ! class_exists( "ModulaLite" ) ) {
|
21 |
-
class ModulaLite {
|
22 |
-
|
23 |
-
private $loadedData;
|
24 |
-
private $fields = array();
|
25 |
-
|
26 |
-
private $version = "1.3.
|
27 |
-
|
28 |
-
private $defaultValues = array(
|
29 |
-
'width' => 100,
|
30 |
-
'height' => 800,
|
31 |
-
'img_size' => 500,
|
32 |
-
'margin' => 10,
|
33 |
-
'filters' => '',
|
34 |
-
'filterClick' => 'F',
|
35 |
-
'allFilterLabel' => 'All',
|
36 |
-
'lightbox' => 'lightbox2',
|
37 |
-
'shuffle' => 'F',
|
38 |
-
'captionColor' => '#ffffff',
|
39 |
-
'wp_field_caption' => 'caption',
|
40 |
-
'wp_field_title' => 'title',
|
41 |
-
'captionFontSize' => 14,
|
42 |
-
'titleFontSize' => 16,
|
43 |
-
'enableTwitter' => 'T',
|
44 |
-
'enableFacebook' => 'T',
|
45 |
-
'enableGplus' => 'T',
|
46 |
-
'enablePinterest' => 'T',
|
47 |
-
'socialIconColor' => '#ffffff',
|
48 |
-
'loadedScale' => 100,
|
49 |
-
'loadedRotate' => 0,
|
50 |
-
'loadedHSlide' => 0,
|
51 |
-
'loadedVSlide' => 0,
|
52 |
-
'borderSize' => 0,
|
53 |
-
'borderRadius' => 0,
|
54 |
-
'borderColor' => '#ffffff',
|
55 |
-
'shadowSize' => 0,
|
56 |
-
'shadowColor' => '#ffffff',
|
57 |
-
'style' => '',
|
58 |
-
'script' => '',
|
59 |
-
'randomFactor' => 50,
|
60 |
-
'hoverColor' => '#000000',
|
61 |
-
'hoverOpacity' => '50',
|
62 |
-
'hoverEffect' => 'pufrobo',
|
63 |
-
'hasResizedImages' => false,
|
64 |
-
'importedFrom' => '',
|
65 |
-
'hide_title' => false,
|
66 |
-
'hide_description' => false,
|
67 |
-
);
|
68 |
-
|
69 |
-
public function __construct() {
|
70 |
-
$this->plugin_name = plugin_basename( __FILE__ );
|
71 |
-
$this->plugin_url = plugins_url( '', __FILE__ );
|
72 |
-
$this->define_constants();
|
73 |
-
$this->define_db_tables();
|
74 |
-
$this->define_hover_effects();
|
75 |
-
$this->ModulaDB = $this->create_db_conn();
|
76 |
-
|
77 |
-
require_once 'lib/class-modula-feedback.php';
|
78 |
-
new Modula_Feedback( __FILE__ );
|
79 |
-
|
80 |
-
add_filter( 'widget_text', 'do_shortcode' );
|
81 |
-
add_filter( 'mce_buttons', array( $this, 'editor_button' ) );
|
82 |
-
add_filter( 'mce_external_plugins', array( $this, 'register_editor_plugin' ) );
|
83 |
-
|
84 |
-
add_action( 'init', array( $this, 'create_textdomain' ) );
|
85 |
-
|
86 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'add_gallery_scripts' ) );
|
87 |
-
|
88 |
-
add_action( 'admin_menu', array( $this, 'add_gallery_admin_menu' ) );
|
89 |
-
|
90 |
-
add_shortcode( 'Modula', array( $this, 'gallery_shortcode_handler' ) );
|
91 |
-
add_filter( 'the_content', array( $this, 'shortcode_empty_paragraph_fix' ), 99 );
|
92 |
-
|
93 |
-
add_action( 'wp_ajax_modula_save_gallery', array( $this, 'save_gallery' ) );
|
94 |
-
add_action( 'wp_ajax_modula_save_image', array( $this, 'save_image' ) );
|
95 |
-
add_action( 'wp_ajax_modula_add_image', array( $this, 'add_image' ) );
|
96 |
-
add_action( 'wp_ajax_modula_list_images', array( $this, 'list_images' ) );
|
97 |
-
add_action( 'wp_ajax_modula_sort_images', array( $this, 'sort_images' ) );
|
98 |
-
add_action( 'wp_ajax_modula_delete_image', array( $this, 'delete_image' ) );
|
99 |
-
add_action( 'wp_ajax_modula_resize_images', array( $this, 'resize_images' ) );
|
100 |
-
add_action( 'wp_ajax_modula_delete_gallery', array( $this, 'delete_gallery' ) );
|
101 |
-
add_action( 'wp_ajax_modula_clone_gallery', array( $this, 'clone_gallery' ) );
|
102 |
-
add_action( 'wp_ajax_modula_create_gallery', array( $this, 'create_gallery' ) );
|
103 |
-
add_action( 'wp_ajax_mtg_shortcode_editor', array( $this, 'mtg_shortcode_editor' ) );
|
104 |
-
add_action( 'wp_ajax_modula_get_config', array( $this, 'get_config' ) );
|
105 |
-
add_action( 'wp_ajax_modula_update_config', array( $this, 'update_config' ) );
|
106 |
-
add_action( 'wp_ajax_modula_get_ext_galleries', array( $this, 'get_ext_galleries' ) );
|
107 |
-
add_action( 'wp_ajax_modula_do_import_galleries', array( $this, 'do_import_galleries' ) );
|
108 |
-
|
109 |
-
add_filter( 'plugin_row_meta', array( $this, 'register_links' ), 10, 2 );
|
110 |
-
add_filter( 'admin_footer_text', array( $this, 'admin_footer' ), 1, 2 );
|
111 |
-
|
112 |
-
|
113 |
-
// Set fields
|
114 |
-
$this->fields[ __( 'General', 'modula-gallery' ) ] = array(
|
115 |
-
"icon" => "mdi mdi-settings",
|
116 |
-
"fields" => array(
|
117 |
-
"name" => array(
|
118 |
-
"name" => esc_html__( 'Name', 'modula-gallery' ),
|
119 |
-
"type" => "text",
|
120 |
-
"description" => esc_html__( 'Name of the gallery, for internal use.', 'modula-gallery' ),
|
121 |
-
"excludeFrom" => array(),
|
122 |
-
),
|
123 |
-
"description" => array(
|
124 |
-
"name" => esc_html__( 'Description', 'modula-gallery' ),
|
125 |
-
"type" => "text",
|
126 |
-
"description" => esc_html__( 'This description is for internal use.', 'modula-gallery' ),
|
127 |
-
"excludeFrom" => array(),
|
128 |
-
),
|
129 |
-
"width" => array(
|
130 |
-
"name" => esc_html__( 'Width', 'modula-gallery' ),
|
131 |
-
"type" => "text",
|
132 |
-
"description" => esc_html__( 'Width of the gallery (i.e.: 100% or 500px)', 'modula-gallery' ),
|
133 |
-
"mu" => "px or %",
|
134 |
-
"excludeFrom" => array(),
|
135 |
-
),
|
136 |
-
"height" => array(
|
137 |
-
"name" => esc_html__( 'Height', 'modula-gallery' ),
|
138 |
-
"type" => "number",
|
139 |
-
"description" => esc_html__( 'Height of the gallery in pixels', 'modula-gallery' ),
|
140 |
-
"mu" => "px",
|
141 |
-
"excludeFrom" => array(),
|
142 |
-
),
|
143 |
-
"img_size" => array(
|
144 |
-
"name" => esc_html__( 'Minimum image size', 'modula-gallery' ),
|
145 |
-
"type" => "number",
|
146 |
-
"description" => esc_html__( 'Minimum width or height of the images', 'modula-gallery' ),
|
147 |
-
"mu" => "px or %",
|
148 |
-
"excludeFrom" => array(),
|
149 |
-
),
|
150 |
-
"margin" => array(
|
151 |
-
"name" => esc_html__( 'Margin', 'modula-gallery' ),
|
152 |
-
"type" => "number",
|
153 |
-
"description" => esc_html__( 'Margin between images', 'modula-gallery' ),
|
154 |
-
"mu" => "px",
|
155 |
-
"excludeFrom" => array(),
|
156 |
-
),
|
157 |
-
"randomFactor" => array(
|
158 |
-
"name" => esc_html__( 'Random factor', 'modula-gallery' ),
|
159 |
-
"type" => "ui-slider",
|
160 |
-
"description" => "",
|
161 |
-
"min" => 0,
|
162 |
-
"max" => 100,
|
163 |
-
"mu" => "%",
|
164 |
-
"default" => 20,
|
165 |
-
"excludeFrom" => array(),
|
166 |
-
),
|
167 |
-
"filters" => array(
|
168 |
-
"name" => esc_html__( 'Filters', 'modula-gallery' ),
|
169 |
-
"type" => "PRO_FEATURE",
|
170 |
-
"description" => esc_html__( 'Add your own filters here. Each image can have one or more filters.', 'modula-gallery' ),
|
171 |
-
"excludeFrom" => array(),
|
172 |
-
),
|
173 |
-
"filterClick" => array(
|
174 |
-
"name" => esc_html__( 'Reload Page on filter click', 'modula-gallery' ),
|
175 |
-
"type" => "PRO_FEATURE",
|
176 |
-
"description" => esc_html__( 'Turn this feature ON if you want to use filters with most lightboxes', 'modula-gallery' ),
|
177 |
-
"excludeFrom" => array(),
|
178 |
-
),
|
179 |
-
"allFilterLabel" => array(
|
180 |
-
"name" => esc_html__( 'Text for "All" filter', 'modula-gallery' ),
|
181 |
-
"type" => "PRO_FEATURE",
|
182 |
-
"description" => esc_html__( 'Write here the label for the "All" filter', 'modula-gallery' ),
|
183 |
-
"default" => "All",
|
184 |
-
"excludeFrom" => array(),
|
185 |
-
),
|
186 |
-
"lightbox" => array(
|
187 |
-
"name" => esc_html__( 'Lightbox & Links', 'modula-gallery' ),
|
188 |
-
"type" => "select",
|
189 |
-
"description" => esc_html__( 'Define here what happens when user click on the images.', 'modula-gallery' ),
|
190 |
-
"values" => array(
|
191 |
-
"Link" => array(
|
192 |
-
"|" . esc_html__( 'No link', 'modula-gallery' ),
|
193 |
-
"direct|" . esc_html__( 'Direct link to image', 'modula-gallery' ),
|
194 |
-
"|" . esc_html__( 'Attachment page', 'modula-gallery' )
|
195 |
-
),
|
196 |
-
"Lightboxes" => array( "lightbox2|Lightbox" ),
|
197 |
-
),
|
198 |
-
"disabled" => array(
|
199 |
-
"Lightboxes with PRO license" => array(
|
200 |
-
"magnific|Magnific popup",
|
201 |
-
"prettyphoto|PrettyPhoto",
|
202 |
-
"fancybox|FancyBox",
|
203 |
-
"swipebox|SwipeBox",
|
204 |
-
"lightbox2|Lightbox",
|
205 |
-
),
|
206 |
-
),
|
207 |
-
"excludeFrom" => array(),
|
208 |
-
),
|
209 |
-
"shuffle" => array(
|
210 |
-
"name" => esc_html__( 'Shuffle images', 'modula-gallery' ),
|
211 |
-
"type" => "toggle",
|
212 |
-
"default" => "T",
|
213 |
-
"description" => esc_html__( 'Flag it if you want to shuffle the gallery at each page load', 'modula-gallery' ),
|
214 |
-
"excludeFrom" => array(),
|
215 |
-
),
|
216 |
-
),
|
217 |
-
);
|
218 |
-
$this->fields[ esc_html__( 'Captions', 'modula-gallery' ) ] = array(
|
219 |
-
"icon" => "mdi mdi-comment-text-outline",
|
220 |
-
"fields" => array(
|
221 |
-
"captionColor" => array(
|
222 |
-
"name" => esc_html__( 'Caption color', 'modula-gallery' ),
|
223 |
-
"type" => "color",
|
224 |
-
"description" => esc_html__( 'Color of the caption.', 'modula-gallery' ),
|
225 |
-
"default" => "#ffffff",
|
226 |
-
"excludeFrom" => array(),
|
227 |
-
),
|
228 |
-
"wp_field_caption" => array(
|
229 |
-
"name" => esc_html__( 'Populate caption from', 'modula-gallery' ),
|
230 |
-
"type" => "select",
|
231 |
-
"description" => __( '<strong>This field is used ONLY when images are added to the gallery. </strong> If you don\'t want to automatically populate the caption field select <i>Don\'t Populate</i>', 'modula-gallery' ),
|
232 |
-
"values" => array(
|
233 |
-
"Field" => array(
|
234 |
-
"none|" . esc_html__( 'Don\'t Populate', 'modula-gallery' ),
|
235 |
-
"title|" . esc_html__( 'WP Image title', 'modula-gallery' ),
|
236 |
-
"caption|" . esc_html__( 'WP Image caption', 'modula-gallery' ),
|
237 |
-
"description|" . esc_html__( 'WP Image description', 'modula-gallery' ),
|
238 |
-
),
|
239 |
-
),
|
240 |
-
"excludeFrom" => array( "shortcode" ),
|
241 |
-
),
|
242 |
-
"wp_field_title" => array(
|
243 |
-
"name" => esc_html__( 'Populate title from', 'modula-gallery' ),
|
244 |
-
"type" => "select",
|
245 |
-
"description" => __( '<strong>This field is used ONLY when images are added to the gallery. </strong> If you don\'t want to automatically populate the title field select <i>Don\'t Populate</i>', 'modula-gallery' ),
|
246 |
-
"values" => array(
|
247 |
-
"Field" => array(
|
248 |
-
"none|" . esc_html__( 'Don\'t Populate', 'modula-gallery' ),
|
249 |
-
"title|" . esc_html__( 'WP Image title', 'modula-gallery' ),
|
250 |
-
"description|" . esc_html__( 'WP Image description', 'modula-gallery' ),
|
251 |
-
),
|
252 |
-
),
|
253 |
-
"excludeFrom" => array( "shortcode" ),
|
254 |
-
),
|
255 |
-
"hide_title" => array(
|
256 |
-
"name" => esc_html__( 'Image Title', 'modula-gallery' ),
|
257 |
-
"type" => "toggle",
|
258 |
-
"default" => "T",
|
259 |
-
"description" => esc_html__( 'Hide image title from frontend', 'modula-gallery' ),
|
260 |
-
"excludeFrom" => array(),
|
261 |
-
),
|
262 |
-
"hide_description" => array(
|
263 |
-
"name" => esc_html__( 'Image Description', 'modula-gallery' ),
|
264 |
-
"type" => "toggle",
|
265 |
-
"default" => "T",
|
266 |
-
"description" => esc_html__( 'Hide image description from frontend', 'modula-gallery' ),
|
267 |
-
"excludeFrom" => array(),
|
268 |
-
),
|
269 |
-
"captionFontSize" => array(
|
270 |
-
"name" => esc_html__( 'Caption Font Size', 'modula-gallery' ),
|
271 |
-
"type" => "number",
|
272 |
-
"description" => "",
|
273 |
-
"mu" => "px",
|
274 |
-
"excludeFrom" => array(),
|
275 |
-
),
|
276 |
-
"titleFontSize" => array(
|
277 |
-
"name" => esc_html__( 'Title Font Size', 'modula-gallery' ),
|
278 |
-
"type" => "number",
|
279 |
-
"description" => "",
|
280 |
-
"mu" => "px",
|
281 |
-
"excludeFrom" => array(),
|
282 |
-
),
|
283 |
-
),
|
284 |
-
);
|
285 |
-
|
286 |
-
$this->fields[ esc_html__( 'Social', 'modula-gallery' ) ] = array(
|
287 |
-
"icon" => "mdi mdi-link-variant",
|
288 |
-
"fields" => array(
|
289 |
-
"enableTwitter" => array(
|
290 |
-
"name" => esc_html__( 'Add Twitter icon', 'modula-gallery' ),
|
291 |
-
"type" => "toggle",
|
292 |
-
"default" => "T",
|
293 |
-
"description" => esc_html__( 'Enable Twitter Sharing', 'modula-gallery' ),
|
294 |
-
"excludeFrom" => array(),
|
295 |
-
),
|
296 |
-
"enableFacebook" => array(
|
297 |
-
"name" => esc_html__( 'Add Facebook icon', 'modula-gallery' ),
|
298 |
-
"type" => "toggle",
|
299 |
-
"default" => "T",
|
300 |
-
"description" => esc_html__( 'Enable Facebook Sharing', 'modula-gallery' ),
|
301 |
-
"excludeFrom" => array(),
|
302 |
-
),
|
303 |
-
"enableGplus" => array(
|
304 |
-
"name" => esc_html__( 'Add Google Plus icon', 'modula-gallery' ),
|
305 |
-
"type" => "toggle",
|
306 |
-
"default" => "T",
|
307 |
-
"description" => esc_html__( 'Enable Google Plus Sharing', 'modula-gallery' ),
|
308 |
-
"excludeFrom" => array(),
|
309 |
-
),
|
310 |
-
"enablePinterest" => array(
|
311 |
-
"name" => esc_html__( 'Add Pinterest icon', 'modula-gallery' ),
|
312 |
-
"type" => "toggle",
|
313 |
-
"default" => "T",
|
314 |
-
"description" => esc_html__( 'Enable Pinterest Sharing', 'modula-gallery' ),
|
315 |
-
"excludeFrom" => array(),
|
316 |
-
),
|
317 |
-
"socialIconColor" => array(
|
318 |
-
"name" => esc_html__( 'Color of social sharing icons', 'modula-gallery' ),
|
319 |
-
"type" => "color",
|
320 |
-
"description" => esc_html__( 'Set the color of the social sharing icons', 'modula-gallery' ),
|
321 |
-
"default" => "#ffffff",
|
322 |
-
"excludeFrom" => array(),
|
323 |
-
),
|
324 |
-
),
|
325 |
-
|
326 |
-
);
|
327 |
-
$this->fields[ esc_html__( 'Image loaded effects', 'modula-gallery' ) ] = array(
|
328 |
-
"icon" => "mdi mdi-reload",
|
329 |
-
"fields" => array(
|
330 |
-
"loadedScale" => array(
|
331 |
-
"name" => esc_html__( 'Scale', 'modula-gallery' ),
|
332 |
-
"description" => esc_html__( 'Choose a value below 100% for a zoom-in effect. Choose a value over 100% for a zoom-out effect', 'modula-gallery' ),
|
333 |
-
"type" => "ui-slider",
|
334 |
-
"min" => 0,
|
335 |
-
"max" => 200,
|
336 |
-
"mu" => "%",
|
337 |
-
"default" => 100,
|
338 |
-
"excludeFrom" => array(),
|
339 |
-
),
|
340 |
-
"loadedRotate" => array(
|
341 |
-
"name" => esc_html__( 'Rotate', 'modula-gallery' ),
|
342 |
-
"description" => "",
|
343 |
-
"type" => "PRO_FEATURE",
|
344 |
-
"min" => - 180,
|
345 |
-
"max" => 180,
|
346 |
-
"default" => 0,
|
347 |
-
"mu" => "deg",
|
348 |
-
"excludeFrom" => array(),
|
349 |
-
),
|
350 |
-
"loadedHSlide" => array(
|
351 |
-
"name" => esc_html__( 'Horizontal slide', 'modula-gallery' ),
|
352 |
-
"description" => "",
|
353 |
-
"type" => "PRO_FEATURE",
|
354 |
-
"min" => - 100,
|
355 |
-
"max" => 100,
|
356 |
-
"mu" => "px",
|
357 |
-
"default" => 0,
|
358 |
-
"excludeFrom" => array(),
|
359 |
-
),
|
360 |
-
"loadedVSlide" => array(
|
361 |
-
"name" => esc_html__( 'Vertical slide', 'modula-gallery' ),
|
362 |
-
"description" => "",
|
363 |
-
"type" => "PRO_FEATURE",
|
364 |
-
"min" => - 100,
|
365 |
-
"max" => 100,
|
366 |
-
"mu" => "px",
|
367 |
-
"default" => 0,
|
368 |
-
"excludeFrom" => array(),
|
369 |
-
),
|
370 |
-
|
371 |
-
),
|
372 |
-
);
|
373 |
-
$this->fields[ esc_html__( 'Hover effect', 'modula-gallery' ) ] = array(
|
374 |
-
"icon" => "mdi mdi-blur",
|
375 |
-
"fields" => array(
|
376 |
-
"Effect" => array(
|
377 |
-
"name" => esc_html__( 'Effect', 'modula-gallery' ),
|
378 |
-
"description" => esc_html__( 'Select an hover effect', 'modula-gallery' ),
|
379 |
-
"type" => "hover-effect",
|
380 |
-
"excludeFrom" => array(),
|
381 |
-
),
|
382 |
-
),
|
383 |
-
);
|
384 |
-
$this->fields[ esc_html__( 'Style', 'modula-gallery' ) ] = array(
|
385 |
-
"icon" => "mdi mdi-format-paint",
|
386 |
-
"fields" => array(
|
387 |
-
"borderSize" => array(
|
388 |
-
"name" => esc_html__( 'Border Size', 'modula-gallery' ),
|
389 |
-
"type" => "ui-slider",
|
390 |
-
"description" => "",
|
391 |
-
"mu" => "px",
|
392 |
-
"min" => 0,
|
393 |
-
"max" => 10,
|
394 |
-
"default" => 0,
|
395 |
-
"excludeFrom" => array(),
|
396 |
-
),
|
397 |
-
"borderRadius" => array(
|
398 |
-
"name" => esc_html__( 'Border Radius', 'modula-gallery' ),
|
399 |
-
"type" => "ui-slider",
|
400 |
-
"description" => "",
|
401 |
-
"mu" => "px",
|
402 |
-
"min" => 0,
|
403 |
-
"max" => 100,
|
404 |
-
"default" => 0,
|
405 |
-
"excludeFrom" => array(),
|
406 |
-
),
|
407 |
-
"borderColor" => array(
|
408 |
-
"name" => esc_html__( 'Border Color', 'modula-gallery' ),
|
409 |
-
"type" => "color",
|
410 |
-
"description" => "",
|
411 |
-
"default" => "#ffffff",
|
412 |
-
"excludeFrom" => array(),
|
413 |
-
),
|
414 |
-
"shadowSize" => array(
|
415 |
-
"name" => esc_html__( 'Shadow Size', 'modula-gallery' ),
|
416 |
-
"type" => "ui-slider",
|
417 |
-
"description" => "",
|
418 |
-
"mu" => "px",
|
419 |
-
"min" => 0,
|
420 |
-
"max" => 20,
|
421 |
-
"default" => 0,
|
422 |
-
"excludeFrom" => array(),
|
423 |
-
),
|
424 |
-
"shadowColor" => array(
|
425 |
-
"name" => esc_html__( 'Shadow Color', 'modula-gallery' ),
|
426 |
-
"type" => "color",
|
427 |
-
"description" => "",
|
428 |
-
"default" => "#ffffff",
|
429 |
-
"excludeFrom" => array(),
|
430 |
-
),
|
431 |
-
|
432 |
-
),
|
433 |
-
);
|
434 |
-
$this->fields[ esc_html__( 'Customizations', 'modula-gallery' ) ] = array(
|
435 |
-
"icon" => "mdi mdi-puzzle",
|
436 |
-
"fields" => array(
|
437 |
-
"script" => array(
|
438 |
-
"name" => esc_html__( 'Custom scripts', 'modula-gallery' ),
|
439 |
-
"type" => "textarea",
|
440 |
-
"description" => esc_html__( 'This script will be called after the gallery initialization. Useful for custom lightboxes.', 'modula-gallery' ) . "
|
441 |
-
<br />
|
442 |
-
<br />
|
443 |
-
<strong>Write just the code without using the <script></script> tags</strong>",
|
444 |
-
"excludeFrom" => array( "shortcode" ),
|
445 |
-
),
|
446 |
-
"style" => array(
|
447 |
-
"name" => esc_html__( 'Custom css', 'modula-gallery' ),
|
448 |
-
"type" => "textarea",
|
449 |
-
"description" => '<strong>' . esc_html__( 'Write just the code without using the <style></style> tags', 'modula-gallery' ) . '</strong>',
|
450 |
-
"excludeFrom" => array( "shortcode" ),
|
451 |
-
),
|
452 |
-
),
|
453 |
-
);
|
454 |
-
|
455 |
-
}
|
456 |
-
|
457 |
-
//Define textdomain
|
458 |
-
public function create_textdomain() {
|
459 |
-
$plugin_dir = basename( dirname( __FILE__ ) );
|
460 |
-
load_plugin_textdomain( 'modula-gallery', false, $plugin_dir . '/lib/languages' );
|
461 |
-
}
|
462 |
-
|
463 |
-
function define_hover_effects() {
|
464 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'None', 'none', false, false, 0 );
|
465 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Pufrobo', 'pufrobo', true, true, 4 );
|
466 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Fluid Up', '', true, true, 0 );
|
467 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Hide', '', true, true, 4 );
|
468 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Quiet', '', true, false, 4 );
|
469 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Catinelle', '', false, false, 4 );
|
470 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Reflex', '', true, true, 4 );
|
471 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Curtain', '', true, false, 4 );
|
472 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Lens', '', true, true, 4 );
|
473 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Appear', '', true, false, 4 );
|
474 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Crafty', '', true, true, 0 );
|
475 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Seemo', '', true, false, 4 );
|
476 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Comodo', '', true, false, 4 );
|
477 |
-
}
|
478 |
-
|
479 |
-
public function get_ext_galleries() {
|
480 |
-
header( "Content-type: application/json" );
|
481 |
-
|
482 |
-
global $wpdb;
|
483 |
-
|
484 |
-
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
485 |
-
$res = array( "success" => 0 );
|
486 |
-
|
487 |
-
$source = $_POST['source'];
|
488 |
-
if ( $source ) {
|
489 |
-
$res['success'] = 1;
|
490 |
-
$res['galleries'] = array();
|
491 |
-
|
492 |
-
switch ( $source ) {
|
493 |
-
case 'Envira':
|
494 |
-
$galleries = get_posts( array(
|
495 |
-
'post_type' => 'envira',
|
496 |
-
'posts_per_page' => 1000,
|
497 |
-
) );
|
498 |
-
foreach ( $galleries as $g ) {
|
499 |
-
$item = array();
|
500 |
-
$item['id'] = $g->ID;
|
501 |
-
$item['title'] = $g->post_title;
|
502 |
-
$res['galleries'] [] = $item;
|
503 |
-
}
|
504 |
-
break;
|
505 |
-
case 'NextGen':
|
506 |
-
$galleries = $wpdb->get_results( "SELECT title, gid FROM $wpdb->nggallery" );
|
507 |
-
foreach ( $galleries as $g ) {
|
508 |
-
$item = array();
|
509 |
-
$item['id'] = $g->gid;
|
510 |
-
$item['title'] = $g->title;
|
511 |
-
$res['galleries'] [] = $item;
|
512 |
-
}
|
513 |
-
break;
|
514 |
-
}
|
515 |
-
}
|
516 |
-
|
517 |
-
echo json_encode( $res );
|
518 |
-
}
|
519 |
-
die();
|
520 |
-
}
|
521 |
-
|
522 |
-
public function admin_footer( $text ) {
|
523 |
-
global $current_screen;
|
524 |
-
if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'modula-lite' ) !== false ) {
|
525 |
-
$url = 'https://wordpress.org/support/plugin/modula-best-grid-gallery/reviews/?rate=5#new-post';
|
526 |
-
$text = sprintf( __( 'Please rate <strong>Modula Gallery</strong> <a href="%s" target="_blank">★★★★★</a> on <a href="%s" target="_blank">WordPress.org</a> to help us spread the word. Thank you, on behalf of the Modula team!', 'modula-gallery' ), $url, $url );
|
527 |
-
}
|
528 |
-
|
529 |
-
return $text;
|
530 |
-
}
|
531 |
-
|
532 |
-
public function do_import_galleries() {
|
533 |
-
global $wpdb;
|
534 |
-
|
535 |
-
header( "Content-type: application/json" );
|
536 |
-
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
537 |
-
$res = array( "success" => 0 );
|
538 |
-
$source = $_POST['source'];
|
539 |
-
$ids = explode( ",", $_POST['ids'] );
|
540 |
-
switch ( $source ) {
|
541 |
-
case 'Envira':
|
542 |
-
foreach ( $ids as $id ) {
|
543 |
-
$gallery = get_post( $id );
|
544 |
-
$meta = get_post_meta( $id );
|
545 |
-
$data = unserialize( $meta['_eg_gallery_data'][0] );
|
546 |
-
|
547 |
-
$g = array(
|
548 |
-
'name' => $data['config']['title'],
|
549 |
-
'description' => 'Imported from Envira (' . $id . ') on ' . date( 'M, d Y' ),
|
550 |
-
'margin' => $data['config']['gutter'],
|
551 |
-
'hasResizedImages' => true,
|
552 |
-
'importedFrom' => 'Envira',
|
553 |
-
);
|
554 |
-
$gdb = array_merge( $this->defaultValues, $g );
|
555 |
-
|
556 |
-
$saved = $this->ModulaDB->addGallery( $gdb );
|
557 |
-
$newId = $this->ModulaDB->getNewGalleryId();
|
558 |
-
|
559 |
-
if ( $newId && count( $data['gallery'] ) ) {
|
560 |
-
$images = array();
|
561 |
-
//TODO only active images
|
562 |
-
foreach ( $data['gallery'] as $item ) {
|
563 |
-
$toAdd = new stdClass();
|
564 |
-
$toAdd->imageId = $this->ModulaDB->getIDbyGUID( $item['src'] );
|
565 |
-
$toAdd->title = $item['title'];
|
566 |
-
$toAdd->description = $item['caption'];
|
567 |
-
$toAdd->imagePath = $item['src'];
|
568 |
-
|
569 |
-
$images [] = $toAdd;
|
570 |
-
}
|
571 |
-
$imgResult = $this->ModulaDB->addImages( $newId, $images );
|
572 |
-
}
|
573 |
-
}
|
574 |
-
$res['success'] = 1;
|
575 |
-
break;
|
576 |
-
case 'NextGen':
|
577 |
-
foreach ( $ids as $id ) {
|
578 |
-
$gallery = $wpdb->get_row( $wpdb->prepare( "SELECT title, gid, path FROM $wpdb->nggallery WHERE gid=%s", $id ) );
|
579 |
-
|
580 |
-
$dbimages = $wpdb->get_results( $wpdb->prepare( "SELECT filename, description, alttext FROM $wpdb->nggpictures WHERE exclude <> 1 AND galleryid=%s", $id ) );
|
581 |
-
|
582 |
-
$g = array(
|
583 |
-
'name' => $gallery->title,
|
584 |
-
'description' => 'Imported from NextGet (' . $id . ') on ' . date( 'M, d Y' ),
|
585 |
-
'hasResizedImages' => true,
|
586 |
-
'importedFrom' => 'NextGen',
|
587 |
-
);
|
588 |
-
$gdb = array_merge( $this->defaultValues, $g );
|
589 |
-
|
590 |
-
$saved = $this->ModulaDB->addGallery( $gdb );
|
591 |
-
$newId = $this->ModulaDB->getNewGalleryId();
|
592 |
-
|
593 |
-
if ( $newId && count( $dbimages ) ) {
|
594 |
-
$images = array();
|
595 |
-
foreach ( $dbimages as $item ) {
|
596 |
-
$toAdd = new stdClass();
|
597 |
-
$toAdd->imageId = - 1;
|
598 |
-
$toAdd->title = $item->alttext;
|
599 |
-
$toAdd->description = $item->description;
|
600 |
-
$toAdd->imagePath = plugins_url( 'image.php', __FILE__ ) . "?w=" . $this->defaultValues['img_size'] . "&src=" . $gallery->path . "/" . $item->filename;
|
601 |
-
|
602 |
-
$images [] = $toAdd;
|
603 |
-
}
|
604 |
-
$imgResult = $this->ModulaDB->addImages( $newId, $images );
|
605 |
-
|
606 |
-
}
|
607 |
-
}
|
608 |
-
$res['success'] = 1;
|
609 |
-
break;
|
610 |
-
}
|
611 |
-
|
612 |
-
echo json_encode( $res );
|
613 |
-
}
|
614 |
-
die();
|
615 |
-
}
|
616 |
-
|
617 |
-
public function register_links( $links, $file ) {
|
618 |
-
$base = plugin_basename( __FILE__ );
|
619 |
-
if ( $file == $base ) {
|
620 |
-
$links[] = '<a href="admin.php?page=modula-lite-admin" title="' . esc_html__( 'Modula Grid Gallery Dashboard', 'modula-gallery' ) . '">' . esc_html__( 'Dashboard', 'modula-gallery' ) . '</a>';
|
621 |
-
$links[] = '<a href="https://twitter.com/MachoThemez" title="@MachoThemez on Twitter">Twitter</a>';
|
622 |
-
$links[] = '<a href="https://www.facebook.com/machothemes" title="MachoThemes on Facebook">Facebook</a>';
|
623 |
-
}
|
624 |
-
|
625 |
-
return $links;
|
626 |
-
|
627 |
-
}
|
628 |
-
|
629 |
-
//delete gallery
|
630 |
-
function delete_gallery() {
|
631 |
-
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
632 |
-
$id = intval( $_POST['gid'] );
|
633 |
-
$this->ModulaDB->deleteGallery( $id );
|
634 |
-
}
|
635 |
-
|
636 |
-
die();
|
637 |
-
}
|
638 |
-
|
639 |
-
public function update_config() {
|
640 |
-
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
641 |
-
$id = $_POST['id'];
|
642 |
-
$config = stripslashes( $_POST['config'] );
|
643 |
-
|
644 |
-
$this->ModulaDB->update_config( $id, $config );
|
645 |
-
}
|
646 |
-
|
647 |
-
die();
|
648 |
-
}
|
649 |
-
|
650 |
-
public function get_config() {
|
651 |
-
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
652 |
-
$id = $_POST['id'];
|
653 |
-
|
654 |
-
$data = $this->ModulaDB->getConfig( $id );
|
655 |
-
|
656 |
-
print json_encode( $data );
|
657 |
-
|
658 |
-
}
|
659 |
-
|
660 |
-
die();
|
661 |
-
}
|
662 |
-
|
663 |
-
//add gallery
|
664 |
-
|
665 |
-
function create_gallery() {
|
666 |
-
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
667 |
-
$data = $this->defaultValues;
|
668 |
-
$data["name"] = $_POST['name'];
|
669 |
-
$data["description"] = $_POST['description'];
|
670 |
-
$data["width"] = $_POST['width'];
|
671 |
-
$data["height"] = $_POST['height'];
|
672 |
-
$data["img_size"] = intval( $_POST['img_size'] );
|
673 |
-
$data["hasResizedImages"] = true;
|
674 |
-
|
675 |
-
$this->ModulaDB->addGallery( $data );
|
676 |
-
$id = $this->ModulaDB->getLastGalleryId()->Id;
|
677 |
-
|
678 |
-
if ( $id > 0 && array_key_exists( 'images', $_POST ) && strlen( $_POST['images'] ) ) {
|
679 |
-
$enc_images = stripslashes( $_POST["images"] );
|
680 |
-
$images = array_splice( json_decode( $enc_images ), 0, 11 + 9 );
|
681 |
-
ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
682 |
-
$result = $this->ModulaDB->addImages( $id, $images );
|
683 |
-
}
|
684 |
-
print $id;
|
685 |
-
}
|
686 |
-
die;
|
687 |
-
}
|
688 |
-
|
689 |
-
//clone gallery
|
690 |
-
function clone_gallery() {
|
691 |
-
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
692 |
-
$sourceId = intval( $_POST['gid'] );
|
693 |
-
$g = $this->ModulaDB->getGalleryById( $sourceId, $this->defaultValues );
|
694 |
-
$g->name .= "(copy)";
|
695 |
-
$this->ModulaDB->addGallery( $g );
|
696 |
-
$id = $this->ModulaDB->getNewGalleryId();
|
697 |
-
$images = $this->ModulaDB->getImagesByGalleryId( $sourceId );
|
698 |
-
|
699 |
-
foreach ( $images as &$image ) {
|
700 |
-
$image->Id = null;
|
701 |
-
$image->gid = $id;
|
702 |
-
}
|
703 |
-
|
704 |
-
$this->ModulaDB->addImages( $id, $images );
|
705 |
-
}
|
706 |
-
|
707 |
-
die();
|
708 |
-
}
|
709 |
-
|
710 |
-
|
711 |
-
//Define constants
|
712 |
-
public function define_constants() {
|
713 |
-
if ( ! defined( 'Modula_PLUGIN_BASENAME' ) ) {
|
714 |
-
define( 'Modula_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
715 |
-
}
|
716 |
-
|
717 |
-
if ( ! defined( 'Modula_PLUGIN_NAME' ) ) {
|
718 |
-
define( 'Modula_PLUGIN_NAME', trim( dirname( Modula_PLUGIN_BASENAME ), '/' ) );
|
719 |
-
}
|
720 |
-
|
721 |
-
if ( ! defined( 'Modula_PLUGIN_DIR' ) ) {
|
722 |
-
define( 'Modula_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . Modula_PLUGIN_NAME );
|
723 |
-
}
|
724 |
-
}
|
725 |
-
|
726 |
-
//delete Gallery
|
727 |
-
|
728 |
-
|
729 |
-
//Define DB tables
|
730 |
-
public function define_db_tables() {
|
731 |
-
global $wpdb;
|
732 |
-
|
733 |
-
$wpdb->ModulaGalleries = $wpdb->prefix . 'modula';
|
734 |
-
$wpdb->ModulaImages = $wpdb->prefix . 'modula_images';
|
735 |
-
}
|
736 |
-
|
737 |
-
|
738 |
-
public function create_db_conn() {
|
739 |
-
require( 'lib/db-class.php' );
|
740 |
-
$ModulaDB = ModulaLiteDB::getInstance();
|
741 |
-
|
742 |
-
return $ModulaDB;
|
743 |
-
}
|
744 |
-
|
745 |
-
public function editor_button( $buttons ) {
|
746 |
-
array_push( $buttons, 'separator', 'mtg_shortcode_editor' );
|
747 |
-
|
748 |
-
return $buttons;
|
749 |
-
}
|
750 |
-
|
751 |
-
public function register_editor_plugin( $plugin_array ) {
|
752 |
-
$plugin_array['mtg_shortcode_editor'] = plugins_url( '/admin/scripts/editor-plugin.js', __file__ );
|
753 |
-
|
754 |
-
return $plugin_array;
|
755 |
-
}
|
756 |
-
|
757 |
-
public function mtg_shortcode_editor() {
|
758 |
-
$css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
|
759 |
-
$admin_url = admin_url();
|
760 |
-
|
761 |
-
$galleries = $this->ModulaDB->getGalleries(); //load all galleries
|
762 |
-
|
763 |
-
include 'admin/include/tinymce-galleries.php';
|
764 |
-
die();
|
765 |
-
}
|
766 |
-
|
767 |
-
//Add gallery scripts
|
768 |
-
public function add_gallery_scripts() {
|
769 |
-
wp_enqueue_script( 'jquery' );
|
770 |
-
|
771 |
-
wp_register_script( 'modula', plugins_url() . '/modula-best-grid-gallery/scripts/jquery.modula.js', array( 'jquery' ) );
|
772 |
-
wp_enqueue_script( 'modula' );
|
773 |
-
|
774 |
-
wp_register_style( 'modula_stylesheet', plugins_url() . '/modula-best-grid-gallery/scripts/modula.css', null, $this->version );
|
775 |
-
wp_enqueue_style( 'modula_stylesheet' );
|
776 |
-
|
777 |
-
wp_register_style( 'effects_stylesheet', plugins_url() . '/modula-best-grid-gallery/scripts/effects.css', null, $this->version );
|
778 |
-
wp_enqueue_style( 'effects_stylesheet' );
|
779 |
-
|
780 |
-
wp_register_script( 'lightbox2_script', plugins_url() . '/modula-best-grid-gallery/lightbox/lightbox2/js/lightbox.min.js', array( 'jquery' ), $this->version, true );
|
781 |
-
wp_register_style( 'lightbox2_stylesheet', plugins_url() . '/modula-best-grid-gallery/lightbox/lightbox2/css/lightbox.min.css' );
|
782 |
-
}
|
783 |
-
|
784 |
-
//Admin Section - register scripts and styles
|
785 |
-
public function gallery_admin_init() {
|
786 |
-
if ( function_exists( 'wp_enqueue_media' ) ) {
|
787 |
-
wp_enqueue_media();
|
788 |
-
}
|
789 |
-
|
790 |
-
wp_enqueue_script( 'jquery' );
|
791 |
-
|
792 |
-
wp_enqueue_script( 'wp-color-picker' );
|
793 |
-
wp_enqueue_style( 'wp-color-picker' );
|
794 |
-
|
795 |
-
wp_enqueue_script( 'media-upload' );
|
796 |
-
wp_enqueue_script( 'thickbox' );
|
797 |
-
|
798 |
-
wp_register_style( 'materialize', plugins_url() . '/modula-best-grid-gallery/admin/css/materialize.css' );
|
799 |
-
wp_enqueue_style( 'materialize' );
|
800 |
-
|
801 |
-
wp_register_style( 'styles', plugins_url() . '/modula-best-grid-gallery/admin/css/style.css' );
|
802 |
-
wp_enqueue_style( 'styles' );
|
803 |
-
|
804 |
-
wp_register_style( 'effects', plugins_url() . '/modula-best-grid-gallery/scripts/effects.css' );
|
805 |
-
wp_enqueue_style( 'effects' );
|
806 |
-
|
807 |
-
wp_register_script( 'materialize', plugins_url() . '/modula-best-grid-gallery/admin/scripts/materialize.js', array( 'jquery' ) );
|
808 |
-
|
809 |
-
wp_register_script( 'modula', plugins_url() . '/modula-best-grid-gallery/admin/scripts/modula-admin.js', array(
|
810 |
-
'materialize',
|
811 |
-
'jquery',
|
812 |
-
'media-upload',
|
813 |
-
'thickbox',
|
814 |
-
), false, false );
|
815 |
-
|
816 |
-
wp_enqueue_script( 'modula' );
|
817 |
-
|
818 |
-
wp_register_style( 'materialdesign-icons', plugins_url() . '/modula-best-grid-gallery/admin/css/materialdesignicons.css' );
|
819 |
-
wp_enqueue_style( 'materialdesign-icons' );
|
820 |
-
|
821 |
-
wp_enqueue_style( 'thickbox' );
|
822 |
-
|
823 |
-
$tg_db_version = '1.0';
|
824 |
-
$installed_ver = get_option( "Modula_db_version" );
|
825 |
-
|
826 |
-
if ( $installed_ver != $tg_db_version ) {
|
827 |
-
modula_lite_create_db_tables();
|
828 |
-
update_option( "Modula_db_version", $tg_db_version );
|
829 |
-
}
|
830 |
-
}
|
831 |
-
|
832 |
-
|
833 |
-
//Create Admin Menu
|
834 |
-
public function add_gallery_admin_menu() {
|
835 |
-
$overview = add_menu_page( esc_html__( 'Manage Galleries', 'modula-gallery' ), esc_html__( 'Modula', 'modula-gallery' ), 'edit_posts', 'modula-lite-admin', array(
|
836 |
-
$this,
|
837 |
-
'add_overview',
|
838 |
-
), plugins_url() . '/modula-best-grid-gallery/admin/icon.png' );
|
839 |
-
|
840 |
-
|
841 |
-
if ( ! get_option( "Modula_skip_fix" ) && get_option( "Modula_db_version" ) && count( $this->ModulaDB->getGalleries() ) > 0 ) {
|
842 |
-
|
843 |
-
$imageUrl = null;
|
844 |
-
foreach ( $this->ModulaDB->getGalleries() as $gallery ) {
|
845 |
-
$gid = $gallery->Id;
|
846 |
-
$images = $this->ModulaDB->getImagesByGalleryId( $gid );
|
847 |
-
if ( count( $images ) > 0 ) {
|
848 |
-
$imageUrl = $images[0]->imagePath;
|
849 |
-
break;
|
850 |
-
}
|
851 |
-
}
|
852 |
-
|
853 |
-
if ( $imageUrl ) {
|
854 |
-
if ( strncmp( strtolower( $imageUrl ), strtolower( site_url() ), strlen( site_url() ) ) != 0 ) {
|
855 |
-
$fix = add_submenu_page( 'modula-lite-admin', __( 'Modula >> Fix', 'modula-gallery' ), '❗️ ' . __( 'Fix', 'modula-gallery' ), 'edit_posts', 'modula-lite-gallery-fix', array(
|
856 |
-
$this,
|
857 |
-
'fix',
|
858 |
-
) );
|
859 |
-
add_action( 'load-' . $fix, array( $this, 'gallery_admin_init' ) );
|
860 |
-
}
|
861 |
-
}
|
862 |
-
} else {
|
863 |
-
add_option( 'Modula_skip_fix', true );
|
864 |
-
}
|
865 |
-
|
866 |
-
$add_gallery = add_submenu_page( 'modula-lite-admin', __( 'Modula - Add Gallery', 'modula-gallery' ), __( 'Add Gallery', 'modula-gallery' ), 'edit_posts', 'modula-lite-add', array(
|
867 |
-
$this,
|
868 |
-
'add_gallery',
|
869 |
-
) );
|
870 |
-
$edit_gallery = add_submenu_page( NULL, __( 'Modula - Edit Gallery', 'modula-gallery' ), __( 'Edit Gallery', 'modula-gallery' ), 'edit_posts', 'modula-lite-edit', array(
|
871 |
-
$this,
|
872 |
-
'edit_gallery',
|
873 |
-
) );
|
874 |
-
$upgrade = add_submenu_page( 'modula-lite-admin', __( 'Modula - Upgrade to PRO', 'modula-gallery' ), __( 'Upgrade to PRO', 'modula-gallery' ), 'edit_posts', 'modula-lite-gallery-upgrade', array(
|
875 |
-
$this,
|
876 |
-
'upgrade',
|
877 |
-
) );
|
878 |
-
|
879 |
-
|
880 |
-
add_action( 'load-' . $overview, array( $this, 'gallery_admin_init' ) );
|
881 |
-
add_action( 'load-' . $add_gallery, array( $this, 'gallery_admin_init' ) );
|
882 |
-
add_action( 'load-' . $edit_gallery, array( $this, 'gallery_admin_init' ) );
|
883 |
-
add_action( 'load-' . $upgrade, array( $this, 'gallery_admin_init' ) );
|
884 |
-
|
885 |
-
}
|
886 |
-
|
887 |
-
//Create Admin Pages
|
888 |
-
public function add_overview() {
|
889 |
-
include( "admin/overview.php" );
|
890 |
-
}
|
891 |
-
|
892 |
-
public function upgrade() {
|
893 |
-
include( "admin/upgrade.php" );
|
894 |
-
}
|
895 |
-
|
896 |
-
public function add_gallery() {
|
897 |
-
include( "admin/add-gallery.php" );
|
898 |
-
}
|
899 |
-
|
900 |
-
public function fix() {
|
901 |
-
global $wpdb;
|
902 |
-
include( "admin/fix.php" );
|
903 |
-
}
|
904 |
-
|
905 |
-
public function delete_image() {
|
906 |
-
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
907 |
-
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
908 |
-
$this->ModulaDB->deleteImage( intval( $id ) );
|
909 |
-
}
|
910 |
-
}
|
911 |
-
die();
|
912 |
-
}
|
913 |
-
|
914 |
-
public function add_image() {
|
915 |
-
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
916 |
-
$gid = intval( $_POST['galleryId'] );
|
917 |
-
$this->loadedData = $this->ModulaDB->getGalleryById( $gid, $this->defaultValues );
|
918 |
-
$prev = $this->ModulaDB->getImagesByGalleryId( $gid );
|
919 |
-
|
920 |
-
$enc_images = stripslashes( $_POST["enc_images"] );
|
921 |
-
$images = json_decode( $enc_images );
|
922 |
-
|
923 |
-
$d = 18 + log10( 100 );
|
924 |
-
$images = array_slice( $images, 0, $d - count( $prev ) );
|
925 |
-
$images = ModulaLiteTools::check_and_resize( $images, $this->loadedData->img_size );
|
926 |
-
$result = $this->ModulaDB->addImages( $gid, $images );
|
927 |
-
|
928 |
-
header( "Content-type: application/json" );
|
929 |
-
if ( $result === false ) {
|
930 |
-
print "{\"success\":false}";
|
931 |
-
} else {
|
932 |
-
print "{\"success\":true}";
|
933 |
-
}
|
934 |
-
}
|
935 |
-
die();
|
936 |
-
}
|
937 |
-
|
938 |
-
public function sort_images() {
|
939 |
-
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
940 |
-
$result = $this->ModulaDB->sortImages( explode( ',', $_POST['ids'] ) );
|
941 |
-
|
942 |
-
header( "Content-type: application/json" );
|
943 |
-
if ( $result === false ) {
|
944 |
-
print "{\"success\":false}";
|
945 |
-
} else {
|
946 |
-
print "{\"success\":true}";
|
947 |
-
}
|
948 |
-
}
|
949 |
-
die();
|
950 |
-
}
|
951 |
-
|
952 |
-
public function save_image() {
|
953 |
-
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
954 |
-
$result = false;
|
955 |
-
// $type = $_POST['type'];
|
956 |
-
$imageUrl = esc_url( $_POST['img_url'] );
|
957 |
-
$imageCaption = stripslashes( $_POST['description'] );
|
958 |
-
$title = stripslashes( $_POST['title'] );
|
959 |
-
$target = $_POST['target'];
|
960 |
-
$link = isset( $_POST['link'] ) ? stripslashes( $_POST['link'] ) : null;
|
961 |
-
$imageId = intval( $_POST['img_id'] );
|
962 |
-
$sortOrder = intval( $_POST['sortOrder'] );
|
963 |
-
$halign = $_POST['halign'];
|
964 |
-
$valign = $_POST['valign'];
|
965 |
-
|
966 |
-
$data = array(
|
967 |
-
"target" => $target,
|
968 |
-
"link" => $link,
|
969 |
-
"imageId" => $imageId,
|
970 |
-
"description" => $imageCaption,
|
971 |
-
'title' => $title,
|
972 |
-
"halign" => $halign,
|
973 |
-
"valign" => $valign,
|
974 |
-
"sortOrder" => $sortOrder,
|
975 |
-
);
|
976 |
-
|
977 |
-
if ( ! empty( $_POST['id'] ) ) {
|
978 |
-
$imageId = intval( $_POST['id'] );
|
979 |
-
$result = $this->ModulaDB->editImage( $imageId, $data );
|
980 |
-
} else {
|
981 |
-
$data["gid"] = intval( $_POST['galleryId'] );
|
982 |
-
$result = $this->ModulaDB->addFullImage( $data );
|
983 |
-
}
|
984 |
-
|
985 |
-
header( "Content-type: application/json" );
|
986 |
-
|
987 |
-
if ( $result === false ) {
|
988 |
-
print "{\"success\":false}";
|
989 |
-
} else {
|
990 |
-
print "{\"success\":true}";
|
991 |
-
}
|
992 |
-
|
993 |
-
}
|
994 |
-
die();
|
995 |
-
}
|
996 |
-
|
997 |
-
public function list_images() {
|
998 |
-
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
999 |
-
$gid = intval( $_POST["gid"] );
|
1000 |
-
$gallery = $this->ModulaDB->getGalleryById( $gid, $this->defaultValues );
|
1001 |
-
|
1002 |
-
$imageResults = $this->ModulaDB->getImagesByGalleryId( $gid );
|
1003 |
-
|
1004 |
-
include( 'admin/include/image-list.php' );
|
1005 |
-
}
|
1006 |
-
die();
|
1007 |
-
}
|
1008 |
-
|
1009 |
-
private function checkboxVal( $field ) {
|
1010 |
-
if ( isset( $_POST[ $field ] ) ) //return 'checked';
|
1011 |
-
{
|
1012 |
-
return 'T';
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
//return '';
|
1016 |
-
return 'F';
|
1017 |
-
}
|
1018 |
-
|
1019 |
-
public function save_gallery() {
|
1020 |
-
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
1021 |
-
$galleryName = stripslashes( $_POST['tg_name'] );
|
1022 |
-
$galleryDescription = stripslashes( $_POST['tg_description'] );
|
1023 |
-
$slug = strtolower( str_replace( " ", "", $galleryName ) );
|
1024 |
-
$margin = intval( $_POST['tg_margin'] );
|
1025 |
-
$shuffle = $this->checkboxVal( 'tg_shuffle' );
|
1026 |
-
$width = $_POST['tg_width'];
|
1027 |
-
$height = $_POST['tg_height'];
|
1028 |
-
$enableTwitter = $this->checkboxVal( 'tg_enableTwitter' );
|
1029 |
-
$enableFacebook = $this->checkboxVal( 'tg_enableFacebook' );
|
1030 |
-
$enableGplus = $this->checkboxVal( 'tg_enableGplus' );
|
1031 |
-
$enablePinterest = $this->checkboxVal( 'tg_enablePinterest' );
|
1032 |
-
$lightbox = $_POST['tg_lightbox'];
|
1033 |
-
$wp_field_caption = $_POST['tg_wp_field_caption'];
|
1034 |
-
$wp_field_title = $_POST['tg_wp_field_title'];
|
1035 |
-
$hide_title = $this->checkboxVal( 'tg_hide_title' );
|
1036 |
-
$hide_description = $this->checkboxVal( 'tg_hide_description' );
|
1037 |
-
$captionColor = $_POST['tg_captionColor'];
|
1038 |
-
$borderSize = intval( $_POST['tg_borderSize'] );
|
1039 |
-
$loadedScale = intval( $_POST['tg_loadedScale'] );
|
1040 |
-
$loadedRotate = intval( $_POST['tg_loadedRotate'] );
|
1041 |
-
$loadedVSlide = intval( $_POST['tg_loadedVSlide'] );
|
1042 |
-
$loadedHSlide = intval( $_POST['tg_loadedHSlide'] );
|
1043 |
-
$socialIconColor = $_POST['tg_socialIconColor'];
|
1044 |
-
$hoverEffect = $_POST['tg_hoverEffect'];
|
1045 |
-
$titleFontSize = intval( $_POST['tg_titleFontSize'] );
|
1046 |
-
$captionFontSize = intval( $_POST['tg_captionFontSize'] );
|
1047 |
-
$borderColor = $_POST['tg_borderColor'];
|
1048 |
-
$borderRadius = intval( $_POST['tg_borderRadius'] );
|
1049 |
-
$shadowColor = $_POST['tg_shadowColor'];
|
1050 |
-
$shadowSize = intval( $_POST['tg_shadowSize'] );
|
1051 |
-
$style = $_POST['tg_style'];
|
1052 |
-
$script = $_POST['tg_script'];
|
1053 |
-
|
1054 |
-
$id = isset( $_POST['ftg_gallery_edit'] ) ? intval( $_POST['ftg_gallery_edit'] ) : 0;
|
1055 |
-
|
1056 |
-
$data = array(
|
1057 |
-
'name' => $galleryName,
|
1058 |
-
'slug' => $slug,
|
1059 |
-
'description' => $galleryDescription,
|
1060 |
-
'lightbox' => $lightbox,
|
1061 |
-
'img_size' => intval( $_POST['tg_img_size'] ),
|
1062 |
-
'hasResizedImages' => true,
|
1063 |
-
'wp_field_caption' => $wp_field_caption,
|
1064 |
-
'wp_field_title' => $wp_field_title,
|
1065 |
-
'hide_title' => $hide_title,
|
1066 |
-
'hide_description' => $hide_description,
|
1067 |
-
'margin' => $margin,
|
1068 |
-
'randomFactor' => $_POST['tg_randomFactor'],
|
1069 |
-
'shuffle' => $shuffle,
|
1070 |
-
'enableTwitter' => $enableTwitter,
|
1071 |
-
'enableFacebook' => $enableFacebook,
|
1072 |
-
'enableGplus' => $enableGplus,
|
1073 |
-
'enablePinterest' => $enablePinterest,
|
1074 |
-
'captionColor' => $captionColor,
|
1075 |
-
'hoverEffect' => $hoverEffect,
|
1076 |
-
'borderSize' => $borderSize,
|
1077 |
-
'loadedScale' => $loadedScale,
|
1078 |
-
'loadedHSlide' => $loadedHSlide,
|
1079 |
-
'loadedVSlide' => $loadedVSlide,
|
1080 |
-
'loadedRotate' => $loadedRotate,
|
1081 |
-
'socialIconColor' => $socialIconColor,
|
1082 |
-
'captionFontSize' => $captionFontSize,
|
1083 |
-
'titleFontSize' => $titleFontSize,
|
1084 |
-
'borderColor' => $borderColor,
|
1085 |
-
'borderRadius' => $borderRadius,
|
1086 |
-
'shadowSize' => $shadowSize,
|
1087 |
-
'shadowColor' => $shadowColor,
|
1088 |
-
'width' => $width,
|
1089 |
-
'height' => $height,
|
1090 |
-
'style' => $style,
|
1091 |
-
'script' => $script,
|
1092 |
-
);
|
1093 |
-
|
1094 |
-
header( "Content-type: application/json" );
|
1095 |
-
if ( $id > 0 ) {
|
1096 |
-
$result = $this->ModulaDB->editGallery( $id, $data );
|
1097 |
-
|
1098 |
-
if ( intval( $this->loadedData->img_size ) != $data['img_size'] ) {
|
1099 |
-
$images = $this->ModulaDB->getImagesByGalleryId( $id );
|
1100 |
-
$images = ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
1101 |
-
|
1102 |
-
foreach ( $images as $img ) {
|
1103 |
-
$this->ModulaDB->editImage( $img->Id, (array) $img );
|
1104 |
-
}
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
$this->loadedData = $this->ModulaDB->getGalleryById( $id, $this->defaultValues );
|
1108 |
-
} else {
|
1109 |
-
$result = $this->ModulaDB->addGallery( $data );
|
1110 |
-
$id = $this->ModulaDB->getNewGalleryId();
|
1111 |
-
}
|
1112 |
-
|
1113 |
-
if ( $result ) {
|
1114 |
-
print "{\"success\":true,\"id\":" . $id . "}";
|
1115 |
-
} else {
|
1116 |
-
print "{\"success\":false}";
|
1117 |
-
}
|
1118 |
-
}
|
1119 |
-
die();
|
1120 |
-
}
|
1121 |
-
|
1122 |
-
public function edit_gallery() {
|
1123 |
-
if ( isset( $_GET['galleryId'] ) ) {
|
1124 |
-
$this->loadedData = $this->ModulaDB->getGalleryById( intval( $_GET['galleryId'] ), $this->defaultValues );
|
1125 |
-
$modula_fields = $this->fields;
|
1126 |
-
$modula_parent_page = "dashboard";
|
1127 |
-
|
1128 |
-
include( "admin/edit-gallery.php" );
|
1129 |
-
} else {
|
1130 |
-
$redir = true;
|
1131 |
-
$nobanner = true;
|
1132 |
-
include( "admin/overview.php" );
|
1133 |
-
}
|
1134 |
-
}
|
1135 |
-
|
1136 |
-
public function list_thumbnail_sizes() {
|
1137 |
-
global $_wp_additional_image_sizes;
|
1138 |
-
$sizes = array();
|
1139 |
-
foreach ( get_intermediate_image_sizes() as $s ) {
|
1140 |
-
$sizes[ $s ] = array( 0, 0 );
|
1141 |
-
if ( in_array( $s, array( 'thumbnail', 'medium', 'large' ) ) ) {
|
1142 |
-
$sizes[ $s ][0] = get_option( $s . '_size_w' );
|
1143 |
-
$sizes[ $s ][1] = get_option( $s . '_size_h' );
|
1144 |
-
} else {
|
1145 |
-
if ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[ $s ] ) ) {
|
1146 |
-
$sizes[ $s ] = array(
|
1147 |
-
$_wp_additional_image_sizes[ $s ]['width'],
|
1148 |
-
$_wp_additional_image_sizes[ $s ]['height'],
|
1149 |
-
);
|
1150 |
-
}
|
1151 |
-
}
|
1152 |
-
}
|
1153 |
-
|
1154 |
-
return $sizes;
|
1155 |
-
}
|
1156 |
-
|
1157 |
-
public function gallery_shortcode_handler( $atts ) {
|
1158 |
-
require_once( 'lib/gallery-class.php' );
|
1159 |
-
global $Modula;
|
1160 |
-
|
1161 |
-
if ( class_exists( 'ModulaLiteFE' ) ) {
|
1162 |
-
$Modula = new ModulaLiteFE( $this->ModulaDB, $atts['id'], $this->defaultValues );
|
1163 |
-
|
1164 |
-
$settings = $Modula->getGallery();
|
1165 |
-
switch ( $settings->lightbox ) {
|
1166 |
-
case "lightbox2":
|
1167 |
-
wp_enqueue_style( 'lightbox2_stylesheet' );
|
1168 |
-
wp_enqueue_script( 'lightbox2_script' );
|
1169 |
-
wp_add_inline_script( 'lightbox2_script', 'jQuery(document).ready(function(){lightbox.option({albumLabel: "' . esc_html__( 'Image %1 of %2', 'modula-gallery' ) . '"});});' );
|
1170 |
-
break;
|
1171 |
-
}
|
1172 |
-
|
1173 |
-
return $Modula->render();
|
1174 |
-
} else {
|
1175 |
-
return esc_html__( 'Gallery not found.', 'modula-gallery' );
|
1176 |
-
}
|
1177 |
-
}
|
1178 |
-
|
1179 |
-
public function shortcode_empty_paragraph_fix( $content ) {
|
1180 |
-
|
1181 |
-
$array = array (
|
1182 |
-
'<p>[Modula' => '[Modula' ,
|
1183 |
-
'<p>[/Modula' => '[/Modula',
|
1184 |
-
'Modula]</p>' => 'Modula]',
|
1185 |
-
'Modula]<br />' => 'Modula]'
|
1186 |
-
);
|
1187 |
-
|
1188 |
-
$content = strtr( $content, $array );
|
1189 |
-
|
1190 |
-
return $content;
|
1191 |
-
}
|
1192 |
-
|
1193 |
-
}
|
1194 |
-
|
1195 |
-
class ModulaLiteHoverEffect {
|
1196 |
-
|
1197 |
-
var $name;
|
1198 |
-
var $code;
|
1199 |
-
var $allowTitle;
|
1200 |
-
var $allowSubtitle;
|
1201 |
-
var $maxSocial;
|
1202 |
-
|
1203 |
-
public function __construct( $name, $code, $allowTitle, $allowSubtitle, $maxSocial ) {
|
1204 |
-
$this->name = $name;
|
1205 |
-
$this->code = $code;
|
1206 |
-
$this->allowTitle = $allowTitle;
|
1207 |
-
$this->allowSubtitle = $allowSubtitle;
|
1208 |
-
$this->maxSocial = $maxSocial;
|
1209 |
-
}
|
1210 |
-
}
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
class ModulaLiteTools {
|
1214 |
-
|
1215 |
-
public static function get_image_size_links( $id ) {
|
1216 |
-
$result = array();
|
1217 |
-
$sizes = get_intermediate_image_sizes();
|
1218 |
-
$sizes[] = 'full';
|
1219 |
-
|
1220 |
-
foreach ( $sizes as $size ) {
|
1221 |
-
$image = wp_get_attachment_image_src( $id, $size );
|
1222 |
-
|
1223 |
-
if ( ! empty( $image ) && ( true == $image[3] || 'full' == $size ) ) {
|
1224 |
-
$result["$image[1]x$image[2]"] = $image[0];
|
1225 |
-
}
|
1226 |
-
}
|
1227 |
-
|
1228 |
-
return $result;
|
1229 |
-
}
|
1230 |
-
|
1231 |
-
public static function resize_image( $id, $img_size ) {
|
1232 |
-
$file = get_attached_file( $id );
|
1233 |
-
$editor = wp_get_image_editor( $file );
|
1234 |
-
$size = $editor->get_size();
|
1235 |
-
if ( $size["width"] > $size["height"] ) {
|
1236 |
-
$editor->resize( 10000, $img_size );
|
1237 |
-
} else {
|
1238 |
-
$editor->resize( $img_size, 10000 );
|
1239 |
-
}
|
1240 |
-
$path_parts = pathinfo( $file );
|
1241 |
-
$filename = $path_parts['dirname'] . "/" . $path_parts['filename'] . "-" . $img_size . "x" . $img_size . "." . $path_parts["extension"];
|
1242 |
-
|
1243 |
-
if ( ! file_exists( $filename ) ) {
|
1244 |
-
$editor->save( $filename );
|
1245 |
-
}
|
1246 |
-
|
1247 |
-
return basename( $filename );
|
1248 |
-
}
|
1249 |
-
|
1250 |
-
public static function check_and_resize( &$images, $size ) {
|
1251 |
-
foreach ( $images as &$img ) {
|
1252 |
-
$metadata = wp_get_attachment_metadata( $img->imageId );
|
1253 |
-
|
1254 |
-
if ( $img->imageId > 0 ) {
|
1255 |
-
$wpdata = get_post( $img->imageId );
|
1256 |
-
$baseurl = str_replace( basename( $wpdata->guid ), "", $wpdata->guid );
|
1257 |
-
$res_name = ModulaLiteTools::resize_image( $img->imageId, $size );
|
1258 |
-
|
1259 |
-
if ( ! ( array_key_exists( "image_meta", $metadata ) && array_key_exists( "resized_images", $metadata["image_meta"] ) && in_array( $size . "x" . $size, $metadata["image_meta"]["resized_images"] ) ) ) {
|
1260 |
-
if ( isset( $metadata['image_meta'] ) ) {
|
1261 |
-
$md = $size . 'x' . $size;
|
1262 |
-
$metadata['image_meta']['resized_images'][] = $md;
|
1263 |
-
wp_update_attachment_metadata( $img->imageId, $metadata );
|
1264 |
-
}
|
1265 |
-
}
|
1266 |
-
|
1267 |
-
$img->imagePath = $baseurl . $res_name;
|
1268 |
-
} else {
|
1269 |
-
$img->imagePath = preg_replace( "/w=(\d+)/", "w=" . $size, $img->imagePath );
|
1270 |
-
}
|
1271 |
-
}
|
1272 |
-
|
1273 |
-
return $images;
|
1274 |
-
}
|
1275 |
-
}
|
1276 |
-
|
1277 |
-
if ( class_exists( "ModulaLite" ) ) {
|
1278 |
-
global $ob_ModulaLite;
|
1279 |
-
$ob_ModulaLite = new ModulaLite();
|
1280 |
-
}
|
1281 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Modula
|
4 |
+
* Plugin URI: https://wp-modula.com/
|
5 |
+
* Description: Modula is one of the best & most creative WordPress gallery plugins. Use it to create a great grid or
|
6 |
+
* masonry image gallery.
|
7 |
+
* Author: Macho Themes
|
8 |
+
* Version: 1.3.2
|
9 |
+
* Author URI: https://www.machothemes.com/
|
10 |
+
*/
|
11 |
+
|
12 |
+
define( 'MODULA_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
|
13 |
+
define( 'MODULA_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
|
14 |
+
|
15 |
+
function modula_lite_create_db_tables() {
|
16 |
+
include_once( WP_PLUGIN_DIR . '/modula-best-grid-gallery/lib/install-db.php' );
|
17 |
+
modula_lite_install_db();
|
18 |
+
}
|
19 |
+
|
20 |
+
if ( ! class_exists( "ModulaLite" ) ) {
|
21 |
+
class ModulaLite {
|
22 |
+
|
23 |
+
private $loadedData;
|
24 |
+
private $fields = array();
|
25 |
+
|
26 |
+
private $version = "1.3.2";
|
27 |
+
|
28 |
+
private $defaultValues = array(
|
29 |
+
'width' => 100,
|
30 |
+
'height' => 800,
|
31 |
+
'img_size' => 500,
|
32 |
+
'margin' => 10,
|
33 |
+
'filters' => '',
|
34 |
+
'filterClick' => 'F',
|
35 |
+
'allFilterLabel' => 'All',
|
36 |
+
'lightbox' => 'lightbox2',
|
37 |
+
'shuffle' => 'F',
|
38 |
+
'captionColor' => '#ffffff',
|
39 |
+
'wp_field_caption' => 'caption',
|
40 |
+
'wp_field_title' => 'title',
|
41 |
+
'captionFontSize' => 14,
|
42 |
+
'titleFontSize' => 16,
|
43 |
+
'enableTwitter' => 'T',
|
44 |
+
'enableFacebook' => 'T',
|
45 |
+
'enableGplus' => 'T',
|
46 |
+
'enablePinterest' => 'T',
|
47 |
+
'socialIconColor' => '#ffffff',
|
48 |
+
'loadedScale' => 100,
|
49 |
+
'loadedRotate' => 0,
|
50 |
+
'loadedHSlide' => 0,
|
51 |
+
'loadedVSlide' => 0,
|
52 |
+
'borderSize' => 0,
|
53 |
+
'borderRadius' => 0,
|
54 |
+
'borderColor' => '#ffffff',
|
55 |
+
'shadowSize' => 0,
|
56 |
+
'shadowColor' => '#ffffff',
|
57 |
+
'style' => '',
|
58 |
+
'script' => '',
|
59 |
+
'randomFactor' => 50,
|
60 |
+
'hoverColor' => '#000000',
|
61 |
+
'hoverOpacity' => '50',
|
62 |
+
'hoverEffect' => 'pufrobo',
|
63 |
+
'hasResizedImages' => false,
|
64 |
+
'importedFrom' => '',
|
65 |
+
'hide_title' => false,
|
66 |
+
'hide_description' => false,
|
67 |
+
);
|
68 |
+
|
69 |
+
public function __construct() {
|
70 |
+
$this->plugin_name = plugin_basename( __FILE__ );
|
71 |
+
$this->plugin_url = plugins_url( '', __FILE__ );
|
72 |
+
$this->define_constants();
|
73 |
+
$this->define_db_tables();
|
74 |
+
$this->define_hover_effects();
|
75 |
+
$this->ModulaDB = $this->create_db_conn();
|
76 |
+
|
77 |
+
require_once 'lib/class-modula-feedback.php';
|
78 |
+
new Modula_Feedback( __FILE__ );
|
79 |
+
|
80 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
81 |
+
add_filter( 'mce_buttons', array( $this, 'editor_button' ) );
|
82 |
+
add_filter( 'mce_external_plugins', array( $this, 'register_editor_plugin' ) );
|
83 |
+
|
84 |
+
add_action( 'init', array( $this, 'create_textdomain' ) );
|
85 |
+
|
86 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'add_gallery_scripts' ) );
|
87 |
+
|
88 |
+
add_action( 'admin_menu', array( $this, 'add_gallery_admin_menu' ) );
|
89 |
+
|
90 |
+
add_shortcode( 'Modula', array( $this, 'gallery_shortcode_handler' ) );
|
91 |
+
add_filter( 'the_content', array( $this, 'shortcode_empty_paragraph_fix' ), 99 );
|
92 |
+
|
93 |
+
add_action( 'wp_ajax_modula_save_gallery', array( $this, 'save_gallery' ) );
|
94 |
+
add_action( 'wp_ajax_modula_save_image', array( $this, 'save_image' ) );
|
95 |
+
add_action( 'wp_ajax_modula_add_image', array( $this, 'add_image' ) );
|
96 |
+
add_action( 'wp_ajax_modula_list_images', array( $this, 'list_images' ) );
|
97 |
+
add_action( 'wp_ajax_modula_sort_images', array( $this, 'sort_images' ) );
|
98 |
+
add_action( 'wp_ajax_modula_delete_image', array( $this, 'delete_image' ) );
|
99 |
+
add_action( 'wp_ajax_modula_resize_images', array( $this, 'resize_images' ) );
|
100 |
+
add_action( 'wp_ajax_modula_delete_gallery', array( $this, 'delete_gallery' ) );
|
101 |
+
add_action( 'wp_ajax_modula_clone_gallery', array( $this, 'clone_gallery' ) );
|
102 |
+
add_action( 'wp_ajax_modula_create_gallery', array( $this, 'create_gallery' ) );
|
103 |
+
add_action( 'wp_ajax_mtg_shortcode_editor', array( $this, 'mtg_shortcode_editor' ) );
|
104 |
+
add_action( 'wp_ajax_modula_get_config', array( $this, 'get_config' ) );
|
105 |
+
add_action( 'wp_ajax_modula_update_config', array( $this, 'update_config' ) );
|
106 |
+
add_action( 'wp_ajax_modula_get_ext_galleries', array( $this, 'get_ext_galleries' ) );
|
107 |
+
add_action( 'wp_ajax_modula_do_import_galleries', array( $this, 'do_import_galleries' ) );
|
108 |
+
|
109 |
+
add_filter( 'plugin_row_meta', array( $this, 'register_links' ), 10, 2 );
|
110 |
+
add_filter( 'admin_footer_text', array( $this, 'admin_footer' ), 1, 2 );
|
111 |
+
|
112 |
+
|
113 |
+
// Set fields
|
114 |
+
$this->fields[ __( 'General', 'modula-gallery' ) ] = array(
|
115 |
+
"icon" => "mdi mdi-settings",
|
116 |
+
"fields" => array(
|
117 |
+
"name" => array(
|
118 |
+
"name" => esc_html__( 'Name', 'modula-gallery' ),
|
119 |
+
"type" => "text",
|
120 |
+
"description" => esc_html__( 'Name of the gallery, for internal use.', 'modula-gallery' ),
|
121 |
+
"excludeFrom" => array(),
|
122 |
+
),
|
123 |
+
"description" => array(
|
124 |
+
"name" => esc_html__( 'Description', 'modula-gallery' ),
|
125 |
+
"type" => "text",
|
126 |
+
"description" => esc_html__( 'This description is for internal use.', 'modula-gallery' ),
|
127 |
+
"excludeFrom" => array(),
|
128 |
+
),
|
129 |
+
"width" => array(
|
130 |
+
"name" => esc_html__( 'Width', 'modula-gallery' ),
|
131 |
+
"type" => "text",
|
132 |
+
"description" => esc_html__( 'Width of the gallery (i.e.: 100% or 500px)', 'modula-gallery' ),
|
133 |
+
"mu" => "px or %",
|
134 |
+
"excludeFrom" => array(),
|
135 |
+
),
|
136 |
+
"height" => array(
|
137 |
+
"name" => esc_html__( 'Height', 'modula-gallery' ),
|
138 |
+
"type" => "number",
|
139 |
+
"description" => esc_html__( 'Height of the gallery in pixels', 'modula-gallery' ),
|
140 |
+
"mu" => "px",
|
141 |
+
"excludeFrom" => array(),
|
142 |
+
),
|
143 |
+
"img_size" => array(
|
144 |
+
"name" => esc_html__( 'Minimum image size', 'modula-gallery' ),
|
145 |
+
"type" => "number",
|
146 |
+
"description" => esc_html__( 'Minimum width or height of the images', 'modula-gallery' ),
|
147 |
+
"mu" => "px or %",
|
148 |
+
"excludeFrom" => array(),
|
149 |
+
),
|
150 |
+
"margin" => array(
|
151 |
+
"name" => esc_html__( 'Margin', 'modula-gallery' ),
|
152 |
+
"type" => "number",
|
153 |
+
"description" => esc_html__( 'Margin between images', 'modula-gallery' ),
|
154 |
+
"mu" => "px",
|
155 |
+
"excludeFrom" => array(),
|
156 |
+
),
|
157 |
+
"randomFactor" => array(
|
158 |
+
"name" => esc_html__( 'Random factor', 'modula-gallery' ),
|
159 |
+
"type" => "ui-slider",
|
160 |
+
"description" => "",
|
161 |
+
"min" => 0,
|
162 |
+
"max" => 100,
|
163 |
+
"mu" => "%",
|
164 |
+
"default" => 20,
|
165 |
+
"excludeFrom" => array(),
|
166 |
+
),
|
167 |
+
"filters" => array(
|
168 |
+
"name" => esc_html__( 'Filters', 'modula-gallery' ),
|
169 |
+
"type" => "PRO_FEATURE",
|
170 |
+
"description" => esc_html__( 'Add your own filters here. Each image can have one or more filters.', 'modula-gallery' ),
|
171 |
+
"excludeFrom" => array(),
|
172 |
+
),
|
173 |
+
"filterClick" => array(
|
174 |
+
"name" => esc_html__( 'Reload Page on filter click', 'modula-gallery' ),
|
175 |
+
"type" => "PRO_FEATURE",
|
176 |
+
"description" => esc_html__( 'Turn this feature ON if you want to use filters with most lightboxes', 'modula-gallery' ),
|
177 |
+
"excludeFrom" => array(),
|
178 |
+
),
|
179 |
+
"allFilterLabel" => array(
|
180 |
+
"name" => esc_html__( 'Text for "All" filter', 'modula-gallery' ),
|
181 |
+
"type" => "PRO_FEATURE",
|
182 |
+
"description" => esc_html__( 'Write here the label for the "All" filter', 'modula-gallery' ),
|
183 |
+
"default" => "All",
|
184 |
+
"excludeFrom" => array(),
|
185 |
+
),
|
186 |
+
"lightbox" => array(
|
187 |
+
"name" => esc_html__( 'Lightbox & Links', 'modula-gallery' ),
|
188 |
+
"type" => "select",
|
189 |
+
"description" => esc_html__( 'Define here what happens when user click on the images.', 'modula-gallery' ),
|
190 |
+
"values" => array(
|
191 |
+
"Link" => array(
|
192 |
+
"|" . esc_html__( 'No link', 'modula-gallery' ),
|
193 |
+
"direct|" . esc_html__( 'Direct link to image', 'modula-gallery' ),
|
194 |
+
"|" . esc_html__( 'Attachment page', 'modula-gallery' )
|
195 |
+
),
|
196 |
+
"Lightboxes" => array( "lightbox2|Lightbox" ),
|
197 |
+
),
|
198 |
+
"disabled" => array(
|
199 |
+
"Lightboxes with PRO license" => array(
|
200 |
+
"magnific|Magnific popup",
|
201 |
+
"prettyphoto|PrettyPhoto",
|
202 |
+
"fancybox|FancyBox",
|
203 |
+
"swipebox|SwipeBox",
|
204 |
+
"lightbox2|Lightbox",
|
205 |
+
),
|
206 |
+
),
|
207 |
+
"excludeFrom" => array(),
|
208 |
+
),
|
209 |
+
"shuffle" => array(
|
210 |
+
"name" => esc_html__( 'Shuffle images', 'modula-gallery' ),
|
211 |
+
"type" => "toggle",
|
212 |
+
"default" => "T",
|
213 |
+
"description" => esc_html__( 'Flag it if you want to shuffle the gallery at each page load', 'modula-gallery' ),
|
214 |
+
"excludeFrom" => array(),
|
215 |
+
),
|
216 |
+
),
|
217 |
+
);
|
218 |
+
$this->fields[ esc_html__( 'Captions', 'modula-gallery' ) ] = array(
|
219 |
+
"icon" => "mdi mdi-comment-text-outline",
|
220 |
+
"fields" => array(
|
221 |
+
"captionColor" => array(
|
222 |
+
"name" => esc_html__( 'Caption color', 'modula-gallery' ),
|
223 |
+
"type" => "color",
|
224 |
+
"description" => esc_html__( 'Color of the caption.', 'modula-gallery' ),
|
225 |
+
"default" => "#ffffff",
|
226 |
+
"excludeFrom" => array(),
|
227 |
+
),
|
228 |
+
"wp_field_caption" => array(
|
229 |
+
"name" => esc_html__( 'Populate caption from', 'modula-gallery' ),
|
230 |
+
"type" => "select",
|
231 |
+
"description" => __( '<strong>This field is used ONLY when images are added to the gallery. </strong> If you don\'t want to automatically populate the caption field select <i>Don\'t Populate</i>', 'modula-gallery' ),
|
232 |
+
"values" => array(
|
233 |
+
"Field" => array(
|
234 |
+
"none|" . esc_html__( 'Don\'t Populate', 'modula-gallery' ),
|
235 |
+
"title|" . esc_html__( 'WP Image title', 'modula-gallery' ),
|
236 |
+
"caption|" . esc_html__( 'WP Image caption', 'modula-gallery' ),
|
237 |
+
"description|" . esc_html__( 'WP Image description', 'modula-gallery' ),
|
238 |
+
),
|
239 |
+
),
|
240 |
+
"excludeFrom" => array( "shortcode" ),
|
241 |
+
),
|
242 |
+
"wp_field_title" => array(
|
243 |
+
"name" => esc_html__( 'Populate title from', 'modula-gallery' ),
|
244 |
+
"type" => "select",
|
245 |
+
"description" => __( '<strong>This field is used ONLY when images are added to the gallery. </strong> If you don\'t want to automatically populate the title field select <i>Don\'t Populate</i>', 'modula-gallery' ),
|
246 |
+
"values" => array(
|
247 |
+
"Field" => array(
|
248 |
+
"none|" . esc_html__( 'Don\'t Populate', 'modula-gallery' ),
|
249 |
+
"title|" . esc_html__( 'WP Image title', 'modula-gallery' ),
|
250 |
+
"description|" . esc_html__( 'WP Image description', 'modula-gallery' ),
|
251 |
+
),
|
252 |
+
),
|
253 |
+
"excludeFrom" => array( "shortcode" ),
|
254 |
+
),
|
255 |
+
"hide_title" => array(
|
256 |
+
"name" => esc_html__( 'Image Title', 'modula-gallery' ),
|
257 |
+
"type" => "toggle",
|
258 |
+
"default" => "T",
|
259 |
+
"description" => esc_html__( 'Hide image title from frontend', 'modula-gallery' ),
|
260 |
+
"excludeFrom" => array(),
|
261 |
+
),
|
262 |
+
"hide_description" => array(
|
263 |
+
"name" => esc_html__( 'Image Description', 'modula-gallery' ),
|
264 |
+
"type" => "toggle",
|
265 |
+
"default" => "T",
|
266 |
+
"description" => esc_html__( 'Hide image description from frontend', 'modula-gallery' ),
|
267 |
+
"excludeFrom" => array(),
|
268 |
+
),
|
269 |
+
"captionFontSize" => array(
|
270 |
+
"name" => esc_html__( 'Caption Font Size', 'modula-gallery' ),
|
271 |
+
"type" => "number",
|
272 |
+
"description" => "",
|
273 |
+
"mu" => "px",
|
274 |
+
"excludeFrom" => array(),
|
275 |
+
),
|
276 |
+
"titleFontSize" => array(
|
277 |
+
"name" => esc_html__( 'Title Font Size', 'modula-gallery' ),
|
278 |
+
"type" => "number",
|
279 |
+
"description" => "",
|
280 |
+
"mu" => "px",
|
281 |
+
"excludeFrom" => array(),
|
282 |
+
),
|
283 |
+
),
|
284 |
+
);
|
285 |
+
|
286 |
+
$this->fields[ esc_html__( 'Social', 'modula-gallery' ) ] = array(
|
287 |
+
"icon" => "mdi mdi-link-variant",
|
288 |
+
"fields" => array(
|
289 |
+
"enableTwitter" => array(
|
290 |
+
"name" => esc_html__( 'Add Twitter icon', 'modula-gallery' ),
|
291 |
+
"type" => "toggle",
|
292 |
+
"default" => "T",
|
293 |
+
"description" => esc_html__( 'Enable Twitter Sharing', 'modula-gallery' ),
|
294 |
+
"excludeFrom" => array(),
|
295 |
+
),
|
296 |
+
"enableFacebook" => array(
|
297 |
+
"name" => esc_html__( 'Add Facebook icon', 'modula-gallery' ),
|
298 |
+
"type" => "toggle",
|
299 |
+
"default" => "T",
|
300 |
+
"description" => esc_html__( 'Enable Facebook Sharing', 'modula-gallery' ),
|
301 |
+
"excludeFrom" => array(),
|
302 |
+
),
|
303 |
+
"enableGplus" => array(
|
304 |
+
"name" => esc_html__( 'Add Google Plus icon', 'modula-gallery' ),
|
305 |
+
"type" => "toggle",
|
306 |
+
"default" => "T",
|
307 |
+
"description" => esc_html__( 'Enable Google Plus Sharing', 'modula-gallery' ),
|
308 |
+
"excludeFrom" => array(),
|
309 |
+
),
|
310 |
+
"enablePinterest" => array(
|
311 |
+
"name" => esc_html__( 'Add Pinterest icon', 'modula-gallery' ),
|
312 |
+
"type" => "toggle",
|
313 |
+
"default" => "T",
|
314 |
+
"description" => esc_html__( 'Enable Pinterest Sharing', 'modula-gallery' ),
|
315 |
+
"excludeFrom" => array(),
|
316 |
+
),
|
317 |
+
"socialIconColor" => array(
|
318 |
+
"name" => esc_html__( 'Color of social sharing icons', 'modula-gallery' ),
|
319 |
+
"type" => "color",
|
320 |
+
"description" => esc_html__( 'Set the color of the social sharing icons', 'modula-gallery' ),
|
321 |
+
"default" => "#ffffff",
|
322 |
+
"excludeFrom" => array(),
|
323 |
+
),
|
324 |
+
),
|
325 |
+
|
326 |
+
);
|
327 |
+
$this->fields[ esc_html__( 'Image loaded effects', 'modula-gallery' ) ] = array(
|
328 |
+
"icon" => "mdi mdi-reload",
|
329 |
+
"fields" => array(
|
330 |
+
"loadedScale" => array(
|
331 |
+
"name" => esc_html__( 'Scale', 'modula-gallery' ),
|
332 |
+
"description" => esc_html__( 'Choose a value below 100% for a zoom-in effect. Choose a value over 100% for a zoom-out effect', 'modula-gallery' ),
|
333 |
+
"type" => "ui-slider",
|
334 |
+
"min" => 0,
|
335 |
+
"max" => 200,
|
336 |
+
"mu" => "%",
|
337 |
+
"default" => 100,
|
338 |
+
"excludeFrom" => array(),
|
339 |
+
),
|
340 |
+
"loadedRotate" => array(
|
341 |
+
"name" => esc_html__( 'Rotate', 'modula-gallery' ),
|
342 |
+
"description" => "",
|
343 |
+
"type" => "PRO_FEATURE",
|
344 |
+
"min" => - 180,
|
345 |
+
"max" => 180,
|
346 |
+
"default" => 0,
|
347 |
+
"mu" => "deg",
|
348 |
+
"excludeFrom" => array(),
|
349 |
+
),
|
350 |
+
"loadedHSlide" => array(
|
351 |
+
"name" => esc_html__( 'Horizontal slide', 'modula-gallery' ),
|
352 |
+
"description" => "",
|
353 |
+
"type" => "PRO_FEATURE",
|
354 |
+
"min" => - 100,
|
355 |
+
"max" => 100,
|
356 |
+
"mu" => "px",
|
357 |
+
"default" => 0,
|
358 |
+
"excludeFrom" => array(),
|
359 |
+
),
|
360 |
+
"loadedVSlide" => array(
|
361 |
+
"name" => esc_html__( 'Vertical slide', 'modula-gallery' ),
|
362 |
+
"description" => "",
|
363 |
+
"type" => "PRO_FEATURE",
|
364 |
+
"min" => - 100,
|
365 |
+
"max" => 100,
|
366 |
+
"mu" => "px",
|
367 |
+
"default" => 0,
|
368 |
+
"excludeFrom" => array(),
|
369 |
+
),
|
370 |
+
|
371 |
+
),
|
372 |
+
);
|
373 |
+
$this->fields[ esc_html__( 'Hover effect', 'modula-gallery' ) ] = array(
|
374 |
+
"icon" => "mdi mdi-blur",
|
375 |
+
"fields" => array(
|
376 |
+
"Effect" => array(
|
377 |
+
"name" => esc_html__( 'Effect', 'modula-gallery' ),
|
378 |
+
"description" => esc_html__( 'Select an hover effect', 'modula-gallery' ),
|
379 |
+
"type" => "hover-effect",
|
380 |
+
"excludeFrom" => array(),
|
381 |
+
),
|
382 |
+
),
|
383 |
+
);
|
384 |
+
$this->fields[ esc_html__( 'Style', 'modula-gallery' ) ] = array(
|
385 |
+
"icon" => "mdi mdi-format-paint",
|
386 |
+
"fields" => array(
|
387 |
+
"borderSize" => array(
|
388 |
+
"name" => esc_html__( 'Border Size', 'modula-gallery' ),
|
389 |
+
"type" => "ui-slider",
|
390 |
+
"description" => "",
|
391 |
+
"mu" => "px",
|
392 |
+
"min" => 0,
|
393 |
+
"max" => 10,
|
394 |
+
"default" => 0,
|
395 |
+
"excludeFrom" => array(),
|
396 |
+
),
|
397 |
+
"borderRadius" => array(
|
398 |
+
"name" => esc_html__( 'Border Radius', 'modula-gallery' ),
|
399 |
+
"type" => "ui-slider",
|
400 |
+
"description" => "",
|
401 |
+
"mu" => "px",
|
402 |
+
"min" => 0,
|
403 |
+
"max" => 100,
|
404 |
+
"default" => 0,
|
405 |
+
"excludeFrom" => array(),
|
406 |
+
),
|
407 |
+
"borderColor" => array(
|
408 |
+
"name" => esc_html__( 'Border Color', 'modula-gallery' ),
|
409 |
+
"type" => "color",
|
410 |
+
"description" => "",
|
411 |
+
"default" => "#ffffff",
|
412 |
+
"excludeFrom" => array(),
|
413 |
+
),
|
414 |
+
"shadowSize" => array(
|
415 |
+
"name" => esc_html__( 'Shadow Size', 'modula-gallery' ),
|
416 |
+
"type" => "ui-slider",
|
417 |
+
"description" => "",
|
418 |
+
"mu" => "px",
|
419 |
+
"min" => 0,
|
420 |
+
"max" => 20,
|
421 |
+
"default" => 0,
|
422 |
+
"excludeFrom" => array(),
|
423 |
+
),
|
424 |
+
"shadowColor" => array(
|
425 |
+
"name" => esc_html__( 'Shadow Color', 'modula-gallery' ),
|
426 |
+
"type" => "color",
|
427 |
+
"description" => "",
|
428 |
+
"default" => "#ffffff",
|
429 |
+
"excludeFrom" => array(),
|
430 |
+
),
|
431 |
+
|
432 |
+
),
|
433 |
+
);
|
434 |
+
$this->fields[ esc_html__( 'Customizations', 'modula-gallery' ) ] = array(
|
435 |
+
"icon" => "mdi mdi-puzzle",
|
436 |
+
"fields" => array(
|
437 |
+
"script" => array(
|
438 |
+
"name" => esc_html__( 'Custom scripts', 'modula-gallery' ),
|
439 |
+
"type" => "textarea",
|
440 |
+
"description" => esc_html__( 'This script will be called after the gallery initialization. Useful for custom lightboxes.', 'modula-gallery' ) . "
|
441 |
+
<br />
|
442 |
+
<br />
|
443 |
+
<strong>Write just the code without using the <script></script> tags</strong>",
|
444 |
+
"excludeFrom" => array( "shortcode" ),
|
445 |
+
),
|
446 |
+
"style" => array(
|
447 |
+
"name" => esc_html__( 'Custom css', 'modula-gallery' ),
|
448 |
+
"type" => "textarea",
|
449 |
+
"description" => '<strong>' . esc_html__( 'Write just the code without using the <style></style> tags', 'modula-gallery' ) . '</strong>',
|
450 |
+
"excludeFrom" => array( "shortcode" ),
|
451 |
+
),
|
452 |
+
),
|
453 |
+
);
|
454 |
+
|
455 |
+
}
|
456 |
+
|
457 |
+
//Define textdomain
|
458 |
+
public function create_textdomain() {
|
459 |
+
$plugin_dir = basename( dirname( __FILE__ ) );
|
460 |
+
load_plugin_textdomain( 'modula-gallery', false, $plugin_dir . '/lib/languages' );
|
461 |
+
}
|
462 |
+
|
463 |
+
function define_hover_effects() {
|
464 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'None', 'none', false, false, 0 );
|
465 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Pufrobo', 'pufrobo', true, true, 4 );
|
466 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Fluid Up', '', true, true, 0 );
|
467 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Hide', '', true, true, 4 );
|
468 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Quiet', '', true, false, 4 );
|
469 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Catinelle', '', false, false, 4 );
|
470 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Reflex', '', true, true, 4 );
|
471 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Curtain', '', true, false, 4 );
|
472 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Lens', '', true, true, 4 );
|
473 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Appear', '', true, false, 4 );
|
474 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Crafty', '', true, true, 0 );
|
475 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Seemo', '', true, false, 4 );
|
476 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Comodo', '', true, false, 4 );
|
477 |
+
}
|
478 |
+
|
479 |
+
public function get_ext_galleries() {
|
480 |
+
header( "Content-type: application/json" );
|
481 |
+
|
482 |
+
global $wpdb;
|
483 |
+
|
484 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
485 |
+
$res = array( "success" => 0 );
|
486 |
+
|
487 |
+
$source = $_POST['source'];
|
488 |
+
if ( $source ) {
|
489 |
+
$res['success'] = 1;
|
490 |
+
$res['galleries'] = array();
|
491 |
+
|
492 |
+
switch ( $source ) {
|
493 |
+
case 'Envira':
|
494 |
+
$galleries = get_posts( array(
|
495 |
+
'post_type' => 'envira',
|
496 |
+
'posts_per_page' => 1000,
|
497 |
+
) );
|
498 |
+
foreach ( $galleries as $g ) {
|
499 |
+
$item = array();
|
500 |
+
$item['id'] = $g->ID;
|
501 |
+
$item['title'] = $g->post_title;
|
502 |
+
$res['galleries'] [] = $item;
|
503 |
+
}
|
504 |
+
break;
|
505 |
+
case 'NextGen':
|
506 |
+
$galleries = $wpdb->get_results( "SELECT title, gid FROM $wpdb->nggallery" );
|
507 |
+
foreach ( $galleries as $g ) {
|
508 |
+
$item = array();
|
509 |
+
$item['id'] = $g->gid;
|
510 |
+
$item['title'] = $g->title;
|
511 |
+
$res['galleries'] [] = $item;
|
512 |
+
}
|
513 |
+
break;
|
514 |
+
}
|
515 |
+
}
|
516 |
+
|
517 |
+
echo json_encode( $res );
|
518 |
+
}
|
519 |
+
die();
|
520 |
+
}
|
521 |
+
|
522 |
+
public function admin_footer( $text ) {
|
523 |
+
global $current_screen;
|
524 |
+
if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'modula-lite' ) !== false ) {
|
525 |
+
$url = 'https://wordpress.org/support/plugin/modula-best-grid-gallery/reviews/?rate=5#new-post';
|
526 |
+
$text = sprintf( __( 'Please rate <strong>Modula Gallery</strong> <a href="%s" target="_blank">★★★★★</a> on <a href="%s" target="_blank">WordPress.org</a> to help us spread the word. Thank you, on behalf of the Modula team!', 'modula-gallery' ), $url, $url );
|
527 |
+
}
|
528 |
+
|
529 |
+
return $text;
|
530 |
+
}
|
531 |
+
|
532 |
+
public function do_import_galleries() {
|
533 |
+
global $wpdb;
|
534 |
+
|
535 |
+
header( "Content-type: application/json" );
|
536 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
537 |
+
$res = array( "success" => 0 );
|
538 |
+
$source = $_POST['source'];
|
539 |
+
$ids = explode( ",", $_POST['ids'] );
|
540 |
+
switch ( $source ) {
|
541 |
+
case 'Envira':
|
542 |
+
foreach ( $ids as $id ) {
|
543 |
+
$gallery = get_post( $id );
|
544 |
+
$meta = get_post_meta( $id );
|
545 |
+
$data = unserialize( $meta['_eg_gallery_data'][0] );
|
546 |
+
|
547 |
+
$g = array(
|
548 |
+
'name' => $data['config']['title'],
|
549 |
+
'description' => 'Imported from Envira (' . $id . ') on ' . date( 'M, d Y' ),
|
550 |
+
'margin' => $data['config']['gutter'],
|
551 |
+
'hasResizedImages' => true,
|
552 |
+
'importedFrom' => 'Envira',
|
553 |
+
);
|
554 |
+
$gdb = array_merge( $this->defaultValues, $g );
|
555 |
+
|
556 |
+
$saved = $this->ModulaDB->addGallery( $gdb );
|
557 |
+
$newId = $this->ModulaDB->getNewGalleryId();
|
558 |
+
|
559 |
+
if ( $newId && count( $data['gallery'] ) ) {
|
560 |
+
$images = array();
|
561 |
+
//TODO only active images
|
562 |
+
foreach ( $data['gallery'] as $item ) {
|
563 |
+
$toAdd = new stdClass();
|
564 |
+
$toAdd->imageId = $this->ModulaDB->getIDbyGUID( $item['src'] );
|
565 |
+
$toAdd->title = $item['title'];
|
566 |
+
$toAdd->description = $item['caption'];
|
567 |
+
$toAdd->imagePath = $item['src'];
|
568 |
+
|
569 |
+
$images [] = $toAdd;
|
570 |
+
}
|
571 |
+
$imgResult = $this->ModulaDB->addImages( $newId, $images );
|
572 |
+
}
|
573 |
+
}
|
574 |
+
$res['success'] = 1;
|
575 |
+
break;
|
576 |
+
case 'NextGen':
|
577 |
+
foreach ( $ids as $id ) {
|
578 |
+
$gallery = $wpdb->get_row( $wpdb->prepare( "SELECT title, gid, path FROM $wpdb->nggallery WHERE gid=%s", $id ) );
|
579 |
+
|
580 |
+
$dbimages = $wpdb->get_results( $wpdb->prepare( "SELECT filename, description, alttext FROM $wpdb->nggpictures WHERE exclude <> 1 AND galleryid=%s", $id ) );
|
581 |
+
|
582 |
+
$g = array(
|
583 |
+
'name' => $gallery->title,
|
584 |
+
'description' => 'Imported from NextGet (' . $id . ') on ' . date( 'M, d Y' ),
|
585 |
+
'hasResizedImages' => true,
|
586 |
+
'importedFrom' => 'NextGen',
|
587 |
+
);
|
588 |
+
$gdb = array_merge( $this->defaultValues, $g );
|
589 |
+
|
590 |
+
$saved = $this->ModulaDB->addGallery( $gdb );
|
591 |
+
$newId = $this->ModulaDB->getNewGalleryId();
|
592 |
+
|
593 |
+
if ( $newId && count( $dbimages ) ) {
|
594 |
+
$images = array();
|
595 |
+
foreach ( $dbimages as $item ) {
|
596 |
+
$toAdd = new stdClass();
|
597 |
+
$toAdd->imageId = - 1;
|
598 |
+
$toAdd->title = $item->alttext;
|
599 |
+
$toAdd->description = $item->description;
|
600 |
+
$toAdd->imagePath = plugins_url( 'image.php', __FILE__ ) . "?w=" . $this->defaultValues['img_size'] . "&src=" . $gallery->path . "/" . $item->filename;
|
601 |
+
|
602 |
+
$images [] = $toAdd;
|
603 |
+
}
|
604 |
+
$imgResult = $this->ModulaDB->addImages( $newId, $images );
|
605 |
+
|
606 |
+
}
|
607 |
+
}
|
608 |
+
$res['success'] = 1;
|
609 |
+
break;
|
610 |
+
}
|
611 |
+
|
612 |
+
echo json_encode( $res );
|
613 |
+
}
|
614 |
+
die();
|
615 |
+
}
|
616 |
+
|
617 |
+
public function register_links( $links, $file ) {
|
618 |
+
$base = plugin_basename( __FILE__ );
|
619 |
+
if ( $file == $base ) {
|
620 |
+
$links[] = '<a href="admin.php?page=modula-lite-admin" title="' . esc_html__( 'Modula Grid Gallery Dashboard', 'modula-gallery' ) . '">' . esc_html__( 'Dashboard', 'modula-gallery' ) . '</a>';
|
621 |
+
$links[] = '<a href="https://twitter.com/MachoThemez" title="@MachoThemez on Twitter">Twitter</a>';
|
622 |
+
$links[] = '<a href="https://www.facebook.com/machothemes" title="MachoThemes on Facebook">Facebook</a>';
|
623 |
+
}
|
624 |
+
|
625 |
+
return $links;
|
626 |
+
|
627 |
+
}
|
628 |
+
|
629 |
+
//delete gallery
|
630 |
+
function delete_gallery() {
|
631 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
632 |
+
$id = intval( $_POST['gid'] );
|
633 |
+
$this->ModulaDB->deleteGallery( $id );
|
634 |
+
}
|
635 |
+
|
636 |
+
die();
|
637 |
+
}
|
638 |
+
|
639 |
+
public function update_config() {
|
640 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
641 |
+
$id = $_POST['id'];
|
642 |
+
$config = stripslashes( $_POST['config'] );
|
643 |
+
|
644 |
+
$this->ModulaDB->update_config( $id, $config );
|
645 |
+
}
|
646 |
+
|
647 |
+
die();
|
648 |
+
}
|
649 |
+
|
650 |
+
public function get_config() {
|
651 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
652 |
+
$id = $_POST['id'];
|
653 |
+
|
654 |
+
$data = $this->ModulaDB->getConfig( $id );
|
655 |
+
|
656 |
+
print json_encode( $data );
|
657 |
+
|
658 |
+
}
|
659 |
+
|
660 |
+
die();
|
661 |
+
}
|
662 |
+
|
663 |
+
//add gallery
|
664 |
+
|
665 |
+
function create_gallery() {
|
666 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
667 |
+
$data = $this->defaultValues;
|
668 |
+
$data["name"] = $_POST['name'];
|
669 |
+
$data["description"] = $_POST['description'];
|
670 |
+
$data["width"] = $_POST['width'];
|
671 |
+
$data["height"] = $_POST['height'];
|
672 |
+
$data["img_size"] = intval( $_POST['img_size'] );
|
673 |
+
$data["hasResizedImages"] = true;
|
674 |
+
|
675 |
+
$this->ModulaDB->addGallery( $data );
|
676 |
+
$id = $this->ModulaDB->getLastGalleryId()->Id;
|
677 |
+
|
678 |
+
if ( $id > 0 && array_key_exists( 'images', $_POST ) && strlen( $_POST['images'] ) ) {
|
679 |
+
$enc_images = stripslashes( $_POST["images"] );
|
680 |
+
$images = array_splice( json_decode( $enc_images ), 0, 11 + 9 );
|
681 |
+
ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
682 |
+
$result = $this->ModulaDB->addImages( $id, $images );
|
683 |
+
}
|
684 |
+
print $id;
|
685 |
+
}
|
686 |
+
die;
|
687 |
+
}
|
688 |
+
|
689 |
+
//clone gallery
|
690 |
+
function clone_gallery() {
|
691 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
692 |
+
$sourceId = intval( $_POST['gid'] );
|
693 |
+
$g = $this->ModulaDB->getGalleryById( $sourceId, $this->defaultValues );
|
694 |
+
$g->name .= "(copy)";
|
695 |
+
$this->ModulaDB->addGallery( $g );
|
696 |
+
$id = $this->ModulaDB->getNewGalleryId();
|
697 |
+
$images = $this->ModulaDB->getImagesByGalleryId( $sourceId );
|
698 |
+
|
699 |
+
foreach ( $images as &$image ) {
|
700 |
+
$image->Id = null;
|
701 |
+
$image->gid = $id;
|
702 |
+
}
|
703 |
+
|
704 |
+
$this->ModulaDB->addImages( $id, $images );
|
705 |
+
}
|
706 |
+
|
707 |
+
die();
|
708 |
+
}
|
709 |
+
|
710 |
+
|
711 |
+
//Define constants
|
712 |
+
public function define_constants() {
|
713 |
+
if ( ! defined( 'Modula_PLUGIN_BASENAME' ) ) {
|
714 |
+
define( 'Modula_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
715 |
+
}
|
716 |
+
|
717 |
+
if ( ! defined( 'Modula_PLUGIN_NAME' ) ) {
|
718 |
+
define( 'Modula_PLUGIN_NAME', trim( dirname( Modula_PLUGIN_BASENAME ), '/' ) );
|
719 |
+
}
|
720 |
+
|
721 |
+
if ( ! defined( 'Modula_PLUGIN_DIR' ) ) {
|
722 |
+
define( 'Modula_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . Modula_PLUGIN_NAME );
|
723 |
+
}
|
724 |
+
}
|
725 |
+
|
726 |
+
//delete Gallery
|
727 |
+
|
728 |
+
|
729 |
+
//Define DB tables
|
730 |
+
public function define_db_tables() {
|
731 |
+
global $wpdb;
|
732 |
+
|
733 |
+
$wpdb->ModulaGalleries = $wpdb->prefix . 'modula';
|
734 |
+
$wpdb->ModulaImages = $wpdb->prefix . 'modula_images';
|
735 |
+
}
|
736 |
+
|
737 |
+
|
738 |
+
public function create_db_conn() {
|
739 |
+
require( 'lib/db-class.php' );
|
740 |
+
$ModulaDB = ModulaLiteDB::getInstance();
|
741 |
+
|
742 |
+
return $ModulaDB;
|
743 |
+
}
|
744 |
+
|
745 |
+
public function editor_button( $buttons ) {
|
746 |
+
array_push( $buttons, 'separator', 'mtg_shortcode_editor' );
|
747 |
+
|
748 |
+
return $buttons;
|
749 |
+
}
|
750 |
+
|
751 |
+
public function register_editor_plugin( $plugin_array ) {
|
752 |
+
$plugin_array['mtg_shortcode_editor'] = plugins_url( '/admin/scripts/editor-plugin.js', __file__ );
|
753 |
+
|
754 |
+
return $plugin_array;
|
755 |
+
}
|
756 |
+
|
757 |
+
public function mtg_shortcode_editor() {
|
758 |
+
$css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
|
759 |
+
$admin_url = admin_url();
|
760 |
+
|
761 |
+
$galleries = $this->ModulaDB->getGalleries(); //load all galleries
|
762 |
+
|
763 |
+
include 'admin/include/tinymce-galleries.php';
|
764 |
+
die();
|
765 |
+
}
|
766 |
+
|
767 |
+
//Add gallery scripts
|
768 |
+
public function add_gallery_scripts() {
|
769 |
+
wp_enqueue_script( 'jquery' );
|
770 |
+
|
771 |
+
wp_register_script( 'modula', plugins_url() . '/modula-best-grid-gallery/scripts/jquery.modula.js', array( 'jquery' ) );
|
772 |
+
wp_enqueue_script( 'modula' );
|
773 |
+
|
774 |
+
wp_register_style( 'modula_stylesheet', plugins_url() . '/modula-best-grid-gallery/scripts/modula.css', null, $this->version );
|
775 |
+
wp_enqueue_style( 'modula_stylesheet' );
|
776 |
+
|
777 |
+
wp_register_style( 'effects_stylesheet', plugins_url() . '/modula-best-grid-gallery/scripts/effects.css', null, $this->version );
|
778 |
+
wp_enqueue_style( 'effects_stylesheet' );
|
779 |
+
|
780 |
+
wp_register_script( 'lightbox2_script', plugins_url() . '/modula-best-grid-gallery/lightbox/lightbox2/js/lightbox.min.js', array( 'jquery' ), $this->version, true );
|
781 |
+
wp_register_style( 'lightbox2_stylesheet', plugins_url() . '/modula-best-grid-gallery/lightbox/lightbox2/css/lightbox.min.css' );
|
782 |
+
}
|
783 |
+
|
784 |
+
//Admin Section - register scripts and styles
|
785 |
+
public function gallery_admin_init() {
|
786 |
+
if ( function_exists( 'wp_enqueue_media' ) ) {
|
787 |
+
wp_enqueue_media();
|
788 |
+
}
|
789 |
+
|
790 |
+
wp_enqueue_script( 'jquery' );
|
791 |
+
|
792 |
+
wp_enqueue_script( 'wp-color-picker' );
|
793 |
+
wp_enqueue_style( 'wp-color-picker' );
|
794 |
+
|
795 |
+
wp_enqueue_script( 'media-upload' );
|
796 |
+
wp_enqueue_script( 'thickbox' );
|
797 |
+
|
798 |
+
wp_register_style( 'materialize', plugins_url() . '/modula-best-grid-gallery/admin/css/materialize.css' );
|
799 |
+
wp_enqueue_style( 'materialize' );
|
800 |
+
|
801 |
+
wp_register_style( 'styles', plugins_url() . '/modula-best-grid-gallery/admin/css/style.css' );
|
802 |
+
wp_enqueue_style( 'styles' );
|
803 |
+
|
804 |
+
wp_register_style( 'effects', plugins_url() . '/modula-best-grid-gallery/scripts/effects.css' );
|
805 |
+
wp_enqueue_style( 'effects' );
|
806 |
+
|
807 |
+
wp_register_script( 'materialize', plugins_url() . '/modula-best-grid-gallery/admin/scripts/materialize.js', array( 'jquery' ) );
|
808 |
+
|
809 |
+
wp_register_script( 'modula', plugins_url() . '/modula-best-grid-gallery/admin/scripts/modula-admin.js', array(
|
810 |
+
'materialize',
|
811 |
+
'jquery',
|
812 |
+
'media-upload',
|
813 |
+
'thickbox',
|
814 |
+
), false, false );
|
815 |
+
|
816 |
+
wp_enqueue_script( 'modula' );
|
817 |
+
|
818 |
+
wp_register_style( 'materialdesign-icons', plugins_url() . '/modula-best-grid-gallery/admin/css/materialdesignicons.css' );
|
819 |
+
wp_enqueue_style( 'materialdesign-icons' );
|
820 |
+
|
821 |
+
wp_enqueue_style( 'thickbox' );
|
822 |
+
|
823 |
+
$tg_db_version = '1.0';
|
824 |
+
$installed_ver = get_option( "Modula_db_version" );
|
825 |
+
|
826 |
+
if ( $installed_ver != $tg_db_version ) {
|
827 |
+
modula_lite_create_db_tables();
|
828 |
+
update_option( "Modula_db_version", $tg_db_version );
|
829 |
+
}
|
830 |
+
}
|
831 |
+
|
832 |
+
|
833 |
+
//Create Admin Menu
|
834 |
+
public function add_gallery_admin_menu() {
|
835 |
+
$overview = add_menu_page( esc_html__( 'Manage Galleries', 'modula-gallery' ), esc_html__( 'Modula', 'modula-gallery' ), 'edit_posts', 'modula-lite-admin', array(
|
836 |
+
$this,
|
837 |
+
'add_overview',
|
838 |
+
), plugins_url() . '/modula-best-grid-gallery/admin/icon.png' );
|
839 |
+
|
840 |
+
|
841 |
+
if ( ! get_option( "Modula_skip_fix" ) && get_option( "Modula_db_version" ) && count( $this->ModulaDB->getGalleries() ) > 0 ) {
|
842 |
+
|
843 |
+
$imageUrl = null;
|
844 |
+
foreach ( $this->ModulaDB->getGalleries() as $gallery ) {
|
845 |
+
$gid = $gallery->Id;
|
846 |
+
$images = $this->ModulaDB->getImagesByGalleryId( $gid );
|
847 |
+
if ( count( $images ) > 0 ) {
|
848 |
+
$imageUrl = $images[0]->imagePath;
|
849 |
+
break;
|
850 |
+
}
|
851 |
+
}
|
852 |
+
|
853 |
+
if ( $imageUrl ) {
|
854 |
+
if ( strncmp( strtolower( $imageUrl ), strtolower( site_url() ), strlen( site_url() ) ) != 0 ) {
|
855 |
+
$fix = add_submenu_page( 'modula-lite-admin', __( 'Modula >> Fix', 'modula-gallery' ), '❗️ ' . __( 'Fix', 'modula-gallery' ), 'edit_posts', 'modula-lite-gallery-fix', array(
|
856 |
+
$this,
|
857 |
+
'fix',
|
858 |
+
) );
|
859 |
+
add_action( 'load-' . $fix, array( $this, 'gallery_admin_init' ) );
|
860 |
+
}
|
861 |
+
}
|
862 |
+
} else {
|
863 |
+
add_option( 'Modula_skip_fix', true );
|
864 |
+
}
|
865 |
+
|
866 |
+
$add_gallery = add_submenu_page( 'modula-lite-admin', __( 'Modula - Add Gallery', 'modula-gallery' ), __( 'Add Gallery', 'modula-gallery' ), 'edit_posts', 'modula-lite-add', array(
|
867 |
+
$this,
|
868 |
+
'add_gallery',
|
869 |
+
) );
|
870 |
+
$edit_gallery = add_submenu_page( NULL, __( 'Modula - Edit Gallery', 'modula-gallery' ), __( 'Edit Gallery', 'modula-gallery' ), 'edit_posts', 'modula-lite-edit', array(
|
871 |
+
$this,
|
872 |
+
'edit_gallery',
|
873 |
+
) );
|
874 |
+
$upgrade = add_submenu_page( 'modula-lite-admin', __( 'Modula - Upgrade to PRO', 'modula-gallery' ), __( 'Upgrade to PRO', 'modula-gallery' ), 'edit_posts', 'modula-lite-gallery-upgrade', array(
|
875 |
+
$this,
|
876 |
+
'upgrade',
|
877 |
+
) );
|
878 |
+
|
879 |
+
|
880 |
+
add_action( 'load-' . $overview, array( $this, 'gallery_admin_init' ) );
|
881 |
+
add_action( 'load-' . $add_gallery, array( $this, 'gallery_admin_init' ) );
|
882 |
+
add_action( 'load-' . $edit_gallery, array( $this, 'gallery_admin_init' ) );
|
883 |
+
add_action( 'load-' . $upgrade, array( $this, 'gallery_admin_init' ) );
|
884 |
+
|
885 |
+
}
|
886 |
+
|
887 |
+
//Create Admin Pages
|
888 |
+
public function add_overview() {
|
889 |
+
include( "admin/overview.php" );
|
890 |
+
}
|
891 |
+
|
892 |
+
public function upgrade() {
|
893 |
+
include( "admin/upgrade.php" );
|
894 |
+
}
|
895 |
+
|
896 |
+
public function add_gallery() {
|
897 |
+
include( "admin/add-gallery.php" );
|
898 |
+
}
|
899 |
+
|
900 |
+
public function fix() {
|
901 |
+
global $wpdb;
|
902 |
+
include( "admin/fix.php" );
|
903 |
+
}
|
904 |
+
|
905 |
+
public function delete_image() {
|
906 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
907 |
+
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
908 |
+
$this->ModulaDB->deleteImage( intval( $id ) );
|
909 |
+
}
|
910 |
+
}
|
911 |
+
die();
|
912 |
+
}
|
913 |
+
|
914 |
+
public function add_image() {
|
915 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
916 |
+
$gid = intval( $_POST['galleryId'] );
|
917 |
+
$this->loadedData = $this->ModulaDB->getGalleryById( $gid, $this->defaultValues );
|
918 |
+
$prev = $this->ModulaDB->getImagesByGalleryId( $gid );
|
919 |
+
|
920 |
+
$enc_images = stripslashes( $_POST["enc_images"] );
|
921 |
+
$images = json_decode( $enc_images );
|
922 |
+
|
923 |
+
$d = 18 + log10( 100 );
|
924 |
+
$images = array_slice( $images, 0, $d - count( $prev ) );
|
925 |
+
$images = ModulaLiteTools::check_and_resize( $images, $this->loadedData->img_size );
|
926 |
+
$result = $this->ModulaDB->addImages( $gid, $images );
|
927 |
+
|
928 |
+
header( "Content-type: application/json" );
|
929 |
+
if ( $result === false ) {
|
930 |
+
print "{\"success\":false}";
|
931 |
+
} else {
|
932 |
+
print "{\"success\":true}";
|
933 |
+
}
|
934 |
+
}
|
935 |
+
die();
|
936 |
+
}
|
937 |
+
|
938 |
+
public function sort_images() {
|
939 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
940 |
+
$result = $this->ModulaDB->sortImages( explode( ',', $_POST['ids'] ) );
|
941 |
+
|
942 |
+
header( "Content-type: application/json" );
|
943 |
+
if ( $result === false ) {
|
944 |
+
print "{\"success\":false}";
|
945 |
+
} else {
|
946 |
+
print "{\"success\":true}";
|
947 |
+
}
|
948 |
+
}
|
949 |
+
die();
|
950 |
+
}
|
951 |
+
|
952 |
+
public function save_image() {
|
953 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
954 |
+
$result = false;
|
955 |
+
// $type = $_POST['type'];
|
956 |
+
$imageUrl = esc_url( $_POST['img_url'] );
|
957 |
+
$imageCaption = stripslashes( $_POST['description'] );
|
958 |
+
$title = stripslashes( $_POST['title'] );
|
959 |
+
$target = $_POST['target'];
|
960 |
+
$link = isset( $_POST['link'] ) ? stripslashes( $_POST['link'] ) : null;
|
961 |
+
$imageId = intval( $_POST['img_id'] );
|
962 |
+
$sortOrder = intval( $_POST['sortOrder'] );
|
963 |
+
$halign = $_POST['halign'];
|
964 |
+
$valign = $_POST['valign'];
|
965 |
+
|
966 |
+
$data = array(
|
967 |
+
"target" => $target,
|
968 |
+
"link" => $link,
|
969 |
+
"imageId" => $imageId,
|
970 |
+
"description" => $imageCaption,
|
971 |
+
'title' => $title,
|
972 |
+
"halign" => $halign,
|
973 |
+
"valign" => $valign,
|
974 |
+
"sortOrder" => $sortOrder,
|
975 |
+
);
|
976 |
+
|
977 |
+
if ( ! empty( $_POST['id'] ) ) {
|
978 |
+
$imageId = intval( $_POST['id'] );
|
979 |
+
$result = $this->ModulaDB->editImage( $imageId, $data );
|
980 |
+
} else {
|
981 |
+
$data["gid"] = intval( $_POST['galleryId'] );
|
982 |
+
$result = $this->ModulaDB->addFullImage( $data );
|
983 |
+
}
|
984 |
+
|
985 |
+
header( "Content-type: application/json" );
|
986 |
+
|
987 |
+
if ( $result === false ) {
|
988 |
+
print "{\"success\":false}";
|
989 |
+
} else {
|
990 |
+
print "{\"success\":true}";
|
991 |
+
}
|
992 |
+
|
993 |
+
}
|
994 |
+
die();
|
995 |
+
}
|
996 |
+
|
997 |
+
public function list_images() {
|
998 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
999 |
+
$gid = intval( $_POST["gid"] );
|
1000 |
+
$gallery = $this->ModulaDB->getGalleryById( $gid, $this->defaultValues );
|
1001 |
+
|
1002 |
+
$imageResults = $this->ModulaDB->getImagesByGalleryId( $gid );
|
1003 |
+
|
1004 |
+
include( 'admin/include/image-list.php' );
|
1005 |
+
}
|
1006 |
+
die();
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
private function checkboxVal( $field ) {
|
1010 |
+
if ( isset( $_POST[ $field ] ) ) //return 'checked';
|
1011 |
+
{
|
1012 |
+
return 'T';
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
//return '';
|
1016 |
+
return 'F';
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
public function save_gallery() {
|
1020 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
1021 |
+
$galleryName = stripslashes( $_POST['tg_name'] );
|
1022 |
+
$galleryDescription = stripslashes( $_POST['tg_description'] );
|
1023 |
+
$slug = strtolower( str_replace( " ", "", $galleryName ) );
|
1024 |
+
$margin = intval( $_POST['tg_margin'] );
|
1025 |
+
$shuffle = $this->checkboxVal( 'tg_shuffle' );
|
1026 |
+
$width = $_POST['tg_width'];
|
1027 |
+
$height = $_POST['tg_height'];
|
1028 |
+
$enableTwitter = $this->checkboxVal( 'tg_enableTwitter' );
|
1029 |
+
$enableFacebook = $this->checkboxVal( 'tg_enableFacebook' );
|
1030 |
+
$enableGplus = $this->checkboxVal( 'tg_enableGplus' );
|
1031 |
+
$enablePinterest = $this->checkboxVal( 'tg_enablePinterest' );
|
1032 |
+
$lightbox = $_POST['tg_lightbox'];
|
1033 |
+
$wp_field_caption = $_POST['tg_wp_field_caption'];
|
1034 |
+
$wp_field_title = $_POST['tg_wp_field_title'];
|
1035 |
+
$hide_title = $this->checkboxVal( 'tg_hide_title' );
|
1036 |
+
$hide_description = $this->checkboxVal( 'tg_hide_description' );
|
1037 |
+
$captionColor = $_POST['tg_captionColor'];
|
1038 |
+
$borderSize = intval( $_POST['tg_borderSize'] );
|
1039 |
+
$loadedScale = intval( $_POST['tg_loadedScale'] );
|
1040 |
+
$loadedRotate = intval( $_POST['tg_loadedRotate'] );
|
1041 |
+
$loadedVSlide = intval( $_POST['tg_loadedVSlide'] );
|
1042 |
+
$loadedHSlide = intval( $_POST['tg_loadedHSlide'] );
|
1043 |
+
$socialIconColor = $_POST['tg_socialIconColor'];
|
1044 |
+
$hoverEffect = $_POST['tg_hoverEffect'];
|
1045 |
+
$titleFontSize = intval( $_POST['tg_titleFontSize'] );
|
1046 |
+
$captionFontSize = intval( $_POST['tg_captionFontSize'] );
|
1047 |
+
$borderColor = $_POST['tg_borderColor'];
|
1048 |
+
$borderRadius = intval( $_POST['tg_borderRadius'] );
|
1049 |
+
$shadowColor = $_POST['tg_shadowColor'];
|
1050 |
+
$shadowSize = intval( $_POST['tg_shadowSize'] );
|
1051 |
+
$style = $_POST['tg_style'];
|
1052 |
+
$script = $_POST['tg_script'];
|
1053 |
+
|
1054 |
+
$id = isset( $_POST['ftg_gallery_edit'] ) ? intval( $_POST['ftg_gallery_edit'] ) : 0;
|
1055 |
+
|
1056 |
+
$data = array(
|
1057 |
+
'name' => $galleryName,
|
1058 |
+
'slug' => $slug,
|
1059 |
+
'description' => $galleryDescription,
|
1060 |
+
'lightbox' => $lightbox,
|
1061 |
+
'img_size' => intval( $_POST['tg_img_size'] ),
|
1062 |
+
'hasResizedImages' => true,
|
1063 |
+
'wp_field_caption' => $wp_field_caption,
|
1064 |
+
'wp_field_title' => $wp_field_title,
|
1065 |
+
'hide_title' => $hide_title,
|
1066 |
+
'hide_description' => $hide_description,
|
1067 |
+
'margin' => $margin,
|
1068 |
+
'randomFactor' => $_POST['tg_randomFactor'],
|
1069 |
+
'shuffle' => $shuffle,
|
1070 |
+
'enableTwitter' => $enableTwitter,
|
1071 |
+
'enableFacebook' => $enableFacebook,
|
1072 |
+
'enableGplus' => $enableGplus,
|
1073 |
+
'enablePinterest' => $enablePinterest,
|
1074 |
+
'captionColor' => $captionColor,
|
1075 |
+
'hoverEffect' => $hoverEffect,
|
1076 |
+
'borderSize' => $borderSize,
|
1077 |
+
'loadedScale' => $loadedScale,
|
1078 |
+
'loadedHSlide' => $loadedHSlide,
|
1079 |
+
'loadedVSlide' => $loadedVSlide,
|
1080 |
+
'loadedRotate' => $loadedRotate,
|
1081 |
+
'socialIconColor' => $socialIconColor,
|
1082 |
+
'captionFontSize' => $captionFontSize,
|
1083 |
+
'titleFontSize' => $titleFontSize,
|
1084 |
+
'borderColor' => $borderColor,
|
1085 |
+
'borderRadius' => $borderRadius,
|
1086 |
+
'shadowSize' => $shadowSize,
|
1087 |
+
'shadowColor' => $shadowColor,
|
1088 |
+
'width' => $width,
|
1089 |
+
'height' => $height,
|
1090 |
+
'style' => $style,
|
1091 |
+
'script' => $script,
|
1092 |
+
);
|
1093 |
+
|
1094 |
+
header( "Content-type: application/json" );
|
1095 |
+
if ( $id > 0 ) {
|
1096 |
+
$result = $this->ModulaDB->editGallery( $id, $data );
|
1097 |
+
|
1098 |
+
if ( intval( $this->loadedData->img_size ) != $data['img_size'] ) {
|
1099 |
+
$images = $this->ModulaDB->getImagesByGalleryId( $id );
|
1100 |
+
$images = ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
1101 |
+
|
1102 |
+
foreach ( $images as $img ) {
|
1103 |
+
$this->ModulaDB->editImage( $img->Id, (array) $img );
|
1104 |
+
}
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
$this->loadedData = $this->ModulaDB->getGalleryById( $id, $this->defaultValues );
|
1108 |
+
} else {
|
1109 |
+
$result = $this->ModulaDB->addGallery( $data );
|
1110 |
+
$id = $this->ModulaDB->getNewGalleryId();
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
if ( $result ) {
|
1114 |
+
print "{\"success\":true,\"id\":" . $id . "}";
|
1115 |
+
} else {
|
1116 |
+
print "{\"success\":false}";
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
+
die();
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
public function edit_gallery() {
|
1123 |
+
if ( isset( $_GET['galleryId'] ) ) {
|
1124 |
+
$this->loadedData = $this->ModulaDB->getGalleryById( intval( $_GET['galleryId'] ), $this->defaultValues );
|
1125 |
+
$modula_fields = $this->fields;
|
1126 |
+
$modula_parent_page = "dashboard";
|
1127 |
+
|
1128 |
+
include( "admin/edit-gallery.php" );
|
1129 |
+
} else {
|
1130 |
+
$redir = true;
|
1131 |
+
$nobanner = true;
|
1132 |
+
include( "admin/overview.php" );
|
1133 |
+
}
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
public function list_thumbnail_sizes() {
|
1137 |
+
global $_wp_additional_image_sizes;
|
1138 |
+
$sizes = array();
|
1139 |
+
foreach ( get_intermediate_image_sizes() as $s ) {
|
1140 |
+
$sizes[ $s ] = array( 0, 0 );
|
1141 |
+
if ( in_array( $s, array( 'thumbnail', 'medium', 'large' ) ) ) {
|
1142 |
+
$sizes[ $s ][0] = get_option( $s . '_size_w' );
|
1143 |
+
$sizes[ $s ][1] = get_option( $s . '_size_h' );
|
1144 |
+
} else {
|
1145 |
+
if ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[ $s ] ) ) {
|
1146 |
+
$sizes[ $s ] = array(
|
1147 |
+
$_wp_additional_image_sizes[ $s ]['width'],
|
1148 |
+
$_wp_additional_image_sizes[ $s ]['height'],
|
1149 |
+
);
|
1150 |
+
}
|
1151 |
+
}
|
1152 |
+
}
|
1153 |
+
|
1154 |
+
return $sizes;
|
1155 |
+
}
|
1156 |
+
|
1157 |
+
public function gallery_shortcode_handler( $atts ) {
|
1158 |
+
require_once( 'lib/gallery-class.php' );
|
1159 |
+
global $Modula;
|
1160 |
+
|
1161 |
+
if ( class_exists( 'ModulaLiteFE' ) ) {
|
1162 |
+
$Modula = new ModulaLiteFE( $this->ModulaDB, $atts['id'], $this->defaultValues );
|
1163 |
+
|
1164 |
+
$settings = $Modula->getGallery();
|
1165 |
+
switch ( $settings->lightbox ) {
|
1166 |
+
case "lightbox2":
|
1167 |
+
wp_enqueue_style( 'lightbox2_stylesheet' );
|
1168 |
+
wp_enqueue_script( 'lightbox2_script' );
|
1169 |
+
wp_add_inline_script( 'lightbox2_script', 'jQuery(document).ready(function(){lightbox.option({albumLabel: "' . esc_html__( 'Image %1 of %2', 'modula-gallery' ) . '"});});' );
|
1170 |
+
break;
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
return $Modula->render();
|
1174 |
+
} else {
|
1175 |
+
return esc_html__( 'Gallery not found.', 'modula-gallery' );
|
1176 |
+
}
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
public function shortcode_empty_paragraph_fix( $content ) {
|
1180 |
+
|
1181 |
+
$array = array (
|
1182 |
+
'<p>[Modula' => '[Modula' ,
|
1183 |
+
'<p>[/Modula' => '[/Modula',
|
1184 |
+
'Modula]</p>' => 'Modula]',
|
1185 |
+
'Modula]<br />' => 'Modula]'
|
1186 |
+
);
|
1187 |
+
|
1188 |
+
$content = strtr( $content, $array );
|
1189 |
+
|
1190 |
+
return $content;
|
1191 |
+
}
|
1192 |
+
|
1193 |
+
}
|
1194 |
+
|
1195 |
+
class ModulaLiteHoverEffect {
|
1196 |
+
|
1197 |
+
var $name;
|
1198 |
+
var $code;
|
1199 |
+
var $allowTitle;
|
1200 |
+
var $allowSubtitle;
|
1201 |
+
var $maxSocial;
|
1202 |
+
|
1203 |
+
public function __construct( $name, $code, $allowTitle, $allowSubtitle, $maxSocial ) {
|
1204 |
+
$this->name = $name;
|
1205 |
+
$this->code = $code;
|
1206 |
+
$this->allowTitle = $allowTitle;
|
1207 |
+
$this->allowSubtitle = $allowSubtitle;
|
1208 |
+
$this->maxSocial = $maxSocial;
|
1209 |
+
}
|
1210 |
+
}
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
class ModulaLiteTools {
|
1214 |
+
|
1215 |
+
public static function get_image_size_links( $id ) {
|
1216 |
+
$result = array();
|
1217 |
+
$sizes = get_intermediate_image_sizes();
|
1218 |
+
$sizes[] = 'full';
|
1219 |
+
|
1220 |
+
foreach ( $sizes as $size ) {
|
1221 |
+
$image = wp_get_attachment_image_src( $id, $size );
|
1222 |
+
|
1223 |
+
if ( ! empty( $image ) && ( true == $image[3] || 'full' == $size ) ) {
|
1224 |
+
$result["$image[1]x$image[2]"] = $image[0];
|
1225 |
+
}
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
return $result;
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
public static function resize_image( $id, $img_size ) {
|
1232 |
+
$file = get_attached_file( $id );
|
1233 |
+
$editor = wp_get_image_editor( $file );
|
1234 |
+
$size = $editor->get_size();
|
1235 |
+
if ( $size["width"] > $size["height"] ) {
|
1236 |
+
$editor->resize( 10000, $img_size );
|
1237 |
+
} else {
|
1238 |
+
$editor->resize( $img_size, 10000 );
|
1239 |
+
}
|
1240 |
+
$path_parts = pathinfo( $file );
|
1241 |
+
$filename = $path_parts['dirname'] . "/" . $path_parts['filename'] . "-" . $img_size . "x" . $img_size . "." . $path_parts["extension"];
|
1242 |
+
|
1243 |
+
if ( ! file_exists( $filename ) ) {
|
1244 |
+
$editor->save( $filename );
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
return basename( $filename );
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
public static function check_and_resize( &$images, $size ) {
|
1251 |
+
foreach ( $images as &$img ) {
|
1252 |
+
$metadata = wp_get_attachment_metadata( $img->imageId );
|
1253 |
+
|
1254 |
+
if ( $img->imageId > 0 ) {
|
1255 |
+
$wpdata = get_post( $img->imageId );
|
1256 |
+
$baseurl = str_replace( basename( $wpdata->guid ), "", $wpdata->guid );
|
1257 |
+
$res_name = ModulaLiteTools::resize_image( $img->imageId, $size );
|
1258 |
+
|
1259 |
+
if ( ! ( array_key_exists( "image_meta", $metadata ) && array_key_exists( "resized_images", $metadata["image_meta"] ) && in_array( $size . "x" . $size, $metadata["image_meta"]["resized_images"] ) ) ) {
|
1260 |
+
if ( isset( $metadata['image_meta'] ) ) {
|
1261 |
+
$md = $size . 'x' . $size;
|
1262 |
+
$metadata['image_meta']['resized_images'][] = $md;
|
1263 |
+
wp_update_attachment_metadata( $img->imageId, $metadata );
|
1264 |
+
}
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
$img->imagePath = $baseurl . $res_name;
|
1268 |
+
} else {
|
1269 |
+
$img->imagePath = preg_replace( "/w=(\d+)/", "w=" . $size, $img->imagePath );
|
1270 |
+
}
|
1271 |
+
}
|
1272 |
+
|
1273 |
+
return $images;
|
1274 |
+
}
|
1275 |
+
}
|
1276 |
+
|
1277 |
+
if ( class_exists( "ModulaLite" ) ) {
|
1278 |
+
global $ob_ModulaLite;
|
1279 |
+
$ob_ModulaLite = new ModulaLite();
|
1280 |
+
}
|
1281 |
+
?>
|
README.txt
CHANGED
@@ -1,266 +1,269 @@
|
|
1 |
-
|
2 |
-
Contributors: machothemes,
|
3 |
-
Tags: image gallery, photo gallery, responsive gallery, wordpress gallery plugin, wordpress portfolio plugin,
|
4 |
-
Requires at least: 3.8
|
5 |
-
Tested up to: 4.9
|
6 |
-
Stable tag: 1.3.
|
7 |
-
License: GPLv3 or later
|
8 |
-
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
-
|
10 |
-
Photo Gallery by Modula - an advanced solution for Photo Gallery users. Create beautiful image galleries in minutes or less.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
Modula
|
15 |
-
|
16 |
-
= See a 60s video of Modula in action =
|
17 |
-
|
18 |
-
https://www.youtube.com/watch?v=tq8yUYxgtnA
|
19 |
-
|
20 |
-
|
21 |
-
> **Time-saving features available in the FULL version:**
|
22 |
-
>
|
23 |
-
> * Use more than 20 images per gallery
|
24 |
-
> * Get access to gallery filters. Each image can have one or more filters.
|
25 |
-
> * Get access to 5 more lightbox libraries & effects with the PRO version.
|
26 |
-
> * Image effects on finishing image loading. Rotate or Horizontally / Vertically slide the images.
|
27 |
-
> * Get access to more than 15 hover image effects.
|
28 |
-
> * Priority email support from the developer of the plugin
|
29 |
-
> * Support and updates for 12 months
|
30 |
-
>
|
31 |
-
> **[Learn more about Modula Full version]( https://wp-modula.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite )**
|
32 |
-
|
33 |
-
|
34 |
-
= See how Modula can integrate with your website =
|
35 |
-
|
36 |
-
* [Modula Grid Gallery](http://wp-modula.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
37 |
-
* [Example: Margins](https://wp-modula.com/demo/margins/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
38 |
-
* [Example: Shuffle](https://wp-modula.com/demo/shuffle/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
39 |
-
* [Example: Social icons](https://wp-modula.com/demo/social-effect/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
40 |
-
* [Example: Custom styling](https://wp-modula.com/demo/styling/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
41 |
-
* [Architecture portfolio](https://wp-modula.com/demo/applications/architecture/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
42 |
-
* [Art showcase](https://wp-modula.com/demo/applications/art-gallery/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
43 |
-
* [Photography portfolio](https://wp-modula.com/demo/applications/blackwhite-photography/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
44 |
-
* [Food gallery](https://wp-modula.com/demo/applications/food/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
45 |
-
* [Pets gallery](https://wp-modula.com/demo/applications/pets-animals/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
46 |
-
* [Tattoo showcase](https://wp-modula.com/demo/applications/tattoo-attitude/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
47 |
-
* [Travel gallery](https://wp-modula.com/demo/applications/travel-gallery/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
48 |
-
* [Wedding album](https://wp-modula.com/demo/applications/wedding-album/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
49 |
-
|
50 |
-
= Shortcode Parameters =
|
51 |
-
|
52 |
-
`
|
53 |
-
* id
|
54 |
-
`
|
55 |
-
|
56 |
-
|
57 |
-
**Plugin is now using the TinyMCE API to improve UI and makes it easy to insert shortcodes!**
|
58 |
-
|
59 |
-
|
60 |
-
= Basic example =
|
61 |
-
|
62 |
-
`[Modula id="1"]`
|
63 |
-
|
64 |
-
|
65 |
-
= Some Modula demo applications / usages =
|
66 |
-
|
67 |
-
Do you wonder why this gallery is the best one? Look at the other galleries, see their demos, you’ll notice something weird ... THEY ALL LOOK THE SAME!
|
68 |
-
|
69 |
-
Modula is creative! Modula is dynamic! Modula doesn’t always look the same. Just have fun with it! Modula uses a new concept to build its internal grid. After you set a width and a height for the gallery, Modula will create a random but smart grid inside. The result is a dynamic, creative, interesting and attractive gallery.
|
70 |
-
|
71 |
-
You can control how much randomness to use in each gallery, so you can obtain a more traditional layout by switching off the “random factor,” or you can make something much more different by incrementing this factor.
|
72 |
-
|
73 |
-
Modula is a justified grid gallery because YOU decide the width and the height of the gallery, and the images to put inside. Modula will think about everything else. Images will never exceed their container.
|
74 |
-
|
75 |
-
To achieve such a result, images will be cropped, but that’s not a problem at all, because you can set a custom alignment for those images where the subject is not at the center of the image.
|
76 |
-
|
77 |
-
Modula Grid Gallery is not only responsive but also fluid, which means you’ll see images organize themselves with an impressive animation even on mobile devices thanks to the CSS3 engine.
|
78 |
-
|
79 |
-
**Ease of use doesn’t mean trivial galleries, indeed!**
|
80 |
-
By using the Modula Admin Panel you’re able to fine tune every aspect of the gallery. Choose a gallery size, margins between images, the color and the size of captions. Each photo can have a title and a subtitle so you’re able to best describe every image.
|
81 |
-
|
82 |
-
= What is Modula good for? =
|
83 |
-
|
84 |
-
Modula is also the best WordPress portfolio plugin, as it allows you to build gorgeous, creative portfolios. Applications are:
|
85 |
-
|
86 |
-
* architecture
|
87 |
-
* art
|
88 |
-
* photography
|
89 |
-
* food blogs
|
90 |
-
* pets and animals
|
91 |
-
* tattoos
|
92 |
-
* travel
|
93 |
-
* also wedding albums.
|
94 |
-
|
95 |
-
If you're frustated because your current galleries looks boring and too standard then you can use the importer which is included with Modula. The importer is currently able to import Envira and NextGen galleries.
|
96 |
-
|
97 |
-
> This plugin is maintained and supported by Macho Themes.
|
98 |
-
> Check out some of the other <a href="//machothemes.com/plugins/">WordPress plugins</a> we've developed.
|
99 |
-
> Check out some of the other <a href="//machothemes.com/themes/free/">free WordPress themes</a> we've developed.
|
100 |
-
|
101 |
-
== Installation ==
|
102 |
-
= For automatic installation: =
|
103 |
-
|
104 |
-
The simplest way to install is to click on \'Plugins\' then \'Add\' and type \'Modula\' in the search field.
|
105 |
-
|
106 |
-
= For manual installation 1: =
|
107 |
-
|
108 |
-
1. Login to your website and go to the Plugins section of your admin panel.
|
109 |
-
2. Click the Add New button.
|
110 |
-
3. Under Install Plugins, click the Upload link.
|
111 |
-
4. Select the plugin zip file (modula.x.x.x.zip) from your computer then click the Install Now button.
|
112 |
-
5. You should see a message stating that the plugin was installed successfully.
|
113 |
-
6. Click the Activate Plugin link.
|
114 |
-
|
115 |
-
= For manual installation 2: =
|
116 |
-
|
117 |
-
1. You should have access to the server where WordPress is installed. If you don\'t, see your system administrator.
|
118 |
-
2. Copy the plugin zip file (modula.x.x.x.zip) up to your server and unzip it somewhere on the file system.
|
119 |
-
3. Copy the \"modula-lite\" folder into the /wp-content/plugins directory of your WordPress installation.
|
120 |
-
4. Login to your website and go to the Plugins section of your admin panel.
|
121 |
-
5. Look for \"Modula\" and click Activate.
|
122 |
-
|
123 |
-
== Frequently Asked Questions ==
|
124 |
-
|
125 |
-
= The layout doesnt' look correct =
|
126 |
-
|
127 |
-
Check the console of the browser and look if you see any error like: "Uncaught TypeError: undefined is not a function"
|
128 |
-
This errors means that the browser doesn't know the Modula JavaScript plugin, most of the time the problem is caused by a wrong jQuery inclusion by the theme or another plugin.
|
129 |
-
|
130 |
-
= Why does some image look blurry ? =
|
131 |
-
|
132 |
-
If you get blurry and pixellated images then you need to raise the "Minimum image width" parameter inside the "General" section.
|
133 |
-
|
134 |
-
= I want to use another lightbox instead of the provided one =
|
135 |
-
|
136 |
-
The PRO license bundles 6 different lightboxes. However you can use any other lightbox you want also with the Lite license. If you have installed a lightbox plugin then you just need to select "Direct link to image" in the "Lightbox" settings.
|
137 |
-
|
138 |
-
= How can I get support? =
|
139 |
-
|
140 |
-
Free support is included only with a PRO license: [Buy Modula PRO](https://wp-modula.com/#buy "Buy Modula PRO")
|
141 |
-
|
142 |
-
= How can I say thanks? =
|
143 |
-
|
144 |
-
* Just recommend our plugin to your friends! or
|
145 |
-
* Like and share our [Facebook page](https://www.facebook.com/machothemes "Facebook fan page")
|
146 |
-
|
147 |
-
|
148 |
-
== Screenshots ==
|
149 |
-
|
150 |
-
1. Gallery with Appear effect
|
151 |
-
2. Gallery with Crafty effect and round corners
|
152 |
-
3. Gallery with Catinelle effect
|
153 |
-
4. Gallery with Appear effect
|
154 |
-
5. Gallery with Pufrobo effect
|
155 |
-
6. Lightgallery lightbox
|
156 |
-
7. Admin panel with Material design
|
157 |
-
|
158 |
-
== Changelog ==
|
159 |
-
|
160 |
-
= 1.3.
|
161 |
-
*
|
162 |
-
|
163 |
-
= 1.3.
|
164 |
-
*
|
165 |
-
|
166 |
-
|
167 |
-
*
|
168 |
-
*
|
169 |
-
|
170 |
-
|
171 |
-
*
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
*
|
176 |
-
|
177 |
-
|
178 |
-
* Removed
|
179 |
-
*
|
180 |
-
* Removed
|
181 |
-
*
|
182 |
-
|
183 |
-
|
184 |
-
*
|
185 |
-
|
186 |
-
= 1.1.
|
187 |
-
*
|
188 |
-
|
189 |
-
= 1.1.
|
190 |
-
*
|
191 |
-
|
192 |
-
= 1.1.
|
193 |
-
*
|
194 |
-
|
195 |
-
= 1.1.
|
196 |
-
*
|
197 |
-
|
198 |
-
= 1.1.
|
199 |
-
*
|
200 |
-
|
201 |
-
= 1.1.
|
202 |
-
*
|
203 |
-
|
204 |
-
= 1.1.
|
205 |
-
*
|
206 |
-
|
207 |
-
= 1.1.
|
208 |
-
*
|
209 |
-
|
210 |
-
= 1.1.
|
211 |
-
* Fixed
|
212 |
-
|
213 |
-
= 1.1.
|
214 |
-
*
|
215 |
-
|
216 |
-
= 1.1.
|
217 |
-
*
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
*
|
223 |
-
|
224 |
-
= 1.0.
|
225 |
-
*
|
226 |
-
|
227 |
-
= 1.0.
|
228 |
-
*
|
229 |
-
|
230 |
-
= 1.0.
|
231 |
-
*
|
232 |
-
|
233 |
-
= 1.0.
|
234 |
-
* Fixed url to upgrade
|
235 |
-
|
236 |
-
= 1.0.
|
237 |
-
*
|
238 |
-
|
239 |
-
= 1.0.
|
240 |
-
*
|
241 |
-
|
242 |
-
= 1.0.
|
243 |
-
*
|
244 |
-
|
245 |
-
= 1.0.
|
246 |
-
*
|
247 |
-
|
248 |
-
= 1.0.
|
249 |
-
*
|
250 |
-
|
251 |
-
= 1.0.
|
252 |
-
*
|
253 |
-
|
254 |
-
= 1.0.
|
255 |
-
*
|
256 |
-
|
257 |
-
= 1.0.
|
258 |
-
*
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
= 1.1.
|
|
|
|
|
|
|
266 |
* This update contains a tool to fix broken images.
|
1 |
+
=== Modula Image Gallery ===
|
2 |
+
Contributors: machothemes, silkalns
|
3 |
+
Tags: best gallery plugin, image gallery, photo gallery, responsive gallery, wordpress gallery plugin, wordpress portfolio plugin, masonry gallery, fancy gallery, media gallery, mosaic gallery, polaroid gallery, portfolio gallery
|
4 |
+
Requires at least: 3.8
|
5 |
+
Tested up to: 4.9
|
6 |
+
Stable tag: 1.3.2
|
7 |
+
License: GPLv3 or later
|
8 |
+
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
+
|
10 |
+
Photo Gallery by Modula - an advanced solution for Photo Gallery users. Create beautiful image galleries in minutes or less.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Modula Image Gallery is a creative and original WordPress plugin perfect for creating custom, unique, and responsive image galleries. Modula is available in both a Lite/free version and a premium version and it is currently the easiest and fastest photo gallery plugin for WordPress. Directly from its dashboard you are able to build stunning galleries in a few seconds, unlike many other WordPress plugins.
|
15 |
+
|
16 |
+
= See a 60s video of Modula in action =
|
17 |
+
|
18 |
+
https://www.youtube.com/watch?v=tq8yUYxgtnA
|
19 |
+
|
20 |
+
|
21 |
+
> **Time-saving features available in the FULL version:**
|
22 |
+
>
|
23 |
+
> * Use more than 20 images per gallery
|
24 |
+
> * Get access to gallery filters. Each image can have one or more filters.
|
25 |
+
> * Get access to 5 more lightbox libraries & effects with the PRO version.
|
26 |
+
> * Image effects on finishing image loading. Rotate or Horizontally / Vertically slide the images.
|
27 |
+
> * Get access to more than 15 hover image effects.
|
28 |
+
> * Priority email support from the developer of the plugin
|
29 |
+
> * Support and updates for 12 months
|
30 |
+
>
|
31 |
+
> **[Learn more about Modula Full version]( https://wp-modula.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite )**
|
32 |
+
|
33 |
+
|
34 |
+
= See how Modula can integrate with your website =
|
35 |
+
|
36 |
+
* [Modula Grid Gallery](http://wp-modula.com/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
37 |
+
* [Example: Margins](https://wp-modula.com/demo/margins/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
38 |
+
* [Example: Shuffle](https://wp-modula.com/demo/shuffle/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
39 |
+
* [Example: Social icons](https://wp-modula.com/demo/social-effect/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
40 |
+
* [Example: Custom styling](https://wp-modula.com/demo/styling/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
41 |
+
* [Architecture portfolio](https://wp-modula.com/demo/applications/architecture/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
42 |
+
* [Art showcase](https://wp-modula.com/demo/applications/art-gallery/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
43 |
+
* [Photography portfolio](https://wp-modula.com/demo/applications/blackwhite-photography/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
44 |
+
* [Food gallery](https://wp-modula.com/demo/applications/food/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
45 |
+
* [Pets gallery](https://wp-modula.com/demo/applications/pets-animals/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
46 |
+
* [Tattoo showcase](https://wp-modula.com/demo/applications/tattoo-attitude/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
47 |
+
* [Travel gallery](https://wp-modula.com/demo/applications/travel-gallery/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
48 |
+
* [Wedding album](https://wp-modula.com/demo/applications/wedding-album/?utm_source=wordpress.org&utm_medium=web&utm_campaign=Modula%20Lite)
|
49 |
+
|
50 |
+
= Shortcode Parameters =
|
51 |
+
|
52 |
+
`
|
53 |
+
* id
|
54 |
+
`
|
55 |
+
|
56 |
+
|
57 |
+
**Plugin is now using the TinyMCE API to improve UI and makes it easy to insert shortcodes!**
|
58 |
+
|
59 |
+
|
60 |
+
= Basic example =
|
61 |
+
|
62 |
+
`[Modula id="1"]`
|
63 |
+
|
64 |
+
|
65 |
+
= Some Modula demo applications / usages =
|
66 |
+
|
67 |
+
Do you wonder why this gallery is the best one? Look at the other galleries, see their demos, you’ll notice something weird ... THEY ALL LOOK THE SAME!
|
68 |
+
|
69 |
+
Modula is creative! Modula is dynamic! Modula doesn’t always look the same. Just have fun with it! Modula uses a new concept to build its internal grid. After you set a width and a height for the gallery, Modula will create a random but smart grid inside. The result is a dynamic, creative, interesting and attractive gallery.
|
70 |
+
|
71 |
+
You can control how much randomness to use in each gallery, so you can obtain a more traditional layout by switching off the “random factor,” or you can make something much more different by incrementing this factor.
|
72 |
+
|
73 |
+
Modula is a justified grid gallery because YOU decide the width and the height of the gallery, and the images to put inside. Modula will think about everything else. Images will never exceed their container.
|
74 |
+
|
75 |
+
To achieve such a result, images will be cropped, but that’s not a problem at all, because you can set a custom alignment for those images where the subject is not at the center of the image.
|
76 |
+
|
77 |
+
Modula Grid Gallery is not only responsive but also fluid, which means you’ll see images organize themselves with an impressive animation even on mobile devices thanks to the CSS3 engine.
|
78 |
+
|
79 |
+
**Ease of use doesn’t mean trivial galleries, indeed!**
|
80 |
+
By using the Modula Admin Panel you’re able to fine tune every aspect of the gallery. Choose a gallery size, margins between images, the color and the size of captions. Each photo can have a title and a subtitle so you’re able to best describe every image.
|
81 |
+
|
82 |
+
= What is Modula good for? =
|
83 |
+
|
84 |
+
Modula is also the best WordPress portfolio plugin, as it allows you to build gorgeous, creative portfolios. Applications are:
|
85 |
+
|
86 |
+
* architecture
|
87 |
+
* art
|
88 |
+
* photography
|
89 |
+
* food blogs
|
90 |
+
* pets and animals
|
91 |
+
* tattoos
|
92 |
+
* travel
|
93 |
+
* also wedding albums.
|
94 |
+
|
95 |
+
If you're frustated because your current galleries looks boring and too standard then you can use the importer which is included with Modula. The importer is currently able to import Envira and NextGen galleries.
|
96 |
+
|
97 |
+
> This plugin is maintained and supported by Macho Themes.
|
98 |
+
> Check out some of the other <a href="//machothemes.com/plugins/">WordPress plugins</a> we've developed.
|
99 |
+
> Check out some of the other <a href="//machothemes.com/themes/free/">free WordPress themes</a> we've developed.
|
100 |
+
|
101 |
+
== Installation ==
|
102 |
+
= For automatic installation: =
|
103 |
+
|
104 |
+
The simplest way to install is to click on \'Plugins\' then \'Add\' and type \'Modula\' in the search field.
|
105 |
+
|
106 |
+
= For manual installation 1: =
|
107 |
+
|
108 |
+
1. Login to your website and go to the Plugins section of your admin panel.
|
109 |
+
2. Click the Add New button.
|
110 |
+
3. Under Install Plugins, click the Upload link.
|
111 |
+
4. Select the plugin zip file (modula.x.x.x.zip) from your computer then click the Install Now button.
|
112 |
+
5. You should see a message stating that the plugin was installed successfully.
|
113 |
+
6. Click the Activate Plugin link.
|
114 |
+
|
115 |
+
= For manual installation 2: =
|
116 |
+
|
117 |
+
1. You should have access to the server where WordPress is installed. If you don\'t, see your system administrator.
|
118 |
+
|