Version Description
- second wp.org review
Download this release
Release Info
| Developer | machothemes |
| Plugin | |
| Version | 1.3.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3.4 to 1.3.5
- Modula.php +1056 -1075
- README.txt +4 -1
- admin/edit-gallery.php +2 -2
- lib/class-modula-plugin-rollback.php +0 -71
- lib/class-modula-rollback.php +0 -178
- lib/db-class.php +0 -2
- lib/gallery-class.php +271 -274
Modula.php
CHANGED
|
@@ -5,14 +5,14 @@
|
|
| 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 |
-
define( 'MODULA_VERSION', '1.3.
|
| 16 |
define( 'MODULA_PLUGIN_BASE', plugin_basename( __FILE__ ) );
|
| 17 |
define( 'MODULA_PREVIOUS_PLUGIN_VERSION', '1.3.3' );
|
| 18 |
define( 'MODULA_FILE_', __FILE__ );
|
|
@@ -22,1236 +22,1234 @@ function modula_lite_create_db_tables() {
|
|
| 22 |
modula_lite_install_db();
|
| 23 |
}
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
"
|
| 122 |
-
"name"
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
"
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
"
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
"
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
"
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
"
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
"
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
"
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
"
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
"
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
"
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
"
|
| 196 |
-
"
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
"|" . esc_html__( 'Attachment page', 'modula-gallery' )
|
| 200 |
-
),
|
| 201 |
-
"Lightboxes" => array( "lightbox2|Lightbox" ),
|
| 202 |
-
),
|
| 203 |
-
"disabled" => array(
|
| 204 |
-
"Lightboxes with PRO license" => array(
|
| 205 |
-
"magnific|Magnific popup",
|
| 206 |
-
"prettyphoto|PrettyPhoto",
|
| 207 |
-
"fancybox|FancyBox",
|
| 208 |
-
"swipebox|SwipeBox",
|
| 209 |
-
"lightbox2|Lightbox",
|
| 210 |
-
),
|
| 211 |
),
|
| 212 |
-
"
|
| 213 |
),
|
| 214 |
-
"
|
| 215 |
-
"
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
|
|
|
|
|
|
| 220 |
),
|
|
|
|
| 221 |
),
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
"
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
),
|
| 245 |
-
"excludeFrom" => array( "shortcode" ),
|
| 246 |
),
|
| 247 |
-
"
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
),
|
|
|
|
| 257 |
),
|
| 258 |
-
"excludeFrom" => array( "shortcode" ),
|
| 259 |
-
),
|
| 260 |
-
"hide_title" => array(
|
| 261 |
-
"name" => esc_html__( 'Image Title', 'modula-gallery' ),
|
| 262 |
-
"type" => "toggle",
|
| 263 |
-
"default" => "T",
|
| 264 |
-
"description" => esc_html__( 'Hide image title from frontend', 'modula-gallery' ),
|
| 265 |
-
"excludeFrom" => array(),
|
| 266 |
-
),
|
| 267 |
-
"hide_description" => array(
|
| 268 |
-
"name" => esc_html__( 'Image Description', 'modula-gallery' ),
|
| 269 |
-
"type" => "toggle",
|
| 270 |
-
"default" => "T",
|
| 271 |
-
"description" => esc_html__( 'Hide image description from frontend', 'modula-gallery' ),
|
| 272 |
-
"excludeFrom" => array(),
|
| 273 |
-
),
|
| 274 |
-
"captionFontSize" => array(
|
| 275 |
-
"name" => esc_html__( 'Caption Font Size', 'modula-gallery' ),
|
| 276 |
-
"type" => "number",
|
| 277 |
-
"description" => "",
|
| 278 |
-
"mu" => "px",
|
| 279 |
-
"excludeFrom" => array(),
|
| 280 |
-
),
|
| 281 |
-
"titleFontSize" => array(
|
| 282 |
-
"name" => esc_html__( 'Title Font Size', 'modula-gallery' ),
|
| 283 |
-
"type" => "number",
|
| 284 |
-
"description" => "",
|
| 285 |
-
"mu" => "px",
|
| 286 |
-
"excludeFrom" => array(),
|
| 287 |
),
|
|
|
|
| 288 |
),
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
"
|
| 295 |
-
"name" => esc_html__( 'Add Twitter icon', 'modula-gallery' ),
|
| 296 |
-
"type" => "toggle",
|
| 297 |
-
"default" => "T",
|
| 298 |
-
"description" => esc_html__( 'Enable Twitter Sharing', 'modula-gallery' ),
|
| 299 |
-
"excludeFrom" => array(),
|
| 300 |
-
),
|
| 301 |
-
"enableFacebook" => array(
|
| 302 |
-
"name" => esc_html__( 'Add Facebook icon', 'modula-gallery' ),
|
| 303 |
-
"type" => "toggle",
|
| 304 |
-
"default" => "T",
|
| 305 |
-
"description" => esc_html__( 'Enable Facebook Sharing', 'modula-gallery' ),
|
| 306 |
-
"excludeFrom" => array(),
|
| 307 |
-
),
|
| 308 |
-
"enableGplus" => array(
|
| 309 |
-
"name" => esc_html__( 'Add Google Plus icon', 'modula-gallery' ),
|
| 310 |
-
"type" => "toggle",
|
| 311 |
-
"default" => "T",
|
| 312 |
-
"description" => esc_html__( 'Enable Google Plus Sharing', 'modula-gallery' ),
|
| 313 |
-
"excludeFrom" => array(),
|
| 314 |
-
),
|
| 315 |
-
"enablePinterest" => array(
|
| 316 |
-
"name" => esc_html__( 'Add Pinterest icon', 'modula-gallery' ),
|
| 317 |
-
"type" => "toggle",
|
| 318 |
-
"default" => "T",
|
| 319 |
-
"description" => esc_html__( 'Enable Pinterest Sharing', 'modula-gallery' ),
|
| 320 |
-
"excludeFrom" => array(),
|
| 321 |
-
),
|
| 322 |
-
"socialIconColor" => array(
|
| 323 |
-
"name" => esc_html__( 'Color of social sharing icons', 'modula-gallery' ),
|
| 324 |
-
"type" => "color",
|
| 325 |
-
"description" => esc_html__( 'Set the color of the social sharing icons', 'modula-gallery' ),
|
| 326 |
-
"default" => "#ffffff",
|
| 327 |
-
"excludeFrom" => array(),
|
| 328 |
-
),
|
| 329 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
"
|
| 335 |
-
"
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
"max" => 200,
|
| 341 |
-
"mu" => "%",
|
| 342 |
-
"default" => 100,
|
| 343 |
-
"excludeFrom" => array(),
|
| 344 |
-
),
|
| 345 |
-
"loadedRotate" => array(
|
| 346 |
-
"name" => esc_html__( 'Rotate', 'modula-gallery' ),
|
| 347 |
-
"description" => "",
|
| 348 |
-
"type" => "PRO_FEATURE",
|
| 349 |
-
"min" => - 180,
|
| 350 |
-
"max" => 180,
|
| 351 |
-
"default" => 0,
|
| 352 |
-
"mu" => "deg",
|
| 353 |
-
"excludeFrom" => array(),
|
| 354 |
-
),
|
| 355 |
-
"loadedHSlide" => array(
|
| 356 |
-
"name" => esc_html__( 'Horizontal slide', 'modula-gallery' ),
|
| 357 |
-
"description" => "",
|
| 358 |
-
"type" => "PRO_FEATURE",
|
| 359 |
-
"min" => - 100,
|
| 360 |
-
"max" => 100,
|
| 361 |
-
"mu" => "px",
|
| 362 |
-
"default" => 0,
|
| 363 |
-
"excludeFrom" => array(),
|
| 364 |
-
),
|
| 365 |
-
"loadedVSlide" => array(
|
| 366 |
-
"name" => esc_html__( 'Vertical slide', 'modula-gallery' ),
|
| 367 |
-
"description" => "",
|
| 368 |
-
"type" => "PRO_FEATURE",
|
| 369 |
-
"min" => - 100,
|
| 370 |
-
"max" => 100,
|
| 371 |
-
"mu" => "px",
|
| 372 |
-
"default" => 0,
|
| 373 |
-
"excludeFrom" => array(),
|
| 374 |
-
),
|
| 375 |
-
|
| 376 |
),
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
"
|
| 382 |
-
|
| 383 |
-
"description" => esc_html__( 'Select an hover effect', 'modula-gallery' ),
|
| 384 |
-
"type" => "hover-effect",
|
| 385 |
-
"excludeFrom" => array(),
|
| 386 |
-
),
|
| 387 |
),
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
"
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
"excludeFrom" => array(),
|
| 411 |
-
),
|
| 412 |
-
"borderColor" => array(
|
| 413 |
-
"name" => esc_html__( 'Border Color', 'modula-gallery' ),
|
| 414 |
-
"type" => "color",
|
| 415 |
-
"description" => "",
|
| 416 |
-
"default" => "#ffffff",
|
| 417 |
-
"excludeFrom" => array(),
|
| 418 |
-
),
|
| 419 |
-
"shadowSize" => array(
|
| 420 |
-
"name" => esc_html__( 'Shadow Size', 'modula-gallery' ),
|
| 421 |
-
"type" => "ui-slider",
|
| 422 |
-
"description" => "",
|
| 423 |
-
"mu" => "px",
|
| 424 |
-
"min" => 0,
|
| 425 |
-
"max" => 20,
|
| 426 |
-
"default" => 0,
|
| 427 |
-
"excludeFrom" => array(),
|
| 428 |
-
),
|
| 429 |
-
"shadowColor" => array(
|
| 430 |
-
"name" => esc_html__( 'Shadow Color', 'modula-gallery' ),
|
| 431 |
-
"type" => "color",
|
| 432 |
-
"description" => "",
|
| 433 |
-
"default" => "#ffffff",
|
| 434 |
-
"excludeFrom" => array(),
|
| 435 |
-
),
|
| 436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
),
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
"
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
"
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 457 |
),
|
| 458 |
-
);
|
| 459 |
|
| 460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 461 |
|
| 462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 463 |
|
| 464 |
-
|
| 465 |
-
return;
|
| 466 |
-
}
|
| 467 |
|
| 468 |
-
|
| 469 |
-
wp_enqueue_style( 'modula-fancybox', plugins_url( 'admin/fancybox/jquery.fancybox.min.css', __FILE__) );
|
| 470 |
|
|
|
|
|
|
|
| 471 |
}
|
| 472 |
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
$plugin_dir = basename( dirname( __FILE__ ) );
|
| 476 |
-
load_plugin_textdomain( 'modula-gallery', false, $plugin_dir . '/lib/languages' );
|
| 477 |
-
}
|
| 478 |
|
| 479 |
-
|
| 480 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'None', 'none', false, false, 0 );
|
| 481 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Pufrobo', 'pufrobo', true, true, 4 );
|
| 482 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Fluid Up', '', true, true, 0 );
|
| 483 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Hide', '', true, true, 4 );
|
| 484 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Quiet', '', true, false, 4 );
|
| 485 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Catinelle', '', false, false, 4 );
|
| 486 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Reflex', '', true, true, 4 );
|
| 487 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Curtain', '', true, false, 4 );
|
| 488 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Lens', '', true, true, 4 );
|
| 489 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Appear', '', true, false, 4 );
|
| 490 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Crafty', '', true, true, 0 );
|
| 491 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Seemo', '', true, false, 4 );
|
| 492 |
-
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Comodo', '', true, false, 4 );
|
| 493 |
-
}
|
| 494 |
|
| 495 |
-
|
| 496 |
-
|
|
|
|
|
|
|
|
|
|
| 497 |
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
) );
|
| 514 |
-
foreach ( $galleries as $g ) {
|
| 515 |
-
$item = array();
|
| 516 |
-
$item['id'] = $g->ID;
|
| 517 |
-
$item['title'] = $g->post_title;
|
| 518 |
-
$res['galleries'] [] = $item;
|
| 519 |
-
}
|
| 520 |
-
break;
|
| 521 |
-
case 'NextGen':
|
| 522 |
-
$galleries = $wpdb->get_results( "SELECT title, gid FROM $wpdb->nggallery" );
|
| 523 |
-
foreach ( $galleries as $g ) {
|
| 524 |
-
$item = array();
|
| 525 |
-
$item['id'] = $g->gid;
|
| 526 |
-
$item['title'] = $g->title;
|
| 527 |
-
$res['galleries'] [] = $item;
|
| 528 |
-
}
|
| 529 |
-
break;
|
| 530 |
-
}
|
| 531 |
-
}
|
| 532 |
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
die();
|
| 536 |
-
}
|
| 537 |
|
| 538 |
-
|
| 539 |
-
global $current_screen;
|
| 540 |
-
if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'modula-lite' ) !== false ) {
|
| 541 |
-
$url = 'https://wordpress.org/support/plugin/modula-best-grid-gallery/reviews/?rate=5#new-post';
|
| 542 |
-
$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 );
|
| 543 |
-
}
|
| 544 |
|
| 545 |
-
|
| 546 |
-
|
| 547 |
|
| 548 |
-
|
| 549 |
-
|
|
|
|
|
|
|
| 550 |
|
| 551 |
-
header( "Content-type: application/json" );
|
| 552 |
-
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
| 553 |
-
$res = array( "success" => 0 );
|
| 554 |
-
$source = $_POST['source'];
|
| 555 |
-
$ids = explode( ",", $_POST['ids'] );
|
| 556 |
switch ( $source ) {
|
| 557 |
case 'Envira':
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
$
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
'hasResizedImages' => true,
|
| 568 |
-
'importedFrom' => 'Envira',
|
| 569 |
-
);
|
| 570 |
-
$gdb = array_merge( $this->defaultValues, $g );
|
| 571 |
-
|
| 572 |
-
$saved = $this->ModulaDB->addGallery( $gdb );
|
| 573 |
-
$newId = $this->ModulaDB->getNewGalleryId();
|
| 574 |
-
|
| 575 |
-
if ( $newId && count( $data['gallery'] ) ) {
|
| 576 |
-
$images = array();
|
| 577 |
-
//TODO only active images
|
| 578 |
-
foreach ( $data['gallery'] as $item ) {
|
| 579 |
-
$toAdd = new stdClass();
|
| 580 |
-
$toAdd->imageId = $this->ModulaDB->getIDbyGUID( $item['src'] );
|
| 581 |
-
$toAdd->title = $item['title'];
|
| 582 |
-
$toAdd->description = $item['caption'];
|
| 583 |
-
$toAdd->imagePath = $item['src'];
|
| 584 |
-
|
| 585 |
-
$images [] = $toAdd;
|
| 586 |
-
}
|
| 587 |
-
$imgResult = $this->ModulaDB->addImages( $newId, $images );
|
| 588 |
-
}
|
| 589 |
}
|
| 590 |
-
$res['success'] = 1;
|
| 591 |
break;
|
| 592 |
case 'NextGen':
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
$
|
| 597 |
-
|
| 598 |
-
$
|
| 599 |
-
'name' => $gallery->title,
|
| 600 |
-
'description' => 'Imported from NextGet (' . $id . ') on ' . date( 'M, d Y' ),
|
| 601 |
-
'hasResizedImages' => true,
|
| 602 |
-
'importedFrom' => 'NextGen',
|
| 603 |
-
);
|
| 604 |
-
$gdb = array_merge( $this->defaultValues, $g );
|
| 605 |
-
|
| 606 |
-
$saved = $this->ModulaDB->addGallery( $gdb );
|
| 607 |
-
$newId = $this->ModulaDB->getNewGalleryId();
|
| 608 |
-
|
| 609 |
-
if ( $newId && count( $dbimages ) ) {
|
| 610 |
-
$images = array();
|
| 611 |
-
foreach ( $dbimages as $item ) {
|
| 612 |
-
$toAdd = new stdClass();
|
| 613 |
-
$toAdd->imageId = - 1;
|
| 614 |
-
$toAdd->title = $item->alttext;
|
| 615 |
-
$toAdd->description = $item->description;
|
| 616 |
-
$toAdd->imagePath = plugins_url( 'image.php', __FILE__ ) . "?w=" . $this->defaultValues['img_size'] . "&src=" . $gallery->path . "/" . $item->filename;
|
| 617 |
-
|
| 618 |
-
$images [] = $toAdd;
|
| 619 |
-
}
|
| 620 |
-
$imgResult = $this->ModulaDB->addImages( $newId, $images );
|
| 621 |
-
|
| 622 |
-
}
|
| 623 |
}
|
| 624 |
-
$res['success'] = 1;
|
| 625 |
break;
|
| 626 |
}
|
| 627 |
-
|
| 628 |
-
echo json_encode( $res );
|
| 629 |
}
|
| 630 |
-
|
|
|
|
| 631 |
}
|
|
|
|
|
|
|
| 632 |
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
}
|
| 640 |
|
| 641 |
-
|
|
|
|
| 642 |
|
| 643 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 644 |
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
| 648 |
-
$id = absint( $_POST['gid'] );
|
| 649 |
-
$this->ModulaDB->deleteGallery( $id );
|
| 650 |
-
}
|
| 651 |
|
| 652 |
-
|
| 653 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
$config = stripslashes( $_POST['config'] );
|
| 659 |
|
| 660 |
-
|
|
|
|
|
|
|
|
|
|
| 661 |
}
|
| 662 |
|
| 663 |
-
|
| 664 |
}
|
|
|
|
|
|
|
| 665 |
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
|
|
|
|
|
|
| 671 |
|
| 672 |
-
|
| 673 |
|
| 674 |
-
|
| 675 |
|
| 676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
}
|
| 678 |
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
|
| 688 |
-
$data["img_size"] = absint( $_POST['img_size'] );
|
| 689 |
-
$data["hasResizedImages"] = true;
|
| 690 |
-
|
| 691 |
-
$this->ModulaDB->addGallery( $data );
|
| 692 |
-
$id = $this->ModulaDB->getLastGalleryId()->Id;
|
| 693 |
-
|
| 694 |
-
if ( $id > 0 && array_key_exists( 'images', $_POST ) && strlen( $_POST['images'] ) ) {
|
| 695 |
-
$enc_images = stripslashes( $_POST["images"] );
|
| 696 |
-
$images = array_splice( json_decode( $enc_images ), 0, 11 + 9 );
|
| 697 |
-
ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
| 698 |
-
$result = $this->ModulaDB->addImages( $id, $images );
|
| 699 |
-
}
|
| 700 |
-
print $id;
|
| 701 |
-
}
|
| 702 |
-
die;
|
| 703 |
}
|
| 704 |
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
| 708 |
-
$sourceId = absint( $_POST['gid'] );
|
| 709 |
-
$g = $this->ModulaDB->getGalleryById( $sourceId, $this->defaultValues );
|
| 710 |
-
$g->name .= "(copy)";
|
| 711 |
-
$this->ModulaDB->addGallery( $g );
|
| 712 |
-
$id = $this->ModulaDB->getNewGalleryId();
|
| 713 |
-
$images = $this->ModulaDB->getImagesByGalleryId( $sourceId );
|
| 714 |
|
| 715 |
-
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
}
|
| 719 |
|
| 720 |
-
|
| 721 |
-
|
|
|
|
| 722 |
|
| 723 |
-
die();
|
| 724 |
}
|
| 725 |
|
|
|
|
|
|
|
| 726 |
|
| 727 |
-
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 731 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 732 |
|
| 733 |
-
|
| 734 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 735 |
}
|
| 736 |
|
| 737 |
-
|
| 738 |
-
define( 'Modula_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . Modula_PLUGIN_NAME );
|
| 739 |
-
}
|
| 740 |
}
|
| 741 |
|
| 742 |
-
|
|
|
|
| 743 |
|
| 744 |
|
| 745 |
-
|
| 746 |
-
|
| 747 |
-
|
|
|
|
|
|
|
| 748 |
|
| 749 |
-
|
| 750 |
-
|
| 751 |
}
|
| 752 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 753 |
|
| 754 |
-
|
| 755 |
-
require( 'lib/db-class.php' );
|
| 756 |
-
$ModulaDB = ModulaLiteDB::getInstance();
|
| 757 |
|
| 758 |
-
return $ModulaDB;
|
| 759 |
-
}
|
| 760 |
|
| 761 |
-
|
| 762 |
-
|
|
|
|
| 763 |
|
| 764 |
-
|
| 765 |
-
|
|
|
|
| 766 |
|
| 767 |
-
public function register_editor_plugin( $plugin_array ) {
|
| 768 |
-
$plugin_array['mtg_shortcode_editor'] = plugins_url( '/admin/scripts/editor-plugin.js', __file__ );
|
| 769 |
|
| 770 |
-
|
| 771 |
-
|
|
|
|
| 772 |
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
$admin_url = admin_url();
|
| 776 |
|
| 777 |
-
|
|
|
|
| 778 |
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
}
|
| 782 |
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
wp_enqueue_script( 'jquery' );
|
| 786 |
|
| 787 |
-
|
| 788 |
-
|
| 789 |
|
| 790 |
-
|
| 791 |
-
|
|
|
|
| 792 |
|
| 793 |
-
|
| 794 |
-
wp_enqueue_style( 'effects_stylesheet' );
|
| 795 |
|
| 796 |
-
|
| 797 |
-
|
| 798 |
-
|
| 799 |
|
| 800 |
-
|
| 801 |
-
|
| 802 |
-
|
| 803 |
-
wp_enqueue_media();
|
| 804 |
-
}
|
| 805 |
|
| 806 |
-
|
|
|
|
| 807 |
|
| 808 |
-
|
| 809 |
-
|
| 810 |
|
| 811 |
-
|
| 812 |
-
|
| 813 |
|
| 814 |
-
|
| 815 |
-
|
|
|
|
| 816 |
|
| 817 |
-
|
| 818 |
-
|
|
|
|
|
|
|
|
|
|
| 819 |
|
| 820 |
-
|
| 821 |
-
wp_enqueue_style( 'effects' );
|
| 822 |
|
| 823 |
-
|
|
|
|
| 824 |
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
'jquery',
|
| 828 |
-
'media-upload',
|
| 829 |
-
'thickbox',
|
| 830 |
-
), false, false );
|
| 831 |
|
| 832 |
-
|
|
|
|
| 833 |
|
| 834 |
-
|
| 835 |
-
|
| 836 |
|
| 837 |
-
|
|
|
|
| 838 |
|
| 839 |
-
|
| 840 |
-
$installed_ver = get_option( "Modula_db_version" );
|
| 841 |
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 846 |
}
|
|
|
|
| 847 |
|
| 848 |
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
|
| 856 |
|
| 857 |
-
|
| 858 |
|
| 859 |
-
|
| 860 |
-
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
|
| 864 |
-
|
| 865 |
-
|
| 866 |
-
}
|
| 867 |
}
|
|
|
|
| 868 |
|
| 869 |
-
|
| 870 |
-
|
| 871 |
-
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
| 875 |
-
|
| 876 |
-
}
|
| 877 |
}
|
| 878 |
-
} else {
|
| 879 |
-
add_option( 'Modula_skip_fix', true );
|
| 880 |
}
|
|
|
|
|
|
|
|
|
|
| 881 |
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
|
| 899 |
-
|
| 900 |
-
|
| 901 |
-
|
| 902 |
-
|
| 903 |
-
|
| 904 |
|
| 905 |
-
|
| 906 |
|
| 907 |
-
|
| 908 |
-
|
| 909 |
-
|
| 910 |
-
|
| 911 |
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
|
| 915 |
|
| 916 |
-
|
| 917 |
-
|
| 918 |
-
|
| 919 |
|
| 920 |
-
|
| 921 |
-
|
| 922 |
-
|
| 923 |
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
|
| 929 |
-
|
| 930 |
-
|
| 931 |
-
|
| 932 |
-
|
| 933 |
-
}
|
| 934 |
}
|
| 935 |
-
die();
|
| 936 |
}
|
|
|
|
|
|
|
| 937 |
|
| 938 |
-
|
| 939 |
-
|
| 940 |
-
|
| 941 |
-
|
| 942 |
-
|
| 943 |
-
|
| 944 |
-
|
| 945 |
-
|
| 946 |
-
|
| 947 |
-
|
| 948 |
-
|
| 949 |
-
|
| 950 |
-
|
| 951 |
-
|
| 952 |
-
|
| 953 |
-
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
}
|
| 958 |
}
|
| 959 |
-
die();
|
| 960 |
}
|
|
|
|
|
|
|
| 961 |
|
| 962 |
-
|
| 963 |
-
|
| 964 |
-
|
| 965 |
|
| 966 |
-
|
| 967 |
-
|
| 968 |
-
|
| 969 |
-
|
| 970 |
-
|
| 971 |
-
}
|
| 972 |
}
|
| 973 |
-
die();
|
| 974 |
}
|
|
|
|
|
|
|
| 975 |
|
| 976 |
-
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
|
| 980 |
-
|
| 981 |
-
|
| 982 |
-
|
| 983 |
-
|
| 984 |
-
|
| 985 |
-
|
| 986 |
-
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
-
|
| 1007 |
-
|
| 1008 |
-
|
| 1009 |
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
-
|
| 1015 |
-
|
| 1016 |
-
|
| 1017 |
-
|
| 1018 |
-
|
| 1019 |
-
|
| 1020 |
-
|
| 1021 |
-
if ( ! empty( $_POST['id'] ) ) {
|
| 1022 |
-
$imageId = intval( $_POST['id'] );
|
| 1023 |
-
$result = $this->ModulaDB->editImage( $imageId, $data );
|
| 1024 |
-
} else {
|
| 1025 |
-
$data["gid"] = intval( $_POST['galleryId'] );
|
| 1026 |
-
$result = $this->ModulaDB->addFullImage( $data );
|
| 1027 |
-
}
|
| 1028 |
|
| 1029 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1030 |
|
| 1031 |
-
|
| 1032 |
-
print "{\"success\":false}";
|
| 1033 |
-
} else {
|
| 1034 |
-
print "{\"success\":true}";
|
| 1035 |
-
}
|
| 1036 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1037 |
}
|
| 1038 |
-
|
| 1039 |
}
|
|
|
|
|
|
|
| 1040 |
|
| 1041 |
-
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
|
| 1045 |
|
| 1046 |
-
|
| 1047 |
|
| 1048 |
-
|
| 1049 |
-
}
|
| 1050 |
-
die();
|
| 1051 |
}
|
|
|
|
|
|
|
| 1052 |
|
| 1053 |
-
|
| 1054 |
-
|
| 1055 |
-
|
| 1056 |
-
|
| 1057 |
-
}
|
| 1058 |
-
|
| 1059 |
-
//return '';
|
| 1060 |
-
return 'F';
|
| 1061 |
}
|
| 1062 |
|
| 1063 |
-
|
| 1064 |
-
|
| 1065 |
-
|
| 1066 |
-
$galleryDescription = stripslashes( $_POST['tg_description'] );
|
| 1067 |
-
$slug = strtolower( str_replace( " ", "", $galleryName ) );
|
| 1068 |
-
$margin = intval( $_POST['tg_margin'] );
|
| 1069 |
-
$shuffle = $this->checkboxVal( 'tg_shuffle' );
|
| 1070 |
-
$width = $_POST['tg_width'];
|
| 1071 |
-
$height = $_POST['tg_height'];
|
| 1072 |
-
$enableTwitter = $this->checkboxVal( 'tg_enableTwitter' );
|
| 1073 |
-
$enableFacebook = $this->checkboxVal( 'tg_enableFacebook' );
|
| 1074 |
-
$enableGplus = $this->checkboxVal( 'tg_enableGplus' );
|
| 1075 |
-
$enablePinterest = $this->checkboxVal( 'tg_enablePinterest' );
|
| 1076 |
-
$lightbox = $_POST['tg_lightbox'];
|
| 1077 |
-
$wp_field_caption = $_POST['tg_wp_field_caption'];
|
| 1078 |
-
$wp_field_title = $_POST['tg_wp_field_title'];
|
| 1079 |
-
$hide_title = $this->checkboxVal( 'tg_hide_title' );
|
| 1080 |
-
$hide_description = $this->checkboxVal( 'tg_hide_description' );
|
| 1081 |
-
$captionColor = $_POST['tg_captionColor'];
|
| 1082 |
-
$borderSize = intval( $_POST['tg_borderSize'] );
|
| 1083 |
-
$loadedScale = intval( $_POST['tg_loadedScale'] );
|
| 1084 |
-
$loadedRotate = intval( $_POST['tg_loadedRotate'] );
|
| 1085 |
-
$loadedVSlide = intval( $_POST['tg_loadedVSlide'] );
|
| 1086 |
-
$loadedHSlide = intval( $_POST['tg_loadedHSlide'] );
|
| 1087 |
-
$socialIconColor = $_POST['tg_socialIconColor'];
|
| 1088 |
-
$hoverEffect = $_POST['tg_hoverEffect'];
|
| 1089 |
-
$titleFontSize = intval( $_POST['tg_titleFontSize'] );
|
| 1090 |
-
$captionFontSize = intval( $_POST['tg_captionFontSize'] );
|
| 1091 |
-
$borderColor = $_POST['tg_borderColor'];
|
| 1092 |
-
$borderRadius = intval( $_POST['tg_borderRadius'] );
|
| 1093 |
-
$shadowColor = $_POST['tg_shadowColor'];
|
| 1094 |
-
$shadowSize = intval( $_POST['tg_shadowSize'] );
|
| 1095 |
-
$style = $_POST['tg_style'];
|
| 1096 |
-
$script = $_POST['tg_script'];
|
| 1097 |
-
|
| 1098 |
-
$id = isset( $_POST['ftg_gallery_edit'] ) ? intval( $_POST['ftg_gallery_edit'] ) : 0;
|
| 1099 |
-
|
| 1100 |
-
$data = array(
|
| 1101 |
-
'name' => $galleryName,
|
| 1102 |
-
'slug' => $slug,
|
| 1103 |
-
'description' => $galleryDescription,
|
| 1104 |
-
'lightbox' => $lightbox,
|
| 1105 |
-
'img_size' => intval( $_POST['tg_img_size'] ),
|
| 1106 |
-
'hasResizedImages' => true,
|
| 1107 |
-
'wp_field_caption' => $wp_field_caption,
|
| 1108 |
-
'wp_field_title' => $wp_field_title,
|
| 1109 |
-
'hide_title' => $hide_title,
|
| 1110 |
-
'hide_description' => $hide_description,
|
| 1111 |
-
'margin' => $margin,
|
| 1112 |
-
'randomFactor' => $_POST['tg_randomFactor'],
|
| 1113 |
-
'shuffle' => $shuffle,
|
| 1114 |
-
'enableTwitter' => $enableTwitter,
|
| 1115 |
-
'enableFacebook' => $enableFacebook,
|
| 1116 |
-
'enableGplus' => $enableGplus,
|
| 1117 |
-
'enablePinterest' => $enablePinterest,
|
| 1118 |
-
'captionColor' => $captionColor,
|
| 1119 |
-
'hoverEffect' => $hoverEffect,
|
| 1120 |
-
'borderSize' => $borderSize,
|
| 1121 |
-
'loadedScale' => $loadedScale,
|
| 1122 |
-
'loadedHSlide' => $loadedHSlide,
|
| 1123 |
-
'loadedVSlide' => $loadedVSlide,
|
| 1124 |
-
'loadedRotate' => $loadedRotate,
|
| 1125 |
-
'socialIconColor' => $socialIconColor,
|
| 1126 |
-
'captionFontSize' => $captionFontSize,
|
| 1127 |
-
'titleFontSize' => $titleFontSize,
|
| 1128 |
-
'borderColor' => $borderColor,
|
| 1129 |
-
'borderRadius' => $borderRadius,
|
| 1130 |
-
'shadowSize' => $shadowSize,
|
| 1131 |
-
'shadowColor' => $shadowColor,
|
| 1132 |
-
'width' => $width,
|
| 1133 |
-
'height' => $height,
|
| 1134 |
-
'style' => $style,
|
| 1135 |
-
'script' => $script,
|
| 1136 |
-
);
|
| 1137 |
-
|
| 1138 |
-
header( "Content-type: application/json" );
|
| 1139 |
-
if ( $id > 0 ) {
|
| 1140 |
-
$result = $this->ModulaDB->editGallery( $id, $data );
|
| 1141 |
-
|
| 1142 |
-
if ( intval( $this->loadedData->img_size ) != $data['img_size'] ) {
|
| 1143 |
-
$images = $this->ModulaDB->getImagesByGalleryId( $id );
|
| 1144 |
-
$images = ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
| 1145 |
-
|
| 1146 |
-
foreach ( $images as $img ) {
|
| 1147 |
-
$this->ModulaDB->editImage( $img->Id, (array) $img );
|
| 1148 |
-
}
|
| 1149 |
-
}
|
| 1150 |
|
| 1151 |
-
|
| 1152 |
-
|
| 1153 |
-
|
| 1154 |
-
|
| 1155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1156 |
|
|
|
|
|
|
|
|
|
|
| 1157 |
|
| 1158 |
-
|
| 1159 |
-
|
| 1160 |
-
|
| 1161 |
-
print "{\"success\":false}";
|
| 1162 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1163 |
}
|
| 1164 |
-
die();
|
| 1165 |
-
}
|
| 1166 |
|
| 1167 |
-
public function edit_gallery() {
|
| 1168 |
-
if ( isset( $_GET['galleryId'] ) ) {
|
| 1169 |
-
$this->loadedData = $this->ModulaDB->getGalleryById( absint( $_GET['galleryId'] ), $this->defaultValues );
|
| 1170 |
-
$modula_fields = $this->fields;
|
| 1171 |
-
$modula_parent_page = "dashboard";
|
| 1172 |
|
| 1173 |
-
|
|
|
|
| 1174 |
} else {
|
| 1175 |
-
|
| 1176 |
-
$nobanner = true;
|
| 1177 |
-
include( "admin/overview.php" );
|
| 1178 |
}
|
| 1179 |
}
|
|
|
|
|
|
|
| 1180 |
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
$
|
| 1184 |
-
|
| 1185 |
-
|
| 1186 |
-
|
| 1187 |
-
|
| 1188 |
-
|
| 1189 |
-
|
| 1190 |
-
|
| 1191 |
-
|
| 1192 |
-
|
| 1193 |
-
|
| 1194 |
-
|
| 1195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1196 |
}
|
| 1197 |
}
|
| 1198 |
-
|
| 1199 |
-
return $sizes;
|
| 1200 |
}
|
| 1201 |
|
| 1202 |
-
|
| 1203 |
-
|
| 1204 |
-
global $Modula;
|
| 1205 |
|
| 1206 |
-
|
| 1207 |
-
|
|
|
|
| 1208 |
|
| 1209 |
-
|
| 1210 |
-
|
| 1211 |
-
case "lightbox2":
|
| 1212 |
-
wp_enqueue_style( 'lightbox2_stylesheet' );
|
| 1213 |
-
wp_enqueue_script( 'lightbox2_script' );
|
| 1214 |
-
wp_add_inline_script( 'lightbox2_script', 'jQuery(document).ready(function(){lightbox.option({albumLabel: "' . esc_html__( 'Image %1 of %2', 'modula-gallery' ) . '"});});' );
|
| 1215 |
-
break;
|
| 1216 |
-
}
|
| 1217 |
|
| 1218 |
-
|
| 1219 |
-
|
| 1220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1221 |
}
|
| 1222 |
-
}
|
| 1223 |
|
| 1224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1225 |
|
| 1226 |
-
|
| 1227 |
-
'<p>[Modula' => '[Modula' ,
|
| 1228 |
-
'<p>[/Modula' => '[/Modula',
|
| 1229 |
-
'Modula]</p>' => 'Modula]',
|
| 1230 |
-
'Modula]<br />' => 'Modula]'
|
| 1231 |
-
);
|
| 1232 |
|
| 1233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1234 |
|
| 1235 |
-
|
| 1236 |
-
}
|
| 1237 |
|
|
|
|
| 1238 |
}
|
| 1239 |
|
| 1240 |
-
|
| 1241 |
|
| 1242 |
-
|
| 1243 |
-
var $code;
|
| 1244 |
-
var $allowTitle;
|
| 1245 |
-
var $allowSubtitle;
|
| 1246 |
-
var $maxSocial;
|
| 1247 |
|
| 1248 |
-
|
| 1249 |
-
|
| 1250 |
-
|
| 1251 |
-
|
| 1252 |
-
|
| 1253 |
-
|
| 1254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1255 |
}
|
| 1256 |
}
|
| 1257 |
|
|
@@ -1431,20 +1429,3 @@ function modula_beta_ajax_script() {
|
|
| 1431 |
|
| 1432 |
<?php
|
| 1433 |
}
|
| 1434 |
-
|
| 1435 |
-
/* RollBack functionality */
|
| 1436 |
-
require MODULA_PLUGIN_DIR_PATH . '/lib/class-modula-plugin-rollback.php';
|
| 1437 |
-
require MODULA_PLUGIN_DIR_PATH . '/lib/class-modula-rollback.php';
|
| 1438 |
-
|
| 1439 |
-
/**
|
| 1440 |
-
* Insert Rollback link for plugin in plugins page
|
| 1441 |
-
*/
|
| 1442 |
-
|
| 1443 |
-
function modula_lite_rollback_link( $links ) {
|
| 1444 |
-
|
| 1445 |
-
$links['rollback'] = sprintf( '<a href="%s" class="modula-rollback-button">%s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=modula_rollback' ), 'modula_rollback' ), __( 'Rollback version', 'modula-gallery' ) );
|
| 1446 |
-
|
| 1447 |
-
return $links;
|
| 1448 |
-
}
|
| 1449 |
-
|
| 1450 |
-
add_action( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'modula_lite_rollback_link' );
|
| 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.5
|
| 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 |
+
define( 'MODULA_VERSION', '1.3.5' );
|
| 16 |
define( 'MODULA_PLUGIN_BASE', plugin_basename( __FILE__ ) );
|
| 17 |
define( 'MODULA_PREVIOUS_PLUGIN_VERSION', '1.3.3' );
|
| 18 |
define( 'MODULA_FILE_', __FILE__ );
|
| 22 |
modula_lite_install_db();
|
| 23 |
}
|
| 24 |
|
| 25 |
+
class ModulaLite {
|
| 26 |
+
|
| 27 |
+
private $loadedData;
|
| 28 |
+
private $fields = array();
|
| 29 |
+
|
| 30 |
+
private $version = "1.3.5";
|
| 31 |
+
|
| 32 |
+
private $defaultValues = array(
|
| 33 |
+
'width' => 100,
|
| 34 |
+
'height' => 800,
|
| 35 |
+
'img_size' => 500,
|
| 36 |
+
'margin' => 10,
|
| 37 |
+
'filters' => '',
|
| 38 |
+
'filterClick' => 'F',
|
| 39 |
+
'allFilterLabel' => 'All',
|
| 40 |
+
'lightbox' => 'lightbox2',
|
| 41 |
+
'shuffle' => 'F',
|
| 42 |
+
'captionColor' => '#ffffff',
|
| 43 |
+
'wp_field_caption' => 'caption',
|
| 44 |
+
'wp_field_title' => 'title',
|
| 45 |
+
'captionFontSize' => 14,
|
| 46 |
+
'titleFontSize' => 16,
|
| 47 |
+
'enableTwitter' => 'T',
|
| 48 |
+
'enableFacebook' => 'T',
|
| 49 |
+
'enableGplus' => 'T',
|
| 50 |
+
'enablePinterest' => 'T',
|
| 51 |
+
'socialIconColor' => '#ffffff',
|
| 52 |
+
'loadedScale' => 100,
|
| 53 |
+
'loadedRotate' => 0,
|
| 54 |
+
'loadedHSlide' => 0,
|
| 55 |
+
'loadedVSlide' => 0,
|
| 56 |
+
'borderSize' => 0,
|
| 57 |
+
'borderRadius' => 0,
|
| 58 |
+
'borderColor' => '#ffffff',
|
| 59 |
+
'shadowSize' => 0,
|
| 60 |
+
'shadowColor' => '#ffffff',
|
| 61 |
+
'style' => '',
|
| 62 |
+
'script' => '',
|
| 63 |
+
'randomFactor' => 50,
|
| 64 |
+
'hoverColor' => '#000000',
|
| 65 |
+
'hoverOpacity' => '50',
|
| 66 |
+
'hoverEffect' => 'pufrobo',
|
| 67 |
+
'hasResizedImages' => false,
|
| 68 |
+
'importedFrom' => '',
|
| 69 |
+
'hide_title' => false,
|
| 70 |
+
'hide_description' => false,
|
| 71 |
+
);
|
| 72 |
+
|
| 73 |
+
public function __construct() {
|
| 74 |
+
$this->plugin_name = plugin_basename( __FILE__ );
|
| 75 |
+
$this->plugin_url = plugins_url( '', __FILE__ );
|
| 76 |
+
$this->define_constants();
|
| 77 |
+
$this->define_db_tables();
|
| 78 |
+
$this->define_hover_effects();
|
| 79 |
+
$this->ModulaDB = $this->create_db_conn();
|
| 80 |
+
|
| 81 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
| 82 |
+
add_filter( 'mce_buttons', array( $this, 'editor_button' ) );
|
| 83 |
+
add_filter( 'mce_external_plugins', array( $this, 'register_editor_plugin' ) );
|
| 84 |
+
|
| 85 |
+
add_action( 'init', array( $this, 'create_textdomain' ) );
|
| 86 |
+
|
| 87 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'add_gallery_scripts' ) );
|
| 88 |
+
|
| 89 |
+
add_action( 'admin_menu', array( $this, 'add_gallery_admin_menu' ) );
|
| 90 |
+
|
| 91 |
+
add_shortcode( 'Modula', array( $this, 'gallery_shortcode_handler' ) );
|
| 92 |
+
add_filter( 'the_content', array( $this, 'shortcode_empty_paragraph_fix' ), 99 );
|
| 93 |
+
|
| 94 |
+
add_action( 'wp_ajax_modula_save_gallery', array( $this, 'save_gallery' ) );
|
| 95 |
+
add_action( 'wp_ajax_modula_save_image', array( $this, 'save_image' ) );
|
| 96 |
+
add_action( 'wp_ajax_modula_add_image', array( $this, 'add_image' ) );
|
| 97 |
+
add_action( 'wp_ajax_modula_list_images', array( $this, 'list_images' ) );
|
| 98 |
+
add_action( 'wp_ajax_modula_sort_images', array( $this, 'sort_images' ) );
|
| 99 |
+
add_action( 'wp_ajax_modula_delete_image', array( $this, 'delete_image' ) );
|
| 100 |
+
add_action( 'wp_ajax_modula_resize_images', array( $this, 'resize_images' ) );
|
| 101 |
+
add_action( 'wp_ajax_modula_delete_gallery', array( $this, 'delete_gallery' ) );
|
| 102 |
+
add_action( 'wp_ajax_modula_clone_gallery', array( $this, 'clone_gallery' ) );
|
| 103 |
+
add_action( 'wp_ajax_modula_create_gallery', array( $this, 'create_gallery' ) );
|
| 104 |
+
add_action( 'wp_ajax_mtg_shortcode_editor', array( $this, 'mtg_shortcode_editor' ) );
|
| 105 |
+
add_action( 'wp_ajax_modula_get_config', array( $this, 'get_config' ) );
|
| 106 |
+
add_action( 'wp_ajax_modula_update_config', array( $this, 'update_config' ) );
|
| 107 |
+
add_action( 'wp_ajax_modula_get_ext_galleries', array( $this, 'get_ext_galleries' ) );
|
| 108 |
+
add_action( 'wp_ajax_modula_do_import_galleries', array( $this, 'do_import_galleries' ) );
|
| 109 |
+
|
| 110 |
+
add_filter( 'plugin_row_meta', array( $this, 'register_links' ), 10, 2 );
|
| 111 |
+
add_filter( 'admin_footer_text', array( $this, 'admin_footer' ), 1, 2 );
|
| 112 |
+
|
| 113 |
+
// Enqueue Fancybox for Modula 2.0 Page
|
| 114 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'modula_beta_scripts' ) );
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
// Set fields
|
| 118 |
+
$this->fields[ __( 'General', 'modula-gallery' ) ] = array(
|
| 119 |
+
"icon" => "mdi mdi-settings",
|
| 120 |
+
"fields" => array(
|
| 121 |
+
"name" => array(
|
| 122 |
+
"name" => esc_html__( 'Name', 'modula-gallery' ),
|
| 123 |
+
"type" => "text",
|
| 124 |
+
"description" => esc_html__( 'Name of the gallery, for internal use.', 'modula-gallery' ),
|
| 125 |
+
"excludeFrom" => array(),
|
| 126 |
+
),
|
| 127 |
+
"description" => array(
|
| 128 |
+
"name" => esc_html__( 'Description', 'modula-gallery' ),
|
| 129 |
+
"type" => "text",
|
| 130 |
+
"description" => esc_html__( 'This description is for internal use.', 'modula-gallery' ),
|
| 131 |
+
"excludeFrom" => array(),
|
| 132 |
+
),
|
| 133 |
+
"width" => array(
|
| 134 |
+
"name" => esc_html__( 'Width', 'modula-gallery' ),
|
| 135 |
+
"type" => "text",
|
| 136 |
+
"description" => esc_html__( 'Width of the gallery (i.e.: 100% or 500px)', 'modula-gallery' ),
|
| 137 |
+
"mu" => "px or %",
|
| 138 |
+
"excludeFrom" => array(),
|
| 139 |
+
),
|
| 140 |
+
"height" => array(
|
| 141 |
+
"name" => esc_html__( 'Height', 'modula-gallery' ),
|
| 142 |
+
"type" => "number",
|
| 143 |
+
"description" => esc_html__( 'Height of the gallery in pixels', 'modula-gallery' ),
|
| 144 |
+
"mu" => "px",
|
| 145 |
+
"excludeFrom" => array(),
|
| 146 |
+
),
|
| 147 |
+
"img_size" => array(
|
| 148 |
+
"name" => esc_html__( 'Minimum image size', 'modula-gallery' ),
|
| 149 |
+
"type" => "number",
|
| 150 |
+
"description" => esc_html__( 'Minimum width or height of the images', 'modula-gallery' ),
|
| 151 |
+
"mu" => "px or %",
|
| 152 |
+
"excludeFrom" => array(),
|
| 153 |
+
),
|
| 154 |
+
"margin" => array(
|
| 155 |
+
"name" => esc_html__( 'Margin', 'modula-gallery' ),
|
| 156 |
+
"type" => "number",
|
| 157 |
+
"description" => esc_html__( 'Margin between images', 'modula-gallery' ),
|
| 158 |
+
"mu" => "px",
|
| 159 |
+
"excludeFrom" => array(),
|
| 160 |
+
),
|
| 161 |
+
"randomFactor" => array(
|
| 162 |
+
"name" => esc_html__( 'Random factor', 'modula-gallery' ),
|
| 163 |
+
"type" => "ui-slider",
|
| 164 |
+
"description" => "",
|
| 165 |
+
"min" => 0,
|
| 166 |
+
"max" => 100,
|
| 167 |
+
"mu" => "%",
|
| 168 |
+
"default" => 20,
|
| 169 |
+
"excludeFrom" => array(),
|
| 170 |
+
),
|
| 171 |
+
"filters" => array(
|
| 172 |
+
"name" => esc_html__( 'Filters', 'modula-gallery' ),
|
| 173 |
+
"type" => "PRO_FEATURE",
|
| 174 |
+
"description" => esc_html__( 'Add your own filters here. Each image can have one or more filters.', 'modula-gallery' ),
|
| 175 |
+
"excludeFrom" => array(),
|
| 176 |
+
),
|
| 177 |
+
"filterClick" => array(
|
| 178 |
+
"name" => esc_html__( 'Reload Page on filter click', 'modula-gallery' ),
|
| 179 |
+
"type" => "PRO_FEATURE",
|
| 180 |
+
"description" => esc_html__( 'Turn this feature ON if you want to use filters with most lightboxes', 'modula-gallery' ),
|
| 181 |
+
"excludeFrom" => array(),
|
| 182 |
+
),
|
| 183 |
+
"allFilterLabel" => array(
|
| 184 |
+
"name" => esc_html__( 'Text for "All" filter', 'modula-gallery' ),
|
| 185 |
+
"type" => "PRO_FEATURE",
|
| 186 |
+
"description" => esc_html__( 'Write here the label for the "All" filter', 'modula-gallery' ),
|
| 187 |
+
"default" => "All",
|
| 188 |
+
"excludeFrom" => array(),
|
| 189 |
+
),
|
| 190 |
+
"lightbox" => array(
|
| 191 |
+
"name" => esc_html__( 'Lightbox & Links', 'modula-gallery' ),
|
| 192 |
+
"type" => "select",
|
| 193 |
+
"description" => esc_html__( 'Define here what happens when user click on the images.', 'modula-gallery' ),
|
| 194 |
+
"values" => array(
|
| 195 |
+
"Link" => array(
|
| 196 |
+
"|" . esc_html__( 'No link', 'modula-gallery' ),
|
| 197 |
+
"direct|" . esc_html__( 'Direct link to image', 'modula-gallery' ),
|
| 198 |
+
"|" . esc_html__( 'Attachment page', 'modula-gallery' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
),
|
| 200 |
+
"Lightboxes" => array( "lightbox2|Lightbox" ),
|
| 201 |
),
|
| 202 |
+
"disabled" => array(
|
| 203 |
+
"Lightboxes with PRO license" => array(
|
| 204 |
+
"magnific|Magnific popup",
|
| 205 |
+
"prettyphoto|PrettyPhoto",
|
| 206 |
+
"fancybox|FancyBox",
|
| 207 |
+
"swipebox|SwipeBox",
|
| 208 |
+
"lightbox2|Lightbox",
|
| 209 |
+
),
|
| 210 |
),
|
| 211 |
+
"excludeFrom" => array(),
|
| 212 |
),
|
| 213 |
+
"shuffle" => array(
|
| 214 |
+
"name" => esc_html__( 'Shuffle images', 'modula-gallery' ),
|
| 215 |
+
"type" => "toggle",
|
| 216 |
+
"default" => "T",
|
| 217 |
+
"description" => esc_html__( 'Flag it if you want to shuffle the gallery at each page load', 'modula-gallery' ),
|
| 218 |
+
"excludeFrom" => array(),
|
| 219 |
+
),
|
| 220 |
+
),
|
| 221 |
+
);
|
| 222 |
+
$this->fields[ esc_html__( 'Captions', 'modula-gallery' ) ] = array(
|
| 223 |
+
"icon" => "mdi mdi-comment-text-outline",
|
| 224 |
+
"fields" => array(
|
| 225 |
+
"captionColor" => array(
|
| 226 |
+
"name" => esc_html__( 'Caption color', 'modula-gallery' ),
|
| 227 |
+
"type" => "color",
|
| 228 |
+
"description" => esc_html__( 'Color of the caption.', 'modula-gallery' ),
|
| 229 |
+
"default" => "#ffffff",
|
| 230 |
+
"excludeFrom" => array(),
|
| 231 |
+
),
|
| 232 |
+
"wp_field_caption" => array(
|
| 233 |
+
"name" => esc_html__( 'Populate caption from', 'modula-gallery' ),
|
| 234 |
+
"type" => "select",
|
| 235 |
+
"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' ),
|
| 236 |
+
"values" => array(
|
| 237 |
+
"Field" => array(
|
| 238 |
+
"none|" . esc_html__( 'Don\'t Populate', 'modula-gallery' ),
|
| 239 |
+
"title|" . esc_html__( 'WP Image title', 'modula-gallery' ),
|
| 240 |
+
"caption|" . esc_html__( 'WP Image caption', 'modula-gallery' ),
|
| 241 |
+
"description|" . esc_html__( 'WP Image description', 'modula-gallery' ),
|
| 242 |
),
|
|
|
|
| 243 |
),
|
| 244 |
+
"excludeFrom" => array( "shortcode" ),
|
| 245 |
+
),
|
| 246 |
+
"wp_field_title" => array(
|
| 247 |
+
"name" => esc_html__( 'Populate title from', 'modula-gallery' ),
|
| 248 |
+
"type" => "select",
|
| 249 |
+
"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' ),
|
| 250 |
+
"values" => array(
|
| 251 |
+
"Field" => array(
|
| 252 |
+
"none|" . esc_html__( 'Don\'t Populate', 'modula-gallery' ),
|
| 253 |
+
"title|" . esc_html__( 'WP Image title', 'modula-gallery' ),
|
| 254 |
+
"description|" . esc_html__( 'WP Image description', 'modula-gallery' ),
|
| 255 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
),
|
| 257 |
+
"excludeFrom" => array( "shortcode" ),
|
| 258 |
),
|
| 259 |
+
"hide_title" => array(
|
| 260 |
+
"name" => esc_html__( 'Image Title', 'modula-gallery' ),
|
| 261 |
+
"type" => "toggle",
|
| 262 |
+
"default" => "T",
|
| 263 |
+
"description" => esc_html__( 'Hide image title from frontend', 'modula-gallery' ),
|
| 264 |
+
"excludeFrom" => array(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
),
|
| 266 |
+
"hide_description" => array(
|
| 267 |
+
"name" => esc_html__( 'Image Description', 'modula-gallery' ),
|
| 268 |
+
"type" => "toggle",
|
| 269 |
+
"default" => "T",
|
| 270 |
+
"description" => esc_html__( 'Hide image description from frontend', 'modula-gallery' ),
|
| 271 |
+
"excludeFrom" => array(),
|
| 272 |
+
),
|
| 273 |
+
"captionFontSize" => array(
|
| 274 |
+
"name" => esc_html__( 'Caption Font Size', 'modula-gallery' ),
|
| 275 |
+
"type" => "number",
|
| 276 |
+
"description" => "",
|
| 277 |
+
"mu" => "px",
|
| 278 |
+
"excludeFrom" => array(),
|
| 279 |
+
),
|
| 280 |
+
"titleFontSize" => array(
|
| 281 |
+
"name" => esc_html__( 'Title Font Size', 'modula-gallery' ),
|
| 282 |
+
"type" => "number",
|
| 283 |
+
"description" => "",
|
| 284 |
+
"mu" => "px",
|
| 285 |
+
"excludeFrom" => array(),
|
| 286 |
+
),
|
| 287 |
+
),
|
| 288 |
+
);
|
| 289 |
|
| 290 |
+
$this->fields[ esc_html__( 'Social', 'modula-gallery' ) ] = array(
|
| 291 |
+
"icon" => "mdi mdi-link-variant",
|
| 292 |
+
"fields" => array(
|
| 293 |
+
"enableTwitter" => array(
|
| 294 |
+
"name" => esc_html__( 'Add Twitter icon', 'modula-gallery' ),
|
| 295 |
+
"type" => "toggle",
|
| 296 |
+
"default" => "T",
|
| 297 |
+
"description" => esc_html__( 'Enable Twitter Sharing', 'modula-gallery' ),
|
| 298 |
+
"excludeFrom" => array(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
),
|
| 300 |
+
"enableFacebook" => array(
|
| 301 |
+
"name" => esc_html__( 'Add Facebook icon', 'modula-gallery' ),
|
| 302 |
+
"type" => "toggle",
|
| 303 |
+
"default" => "T",
|
| 304 |
+
"description" => esc_html__( 'Enable Facebook Sharing', 'modula-gallery' ),
|
| 305 |
+
"excludeFrom" => array(),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
),
|
| 307 |
+
"enableGplus" => array(
|
| 308 |
+
"name" => esc_html__( 'Add Google Plus icon', 'modula-gallery' ),
|
| 309 |
+
"type" => "toggle",
|
| 310 |
+
"default" => "T",
|
| 311 |
+
"description" => esc_html__( 'Enable Google Plus Sharing', 'modula-gallery' ),
|
| 312 |
+
"excludeFrom" => array(),
|
| 313 |
+
),
|
| 314 |
+
"enablePinterest" => array(
|
| 315 |
+
"name" => esc_html__( 'Add Pinterest icon', 'modula-gallery' ),
|
| 316 |
+
"type" => "toggle",
|
| 317 |
+
"default" => "T",
|
| 318 |
+
"description" => esc_html__( 'Enable Pinterest Sharing', 'modula-gallery' ),
|
| 319 |
+
"excludeFrom" => array(),
|
| 320 |
+
),
|
| 321 |
+
"socialIconColor" => array(
|
| 322 |
+
"name" => esc_html__( 'Color of social sharing icons', 'modula-gallery' ),
|
| 323 |
+
"type" => "color",
|
| 324 |
+
"description" => esc_html__( 'Set the color of the social sharing icons', 'modula-gallery' ),
|
| 325 |
+
"default" => "#ffffff",
|
| 326 |
+
"excludeFrom" => array(),
|
| 327 |
+
),
|
| 328 |
+
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
|
| 330 |
+
);
|
| 331 |
+
$this->fields[ esc_html__( 'Image loaded effects', 'modula-gallery' ) ] = array(
|
| 332 |
+
"icon" => "mdi mdi-reload",
|
| 333 |
+
"fields" => array(
|
| 334 |
+
"loadedScale" => array(
|
| 335 |
+
"name" => esc_html__( 'Scale', 'modula-gallery' ),
|
| 336 |
+
"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' ),
|
| 337 |
+
"type" => "ui-slider",
|
| 338 |
+
"min" => 0,
|
| 339 |
+
"max" => 200,
|
| 340 |
+
"mu" => "%",
|
| 341 |
+
"default" => 100,
|
| 342 |
+
"excludeFrom" => array(),
|
| 343 |
),
|
| 344 |
+
"loadedRotate" => array(
|
| 345 |
+
"name" => esc_html__( 'Rotate', 'modula-gallery' ),
|
| 346 |
+
"description" => "",
|
| 347 |
+
"type" => "PRO_FEATURE",
|
| 348 |
+
"min" => - 180,
|
| 349 |
+
"max" => 180,
|
| 350 |
+
"default" => 0,
|
| 351 |
+
"mu" => "deg",
|
| 352 |
+
"excludeFrom" => array(),
|
| 353 |
+
),
|
| 354 |
+
"loadedHSlide" => array(
|
| 355 |
+
"name" => esc_html__( 'Horizontal slide', 'modula-gallery' ),
|
| 356 |
+
"description" => "",
|
| 357 |
+
"type" => "PRO_FEATURE",
|
| 358 |
+
"min" => - 100,
|
| 359 |
+
"max" => 100,
|
| 360 |
+
"mu" => "px",
|
| 361 |
+
"default" => 0,
|
| 362 |
+
"excludeFrom" => array(),
|
| 363 |
+
),
|
| 364 |
+
"loadedVSlide" => array(
|
| 365 |
+
"name" => esc_html__( 'Vertical slide', 'modula-gallery' ),
|
| 366 |
+
"description" => "",
|
| 367 |
+
"type" => "PRO_FEATURE",
|
| 368 |
+
"min" => - 100,
|
| 369 |
+
"max" => 100,
|
| 370 |
+
"mu" => "px",
|
| 371 |
+
"default" => 0,
|
| 372 |
+
"excludeFrom" => array(),
|
| 373 |
),
|
|
|
|
| 374 |
|
| 375 |
+
),
|
| 376 |
+
);
|
| 377 |
+
$this->fields[ esc_html__( 'Hover effect', 'modula-gallery' ) ] = array(
|
| 378 |
+
"icon" => "mdi mdi-blur",
|
| 379 |
+
"fields" => array(
|
| 380 |
+
"Effect" => array(
|
| 381 |
+
"name" => esc_html__( 'Effect', 'modula-gallery' ),
|
| 382 |
+
"description" => esc_html__( 'Select an hover effect', 'modula-gallery' ),
|
| 383 |
+
"type" => "hover-effect",
|
| 384 |
+
"excludeFrom" => array(),
|
| 385 |
+
),
|
| 386 |
+
),
|
| 387 |
+
);
|
| 388 |
+
$this->fields[ esc_html__( 'Style', 'modula-gallery' ) ] = array(
|
| 389 |
+
"icon" => "mdi mdi-format-paint",
|
| 390 |
+
"fields" => array(
|
| 391 |
+
"borderSize" => array(
|
| 392 |
+
"name" => esc_html__( 'Border Size', 'modula-gallery' ),
|
| 393 |
+
"type" => "ui-slider",
|
| 394 |
+
"description" => "",
|
| 395 |
+
"mu" => "px",
|
| 396 |
+
"min" => 0,
|
| 397 |
+
"max" => 10,
|
| 398 |
+
"default" => 0,
|
| 399 |
+
"excludeFrom" => array(),
|
| 400 |
+
),
|
| 401 |
+
"borderRadius" => array(
|
| 402 |
+
"name" => esc_html__( 'Border Radius', 'modula-gallery' ),
|
| 403 |
+
"type" => "ui-slider",
|
| 404 |
+
"description" => "",
|
| 405 |
+
"mu" => "px",
|
| 406 |
+
"min" => 0,
|
| 407 |
+
"max" => 100,
|
| 408 |
+
"default" => 0,
|
| 409 |
+
"excludeFrom" => array(),
|
| 410 |
+
),
|
| 411 |
+
"borderColor" => array(
|
| 412 |
+
"name" => esc_html__( 'Border Color', 'modula-gallery' ),
|
| 413 |
+
"type" => "color",
|
| 414 |
+
"description" => "",
|
| 415 |
+
"default" => "#ffffff",
|
| 416 |
+
"excludeFrom" => array(),
|
| 417 |
+
),
|
| 418 |
+
"shadowSize" => array(
|
| 419 |
+
"name" => esc_html__( 'Shadow Size', 'modula-gallery' ),
|
| 420 |
+
"type" => "ui-slider",
|
| 421 |
+
"description" => "",
|
| 422 |
+
"mu" => "px",
|
| 423 |
+
"min" => 0,
|
| 424 |
+
"max" => 20,
|
| 425 |
+
"default" => 0,
|
| 426 |
+
"excludeFrom" => array(),
|
| 427 |
+
),
|
| 428 |
+
"shadowColor" => array(
|
| 429 |
+
"name" => esc_html__( 'Shadow Color', 'modula-gallery' ),
|
| 430 |
+
"type" => "color",
|
| 431 |
+
"description" => "",
|
| 432 |
+
"default" => "#ffffff",
|
| 433 |
+
"excludeFrom" => array(),
|
| 434 |
+
),
|
| 435 |
|
| 436 |
+
),
|
| 437 |
+
);
|
| 438 |
+
$this->fields[ esc_html__( 'Customizations', 'modula-gallery' ) ] = array(
|
| 439 |
+
"icon" => "mdi mdi-puzzle",
|
| 440 |
+
"fields" => array(
|
| 441 |
+
"script" => array(
|
| 442 |
+
"name" => esc_html__( 'Custom scripts', 'modula-gallery' ),
|
| 443 |
+
"type" => "textarea",
|
| 444 |
+
"description" => esc_html__( 'This script will be called after the gallery initialization. Useful for custom lightboxes.', 'modula-gallery' ) . "
|
| 445 |
+
<br />
|
| 446 |
+
<br />
|
| 447 |
+
<strong>Write just the code without using the <script></script> tags</strong>",
|
| 448 |
+
"excludeFrom" => array( "shortcode" ),
|
| 449 |
+
),
|
| 450 |
+
"style" => array(
|
| 451 |
+
"name" => esc_html__( 'Custom css', 'modula-gallery' ),
|
| 452 |
+
"type" => "textarea",
|
| 453 |
+
"description" => '<strong>' . esc_html__( 'Write just the code without using the <style></style> tags', 'modula-gallery' ) . '</strong>',
|
| 454 |
+
"excludeFrom" => array( "shortcode" ),
|
| 455 |
+
),
|
| 456 |
+
),
|
| 457 |
+
);
|
| 458 |
|
| 459 |
+
}
|
|
|
|
|
|
|
| 460 |
|
| 461 |
+
public function modula_beta_scripts( $hook ) {
|
|
|
|
| 462 |
|
| 463 |
+
if ( 'modula_page_modula-lite-gallery-v2' != $hook ) {
|
| 464 |
+
return;
|
| 465 |
}
|
| 466 |
|
| 467 |
+
wp_enqueue_script( 'modula-fancybox', plugins_url( 'admin/fancybox/jquery.fancybox.min.js', __FILE__), array( 'jquery' ) );
|
| 468 |
+
wp_enqueue_style( 'modula-fancybox', plugins_url( 'admin/fancybox/jquery.fancybox.min.css', __FILE__) );
|
|
|
|
|
|
|
|
|
|
| 469 |
|
| 470 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
|
| 472 |
+
//Define textdomain
|
| 473 |
+
public function create_textdomain() {
|
| 474 |
+
$plugin_dir = basename( dirname( __FILE__ ) );
|
| 475 |
+
load_plugin_textdomain( 'modula-gallery', false, $plugin_dir . '/lib/languages' );
|
| 476 |
+
}
|
| 477 |
|
| 478 |
+
function define_hover_effects() {
|
| 479 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'None', 'none', false, false, 0 );
|
| 480 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Pufrobo', 'pufrobo', true, true, 4 );
|
| 481 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Fluid Up', '', true, true, 0 );
|
| 482 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Hide', '', true, true, 4 );
|
| 483 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Quiet', '', true, false, 4 );
|
| 484 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Catinelle', '', false, false, 4 );
|
| 485 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Reflex', '', true, true, 4 );
|
| 486 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Curtain', '', true, false, 4 );
|
| 487 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Lens', '', true, true, 4 );
|
| 488 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Appear', '', true, false, 4 );
|
| 489 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Crafty', '', true, true, 0 );
|
| 490 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Seemo', '', true, false, 4 );
|
| 491 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect( 'Comodo', '', true, false, 4 );
|
| 492 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 493 |
|
| 494 |
+
public function get_ext_galleries() {
|
| 495 |
+
header( "Content-type: application/json" );
|
|
|
|
|
|
|
| 496 |
|
| 497 |
+
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
|
| 499 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
| 500 |
+
$res = array( "success" => 0 );
|
| 501 |
|
| 502 |
+
$source = $_POST['source'];
|
| 503 |
+
if ( $source ) {
|
| 504 |
+
$res['success'] = 1;
|
| 505 |
+
$res['galleries'] = array();
|
| 506 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
switch ( $source ) {
|
| 508 |
case 'Envira':
|
| 509 |
+
$galleries = get_posts( array(
|
| 510 |
+
'post_type' => 'envira',
|
| 511 |
+
'posts_per_page' => 1000,
|
| 512 |
+
) );
|
| 513 |
+
foreach ( $galleries as $g ) {
|
| 514 |
+
$item = array();
|
| 515 |
+
$item['id'] = $g->ID;
|
| 516 |
+
$item['title'] = $g->post_title;
|
| 517 |
+
$res['galleries'] [] = $item;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 518 |
}
|
|
|
|
| 519 |
break;
|
| 520 |
case 'NextGen':
|
| 521 |
+
$galleries = $wpdb->get_results( "SELECT title, gid FROM $wpdb->nggallery" );
|
| 522 |
+
foreach ( $galleries as $g ) {
|
| 523 |
+
$item = array();
|
| 524 |
+
$item['id'] = $g->gid;
|
| 525 |
+
$item['title'] = $g->title;
|
| 526 |
+
$res['galleries'] [] = $item;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 527 |
}
|
|
|
|
| 528 |
break;
|
| 529 |
}
|
|
|
|
|
|
|
| 530 |
}
|
| 531 |
+
|
| 532 |
+
echo json_encode( $res );
|
| 533 |
}
|
| 534 |
+
die();
|
| 535 |
+
}
|
| 536 |
|
| 537 |
+
public function admin_footer( $text ) {
|
| 538 |
+
global $current_screen;
|
| 539 |
+
if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'modula-lite' ) !== false ) {
|
| 540 |
+
$url = 'https://wordpress.org/support/plugin/modula-best-grid-gallery/reviews/?rate=5#new-post';
|
| 541 |
+
$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 );
|
| 542 |
+
}
|
|
|
|
| 543 |
|
| 544 |
+
return $text;
|
| 545 |
+
}
|
| 546 |
|
| 547 |
+
public function do_import_galleries() {
|
| 548 |
+
global $wpdb;
|
| 549 |
+
|
| 550 |
+
header( "Content-type: application/json" );
|
| 551 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
| 552 |
+
$res = array( "success" => 0 );
|
| 553 |
+
$source = $_POST['source'];
|
| 554 |
+
$ids = explode( ",", $_POST['ids'] );
|
| 555 |
+
switch ( $source ) {
|
| 556 |
+
case 'Envira':
|
| 557 |
+
foreach ( $ids as $id ) {
|
| 558 |
+
$gallery = get_post( $id );
|
| 559 |
+
$meta = get_post_meta( $id );
|
| 560 |
+
$data = unserialize( $meta['_eg_gallery_data'][0] );
|
| 561 |
+
|
| 562 |
+
$g = array(
|
| 563 |
+
'name' => $data['config']['title'],
|
| 564 |
+
'description' => 'Imported from Envira (' . $id . ') on ' . date( 'M, d Y' ),
|
| 565 |
+
'margin' => $data['config']['gutter'],
|
| 566 |
+
'hasResizedImages' => true,
|
| 567 |
+
'importedFrom' => 'Envira',
|
| 568 |
+
);
|
| 569 |
+
$gdb = array_merge( $this->defaultValues, $g );
|
| 570 |
+
|
| 571 |
+
$saved = $this->ModulaDB->addGallery( $gdb );
|
| 572 |
+
$newId = $this->ModulaDB->getNewGalleryId();
|
| 573 |
+
|
| 574 |
+
if ( $newId && count( $data['gallery'] ) ) {
|
| 575 |
+
$images = array();
|
| 576 |
+
//TODO only active images
|
| 577 |
+
foreach ( $data['gallery'] as $item ) {
|
| 578 |
+
$toAdd = new stdClass();
|
| 579 |
+
$toAdd->imageId = $this->ModulaDB->getIDbyGUID( $item['src'] );
|
| 580 |
+
$toAdd->title = $item['title'];
|
| 581 |
+
$toAdd->description = $item['caption'];
|
| 582 |
+
$toAdd->imagePath = $item['src'];
|
| 583 |
+
|
| 584 |
+
$images [] = $toAdd;
|
| 585 |
+
}
|
| 586 |
+
$imgResult = $this->ModulaDB->addImages( $newId, $images );
|
| 587 |
+
}
|
| 588 |
+
}
|
| 589 |
+
$res['success'] = 1;
|
| 590 |
+
break;
|
| 591 |
+
case 'NextGen':
|
| 592 |
+
foreach ( $ids as $id ) {
|
| 593 |
+
$gallery = $wpdb->get_row( $wpdb->prepare( "SELECT title, gid, path FROM $wpdb->nggallery WHERE gid=%s", $id ) );
|
| 594 |
+
|
| 595 |
+
$dbimages = $wpdb->get_results( $wpdb->prepare( "SELECT filename, description, alttext FROM $wpdb->nggpictures WHERE exclude <> 1 AND galleryid=%s", $id ) );
|
| 596 |
+
|
| 597 |
+
$g = array(
|
| 598 |
+
'name' => $gallery->title,
|
| 599 |
+
'description' => 'Imported from NextGet (' . $id . ') on ' . date( 'M, d Y' ),
|
| 600 |
+
'hasResizedImages' => true,
|
| 601 |
+
'importedFrom' => 'NextGen',
|
| 602 |
+
);
|
| 603 |
+
$gdb = array_merge( $this->defaultValues, $g );
|
| 604 |
|
| 605 |
+
$saved = $this->ModulaDB->addGallery( $gdb );
|
| 606 |
+
$newId = $this->ModulaDB->getNewGalleryId();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 607 |
|
| 608 |
+
if ( $newId && count( $dbimages ) ) {
|
| 609 |
+
$images = array();
|
| 610 |
+
foreach ( $dbimages as $item ) {
|
| 611 |
+
$toAdd = new stdClass();
|
| 612 |
+
$toAdd->imageId = - 1;
|
| 613 |
+
$toAdd->title = $item->alttext;
|
| 614 |
+
$toAdd->description = $item->description;
|
| 615 |
+
$toAdd->imagePath = plugins_url( 'image.php', __FILE__ ) . "?w=" . $this->defaultValues['img_size'] . "&src=" . $gallery->path . "/" . $item->filename;
|
| 616 |
|
| 617 |
+
$images [] = $toAdd;
|
| 618 |
+
}
|
| 619 |
+
$imgResult = $this->ModulaDB->addImages( $newId, $images );
|
|
|
|
| 620 |
|
| 621 |
+
}
|
| 622 |
+
}
|
| 623 |
+
$res['success'] = 1;
|
| 624 |
+
break;
|
| 625 |
}
|
| 626 |
|
| 627 |
+
echo json_encode( $res );
|
| 628 |
}
|
| 629 |
+
die();
|
| 630 |
+
}
|
| 631 |
|
| 632 |
+
public function register_links( $links, $file ) {
|
| 633 |
+
$base = plugin_basename( __FILE__ );
|
| 634 |
+
if ( $file == $base ) {
|
| 635 |
+
$links[] = '<a href="admin.php?page=modula-lite-admin" title="' . esc_html__( 'Modula Grid Gallery Dashboard', 'modula-gallery' ) . '">' . esc_html__( 'Dashboard', 'modula-gallery' ) . '</a>';
|
| 636 |
+
$links[] = '<a href="https://twitter.com/MachoThemez" title="@MachoThemez on Twitter">Twitter</a>';
|
| 637 |
+
$links[] = '<a href="https://www.facebook.com/machothemes" title="MachoThemes on Facebook">Facebook</a>';
|
| 638 |
+
}
|
| 639 |
|
| 640 |
+
return $links;
|
| 641 |
|
| 642 |
+
}
|
| 643 |
|
| 644 |
+
//delete gallery
|
| 645 |
+
function delete_gallery() {
|
| 646 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
| 647 |
+
$id = absint( $_POST['gid'] );
|
| 648 |
+
$this->ModulaDB->deleteGallery( $id );
|
| 649 |
}
|
| 650 |
|
| 651 |
+
die();
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
public function update_config() {
|
| 655 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
| 656 |
+
$id = absint($_POST['id']);
|
| 657 |
+
$config = stripslashes( $_POST['config'] );
|
| 658 |
+
|
| 659 |
+
$this->ModulaDB->update_config( $id, $config );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 660 |
}
|
| 661 |
|
| 662 |
+
die();
|
| 663 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 664 |
|
| 665 |
+
public function get_config() {
|
| 666 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
| 667 |
+
$id = absint($_POST['id']);
|
|
|
|
| 668 |
|
| 669 |
+
$data = $this->ModulaDB->getConfig( $id );
|
| 670 |
+
|
| 671 |
+
print json_encode( $data );
|
| 672 |
|
|
|
|
| 673 |
}
|
| 674 |
|
| 675 |
+
die();
|
| 676 |
+
}
|
| 677 |
|
| 678 |
+
//add gallery
|
| 679 |
+
|
| 680 |
+
function create_gallery() {
|
| 681 |
+
if ( check_admin_referer( "Modula", "Modula" ) ) {
|
| 682 |
+
$data = $this->defaultValues;
|
| 683 |
+
$data["name"] = sanitize_text_field($_POST['name']);
|
| 684 |
+
$data["description"] = wp_filter_post_kses($_POST['description']);
|
| 685 |
+
$data["width"] = sanitize_text_field($_POST['width']);
|
| 686 |
+
$data["height"] = absint($_POST['height']);
|
| 687 |
+
$data["img_size"] = absint( $_POST['img_size'] );
|
| 688 |
+
$data["hasResizedImages"] = true;
|
| 689 |
+
|
| 690 |
+
$this->ModulaDB->addGallery( $data );
|
| 691 |
+
$id = $this->ModulaDB->getLastGalleryId()->Id;
|
| 692 |
+
|
| 693 |
+
if ( $id > 0 && array_key_exists( 'images', $_POST ) && strlen( $_POST['images'] ) ) {
|
| 694 |
+
$enc_images = stripslashes( $_POST["images"] );
|
| 695 |
+
$images = array_splice( json_decode( $enc_images ), 0, 11 + 9 );
|
| 696 |
+
ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
| 697 |
+
$result = $this->ModulaDB->addImages( $id, $images );
|
| 698 |
}
|
| 699 |
+
print $id;
|
| 700 |
+
}
|
| 701 |
+
die;
|
| 702 |
+
}
|
| 703 |
|
| 704 |
+
//clone gallery
|
| 705 |
+
function clone_gallery() {
|
| 706 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
| 707 |
+
$sourceId = absint( $_POST['gid'] );
|
| 708 |
+
$g = $this->ModulaDB->getGalleryById( $sourceId, $this->defaultValues );
|
| 709 |
+
$g->name .= "(copy)";
|
| 710 |
+
$this->ModulaDB->addGallery( $g );
|
| 711 |
+
$id = $this->ModulaDB->getNewGalleryId();
|
| 712 |
+
$images = $this->ModulaDB->getImagesByGalleryId( $sourceId );
|
| 713 |
+
|
| 714 |
+
foreach ( $images as &$image ) {
|
| 715 |
+
$image->Id = null;
|
| 716 |
+
$image->gid = $id;
|
| 717 |
}
|
| 718 |
|
| 719 |
+
$this->ModulaDB->addImages( $id, $images );
|
|
|
|
|
|
|
| 720 |
}
|
| 721 |
|
| 722 |
+
die();
|
| 723 |
+
}
|
| 724 |
|
| 725 |
|
| 726 |
+
//Define constants
|
| 727 |
+
public function define_constants() {
|
| 728 |
+
if ( ! defined( 'Modula_PLUGIN_BASENAME' ) ) {
|
| 729 |
+
define( 'Modula_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
| 730 |
+
}
|
| 731 |
|
| 732 |
+
if ( ! defined( 'Modula_PLUGIN_NAME' ) ) {
|
| 733 |
+
define( 'Modula_PLUGIN_NAME', trim( dirname( Modula_PLUGIN_BASENAME ), '/' ) );
|
| 734 |
}
|
| 735 |
|
| 736 |
+
if ( ! defined( 'Modula_PLUGIN_DIR' ) ) {
|
| 737 |
+
define( 'Modula_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . Modula_PLUGIN_NAME );
|
| 738 |
+
}
|
| 739 |
+
}
|
| 740 |
|
| 741 |
+
//delete Gallery
|
|
|
|
|
|
|
| 742 |
|
|
|
|
|
|
|
| 743 |
|
| 744 |
+
//Define DB tables
|
| 745 |
+
public function define_db_tables() {
|
| 746 |
+
global $wpdb;
|
| 747 |
|
| 748 |
+
$wpdb->ModulaGalleries = $wpdb->prefix . 'modula';
|
| 749 |
+
$wpdb->ModulaImages = $wpdb->prefix . 'modula_images';
|
| 750 |
+
}
|
| 751 |
|
|
|
|
|
|
|
| 752 |
|
| 753 |
+
public function create_db_conn() {
|
| 754 |
+
require( 'lib/db-class.php' );
|
| 755 |
+
$ModulaDB = ModulaLiteDB::getInstance();
|
| 756 |
|
| 757 |
+
return $ModulaDB;
|
| 758 |
+
}
|
|
|
|
| 759 |
|
| 760 |
+
public function editor_button( $buttons ) {
|
| 761 |
+
array_push( $buttons, 'separator', 'mtg_shortcode_editor' );
|
| 762 |
|
| 763 |
+
return $buttons;
|
| 764 |
+
}
|
|
|
|
| 765 |
|
| 766 |
+
public function register_editor_plugin( $plugin_array ) {
|
| 767 |
+
$plugin_array['mtg_shortcode_editor'] = plugins_url( '/admin/scripts/editor-plugin.js', __file__ );
|
|
|
|
| 768 |
|
| 769 |
+
return $plugin_array;
|
| 770 |
+
}
|
| 771 |
|
| 772 |
+
public function mtg_shortcode_editor() {
|
| 773 |
+
$css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
|
| 774 |
+
$admin_url = admin_url();
|
| 775 |
|
| 776 |
+
$galleries = $this->ModulaDB->getGalleries(); //load all galleries
|
|
|
|
| 777 |
|
| 778 |
+
include 'admin/include/tinymce-galleries.php';
|
| 779 |
+
die();
|
| 780 |
+
}
|
| 781 |
|
| 782 |
+
//Add gallery scripts
|
| 783 |
+
public function add_gallery_scripts() {
|
| 784 |
+
wp_enqueue_script( 'jquery' );
|
|
|
|
|
|
|
| 785 |
|
| 786 |
+
wp_register_script( 'modula', plugins_url( 'scripts/jquery.modula.js', __FILE__ ) , array( 'jquery' ) );
|
| 787 |
+
wp_enqueue_script( 'modula' );
|
| 788 |
|
| 789 |
+
wp_register_style( 'modula_stylesheet', plugins_url( 'scripts/modula.css', __FILE__ ), null, $this->version );
|
| 790 |
+
wp_enqueue_style( 'modula_stylesheet' );
|
| 791 |
|
| 792 |
+
wp_register_style( 'effects_stylesheet', plugins_url( 'scripts/effects.css', __FILE__ ), null, $this->version );
|
| 793 |
+
wp_enqueue_style( 'effects_stylesheet' );
|
| 794 |
|
| 795 |
+
wp_register_script( 'lightbox2_script', plugins_url( 'lightbox/lightbox2/js/lightbox.min.js', __FILE__ ), array( 'jquery' ), $this->version, true );
|
| 796 |
+
wp_register_style( 'lightbox2_stylesheet', plugins_url( 'lightbox/lightbox2/css/lightbox.min.css', __FILE__ ) );
|
| 797 |
+
}
|
| 798 |
|
| 799 |
+
//Admin Section - register scripts and styles
|
| 800 |
+
public function gallery_admin_init() {
|
| 801 |
+
if ( function_exists( 'wp_enqueue_media' ) ) {
|
| 802 |
+
wp_enqueue_media();
|
| 803 |
+
}
|
| 804 |
|
| 805 |
+
wp_enqueue_script( 'jquery' );
|
|
|
|
| 806 |
|
| 807 |
+
wp_enqueue_script( 'wp-color-picker' );
|
| 808 |
+
wp_enqueue_style( 'wp-color-picker' );
|
| 809 |
|
| 810 |
+
wp_enqueue_script( 'media-upload' );
|
| 811 |
+
wp_enqueue_script( 'thickbox' );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 812 |
|
| 813 |
+
wp_register_style( 'materialize', plugins_url( 'admin/css/materialize.css', __FILE__ ) );
|
| 814 |
+
wp_enqueue_style( 'materialize' );
|
| 815 |
|
| 816 |
+
wp_register_style( 'styles', plugins_url( 'admin/css/style.css', __FILE__ ) );
|
| 817 |
+
wp_enqueue_style( 'styles' );
|
| 818 |
|
| 819 |
+
wp_register_style( 'effects', plugins_url( 'scripts/effects.css', __FILE__ ) );
|
| 820 |
+
wp_enqueue_style( 'effects' );
|
| 821 |
|
| 822 |
+
wp_register_script( 'materialize', plugins_url( 'admin/scripts/materialize.js', __FILE__ ), array( 'jquery' ) );
|
|
|
|
| 823 |
|
| 824 |
+
wp_register_script( 'modula', plugins_url( 'admin/scripts/modula-admin.js', __FILE__ ), array(
|
| 825 |
+
'materialize',
|
| 826 |
+
'jquery',
|
| 827 |
+
'media-upload',
|
| 828 |
+
'thickbox',
|
| 829 |
+
), false, false );
|
| 830 |
+
|
| 831 |
+
wp_enqueue_script( 'modula' );
|
| 832 |
+
|
| 833 |
+
wp_register_style( 'materialdesign-icons', plugins_url( 'admin/css/materialdesignicons.css', __FILE__ ) );
|
| 834 |
+
wp_enqueue_style( 'materialdesign-icons' );
|
| 835 |
+
|
| 836 |
+
wp_enqueue_style( 'thickbox' );
|
| 837 |
+
|
| 838 |
+
$tg_db_version = '1.0';
|
| 839 |
+
$installed_ver = get_option( "Modula_db_version" );
|
| 840 |
+
|
| 841 |
+
if ( $installed_ver != $tg_db_version ) {
|
| 842 |
+
modula_lite_create_db_tables();
|
| 843 |
+
update_option( "Modula_db_version", $tg_db_version );
|
| 844 |
}
|
| 845 |
+
}
|
| 846 |
|
| 847 |
|
| 848 |
+
//Create Admin Menu
|
| 849 |
+
public function add_gallery_admin_menu() {
|
| 850 |
+
$overview = add_menu_page( esc_html__( 'Manage Galleries', 'modula-gallery' ), esc_html__( 'Modula', 'modula-gallery' ), 'edit_posts', 'modula-lite-admin', array(
|
| 851 |
+
$this,
|
| 852 |
+
'add_overview',
|
| 853 |
+
), plugins_url( 'admin/icon.png', __FILE__ ) );
|
| 854 |
|
| 855 |
|
| 856 |
+
if ( ! get_option( "Modula_skip_fix" ) && get_option( "Modula_db_version" ) && count( $this->ModulaDB->getGalleries() ) > 0 ) {
|
| 857 |
|
| 858 |
+
$imageUrl = null;
|
| 859 |
+
foreach ( $this->ModulaDB->getGalleries() as $gallery ) {
|
| 860 |
+
$gid = $gallery->Id;
|
| 861 |
+
$images = $this->ModulaDB->getImagesByGalleryId( $gid );
|
| 862 |
+
if ( count( $images ) > 0 ) {
|
| 863 |
+
$imageUrl = $images[0]->imagePath;
|
| 864 |
+
break;
|
|
|
|
| 865 |
}
|
| 866 |
+
}
|
| 867 |
|
| 868 |
+
if ( $imageUrl ) {
|
| 869 |
+
if ( strncmp( strtolower( $imageUrl ), strtolower( site_url() ), strlen( site_url() ) ) != 0 ) {
|
| 870 |
+
$fix = add_submenu_page( 'modula-lite-admin', __( 'Modula >> Fix', 'modula-gallery' ), '❗️ ' . __( 'Fix', 'modula-gallery' ), 'edit_posts', 'modula-lite-gallery-fix', array(
|
| 871 |
+
$this,
|
| 872 |
+
'fix',
|
| 873 |
+
) );
|
| 874 |
+
add_action( 'load-' . $fix, array( $this, 'gallery_admin_init' ) );
|
|
|
|
| 875 |
}
|
|
|
|
|
|
|
| 876 |
}
|
| 877 |
+
} else {
|
| 878 |
+
add_option( 'Modula_skip_fix', true );
|
| 879 |
+
}
|
| 880 |
|
| 881 |
+
$add_gallery = add_submenu_page( 'modula-lite-admin', __( 'Modula - Add Gallery', 'modula-gallery' ), __( 'Add Gallery', 'modula-gallery' ), 'edit_posts', 'modula-lite-add', array(
|
| 882 |
+
$this,
|
| 883 |
+
'add_gallery',
|
| 884 |
+
) );
|
| 885 |
+
$edit_gallery = add_submenu_page( NULL, __( 'Modula - Edit Gallery', 'modula-gallery' ), __( 'Edit Gallery', 'modula-gallery' ), 'edit_posts', 'modula-lite-edit', array(
|
| 886 |
+
$this,
|
| 887 |
+
'edit_gallery',
|
| 888 |
+
) );
|
| 889 |
+
$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(
|
| 890 |
+
$this,
|
| 891 |
+
'upgrade',
|
| 892 |
+
) );
|
| 893 |
+
$v2 = add_submenu_page( 'modula-lite-admin', __( 'Try Modula 2.0', 'modula-gallery' ), __( 'Try Modula 2.0', 'modula-gallery' ), 'edit_posts', 'modula-lite-gallery-v2', array(
|
| 894 |
+
$this,
|
| 895 |
+
'new_modula',
|
| 896 |
+
) );
|
| 897 |
+
|
| 898 |
+
|
| 899 |
+
add_action( 'load-' . $overview, array( $this, 'gallery_admin_init' ) );
|
| 900 |
+
add_action( 'load-' . $add_gallery, array( $this, 'gallery_admin_init' ) );
|
| 901 |
+
add_action( 'load-' . $edit_gallery, array( $this, 'gallery_admin_init' ) );
|
| 902 |
+
add_action( 'load-' . $upgrade, array( $this, 'gallery_admin_init' ) );
|
| 903 |
|
| 904 |
+
}
|
| 905 |
|
| 906 |
+
//Create Admin Pages
|
| 907 |
+
public function add_overview() {
|
| 908 |
+
include( "admin/overview.php" );
|
| 909 |
+
}
|
| 910 |
|
| 911 |
+
public function upgrade() {
|
| 912 |
+
include( "admin/upgrade.php" );
|
| 913 |
+
}
|
| 914 |
|
| 915 |
+
public function add_gallery() {
|
| 916 |
+
include( "admin/add-gallery.php" );
|
| 917 |
+
}
|
| 918 |
|
| 919 |
+
public function new_modula() {
|
| 920 |
+
include( "admin/modula-v2.php" );
|
| 921 |
+
}
|
| 922 |
|
| 923 |
+
public function fix() {
|
| 924 |
+
global $wpdb;
|
| 925 |
+
include( "admin/fix.php" );
|
| 926 |
+
}
|
| 927 |
|
| 928 |
+
public function delete_image() {
|
| 929 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
| 930 |
+
foreach ( explode( ",", $_POST["id"] ) as $id ) {
|
| 931 |
+
$this->ModulaDB->deleteImage( absint( $id ) );
|
|
|
|
| 932 |
}
|
|
|
|
| 933 |
}
|
| 934 |
+
die();
|
| 935 |
+
}
|
| 936 |
|
| 937 |
+
public function add_image() {
|
| 938 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
| 939 |
+
$gid = intval( $_POST['galleryId'] );
|
| 940 |
+
$this->loadedData = $this->ModulaDB->getGalleryById( $gid, $this->defaultValues );
|
| 941 |
+
$prev = $this->ModulaDB->getImagesByGalleryId( $gid );
|
| 942 |
+
|
| 943 |
+
$enc_images = stripslashes( $_POST["enc_images"] );
|
| 944 |
+
$images = json_decode( $enc_images );
|
| 945 |
+
|
| 946 |
+
$d = 18 + log10( 100 );
|
| 947 |
+
$images = array_slice( $images, 0, $d - count( $prev ) );
|
| 948 |
+
$images = ModulaLiteTools::check_and_resize( $images, $this->loadedData->img_size );
|
| 949 |
+
$result = $this->ModulaDB->addImages( $gid, $images );
|
| 950 |
+
|
| 951 |
+
header( "Content-type: application/json" );
|
| 952 |
+
if ( $result === false ) {
|
| 953 |
+
print "{\"success\":false}";
|
| 954 |
+
} else {
|
| 955 |
+
print "{\"success\":true}";
|
|
|
|
| 956 |
}
|
|
|
|
| 957 |
}
|
| 958 |
+
die();
|
| 959 |
+
}
|
| 960 |
|
| 961 |
+
public function sort_images() {
|
| 962 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
| 963 |
+
$result = $this->ModulaDB->sortImages( explode( ',', $_POST['ids'] ) );
|
| 964 |
|
| 965 |
+
header( "Content-type: application/json" );
|
| 966 |
+
if ( $result === false ) {
|
| 967 |
+
print "{\"success\":false}";
|
| 968 |
+
} else {
|
| 969 |
+
print "{\"success\":true}";
|
|
|
|
| 970 |
}
|
|
|
|
| 971 |
}
|
| 972 |
+
die();
|
| 973 |
+
}
|
| 974 |
|
| 975 |
+
public function save_image() {
|
| 976 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
| 977 |
+
$result = false;
|
| 978 |
+
// $type = $_POST['type'];
|
| 979 |
+
|
| 980 |
+
$target_values = array( '', '_self', '_blank' );
|
| 981 |
+
$halign_values = array( 'left', 'right', 'center' );
|
| 982 |
+
$valign_values = array( 'top', 'bottom', 'middle' );
|
| 983 |
+
|
| 984 |
+
$imageUrl = esc_url( $_POST['img_url'] );
|
| 985 |
+
$imageCaption = wp_filter_post_kses( $_POST['description'] );
|
| 986 |
+
$title = sanitize_text_field( $_POST['title'] );
|
| 987 |
+
if ( in_array( $_POST['target'], $target_values ) ) {
|
| 988 |
+
$target = sanitize_text_field($_POST['target']);
|
| 989 |
+
}else{
|
| 990 |
+
$target = '';
|
| 991 |
+
}
|
| 992 |
+
|
| 993 |
+
$link = isset( $_POST['link'] ) ? esc_url_raw( $_POST['link'] ) : null;
|
| 994 |
+
$imageId = intval( $_POST['img_id'] );
|
| 995 |
+
$sortOrder = intval( $_POST['sortOrder'] );
|
| 996 |
+
|
| 997 |
+
if ( in_array( $_POST['halign'], $halign_values ) ) {
|
| 998 |
+
$halign = sanitize_text_field($_POST['halign']);
|
| 999 |
+
}else{
|
| 1000 |
+
$halign = 'center';
|
| 1001 |
+
}
|
| 1002 |
|
| 1003 |
+
if ( in_array( $_POST['valign'], $valign_values ) ) {
|
| 1004 |
+
$valign = sanitize_text_field($_POST['valign']);
|
| 1005 |
+
}else{
|
| 1006 |
+
$valign = 'middle';
|
| 1007 |
+
}
|
| 1008 |
|
| 1009 |
+
$data = array(
|
| 1010 |
+
"target" => $target,
|
| 1011 |
+
"link" => $link,
|
| 1012 |
+
"imageId" => $imageId,
|
| 1013 |
+
"description" => $imageCaption,
|
| 1014 |
+
'title' => $title,
|
| 1015 |
+
"halign" => $halign,
|
| 1016 |
+
"valign" => $valign,
|
| 1017 |
+
"sortOrder" => $sortOrder,
|
| 1018 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1019 |
|
| 1020 |
+
if ( ! empty( $_POST['id'] ) ) {
|
| 1021 |
+
$imageId = intval( $_POST['id'] );
|
| 1022 |
+
$result = $this->ModulaDB->editImage( $imageId, $data );
|
| 1023 |
+
} else {
|
| 1024 |
+
$data["gid"] = intval( $_POST['galleryId'] );
|
| 1025 |
+
$result = $this->ModulaDB->addFullImage( $data );
|
| 1026 |
+
}
|
| 1027 |
|
| 1028 |
+
header( "Content-type: application/json" );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1029 |
|
| 1030 |
+
if ( $result === false ) {
|
| 1031 |
+
print "{\"success\":false}";
|
| 1032 |
+
} else {
|
| 1033 |
+
print "{\"success\":true}";
|
| 1034 |
}
|
| 1035 |
+
|
| 1036 |
}
|
| 1037 |
+
die();
|
| 1038 |
+
}
|
| 1039 |
|
| 1040 |
+
public function list_images() {
|
| 1041 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
| 1042 |
+
$gid = intval( $_POST["gid"] );
|
| 1043 |
+
$gallery = $this->ModulaDB->getGalleryById( $gid, $this->defaultValues );
|
| 1044 |
|
| 1045 |
+
$imageResults = $this->ModulaDB->getImagesByGalleryId( $gid );
|
| 1046 |
|
| 1047 |
+
include( 'admin/include/image-list.php' );
|
|
|
|
|
|
|
| 1048 |
}
|
| 1049 |
+
die();
|
| 1050 |
+
}
|
| 1051 |
|
| 1052 |
+
private function checkboxVal( $field ) {
|
| 1053 |
+
if ( isset( $_POST[ $field ] ) ) //return 'checked';
|
| 1054 |
+
{
|
| 1055 |
+
return 'T';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1056 |
}
|
| 1057 |
|
| 1058 |
+
//return '';
|
| 1059 |
+
return 'F';
|
| 1060 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1061 |
|
| 1062 |
+
public function save_gallery() {
|
| 1063 |
+
if ( check_admin_referer( 'Modula', 'Modula' ) ) {
|
| 1064 |
+
$galleryName = sanitize_text_field( $_POST['tg_name'] );
|
| 1065 |
+
$galleryDescription = wp_filter_post_kses( $_POST['tg_description'] );
|
| 1066 |
+
$slug = strtolower( str_replace( " ", "", $galleryName ) );
|
| 1067 |
+
$margin = absint( $_POST['tg_margin'] );
|
| 1068 |
+
$shuffle = $this->checkboxVal( 'tg_shuffle' );
|
| 1069 |
+
$width = sanitize_text_field( $_POST['tg_width'] );
|
| 1070 |
+
$height = absint($_POST['tg_height']);
|
| 1071 |
+
$enableTwitter = $this->checkboxVal( 'tg_enableTwitter' );
|
| 1072 |
+
$enableFacebook = $this->checkboxVal( 'tg_enableFacebook' );
|
| 1073 |
+
$enableGplus = $this->checkboxVal( 'tg_enableGplus' );
|
| 1074 |
+
$enablePinterest = $this->checkboxVal( 'tg_enablePinterest' );
|
| 1075 |
+
$lightbox = $_POST['tg_lightbox'];
|
| 1076 |
+
$wp_field_caption = $_POST['tg_wp_field_caption'];
|
| 1077 |
+
$wp_field_title = $_POST['tg_wp_field_title'];
|
| 1078 |
+
$hide_title = $this->checkboxVal( 'tg_hide_title' );
|
| 1079 |
+
$hide_description = $this->checkboxVal( 'tg_hide_description' );
|
| 1080 |
+
$captionColor = sanitize_hex_color($_POST['tg_captionColor']);
|
| 1081 |
+
$borderSize = absint( $_POST['tg_borderSize'] );
|
| 1082 |
+
$loadedScale = absint( $_POST['tg_loadedScale'] );
|
| 1083 |
+
$loadedRotate = absint( $_POST['tg_loadedRotate'] );
|
| 1084 |
+
$loadedVSlide = absint( $_POST['tg_loadedVSlide'] );
|
| 1085 |
+
$loadedHSlide = absint( $_POST['tg_loadedHSlide'] );
|
| 1086 |
+
$socialIconColor = sanitize_hex_color($_POST['tg_socialIconColor']);
|
| 1087 |
+
$hoverEffect = $_POST['tg_hoverEffect'];
|
| 1088 |
+
$titleFontSize = absint( $_POST['tg_titleFontSize'] );
|
| 1089 |
+
$captionFontSize = absint( $_POST['tg_captionFontSize'] );
|
| 1090 |
+
$borderColor = sanitize_hex_color($_POST['tg_borderColor']);
|
| 1091 |
+
$borderRadius = intval( $_POST['tg_borderRadius'] );
|
| 1092 |
+
$shadowColor = sanitize_hex_color($_POST['tg_shadowColor']);
|
| 1093 |
+
$shadowSize = intval( $_POST['tg_shadowSize'] );
|
| 1094 |
+
$style = sanitize_text_field($_POST['tg_style']);
|
| 1095 |
+
$script = sanitize_text_field($_POST['tg_script']);
|
| 1096 |
+
|
| 1097 |
+
$id = isset( $_POST['ftg_gallery_edit'] ) ? intval( $_POST['ftg_gallery_edit'] ) : 0;
|
| 1098 |
+
|
| 1099 |
+
$data = array(
|
| 1100 |
+
'name' => $galleryName,
|
| 1101 |
+
'slug' => $slug,
|
| 1102 |
+
'description' => $galleryDescription,
|
| 1103 |
+
'lightbox' => $lightbox,
|
| 1104 |
+
'img_size' => intval( $_POST['tg_img_size'] ),
|
| 1105 |
+
'hasResizedImages' => true,
|
| 1106 |
+
'wp_field_caption' => $wp_field_caption,
|
| 1107 |
+
'wp_field_title' => $wp_field_title,
|
| 1108 |
+
'hide_title' => $hide_title,
|
| 1109 |
+
'hide_description' => $hide_description,
|
| 1110 |
+
'margin' => $margin,
|
| 1111 |
+
'randomFactor' => $_POST['tg_randomFactor'],
|
| 1112 |
+
'shuffle' => $shuffle,
|
| 1113 |
+
'enableTwitter' => $enableTwitter,
|
| 1114 |
+
'enableFacebook' => $enableFacebook,
|
| 1115 |
+
'enableGplus' => $enableGplus,
|
| 1116 |
+
'enablePinterest' => $enablePinterest,
|
| 1117 |
+
'captionColor' => $captionColor,
|
| 1118 |
+
'hoverEffect' => $hoverEffect,
|
| 1119 |
+
'borderSize' => $borderSize,
|
| 1120 |
+
'loadedScale' => $loadedScale,
|
| 1121 |
+
'loadedHSlide' => $loadedHSlide,
|
| 1122 |
+
'loadedVSlide' => $loadedVSlide,
|
| 1123 |
+
'loadedRotate' => $loadedRotate,
|
| 1124 |
+
'socialIconColor' => $socialIconColor,
|
| 1125 |
+
'captionFontSize' => $captionFontSize,
|
| 1126 |
+
'titleFontSize' => $titleFontSize,
|
| 1127 |
+
'borderColor' => $borderColor,
|
| 1128 |
+
'borderRadius' => $borderRadius,
|
| 1129 |
+
'shadowSize' => $shadowSize,
|
| 1130 |
+
'shadowColor' => $shadowColor,
|
| 1131 |
+
'width' => $width,
|
| 1132 |
+
'height' => $height,
|
| 1133 |
+
'style' => $style,
|
| 1134 |
+
'script' => $script,
|
| 1135 |
+
);
|
| 1136 |
+
|
| 1137 |
+
header( "Content-type: application/json" );
|
| 1138 |
+
if ( $id > 0 ) {
|
| 1139 |
+
$result = $this->ModulaDB->editGallery( $id, $data );
|
| 1140 |
|
| 1141 |
+
if ( intval( $this->loadedData->img_size ) != $data['img_size'] ) {
|
| 1142 |
+
$images = $this->ModulaDB->getImagesByGalleryId( $id );
|
| 1143 |
+
$images = ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
| 1144 |
|
| 1145 |
+
foreach ( $images as $img ) {
|
| 1146 |
+
$this->ModulaDB->editImage( $img->Id, (array) $img );
|
| 1147 |
+
}
|
|
|
|
| 1148 |
}
|
| 1149 |
+
|
| 1150 |
+
$this->loadedData = $this->ModulaDB->getGalleryById( $id, $this->defaultValues );
|
| 1151 |
+
} else {
|
| 1152 |
+
$result = $this->ModulaDB->addGallery( $data );
|
| 1153 |
+
$id = $this->ModulaDB->getNewGalleryId();
|
| 1154 |
}
|
|
|
|
|
|
|
| 1155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1156 |
|
| 1157 |
+
if ( $result ) {
|
| 1158 |
+
print "{\"success\":true,\"id\":" . $id . "}";
|
| 1159 |
} else {
|
| 1160 |
+
print "{\"success\":false}";
|
|
|
|
|
|
|
| 1161 |
}
|
| 1162 |
}
|
| 1163 |
+
die();
|
| 1164 |
+
}
|
| 1165 |
|
| 1166 |
+
public function edit_gallery() {
|
| 1167 |
+
if ( isset( $_GET['galleryId'] ) ) {
|
| 1168 |
+
$this->loadedData = $this->ModulaDB->getGalleryById( absint( $_GET['galleryId'] ), $this->defaultValues );
|
| 1169 |
+
$modula_fields = $this->fields;
|
| 1170 |
+
$modula_parent_page = "dashboard";
|
| 1171 |
+
|
| 1172 |
+
include( "admin/edit-gallery.php" );
|
| 1173 |
+
} else {
|
| 1174 |
+
$redir = true;
|
| 1175 |
+
$nobanner = true;
|
| 1176 |
+
include( "admin/overview.php" );
|
| 1177 |
+
}
|
| 1178 |
+
}
|
| 1179 |
+
|
| 1180 |
+
public function list_thumbnail_sizes() {
|
| 1181 |
+
global $_wp_additional_image_sizes;
|
| 1182 |
+
$sizes = array();
|
| 1183 |
+
foreach ( get_intermediate_image_sizes() as $s ) {
|
| 1184 |
+
$sizes[ $s ] = array( 0, 0 );
|
| 1185 |
+
if ( in_array( $s, array( 'thumbnail', 'medium', 'large' ) ) ) {
|
| 1186 |
+
$sizes[ $s ][0] = get_option( $s . '_size_w' );
|
| 1187 |
+
$sizes[ $s ][1] = get_option( $s . '_size_h' );
|
| 1188 |
+
} else {
|
| 1189 |
+
if ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[ $s ] ) ) {
|
| 1190 |
+
$sizes[ $s ] = array(
|
| 1191 |
+
$_wp_additional_image_sizes[ $s ]['width'],
|
| 1192 |
+
$_wp_additional_image_sizes[ $s ]['height'],
|
| 1193 |
+
);
|
| 1194 |
}
|
| 1195 |
}
|
|
|
|
|
|
|
| 1196 |
}
|
| 1197 |
|
| 1198 |
+
return $sizes;
|
| 1199 |
+
}
|
|
|
|
| 1200 |
|
| 1201 |
+
public function gallery_shortcode_handler( $atts ) {
|
| 1202 |
+
require_once( 'lib/gallery-class.php' );
|
| 1203 |
+
global $Modula;
|
| 1204 |
|
| 1205 |
+
if ( class_exists( 'ModulaLiteFE' ) ) {
|
| 1206 |
+
$Modula = new ModulaLiteFE( $this->ModulaDB, $atts['id'], $this->defaultValues );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1207 |
|
| 1208 |
+
$settings = $Modula->getGallery();
|
| 1209 |
+
switch ( $settings->lightbox ) {
|
| 1210 |
+
case "lightbox2":
|
| 1211 |
+
wp_enqueue_style( 'lightbox2_stylesheet' );
|
| 1212 |
+
wp_enqueue_script( 'lightbox2_script' );
|
| 1213 |
+
wp_add_inline_script( 'lightbox2_script', 'jQuery(document).ready(function(){lightbox.option({albumLabel: "' . esc_html__( 'Image %1 of %2', 'modula-gallery' ) . '"});});' );
|
| 1214 |
+
break;
|
| 1215 |
}
|
|
|
|
| 1216 |
|
| 1217 |
+
return $Modula->render();
|
| 1218 |
+
} else {
|
| 1219 |
+
return esc_html__( 'Gallery not found.', 'modula-gallery' );
|
| 1220 |
+
}
|
| 1221 |
+
}
|
| 1222 |
|
| 1223 |
+
public function shortcode_empty_paragraph_fix( $content ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1224 |
|
| 1225 |
+
$array = array (
|
| 1226 |
+
'<p>[Modula' => '[Modula' ,
|
| 1227 |
+
'<p>[/Modula' => '[/Modula',
|
| 1228 |
+
'Modula]</p>' => 'Modula]',
|
| 1229 |
+
'Modula]<br />' => 'Modula]'
|
| 1230 |
+
);
|
| 1231 |
|
| 1232 |
+
$content = strtr( $content, $array );
|
|
|
|
| 1233 |
|
| 1234 |
+
return $content;
|
| 1235 |
}
|
| 1236 |
|
| 1237 |
+
}
|
| 1238 |
|
| 1239 |
+
class ModulaLiteHoverEffect {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1240 |
|
| 1241 |
+
var $name;
|
| 1242 |
+
var $code;
|
| 1243 |
+
var $allowTitle;
|
| 1244 |
+
var $allowSubtitle;
|
| 1245 |
+
var $maxSocial;
|
| 1246 |
+
|
| 1247 |
+
public function __construct( $name, $code, $allowTitle, $allowSubtitle, $maxSocial ) {
|
| 1248 |
+
$this->name = $name;
|
| 1249 |
+
$this->code = $code;
|
| 1250 |
+
$this->allowTitle = $allowTitle;
|
| 1251 |
+
$this->allowSubtitle = $allowSubtitle;
|
| 1252 |
+
$this->maxSocial = $maxSocial;
|
| 1253 |
}
|
| 1254 |
}
|
| 1255 |
|
| 1429 |
|
| 1430 |
<?php
|
| 1431 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.txt
CHANGED
|
@@ -3,7 +3,7 @@ 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.
|
| 7 |
License: GPLv3 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
|
@@ -173,6 +173,9 @@ Free support is included only with a PRO license: [Buy Modula PRO](https://wp-mo
|
|
| 173 |
|
| 174 |
== Changelog ==
|
| 175 |
|
|
|
|
|
|
|
|
|
|
| 176 |
= 1.3.4 =
|
| 177 |
* wp.org review
|
| 178 |
|
| 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.5
|
| 7 |
License: GPLv3 or later
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
| 173 |
|
| 174 |
== Changelog ==
|
| 175 |
|
| 176 |
+
= 1.3.5 =
|
| 177 |
+
* second wp.org review
|
| 178 |
+
|
| 179 |
= 1.3.4 =
|
| 180 |
* wp.org review
|
| 181 |
|
admin/edit-gallery.php
CHANGED
|
@@ -8,10 +8,10 @@ function modula_print_value( $gallery, $field, $default = null ) {
|
|
| 8 |
if ( $default === null ) {
|
| 9 |
print "";
|
| 10 |
} else {
|
| 11 |
-
print
|
| 12 |
}
|
| 13 |
} else {
|
| 14 |
-
print
|
| 15 |
}
|
| 16 |
}
|
| 17 |
|
| 8 |
if ( $default === null ) {
|
| 9 |
print "";
|
| 10 |
} else {
|
| 11 |
+
print esc_html( $default );
|
| 12 |
}
|
| 13 |
} else {
|
| 14 |
+
print esc_html( $gallery->$field );
|
| 15 |
}
|
| 16 |
}
|
| 17 |
|
lib/class-modula-plugin-rollback.php
DELETED
|
@@ -1,71 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Modula_Plugin_RollBack {
|
| 4 |
-
|
| 5 |
-
public function __construct() {
|
| 6 |
-
|
| 7 |
-
/**
|
| 8 |
-
* $_POST action hook
|
| 9 |
-
*
|
| 10 |
-
* @see: https://codex.wordpress.org/Plugin_API/Action_Reference/admin_post_(action)
|
| 11 |
-
*
|
| 12 |
-
*/
|
| 13 |
-
add_action( 'admin_post_modula_rollback', array( $this, 'post_rollback' ) );
|
| 14 |
-
|
| 15 |
-
/**
|
| 16 |
-
* Hook responsible for loading our Rollback JS script
|
| 17 |
-
*/
|
| 18 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'rollback_scripts' ) );
|
| 19 |
-
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
/**
|
| 23 |
-
* FBFW version rollback.
|
| 24 |
-
*
|
| 25 |
-
* Rollback to previous {plugin} version.
|
| 26 |
-
*
|
| 27 |
-
* Fired by `admin_post_epfw_rollback` action.
|
| 28 |
-
*
|
| 29 |
-
* @since 1.5.0
|
| 30 |
-
* @access public
|
| 31 |
-
*/
|
| 32 |
-
public function post_rollback() {
|
| 33 |
-
|
| 34 |
-
check_admin_referer( 'modula_rollback' );
|
| 35 |
-
|
| 36 |
-
$plugin_slug = basename( MODULA_FILE_, '.php' );
|
| 37 |
-
|
| 38 |
-
// check for const defines
|
| 39 |
-
if ( ! defined( 'MODULA_PREVIOUS_PLUGIN_VERSION' ) || ! defined( 'MODULA_PLUGIN_BASE' ) ) {
|
| 40 |
-
wp_die(
|
| 41 |
-
new WP_Error( 'broke', esc_html__( 'Previous plugin version or plugin basename CONST aren\'t defined.', 'epfw' ) )
|
| 42 |
-
);
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
if ( class_exists( 'Modula_Rollback' ) ) {
|
| 46 |
-
$rollback = new Modula_Rollback(
|
| 47 |
-
array(
|
| 48 |
-
'version' => MODULA_PREVIOUS_PLUGIN_VERSION,
|
| 49 |
-
'plugin_name' => MODULA_PLUGIN_BASE,
|
| 50 |
-
'plugin_slug' => $plugin_slug,
|
| 51 |
-
'package_url' => sprintf( 'https://downloads.wordpress.org/plugin/%s.%s.zip', 'modula-best-grid-gallery', MODULA_PREVIOUS_PLUGIN_VERSION ),
|
| 52 |
-
)
|
| 53 |
-
);
|
| 54 |
-
$rollback->run();
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
wp_die(
|
| 58 |
-
'', __( 'Rollback to Previous Version', 'mfbfw' ), array(
|
| 59 |
-
'response' => 200,
|
| 60 |
-
)
|
| 61 |
-
);
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
public function rollback_scripts() {
|
| 65 |
-
wp_enqueue_script('rollback-script', MODULA_PLUGIN_DIR_URL . 'scripts/rollback.js', MODULA_VERSION ); // Load Rollback script
|
| 66 |
-
wp_enqueue_script( 'rollback-script' );
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
new Modula_Plugin_RollBack();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/class-modula-rollback.php
DELETED
|
@@ -1,178 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
| 4 |
-
exit; // Exit if accessed directly.
|
| 5 |
-
}
|
| 6 |
-
|
| 7 |
-
/**
|
| 8 |
-
* Modula rollback class.
|
| 9 |
-
*
|
| 10 |
-
* EPFW rollback handler class is responsible for rolling back EPFW to
|
| 11 |
-
* previous version.
|
| 12 |
-
*
|
| 13 |
-
* @since 1.0.0
|
| 14 |
-
*/
|
| 15 |
-
class Modula_Rollback {
|
| 16 |
-
|
| 17 |
-
/**
|
| 18 |
-
* Package URL.
|
| 19 |
-
*
|
| 20 |
-
* Holds the package URL.
|
| 21 |
-
*
|
| 22 |
-
* @since 1.0.0
|
| 23 |
-
* @access protected
|
| 24 |
-
*
|
| 25 |
-
* @var string Package URL.
|
| 26 |
-
*/
|
| 27 |
-
protected $package_url;
|
| 28 |
-
|
| 29 |
-
/**
|
| 30 |
-
* Version.
|
| 31 |
-
*
|
| 32 |
-
* Holds the version.
|
| 33 |
-
*
|
| 34 |
-
* @since 1.0.0
|
| 35 |
-
* @access protected
|
| 36 |
-
*
|
| 37 |
-
* @var string Package URL.
|
| 38 |
-
*/
|
| 39 |
-
protected $version;
|
| 40 |
-
|
| 41 |
-
/**
|
| 42 |
-
* Plugin name.
|
| 43 |
-
*
|
| 44 |
-
* Holds the plugin name.
|
| 45 |
-
*
|
| 46 |
-
* @since 1.0.0
|
| 47 |
-
* @access protected
|
| 48 |
-
*
|
| 49 |
-
* @var string Plugin name.
|
| 50 |
-
*/
|
| 51 |
-
protected $plugin_name;
|
| 52 |
-
|
| 53 |
-
/**
|
| 54 |
-
* Plugin slug.
|
| 55 |
-
*
|
| 56 |
-
* Holds the plugin slug.
|
| 57 |
-
*
|
| 58 |
-
* @since 1.0.0
|
| 59 |
-
* @access protected
|
| 60 |
-
*
|
| 61 |
-
* @var string Plugin slug.
|
| 62 |
-
*/
|
| 63 |
-
protected $plugin_slug;
|
| 64 |
-
|
| 65 |
-
/**
|
| 66 |
-
* Rollback constructor.
|
| 67 |
-
*
|
| 68 |
-
* Initializing EPFW rollback.
|
| 69 |
-
*
|
| 70 |
-
* @since 1.0.0
|
| 71 |
-
* @access public
|
| 72 |
-
*
|
| 73 |
-
* @param array $args Optional. Rollback arguments. Default is an empty array.
|
| 74 |
-
*/
|
| 75 |
-
public function __construct( $args = array() ) {
|
| 76 |
-
foreach ( $args as $key => $value ) {
|
| 77 |
-
$this->{$key} = $value;
|
| 78 |
-
}
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
/**
|
| 82 |
-
* Print inline style.
|
| 83 |
-
*
|
| 84 |
-
* Add an inline CSS to the rollback page.
|
| 85 |
-
*
|
| 86 |
-
* @since 1.0.0
|
| 87 |
-
* @access private
|
| 88 |
-
*/
|
| 89 |
-
private function print_inline_style() {
|
| 90 |
-
?>
|
| 91 |
-
<style>
|
| 92 |
-
.wrap {
|
| 93 |
-
overflow: hidden;
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
h1 {
|
| 97 |
-
background: #9b0a46;
|
| 98 |
-
text-align: center;
|
| 99 |
-
color: #fff !important;
|
| 100 |
-
padding: 70px !important;
|
| 101 |
-
text-transform: uppercase;
|
| 102 |
-
letter-spacing: 1px;
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
h1 img {
|
| 106 |
-
max-width: 300px;
|
| 107 |
-
display: block;
|
| 108 |
-
margin: auto auto 50px;
|
| 109 |
-
}
|
| 110 |
-
</style>
|
| 111 |
-
<?php
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
/**
|
| 115 |
-
* Apply package.
|
| 116 |
-
*
|
| 117 |
-
* Change the plugin data when WordPress checks for updates. This method
|
| 118 |
-
* modifies package data to update the plugin from a specific URL containing
|
| 119 |
-
* the version package.
|
| 120 |
-
*
|
| 121 |
-
* @since 1.0.0
|
| 122 |
-
* @access protected
|
| 123 |
-
*/
|
| 124 |
-
protected function apply_package() {
|
| 125 |
-
$update_plugins = get_site_transient( 'update_plugins' );
|
| 126 |
-
if ( ! is_object( $update_plugins ) ) {
|
| 127 |
-
$update_plugins = new \stdClass();
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
$plugin_info = new \stdClass();
|
| 131 |
-
$plugin_info->new_version = $this->version;
|
| 132 |
-
$plugin_info->slug = $this->plugin_slug;
|
| 133 |
-
$plugin_info->package = $this->package_url;
|
| 134 |
-
|
| 135 |
-
$update_plugins->response[ $this->plugin_name ] = $plugin_info;
|
| 136 |
-
|
| 137 |
-
set_site_transient( 'update_plugins', $update_plugins );
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
/**
|
| 141 |
-
* Upgrade.
|
| 142 |
-
*
|
| 143 |
-
* Run WordPress upgrade to rollback EPFW to previous version.
|
| 144 |
-
*
|
| 145 |
-
* @since 1.0.0
|
| 146 |
-
* @access protected
|
| 147 |
-
*/
|
| 148 |
-
protected function upgrade() {
|
| 149 |
-
require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
| 150 |
-
|
| 151 |
-
$logo_url = MODULA_PLUGIN_DIR_URL . 'admin/images/modula.svg';
|
| 152 |
-
|
| 153 |
-
$upgrader_args = array(
|
| 154 |
-
'url' => 'update.php?action=upgrade-plugin&plugin=' . rawurlencode( $this->plugin_name ),
|
| 155 |
-
'plugin' => $this->plugin_name,
|
| 156 |
-
'nonce' => 'upgrade-plugin_' . $this->plugin_name,
|
| 157 |
-
'title' => '<img src="' . $logo_url . '" alt="Modula">' . __( 'Rollback to Previous Version', 'epfw' ),
|
| 158 |
-
);
|
| 159 |
-
|
| 160 |
-
$this->print_inline_style();
|
| 161 |
-
|
| 162 |
-
$upgrader = new \Plugin_Upgrader( new \Plugin_Upgrader_Skin( $upgrader_args ) );
|
| 163 |
-
$upgrader->upgrade( $this->plugin_name );
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
/**
|
| 167 |
-
* Run.
|
| 168 |
-
*
|
| 169 |
-
* Rollback EPFW to previous versions.
|
| 170 |
-
*
|
| 171 |
-
* @since 1.0.0
|
| 172 |
-
* @access public
|
| 173 |
-
*/
|
| 174 |
-
public function run() {
|
| 175 |
-
$this->apply_package();
|
| 176 |
-
$this->upgrade();
|
| 177 |
-
}
|
| 178 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/db-class.php
CHANGED
|
@@ -309,5 +309,3 @@ class ModulaLiteDB {
|
|
| 309 |
return $gallery;
|
| 310 |
}
|
| 311 |
}
|
| 312 |
-
|
| 313 |
-
?>
|
| 309 |
return $gallery;
|
| 310 |
}
|
| 311 |
}
|
|
|
|
|
|
lib/gallery-class.php
CHANGED
|
@@ -3,367 +3,364 @@
|
|
| 3 |
define( "MODULA_DB_MODE", 1 );
|
| 4 |
define( "MODULA_WP_MODE", 2 );
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
}
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
}
|
| 27 |
}
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
}
|
| 45 |
-
$this->gallery->hasResizedImages = true;
|
| 46 |
-
$this->db->editGallery( $this->id, (array) $this->gallery );
|
| 47 |
}
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
-
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
}
|
| 60 |
}
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
);
|
| 69 |
-
|
| 70 |
-
$
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
|
|
|
| 80 |
}
|
| 81 |
|
| 82 |
-
|
| 83 |
-
$this->imageIds = $ids;
|
| 84 |
-
$this->gallery->mode = MODULA_WP_MODE;
|
| 85 |
-
$this->loadWPImages( $ids );
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
$image->url = $att->url;
|
| 91 |
-
$image->Id = $att->ID;
|
| 92 |
-
$image->imagePath = $att->guid;
|
| 93 |
-
$image->link = get_post_meta( $att->ID, "_modula_link", true );
|
| 94 |
-
$image->alt = get_post_meta( $att->ID, '_wp_attachment_image_alt', true );
|
| 95 |
-
|
| 96 |
-
switch ( $this->gallery->wp_field_caption ) {
|
| 97 |
-
case 'title':
|
| 98 |
-
$image->description = $att->post_title;
|
| 99 |
-
break;
|
| 100 |
-
case 'caption':
|
| 101 |
-
$image->description = $att->post_excerpt;
|
| 102 |
-
break;
|
| 103 |
-
case 'description':
|
| 104 |
-
$image->description = $att->post_content;
|
| 105 |
-
break;
|
| 106 |
-
}
|
| 107 |
-
$this->images[ $image->imageId ] = $image;
|
| 108 |
-
}
|
| 109 |
|
|
|
|
|
|
|
|
|
|
| 110 |
}
|
| 111 |
|
| 112 |
-
|
| 113 |
-
return
|
| 114 |
}
|
| 115 |
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
return '';
|
| 119 |
-
}
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
| 123 |
}
|
| 124 |
-
|
| 125 |
-
return 'modula-lightbox';
|
| 126 |
}
|
|
|
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
if ( $effect->code == $code ) {
|
| 132 |
-
return $effect;
|
| 133 |
-
}
|
| 134 |
-
}
|
| 135 |
}
|
| 136 |
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
}
|
| 141 |
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
}
|
| 149 |
|
| 150 |
-
|
|
|
|
|
|
|
| 151 |
}
|
| 152 |
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
return "target='" . esc_attr($image->target) . "'";
|
| 156 |
-
}
|
| 157 |
|
| 158 |
-
|
| 159 |
-
|
| 160 |
|
| 161 |
-
|
|
|
|
|
|
|
| 162 |
}
|
| 163 |
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
return $default;
|
| 167 |
-
}
|
| 168 |
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
| 170 |
}
|
| 171 |
|
| 172 |
-
|
|
|
|
|
|
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
|
| 186 |
-
|
| 187 |
-
$RGB['G'] = $G;
|
| 188 |
-
$RGB['B'] = $B;
|
| 189 |
|
| 190 |
-
|
| 191 |
-
$RGB[1] = $G;
|
| 192 |
-
$RGB[2] = $B;
|
| 193 |
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
|
|
|
|
|
|
|
| 196 |
}
|
| 197 |
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
$text = trim( $text, '-' );
|
| 201 |
-
$text = iconv( 'utf-8', 'us-ascii//TRANSLIT', $text );
|
| 202 |
-
$text = strtolower( $text );
|
| 203 |
-
$text = preg_replace( '~[^-\w]+~', '', $text );
|
| 204 |
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
-
|
|
|
|
| 210 |
}
|
| 211 |
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
}
|
| 221 |
}
|
| 222 |
|
| 223 |
-
|
| 224 |
-
$rid
|
|
|
|
| 225 |
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
|
| 230 |
-
|
|
|
|
|
|
|
| 231 |
|
| 232 |
-
|
| 233 |
|
| 234 |
-
|
| 235 |
|
| 236 |
-
|
| 237 |
-
$html .= "#jtg-$this->id$rid .item { border: " . absint($this->gallery->borderSize) . "px solid " . sanitize_hex_color($this->gallery->borderColor) . "; }";
|
| 238 |
-
}
|
| 239 |
|
| 240 |
-
|
| 241 |
-
$html .= "#jtg-$this->id$rid .item { border-radius: " . absint($this->gallery->borderRadius) . "px; }";
|
| 242 |
-
}
|
| 243 |
|
| 244 |
-
|
| 245 |
-
$html .= "#jtg-$this->id$rid .item { box-shadow: " . absint($this->gallery->shadowColor) . " 0px 0px " . sanitize_hex_color($this->gallery->shadowSize) . "px; }";
|
| 246 |
-
}
|
| 247 |
|
| 248 |
-
|
| 249 |
-
$html .= "#jtg-$this->id$rid .item .jtg-social a { color: " . sanitize_hex_color($this->gallery->socialIconColor) . " }";
|
| 250 |
-
}
|
| 251 |
|
| 252 |
-
$html .= "#jtg-$this->id$rid .item .caption { background-color: " . sanitize_hex_color($this->gallery->captionColor) . "; }";
|
| 253 |
|
| 254 |
-
|
|
|
|
|
|
|
| 255 |
|
| 256 |
-
|
| 257 |
|
| 258 |
-
|
|
|
|
|
|
|
| 259 |
|
| 260 |
-
|
| 261 |
|
| 262 |
-
|
| 263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
-
|
| 266 |
-
$html .= esc_html($this->gallery->style);
|
| 267 |
-
}
|
| 268 |
|
| 269 |
-
$
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
foreach ( array_slice( $this->images, 0, 40 / 2 ) as $image ) {
|
| 278 |
-
|
| 279 |
-
$title = in_array( $this->gallery->lightbox, array(
|
| 280 |
-
'prettyphoto',
|
| 281 |
-
'fancybox',
|
| 282 |
-
'swipebox',
|
| 283 |
-
'lightbox2'
|
| 284 |
-
) ) ? "title" : "data-title";
|
| 285 |
-
$rel = $this->gallery->lightbox == "prettyphoto" ? 'prettyPhoto[jtg-' . esc_attr($this->id) . esc_attr($rid) . ']' : 'jtg-' . esc_attr($this->id) . esc_attr($rid);
|
| 286 |
-
|
| 287 |
-
$hoverEffect = $this->getHoverEffect( $this->gallery->hoverEffect );
|
| 288 |
-
|
| 289 |
-
/*if(empty($image->title) && empty($image->description) &&
|
| 290 |
-
!$this->gallery->enableTwitter && !$this->gallery->enableFacebook &&
|
| 291 |
-
!$this->gallery->enablePinterest & !$this->gallery->enableGplus)
|
| 292 |
-
{
|
| 293 |
-
$hoverEffect = $this->getHoverEffect('none');
|
| 294 |
-
}*/
|
| 295 |
-
|
| 296 |
-
$hasTitle = empty( $image->title ) ? 'notitle' : '';
|
| 297 |
-
|
| 298 |
-
$imgUrl = $image->imagePath;
|
| 299 |
-
$image->alt = isset( $image->alt ) ? $image->alt : '';
|
| 300 |
-
|
| 301 |
-
$html .= "<div class=\"item " . esc_attr($hasTitle) . " effect-" . esc_attr($hoverEffect->code) . "\">";
|
| 302 |
-
$html .= "<a $title='$image->description' " . ( $this->gallery->lightbox == "lightbox2" && empty( $image->link ) ? "data-lightbox='$rel'" : "" ) . " rel='$rel' " . $this->getTarget( $image ) . " class='tile-inner " . esc_attr( $this->getLightboxClass( $image ) ) . "' " . $this->getLink( $image ) . "></a>";
|
| 303 |
-
$html .= "<img data-valign='$image->valign' alt='$image->alt' data-halign='$image->halign' class='pic' src='$imgUrl' data-src='$imgUrl' />";
|
| 304 |
-
$html .= "<div class=\"figc\">";
|
| 305 |
-
$html .= "<div class=\"figc-inner\">";
|
| 306 |
-
if ( $this->gallery->hoverEffect != 'none' && ! empty( $image->title ) && 'T' != $this->gallery->hide_title ) {
|
| 307 |
-
$html .= "<h2 class='jtg-title'>" . esc_html($image->title) . "</h2>";
|
| 308 |
-
}
|
| 309 |
-
|
| 310 |
-
if ( ( $this->gallery->hoverEffect != 'none' && ! empty( $image->description ) ) && 'T' != $this->gallery->hide_description ) {
|
| 311 |
-
$html .= "<p class=\"description\">";
|
| 312 |
-
$html .= wp_kses_post($image->description);
|
| 313 |
-
$html .= "</p>";
|
| 314 |
-
}
|
| 315 |
-
$html .= "</div>";
|
| 316 |
-
$html .= "</div>";
|
| 317 |
-
$html .= "</div>";
|
| 318 |
-
}
|
| 319 |
|
|
|
|
|
|
|
| 320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
$html .= "</div>";
|
| 322 |
$html .= "</div>";
|
|
|
|
|
|
|
| 323 |
|
| 324 |
-
$html .= "<script type='text/javascript'>";
|
| 325 |
-
$html .= "jQuery('#jtg-$this->id$rid').modulaGallery({";
|
| 326 |
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
}
|
| 330 |
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
// $html .= "\t\tkeepArea: " . ($this->gallery->keepArea == "T" ? "true" : "false") . ",\n";
|
| 334 |
-
$html .= "enableTwitter: " . ( $this->gallery->enableTwitter == "T" ? "true" : "false" ) . ",";
|
| 335 |
-
$html .= "enableFacebook: " . ( $this->gallery->enableFacebook == "T" ? "true" : "false" ) . ",";
|
| 336 |
-
$html .= "enablePinterest: " . ( $this->gallery->enablePinterest == "T" ? "true" : "false" ) . ",";
|
| 337 |
-
$html .= "enableGplus: " . ( $this->gallery->enableGplus == "T" ? "true" : "false" ) . ",";
|
| 338 |
-
$html .= "randomFactor: " . ( $this->gallery->randomFactor / 100 ) . ",";
|
| 339 |
-
$html .= "});";
|
| 340 |
-
$html .= "</script>";
|
| 341 |
|
|
|
|
|
|
|
|
|
|
| 342 |
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
|
| 347 |
-
|
|
|
|
|
|
|
| 348 |
}
|
| 349 |
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
return false;
|
| 353 |
-
}
|
| 354 |
|
| 355 |
-
|
|
|
|
|
|
|
| 356 |
}
|
| 357 |
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
$idx = 0;
|
| 361 |
-
foreach ( $this->db->getImagesByGalleryId( $this->id ) as $img ) {
|
| 362 |
-
$images[ $img->imageId < 0 ? $img->imageId - ( $idx ++ ) : $img->imageId ] = $img;
|
| 363 |
-
}
|
| 364 |
|
| 365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
}
|
|
|
|
|
|
|
| 367 |
}
|
| 368 |
}
|
| 369 |
-
?>
|
| 3 |
define( "MODULA_DB_MODE", 1 );
|
| 4 |
define( "MODULA_WP_MODE", 2 );
|
| 5 |
|
| 6 |
+
class ModulaLiteFE {
|
| 7 |
+
|
| 8 |
+
private $defaultValues;
|
| 9 |
+
|
| 10 |
+
public function __construct( $db, $id, $defaultValues ) {
|
| 11 |
+
$this->gallery = new stdClass();
|
| 12 |
+
$this->db = $db;
|
| 13 |
+
$this->wp_images = array();
|
| 14 |
+
$this->images = array();
|
| 15 |
+
$this->id = $id;
|
| 16 |
+
$this->defaultValues = $defaultValues;
|
| 17 |
+
$this->init();
|
| 18 |
+
}
|
|
|
|
| 19 |
|
| 20 |
+
public function init() {
|
| 21 |
+
$this->gallery = $this->db->getGalleryById( $this->id );
|
| 22 |
+
foreach ( $this->defaultValues as $k => $v ) {
|
| 23 |
+
if ( ! isset( $this->gallery->$k ) ) {
|
| 24 |
+
$this->gallery->$k = $v;
|
|
|
|
| 25 |
}
|
| 26 |
+
}
|
| 27 |
|
| 28 |
+
$this->gallery->mode = MODULA_DB_MODE;
|
| 29 |
|
| 30 |
+
if ( ! empty( $_GET["debug"] ) ) {
|
| 31 |
+
print "<!--\n";
|
| 32 |
+
print "Gallery id: $this->id\n";
|
| 33 |
+
print "settings:\n";
|
| 34 |
+
print_r( $this->gallery );
|
| 35 |
+
print "\n-->\n";
|
| 36 |
+
}
|
| 37 |
|
| 38 |
+
if ( ! $this->gallery->hasResizedImages ) {
|
| 39 |
+
$images = $this->db->getImagesByGalleryId( $this->id );
|
| 40 |
+
$images = ModulaLiteTools::check_and_resize( $images, $this->gallery->img_size );
|
| 41 |
+
foreach ( $images as $img ) {
|
| 42 |
+
$this->db->editImage( $img->Id, (array) $img );
|
|
|
|
|
|
|
|
|
|
| 43 |
}
|
| 44 |
+
$this->gallery->hasResizedImages = true;
|
| 45 |
+
$this->db->editGallery( $this->id, (array) $this->gallery );
|
| 46 |
+
}
|
| 47 |
|
| 48 |
+
$this->images = $this->loadModulaImages();
|
| 49 |
|
| 50 |
+
$ids = array();
|
| 51 |
+
$idx = 0;
|
| 52 |
+
foreach ( $this->images as $img ) {
|
| 53 |
+
$ids[] = $img->imageId < 0 ? $img->imageId - ( $idx ++ ) : $img->imageId;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
if ( count( $this->images ) > 0 && $this->gallery->importedFrom != 'NextGen' ) {
|
| 57 |
+
$this->loadWPImages( $ids );
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
|
| 61 |
+
public function loadWPImages( $ids ) {
|
| 62 |
+
$args = array(
|
| 63 |
+
'post_type' => 'attachment',
|
| 64 |
+
'posts_per_page' => -1,
|
| 65 |
+
'include' => $ids,
|
| 66 |
+
'suppress_filters' => 0,
|
| 67 |
+
);
|
| 68 |
+
|
| 69 |
+
$this->wp_images = get_posts( $args );
|
| 70 |
+
foreach ( $this->wp_images as $att ) {
|
| 71 |
+
$att->url = get_attachment_link( $att->ID );
|
| 72 |
+
|
| 73 |
+
if ( $this->gallery->mode == MODULA_DB_MODE ) {
|
| 74 |
+
//$this->images[$att->ID]->imagePath = $att->guid;
|
| 75 |
+
$this->images[ $att->ID ]->url = $att->url;
|
| 76 |
+
$this->images[ $att->ID ]->alt = get_post_meta( $att->ID, '_wp_attachment_image_alt', true );
|
| 77 |
}
|
| 78 |
}
|
| 79 |
+
}
|
| 80 |
|
| 81 |
+
public function initByImageIds( $ids ) {
|
| 82 |
+
$this->imageIds = $ids;
|
| 83 |
+
$this->gallery->mode = MODULA_WP_MODE;
|
| 84 |
+
$this->loadWPImages( $ids );
|
| 85 |
+
|
| 86 |
+
foreach ( $this->wp_images as $att ) {
|
| 87 |
+
$image = new stdClass();
|
| 88 |
+
$image->imageId = $att->ID;
|
| 89 |
+
$image->url = $att->url;
|
| 90 |
+
$image->Id = $att->ID;
|
| 91 |
+
$image->imagePath = $att->guid;
|
| 92 |
+
$image->link = get_post_meta( $att->ID, "_modula_link", true );
|
| 93 |
+
$image->alt = get_post_meta( $att->ID, '_wp_attachment_image_alt', true );
|
| 94 |
+
|
| 95 |
+
switch ( $this->gallery->wp_field_caption ) {
|
| 96 |
+
case 'title':
|
| 97 |
+
$image->description = $att->post_title;
|
| 98 |
+
break;
|
| 99 |
+
case 'caption':
|
| 100 |
+
$image->description = $att->post_excerpt;
|
| 101 |
+
break;
|
| 102 |
+
case 'description':
|
| 103 |
+
$image->description = $att->post_content;
|
| 104 |
+
break;
|
| 105 |
}
|
| 106 |
+
$this->images[ $image->imageId ] = $image;
|
| 107 |
}
|
| 108 |
|
| 109 |
+
}
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
+
public function getGallery() {
|
| 112 |
+
return $this->gallery;
|
| 113 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
+
private function getLightboxClass( $image ) {
|
| 116 |
+
if ( ! empty( $image->link ) ) {
|
| 117 |
+
return '';
|
| 118 |
}
|
| 119 |
|
| 120 |
+
if ( empty( $this->gallery->lightbox ) ) {
|
| 121 |
+
return '';
|
| 122 |
}
|
| 123 |
|
| 124 |
+
return 'modula-lightbox';
|
| 125 |
+
}
|
|
|
|
|
|
|
| 126 |
|
| 127 |
+
private function getHoverEffect( $code ) {
|
| 128 |
+
global $ob_ModulaLite;
|
| 129 |
+
foreach ( $ob_ModulaLite->hoverEffects as $effect ) {
|
| 130 |
+
if ( $effect->code == $code ) {
|
| 131 |
+
return $effect;
|
| 132 |
}
|
|
|
|
|
|
|
| 133 |
}
|
| 134 |
+
}
|
| 135 |
|
| 136 |
+
private function getLink( $image ) {
|
| 137 |
+
if ( ! empty( $image->link ) ) {
|
| 138 |
+
return "href='" . esc_url($image->link) . "'";
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
}
|
| 140 |
|
| 141 |
+
if ( empty( $this->gallery->lightbox ) ) {
|
| 142 |
+
return '';
|
| 143 |
+
}
|
|
|
|
| 144 |
|
| 145 |
+
if ( $this->gallery->lightbox == 'attachment-page' ) {
|
| 146 |
+
return "href='" . esc_url($image->url) . "'";
|
| 147 |
+
}
|
| 148 |
|
| 149 |
+
return "href='" . wp_get_attachment_url( $image->imageId ) . "'";
|
| 150 |
+
}
|
|
|
|
| 151 |
|
| 152 |
+
private function getTarget( $image ) {
|
| 153 |
+
if ( ! empty( $image->target ) ) {
|
| 154 |
+
return "target='" . esc_attr($image->target) . "'";
|
| 155 |
}
|
| 156 |
|
| 157 |
+
// if($this->gallery->blank == 'T')
|
| 158 |
+
// return "target='_blank'";
|
|
|
|
|
|
|
| 159 |
|
| 160 |
+
return '';
|
| 161 |
+
}
|
| 162 |
|
| 163 |
+
private function getdef( $value, $default ) {
|
| 164 |
+
if ( $value == null || empty( $value ) ) {
|
| 165 |
+
return $default;
|
| 166 |
}
|
| 167 |
|
| 168 |
+
return $value;
|
| 169 |
+
}
|
|
|
|
|
|
|
| 170 |
|
| 171 |
+
private function toRGB( $Hex ) {
|
| 172 |
+
|
| 173 |
+
if ( substr( $Hex, 0, 1 ) == "#" ) {
|
| 174 |
+
$Hex = substr( $Hex, 1 );
|
| 175 |
}
|
| 176 |
|
| 177 |
+
$R = substr( $Hex, 0, 2 );
|
| 178 |
+
$G = substr( $Hex, 2, 2 );
|
| 179 |
+
$B = substr( $Hex, 4, 2 );
|
| 180 |
|
| 181 |
+
$R = hexdec( $R );
|
| 182 |
+
$G = hexdec( $G );
|
| 183 |
+
$B = hexdec( $B );
|
| 184 |
|
| 185 |
+
$RGB['R'] = $R;
|
| 186 |
+
$RGB['G'] = $G;
|
| 187 |
+
$RGB['B'] = $B;
|
| 188 |
|
| 189 |
+
$RGB[0] = $R;
|
| 190 |
+
$RGB[1] = $G;
|
| 191 |
+
$RGB[2] = $B;
|
| 192 |
|
| 193 |
+
return $RGB;
|
|
|
|
|
|
|
| 194 |
|
| 195 |
+
}
|
|
|
|
|
|
|
| 196 |
|
| 197 |
+
static public function slugify( $text ) {
|
| 198 |
+
$text = preg_replace( '~[^\\pL\d]+~u', '-', $text );
|
| 199 |
+
$text = trim( $text, '-' );
|
| 200 |
+
$text = iconv( 'utf-8', 'us-ascii//TRANSLIT', $text );
|
| 201 |
+
$text = strtolower( $text );
|
| 202 |
+
$text = preg_replace( '~[^-\w]+~', '', $text );
|
| 203 |
|
| 204 |
+
if ( empty( $text ) ) {
|
| 205 |
+
return 'n-a';
|
| 206 |
}
|
| 207 |
|
| 208 |
+
return $text;
|
| 209 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
|
| 211 |
+
private function v( $name ) {
|
| 212 |
+
switch ( $this->mode ) {
|
| 213 |
+
default:
|
| 214 |
+
case MODULA_DB_MODE:
|
| 215 |
+
return $this->gallery->$name;
|
| 216 |
+
break;
|
| 217 |
+
case MODULA_WP_MODE:
|
| 218 |
+
return $this->settings[ $name ];
|
| 219 |
+
}
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
public function render() {
|
| 223 |
+
$rid = rand( 1, 1000 );
|
| 224 |
|
| 225 |
+
if ( $this->gallery->shuffle == 'T' ) {
|
| 226 |
+
shuffle( $this->images );
|
| 227 |
}
|
| 228 |
|
| 229 |
+
$gallery = $this->gallery;
|
| 230 |
+
|
| 231 |
+
$html = "";
|
| 232 |
+
|
| 233 |
+
$html .= "<style>";
|
| 234 |
+
|
| 235 |
+
if ( $this->gallery->borderSize ) {
|
| 236 |
+
$html .= "#jtg-$this->id$rid .item { border: " . absint($this->gallery->borderSize) . "px solid " . sanitize_hex_color($this->gallery->borderColor) . "; }";
|
|
|
|
| 237 |
}
|
| 238 |
|
| 239 |
+
if ( $this->gallery->borderRadius ) {
|
| 240 |
+
$html .= "#jtg-$this->id$rid .item { border-radius: " . absint($this->gallery->borderRadius) . "px; }";
|
| 241 |
+
}
|
| 242 |
|
| 243 |
+
if ( $this->gallery->shadowSize ) {
|
| 244 |
+
$html .= "#jtg-$this->id$rid .item { box-shadow: " . absint($this->gallery->shadowColor) . " 0px 0px " . sanitize_hex_color($this->gallery->shadowSize) . "px; }";
|
| 245 |
+
}
|
| 246 |
|
| 247 |
+
if ( $this->gallery->socialIconColor ) {
|
| 248 |
+
$html .= "#jtg-$this->id$rid .item .jtg-social a { color: " . sanitize_hex_color($this->gallery->socialIconColor) . " }";
|
| 249 |
+
}
|
| 250 |
|
| 251 |
+
$html .= "#jtg-$this->id$rid .item .caption { background-color: " . sanitize_hex_color($this->gallery->captionColor) . "; }";
|
| 252 |
|
| 253 |
+
$html .= "#jtg-$this->id$rid .item .figc { color: " . sanitize_hex_color($this->gallery->captionColor) . "; font-size: " . $this->gallery->captionFontSize . "px; }";
|
| 254 |
|
| 255 |
+
$html .= "#jtg-$this->id$rid .item .figc h2.jtg-title { font-size: " . absint($this->gallery->titleFontSize) . "px; }";
|
|
|
|
|
|
|
| 256 |
|
| 257 |
+
$html .= "#jtg-$this->id$rid .item { transform: scale(" . absint($gallery->loadedScale) / 100 . ") translate(" . absint($gallery->loadedHSlide) . 'px,' . absint($gallery->loadedVSlide) . "px) rotate(" . absint($gallery->loadedRotate) . "deg); }";
|
|
|
|
|
|
|
| 258 |
|
| 259 |
+
$html .= "#jtg-$this->id$rid .items { width:" . esc_html($this->gallery->width) . "; height:" . absint($this->gallery->height) . "px; }";
|
|
|
|
|
|
|
| 260 |
|
| 261 |
+
$html .= "#jtg-$this->id$rid .items .figc p.description { color:" . sanitize_hex_color($this->gallery->captionColor) . "; }";
|
|
|
|
|
|
|
| 262 |
|
|
|
|
| 263 |
|
| 264 |
+
if ( strlen( $this->gallery->style ) ) {
|
| 265 |
+
$html .= esc_html($this->gallery->style);
|
| 266 |
+
}
|
| 267 |
|
| 268 |
+
$html .= "</style>\n";
|
| 269 |
|
| 270 |
+
$id = $this->id;
|
| 271 |
+
$html .= "<a name='$id'> </a>";
|
| 272 |
+
$html .= '<div class="modula" id="jtg-' . absint($this->id) . absint($rid) . '">';
|
| 273 |
|
| 274 |
+
$html .= "<div class='items'>";
|
| 275 |
|
| 276 |
+
foreach ( array_slice( $this->images, 0, 40 / 2 ) as $image ) {
|
| 277 |
|
| 278 |
+
$title = in_array( $this->gallery->lightbox, array(
|
| 279 |
+
'prettyphoto',
|
| 280 |
+
'fancybox',
|
| 281 |
+
'swipebox',
|
| 282 |
+
'lightbox2'
|
| 283 |
+
) ) ? "title" : "data-title";
|
| 284 |
+
$rel = $this->gallery->lightbox == "prettyphoto" ? 'prettyPhoto[jtg-' . esc_attr($this->id) . esc_attr($rid) . ']' : 'jtg-' . esc_attr($this->id) . esc_attr($rid);
|
| 285 |
|
| 286 |
+
$hoverEffect = $this->getHoverEffect( $this->gallery->hoverEffect );
|
|
|
|
|
|
|
| 287 |
|
| 288 |
+
/*if(empty($image->title) && empty($image->description) &&
|
| 289 |
+
!$this->gallery->enableTwitter && !$this->gallery->enableFacebook &&
|
| 290 |
+
!$this->gallery->enablePinterest & !$this->gallery->enableGplus)
|
| 291 |
+
{
|
| 292 |
+
$hoverEffect = $this->getHoverEffect('none');
|
| 293 |
+
}*/
|
| 294 |
+
|
| 295 |
+
$hasTitle = empty( $image->title ) ? 'notitle' : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
|
| 297 |
+
$imgUrl = $image->imagePath;
|
| 298 |
+
$image->alt = isset( $image->alt ) ? $image->alt : '';
|
| 299 |
|
| 300 |
+
$html .= "<div class=\"item " . esc_attr($hasTitle) . " effect-" . esc_attr($hoverEffect->code) . "\">";
|
| 301 |
+
$html .= "<a $title='$image->description' " . ( $this->gallery->lightbox == "lightbox2" && empty( $image->link ) ? "data-lightbox='$rel'" : "" ) . " rel='$rel' " . $this->getTarget( $image ) . " class='tile-inner " . esc_attr( $this->getLightboxClass( $image ) ) . "' " . $this->getLink( $image ) . "></a>";
|
| 302 |
+
$html .= "<img data-valign='$image->valign' alt='$image->alt' data-halign='$image->halign' class='pic' src='$imgUrl' data-src='$imgUrl' />";
|
| 303 |
+
$html .= "<div class=\"figc\">";
|
| 304 |
+
$html .= "<div class=\"figc-inner\">";
|
| 305 |
+
if ( $this->gallery->hoverEffect != 'none' && ! empty( $image->title ) && 'T' != $this->gallery->hide_title ) {
|
| 306 |
+
$html .= "<h2 class='jtg-title'>" . esc_html($image->title) . "</h2>";
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
if ( ( $this->gallery->hoverEffect != 'none' && ! empty( $image->description ) ) && 'T' != $this->gallery->hide_description ) {
|
| 310 |
+
$html .= "<p class=\"description\">";
|
| 311 |
+
$html .= wp_kses_post($image->description);
|
| 312 |
+
$html .= "</p>";
|
| 313 |
+
}
|
| 314 |
$html .= "</div>";
|
| 315 |
$html .= "</div>";
|
| 316 |
+
$html .= "</div>";
|
| 317 |
+
}
|
| 318 |
|
|
|
|
|
|
|
| 319 |
|
| 320 |
+
$html .= "</div>";
|
| 321 |
+
$html .= "</div>";
|
|
|
|
| 322 |
|
| 323 |
+
$html .= "<script type='text/javascript'>";
|
| 324 |
+
$html .= "jQuery('#jtg-$this->id$rid').modulaGallery({";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
|
| 326 |
+
if ( strlen( $this->gallery->script ) ) {
|
| 327 |
+
$html .= "onComplete: function () { " . esc_js( $this->gallery->script ) . "},";
|
| 328 |
+
}
|
| 329 |
|
| 330 |
+
$html .= "resizer: '" . plugins_url( 'image.php', dirname(__FILE__) ) . "',";
|
| 331 |
+
$html .= "margin: " . absint($this->gallery->margin) . ",";
|
| 332 |
+
// $html .= "\t\tkeepArea: " . ($this->gallery->keepArea == "T" ? "true" : "false") . ",\n";
|
| 333 |
+
$html .= "enableTwitter: " . ( $this->gallery->enableTwitter == "T" ? "true" : "false" ) . ",";
|
| 334 |
+
$html .= "enableFacebook: " . ( $this->gallery->enableFacebook == "T" ? "true" : "false" ) . ",";
|
| 335 |
+
$html .= "enablePinterest: " . ( $this->gallery->enablePinterest == "T" ? "true" : "false" ) . ",";
|
| 336 |
+
$html .= "enableGplus: " . ( $this->gallery->enableGplus == "T" ? "true" : "false" ) . ",";
|
| 337 |
+
$html .= "randomFactor: " . ( absint($this->gallery->randomFactor) / 100 ) . ",";
|
| 338 |
+
$html .= "});";
|
| 339 |
+
$html .= "</script>";
|
| 340 |
|
| 341 |
+
|
| 342 |
+
if ( ! empty( $_GET["debug"] ) ) {
|
| 343 |
+
return $html;
|
| 344 |
}
|
| 345 |
|
| 346 |
+
return str_replace( array( "\n", "\t" ), "", $html );
|
| 347 |
+
}
|
|
|
|
|
|
|
| 348 |
|
| 349 |
+
public function useCaptions() {
|
| 350 |
+
if ( $this->gallery->wp_field_caption == "none" && $this->gallery->wp_field_title == "none" ) {
|
| 351 |
+
return false;
|
| 352 |
}
|
| 353 |
|
| 354 |
+
return true;
|
| 355 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
|
| 357 |
+
public function loadModulaImages() {
|
| 358 |
+
$images = array();
|
| 359 |
+
$idx = 0;
|
| 360 |
+
foreach ( $this->db->getImagesByGalleryId( $this->id ) as $img ) {
|
| 361 |
+
$images[ $img->imageId < 0 ? $img->imageId - ( $idx ++ ) : $img->imageId ] = $img;
|
| 362 |
}
|
| 363 |
+
|
| 364 |
+
return $images;
|
| 365 |
}
|
| 366 |
}
|
|
|
