Version Description
- New image management
- Import tool for Envira galleries
- Import tool for NextGen galleries
Download this release
Release Info
Developer | GreenTreeLabs |
Plugin | Gallery – Photo Gallery – Image Gallery |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.12 to 1.1.0
- Modula.php +299 -79
- README.txt +7 -2
- admin/add-gallery.php +41 -44
- admin/css/style.css +15 -25
- admin/edit-gallery.php +111 -130
- admin/import.php +76 -0
- admin/include/image-list.php +3 -25
- admin/overview.php +20 -8
- admin/scripts/modula-admin.js +180 -13
- lib/db-class.php +16 -3
- lib/gallery-class.php +41 -16
- scripts/jquery.modula.js +6 -1
Modula.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
Plugin Name: Modula Grid
|
4 |
Plugin URI: http://modula.greentreelabs.net
|
5 |
Description: The Best Wordpress Gallery.
|
6 |
Author: GreenTreeLabs
|
7 |
-
Version: 1.0
|
8 |
Author URI: http://modula.greentreelabs.net
|
9 |
*/
|
10 |
|
@@ -18,14 +18,17 @@ if (!class_exists("ModulaLite"))
|
|
18 |
{
|
19 |
class ModulaLite
|
20 |
{
|
21 |
-
|
|
|
|
|
22 |
'width' => 100,
|
23 |
'height' => 800,
|
|
|
24 |
'margin' => 10,
|
25 |
'filters' => '',
|
26 |
'filterClick' => 'F',
|
27 |
'allFilterLabel' => 'All',
|
28 |
-
'lightbox' => '',
|
29 |
'shuffle' => 'F',
|
30 |
'captionColor' => '#ffffff',
|
31 |
'wp_field_caption' => 'caption',
|
@@ -51,12 +54,15 @@ if (!class_exists("ModulaLite"))
|
|
51 |
'randomFactor' => 50,
|
52 |
'hoverColor' => '#000000',
|
53 |
'hoverOpacity' => '50',
|
54 |
-
'hoverEffect' => 'pufrobo'
|
|
|
|
|
55 |
);
|
56 |
|
57 |
public function __construct()
|
58 |
{
|
59 |
-
$this->plugin_name = plugin_basename(__FILE__);
|
|
|
60 |
$this->define_constants();
|
61 |
$this->define_db_tables();
|
62 |
$this->define_hover_effects();
|
@@ -72,7 +78,7 @@ if (!class_exists("ModulaLite"))
|
|
72 |
|
73 |
add_action( 'admin_menu', array($this, 'add_gallery_admin_menu') );
|
74 |
|
75 |
-
add_shortcode( 'Modula', array($this, 'gallery_shortcode_handler') );
|
76 |
|
77 |
add_action('wp_ajax_modula_save_gallery', array($this,'save_gallery'));
|
78 |
add_action('wp_ajax_modula_save_image', array($this,'save_image'));
|
@@ -87,7 +93,9 @@ if (!class_exists("ModulaLite"))
|
|
87 |
add_action('wp_ajax_mtg_shortcode_editor', array($this, 'mtg_shortcode_editor'));
|
88 |
add_action('wp_ajax_modula_get_config', array($this, 'get_config'));
|
89 |
add_action('wp_ajax_modula_update_config', array($this, 'update_config'));
|
90 |
-
|
|
|
|
|
91 |
add_filter( 'plugin_row_meta',array( $this, 'register_links' ),10,2);
|
92 |
}
|
93 |
|
@@ -101,27 +109,167 @@ if (!class_exists("ModulaLite"))
|
|
101 |
function define_hover_effects()
|
102 |
{
|
103 |
$this->hoverEffects = array();
|
104 |
-
$this->hoverEffects[] = new
|
105 |
-
$this->hoverEffects[] = new
|
106 |
-
$this->hoverEffects[] = new
|
107 |
-
$this->hoverEffects[] = new
|
108 |
-
$this->hoverEffects[] = new
|
109 |
-
$this->hoverEffects[] = new
|
110 |
-
$this->hoverEffects[] = new
|
111 |
-
$this->hoverEffects[] = new
|
112 |
-
$this->hoverEffects[] = new
|
113 |
-
$this->hoverEffects[] = new
|
114 |
-
$this->hoverEffects[] = new
|
115 |
-
$this->hoverEffects[] = new
|
116 |
-
$this->hoverEffects[] = new
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
public function register_links($links, $file)
|
121 |
{
|
122 |
$base = plugin_basename(__FILE__);
|
123 |
if ($file == $base) {
|
124 |
-
$links[] = '<a href="admin.php?page=
|
125 |
$links[] = '<a href="https://twitter.com/greentreelabs" title="@GreenTreeLabs on Twitter">Twitter</a>';
|
126 |
$links[] = '<a href="https://www.facebook.com/greentreelabs" title="GreenTreeLabs on Facebook">Facebook</a>';
|
127 |
$links[] = '<a href="https://www.google.com/+GreentreelabsNetjs" title="GreenTreeLabs on Google+">Google+</a>';
|
@@ -181,6 +329,8 @@ if (!class_exists("ModulaLite"))
|
|
181 |
$data["description"] = $_POST['description'];
|
182 |
$data["width"] = $_POST['width'];
|
183 |
$data["height"] = $_POST['height'];
|
|
|
|
|
184 |
|
185 |
$this->ModulaDB->addGallery($data);
|
186 |
$id = $this->ModulaDB->getLastGalleryId()->Id;
|
@@ -189,12 +339,11 @@ if (!class_exists("ModulaLite"))
|
|
189 |
{
|
190 |
$enc_images = stripslashes($_POST["images"]);
|
191 |
$images = array_splice(json_decode($enc_images), 0, 11 + 9);
|
|
|
192 |
$result = $this->ModulaDB->addImages($id, $images);
|
193 |
}
|
194 |
-
|
195 |
print $id;
|
196 |
-
}
|
197 |
-
|
198 |
die;
|
199 |
}
|
200 |
|
@@ -204,7 +353,7 @@ if (!class_exists("ModulaLite"))
|
|
204 |
if(check_admin_referer('Modula','Modula'))
|
205 |
{
|
206 |
$sourceId = intval($_POST['gid']);
|
207 |
-
$g = $this->ModulaDB->getGalleryById($sourceId);
|
208 |
$g->name .="(copy)";
|
209 |
$this->ModulaDB->addGallery($g);
|
210 |
$id = $this->ModulaDB->getNewGalleryId();
|
@@ -284,7 +433,7 @@ if (!class_exists("ModulaLite"))
|
|
284 |
public function add_gallery_scripts()
|
285 |
{
|
286 |
wp_enqueue_script('jquery');
|
287 |
-
|
288 |
wp_register_script('modula', WP_PLUGIN_URL.'/modula-best-grid-gallery/scripts/jquery.modula.js', array('jquery'));
|
289 |
wp_enqueue_script('modula');
|
290 |
|
@@ -350,23 +499,20 @@ if (!class_exists("ModulaLite"))
|
|
350 |
//Create Admin Menu
|
351 |
public function add_gallery_admin_menu()
|
352 |
{
|
353 |
-
$overview = add_menu_page('Modula', 'Modula', 'edit_posts', '
|
354 |
-
|
355 |
-
$
|
356 |
-
|
357 |
-
$
|
358 |
-
|
359 |
-
$
|
360 |
-
|
361 |
-
$plugins = add_submenu_page('Modula-admin', __('Modula >> Other galleries','Modula'), __('Other galleries','Modula'), 'edit_posts', 'modula-gallery-others', array($this, 'other_galleries'));
|
362 |
-
|
363 |
-
$upgrade = add_submenu_page('Modula-admin', __('Modula >> Upgrade','Modula'), __('Upgrade','Modula'), 'edit_posts', 'modula-gallery-upgrade', array($this, 'upgrade'));
|
364 |
|
365 |
add_action('load-'.$tutorial, array($this, 'gallery_admin_init'));
|
366 |
add_action('load-'.$overview, array($this, 'gallery_admin_init'));
|
367 |
add_action('load-'.$add_gallery, array($this, 'gallery_admin_init'));
|
368 |
add_action('load-'.$edit_gallery, array($this, 'gallery_admin_init'));
|
369 |
add_action('load-'.$upgrade, array($this, 'gallery_admin_init'));
|
|
|
370 |
add_action('load-'.$plugins, array($this, 'gallery_admin_init'));
|
371 |
}
|
372 |
|
@@ -396,7 +542,10 @@ if (!class_exists("ModulaLite"))
|
|
396 |
include("admin/add-gallery.php");
|
397 |
}
|
398 |
|
399 |
-
|
|
|
|
|
|
|
400 |
|
401 |
public function delete_image()
|
402 |
{
|
@@ -409,27 +558,12 @@ if (!class_exists("ModulaLite"))
|
|
409 |
die();
|
410 |
}
|
411 |
|
412 |
-
public function resize_images()
|
413 |
-
{
|
414 |
-
if(check_admin_referer('Modula','Modula'))
|
415 |
-
{
|
416 |
-
foreach (explode(",", $_POST["id"]) as $data)
|
417 |
-
{
|
418 |
-
$data = explode("-", $data);
|
419 |
-
$image = wp_get_attachment_image_src( $data[1], $_POST['size'] );
|
420 |
-
|
421 |
-
if ( !empty( $image ) )
|
422 |
-
$this->ModulaDB->editImage($data[0], array("imagePath" => $image[0]));
|
423 |
-
}
|
424 |
-
}
|
425 |
-
die();
|
426 |
-
}
|
427 |
-
|
428 |
public function add_image()
|
429 |
{
|
430 |
if(check_admin_referer('Modula','Modula'))
|
431 |
{
|
432 |
$gid = intval($_POST['galleryId']);
|
|
|
433 |
$prev = $this->ModulaDB->getImagesByGalleryId($gid);
|
434 |
|
435 |
$enc_images = stripslashes($_POST["enc_images"]);
|
@@ -437,7 +571,7 @@ if (!class_exists("ModulaLite"))
|
|
437 |
|
438 |
$d = 18 + log10(100);
|
439 |
$images = array_slice($images, 0, $d - count($prev));
|
440 |
-
|
441 |
$result = $this->ModulaDB->addImages($gid, $images);
|
442 |
|
443 |
header("Content-type: application/json");
|
@@ -488,8 +622,7 @@ if (!class_exists("ModulaLite"))
|
|
488 |
$halign = $_POST['halign'];
|
489 |
$valign = $_POST['valign'];
|
490 |
|
491 |
-
$data = array("
|
492 |
-
"target" => $target,
|
493 |
"link" => $link,
|
494 |
"imageId" => $imageId,
|
495 |
"description" => $imageCaption,
|
@@ -529,7 +662,7 @@ if (!class_exists("ModulaLite"))
|
|
529 |
if(check_admin_referer('Modula','Modula'))
|
530 |
{
|
531 |
$gid = intval($_POST["gid"]);
|
532 |
-
$gallery = $this->ModulaDB->getGalleryById($gid);
|
533 |
|
534 |
$imageResults = $this->ModulaDB->getImagesByGalleryId($gid);
|
535 |
|
@@ -550,8 +683,7 @@ if (!class_exists("ModulaLite"))
|
|
550 |
public function save_gallery()
|
551 |
{
|
552 |
if(check_admin_referer('Modula','Modula'))
|
553 |
-
{
|
554 |
-
|
555 |
$galleryName = stripslashes($_POST['tg_name']);
|
556 |
$galleryDescription = stripslashes($_POST['tg_description']);
|
557 |
$slug = strtolower(str_replace(" ", "", $galleryName));
|
@@ -589,6 +721,8 @@ if (!class_exists("ModulaLite"))
|
|
589 |
'slug' => $slug,
|
590 |
'description' => $galleryDescription,
|
591 |
'lightbox' => $lightbox,
|
|
|
|
|
592 |
'wp_field_caption' => $wp_field_caption,
|
593 |
'wp_field_title' => $wp_field_title,
|
594 |
'margin' => $margin,
|
@@ -621,7 +755,19 @@ if (!class_exists("ModulaLite"))
|
|
621 |
header("Content-type: application/json");
|
622 |
if($id > 0)
|
623 |
{
|
624 |
-
$result = $this->ModulaDB->editGallery($id, $data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
}
|
626 |
else
|
627 |
{
|
@@ -639,6 +785,7 @@ if (!class_exists("ModulaLite"))
|
|
639 |
|
640 |
public function edit_gallery()
|
641 |
{
|
|
|
642 |
$modula_fields = $this->fields;
|
643 |
$modula_parent_page = "dashboard";
|
644 |
|
@@ -673,19 +820,13 @@ if (!class_exists("ModulaLite"))
|
|
673 |
require_once('lib/gallery-class.php');
|
674 |
global $Modula;
|
675 |
|
676 |
-
if (class_exists('
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
$Modula->initByGalleryId($atts['id']);
|
681 |
-
|
682 |
-
if(! empty($atts['ids']))
|
683 |
-
$Modula->initByImageIds($atts['ids']);
|
684 |
-
|
685 |
$settings = $Modula->getGallery();
|
686 |
switch($settings->lightbox)
|
687 |
{
|
688 |
-
default:
|
689 |
case "lightbox2":
|
690 |
wp_enqueue_style('lightbox2_stylesheet');
|
691 |
wp_enqueue_script('lightbox2_script');
|
@@ -693,13 +834,11 @@ if (!class_exists("ModulaLite"))
|
|
693 |
}
|
694 |
return $Modula->render();
|
695 |
}
|
696 |
-
else
|
|
|
697 |
return "Gallery not found.";
|
698 |
-
}
|
699 |
-
}
|
700 |
-
|
701 |
-
|
702 |
-
/* example */
|
703 |
|
704 |
var $fields = array(
|
705 |
|
@@ -731,6 +870,13 @@ if (!class_exists("ModulaLite"))
|
|
731 |
"description" => "Height of the gallery in pixels",
|
732 |
"mu" => "px",
|
733 |
"excludeFrom" => array()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
),
|
735 |
"margin" => array(
|
736 |
"name" => "Margin",
|
@@ -1007,7 +1153,7 @@ if (!class_exists("ModulaLite"))
|
|
1007 |
);
|
1008 |
}
|
1009 |
|
1010 |
-
class
|
1011 |
{
|
1012 |
var $name;
|
1013 |
var $code;
|
@@ -1026,6 +1172,80 @@ if (!class_exists("ModulaLite"))
|
|
1026 |
}
|
1027 |
}
|
1028 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1029 |
if (class_exists("ModulaLite"))
|
1030 |
{
|
1031 |
global $ob_ModulaLite;
|
1 |
<?php
|
2 |
/**
|
3 |
+
Plugin Name: Gallery A WordPress Modula Grid
|
4 |
Plugin URI: http://modula.greentreelabs.net
|
5 |
Description: The Best Wordpress Gallery.
|
6 |
Author: GreenTreeLabs
|
7 |
+
Version: 1.1.0
|
8 |
Author URI: http://modula.greentreelabs.net
|
9 |
*/
|
10 |
|
18 |
{
|
19 |
class ModulaLite
|
20 |
{
|
21 |
+
private $loadedData;
|
22 |
+
|
23 |
+
private $defaultValues = array(
|
24 |
'width' => 100,
|
25 |
'height' => 800,
|
26 |
+
'img_size' => 500,
|
27 |
'margin' => 10,
|
28 |
'filters' => '',
|
29 |
'filterClick' => 'F',
|
30 |
'allFilterLabel' => 'All',
|
31 |
+
'lightbox' => 'lightbox2',
|
32 |
'shuffle' => 'F',
|
33 |
'captionColor' => '#ffffff',
|
34 |
'wp_field_caption' => 'caption',
|
54 |
'randomFactor' => 50,
|
55 |
'hoverColor' => '#000000',
|
56 |
'hoverOpacity' => '50',
|
57 |
+
'hoverEffect' => 'pufrobo',
|
58 |
+
'hasResizedImages' => false,
|
59 |
+
'importedFrom' => ''
|
60 |
);
|
61 |
|
62 |
public function __construct()
|
63 |
{
|
64 |
+
$this->plugin_name = plugin_basename(__FILE__);
|
65 |
+
$this->plugin_url = plugins_url('', __FILE__);
|
66 |
$this->define_constants();
|
67 |
$this->define_db_tables();
|
68 |
$this->define_hover_effects();
|
78 |
|
79 |
add_action( 'admin_menu', array($this, 'add_gallery_admin_menu') );
|
80 |
|
81 |
+
add_shortcode( 'Modula', array($this, 'gallery_shortcode_handler') );
|
82 |
|
83 |
add_action('wp_ajax_modula_save_gallery', array($this,'save_gallery'));
|
84 |
add_action('wp_ajax_modula_save_image', array($this,'save_image'));
|
93 |
add_action('wp_ajax_mtg_shortcode_editor', array($this, 'mtg_shortcode_editor'));
|
94 |
add_action('wp_ajax_modula_get_config', array($this, 'get_config'));
|
95 |
add_action('wp_ajax_modula_update_config', array($this, 'update_config'));
|
96 |
+
add_action('wp_ajax_modula_get_ext_galleries', array($this,'get_ext_galleries'));
|
97 |
+
add_action('wp_ajax_modula_do_import_galleries', array($this,'do_import_galleries'));
|
98 |
+
|
99 |
add_filter( 'plugin_row_meta',array( $this, 'register_links' ),10,2);
|
100 |
}
|
101 |
|
109 |
function define_hover_effects()
|
110 |
{
|
111 |
$this->hoverEffects = array();
|
112 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('None', 'none', false, false, 0);
|
113 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Pufrobo', 'pufrobo', true, true, 4);
|
114 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Fluid Up', '', true, true, 0);
|
115 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Hide', '', true, true, 4);
|
116 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Quiet', '', true, false, 4);
|
117 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Catinelle', '', false, false, 4);
|
118 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Reflex', '', true, true, 4);
|
119 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Curtain', '', true, false, 4);
|
120 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Lens', '', true, true, 4);
|
121 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Appear', '', true, false, 4);
|
122 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Crafty', '', true, true, 0);
|
123 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Seemo', '', true, false, 4);
|
124 |
+
$this->hoverEffects[] = new ModulaLiteHoverEffect('Comodo', '', true, false, 4);
|
125 |
+
}
|
126 |
+
|
127 |
+
public function get_ext_galleries()
|
128 |
+
{
|
129 |
+
header("Content-type: application/json");
|
130 |
+
|
131 |
+
global $wpdb;
|
132 |
+
|
133 |
+
if(check_admin_referer("Modula","Modula"))
|
134 |
+
{
|
135 |
+
$res = array( "success" => 0 );
|
136 |
+
|
137 |
+
$source = $_POST['source'];
|
138 |
+
if ( $source ) {
|
139 |
+
$res['success'] = 1;
|
140 |
+
$res['galleries'] = array();
|
141 |
+
|
142 |
+
switch ( $source ) {
|
143 |
+
case 'Envira':
|
144 |
+
$galleries = get_posts( array(
|
145 |
+
'post_type' => 'envira',
|
146 |
+
'posts_per_page' => 1000
|
147 |
+
) );
|
148 |
+
foreach ( $galleries as $g ) {
|
149 |
+
$item = array();
|
150 |
+
$item['id'] = $g->ID;
|
151 |
+
$item['title'] = $g->post_title;
|
152 |
+
$res['galleries'] [] = $item;
|
153 |
+
}
|
154 |
+
break;
|
155 |
+
case 'NextGen':
|
156 |
+
$galleries = $wpdb->get_results("SELECT title, gid FROM $wpdb->nggallery");
|
157 |
+
foreach ( $galleries as $g ) {
|
158 |
+
$item = array();
|
159 |
+
$item['id'] = $g->gid;
|
160 |
+
$item['title'] = $g->title;
|
161 |
+
$res['galleries'] [] = $item;
|
162 |
+
}
|
163 |
+
break;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
echo json_encode( $res );
|
168 |
+
}
|
169 |
+
die();
|
170 |
}
|
171 |
|
172 |
+
public function do_import_galleries()
|
173 |
+
{
|
174 |
+
global $wpdb;
|
175 |
+
|
176 |
+
header("Content-type: application/json");
|
177 |
+
if(check_admin_referer("Modula","Modula"))
|
178 |
+
{
|
179 |
+
$res = array("success" => 0);
|
180 |
+
$source = $_POST['source'];
|
181 |
+
$ids = explode(",", $_POST['ids']);
|
182 |
+
switch ($source)
|
183 |
+
{
|
184 |
+
case 'Envira':
|
185 |
+
foreach ($ids as $id)
|
186 |
+
{
|
187 |
+
$gallery = get_post($id);
|
188 |
+
$meta = get_post_meta($id);
|
189 |
+
$data = unserialize( $meta['_eg_gallery_data'][0] );
|
190 |
+
|
191 |
+
$g = array('name' => $data['config']['title'],
|
192 |
+
'description' => 'Imported from Envira ('.$id.') on ' . date('M, d Y'),
|
193 |
+
'margin' => $data['config']['gutter'],
|
194 |
+
'hasResizedImages' => true,
|
195 |
+
'importedFrom' => 'Envira'
|
196 |
+
);
|
197 |
+
$gdb = array_merge($this->defaultValues, $g);
|
198 |
+
|
199 |
+
$saved = $this->ModulaDB->addGallery($gdb);
|
200 |
+
$newId = $this->ModulaDB->getNewGalleryId();
|
201 |
+
|
202 |
+
if($newId && count($data['gallery']))
|
203 |
+
{
|
204 |
+
$images = array();
|
205 |
+
//TODO only active images
|
206 |
+
foreach ( $data['gallery'] as $item )
|
207 |
+
{
|
208 |
+
$toAdd = new stdClass();
|
209 |
+
$toAdd->imageId = $this->ModulaDB->getIDbyGUID( $item['src'] );
|
210 |
+
$toAdd->title = $item['title'];
|
211 |
+
$toAdd->description = $item['caption'];
|
212 |
+
$toAdd->imagePath = $item['src'];
|
213 |
+
|
214 |
+
$images []= $toAdd;
|
215 |
+
}
|
216 |
+
$imgResult = $this->ModulaDB->addImages($newId, $images);
|
217 |
+
}
|
218 |
+
}
|
219 |
+
$res['success'] = 1;
|
220 |
+
break;
|
221 |
+
case 'NextGen':
|
222 |
+
foreach ($ids as $id)
|
223 |
+
{
|
224 |
+
$gallery = $wpdb->get_row(
|
225 |
+
$wpdb->prepare( "SELECT title, gid, path FROM $wpdb->nggallery WHERE gid=%s", $id)
|
226 |
+
);
|
227 |
+
|
228 |
+
$dbimages = $wpdb->get_results(
|
229 |
+
$wpdb->prepare( "SELECT filename, description, alttext FROM $wpdb->nggpictures WHERE exclude <> 1 AND galleryid=%s", $id )
|
230 |
+
);
|
231 |
+
|
232 |
+
$g = array('name' => $gallery->title,
|
233 |
+
'description' => 'Imported from NextGet ('.$id.') on ' . date('M, d Y'),
|
234 |
+
'hasResizedImages' => true,
|
235 |
+
'importedFrom' => 'NextGen'
|
236 |
+
);
|
237 |
+
$gdb = array_merge($this->defaultValues, $g);
|
238 |
+
|
239 |
+
$saved = $this->ModulaDB->addGallery($gdb);
|
240 |
+
$newId = $this->ModulaDB->getNewGalleryId();
|
241 |
+
|
242 |
+
if($newId && count($dbimages))
|
243 |
+
{
|
244 |
+
$images = array();
|
245 |
+
foreach ( $dbimages as $item )
|
246 |
+
{
|
247 |
+
$toAdd = new stdClass();
|
248 |
+
$toAdd->imageId = -1;
|
249 |
+
$toAdd->title = $item->alttext;
|
250 |
+
$toAdd->description = $item->description;
|
251 |
+
$toAdd->imagePath = plugins_url('image.php', __FILE__) . "?w=". $this->defaultValues['img_size'] ."&src=" . $gallery->path . "/" . $item->filename;
|
252 |
+
|
253 |
+
$images []= $toAdd;
|
254 |
+
}
|
255 |
+
$imgResult = $this->ModulaDB->addImages($newId, $images);
|
256 |
+
|
257 |
+
}
|
258 |
+
}
|
259 |
+
$res['success'] = 1;
|
260 |
+
break;
|
261 |
+
}
|
262 |
+
|
263 |
+
echo json_encode($res);
|
264 |
+
}
|
265 |
+
die();
|
266 |
+
}
|
267 |
|
268 |
public function register_links($links, $file)
|
269 |
{
|
270 |
$base = plugin_basename(__FILE__);
|
271 |
if ($file == $base) {
|
272 |
+
$links[] = '<a href="admin.php?page=ModulaLite-admin" title="Modula Grid Gallery Dashboard">Dashboard</a>';
|
273 |
$links[] = '<a href="https://twitter.com/greentreelabs" title="@GreenTreeLabs on Twitter">Twitter</a>';
|
274 |
$links[] = '<a href="https://www.facebook.com/greentreelabs" title="GreenTreeLabs on Facebook">Facebook</a>';
|
275 |
$links[] = '<a href="https://www.google.com/+GreentreelabsNetjs" title="GreenTreeLabs on Google+">Google+</a>';
|
329 |
$data["description"] = $_POST['description'];
|
330 |
$data["width"] = $_POST['width'];
|
331 |
$data["height"] = $_POST['height'];
|
332 |
+
$data["img_size"] = intval($_POST['img_size']);
|
333 |
+
$data["hasResizedImages"] = true;
|
334 |
|
335 |
$this->ModulaDB->addGallery($data);
|
336 |
$id = $this->ModulaDB->getLastGalleryId()->Id;
|
339 |
{
|
340 |
$enc_images = stripslashes($_POST["images"]);
|
341 |
$images = array_splice(json_decode($enc_images), 0, 11 + 9);
|
342 |
+
ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
343 |
$result = $this->ModulaDB->addImages($id, $images);
|
344 |
}
|
|
|
345 |
print $id;
|
346 |
+
}
|
|
|
347 |
die;
|
348 |
}
|
349 |
|
353 |
if(check_admin_referer('Modula','Modula'))
|
354 |
{
|
355 |
$sourceId = intval($_POST['gid']);
|
356 |
+
$g = $this->ModulaDB->getGalleryById($sourceId, $this->defaultValues);
|
357 |
$g->name .="(copy)";
|
358 |
$this->ModulaDB->addGallery($g);
|
359 |
$id = $this->ModulaDB->getNewGalleryId();
|
433 |
public function add_gallery_scripts()
|
434 |
{
|
435 |
wp_enqueue_script('jquery');
|
436 |
+
|
437 |
wp_register_script('modula', WP_PLUGIN_URL.'/modula-best-grid-gallery/scripts/jquery.modula.js', array('jquery'));
|
438 |
wp_enqueue_script('modula');
|
439 |
|
499 |
//Create Admin Menu
|
500 |
public function add_gallery_admin_menu()
|
501 |
{
|
502 |
+
$overview = add_menu_page('Modula', 'Modula', 'edit_posts', 'ModulaLite-admin', array($this, 'add_overview'), WP_PLUGIN_URL.'/modula-best-grid-gallery/admin/icon.png');
|
503 |
+
$tutorial = add_submenu_page('ModulaLite-admin', __('Modula >> Tutorial','Modula'), __('Tutorial','Modula'), 'edit_posts', 'modula-lite-tutorial', array($this, 'tutorial'));
|
504 |
+
$add_gallery = add_submenu_page('ModulaLite-admin', __('Modula >> Add Gallery','Modula'), __('Add Gallery','Modula'), 'edit_posts', 'add-modula-lite', array($this, 'add_gallery'));
|
505 |
+
$edit_gallery = add_submenu_page('ModulaLite-admin', __('Modula >> Edit Gallery','Modula'), __('Edit Gallery','Modula'), 'edit_posts', 'edit-modula-lite', array($this, 'edit_gallery'));
|
506 |
+
$plugins = add_submenu_page('ModulaLite-admin', __('Modula >> Other galleries','Modula'), __('Other galleries','Modula'), 'edit_posts', 'modula-lite-gallery-others', array($this, 'other_galleries'));
|
507 |
+
$import = add_submenu_page('ModulaLite-admin', __('Modula >> Import','Modula'), __('Import galleries','Modula'), 'edit_posts', 'modula-lite-gallery-import', array($this, 'import_galleries'));
|
508 |
+
$upgrade = add_submenu_page('ModulaLite-admin', __('Modula >> Upgrade','Modula'), __('Upgrade','Modula'), 'edit_posts', 'modula-lite-gallery-upgrade', array($this, 'upgrade'));
|
|
|
|
|
|
|
|
|
509 |
|
510 |
add_action('load-'.$tutorial, array($this, 'gallery_admin_init'));
|
511 |
add_action('load-'.$overview, array($this, 'gallery_admin_init'));
|
512 |
add_action('load-'.$add_gallery, array($this, 'gallery_admin_init'));
|
513 |
add_action('load-'.$edit_gallery, array($this, 'gallery_admin_init'));
|
514 |
add_action('load-'.$upgrade, array($this, 'gallery_admin_init'));
|
515 |
+
add_action('load-'.$import, array($this, 'gallery_admin_init'));
|
516 |
add_action('load-'.$plugins, array($this, 'gallery_admin_init'));
|
517 |
}
|
518 |
|
542 |
include("admin/add-gallery.php");
|
543 |
}
|
544 |
|
545 |
+
public function import_galleries()
|
546 |
+
{
|
547 |
+
include("admin/import.php");
|
548 |
+
}
|
549 |
|
550 |
public function delete_image()
|
551 |
{
|
558 |
die();
|
559 |
}
|
560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
public function add_image()
|
562 |
{
|
563 |
if(check_admin_referer('Modula','Modula'))
|
564 |
{
|
565 |
$gid = intval($_POST['galleryId']);
|
566 |
+
$this->loadedData = $this->ModulaDB->getGalleryById($gid, $this->defaultValues);
|
567 |
$prev = $this->ModulaDB->getImagesByGalleryId($gid);
|
568 |
|
569 |
$enc_images = stripslashes($_POST["enc_images"]);
|
571 |
|
572 |
$d = 18 + log10(100);
|
573 |
$images = array_slice($images, 0, $d - count($prev));
|
574 |
+
$images = ModulaLiteTools::check_and_resize( $images, $this->loadedData->img_size );
|
575 |
$result = $this->ModulaDB->addImages($gid, $images);
|
576 |
|
577 |
header("Content-type: application/json");
|
622 |
$halign = $_POST['halign'];
|
623 |
$valign = $_POST['valign'];
|
624 |
|
625 |
+
$data = array("target" => $target,
|
|
|
626 |
"link" => $link,
|
627 |
"imageId" => $imageId,
|
628 |
"description" => $imageCaption,
|
662 |
if(check_admin_referer('Modula','Modula'))
|
663 |
{
|
664 |
$gid = intval($_POST["gid"]);
|
665 |
+
$gallery = $this->ModulaDB->getGalleryById($gid, $this->defaultValues);
|
666 |
|
667 |
$imageResults = $this->ModulaDB->getImagesByGalleryId($gid);
|
668 |
|
683 |
public function save_gallery()
|
684 |
{
|
685 |
if(check_admin_referer('Modula','Modula'))
|
686 |
+
{
|
|
|
687 |
$galleryName = stripslashes($_POST['tg_name']);
|
688 |
$galleryDescription = stripslashes($_POST['tg_description']);
|
689 |
$slug = strtolower(str_replace(" ", "", $galleryName));
|
721 |
'slug' => $slug,
|
722 |
'description' => $galleryDescription,
|
723 |
'lightbox' => $lightbox,
|
724 |
+
'img_size' => intval($_POST['tg_img_size']),
|
725 |
+
'hasResizedImages' => true,
|
726 |
'wp_field_caption' => $wp_field_caption,
|
727 |
'wp_field_title' => $wp_field_title,
|
728 |
'margin' => $margin,
|
755 |
header("Content-type: application/json");
|
756 |
if($id > 0)
|
757 |
{
|
758 |
+
$result = $this->ModulaDB->editGallery($id, $data);
|
759 |
+
|
760 |
+
if(intval($this->loadedData->img_size) != $data['img_size'])
|
761 |
+
{
|
762 |
+
$images = $this->ModulaDB->getImagesByGalleryId( $id );
|
763 |
+
$images = ModulaLiteTools::check_and_resize( $images, $data['img_size'] );
|
764 |
+
|
765 |
+
foreach($images as $img) {
|
766 |
+
$this->ModulaDB->editImage( $img->Id, (array)$img );
|
767 |
+
}
|
768 |
+
}
|
769 |
+
|
770 |
+
$this->loadedData = $this->ModulaDB->getGalleryById($id, $this->defaultValues);
|
771 |
}
|
772 |
else
|
773 |
{
|
785 |
|
786 |
public function edit_gallery()
|
787 |
{
|
788 |
+
$this->loadedData = $this->ModulaDB->getGalleryById(intval($_GET['galleryId']), $this->defaultValues);
|
789 |
$modula_fields = $this->fields;
|
790 |
$modula_parent_page = "dashboard";
|
791 |
|
820 |
require_once('lib/gallery-class.php');
|
821 |
global $Modula;
|
822 |
|
823 |
+
if (class_exists( 'ModulaLiteFE' ))
|
824 |
+
{
|
825 |
+
$Modula = new ModulaLiteFE($this->ModulaDB, $atts['id'], $this->defaultValues);
|
826 |
+
|
|
|
|
|
|
|
|
|
|
|
827 |
$settings = $Modula->getGallery();
|
828 |
switch($settings->lightbox)
|
829 |
{
|
|
|
830 |
case "lightbox2":
|
831 |
wp_enqueue_style('lightbox2_stylesheet');
|
832 |
wp_enqueue_script('lightbox2_script');
|
834 |
}
|
835 |
return $Modula->render();
|
836 |
}
|
837 |
+
else
|
838 |
+
{
|
839 |
return "Gallery not found.";
|
840 |
+
}
|
841 |
+
}
|
|
|
|
|
|
|
842 |
|
843 |
var $fields = array(
|
844 |
|
870 |
"description" => "Height of the gallery in pixels",
|
871 |
"mu" => "px",
|
872 |
"excludeFrom" => array()
|
873 |
+
),
|
874 |
+
"img_size" => array(
|
875 |
+
"name" => "Minimum image size",
|
876 |
+
"type" => "number",
|
877 |
+
"description" => "Minimum width or height of the images",
|
878 |
+
"mu" => "px or %",
|
879 |
+
"excludeFrom" => array()
|
880 |
),
|
881 |
"margin" => array(
|
882 |
"name" => "Margin",
|
1153 |
);
|
1154 |
}
|
1155 |
|
1156 |
+
class ModulaLiteHoverEffect
|
1157 |
{
|
1158 |
var $name;
|
1159 |
var $code;
|
1172 |
}
|
1173 |
}
|
1174 |
|
1175 |
+
class ModulaLiteTools
|
1176 |
+
{
|
1177 |
+
public static function get_image_size_links($id)
|
1178 |
+
{
|
1179 |
+
$result = array();
|
1180 |
+
$sizes = get_intermediate_image_sizes();
|
1181 |
+
$sizes[] = 'full';
|
1182 |
+
|
1183 |
+
foreach ( $sizes as $size )
|
1184 |
+
{
|
1185 |
+
$image = wp_get_attachment_image_src( $id, $size );
|
1186 |
+
|
1187 |
+
if ( !empty( $image ) && ( true == $image[3] || 'full' == $size ) )
|
1188 |
+
$result["$image[1]x$image[2]"] = $image[0];
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
return $result;
|
1192 |
+
}
|
1193 |
+
|
1194 |
+
public static function resize_image($id, $img_size)
|
1195 |
+
{
|
1196 |
+
$file = get_attached_file($id);
|
1197 |
+
$editor = wp_get_image_editor($file);
|
1198 |
+
$size = $editor->get_size();
|
1199 |
+
if($size["width"] > $size["height"])
|
1200 |
+
{
|
1201 |
+
$editor->resize(10000, $img_size);
|
1202 |
+
}
|
1203 |
+
else
|
1204 |
+
{
|
1205 |
+
$editor->resize($img_size, 10000);
|
1206 |
+
}
|
1207 |
+
$path_parts = pathinfo($file);
|
1208 |
+
$filename = $path_parts['dirname'] . "/" . $path_parts['filename'] . "-" . $img_size . "x" . $img_size . "." . $path_parts["extension"];
|
1209 |
+
|
1210 |
+
if(! file_exists( $filename ))
|
1211 |
+
$editor->save($filename);
|
1212 |
+
return basename( $filename );
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
public static function check_and_resize(&$images, $size)
|
1216 |
+
{
|
1217 |
+
foreach ($images as &$img)
|
1218 |
+
{
|
1219 |
+
$metadata = wp_get_attachment_metadata( $img->imageId );
|
1220 |
+
|
1221 |
+
if($img->imageId > 0)
|
1222 |
+
{
|
1223 |
+
$wpdata = get_post( $img->imageId );
|
1224 |
+
$baseurl = str_replace( basename( $wpdata->guid ), "", $wpdata->guid );
|
1225 |
+
$res_name = ModulaLiteTools::resize_image( $img->imageId, $size );
|
1226 |
+
|
1227 |
+
if ( ! ( array_key_exists( "image_meta", $metadata ) &&
|
1228 |
+
array_key_exists( "resized_images", $metadata["image_meta"] ) &&
|
1229 |
+
in_array( $size . "x" . $size, $metadata["image_meta"]["resized_images"] ) )
|
1230 |
+
) {
|
1231 |
+
if ( isset( $metadata['image_meta'] ) ) {
|
1232 |
+
$md = $size . 'x' . $size;
|
1233 |
+
$metadata['image_meta']['resized_images'][] = $md;
|
1234 |
+
wp_update_attachment_metadata( $img->imageId, $metadata );
|
1235 |
+
}
|
1236 |
+
}
|
1237 |
+
|
1238 |
+
$img->imagePath = $baseurl . $res_name;
|
1239 |
+
}
|
1240 |
+
else
|
1241 |
+
{
|
1242 |
+
$img->imagePath = preg_replace("/w=(\d+)/", "w=" . $size, $img->imagePath);
|
1243 |
+
}
|
1244 |
+
}
|
1245 |
+
return $images;
|
1246 |
+
}
|
1247 |
+
}
|
1248 |
+
|
1249 |
if (class_exists("ModulaLite"))
|
1250 |
{
|
1251 |
global $ob_ModulaLite;
|
README.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
-
===
|
2 |
Contributors: GreenTreeLabs
|
3 |
Tags: best gallery, best gallery plugin, best responsive gallery, best responsive wordpress gallery, best wordpress gallery, best wordpress gallery plugin, best wp gallery, design portfolio, fullscreen, gallery, Gallery Plugin, image gallery, image gallery plugin, Image Rotator, javascript gallery, javascript rotator, jquery gallery, jquery rotator, media uploader, photo gallery, photo rotator, Picture Gallery, portfolio, responsive, responsive galleries, responsive gallery, responsive gallery plugin, responsive image gallery, responsive image gallery plugin, responsive rotator, responsive slideshow, responsive slideshow plugin, rotator, shortcode, slideshow, slideshow plugin, template tag, wordpress galleries, wordpress gallery, wordpress gallery plugin
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.5.
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -83,6 +83,11 @@ The simplest way to install is to click on \'Plugins\' then \'Add\' and type \'M
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
|
|
86 |
= 1.0.12 =
|
87 |
* Added link to ShortPixel plugin for image optimization
|
88 |
|
1 |
+
=== Gallery A WordPress Modula Grid ===
|
2 |
Contributors: GreenTreeLabs
|
3 |
Tags: best gallery, best gallery plugin, best responsive gallery, best responsive wordpress gallery, best wordpress gallery, best wordpress gallery plugin, best wp gallery, design portfolio, fullscreen, gallery, Gallery Plugin, image gallery, image gallery plugin, Image Rotator, javascript gallery, javascript rotator, jquery gallery, jquery rotator, media uploader, photo gallery, photo rotator, Picture Gallery, portfolio, responsive, responsive galleries, responsive gallery, responsive gallery plugin, responsive image gallery, responsive image gallery plugin, responsive rotator, responsive slideshow, responsive slideshow plugin, rotator, shortcode, slideshow, slideshow plugin, template tag, wordpress galleries, wordpress gallery, wordpress gallery plugin
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.5.2
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
83 |
|
84 |
== Changelog ==
|
85 |
|
86 |
+
= 1.1.0 =
|
87 |
+
* New image management
|
88 |
+
* Import tool for Envira galleries
|
89 |
+
* Import tool for NextGen galleries
|
90 |
+
|
91 |
= 1.0.12 =
|
92 |
* Added link to ShortPixel plugin for image optimization
|
93 |
|
admin/add-gallery.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
?>
|
6 |
|
7 |
<?php include("header.php") ?>
|
@@ -22,63 +22,60 @@
|
|
22 |
</div>
|
23 |
</div>
|
24 |
<div class="row">
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
</div>
|
30 |
<div class="row">
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
</div>
|
40 |
</fieldset>
|
41 |
-
|
42 |
-
|
43 |
<h5><?php _e('WordPress field for titles:','modula')?></h5>
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
</div>
|
50 |
<div class="field">
|
51 |
<h5><?php _e('WordPress field for captions:','modula')?></h5>
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
</div>
|
59 |
</fieldset>
|
60 |
<fieldset data-step="3" data-save="true">
|
61 |
<div class="field">
|
62 |
-
<h5><?php _e('
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
<label><?php _e('You can customize each image later','modula-gallery')?></label>
|
73 |
</div>
|
74 |
<div class="field select-images">
|
75 |
<a class="waves-effect waves-light btn add-images">
|
76 |
<i class="mdi mdi-plus left"></i> <?php _e('Add images','modula-gallery')?></a>
|
77 |
<br>
|
78 |
<label><?php _e('You can add images now or later.','modula-gallery')?></label>
|
79 |
-
|
80 |
-
<img src="<?php echo plugins_url('',__file__) ?>/images/icon-shortpixel.png" alt="ShortPixel">
|
81 |
-
<a target="_blank" href="https://shortpixel.com/h/af/N8LKGGT72393"><?php _e('We suggest you to use ShortPixel image optimization plugin for best SEO results.','modula-gallery')?></a></label>
|
82 |
<div class="images list-group"></div>
|
83 |
</div>
|
84 |
</fieldset>
|
@@ -103,7 +100,7 @@
|
|
103 |
</p>
|
104 |
</div>
|
105 |
<div class="modal-'footer">
|
106 |
-
<a href="?page=
|
107 |
</div>
|
108 |
</div>
|
109 |
|
@@ -113,7 +110,7 @@
|
|
113 |
<p><?php _e('For some reason it was not possible to save your gallery','modula-gallery')?></p>
|
114 |
</div>
|
115 |
<div class="modal-footer">
|
116 |
-
<a href="?page=
|
117 |
</div>
|
118 |
</div>
|
119 |
</div>
|
1 |
<?php
|
2 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
|
3 |
+
|
4 |
+
$tg_subtitle = "New Gallery";
|
5 |
?>
|
6 |
|
7 |
<?php include("header.php") ?>
|
22 |
</div>
|
23 |
</div>
|
24 |
<div class="row">
|
25 |
+
<div class="input-field">
|
26 |
+
<input name="tg_description" id="description" type="text" class="validate">
|
27 |
+
<label for="description"><?php _e('Description of the gallery (for internal use)','modula-gallery')?></label>
|
28 |
+
</div>
|
29 |
</div>
|
30 |
<div class="row">
|
31 |
+
<div class="input-field col s6">
|
32 |
+
<input name="tg_width" id="width" type="text" value="100%">
|
33 |
+
<label for="width"><?php _e('Gallery width','modula-gallery')?></label>
|
34 |
+
</div>
|
35 |
+
<div class="input-field col s6">
|
36 |
+
<input name="tg_height" id="height" type="text" value="800">
|
37 |
+
<label for="height"><?php _e('Gallery height in pixels','modula-gallery')?></label>
|
38 |
+
</div>
|
39 |
</div>
|
40 |
</fieldset>
|
41 |
+
<fieldset data-step="2" data-branch="images">
|
42 |
+
<div class="field">
|
43 |
<h5><?php _e('WordPress field for titles:','modula')?></h5>
|
44 |
+
<select class="browser-default" name="ftg_wp_field_title">
|
45 |
+
<option value="none">Don't use titles</option>
|
46 |
+
<option value="title" selected>Title</option>
|
47 |
+
<option value="description">Description</option>
|
48 |
+
</select>
|
49 |
</div>
|
50 |
<div class="field">
|
51 |
<h5><?php _e('WordPress field for captions:','modula')?></h5>
|
52 |
+
<select class="browser-default" name="ftg_wp_field_caption">
|
53 |
+
<option value="none">Don't use captions</option>
|
54 |
+
<option value="title">Title</option>
|
55 |
+
<option value="caption" selected>Caption</option>
|
56 |
+
<option value="description">Description</option>
|
57 |
+
</select>
|
58 |
</div>
|
59 |
</fieldset>
|
60 |
<fieldset data-step="3" data-save="true">
|
61 |
<div class="field">
|
62 |
+
<h5><?php _e('Image size','modula-gallery')?></h5>
|
63 |
+
<div class="row">
|
64 |
+
<div class="input-field">
|
65 |
+
<input name="tg_img_size" id="img_size" type="text" class="validate" required="required" value="500">
|
66 |
+
<label for="name"><?php _e('Minimum width or height of images','modula-gallery')?></label>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
<label class="shortpixel">
|
70 |
+
<img src="<?php echo plugins_url('',__file__) ?>/images/icon-shortpixel.png" alt="ShortPixel">
|
71 |
+
<a target="_blank" href="https://shortpixel.com/wp/af/N8LKGGT72393"><?php _e('We suggest you to use ShortPixel image optimization plugin for best SEO results.','modula-gallery')?></a></label>
|
|
|
72 |
</div>
|
73 |
<div class="field select-images">
|
74 |
<a class="waves-effect waves-light btn add-images">
|
75 |
<i class="mdi mdi-plus left"></i> <?php _e('Add images','modula-gallery')?></a>
|
76 |
<br>
|
77 |
<label><?php _e('You can add images now or later.','modula-gallery')?></label>
|
78 |
+
|
|
|
|
|
79 |
<div class="images list-group"></div>
|
80 |
</div>
|
81 |
</fieldset>
|
100 |
</p>
|
101 |
</div>
|
102 |
<div class="modal-'footer">
|
103 |
+
<a href="?page=ModulaLite-admin" id="modal-close" class="waves-effect waves-green btn-flat modal-action"><?php _e('Close','modula-gallery')?></a>
|
104 |
</div>
|
105 |
</div>
|
106 |
|
110 |
<p><?php _e('For some reason it was not possible to save your gallery','modula-gallery')?></p>
|
111 |
</div>
|
112 |
<div class="modal-footer">
|
113 |
+
<a href="?page=ModulaLite-admin" class="waves-effect waves-green btn-flat modal-action"><?php _e('Close','modula-gallery')?></a>
|
114 |
</div>
|
115 |
</div>
|
116 |
</div>
|
admin/css/style.css
CHANGED
@@ -14,17 +14,18 @@
|
|
14 |
|
15 |
@font-face {
|
16 |
font-family: 'Roboto';
|
17 |
-
src: url('../font/
|
18 |
-
src: url('../font/
|
19 |
-
url('../font/
|
20 |
-
url('../font/
|
21 |
-
url('../font/
|
22 |
font-weight: normal;
|
23 |
font-style: normal;
|
24 |
|
25 |
}
|
26 |
|
27 |
|
|
|
28 |
[data-icon]:before {
|
29 |
font-family: "modula-icons" !important;
|
30 |
content: attr(data-icon);
|
@@ -94,6 +95,9 @@ body
|
|
94 |
margin: 10px;
|
95 |
padding: 5px;
|
96 |
}
|
|
|
|
|
|
|
97 |
|
98 |
/*.shortcode-section
|
99 |
{
|
@@ -106,7 +110,9 @@ body
|
|
106 |
margin-top: 5px;
|
107 |
width: 100%;
|
108 |
}
|
109 |
-
|
|
|
|
|
110 |
.hide
|
111 |
{
|
112 |
display: none;
|
@@ -1419,25 +1425,6 @@ body
|
|
1419 |
opacity: .8;
|
1420 |
color:#fff;
|
1421 |
}
|
1422 |
-
.shortcode-section input[type=text]
|
1423 |
-
{
|
1424 |
-
border: none!important;
|
1425 |
-
color: #AFACB8;
|
1426 |
-
font-family: courier;
|
1427 |
-
background: transparent!important;
|
1428 |
-
width: 141px;
|
1429 |
-
}
|
1430 |
-
|
1431 |
-
.shortcode-section
|
1432 |
-
{
|
1433 |
-
color: #ADACAC;
|
1434 |
-
margin: 48px 0px 15px 41px;
|
1435 |
-
padding-left: 43px;
|
1436 |
-
font-size: 1rem;
|
1437 |
-
width: 300px;
|
1438 |
-
background-color: white;
|
1439 |
-
padding: 20px;
|
1440 |
-
}
|
1441 |
.setting
|
1442 |
{
|
1443 |
color: #ADACAC;
|
@@ -1496,4 +1483,7 @@ body
|
|
1496 |
#adminmenu .wp-submenu .modula-jump-pro-menu {
|
1497 |
color:#22e34f;
|
1498 |
font-weight: bold;
|
|
|
|
|
|
|
1499 |
}
|
14 |
|
15 |
@font-face {
|
16 |
font-family: 'Roboto';
|
17 |
+
src: url('../font/roboto/Roboto-Regular-webfont.eot');
|
18 |
+
src: url('../font/roboto/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
|
19 |
+
url('../font/roboto/Roboto-Regular-webfont.woff') format('woff'),
|
20 |
+
url('../font/roboto/Roboto-Regular-webfont.ttf') format('truetype'),
|
21 |
+
url('../font/roboto/Roboto-Regular-webfont.svg#robotoregular') format('svg');
|
22 |
font-weight: normal;
|
23 |
font-style: normal;
|
24 |
|
25 |
}
|
26 |
|
27 |
|
28 |
+
|
29 |
[data-icon]:before {
|
30 |
font-family: "modula-icons" !important;
|
31 |
content: attr(data-icon);
|
95 |
margin: 10px;
|
96 |
padding: 5px;
|
97 |
}
|
98 |
+
strong {
|
99 |
+
font-weight:700;
|
100 |
+
}
|
101 |
|
102 |
/*.shortcode-section
|
103 |
{
|
110 |
margin-top: 5px;
|
111 |
width: 100%;
|
112 |
}
|
113 |
+
.page-footer .progress {
|
114 |
+
display: none;
|
115 |
+
}
|
116 |
.hide
|
117 |
{
|
118 |
display: none;
|
1425 |
opacity: .8;
|
1426 |
color:#fff;
|
1427 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1428 |
.setting
|
1429 |
{
|
1430 |
color: #ADACAC;
|
1483 |
#adminmenu .wp-submenu .modula-jump-pro-menu {
|
1484 |
color:#22e34f;
|
1485 |
font-weight: bold;
|
1486 |
+
}
|
1487 |
+
#external-galleries input[type=checkbox] {
|
1488 |
+
position: static;
|
1489 |
}
|
admin/edit-gallery.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
|
3 |
|
4 |
function modula_print_value($gallery, $field, $default = NULL)
|
@@ -21,34 +21,31 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('Y
|
|
21 |
}
|
22 |
|
23 |
$galleryResults = $this->ModulaDB->getGalleries();
|
24 |
-
$gallery = null;
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
$gid = $_GET['galleryId'];
|
29 |
-
$gallery = $this->ModulaDB->getGalleryById($gid);
|
30 |
-
$tg_subtitle = "Edit Gallery: " . $gallery->name;
|
31 |
-
}
|
32 |
-
else
|
33 |
-
{
|
34 |
-
$tg_subtitle="Edit Gallery";
|
35 |
-
include("overview.php");
|
36 |
-
return;
|
37 |
-
}
|
38 |
|
39 |
include("header.php");
|
40 |
|
41 |
?>
|
42 |
|
43 |
-
<script>
|
44 |
-
|
45 |
-
</script>
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
<span class='setting'>Settings:</span>
|
53 |
|
54 |
<p class="import-export">
|
@@ -90,7 +87,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('Y
|
|
90 |
|
91 |
<form name="gallery_form" id="gallery_form" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" method="post">
|
92 |
<?php wp_nonce_field('Modula', 'Modula'); ?>
|
93 |
-
<input type="hidden" name="ftg_gallery_edit" id="gallery-id" value="<?php _e($
|
94 |
<table class="widefat post fixed" cellspacing="0">
|
95 |
</tbody>
|
96 |
</table>
|
@@ -246,8 +243,6 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('Y
|
|
246 |
</table>
|
247 |
</div>
|
248 |
</li>
|
249 |
-
<?php $idx++ ?>
|
250 |
-
|
251 |
<?php endforeach; ?>
|
252 |
|
253 |
<li id="images">
|
@@ -256,118 +251,105 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('Y
|
|
256 |
<i class="icon icon-chevron-right"></i>
|
257 |
</div>
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
<select class="current-image-size browser-default">
|
269 |
-
<?php
|
270 |
-
foreach ($this->list_thumbnail_sizes() as $size => $atts)
|
271 |
-
{
|
272 |
-
print '<option value="'. $size .'">' . $size . " (" . implode( 'x', $atts ) . ")</option>";
|
273 |
-
}
|
274 |
-
?>
|
275 |
-
</select>
|
276 |
-
</div>
|
277 |
-
</div>
|
278 |
-
|
279 |
-
<div>
|
280 |
-
|
281 |
-
<div class="">
|
282 |
-
<span class="tip">For multiple selections: Click+CTRL.</span>
|
283 |
-
</div>
|
284 |
-
<div class="actions row">
|
285 |
-
<a href="#" class="open-media-panel waves-effect button-bg waves-light btn action"><i class="mdi-image-photo"></i> <?php _e('Add images','Modula-gallery')?></a>
|
286 |
-
</div>
|
287 |
-
|
288 |
-
<div class="bulk row">
|
289 |
-
<label class="label-text row"><?php _e('Bulk Actions','modula-gallery')?></label>
|
290 |
-
<div class="options">
|
291 |
-
<a class="btn button-bg waves-effect waves-light" href="#" data-action="select"><?php _e('Select all','modula-gallery')?></a>
|
292 |
-
<a class="btn button-bg waves-effect waves-light" href="#" data-action="deselect"><?php _e('Deselect all','modula-gallery')?></a>
|
293 |
-
<a class="btn button-bg waves-effect waves-light" href="#" data-action="toggle"><?php _e('Toggle selection','modula-gallery')?></a>
|
294 |
-
<a class="btn button-bg waves-effect waves-light" href="#" data-action="resize"><?php _e('Resize','modula-gallery')?></a>
|
295 |
-
<a class="btn button-bg waves-effect waves-light" href="#" data-action="remove"><?php _e('Remove','modula-gallery')?></a>
|
296 |
-
</div>
|
297 |
-
<div class="panel">
|
298 |
-
<strong></strong>
|
299 |
-
<p class="text"></p>
|
300 |
-
<p class="buttons">
|
301 |
-
<a class="btn deep-orange darken-2 mrm cancel" href="#" ><?php _e('Cancel','modula-gallery')?></a>
|
302 |
-
<a class="btn green mrm proceed firm" href="#"><?php _e('Proceed','modula-gallery')?></a>
|
303 |
-
</p>
|
304 |
</div>
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
<!-- image panel -->
|
313 |
-
<div id="image-panel-model" style="display:none">
|
314 |
-
<a href="#" class="close" title="Close">X</a>
|
315 |
-
<h4> <?php _e('Edit Image','modula-gallery')?> </h4>
|
316 |
-
<div class="clearfix">
|
317 |
-
<div class="left">
|
318 |
-
<div class="figure"></div>
|
319 |
-
<div class="field sizes"></div>
|
320 |
</div>
|
321 |
-
<div class="editimage-right" >
|
322 |
-
<div class="field">
|
323 |
-
<label><?php _e('Title','modula-gallery')?></label>
|
324 |
-
<div class="text">
|
325 |
-
<textarea id="item-title" name="title"></textarea>
|
326 |
-
</div>
|
327 |
-
<label><?php _e('Caption','modula-gallery')?></label>
|
328 |
-
<div class="text">
|
329 |
-
<textarea id="item-description" name="description"></textarea>
|
330 |
-
</div>
|
331 |
-
</div>
|
332 |
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
|
|
|
|
|
|
|
|
345 |
</div>
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
|
|
|
|
356 |
</div>
|
357 |
-
|
358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
</div>
|
366 |
</div>
|
367 |
-
</div>
|
368 |
-
</div>
|
369 |
</li>
|
370 |
-
|
371 |
</ul>
|
372 |
|
373 |
<a id="edit-gallery" data-tooltip="Update gallery" data-position="top" data-delay="10" class="tooltipped btn-floating btn-large waves-effect waves-light green update-gallery">
|
@@ -378,7 +360,6 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('Y
|
|
378 |
<i class="icon icon-angle-up"></i>
|
379 |
</a>
|
380 |
<ul>
|
381 |
-
<?php $idx = 0; ?>
|
382 |
<?php foreach($modula_fields as $section => $s) : ?>
|
383 |
<li>
|
384 |
<a class="btn-floating green" rel="<?php print strtolower(str_replace(' ', '-', $section)) ?>"><i class="small <?php _e($s["icon"]) ?>"></i></a>
|
1 |
+
<?php
|
2 |
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
|
3 |
|
4 |
function modula_print_value($gallery, $field, $default = NULL)
|
21 |
}
|
22 |
|
23 |
$galleryResults = $this->ModulaDB->getGalleries();
|
|
|
24 |
|
25 |
+
$gallery = $this->loadedData;
|
26 |
+
$tg_subtitle = "Edit Gallery: " . $gallery->name;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
include("header.php");
|
29 |
|
30 |
?>
|
31 |
|
32 |
+
<script>
|
33 |
+
var modula_wp_caption_field = '<?php modula_print_value($gallery, "wp_field_caption") ?>';
|
34 |
+
</script>
|
35 |
+
<div class="row collapsible">
|
36 |
+
<div class="col s12 m6 l4">
|
37 |
+
<div class="card-panel light-green lighten-4">
|
38 |
+
<span> Shortcode: </span>
|
39 |
+
<input type="text" readonly value="[Modula id='<?php print $gallery->id; ?>']"> </input>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
<div class="col s12 m6 l4">
|
43 |
+
<div class="card-panel lime lighten-4">
|
44 |
+
<strong>TIP</strong>: blurry images? Try using a higher <i>Minimum image size</i> value!
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
|
49 |
<span class='setting'>Settings:</span>
|
50 |
|
51 |
<p class="import-export">
|
87 |
|
88 |
<form name="gallery_form" id="gallery_form" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>" method="post">
|
89 |
<?php wp_nonce_field('Modula', 'Modula'); ?>
|
90 |
+
<input type="hidden" name="ftg_gallery_edit" id="gallery-id" value="<?php _e($gallery->id); ?>" />
|
91 |
<table class="widefat post fixed" cellspacing="0">
|
92 |
</tbody>
|
93 |
</table>
|
243 |
</table>
|
244 |
</div>
|
245 |
</li>
|
|
|
|
|
246 |
<?php endforeach; ?>
|
247 |
|
248 |
<li id="images">
|
251 |
<i class="icon icon-chevron-right"></i>
|
252 |
</div>
|
253 |
|
254 |
+
<div class="collapsible-body white lighten-5">
|
255 |
+
<div class="image-size-section">
|
256 |
+
<div>
|
257 |
+
<div class="tips">
|
258 |
+
<span class="shortpixel">
|
259 |
+
<img src="<?php echo plugins_url('',__file__) ?>/images/icon-shortpixel.png" alt="ShortPixel">
|
260 |
+
<a target="_blank" href="https://shortpixel.com/wp/af/N8LKGGT72393"><?php _e('We suggest you to use ShortPixel image optimization plugin for best SEO results.','modula-gallery')?></a></span>
|
261 |
+
</div>
|
262 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
</div>
|
264 |
+
|
265 |
+
<div>
|
266 |
+
<div class="">
|
267 |
+
<span class="tip">For multiple selections: Click+CTRL.</span>
|
268 |
+
</div>
|
269 |
+
<div class="actions row">
|
270 |
+
<a href="#" class="open-media-panel waves-effect button-bg waves-light btn action"><i class="mdi-image-photo"></i> <?php _e('Add images','Modula-gallery')?></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
|
273 |
+
<div class="bulk row">
|
274 |
+
<label class="label-text row"><?php _e('Bulk Actions','modula-gallery')?></label>
|
275 |
+
<div class="options">
|
276 |
+
<a class="btn button-bg waves-effect waves-light" href="#" data-action="select"><?php _e('Select all','modula-gallery')?></a>
|
277 |
+
<a class="btn button-bg waves-effect waves-light" href="#" data-action="deselect"><?php _e('Deselect all','modula-gallery')?></a>
|
278 |
+
<a class="btn button-bg waves-effect waves-light" href="#" data-action="toggle"><?php _e('Toggle selection','modula-gallery')?></a>
|
279 |
+
<a class="btn button-bg waves-effect waves-light" href="#" data-action="resize"><?php _e('Resize','modula-gallery')?></a>
|
280 |
+
<a class="btn button-bg waves-effect waves-light" href="#" data-action="remove"><?php _e('Remove','modula-gallery')?></a>
|
281 |
+
</div>
|
282 |
+
<div class="panel">
|
283 |
+
<strong></strong>
|
284 |
+
<p class="text"></p>
|
285 |
+
<p class="buttons">
|
286 |
+
<a class="btn deep-orange darken-2 mrm cancel" href="#" ><?php _e('Cancel','modula-gallery')?></a>
|
287 |
+
<a class="btn green mrm proceed firm" href="#"><?php _e('Proceed','modula-gallery')?></a>
|
288 |
+
</p>
|
289 |
</div>
|
290 |
+
</div>
|
291 |
+
<div class="row">
|
292 |
+
<span class="tip"><?php _e('Drag images to change order.','modula-gallery')?></span>
|
293 |
+
</div>
|
294 |
+
|
295 |
+
<div id="image-list"></div>
|
296 |
+
|
297 |
+
<!-- image panel -->
|
298 |
+
<div id="image-panel-model" style="display:none">
|
299 |
+
<a href="#" class="close" title="Close">X</a>
|
300 |
+
<h4> <?php _e('Edit Image','modula-gallery')?> </h4>
|
301 |
+
<div class="clearfix">
|
302 |
+
<div class="left">
|
303 |
+
<div class="figure"></div>
|
304 |
</div>
|
305 |
+
<div class="editimage-right" >
|
306 |
+
<div class="field">
|
307 |
+
<label><?php _e('Title','modula-gallery')?></label>
|
308 |
+
<div class="text">
|
309 |
+
<textarea id="item-title" name="title"></textarea>
|
310 |
+
</div>
|
311 |
+
<label><?php _e('Caption','modula-gallery')?></label>
|
312 |
+
<div class="text">
|
313 |
+
<textarea id="item-description" name="description"></textarea>
|
314 |
+
</div>
|
315 |
+
</div>
|
316 |
|
317 |
+
<div class="field">
|
318 |
+
<label for="alignment"><?php _e('Alignment','modula-gallery')?></label>
|
319 |
+
<select name="halign">
|
320 |
+
<option><?php _e('left','modula-gallery')?></option>
|
321 |
+
<option selected><?php _e('center','modula-gallery')?></option>
|
322 |
+
<option><?php _e('right','modula-gallery')?></option>
|
323 |
+
</select>
|
324 |
+
<select name="valign">
|
325 |
+
<option><?php _e('top','modula-gallery')?></option>
|
326 |
+
<option selected><?php _e('middle','modula-gallery')?></option>
|
327 |
+
<option><?php _e('bottom','modula-gallery')?></option>
|
328 |
+
</select>
|
329 |
+
</div>
|
330 |
+
<div class="field">
|
331 |
+
<label><?php _e('Link','modula-gallery')?></label>
|
332 |
+
<div class="text">
|
333 |
+
<!-- <input type="text" name="link" value="" class="text-input row"> -->
|
334 |
+
<textarea id="item-link" name="link"></textarea>
|
335 |
+
<select name="target">
|
336 |
+
<option value=""><?php _e('Default target','modula-gallery')?></option>
|
337 |
+
<option value="_self"><?php _e('Open in same page','modula-gallery')?></option>
|
338 |
+
<option value="_blank"><?php _e('Open in _blank','modula-gallery')?></option>
|
339 |
+
</select>
|
340 |
+
</div>
|
341 |
+
</div>
|
342 |
+
<div class="field filters clearfix"></div>
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
<div class="field buttons">
|
346 |
+
<a href="#" data-action="cancel" class="action modal-action modal-close waves-effect waves-yellow btn-flat"><i class="mdi-content-reply"></i> <?php _e('Cancel','modula-gallery')?></a>
|
347 |
+
<a href="#" data-action="save" class="action modal-action modal-close waves-effect waves-green btn-flat"><i class="icon icon-save-disk"></i> <?php _e('Save','modula-gallery')?></a>
|
348 |
+
</div>
|
349 |
+
</div>
|
350 |
</div>
|
351 |
</div>
|
|
|
|
|
352 |
</li>
|
|
|
353 |
</ul>
|
354 |
|
355 |
<a id="edit-gallery" data-tooltip="Update gallery" data-position="top" data-delay="10" class="tooltipped btn-floating btn-large waves-effect waves-light green update-gallery">
|
360 |
<i class="icon icon-angle-up"></i>
|
361 |
</a>
|
362 |
<ul>
|
|
|
363 |
<?php foreach($modula_fields as $section => $s) : ?>
|
364 |
<li>
|
365 |
<a class="btn-floating green" rel="<?php print strtolower(str_replace(' ', '-', $section)) ?>"><i class="small <?php _e($s["icon"]) ?>"></i></a>
|
admin/import.php
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die(_e('You are not allowed to call this page directly.','modula-gallery')); }
|
3 |
+
|
4 |
+
if(empty($tg_subtitle))
|
5 |
+
{
|
6 |
+
$tg_subtitle = "Import galleries";
|
7 |
+
}
|
8 |
+
|
9 |
+
?>
|
10 |
+
<?php include("header.php"); ?>
|
11 |
+
|
12 |
+
<div id="modula-wizard" >
|
13 |
+
<h2> <?php _e('Import galleries','modula-gallery'); ?> </h2>
|
14 |
+
<form action="#" method="post" onsubmit="return false;">
|
15 |
+
<?php wp_nonce_field('Modula', 'Modula'); ?>
|
16 |
+
|
17 |
+
<fieldset data-step="1">
|
18 |
+
<div class="row">
|
19 |
+
<div class="input-field">
|
20 |
+
<p>Select an external source from which you want to import existing galleries</p>
|
21 |
+
<select class="import-source">
|
22 |
+
<option value=""><?php _e('Choose a source', 'modula-gallery') ?></option>
|
23 |
+
<?php if(class_exists( "Envira_Gallery_Lite" ) || class_exists( "Envira_Gallery" )) : ?>
|
24 |
+
<option>Envira</option>
|
25 |
+
<?php endif ?>
|
26 |
+
<?php if(class_exists( "nggGallery" )) : ?>
|
27 |
+
<option>NextGen</option>
|
28 |
+
<?php endif ?>
|
29 |
+
</select>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
</fieldset>
|
33 |
+
<fieldset data-step="2" data-branch="galleries">
|
34 |
+
<div class="field">
|
35 |
+
<h5><?php _e('List of galleries','modula-gallery')?></h5>
|
36 |
+
<div id="external-galleries">
|
37 |
+
<ul></ul>
|
38 |
+
<button class="waves-effect button-bg green lighten-3 waves-light btn js-select-all">Select all</button>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</fieldset>
|
42 |
+
<fieldset data-step="3" data-save="true">
|
43 |
+
<h5>You are going to import <strong class="galleries-count"></strong> galleries.</h5>
|
44 |
+
</fieldset>
|
45 |
+
|
46 |
+
<footer class="page-footer">
|
47 |
+
<div class="progress loading hide">
|
48 |
+
<div class="indeterminate"></div>
|
49 |
+
</div>
|
50 |
+
|
51 |
+
<a class="waves-effect waves-yellow btn-flat prev"><?php _e('Previous','modula-gallery')?></a>
|
52 |
+
<a class="waves-effect waves-green btn-flat next"><?php _e('Next','modula-gallery')?></a>
|
53 |
+
</footer>
|
54 |
+
|
55 |
+
</form>
|
56 |
+
<div id="success" class="modal">
|
57 |
+
<div class="modal-content">
|
58 |
+
<h4><?php _e('Success!','modula-gallery')?></h4>
|
59 |
+
<p><?php _e('All selected galleries have been imported!','modula-gallery')?></p>
|
60 |
+
<p>Go to the <a href="?page=ModulaLite-admin">dashboard page</a> and copy the shortcode to paste inside your pages and posts</p>
|
61 |
+
</div>
|
62 |
+
<div class="modal-'footer">
|
63 |
+
<a href="?page=ModulaLite-admin" id="modal-close" class="waves-effect waves-green btn-flat modal-action"><?php _e('Close','modula-gallery')?></a>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<div id="error" class="modal">
|
68 |
+
<div class="modal-content">
|
69 |
+
<h4><?php _e('Error!','modula-gallery')?></h4>
|
70 |
+
<p><?php _e('For some reason it was not possible to import one or more galleries','modula-gallery')?></p>
|
71 |
+
</div>
|
72 |
+
<div class="modal-footer">
|
73 |
+
<a href="?page=ModulaLite-admin" class="waves-effect waves-green btn-flat modal-action"><?php _e('Close','modula-gallery')?></a>
|
74 |
+
</div>
|
75 |
+
</div>
|
76 |
+
</div>
|
admin/include/image-list.php
CHANGED
@@ -1,35 +1,13 @@
|
|
1 |
<?php
|
2 |
-
$default_options = get_option('modula_options');
|
3 |
-
$
|
4 |
-
|
5 |
-
function modula_get_image_size_links($id)
|
6 |
-
{
|
7 |
-
$result = array();
|
8 |
-
$sizes = get_intermediate_image_sizes();
|
9 |
-
$sizes[] = 'full';
|
10 |
-
|
11 |
-
foreach ( $sizes as $size )
|
12 |
-
{
|
13 |
-
$image = wp_get_attachment_image_src( $id, $size );
|
14 |
-
|
15 |
-
if ( !empty( $image ) && ( true == $image[3] || 'full' == $size ) )
|
16 |
-
$result["$image[1]x$image[2]"] = $image[0];
|
17 |
-
}
|
18 |
-
|
19 |
-
return $result;
|
20 |
-
}
|
21 |
-
|
22 |
-
foreach($imageResults as $image) {
|
23 |
-
$sizes = modula_get_image_size_links($image->imageId);
|
24 |
$thumb = array_key_exists("150x150", $sizes) ? $sizes["150x150"] : $image->imagePath;
|
25 |
?>
|
26 |
<div class='item card' data-image-id="<?php _e($image->imageId) ?>" data-id="<?php _e($image->Id) ?>">
|
27 |
<input type="hidden" name="filter-list" value="<?php print $image->imageId ?>">
|
28 |
<div class="figure card-image">
|
29 |
<img data-type="image" class="thumb" src="<?php _e($thumb) ?>" />
|
30 |
-
<?php if(in_array($image->imagePath, $sizes)) : ?>
|
31 |
-
<span class='card-title'><?php print array_search($image->imagePath, $sizes) ?></span>
|
32 |
-
<?php endif ?>
|
33 |
<?php
|
34 |
if(!empty($image->filters))
|
35 |
{
|
1 |
<?php
|
2 |
+
$default_options = get_option('modula_options');
|
3 |
+
foreach($imageResults as $image) {
|
4 |
+
$sizes = ModulaLiteTools::get_image_size_links($image->imageId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
$thumb = array_key_exists("150x150", $sizes) ? $sizes["150x150"] : $image->imagePath;
|
6 |
?>
|
7 |
<div class='item card' data-image-id="<?php _e($image->imageId) ?>" data-id="<?php _e($image->Id) ?>">
|
8 |
<input type="hidden" name="filter-list" value="<?php print $image->imageId ?>">
|
9 |
<div class="figure card-image">
|
10 |
<img data-type="image" class="thumb" src="<?php _e($thumb) ?>" />
|
|
|
|
|
|
|
11 |
<?php
|
12 |
if(!empty($image->filters))
|
13 |
{
|
admin/overview.php
CHANGED
@@ -15,11 +15,24 @@
|
|
15 |
|
16 |
<div class="bd">
|
17 |
<?php if(count($galleries) == 0) : ?>
|
18 |
-
<
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
<?php else : ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<div id="gallery-list" class="row">
|
24 |
<?php foreach($galleries as $gallery) : ?>
|
25 |
<?php
|
@@ -42,7 +55,7 @@
|
|
42 |
</div>
|
43 |
<div class="card-action darken-4">
|
44 |
<a href="#" data-tooltip="Show shortcode" data-position="top" data-delay="10" class="tooltipped waves-effect show-shortcode" data-gid="<?php print $gid ?>"><i class="mdi mdi-code-array"></i></a>
|
45 |
-
<a href="?page=edit-modula&galleryId=<?php _e($gid);?>" data-tooltip="Edit gallery" data-position="top" data-delay="10" class="tooltipped waves-effect waves"><i class="mdi mdi-pencil"></i></a>
|
46 |
<a data-tooltip="Clone gallery" data-position="top" data-delay="10" class="tooltipped waves-effect waves clone-gallery" data-gid="<?php print $gid ?>"><i class="mdi mdi-content-copy"></i></a>
|
47 |
|
48 |
<a data-tooltip="Delete gallery" datacolor="red" data-position="top" data-delay="10" class="tooltipped waves-effect waves delete-gallery" data-gid="<?php print $gid ?>"><i class="mdi mdi-delete"></i></a>
|
@@ -105,7 +118,7 @@
|
|
105 |
|
106 |
$(".card .card-content").click(function () {
|
107 |
var id = $(this).parents(".card").data("gid");
|
108 |
-
location.href = "?page=edit-modula&galleryId=" + id;
|
109 |
});
|
110 |
|
111 |
$(".delete-gallery").click(function (e) {
|
@@ -113,8 +126,7 @@
|
|
113 |
galleryId = $(this).data("gid");
|
114 |
galleryName = $(this).parents(".data").find(".card-title").text();
|
115 |
$("#delete-gallery-modal span").text(galleryName);
|
116 |
-
$("#delete-gallery-modal").openModal();
|
117 |
-
|
118 |
});
|
119 |
|
120 |
$(".clone-gallery").click(function (e) {
|
15 |
|
16 |
<div class="bd">
|
17 |
<?php if(count($galleries) == 0) : ?>
|
18 |
+
<div class="row ">
|
19 |
+
<div class="col s12 m6 l4">
|
20 |
+
<div class="card-panel light-green lighten-4">
|
21 |
+
<h5 class="cyan-text text-darken-3"><?php _e('Welcome to Modula Gallery!','modula-gallery')?></h5>
|
22 |
+
<p>
|
23 |
+
<?php _e('Create your first awesome gallery, click','modula-gallery')?> <a href="?page=add-modula-lite"><?php _e('here','modula-gallery')?></a>.
|
24 |
+
</p>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
<?php else : ?>
|
29 |
+
<div class="row">
|
30 |
+
<div class="col s12 m6 l4">
|
31 |
+
<div class="card-panel lime lighten-4">
|
32 |
+
<strong>TIP</strong>: blurry images? Try using a higher <i>Minimum image size</i> value!
|
33 |
+
</div>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
<div id="gallery-list" class="row">
|
37 |
<?php foreach($galleries as $gallery) : ?>
|
38 |
<?php
|
55 |
</div>
|
56 |
<div class="card-action darken-4">
|
57 |
<a href="#" data-tooltip="Show shortcode" data-position="top" data-delay="10" class="tooltipped waves-effect show-shortcode" data-gid="<?php print $gid ?>"><i class="mdi mdi-code-array"></i></a>
|
58 |
+
<a href="?page=edit-modula-lite&galleryId=<?php _e($gid);?>" data-tooltip="Edit gallery" data-position="top" data-delay="10" class="tooltipped waves-effect waves"><i class="mdi mdi-pencil"></i></a>
|
59 |
<a data-tooltip="Clone gallery" data-position="top" data-delay="10" class="tooltipped waves-effect waves clone-gallery" data-gid="<?php print $gid ?>"><i class="mdi mdi-content-copy"></i></a>
|
60 |
|
61 |
<a data-tooltip="Delete gallery" datacolor="red" data-position="top" data-delay="10" class="tooltipped waves-effect waves delete-gallery" data-gid="<?php print $gid ?>"><i class="mdi mdi-delete"></i></a>
|
118 |
|
119 |
$(".card .card-content").click(function () {
|
120 |
var id = $(this).parents(".card").data("gid");
|
121 |
+
location.href = "?page=edit-modula-lite&galleryId=" + id;
|
122 |
});
|
123 |
|
124 |
$(".delete-gallery").click(function (e) {
|
126 |
galleryId = $(this).data("gid");
|
127 |
galleryName = $(this).parents(".data").find(".card-title").text();
|
128 |
$("#delete-gallery-modal span").text(galleryName);
|
129 |
+
$("#delete-gallery-modal").openModal();
|
|
|
130 |
});
|
131 |
|
132 |
$(".clone-gallery").click(function (e) {
|
admin/scripts/modula-admin.js
CHANGED
@@ -2,7 +2,7 @@ var TG = function ($) {
|
|
2 |
var _loading = null;
|
3 |
|
4 |
return {
|
5 |
-
choose_images: function(
|
6 |
tgm_media_frame = wp.media.frames.tgm_media_frame = wp.media({
|
7 |
multiple: true,
|
8 |
library: {
|
@@ -46,11 +46,8 @@ var TG = function ($) {
|
|
46 |
obj.title = attachment[title_field];
|
47 |
if (caption_field != 'none')
|
48 |
obj.description = attachment[caption_field];
|
49 |
-
|
50 |
-
|
51 |
-
obj.imagePath = attachment.sizes[currentImageSize].url
|
52 |
-
else
|
53 |
-
obj.imagePath = attachment.url;
|
54 |
|
55 |
if (attachment.sizes.thumbnail)
|
56 |
obj.thumbnail = attachment.sizes.thumbnail.url;
|
@@ -250,7 +247,7 @@ var TG = function ($) {
|
|
250 |
TG.hide_loading();
|
251 |
}
|
252 |
else
|
253 |
-
location.href = "?page=edit-modula";
|
254 |
}
|
255 |
});
|
256 |
},
|
@@ -352,7 +349,7 @@ var TG = function ($) {
|
|
352 |
|
353 |
$_success.find(".code").val("[Modula id='" + id + "']");
|
354 |
$_success.find(".gallery-name").text(name);
|
355 |
-
$_success.find(".customize").attr("href", "?page=edit-modula&galleryId="+id);
|
356 |
|
357 |
$_success.openModal();
|
358 |
});
|
@@ -568,6 +565,45 @@ var TG = function ($) {
|
|
568 |
}
|
569 |
});
|
570 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
571 |
$(".open-media-panel").on("click", function() {
|
572 |
|
573 |
var currentImageSize = $('.current-image-size').val();
|
@@ -662,7 +698,7 @@ var TG = function ($) {
|
|
662 |
}
|
663 |
}(jQuery);
|
664 |
|
665 |
-
var
|
666 |
|
667 |
var _curPage = 1;
|
668 |
var $_wizard = null;
|
@@ -691,7 +727,7 @@ var TGWizard = function($) {
|
|
691 |
|
692 |
/*! Wizard save */
|
693 |
if ($_wizard.find("fieldset[data-step=" + _curPage + "]").data("save")) {
|
694 |
-
|
695 |
return;
|
696 |
} else {
|
697 |
branch = "images";
|
@@ -779,7 +815,7 @@ var TGWizard = function($) {
|
|
779 |
var size = $_wizard.find("[name=def_imgsize]").val();
|
780 |
var title_field = $("[name=ftg_wp_field_title]").val();
|
781 |
var caption_field = $("[name=ftg_wp_field_caption]").val();
|
782 |
-
TG.choose_images(
|
783 |
var delta = Math.pow(2, 4) + Math.pow(2, 2);
|
784 |
var prev = [];
|
785 |
if($("[name=enc_images]").val())
|
@@ -823,6 +859,7 @@ var TGWizard = function($) {
|
|
823 |
var images = $('[name=enc_images]').val();
|
824 |
var width = $('#width').val();
|
825 |
var height = $('#height').val();
|
|
|
826 |
|
827 |
var data={ action: 'modula_create_gallery',
|
828 |
name: name,
|
@@ -830,6 +867,7 @@ var TGWizard = function($) {
|
|
830 |
images: images,
|
831 |
width: width,
|
832 |
height: height,
|
|
|
833 |
Modula: $('#Modula').val()
|
834 |
};
|
835 |
|
@@ -852,7 +890,7 @@ var TGWizard = function($) {
|
|
852 |
$_success = $('#success');
|
853 |
$_success.find(".code").val("[Modula id='" + id + "']");
|
854 |
$_success.find(".gallery-name").text(name);
|
855 |
-
$_success.find(".customize").attr("href", "?page=edit-modula&galleryId="+id);
|
856 |
|
857 |
$_success.openModal();
|
858 |
}
|
@@ -860,6 +898,134 @@ var TGWizard = function($) {
|
|
860 |
}
|
861 |
}
|
862 |
}(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
863 |
jQuery(function () {
|
864 |
jQuery('.pickColor').wpColorPicker({
|
865 |
change: function(event, ui){},
|
@@ -869,7 +1035,8 @@ jQuery(function () {
|
|
869 |
});
|
870 |
|
871 |
TG.bind();
|
872 |
-
|
|
|
873 |
|
874 |
jQuery("a[href$=modula-gallery-upgrade]").addClass('modula-jump-pro-menu').click(function (e) {
|
875 |
e.preventDefault();
|
2 |
var _loading = null;
|
3 |
|
4 |
return {
|
5 |
+
choose_images: function(title_field, caption_field, callback) {
|
6 |
tgm_media_frame = wp.media.frames.tgm_media_frame = wp.media({
|
7 |
multiple: true,
|
8 |
library: {
|
46 |
obj.title = attachment[title_field];
|
47 |
if (caption_field != 'none')
|
48 |
obj.description = attachment[caption_field];
|
49 |
+
|
50 |
+
obj.imagePath = attachment.url;
|
|
|
|
|
|
|
51 |
|
52 |
if (attachment.sizes.thumbnail)
|
53 |
obj.thumbnail = attachment.sizes.thumbnail.url;
|
247 |
TG.hide_loading();
|
248 |
}
|
249 |
else
|
250 |
+
location.href = "?page=edit-modula-lite";
|
251 |
}
|
252 |
});
|
253 |
},
|
349 |
|
350 |
$_success.find(".code").val("[Modula id='" + id + "']");
|
351 |
$_success.find(".gallery-name").text(name);
|
352 |
+
$_success.find(".customize").attr("href", "?page=edit-modula-lite&galleryId="+id);
|
353 |
|
354 |
$_success.openModal();
|
355 |
});
|
565 |
}
|
566 |
});
|
567 |
|
568 |
+
$(".import-source").on("change", function () {
|
569 |
+
var source = $(this).val();
|
570 |
+
$("#external-galleries ul").empty();
|
571 |
+
|
572 |
+
if(source) {
|
573 |
+
var data = {
|
574 |
+
action : 'modula_get_ext_galleries',
|
575 |
+
source: source,
|
576 |
+
Modula : $('#Modula').val()
|
577 |
+
};
|
578 |
+
|
579 |
+
function fill(list) {
|
580 |
+
var $ul = $("#external-galleries ul");
|
581 |
+
$.each(list, function(i, g) {
|
582 |
+
console.log(g);
|
583 |
+
$ul.append("<li><input class='js-item' type='checkbox' value='"+g.id+"'/> "+ g.title +"</li>");
|
584 |
+
});
|
585 |
+
}
|
586 |
+
TG.show_loading();
|
587 |
+
$.ajax({
|
588 |
+
url: ajaxurl,
|
589 |
+
data: data,
|
590 |
+
dataType: "json",
|
591 |
+
type: "post",
|
592 |
+
error: function(a,b,c) {
|
593 |
+
TG.hide_loading();
|
594 |
+
alert("error loading galleries");
|
595 |
+
},
|
596 |
+
success: function(r) {
|
597 |
+
if(r.success) {
|
598 |
+
TG.hide_loading();
|
599 |
+
|
600 |
+
fill(r.galleries);
|
601 |
+
}
|
602 |
+
}
|
603 |
+
});
|
604 |
+
}
|
605 |
+
});
|
606 |
+
|
607 |
$(".open-media-panel").on("click", function() {
|
608 |
|
609 |
var currentImageSize = $('.current-image-size').val();
|
698 |
}
|
699 |
}(jQuery);
|
700 |
|
701 |
+
var NewGalleryWizard = function($) {
|
702 |
|
703 |
var _curPage = 1;
|
704 |
var $_wizard = null;
|
727 |
|
728 |
/*! Wizard save */
|
729 |
if ($_wizard.find("fieldset[data-step=" + _curPage + "]").data("save")) {
|
730 |
+
NewGalleryWizard.save();
|
731 |
return;
|
732 |
} else {
|
733 |
branch = "images";
|
815 |
var size = $_wizard.find("[name=def_imgsize]").val();
|
816 |
var title_field = $("[name=ftg_wp_field_title]").val();
|
817 |
var caption_field = $("[name=ftg_wp_field_caption]").val();
|
818 |
+
TG.choose_images(title_field, caption_field, function(images) {
|
819 |
var delta = Math.pow(2, 4) + Math.pow(2, 2);
|
820 |
var prev = [];
|
821 |
if($("[name=enc_images]").val())
|
859 |
var images = $('[name=enc_images]').val();
|
860 |
var width = $('#width').val();
|
861 |
var height = $('#height').val();
|
862 |
+
var img_size = $('#img_size').val();
|
863 |
|
864 |
var data={ action: 'modula_create_gallery',
|
865 |
name: name,
|
867 |
images: images,
|
868 |
width: width,
|
869 |
height: height,
|
870 |
+
img_size: img_size,
|
871 |
Modula: $('#Modula').val()
|
872 |
};
|
873 |
|
890 |
$_success = $('#success');
|
891 |
$_success.find(".code").val("[Modula id='" + id + "']");
|
892 |
$_success.find(".gallery-name").text(name);
|
893 |
+
$_success.find(".customize").attr("href", "?page=edit-modula-lite&galleryId="+id);
|
894 |
|
895 |
$_success.openModal();
|
896 |
}
|
898 |
}
|
899 |
}
|
900 |
}(jQuery);
|
901 |
+
var ImportWizard = function($) {
|
902 |
+
|
903 |
+
var _curPage = 1;
|
904 |
+
var $_wizard = null;
|
905 |
+
var _lock = false;
|
906 |
+
|
907 |
+
return {
|
908 |
+
init: function() {
|
909 |
+
$_wizard = $("#modula-wizard");
|
910 |
+
$("#external-galleries .js-select-all").on("click", function () {
|
911 |
+
$("#external-galleries .js-item").each(function () {
|
912 |
+
this.checked = true;
|
913 |
+
});
|
914 |
+
});
|
915 |
+
// $_wizard.find('select').material_select();
|
916 |
+
|
917 |
+
/*! Wizard next */
|
918 |
+
$_wizard.find(".next").click(function() {
|
919 |
+
if ($(this).hasClass("disabled"))
|
920 |
+
return;
|
921 |
+
|
922 |
+
// var branch = $("[name=ftg_source]:checked").val();
|
923 |
+
$(".invalid").removeClass("invalid");
|
924 |
+
|
925 |
+
if (_curPage == 1) {
|
926 |
+
var source = $(".import-source").val();
|
927 |
+
if (source.length == 0) {
|
928 |
+
$(".import-source").addClass("invalid");
|
929 |
+
return false;
|
930 |
+
}
|
931 |
+
}
|
932 |
+
|
933 |
+
if (_curPage == 2) {
|
934 |
+
var count = $("#external-galleries .js-item:checked").length;
|
935 |
+
if(count == 0)
|
936 |
+
return false;
|
937 |
+
|
938 |
+
$_wizard.find(".galleries-count").text(count);
|
939 |
+
}
|
940 |
+
|
941 |
+
/*! Wizard save */
|
942 |
+
if ($_wizard.find("fieldset[data-step=" + _curPage + "]").data("save")) {
|
943 |
+
ImportWizard.import();
|
944 |
+
return;
|
945 |
+
} else {
|
946 |
+
branch = "images";
|
947 |
+
$_wizard.find("fieldset").hide();
|
948 |
+
_curPage++;
|
949 |
+
|
950 |
+
var $fs = $_wizard.find("fieldset[data-step=" + _curPage + "]");
|
951 |
+
$fs.show();
|
952 |
+
|
953 |
+
if ($fs.data("save")) {
|
954 |
+
$('.prev').css("visibility","visible");
|
955 |
+
$(this).text("Proceed");
|
956 |
+
|
957 |
+
} else {
|
958 |
+
$(this).text("Next");
|
959 |
+
}
|
960 |
+
}
|
961 |
+
|
962 |
+
$_wizard.find(".prev").css({
|
963 |
+
visibility: 'visible'
|
964 |
+
});
|
965 |
+
});
|
966 |
+
|
967 |
+
/*! Wizard prev */
|
968 |
+
$_wizard.find(".prev").click(function() {
|
969 |
+
if ($(this).hasClass("disabled"))
|
970 |
+
return;
|
971 |
+
_curPage--;
|
972 |
+
|
973 |
+
var branch = $("[name=ftg_source]:checked").val();
|
974 |
+
|
975 |
+
if (_curPage == 1) {
|
976 |
+
$(this).css({
|
977 |
+
visibility: 'hidden'
|
978 |
+
});
|
979 |
+
}
|
980 |
+
|
981 |
+
$_wizard.find("fieldset").hide();
|
982 |
+
var $fs = $_wizard.find("fieldset[data-step=" + _curPage + "]");
|
983 |
+
if (_curPage == 3) {
|
984 |
+
$fs = $fs.filter("[data-branch=" + branch + "]");
|
985 |
+
}
|
986 |
+
$fs.show();
|
987 |
+
$_wizard.find(".next").css({
|
988 |
+
visibility: 'visible'
|
989 |
+
}).text("Next");
|
990 |
+
});
|
991 |
+
},
|
992 |
+
import: function() {
|
993 |
+
var source = $('.import-source').val();
|
994 |
+
var ids = [];
|
995 |
+
|
996 |
+
$("#external-galleries .js-item:checked").each(function (i, e) {
|
997 |
+
ids.push($(e).val());
|
998 |
+
});
|
999 |
+
|
1000 |
+
var data = {
|
1001 |
+
action : 'modula_do_import_galleries',
|
1002 |
+
source: source,
|
1003 |
+
ids: ids.join(','),
|
1004 |
+
Modula : $('#Modula').val()
|
1005 |
+
};
|
1006 |
+
|
1007 |
+
$_wizard.find("footer a").addClass("disabled");
|
1008 |
+
$_wizard.find(".loading").show();
|
1009 |
+
|
1010 |
+
$.ajax({
|
1011 |
+
url: ajaxurl,
|
1012 |
+
data: data,
|
1013 |
+
dataType: "json",
|
1014 |
+
type: "post",
|
1015 |
+
error: function(a,b,c) {
|
1016 |
+
$("#error").openModal();
|
1017 |
+
},
|
1018 |
+
success: function(r) {
|
1019 |
+
if(r.success) {
|
1020 |
+
$('#success').openModal();
|
1021 |
+
} else {
|
1022 |
+
$("#error").openModal();
|
1023 |
+
}
|
1024 |
+
}
|
1025 |
+
});
|
1026 |
+
}
|
1027 |
+
}
|
1028 |
+
}(jQuery);
|
1029 |
jQuery(function () {
|
1030 |
jQuery('.pickColor').wpColorPicker({
|
1031 |
change: function(event, ui){},
|
1035 |
});
|
1036 |
|
1037 |
TG.bind();
|
1038 |
+
NewGalleryWizard.init();
|
1039 |
+
ImportWizard.init();
|
1040 |
|
1041 |
jQuery("a[href$=modula-gallery-upgrade]").addClass('modula-jump-pro-menu').click(function (e) {
|
1042 |
e.preventDefault();
|
lib/db-class.php
CHANGED
@@ -66,11 +66,24 @@ class ModulaLiteDB {
|
|
66 |
print_r($wpdb->last_error);
|
67 |
return $imageEdited;
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
public function getGalleryById($id) {
|
71 |
global $wpdb;
|
72 |
$gallery = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->ModulaGalleries WHERE Id = %s", $id));
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
}
|
75 |
|
76 |
public function getLastGalleryId()
|
@@ -124,7 +137,7 @@ class ModulaLiteDB {
|
|
124 |
public function editImage($id, $data) {
|
125 |
global $wpdb;
|
126 |
$imageEdited = $wpdb->update( $wpdb->ModulaImages, $data, array( 'Id' => $id ) );
|
127 |
-
//
|
128 |
return $imageEdited;
|
129 |
}
|
130 |
|
66 |
print_r($wpdb->last_error);
|
67 |
return $imageEdited;
|
68 |
}
|
69 |
+
|
70 |
+
public function getIDbyGUID( $guid )
|
71 |
+
{
|
72 |
+
global $wpdb;
|
73 |
+
return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid=%s", $guid ) );
|
74 |
+
}
|
75 |
|
76 |
+
public function getGalleryById($id, $default=null) {
|
77 |
global $wpdb;
|
78 |
$gallery = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->ModulaGalleries WHERE Id = %s", $id));
|
79 |
+
$data = json_decode($gallery->configuration);
|
80 |
+
if($default)
|
81 |
+
foreach ( $default as $k => $v )
|
82 |
+
if(! isset($data->$k))
|
83 |
+
$data->$k = $v;
|
84 |
+
|
85 |
+
$data->id = $id;
|
86 |
+
return $data;
|
87 |
}
|
88 |
|
89 |
public function getLastGalleryId()
|
137 |
public function editImage($id, $data) {
|
138 |
global $wpdb;
|
139 |
$imageEdited = $wpdb->update( $wpdb->ModulaImages, $data, array( 'Id' => $id ) );
|
140 |
+
//print $wpdb->last_query;
|
141 |
return $imageEdited;
|
142 |
}
|
143 |
|
lib/gallery-class.php
CHANGED
@@ -3,21 +3,30 @@
|
|
3 |
define("MODULA_DB_MODE", 1);
|
4 |
define("MODULA_WP_MODE", 2);
|
5 |
|
6 |
-
if (!class_exists("
|
7 |
-
class
|
8 |
-
|
9 |
-
|
|
|
|
|
10 |
{
|
11 |
$this->gallery = new stdClass();
|
12 |
$this->db = $db;
|
13 |
$this->wp_images = array();
|
14 |
$this->images = array();
|
|
|
|
|
|
|
15 |
}
|
16 |
|
17 |
-
public function
|
18 |
{
|
19 |
-
$this->id = $id;
|
20 |
$this->gallery = $this->db->getGalleryById($this->id);
|
|
|
|
|
|
|
|
|
|
|
21 |
$this->gallery->mode = MODULA_DB_MODE;
|
22 |
|
23 |
if(! empty($_GET["debug"]))
|
@@ -28,14 +37,26 @@ if (!class_exists("ModulaFE")) {
|
|
28 |
print_r($this->gallery);
|
29 |
print "\n-->\n";
|
30 |
}
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
$this->images = $this->loadModulaImages();
|
33 |
|
34 |
$ids = array();
|
|
|
35 |
foreach($this->images as $img)
|
36 |
-
$ids[] = $img->imageId;
|
37 |
-
|
38 |
-
if(count($this->images) > 0)
|
39 |
$this->loadWPImages($ids);
|
40 |
}
|
41 |
|
@@ -64,6 +85,7 @@ if (!class_exists("ModulaFE")) {
|
|
64 |
|
65 |
//$this->images[$att->ID]->imagePath = $att->guid;
|
66 |
$this->images[$att->ID]->url = $att->url;
|
|
|
67 |
}
|
68 |
}
|
69 |
}
|
@@ -260,10 +282,9 @@ if (!class_exists("ModulaFE")) {
|
|
260 |
$html .= "<div class='modula' id='jtg-$this->id$rid'>\n";
|
261 |
|
262 |
$html .= "<div class='items'>\n";
|
|
|
263 |
foreach(array_slice($this->images, 0, 40/2) as $image)
|
264 |
-
{
|
265 |
-
$imgUrl = WP_PLUGIN_URL . '/modula/img.php?id=' . $image->imageId;
|
266 |
-
|
267 |
$title = in_array($this->gallery->lightbox, array('prettyphoto', 'fancybox', 'swipebox', 'lightbox2')) ? "title" : "data-title";
|
268 |
$rel = $this->gallery->lightbox == "prettyphoto" ? "prettyPhoto[jtg-$this->id$rid]" : "jtg-$this->id$rid";
|
269 |
|
@@ -278,9 +299,11 @@ if (!class_exists("ModulaFE")) {
|
|
278 |
|
279 |
$hasTitle = empty($image->title) ? 'notitle' : '';
|
280 |
|
|
|
|
|
281 |
$html .= "\t<div class=\"item " . $hasTitle . " effect-". $hoverEffect->code ."\">\n";
|
282 |
$html .= "<a $title='$image->description' ". ($this->gallery->lightbox == "lightbox2" ? "data-lightbox='gallery'" : "") ." rel='$rel' " . $this->getTarget($image) . " class='tile-inner " . ($this->getLightboxClass($image)) . "' " . $this->getLink($image) . ">\n";
|
283 |
-
$html .= "\t\t<img data-valign='$image->valign' data-halign='$image->halign' class='pic' src='$
|
284 |
$html .= "\t\t<div class=\"figc\">\n";
|
285 |
$html .= "\t\t\t<div class=\"figc-inner\">\n";
|
286 |
if($this->gallery->hoverEffect != 'none' && ! empty($image->title))
|
@@ -311,7 +334,8 @@ if (!class_exists("ModulaFE")) {
|
|
311 |
{
|
312 |
$html .= "\t\tonComplete: function () { " . stripslashes($this->gallery->script) . "},\n";
|
313 |
}
|
314 |
-
|
|
|
315 |
$html .= "\t\tmargin: ". $this->gallery->margin .",\n";
|
316 |
// $html .= "\t\tkeepArea: " . ($this->gallery->keepArea == "T" ? "true" : "false") . ",\n";
|
317 |
$html .= "\t\tenableTwitter: " . ($this->gallery->enableTwitter == "T" ? "true" : "false") . ",\n";
|
@@ -341,8 +365,9 @@ if (!class_exists("ModulaFE")) {
|
|
341 |
public function loadModulaImages()
|
342 |
{
|
343 |
$images = array();
|
|
|
344 |
foreach($this->db->getImagesByGalleryId($this->id) as $img)
|
345 |
-
$images[$img->imageId] = $img;
|
346 |
|
347 |
return $images;
|
348 |
}
|
3 |
define("MODULA_DB_MODE", 1);
|
4 |
define("MODULA_WP_MODE", 2);
|
5 |
|
6 |
+
if (!class_exists( "ModulaLiteFE" )) {
|
7 |
+
class ModulaLiteFE {
|
8 |
+
|
9 |
+
private $defaultValues;
|
10 |
+
|
11 |
+
public function __construct($db, $id, $defaultValues)
|
12 |
{
|
13 |
$this->gallery = new stdClass();
|
14 |
$this->db = $db;
|
15 |
$this->wp_images = array();
|
16 |
$this->images = array();
|
17 |
+
$this->id = $id;
|
18 |
+
$this->defaultValues = $defaultValues;
|
19 |
+
$this->init();
|
20 |
}
|
21 |
|
22 |
+
public function init()
|
23 |
{
|
|
|
24 |
$this->gallery = $this->db->getGalleryById($this->id);
|
25 |
+
foreach ( $this->defaultValues as $k => $v ) {
|
26 |
+
if(! isset($this->gallery->$k))
|
27 |
+
$this->gallery->$k = $v;
|
28 |
+
}
|
29 |
+
|
30 |
$this->gallery->mode = MODULA_DB_MODE;
|
31 |
|
32 |
if(! empty($_GET["debug"]))
|
37 |
print_r($this->gallery);
|
38 |
print "\n-->\n";
|
39 |
}
|
40 |
+
|
41 |
+
if(! $this->gallery->hasResizedImages) {
|
42 |
+
|
43 |
+
$images = $this->db->getImagesByGalleryId( $this->id );
|
44 |
+
$images = ModulaLiteTools::check_and_resize( $images, $this->gallery->img_size );
|
45 |
+
foreach($images as $img) {
|
46 |
+
$this->db->editImage( $img->Id, (array)$img );
|
47 |
+
}
|
48 |
+
$this->gallery->hasResizedImages = true;
|
49 |
+
$this->db->editGallery($this->id, (array)$this->gallery);
|
50 |
+
}
|
51 |
+
|
52 |
$this->images = $this->loadModulaImages();
|
53 |
|
54 |
$ids = array();
|
55 |
+
$idx = 0;
|
56 |
foreach($this->images as $img)
|
57 |
+
$ids[] = $img->imageId < 0 ? $img->imageId - ($idx++) : $img->imageId;
|
58 |
+
|
59 |
+
if(count($this->images) > 0 && $this->gallery->importedFrom != 'NextGen')
|
60 |
$this->loadWPImages($ids);
|
61 |
}
|
62 |
|
85 |
|
86 |
//$this->images[$att->ID]->imagePath = $att->guid;
|
87 |
$this->images[$att->ID]->url = $att->url;
|
88 |
+
$this->images[$att->ID]->alt = get_post_meta( $att->ID, '_wp_attachment_image_alt', true );
|
89 |
}
|
90 |
}
|
91 |
}
|
282 |
$html .= "<div class='modula' id='jtg-$this->id$rid'>\n";
|
283 |
|
284 |
$html .= "<div class='items'>\n";
|
285 |
+
|
286 |
foreach(array_slice($this->images, 0, 40/2) as $image)
|
287 |
+
{
|
|
|
|
|
288 |
$title = in_array($this->gallery->lightbox, array('prettyphoto', 'fancybox', 'swipebox', 'lightbox2')) ? "title" : "data-title";
|
289 |
$rel = $this->gallery->lightbox == "prettyphoto" ? "prettyPhoto[jtg-$this->id$rid]" : "jtg-$this->id$rid";
|
290 |
|
299 |
|
300 |
$hasTitle = empty($image->title) ? 'notitle' : '';
|
301 |
|
302 |
+
$imgUrl = str_replace(get_site_url(), '', $image->imagePath);
|
303 |
+
|
304 |
$html .= "\t<div class=\"item " . $hasTitle . " effect-". $hoverEffect->code ."\">\n";
|
305 |
$html .= "<a $title='$image->description' ". ($this->gallery->lightbox == "lightbox2" ? "data-lightbox='gallery'" : "") ." rel='$rel' " . $this->getTarget($image) . " class='tile-inner " . ($this->getLightboxClass($image)) . "' " . $this->getLink($image) . ">\n";
|
306 |
+
$html .= "\t\t<img data-valign='$image->valign' alt='$image->alt' data-halign='$image->halign' class='pic' src='$imgUrl' data-src='$imgUrl' />\n";
|
307 |
$html .= "\t\t<div class=\"figc\">\n";
|
308 |
$html .= "\t\t\t<div class=\"figc-inner\">\n";
|
309 |
if($this->gallery->hoverEffect != 'none' && ! empty($image->title))
|
334 |
{
|
335 |
$html .= "\t\tonComplete: function () { " . stripslashes($this->gallery->script) . "},\n";
|
336 |
}
|
337 |
+
|
338 |
+
$html .= "\t\tresizer: '". plugins_url('modula-best-grid-gallery/image.php', '') ."',\n";
|
339 |
$html .= "\t\tmargin: ". $this->gallery->margin .",\n";
|
340 |
// $html .= "\t\tkeepArea: " . ($this->gallery->keepArea == "T" ? "true" : "false") . ",\n";
|
341 |
$html .= "\t\tenableTwitter: " . ($this->gallery->enableTwitter == "T" ? "true" : "false") . ",\n";
|
365 |
public function loadModulaImages()
|
366 |
{
|
367 |
$images = array();
|
368 |
+
$idx = 0;
|
369 |
foreach($this->db->getImagesByGalleryId($this->id) as $img)
|
370 |
+
$images[$img->imageId < 0 ? $img->imageId - ($idx++) : $img->imageId] = $img;
|
371 |
|
372 |
return $images;
|
373 |
}
|
scripts/jquery.modula.js
CHANGED
@@ -16,6 +16,7 @@ function tg_getURLParameter(name) {
|
|
16 |
// Create the defaults once
|
17 |
var pluginName = 'modulaGallery',
|
18 |
defaults = {
|
|
|
19 |
margin: 10,
|
20 |
keepArea: true,
|
21 |
enableTwitter: false,
|
@@ -251,7 +252,10 @@ function tg_getURLParameter(name) {
|
|
251 |
if (index + 1 < instance.$items.length)
|
252 |
instance.loadImage(index + 1);
|
253 |
}
|
254 |
-
|
|
|
|
|
|
|
255 |
}
|
256 |
|
257 |
Plugin.prototype.setupFilters = function () {
|
@@ -310,6 +314,7 @@ function tg_getURLParameter(name) {
|
|
310 |
});
|
311 |
|
312 |
this.$items.addClass("tile");
|
|
|
313 |
|
314 |
if (this.options.width) {
|
315 |
this.$itemsCnt.width(this.options.width);
|
16 |
// Create the defaults once
|
17 |
var pluginName = 'modulaGallery',
|
18 |
defaults = {
|
19 |
+
resizer: '/',
|
20 |
margin: 10,
|
21 |
keepArea: true,
|
22 |
enableTwitter: false,
|
252 |
if (index + 1 < instance.$items.length)
|
253 |
instance.loadImage(index + 1);
|
254 |
}
|
255 |
+
|
256 |
+
var original_src = source.data('src');
|
257 |
+
img.src = original_src;
|
258 |
+
source.attr("src", original_src);
|
259 |
}
|
260 |
|
261 |
Plugin.prototype.setupFilters = function () {
|
314 |
});
|
315 |
|
316 |
this.$items.addClass("tile");
|
317 |
+
this.$items.find(".pic").removeAttr("src");
|
318 |
|
319 |
if (this.options.width) {
|
320 |
this.$itemsCnt.width(this.options.width);
|