NextCellent Gallery – NextGEN Legacy - Version 1.9.21

Version Description

  • 14/09/2014 =

What's in it for you?

  • The uploader did not use the quality set in the options. Now it does (credits to Niko Strijbol)
  • Fix: When a gallery is deleted, the ID is removed from albums. (credits to Niko Strijbol)
  • Small changes readme.txt to look better (Matthew's Random Stuff)
  • Support for the ngg_styles folder (introduced in NextGEN 2.x), solving issues with updates (credits to Niko Strijbol)

VERY IMPORTANT: Read ON!

NextCellent Gallery provides backward compatibility for older NextGEN until version 1.9.13 .

  • this plugin will gracefully deactivate if detects NextGEN is working (any version) to avoid compatibility issues.

  • Please remember to READ THE FAQ!!! Issues for failing to read the FAQ will be IGNORED!!!

  • If you like it, please spread the word and rate it accordingly. I guess a lot of annoyed users can take advantage of NextCellent. Thank you!

  • WE APPRECIATE YOUR FEEDBACK. Be our voice and comment it!!!!

Download this release

Release Info

Developer WPReady
Plugin Icon NextCellent Gallery – NextGEN Legacy
Version 1.9.21
Comparing to
See all releases

Code changes from version 1.9.20 to 1.9.21

admin/about.php CHANGED
@@ -24,6 +24,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
24
  <li><a href="http://wpgetready.com/" target="_blank">WPGetReady</a> <?php _e('for maintaining this fork of NextGen Gallery', 'nggallery') ;?></li>
25
  <li><?php _e('The original translators for NextGen Gallery, who made the translations', 'nggallery') ;?></li>
26
  </ul>
 
27
  </div>
28
  </div>
29
  <div class="postbox">
24
  <li><a href="http://wpgetready.com/" target="_blank">WPGetReady</a> <?php _e('for maintaining this fork of NextGen Gallery', 'nggallery') ;?></li>
25
  <li><?php _e('The original translators for NextGen Gallery, who made the translations', 'nggallery') ;?></li>
26
  </ul>
27
+ <div>Icons made by <a href="http://www.freepik.com" alt="Freepik.com" title="Freepik.com">Freepik</a> from i.a. <a href="http://www.flaticon.com/packs/layout-icons" title="Flaticon">www.flaticon.com</a></div>
28
  </div>
29
  </div>
30
  <div class="postbox">
admin/addgallery.php CHANGED
@@ -179,7 +179,7 @@ class nggAddGallery {
179
  resize: {
180
  width: <?php echo esc_js( $ngg->options['imgWidth'] ); ?>,
181
  height: <?php echo esc_js( $ngg->options['imgHeight'] ); ?>,
182
- quality: 100
183
  },
184
  <?php } ?>
185
  debug: false,
179
  resize: {
180
  width: <?php echo esc_js( $ngg->options['imgWidth'] ); ?>,
181
  height: <?php echo esc_js( $ngg->options['imgHeight'] ); ?>,
182
+ quality: <?php echo esc_js( $ngg->options['imgQuality'] ); ?>
183
  },
184
  <?php } ?>
185
  debug: false,
admin/images/caption.svg ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
6
+ <g>
7
+ <path d="M7.5,7.5v25.366h35V7.5H7.5z M40.379,30.745H9.621V9.621h30.758V30.745z"/>
8
+ <rect x="7.5" y="35.783" width="35" height="6.717"/>
9
+ </g>
10
+ </svg>
admin/images/carousel.svg ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
6
+ <g>
7
+ <path d="M7.5,7.5v25.366h35V7.5H7.5z M40.379,30.745H9.621V9.621h30.758V30.745z"/>
8
+ <rect x="7.5" y="35.783" width="9.545" height="6.717"/>
9
+ <rect x="32.955" y="35.783" width="9.545" height="6.717"/>
10
+ <rect x="20.227" y="35.783" width="9.547" height="6.717"/>
11
+ </g>
12
+ </svg>
admin/images/compact.svg ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
6
+ <g>
7
+ <path d="M7.5,7.5v35h35v-35H7.5z M40.5,40.5h-31v-31h31V40.5z"/>
8
+ <rect x="21.5" y="12" width="7" height="7"/>
9
+ <rect x="21.5" y="21.5" width="7" height="7"/>
10
+ <rect x="21.5" y="31" width="7" height="7"/>
11
+ <rect x="12" y="12" width="7" height="7"/>
12
+ <rect x="12" y="21.5" width="7" height="7"/>
13
+ <rect x="12" y="31" width="7" height="7"/>
14
+ <rect x="31" y="12" width="7" height="7"/>
15
+ <rect x="31" y="21.5" width="7" height="7"/>
16
+ <rect x="31" y="31" width="7" height="7"/>
17
+ </g>
18
+ </svg>
admin/images/extend.svg ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
6
+ <g>
7
+ <rect x="7.5" y="7.5" width="15.909" height="35"/>
8
+ <rect x="26.591" y="7.5" width="15.909" height="2"/>
9
+ <rect x="26.591" y="12.214" width="15.909" height="2"/>
10
+ <rect x="26.591" y="21.644" width="15.909" height="2"/>
11
+ <rect x="26.591" y="26.356" width="15.909" height="2"/>
12
+ <rect x="26.591" y="35.786" width="15.909" height="2"/>
13
+ <rect x="26.591" y="40.5" width="15.909" height="2"/>
14
+ </g>
15
+ </svg>
admin/images/gallery.svg ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
6
+ <g>
7
+ <path d="M7.5,7.5v35h35v-35H7.5z M40.5,40.5h-31v-31h31V40.5z"/>
8
+ <rect x="21.5" y="12" width="7" height="7"/>
9
+ <rect x="21.5" y="21.5" width="7" height="7"/>
10
+ <rect x="21.5" y="31" width="7" height="7"/>
11
+ <rect x="12" y="12" width="7" height="7"/>
12
+ <rect x="12" y="21.5" width="7" height="7"/>
13
+ <rect x="12" y="31" width="7" height="7"/>
14
+ <rect x="31" y="12" width="7" height="7"/>
15
+ <rect x="31" y="21.5" width="7" height="7"/>
16
+ <rect x="31" y="31" width="7" height="7"/>
17
+ </g>
18
+ </svg>
admin/images/imagebrowser.svg ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
6
+ <g>
7
+ <rect x="7.5" y="7.5" width="16" height="16"/>
8
+ <rect x="26.5" y="7.5" width="16" height="16"/>
9
+ <rect x="7.5" y="26.5" width="16" height="16"/>
10
+ <rect x="26.5" y="26.5" width="16" height="16"/>
11
+ </g>
12
+ </svg>
admin/images/other.svg ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="26px" height="26px" viewBox="0 0 26 26" enable-background="new 0 0 26 26" xml:space="preserve">
6
+ <g>
7
+ <path d="M23.008,12.789l-2.37-2.371l-5.146,5.145l-1.38,4.164l4.124-1.419l5.145-5.146L23.008,12.789L23.008,12.789z
8
+ M14.928,18.901l0.762-2.433l1.647,1.649L14.928,18.901z"/>
9
+ <path d="M24.806,11.45l-2.455-2.458c-0.081-0.079-0.209-0.079-0.288,0l-0.979,0.98c-0.079,0.08-0.079,0.207,0,0.287l2.457,2.457
10
+ c0.079,0.079,0.208,0.078,0.287,0l0.978-0.98C24.885,11.657,24.885,11.529,24.806,11.45z"/>
11
+ <path d="M5.205,15.967V7.686h12.648v3.702l1.152-1.152v-3.64c0-0.169-0.137-0.307-0.309-0.307H4.105
12
+ c-0.171,0-0.309,0.138-0.309,0.307v12.628c0,0.169,0.138,0.307,0.309,0.307h9.161l1.183-3.564H5.205z"/>
13
+ <path d="M9.164,13.787C6.952,9.35,5.48,14.973,5.48,14.973h3.292h0.908h4.766C11.894,8.311,9.956,11.728,9.164,13.787z"/>
14
+ <circle cx="14.717" cy="9.578" r="1.243"/>
15
+ </g>
16
+ </svg>
admin/images/slideshow.svg ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="50px" height="50px" viewBox="0 0 50 50" enable-background="new 0 0 50 50" xml:space="preserve">
6
+ <path d="M7.5,7.5v35h35v-35H7.5z M40.5,40.5h-31v-31h31V40.5z"/>
7
+ </svg>
admin/style.php CHANGED
@@ -5,11 +5,18 @@ function nggallery_admin_style() {
5
 
6
  global $ngg;
7
 
8
- if ( $theme_css_exists = file_exists (TEMPLATEPATH . "/nggallery.css") ) {
 
 
 
 
 
 
 
 
 
 
9
 
10
- $real_file = TEMPLATEPATH . "/nggallery.css";
11
- $file_show = 'nggallery.css ' . __('(From the theme folder)','nggallery');
12
-
13
  } else {
14
 
15
  if (isset($_POST['css'])) {
@@ -33,6 +40,7 @@ if ( $theme_css_exists = file_exists (TEMPLATEPATH . "/nggallery.css") ) {
33
 
34
  // set the path
35
  $real_file = NGGALLERY_ABSPATH . "css/" . $act_cssfile;
 
36
  }
37
 
38
  if (isset($_POST['updatecss'])) {
@@ -86,7 +94,9 @@ if (!$error && filesize($real_file) > 0) {
86
  <div class="bordertitle">
87
  <?php screen_icon( 'nextgen-gallery' ); ?>
88
  <h2><?php _e('Style Editor','nggallery') ?></h2>
 
89
  <?php if (!$theme_css_exists) : ?>
 
90
  <form id="themeselector" name="cssfiles" method="post">
91
  <?php wp_nonce_field('ngg_style') ?>
92
  <strong><?php _e('Activate and use style sheet:','nggallery') ?></strong>
@@ -111,21 +121,21 @@ if (!$error && filesize($real_file) > 0) {
111
  </select>
112
  <input class="button" type="submit" name="activate" value="<?php _e('Activate','nggallery') ?> &raquo;" class="button" />
113
  </form>
 
114
  <?php endif; ?>
115
- </div>
116
- <br style="clear: both;"/>
117
-
118
  <?php if (!is_multisite() || is_super_admin() ) { ?>
119
- <div class="tablenav">
120
  <?php
121
  if ( is_writeable($real_file) ) {
122
- echo '<big>' . sprintf(__('Editing <strong>%s</strong>','nggallery'), $file_show) . '</big>';
123
  } else {
124
- echo '<big>' . sprintf(__('Browsing <strong>%s</strong>','nggallery'), $file_show) . '</big>';
125
  }
126
  ?>
127
  </div>
128
- <br style="clear: both;"/>
 
129
 
130
  <div id="templateside">
131
  <?php if (!$theme_css_exists) : ?>
@@ -134,11 +144,16 @@ if (!$error && filesize($real_file) > 0) {
134
  <li><strong><?php _e('Version','nggallery') ?> :</strong> <?php echo $act_css_version ?></li>
135
  <li><strong><?php _e('Description','nggallery') ?> :<br /></strong> <?php echo $act_css_description ?></li>
136
  </ul>
137
- <p><?php _e('Tip: Copy your stylesheet (nggallery.css) to your theme folder, so it will be not lost during a upgrade','nggallery') ?></p>
 
 
 
 
138
  <?php else: ?>
139
- <p><?php _e('Your theme contain a NextCellent Gallery stylesheet (nggallery.css), this file will be used','nggallery') ?></p>
 
140
  <?php endif; ?>
141
- <p><?php _e('Tip No. 2: Use the color picker below to help you find the right color scheme for your gallery!','nggallery') ?></p>
142
  <div id="colorSelector">
143
  <div></div>
144
  </div>
5
 
6
  global $ngg;
7
 
8
+ if ($theme_css_exists = file_exists (WP_CONTENT_DIR . "/ngg_styles/nggallery.css") ) {
9
+
10
+ $real_file = WP_CONTENT_DIR . "/ngg_styles/nggallery.css";
11
+ $file_show = 'nggallery.css ' . __('(from the ngg_styles folder)','nggallery');
12
+ $theme_css_safe = true;
13
+
14
+ } elseif ( $theme_css_exists = file_exists (get_stylesheet_directory() . "/nggallery.css") ) {
15
+
16
+ $real_file = get_stylesheet_directory() . "/nggallery.css";
17
+ $file_show = 'nggallery.css ' . __('(from the theme folder)','nggallery');
18
+ $theme_css_safe = false;
19
 
 
 
 
20
  } else {
21
 
22
  if (isset($_POST['css'])) {
40
 
41
  // set the path
42
  $real_file = NGGALLERY_ABSPATH . "css/" . $act_cssfile;
43
+ $theme_css_safe = false;
44
  }
45
 
46
  if (isset($_POST['updatecss'])) {
94
  <div class="bordertitle">
95
  <?php screen_icon( 'nextgen-gallery' ); ?>
96
  <h2><?php _e('Style Editor','nggallery') ?></h2>
97
+ <div class="fileedit-sub">
98
  <?php if (!$theme_css_exists) : ?>
99
+ <div class="alignright">
100
  <form id="themeselector" name="cssfiles" method="post">
101
  <?php wp_nonce_field('ngg_style') ?>
102
  <strong><?php _e('Activate and use style sheet:','nggallery') ?></strong>
121
  </select>
122
  <input class="button" type="submit" name="activate" value="<?php _e('Activate','nggallery') ?> &raquo;" class="button" />
123
  </form>
124
+ </div>
125
  <?php endif; ?>
126
+
 
 
127
  <?php if (!is_multisite() || is_super_admin() ) { ?>
128
+ <div class="alignleft">
129
  <?php
130
  if ( is_writeable($real_file) ) {
131
+ echo '<h3>' . sprintf(__('Editing %s','nggallery'), $file_show) . '</h3>';
132
  } else {
133
+ echo '<h3>' . sprintf(__('Browsing %s','nggallery'), $file_show) . '</h3>';
134
  }
135
  ?>
136
  </div>
137
+ <br class="clear" />
138
+ </div> <!-- fileedit-sub -->
139
 
140
  <div id="templateside">
141
  <?php if (!$theme_css_exists) : ?>
144
  <li><strong><?php _e('Version','nggallery') ?> :</strong> <?php echo $act_css_version ?></li>
145
  <li><strong><?php _e('Description','nggallery') ?> :<br /></strong> <?php echo $act_css_description ?></li>
146
  </ul>
147
+ <?php endif; ?>
148
+ <?php if (!$theme_css_safe) : ?>
149
+ <p><?php _e('If you do not want to lose your edits during an update, copy your css file (nggalery.css) to the "/wp-content/ngg_styles" folder.','nggallery') ?></p>
150
+ <p><?php _e('Your current file is located here:','nggallery') ?></p>
151
+ <p class="description"><?php echo $real_file; ?></p>
152
  <?php else: ?>
153
+ <p><?php _e('There is a NextCellent theme file, this file will be used. It\'s located in:','nggallery') ?></p>
154
+ <p class="description"><?php echo $real_file; ?></p>
155
  <?php endif; ?>
156
+ <p><?php _e('Tip 2: use the color picker below to help you find the right color scheme for your gallery!','nggallery') ?></p>
157
  <div id="colorSelector">
158
  <div></div>
159
  </div>
admin/tinymce/editor_plugin.js CHANGED
@@ -16,13 +16,18 @@
16
  // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
17
 
18
  ed.addCommand('mceNextGEN', function() {
 
 
 
 
19
  ed.windowManager.open({
20
  // call content via admin-ajax, no need to know the full plugin path
21
- url : ajaxurl + '?action=ngg_tinymce',
22
- width : 360 + ed.getLang('NextGEN.delta_width', 0),
23
- height : 210 + ed.getLang('NextGEN.delta_height', 0),
24
  inline : 1
25
  }, {
 
26
  plugin_url : url // Plugin absolute URL
27
  });
28
  });
@@ -32,13 +37,7 @@
32
  title : 'NextCellent',
33
  cmd : 'mceNextGEN',
34
  image : url + '/nextgen.gif',
35
- stateSelector: 'img'
36
  });
37
-
38
- // Add a node change handler, selects the button in the UI when a image is selected
39
- //ed.onNodeChange.add(function(ed, cm, n) {
40
- // cm.setActive('NextGEN', n.nodeName == 'IMG');
41
- //});
42
  },
43
 
44
  /**
@@ -63,11 +62,11 @@
63
  */
64
  getInfo : function() {
65
  return {
66
- longname : 'NextGEN',
67
- author : 'Photocrati',
68
- authorurl : 'http://www.photocrati.com/',
69
- infourl : 'http://www.nextgen-gallery.com/',
70
- version : "2.0"
71
  };
72
  }
73
  });
16
  // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
17
 
18
  ed.addCommand('mceNextGEN', function() {
19
+ vp = tinymce.DOM.getViewPort();
20
+ H = vp.h-150; //580 < (vp.h - 70) ? 580 : vp.h - 70;
21
+ W = vp.w-200; //650 < vp.w ? 650 : vp.w;
22
+
23
  ed.windowManager.open({
24
  // call content via admin-ajax, no need to know the full plugin path
25
+ file : ajaxurl + '?action=ngg_tinymce',
26
+ width : W + 'px',
27
+ height : H + 'px',
28
  inline : 1
29
  }, {
30
+ ajax_url: ajaxurl, //wp ajaxurl
31
  plugin_url : url // Plugin absolute URL
32
  });
33
  });
37
  title : 'NextCellent',
38
  cmd : 'mceNextGEN',
39
  image : url + '/nextgen.gif',
 
40
  });
 
 
 
 
 
41
  },
42
 
43
  /**
62
  */
63
  getInfo : function() {
64
  return {
65
+ longname : 'NextCellent',
66
+ author : '',
67
+ authorurl : '',
68
+ infourl : '',
69
+ version : "1.9.21"
70
  };
71
  }
72
  });
admin/tinymce/tinymce.js CHANGED
@@ -22,54 +22,122 @@ function getCheckedValue(radioObj) {
22
  function insertNGGLink() {
23
 
24
  var tagtext;
25
-
26
- var gallery = document.getElementById('gallery_panel');
27
- var album = document.getElementById('album_panel');
28
- var singlepic = document.getElementById('singlepic_panel');
29
 
30
  // who is active ?
31
- if (gallery.className.indexOf('current') != -1) {
 
 
32
  var galleryid = document.getElementById('gallerytag').value;
33
  var showtype = getCheckedValue(document.getElementsByName('showtype'));
34
- if (galleryid != 0 )
35
- tagtext = "["+ showtype + " id=" + galleryid + "]";
36
- else
37
- tinyMCEPopup.close();
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- if (album.className.indexOf('current') != -1) {
41
  var albumid = document.getElementById('albumtag').value;
42
  var showtype = getCheckedValue(document.getElementsByName('albumtype'));
43
- if (albumid != 0 )
44
- tagtext = "[nggalbum id=" + albumid + " template=" + showtype + "]";
45
- else
46
- tinyMCEPopup.close();
47
- }
48
 
49
- if (singlepic.className.indexOf('current') != -1) {
 
 
 
 
 
 
 
 
50
  var singlepicid = document.getElementById('singlepictag').value;
51
  var imgWidth = document.getElementById('imgWidth').value;
52
  var imgHeight = document.getElementById('imgHeight').value;
53
  var imgeffect = document.getElementById('imgeffect').value;
54
  var imgfloat = document.getElementById('imgfloat').value;
 
 
55
 
56
- if (singlepicid != 0 ) {
57
- if (imgeffect == "none")
58
- tagtext = "[singlepic id=" + singlepicid + " w=" + imgWidth + " h=" + imgHeight + " float=" + imgfloat + "]";
59
- else
60
- tagtext = "[singlepic id=" + singlepicid + " w=" + imgWidth + " h=" + imgHeight + " mode=" + imgeffect + " float=" + imgfloat + "]";
 
 
 
 
 
 
 
 
61
  } else {
62
- tinyMCEPopup.close();
63
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
  if(window.tinyMCE) {
67
- tinyMCEPopup.editor.execCommand('mceInsertContent', false, tagtext);
68
- //window.tinyMCE.execInstanceCommand(window.tinyMCE.activeEditor.id, 'mceInsertContent', false, tagtext);
69
- //Peforms a clean up of the current editor HTML.
70
- //tinyMCEPopup.editor.execCommand('mceCleanup');
71
- //Repaints the editor. Sometimes the browser has graphic glitches.
72
- tinyMCEPopup.editor.execCommand('mceRepaint');
73
  tinyMCEPopup.close();
74
  }
75
  return;
22
  function insertNGGLink() {
23
 
24
  var tagtext;
25
+ var selected = document.getElementsByClassName('current')[0];
26
+ var panel = selected.id;
 
 
27
 
28
  // who is active ?
29
+ switch(panel) {
30
+ case 'gallery_panel' :
31
+
32
  var galleryid = document.getElementById('gallerytag').value;
33
  var showtype = getCheckedValue(document.getElementsByName('showtype'));
34
+ var images = document.getElementById('nggallery-images').value;
35
+ var width = document.getElementById('slide-width').value;
36
+ var height = document.getElementById('slide-height').value;
37
+ var otherName = document.getElementById('other-name').value;
38
+
39
+ switch(showtype) {
40
+ case 'nggallery':
41
+ if (images) {
42
+ tagtext = "[nggallery id=" + galleryid + " images=" + images + "]";
43
+ } else {
44
+ tagtext = "[nggallery id=" + galleryid + "]";
45
+ }
46
+ break;
47
+ case 'slideshow':
48
+ tagtext = "[slideshow id=" + galleryid;
49
+ if (width)
50
+ tagtext += " w=" + width;
51
+ if (height)
52
+ tagtext += " h=" + height;
53
+ tagtext += "]";
54
+ break;
55
+ case 'imagebrowser':
56
+ tagtext = "["+ showtype + " id=" + galleryid + "]";
57
+ break;
58
+ case 'other':
59
+ tagtext = "[nggallery id=" + galleryid + " template="+ otherName + "]";
60
+ default:
61
+ tagtext = "[nggallery id=" + galleryid + " template="+ showtype + "]";
62
+ }
63
+ break;
64
+ case 'album_panel':
65
 
 
66
  var albumid = document.getElementById('albumtag').value;
67
  var showtype = getCheckedValue(document.getElementsByName('albumtype'));
68
+ var albumshowtype = getCheckedValue(document.getElementsByName('album-showtype'));
 
 
 
 
69
 
70
+ if (albumshowtype == 'nggallery') {
71
+ tagtext = "[nggalbum id=" + albumid + " template=" + showtype + "]";
72
+ } else {
73
+ tagtext = "[nggalbum id=" + albumid + " template=" + showtype + " gallery=" + albumshowtype + "]";
74
+ }
75
+ break;
76
+ case 'singlepic_panel':
77
+
78
+ //get all the options
79
  var singlepicid = document.getElementById('singlepictag').value;
80
  var imgWidth = document.getElementById('imgWidth').value;
81
  var imgHeight = document.getElementById('imgHeight').value;
82
  var imgeffect = document.getElementById('imgeffect').value;
83
  var imgfloat = document.getElementById('imgfloat').value;
84
+ var imglink = document.getElementById('imglink').value;
85
+ var imgcaption = document.getElementById('imgcaption').value;
86
 
87
+ tagtext = "[singlepic id=" + singlepicid;
88
+ if (imgWidth)
89
+ tagtext += " w=" + imgWidth;
90
+ if (imgHeight)
91
+ tagtext += " h=" + imgHeight;
92
+ if (imgeffect != 0 )
93
+ tagtext += " mode=" + imgeffect;
94
+ if (imgfloat != 0 )
95
+ tagtext += " float=" + imgfloat;
96
+ if (imglink)
97
+ tagtext += " link=" + imglink;
98
+ if (imgcaption) {
99
+ tagtext += "]" + imgcaption + "[/singlepic]";
100
  } else {
101
+ tagtext += "]";
102
  }
103
+ break;
104
+ case 'recent_panel' :
105
+
106
+ var number = document.getElementById('recent-images').value;
107
+ var sort = document.getElementById('sortmode').value;
108
+ var gallery = document.getElementById('recentgallery').value;
109
+ var recentshowtype = getCheckedValue(document.getElementsByName('recent-showtype'));
110
+
111
+ tagtext = "[recent max=" + number;
112
+ if (sort != 0)
113
+ tagtext += " mode=" + sort;
114
+ if (gallery != 0)
115
+ tagtext += " id=" + gallery;
116
+ if (recentshowtype != 'nggallery')
117
+ tagtext += " template=" + recentshowtype;
118
+ tagtext += "/]";
119
+ break;
120
+ case 'random_panel' :
121
+
122
+ var number = document.getElementById('random-images').value;
123
+ var gallery = document.getElementById('randomgallery').value;
124
+ var recentshowtype = getCheckedValue(document.getElementsByName('random-showtype'));
125
+
126
+ tagtext = "[random max=" + number;
127
+
128
+ if (gallery != 0)
129
+ tagtext += " id=" + gallery;
130
+ if (recentshowtype != 'nggallery')
131
+ tagtext += " template=" + recentshowtype;
132
+
133
+ tagtext += "/]";
134
+ break;
135
+ default:
136
+ tinyMCEPopup.close();
137
  }
138
 
139
  if(window.tinyMCE) {
140
+ tinyMCEPopup.editor.insertContent(tagtext, false);
 
 
 
 
 
141
  tinyMCEPopup.close();
142
  }
143
  return;
admin/tinymce/window.php CHANGED
@@ -1,152 +1,537 @@
1
  <?php
2
-
3
  if ( !defined('ABSPATH') )
4
- die('You are not allowed to call this page directly.');
5
 
6
- global $wpdb, $nggdb;
7
 
8
  @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
9
 
10
- // Get WordPress scripts and styles
11
  wp_enqueue_script('jquery-ui-core');
12
  wp_enqueue_script('jquery-ui-widget');
13
  wp_enqueue_script('jquery-ui-position');
14
- global $wp_scripts;
15
  if (!isset($wp_scripts->registered['jquery-ui-autocomplete'])) {
16
  wp_register_script( 'jquery-ui-autocomplete', NGGALLERY_URLPATH .'admin/js/jquery.ui.autocomplete.min.js', array('jquery-ui-core'), '1.8.15');
17
  }
18
  wp_enqueue_script('jquery-ui-autocomplete');
19
  ?>
20
  <html xmlns="http://www.w3.org/1999/xhtml">
21
- <head>
22
- <title>NextCellent Gallery</title>
23
- <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
24
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
25
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
26
- <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
27
- <?php wp_print_scripts() ?>
28
- <script language="javascript" type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/ngg.autocomplete.js"></script>
29
- <script language="javascript" type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/tinymce/tinymce.js"></script>
30
- <link rel="stylesheet" type="text/css" href="<?php echo NGGALLERY_URLPATH ?>admin/css/jquery.ui.css" media="all" />
31
- <base target="_self" />
32
- </head>
33
- <script type="text/javascript">
34
- jQuery(document).ready(function(){
35
- jQuery("#gallerytag").nggAutocomplete( {
36
- type: 'gallery',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
37
- });
38
- jQuery("#albumtag").nggAutocomplete( {
39
- type: 'album',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
40
- });
41
- jQuery("#singlepictag").nggAutocomplete( {
42
- type: 'image',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
43
- });
44
- });
45
- </script>
46
- <body class="nextgen_tinymce_window" id="link" onload="tinyMCEPopup.executeOnLoad('init();');document.body.style.display='';" style="display: none">
47
- <!-- <form onsubmit="insertLink();return false;" action="#"> -->
48
- <form name="NextGEN" action="#">
49
- <div class="tabs">
50
- <ul>
51
- <li id="gallery_tab" class="current"><span><a href="javascript:mcTabs.displayTab('gallery_tab','gallery_panel');" onmousedown="return false;"><?php echo _n( 'Gallery', 'Galleries', 1, 'nggallery' ) ?></a></span></li>
52
- <li id="album_tab"><span><a href="javascript:mcTabs.displayTab('album_tab','album_panel');" onmousedown="return false;"><?php echo _n( 'Album', 'Albums', 1, 'nggallery' ) ?></a></span></li>
53
- <li id="singlepic_tab"><span><a href="javascript:mcTabs.displayTab('singlepic_tab','singlepic_panel');" onmousedown="return false;"><?php _e('Picture', 'nggallery'); ?></a></span></li>
54
- </ul>
55
- </div>
56
-
57
- <div class="panel_wrapper">
58
- <!-- gallery panel -->
59
- <div id="gallery_panel" class="panel current">
60
- <br />
61
- <table border="0" cellpadding="4" cellspacing="0" style="font-size:1em;">
62
- <tr>
63
- <td nowrap="nowrap"><label for="gallerytag"><?php _e("Gallery", 'nggallery'); ?></label></td>
64
- <td><select id="gallerytag" name="gallerytag" style="width: 200px">
65
- <option value="0" selected="selected"><?php _e("Select or enter gallery", 'nggallery'); ?></option>
66
- </select>
67
- </td>
68
- </tr>
69
- <tr>
70
- <td nowrap="nowrap" valign="top"><label for="showtype"><?php _e("Show as", 'nggallery'); ?></label></td>
71
- <td><label><input name="showtype" type="radio" value="nggallery" checked="checked" /> <?php _e('Image list', 'nggallery') ;?></label><br />
72
- <label><input name="showtype" type="radio" value="slideshow" /> <?php _e('Slideshow', 'nggallery') ;?></label><br />
73
- <label><input name="showtype" type="radio" value="imagebrowser" /> <?php _e('Imagebrowser', 'nggallery') ;?></label></td>
74
- </tr>
75
- </table>
76
- </div>
77
- <!-- gallery panel -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
- <!-- album panel -->
80
- <div id="album_panel" class="panel">
81
- <br />
82
- <table border="0" cellpadding="4" cellspacing="0" style="font-size:1em;">
83
- <tr>
84
- <td nowrap="nowrap"><label for="albumtag"><?php _e("Album", 'nggallery'); ?></label></td>
85
- <td><select id="albumtag" name="albumtag" style="width: 200px">
86
- <option value="0" selected="selected"><?php _e("Select or enter album", 'nggallery'); ?></option>
87
- </select>
88
- </td>
89
- </tr>
90
- <tr>
91
- <td nowrap="nowrap" valign="top"><label for="showtype"><?php _e("Show as", 'nggallery'); ?></label></td>
92
- <td><label><input name="albumtype" type="radio" value="extend" checked="checked" /> <?php _e('Extended version', 'nggallery') ;?></label><br />
93
- <label><input name="albumtype" type="radio" value="compact" /> <?php _e('Compact version', 'nggallery') ;?></label></td>
94
- </tr>
95
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  </div>
97
- <!-- album panel -->
98
-
99
- <!-- single pic panel -->
100
- <div id="singlepic_panel" class="panel">
101
- <br />
102
- <table border="0" cellpadding="4" cellspacing="0" style="font-size:1em;">
103
- <tr>
104
- <td nowrap="nowrap"><label for="singlepictag"><?php _e("Picture", 'nggallery'); ?></label></td>
105
- <td><select id="singlepictag" name="singlepictag" style="width: 200px">
106
- <option value="0" selected="selected"><?php _e("Select or enter picture", 'nggallery'); ?></option>
107
- </select>
108
- </td>
109
- </tr>
110
- <tr>
111
- <td nowrap="nowrap"><?php _e("Width x Height", 'nggallery'); ?></td>
112
- <td><input type="text" size="5" id="imgWidth" name="imgWidth" value="320" /> x <input type="text" size="5" id="imgHeight" name="imgHeight" value="240" /></td>
113
- </tr>
114
- <tr>
115
- <td nowrap="nowrap" valign="top"><?php _e("Effect", 'nggallery'); ?></td>
116
- <td>
117
- <label><select id="imgeffect" name="imgeffect">
118
- <option value="none"><?php _e("No effect", 'nggallery'); ?></option>
119
- <option value="watermark"><?php _e("Watermark", 'nggallery'); ?></option>
120
- <option value="web20"><?php _e("Web 2.0", 'nggallery'); ?></option>
121
- </select></label>
122
- </td>
123
- </tr>
124
- <tr>
125
- <td nowrap="nowrap" valign="top"><?php _e("Float", 'nggallery'); ?></td>
126
- <td>
127
- <label><select id="imgfloat" name="imgfloat">
128
- <option value=""><?php _e("No float", 'nggallery'); ?></option>
129
- <option value="left"><?php _e("Left", 'nggallery'); ?></option>
130
- <option value="center"><?php _e("Center", 'nggallery'); ?></option>
131
- <option value="right"><?php _e("Right", 'nggallery'); ?></option>
132
- </select></label>
133
- </td>
134
- </tr>
135
-
136
- </table>
137
- </div>
138
- <!-- single pic panel -->
139
- </div>
140
-
141
- <div class="mceActionPanel">
142
- <div style="float: left">
143
- <input type="button" id="cancel" name="cancel" value="<?php _e("Cancel", 'nggallery'); ?>" onclick="tinyMCEPopup.close();" />
144
- </div>
145
-
146
- <div style="float: right">
147
- <input type="submit" id="insert" name="insert" value="<?php _e("Insert", 'nggallery'); ?>" onclick="insertNGGLink();" />
148
  </div>
149
- </div>
150
- </form>
151
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  </html>
1
  <?php
 
2
  if ( !defined('ABSPATH') )
3
+ die('You are not allowed to call this page directly.');
4
 
5
+ global $wpdb, $nggdb, $wp_scripts;
6
 
7
  @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
8
 
9
+ // Get scripts and styles
10
  wp_enqueue_script('jquery-ui-core');
11
  wp_enqueue_script('jquery-ui-widget');
12
  wp_enqueue_script('jquery-ui-position');
13
+ wp_enqueue_style('wp-admin');
14
  if (!isset($wp_scripts->registered['jquery-ui-autocomplete'])) {
15
  wp_register_script( 'jquery-ui-autocomplete', NGGALLERY_URLPATH .'admin/js/jquery.ui.autocomplete.min.js', array('jquery-ui-core'), '1.8.15');
16
  }
17
  wp_enqueue_script('jquery-ui-autocomplete');
18
  ?>
19
  <html xmlns="http://www.w3.org/1999/xhtml">
20
+ <head>
21
+ <title>NextCellent</title>
22
+ <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
23
+ <?php wp_print_scripts(); ?>
24
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/tiny_mce_popup.js"></script>
25
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/mctabs.js"></script>
26
+ <script language="javascript" type="text/javascript" src="<?php echo site_url(); ?>/wp-includes/js/tinymce/utils/form_utils.js"></script>
27
+ <script language="javascript" type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/ngg.autocomplete.js"></script>
28
+ <script language="javascript" type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/tinymce/tinymce.js"></script>
29
+ <?php wp_print_styles(); ?>
30
+ <style>
31
+ .nggwrap {
32
+ padding:10px;
33
+ overflow-y: scroll;
34
+ height: calc(100% - 51px);
35
+ }
36
+ body {
37
+ height: calc(100% - 36px);
38
+ }
39
+ .display-type, .album-type, .recent-type, .random-type {
40
+ float: left;
41
+ width: 10%;
42
+ min-width: 150px;
43
+ text-align: center;
44
+ }
45
+ .display-type-img {
46
+ width: 100%;
47
+ height: auto;
48
+ }
49
+ .type {
50
+ height: auto !important;
51
+ }
52
+ label {
53
+ vertical-align: initial;
54
+ }
55
+ .description {
56
+ padding-left: 10px;
57
+ }
58
+ h3 {
59
+ margin-bottom: 0;
60
+ }
61
+ .mceActionPanel {
62
+ position: fixed;
63
+ background: white;
64
+ bottom: 0;
65
+ left: 0;
66
+ right: 0;
67
+ overflow: hidden;
68
+ padding: 1em;
69
+ border-top: 1px solid #dfdfdf;
70
+ }
71
+ #insert:hover {
72
+ background: #1e8cbe;
73
+ border-color: #0074a2;
74
+ box-shadow: inset 0 1px 0 rgba(120,200,230,.6);
75
+ color: #fff;
76
+ }
77
+ #insert:active {
78
+ background: #1b7aa6;
79
+ border-color: #005684;
80
+ color: rgba(255,255,255,.95);
81
+ box-shadow: inset 0 1px 0 rgba(0,0,0,.1);
82
+ vertical-align: top;
83
+ }
84
+ #insert {
85
+ background: #2ea2cc;
86
+ border-color: #0074a2;
87
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);
88
+ box-shadow: inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);
89
+ color: #fff;
90
+ text-decoration: none;
91
+ }
92
+ #cancel:hover {
93
+ background: #fafafa;
94
+ border-color: #999;
95
+ color: #222;
96
+ }
97
+ #cancel {
98
+ color: #555;
99
+ border-color: #ccc;
100
+ background: #f7f7f7;
101
+ -webkit-box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
102
+ box-shadow: inset 0 1px 0 #fff,0 1px 0 rgba(0,0,0,.08);
103
+ vertical-align: top;
104
+ }
105
+ #cancel:active {
106
+ background: #eee;
107
+ border-color: #999;
108
+ color: #333;
109
+ -webkit-box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
110
+ box-shadow: inset 0 2px 5px -3px rgba(0,0,0,.5);
111
+ }
112
+ </style>
113
+ <base target="_self" />
114
+ </head>
115
+ <body class="nextgen_tinymce_window wp-admin wp-core-ui" id="link" style="display: none">
116
+ <div class="nggwrap">
117
+ <form id="select-type">
118
+ <label for="types"><?php _e("To add something, select what you would want to display", 'nggallery'); ?>:</label>
119
+ <select id="types">
120
+ <option value="gallery_panel" selected="selected"><?php _e("Gallery", 'nggallery'); ?></option>
121
+ <option value="album_panel"><?php _e("Album", 'nggallery'); ?></option>
122
+ <option value="singlepic_panel"><?php _e("One picture", 'nggallery'); ?></option>
123
+ <option value="recent_panel"><?php _e("Recent pictures", 'nggallery'); ?></option>
124
+ <option value="random_panel"><?php _e("Random pictures", 'nggallery'); ?></option>
125
+ </select>
126
+ </form>
127
+ <form name="NextGEN" id="ngg-tinymce" action="#">
128
+ <!-- This is the initial panel that's showed -->
129
+ <div id="gallery_panel" class="type current" style="display: initial;">
130
+ <table border="0" cellpadding="4" cellspacing="0" style="font-size:1em;">
131
+ <tr>
132
+ <td colspan="2"><h3><?php _e("Basics", 'nggallery'); ?></h3></td>
133
+ </tr>
134
+ <tr>
135
+ <td nowrap="nowrap"><label for="gallerytag"><?php _e("Select a gallery:", 'nggallery'); ?></label></td>
136
+ <td>
137
+ <select id="gallerytag" name="gallerytag" style="width: 200px">
138
+ <option value="0" selected="selected"><?php _e("Select or search for a gallery", 'nggallery'); ?></option>
139
+ </select>
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <td colspan="2"><h3><?php _e("Display types", 'nggallery'); ?></h3></td>
144
+ </tr>
145
+ <tr>
146
+ <td nowrap="nowrap" colspan="2" valign="top"><?php _e("Select how you want to display your gallery", 'nggallery'); ?>:</td>
147
+ </tr>
148
+ <tr>
149
+ <td colspan="2" style="overflow:hidden;">
150
+ <div class="display-type">
151
+ <label for="type-nggallery">
152
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/gallery.svg'; ?>" alt="gallery">
153
+ <br /><input name="showtype" class="radiotype" type="radio" value="nggallery" id="type-nggallery" checked="checked" /><?php _e('Gallery', 'nggallery') ;?>
154
+ </label>
155
+ </div>
156
+ <div class="display-type">
157
+ <label for="type-slideshow">
158
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/slideshow.svg'; ?>" alt="slideshow">
159
+ <br /><input name="showtype" class="radiotype" type="radio" value="slideshow" id="type-slideshow" /><?php _e('Slideshow', 'nggallery') ;?>
160
+ </label>
161
+ </div>
162
+ <div class="display-type">
163
+ <label for="type-imagebrowser">
164
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/imagebrowser.svg'; ?>" alt="browser">
165
+ <br /><input name="showtype" class="radiotype" type="radio" value="imagebrowser" id="type-imagebrowser" /><?php _e('Imagebrowser', 'nggallery') ;?>
166
+ </label>
167
+ </div>
168
+ <div class="display-type">
169
+ <label for="type-carousel">
170
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/carousel.svg'; ?>" alt="carousel">
171
+ <br /><input name="showtype" class="radiotype" type="radio" value="carousel" id="type-carousel" /><?php _e('Carousel', 'nggallery') ;?>
172
+ </label>
173
+ </div>
174
+ <div class="display-type">
175
+ <label for="type-caption">
176
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/caption.svg'; ?>" alt="caption">
177
+ <br /><input name="showtype" class="radiotype" type="radio" value="caption" id="type-caption" /><?php _e('Caption', 'nggallery') ;?>
178
+ </label>
179
+ </div>
180
+ <?php //TODO: add some kind of filter here ?>
181
+ <div class="display-type">
182
+ <label for="type-other">
183
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/other.svg'; ?>" alt="carousel">
184
+ <br /><input name="showtype" class="radiotype" type="radio" value="other" id="type-other" /><?php _e('Custom', 'nggallery') ;?>
185
+ </label>
186
+ </div>
187
+ </td>
188
+ </tr>
189
+ <tr>
190
+ <td colspan="2"><h3><?php _e("Type options", 'nggallery'); ?></h3></td>
191
+ </tr>
192
+ <tr>
193
+ <td colspan="2">
194
+ <span class="nggallery-options carousel-options caption-options type-options" style="display: initial;">
195
+ <table style="font-size:1em;">
196
+ <tr>
197
+ <td><label for="nggallery-images"><?php _e("Number of images", 'nggallery'); ?>:</label></td>
198
+ <td>
199
+ <input id="nggallery-images" type="number">
200
+ <span class="description"><?php _e("The number of images before pagination is applied. Leave empty for the default from the settings.", 'nggallery'); ?></span>
201
+ </td>
202
+ </tr>
203
+ </table>
204
+ </span>
205
+ <span class="slideshow-options type-options" style="display: none;">
206
+ <table style="font-size:1em;">
207
+ <tr>
208
+ <td><?php _e("Slideshow dimensions", 'nggallery'); ?>:</td>
209
+ <td>
210
+ <label for="slide-width"><?php esc_html_e('Width','nggallery') ?></label><input id="slide-width" type="number" step="1" min="0"/>
211
+ <label for="slide-height"><?php esc_html_e('Height','nggallery') ?></label><input id="slide-height" type="number" step="1" min="0" type="number">
212
+ </td>
213
+ </tr>
214
+ </table>
215
+ </span>
216
+ <span class="other-options type-options" style="display: none;">
217
+ <table style="font-size:1em;">
218
+ <tr>
219
+ <td><label for="other-name"><?php _e("Template name", 'nggallery'); ?>:</label></td>
220
+ <td><input id="other-name"type="text"></td>
221
+ </tr>
222
+ </table>
223
+ </span>
224
+ <span class="imagebrowser-options type-options" style="display: none;">No options.</span>
225
+ </td>
226
+ </tr>
227
+ </table>
228
+ </div> <!-- Gallery Panel -->
229
 
230
+ <div id="album_panel" class="type" style="display:none;">
231
+ <table border="0" cellpadding="4" cellspacing="0" style="font-size:1em;">
232
+ <tr>
233
+ <td colspan="2"><h3><?php _e("Basics", 'nggallery'); ?></h3></td>
234
+ </tr>
235
+ <tr>
236
+ <td nowrap="nowrap"><label for="albumtag"><?php _e("Album", 'nggallery'); ?></label></td>
237
+ <td>
238
+ <select id="albumtag" name="albumtag" style="width: 200px">
239
+ <option value="0" selected="selected"><?php _e("Select or enter album", 'nggallery'); ?></option>
240
+ </select>
241
+ <span class="description"><?php _e("Leave this empty to display all galleries.", 'nggallery'); ?></span>
242
+ </td>
243
+ </tr>
244
+ <tr>
245
+ <td colspan="2"><h3><?php _e("Album display types", 'nggallery'); ?></h3></td>
246
+ </tr>
247
+ <tr>
248
+ <td colspan="2"><?php _e("Select how you want to display the albums", 'nggallery'); ?></td>
249
+ </tr>
250
+ <tr>
251
+ <td colspan="2">
252
+ <div class="album-type">
253
+ <label for="album-type-compact">
254
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/compact.svg'; ?>" alt="compact">
255
+ <br /><input name="albumtype" type="radio" value="compact" id="album-type-compact" checked="checked" /><?php _e('Compact version', 'nggallery') ;?>
256
+ </label>
257
+ </div>
258
+ <div class="album-type">
259
+ <label for="album-type-extend">
260
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/extend.svg'; ?>" alt="extend">
261
+ <br /><input name="albumtype" type="radio" value="extend" id="album-type-extend" /><?php _e("Extended version", 'nggallery') ;?>
262
+ </label>
263
+ </div>
264
+ </td>
265
+ </tr>
266
+ <tr>
267
+ <td colspan="2"><h3><?php _e("Gallery display types", 'nggallery') ;?></h3></td>
268
+ </tr>
269
+ <tr>
270
+ <td colspan="2"><?php _e("Select a template for the galleries (displayed after you click on an album)", 'nggallery'); ?>:</td>
271
+ </tr>
272
+ <tr>
273
+ <td colspan="2">
274
+ <div class="album-type">
275
+ <label for="albumtype-nggallery">
276
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/gallery.svg'; ?>" alt="gallery">
277
+ <br /><input name="album-showtype" class="radiotype" type="radio" value="nggallery" id="albumtype-nggallery" checked="checked" /><?php _e('Gallery', 'nggallery') ;?>
278
+ </label>
279
+ </div>
280
+ <div class="album-type">
281
+ <label for="albumtype-carousel">
282
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/carousel.svg'; ?>" alt="carousel">
283
+ <br /><input name="album-showtype" class="radiotype" type="radio" value="carousel" id="albumtype-carousel" /><?php _e('Carousel', 'nggallery') ;?>
284
+ </label>
285
+ </div>
286
+ <div class="album-type">
287
+ <label for="albumtype-caption">
288
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/caption.svg'; ?>" alt="caption">
289
+ <br /><input name="album-showtype" class="radiotype" type="radio" value="caption" id="albumtype-caption" /><?php _e('Caption', 'nggallery') ;?>
290
+ </label>
291
+ </div>
292
+ </td>
293
+ </tr>
294
+ </table>
295
+ </div> <!-- Album Panel -->
296
+
297
+ <div id="singlepic_panel" class="type" style="display:none;">
298
+ <table style="font-size:1em;">
299
+ <tr>
300
+ <td colspan="2"><h3><?php _e("Basics", 'nggallery'); ?></h3></td>
301
+ </tr>
302
+ <tr>
303
+ <td>
304
+ <label for="singlepictag"><?php _e("Select a picture", 'nggallery'); ?></label>
305
+ </td>
306
+ <td>
307
+ <select id="singlepictag" name="singlepictag" style="width: 200px">
308
+ <option value="0" selected="selected"><?php _e("Select or enter picture", 'nggallery'); ?></option>
309
+ </select>
310
+ </td>
311
+ </tr>
312
+ <tr>
313
+ <td colspan="2"><h3><?php _e("Options", 'nggallery'); ?></h3></td>
314
+ </tr>
315
+ <tr>
316
+ <td><?php _e("Dimensions", 'nggallery'); ?></td>
317
+ <td>
318
+ <label for="imgWidth"><?php _e('Width','nggallery') ?></label>
319
+ <input type="number" min="0" id="imgWidth" name="imgWidth" />
320
+ <label for="imgHeight"><?php _e('Height','nggallery') ?></label>
321
+ <input type="number" min="0" id="imgHeight" name="imgHeight" />
322
+ </td>
323
+ </tr>
324
+ <tr>
325
+ <td><label for="imgeffect"><?php _e("Effect", 'nggallery'); ?></label></td>
326
+ <td>
327
+ <select id="imgeffect" name="imgeffect">
328
+ <option value="0"><?php _e("No effect", 'nggallery'); ?></option>
329
+ <option value="watermark"><?php _e("Watermark", 'nggallery'); ?></option>
330
+ <option value="web20"><?php _e("Web 2.0", 'nggallery'); ?></option>
331
+ </select>
332
+ </td>
333
+ </tr>
334
+ <tr>
335
+ <td><label for="imgfloat"><?php _e("Alignment", 'nggallery'); ?></label></td>
336
+ <td>
337
+ <select id="imgfloat" name="imgfloat">
338
+ <option value="0"><?php _e("No float", 'nggallery'); ?></option>
339
+ <option value="left"><?php _e("Left", 'nggallery'); ?></option>
340
+ <option value="center"><?php _e("Center", 'nggallery'); ?></option>
341
+ <option value="right"><?php _e("Right", 'nggallery'); ?></option>
342
+ </select>
343
+ </td>
344
+ </tr>
345
+ <tr>
346
+ <td><label for="imglink"><?php _e("Link", 'nggallery'); ?></label></td>
347
+ <td><input type="text" name="imglink" id="imglink"><span class="description"><?php _e("Add an optional link to the image. Leave blank for no link.", 'nggallery'); ?></td>
348
+ </tr>
349
+ <tr>
350
+ <td><label for="imgcaption"><?php _e("Caption", 'nggallery'); ?></label></td>
351
+ <td><input type="text" name="imgcaption" id="imgcaption"><span class="description"><?php _e("Add an optional caption to the image. Leave blank for no caption.", 'nggallery'); ?></td>
352
+ </tr>
353
+ </table>
354
+ </div> <!-- SinglePic Panel -->
355
+ <div id="recent_panel" class="type" style="display:none;">
356
+ <table style="font-size:1em;">
357
+ <tr>
358
+ <td colspan="2"><h3><?php _e("Basics", 'nggallery'); ?></h3></td>
359
+ </tr>
360
+ <tr>
361
+ <td><label for="recent-images"><?php _e("Number of images", 'nggallery'); ?>:</label></td>
362
+ <td>
363
+ <input id="recent-images" type="number" required>
364
+ <span class="description"><?php _e("The number of images that should be displayed.", 'nggallery'); ?></span>
365
+ </td>
366
+ </tr>
367
+ <tr>
368
+ <td><label for="sortmode"><?php _e("Sort the images", 'nggallery'); ?></label></td>
369
+ <td>
370
+ <select id="sortmode" name="sortmode">
371
+ <option value="0"><?php _e("Upload order", 'nggallery'); ?></option>
372
+ <option value="date"><?php _e("Date taken", 'nggallery'); ?></option>
373
+ <option value="sort"><?php _e("User defined", 'nggallery'); ?></option>
374
+ </select>
375
+ <span class="description"><?php _e("In what order the images are shown. Upload order uses the ID's, date taken uses the EXIF data and user defined is the sort mode from the settings.", 'nggallery'); ?></span>
376
+ </td>
377
+ </tr>
378
+ <tr>
379
+ <td><label for="recentgallery"><?php _e("Select a gallery:", 'nggallery'); ?></label></td>
380
+ <td>
381
+ <select id="recentgallery" name="recentgallery" style="width: 200px">
382
+ <option value="0" selected="selected"><?php _e("Select or search for a gallery", 'nggallery'); ?></option>
383
+ </select>
384
+ <span class="description"><?php _e("If a gallery is selected, only images from that gallery will be shown.", 'nggallery'); ?></span>
385
+ </td>
386
+ </tr>
387
+ <tr>
388
+ <td colspan="2"><h3><?php _e("Options", 'nggallery'); ?></h3></td>
389
+ </tr>
390
+ <tr>
391
+ <td colspan="2"><?php _e("Select a template to display the images", 'nggallery'); ?>:</td>
392
+ </tr>
393
+ <tr>
394
+ <td colspan="2">
395
+ <div class="recent-type">
396
+ <label for="recenttype-nggallery">
397
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/gallery.svg'; ?>" alt="gallery">
398
+ <br /><input name="recent-showtype" class="radiotype" type="radio" value="nggallery" id="recenttype-nggallery" checked="checked" /><?php _e('Gallery', 'nggallery') ;?>
399
+ </label>
400
+ </div>
401
+ <div class="recent-type">
402
+ <label for="recenttype-carousel">
403
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/carousel.svg'; ?>" alt="carousel">
404
+ <br /><input name="recent-showtype" class="radiotype" type="radio" value="carousel" id="recenttype-carousel" /><?php _e('Carousel', 'nggallery') ;?>
405
+ </label>
406
+ </div>
407
+ <div class="recent-type">
408
+ <label for="recenttype-caption">
409
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/caption.svg'; ?>" alt="caption">
410
+ <br /><input name="recent-showtype" class="radiotype" type="radio" value="caption" id="recenttype-caption" /><?php _e('Caption', 'nggallery') ;?>
411
+ </label>
412
+ </div>
413
+ </td>
414
+ </tr>
415
+ </table>
416
+ </div> <!-- Recent Panel -->
417
+ <div id="random_panel" class="type" style="display:none;">
418
+ <table style="font-size:1em;">
419
+ <tr>
420
+ <td colspan="2"><h3><?php _e("Basics", 'nggallery'); ?></h3></td>
421
+ </tr>
422
+ <tr>
423
+ <td><label for="random-images"><?php _e("Number of images", 'nggallery'); ?>:</label></td>
424
+ <td>
425
+ <input id="random-images" type="number" required>
426
+ <span class="description"><?php _e("The number of images that should be displayed.", 'nggallery'); ?></span>
427
+ </td>
428
+ </tr>
429
+ <tr>
430
+ <td><label for="randomgallery"><?php _e("Select a gallery:", 'nggallery'); ?></label></td>
431
+ <td>
432
+ <select id="randomgallery" name="randomgallery" style="width: 200px">
433
+ <option value="0" selected="selected"><?php _e("Select or search for a gallery", 'nggallery'); ?></option>
434
+ </select>
435
+ <span class="description"><?php _e("If a gallery is selected, only images from that gallery will be shown.", 'nggallery'); ?></span>
436
+ </td>
437
+ </tr>
438
+ <tr>
439
+ <td colspan="2"><h3><?php _e("Options", 'nggallery'); ?></h3></td>
440
+ </tr>
441
+ <tr>
442
+ <td colspan="2"><?php _e("Select a template to display the images", 'nggallery'); ?>:</td>
443
+ </tr>
444
+ <tr>
445
+ <td colspan="2">
446
+ <div class="random-type">
447
+ <label for="randomtype-nggallery">
448
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/gallery.svg'; ?>" alt="gallery">
449
+ <br /><input name="random-showtype" class="radiotype" type="radio" value="nggallery" id="randomtype-nggallery" checked="checked" /><?php _e('Gallery', 'nggallery') ;?>
450
+ </label>
451
+ </div>
452
+ <div class="random-type">
453
+ <label for="randomtype-carousel">
454
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/carousel.svg'; ?>" alt="carousel">
455
+ <br /><input name="random-showtype" class="radiotype" type="radio" value="carousel" id="randomtype-carousel" /><?php _e('Carousel', 'nggallery') ;?>
456
+ </label>
457
+ </div>
458
+ <div class="random-type">
459
+ <label for="randomtype-caption">
460
+ <img class="display-type-img" src="<?php echo NGGALLERY_URLPATH . 'admin/images/caption.svg'; ?>" alt="caption">
461
+ <br /><input name="random-showtype" class="radiotype" type="radio" value="caption" id="randomtype-caption" /><?php _e('Caption', 'nggallery') ;?>
462
+ </label>
463
+ </div>
464
+ </td>
465
+ </tr>
466
+ </table>
467
+ </div> <!-- Random Panel -->
468
+ </form>
469
  </div>
470
+ <div class="mceActionPanel">
471
+ <div style="float: left">
472
+ <input form="ngg-tinymce" type="button" id="cancel" name="cancel" value="<?php _e("Cancel", 'nggallery'); ?>" onclick="tinyMCEPopup.close();" />
473
+ </div>
474
+ <div style="float: right">
475
+ <input form="ngg-tinymce" type="submit" id="insert" name="insert" value="<?php _e("Insert", 'nggallery'); ?>" onclick="checkValues();" />
476
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
477
  </div>
478
+ <script type="text/javascript">
479
+ jQuery(document).ready(function(){
480
+ jQuery("#gallerytag").nggAutocomplete( {
481
+ type: 'gallery',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
482
+ });
483
+ jQuery("#albumtag").nggAutocomplete( {
484
+ type: 'album',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
485
+ });
486
+ jQuery("#singlepictag").nggAutocomplete( {
487
+ type: 'image',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
488
+ });
489
+ jQuery("#recentgallery").nggAutocomplete( {
490
+ type: 'gallery',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
491
+ });
492
+ jQuery("#randomgallery").nggAutocomplete( {
493
+ type: 'gallery',domain: "<?php echo home_url('index.php', is_ssl() ? 'https' : 'http'); ?>"
494
+ });
495
+ jQuery('#types').change(function(){
496
+ jQuery('#' + jQuery(this).val()).show('fast').addClass('current').siblings('.type').hide().removeClass('current');
497
+ });
498
+ jQuery('.radiotype').change(function(){
499
+ jQuery('.' + jQuery(this).val() + '-options').show('fast').siblings('.type-options').hide();
500
+ });
501
+ });
502
+ function checkValues() {
503
+ //Check to see that the required forms are completed
504
+ var active = document.getElementsByClassName('current')[0].id;
505
+ var required;
506
+ var message;
507
+
508
+ switch (active) {
509
+ case 'gallery_panel' :
510
+ required = document.getElementById('gallerytag').value;
511
+ message = "<?php _e('You need to select a gallery.','nggallery')?>";
512
+ break;
513
+ case 'singlepic_panel' :
514
+ required = document.getElementById('singlepictag').value;
515
+ message = "<?php _e('You need to select a picture.','nggallery')?>";
516
+ break;
517
+ case 'recent_panel' :
518
+ required = document.getElementById('recent-images').value;
519
+ message = "<?php _e('You need to select a number of images.','nggallery')?>";
520
+ break;
521
+ case 'random_panel' :
522
+ required = document.getElementById('random-images').value;
523
+ message = "<?php _e('You need to select a number of images.','nggallery')?>";
524
+ break;
525
+ default:
526
+ required = 1;
527
+ }
528
+ if (required == 0) {
529
+ event.preventDefault();
530
+ alert(message);
531
+ } else {
532
+ insertNGGLink();
533
+ }
534
+ }
535
+ </script>
536
+ </body>
537
  </html>
lib/core.php CHANGED
@@ -268,11 +268,16 @@ class nggGallery {
268
 
269
  if ( ( $custom_template != false ) && file_exists ($custom_template) ) {
270
  include ( $custom_template );
271
- } else if (file_exists (STYLESHEETPATH . "/nggallery/$template_name.php")) {
272
- include (STYLESHEETPATH . "/nggallery/$template_name.php");
273
- } else if (file_exists (NGGALLERY_ABSPATH . "/view/$template_name.php")) {
 
 
 
 
 
274
  include (NGGALLERY_ABSPATH . "/view/$template_name.php");
275
- } else if ( $callback === true ) {
276
  echo "<p>Rendering of template $template_name.php failed</p>";
277
  } else {
278
  //test without the "-template" name one time more
@@ -328,7 +333,9 @@ class nggGallery {
328
 
329
  if ( $stylesheet !== false )
330
  return ( $stylesheet );
331
- elseif ( file_exists (STYLESHEETPATH . '/nggallery.css') )
 
 
332
  return get_stylesheet_directory_uri() . '/nggallery.css';
333
  else
334
  return false;
268
 
269
  if ( ( $custom_template != false ) && file_exists ($custom_template) ) {
270
  include ( $custom_template );
271
+ //search in theme folder
272
+ } elseif (file_exists (get_stylesheet_directory() . "/nggallery/$template_name.php")) {
273
+ include (get_stylesheet_directory() . "/nggallery/$template_name.php");
274
+ //search in WP_CONTENT_DIR
275
+ } elseif (file_exists (WP_CONTENT_DIR . "/ngg_styles/$template_name.php")) {
276
+ include (WP_CONTENT_DIR . "/ngg_styles/$template_name.php");
277
+ //use defaults
278
+ } elseif (file_exists (NGGALLERY_ABSPATH . "/view/$template_name.php")) {
279
  include (NGGALLERY_ABSPATH . "/view/$template_name.php");
280
+ } elseif ( $callback === true ) {
281
  echo "<p>Rendering of template $template_name.php failed</p>";
282
  } else {
283
  //test without the "-template" name one time more
333
 
334
  if ( $stylesheet !== false )
335
  return ( $stylesheet );
336
+ elseif ( file_exists (WP_CONTENT_DIR . '/ngg_styles/nggallery.css') )
337
+ return content_url() . '/ngg_styles/nggallery.css';
338
+ elseif ( file_exists (get_stylesheet_directory() . '/nggallery.css') )
339
  return get_stylesheet_directory_uri() . '/nggallery.css';
340
  else
341
  return false;
lib/ngg-db.php CHANGED
@@ -293,7 +293,7 @@ class nggdb {
293
  * @id The gallery ID
294
  */
295
  static function delete_gallery( $id ) {
296
- global $wpdb;
297
 
298
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->nggpictures WHERE galleryid = %d", $id) );
299
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->nggallery WHERE gid = %d", $id) );
@@ -301,6 +301,22 @@ class nggdb {
301
  wp_cache_delete($id, 'ngg_gallery');
302
 
303
  //TODO:Remove all tag relationship
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  return true;
305
  }
306
 
293
  * @id The gallery ID
294
  */
295
  static function delete_gallery( $id ) {
296
+ global $wpdb, $nggdb;
297
 
298
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->nggpictures WHERE galleryid = %d", $id) );
299
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->nggallery WHERE gid = %d", $id) );
301
  wp_cache_delete($id, 'ngg_gallery');
302
 
303
  //TODO:Remove all tag relationship
304
+
305
+ //Update the galleries to remove the deleted ID's
306
+ $albums = $nggdb->find_all_album();
307
+
308
+ foreach ($albums as $album) {
309
+ $albumid = $album->id;
310
+ $galleries = $album->galleries;
311
+ $deleted = array_search($id, $galleries);
312
+
313
+ unset($galleries[$deleted]);
314
+
315
+ $new_galleries = serialize($galleries);
316
+
317
+ nggdb::update_album($albumid, false, false, false, $new_galleries);
318
+ }
319
+
320
  return true;
321
  }
322
 
nggallery.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.wpgetready.com/nextcellent-gallery
5
  Description: A Photo Gallery for WordPress providing NextGEN legacy compatibility from version 1.9.13
6
  Author: WPGReady based on Alex Rabe & PhotoCrati work.
7
  Author URI: http://www.wpgetready.com
8
- Version: 1.9.20
9
 
10
  Copyright (c) 2007-2011 by Alex Rabe & NextGEN DEV-Team
11
  Copyright (c) 2012 Photocrati Media
@@ -52,7 +52,7 @@ if (!class_exists('nggLoader')) {
52
  */
53
  class nggLoader {
54
 
55
- var $version = '1.9.20';
56
  var $dbversion = '1.8.1';
57
  var $minimum_WP = '3.5';
58
  var $options = '';
5
  Description: A Photo Gallery for WordPress providing NextGEN legacy compatibility from version 1.9.13
6
  Author: WPGReady based on Alex Rabe & PhotoCrati work.
7
  Author URI: http://www.wpgetready.com
8
+ Version: 1.9.21
9
 
10
  Copyright (c) 2007-2011 by Alex Rabe & NextGEN DEV-Team
11
  Copyright (c) 2012 Photocrati Media
52
  */
53
  class nggLoader {
54
 
55
+ var $version = '1.9.21';
56
  var $dbversion = '1.8.1';
57
  var $minimum_WP = '3.5';
58
  var $options = '';
readme.txt CHANGED
@@ -1,5 +1,5 @@
1
  === NextCellent Gallery - NextGEN Legacy ===
2
- Contributors: WPGetReady
3
  Tags:gallery,image,images,photo,photos,picture,pictures,slideshow,flash,media,thumbnails,photo-albums,NextGEN-gallery,NextGEN,nextcellent-gallery,nextcellent
4
  Requires at least: 3.5
5
  Tested up to: 3.9.1
@@ -8,19 +8,14 @@ License: GPLv2
8
 
9
  == Description ==
10
 
11
- = WordPress Gallery Plugin =
12
-
13
- = V1.9.20 - 20.06.2014
14
 
15
  What's in it for you?
16
 
17
- * Fixes on uploader (credits to Niko Strijbol)
18
- * Fixes for nggtag shortcode (credits to Niko Strijbol)
19
- * Refactored code in few places
20
- * Fix vulnerability which disallowed html text & santitize_taglist function (credits to NS & FZ)
21
- * Fix for 3.9 and typos for strict warning
22
- * Improved injections prevention (credits to jayque9)
23
- * Improve spelling & error message (credits to Niko Strijbol)
24
 
25
  VERY IMPORTANT: Read ON!
26
  -----------------------
@@ -330,23 +325,29 @@ Yes, since we use Javascript rather than flash, NextCellent Gallery is compatibl
330
 
331
  == Changelog ==
332
 
333
- = V1.9.19 - 20.06.2014
 
 
 
 
 
 
334
  * Fixes on uploader (credits to Niko Strijbol)
335
  * Fixes for nggtag shortcode (credits to Niko Strijbol)
336
  * Refactored code in few places
337
- * Fix vulnerability which disallowed html text & santitize_taglist function (credits to NS & FZ)
338
  * Fix for 3.9 and typos for strict warning
339
  * Improved injections prevention (credits to jayque9)
340
  * Improve spelling & error message (credits to Niko Strijbol)
341
 
342
- = V1.9.19 - 22.05.2014
343
  * New uploader. Flash uploader deprecated (credits to Niko Strijbol)
344
  * Improved image folder importer. Now fixes folder & files with spaces (credits to Niko Strijbol)
345
  * Removed dead code
346
  * Wikipedia docs in progress http://wpgetready.com/wiki/nextcellent-plugin/ Be free to contribute! (contact us to request permission to edit it)
347
  * Re-fix vuln (previous fix also filtered html data, now fixed)
348
 
349
- = V1.9.18 - 23.04.2014 =
350
  * Fixes compatibility with TinyMCE 1.4, for WordPress 3.9. (credits to Niko Strijbol)
351
  * Fixes use of mysql_*(), which isn't allowed anymore. (credits to Niko Strijbol)
352
  * Fixes some style stuff from the datepicker interfering with the style of the tabs. (credits to Niko Strijbol)
@@ -354,7 +355,7 @@ Yes, since we use Javascript rather than flash, NextCellent Gallery is compatibl
354
  * Vulnerability fix: data isn't properly sanitized before being printed ona Alt & Title (credits to Larry W. Cashdollar)
355
  * Changing date for uploaded images improved (credits to Richard Bale)
356
 
357
- = V1.9.17 - 17.03.2014 =
358
  * Fixes to layout and more (credits to Niko Strijbol)
359
  * Added ability to change image upload + Ajax (credits to Richard Bale)
360
  * Russian translation (credits to Vladimir Vasilenko)
@@ -363,19 +364,19 @@ Yes, since we use Javascript rather than flash, NextCellent Gallery is compatibl
363
  * Improved nggtags shortcode implementing Tony Howden's suggestions (see http://howden.net.au/thowden/2012/12/nextgen-gallery-wordpress-nggtags-template-caption-option/)
364
  added modes ASC,DESC and RAND
365
 
366
- = V1.9.16 - 08.01.2014 =
367
  * Folder and Image Management improved (credits to Niko Strijbol)
368
  * German translation (credits to Niko Strijbol)
369
  * Improved style for WP 3.8 (credits to Niko Strijbol)
370
  * Improper call to method as static when method belongs to instance. Fixed
371
  * Code cleaning, proper call to static method fixed
372
 
373
- = V1.9.15 - 03.10.2013 =
374
  * Code simplification: code supporting PHP4 has no use. Deprecated.
375
  * Plugin should work with PHP strict standard enabled.
376
  * Improper call to static functions corrected all over the code
377
  * Disabled donator metabox since link is dead
378
 
379
- = V1.9.14 - 01.09.2013 =
380
  * The plugin will deactivate if NextGEN (all versions) plugin is installed & activated
381
- * text messages were adjusted to this plugin, to avoid user confusion.
1
  === NextCellent Gallery - NextGEN Legacy ===
2
+ Contributors: wpready
3
  Tags:gallery,image,images,photo,photos,picture,pictures,slideshow,flash,media,thumbnails,photo-albums,NextGEN-gallery,NextGEN,nextcellent-gallery,nextcellent
4
  Requires at least: 3.5
5
  Tested up to: 3.9.1
8
 
9
  == Description ==
10
 
11
+ = 1.9.21 - 14/09/2014 =
 
 
12
 
13
  What's in it for you?
14
 
15
+ * The uploader did not use the quality set in the options. Now it does (credits to Niko Strijbol)
16
+ * Fix: When a gallery is deleted, the ID is removed from albums. (credits to Niko Strijbol)
17
+ * Small changes readme.txt to look better (Matthew's Random Stuff)
18
+ * Support for the ngg_styles folder (introduced in NextGEN 2.x), solving issues with updates (credits to Niko Strijbol)
 
 
 
19
 
20
  VERY IMPORTANT: Read ON!
21
  -----------------------
325
 
326
  == Changelog ==
327
 
328
+ = 1.9.21 - 14/09/2014 =
329
+ * The uploader did not use the quality set in the options. Now it does (credits to Niko Strijbol)
330
+ * Fix: When a gallery is deleted, the ID is removed from albums. (credits to Niko Strijbol)
331
+ * Small changes readme.txt to look better (Matthew's Random Stuff)
332
+ * Support for the ngg_styles folder (introduced in NextGEN 2.x), solving issues with updates (credits to Niko Strijbol)
333
+
334
+ = 1.9.20 - 20/06/2014 =
335
  * Fixes on uploader (credits to Niko Strijbol)
336
  * Fixes for nggtag shortcode (credits to Niko Strijbol)
337
  * Refactored code in few places
338
+ * Fix vulnerability which disallowed html text & sanitize_taglist function (credits to NS & FZ)
339
  * Fix for 3.9 and typos for strict warning
340
  * Improved injections prevention (credits to jayque9)
341
  * Improve spelling & error message (credits to Niko Strijbol)
342
 
343
+ = 1.9.19 - 22/05/2014 =
344
  * New uploader. Flash uploader deprecated (credits to Niko Strijbol)
345
  * Improved image folder importer. Now fixes folder & files with spaces (credits to Niko Strijbol)
346
  * Removed dead code
347
  * Wikipedia docs in progress http://wpgetready.com/wiki/nextcellent-plugin/ Be free to contribute! (contact us to request permission to edit it)
348
  * Re-fix vuln (previous fix also filtered html data, now fixed)
349
 
350
+ = 1.9.18 - 23/04/2014 =
351
  * Fixes compatibility with TinyMCE 1.4, for WordPress 3.9. (credits to Niko Strijbol)
352
  * Fixes use of mysql_*(), which isn't allowed anymore. (credits to Niko Strijbol)
353
  * Fixes some style stuff from the datepicker interfering with the style of the tabs. (credits to Niko Strijbol)
355
  * Vulnerability fix: data isn't properly sanitized before being printed ona Alt & Title (credits to Larry W. Cashdollar)
356
  * Changing date for uploaded images improved (credits to Richard Bale)
357
 
358
+ = 1.9.17 - 17/03/2014 =
359
  * Fixes to layout and more (credits to Niko Strijbol)
360
  * Added ability to change image upload + Ajax (credits to Richard Bale)
361
  * Russian translation (credits to Vladimir Vasilenko)
364
  * Improved nggtags shortcode implementing Tony Howden's suggestions (see http://howden.net.au/thowden/2012/12/nextgen-gallery-wordpress-nggtags-template-caption-option/)
365
  added modes ASC,DESC and RAND
366
 
367
+ = 1.9.16 - 08/01/2014 =
368
  * Folder and Image Management improved (credits to Niko Strijbol)
369
  * German translation (credits to Niko Strijbol)
370
  * Improved style for WP 3.8 (credits to Niko Strijbol)
371
  * Improper call to method as static when method belongs to instance. Fixed
372
  * Code cleaning, proper call to static method fixed
373
 
374
+ = 1.9.15 - 03/10/2013 =
375
  * Code simplification: code supporting PHP4 has no use. Deprecated.
376
  * Plugin should work with PHP strict standard enabled.
377
  * Improper call to static functions corrected all over the code
378
  * Disabled donator metabox since link is dead
379
 
380
+ = 1.9.14 - 01/09/2013 =
381
  * The plugin will deactivate if NextGEN (all versions) plugin is installed & activated
382
+ * text messages were adjusted to this plugin, to avoid user confusion.