Version Description
- 2017-09-23
Download this release
Release Info
Developer | WPReady |
Plugin | NextCellent Gallery – NextGEN Legacy |
Version | 1.9.33 |
Comparing to | |
See all releases |
Code changes from version 1.9.32.fix-2 to 1.9.33
- admin/ajax.php +19 -2
- admin/class-ngg-album-manager.php +2 -2
- admin/class-ngg-installer.php +3 -1
- admin/class-ngg-options.php +5 -3
- admin/class-ngg-roles.php +9 -9
- admin/functions.php +9 -113
- admin/manage/actions.php +2 -3
- admin/manage/class-ngg-abstract-image-manager.php +80 -2
- admin/media-upload.php +2 -1
- admin/tinymce/tiny_mce_popup.js +544 -0
- admin/tinymce/tinymce.php +1 -1
- admin/tinymce/utils/mctabs.js +171 -0
- admin/upgrade.php +3 -3
- admin/upload.php +1 -1
- lib/gd.thumbnail.inc.php +4 -4
- lib/image.php +1 -1
- lib/meta.php +1 -1
- lib/rewrite.php +1 -1
- ngg-config.php +0 -36
- nggallery.php +5 -7
- nggshow.php +0 -5
- readme.txt +33 -20
- xml/imagerotator.php +0 -54
- xml/media-rss.php +0 -2
admin/ajax.php
CHANGED
@@ -241,8 +241,6 @@ function ngg_rotateImage() {
|
|
241 |
if ( !current_user_can('NextGEN Manage gallery') )
|
242 |
die('-1');
|
243 |
|
244 |
-
require_once( dirname( dirname(__FILE__) ) . '/ngg-config.php');
|
245 |
-
|
246 |
// include the ngg function
|
247 |
include_once (dirname (__FILE__). '/functions.php');
|
248 |
|
@@ -508,4 +506,23 @@ function ngg_ajax_test_head_footer() {
|
|
508 |
}
|
509 |
die('success');
|
510 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
?>
|
241 |
if ( !current_user_can('NextGEN Manage gallery') )
|
242 |
die('-1');
|
243 |
|
|
|
|
|
244 |
// include the ngg function
|
245 |
include_once (dirname (__FILE__). '/functions.php');
|
246 |
|
506 |
}
|
507 |
die('success');
|
508 |
}
|
509 |
+
|
510 |
+
add_action('wp_ajax_image_manager', 'ngg_ajax_image_manager');
|
511 |
+
|
512 |
+
/**
|
513 |
+
* handle image operations. This is the correct solution to avoid using wp-load.php issue on NGG 1.9.31
|
514 |
+
*
|
515 |
+
* @see
|
516 |
+
* @since 1.9.33
|
517 |
+
* @return depend on the operation
|
518 |
+
*/
|
519 |
+
|
520 |
+
function ngg_ajax_image_manager() {
|
521 |
+
|
522 |
+
require_once('manage/actions.php');
|
523 |
+
wp_die();
|
524 |
+
|
525 |
+
}
|
526 |
+
|
527 |
+
|
528 |
?>
|
admin/class-ngg-album-manager.php
CHANGED
@@ -143,8 +143,8 @@ class NGG_Album_Manager implements NGG_Displayable {
|
|
143 |
wp_die( __( 'Cheatin’ uh?' ) );
|
144 |
}
|
145 |
|
146 |
-
$name =
|
147 |
-
$desc =
|
148 |
$prev = (int) $_POST['previewpic'];
|
149 |
$link = (int) $_POST['pageid'];
|
150 |
|
143 |
wp_die( __( 'Cheatin’ uh?' ) );
|
144 |
}
|
145 |
|
146 |
+
$name = sanitize_text_field($_POST['album_name']);
|
147 |
+
$desc = sanitize_text_field($_POST['album_desc']);
|
148 |
$prev = (int) $_POST['previewpic'];
|
149 |
$link = (int) $_POST['pageid'];
|
150 |
|
admin/class-ngg-installer.php
CHANGED
@@ -109,7 +109,7 @@ class NGG_Installer {
|
|
109 |
// check one table again, to be sure
|
110 |
if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
|
111 |
update_option( "ngg_init_check",
|
112 |
-
__( 'NextCellent Gallery : Tables could not created, please check your database settings',
|
113 |
"nggallery" ) );
|
114 |
|
115 |
return;
|
@@ -230,6 +230,8 @@ class NGG_Installer {
|
|
230 |
$ngg_options['gallerypath'] = str_replace( "%BLOG_ID%", $blog_id, $ngg_wpmu_options['gallerypath'] );
|
231 |
$ngg_options['CSSfile'] = $ngg_wpmu_options['wpmuCSSfile'];
|
232 |
}
|
|
|
|
|
233 |
|
234 |
update_option( 'ngg_options', $ngg_options );
|
235 |
|
109 |
// check one table again, to be sure
|
110 |
if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$nggpictures'" ) ) {
|
111 |
update_option( "ngg_init_check",
|
112 |
+
__( 'NextCellent Gallery : Tables could not be created, please check your database settings',
|
113 |
"nggallery" ) );
|
114 |
|
115 |
return;
|
230 |
$ngg_options['gallerypath'] = str_replace( "%BLOG_ID%", $blog_id, $ngg_wpmu_options['gallerypath'] );
|
231 |
$ngg_options['CSSfile'] = $ngg_wpmu_options['wpmuCSSfile'];
|
232 |
}
|
233 |
+
$ngg_options['silentUpgrade'] = false;
|
234 |
+
$ngg_options['thumbDifferentSize'] = false;
|
235 |
|
236 |
update_option( 'ngg_options', $ngg_options );
|
237 |
|
admin/class-ngg-options.php
CHANGED
@@ -45,7 +45,8 @@ class NGG_Options extends NGG_Post_Admin_Page {
|
|
45 |
check_admin_referer('ngg_settings');
|
46 |
// get the hidden option fields, taken from WP core
|
47 |
if ( $_POST['page_options'] ) {
|
48 |
-
|
|
|
49 |
} else {
|
50 |
$options = false;
|
51 |
}
|
@@ -55,7 +56,8 @@ class NGG_Options extends NGG_Post_Admin_Page {
|
|
55 |
$option = trim($option);
|
56 |
$value = false;
|
57 |
if ( isset( $_POST[ $option ] ) ) {
|
58 |
-
|
|
|
59 |
if ($value === "true") {
|
60 |
$value = true;
|
61 |
}
|
@@ -627,7 +629,7 @@ class NGG_Options extends NGG_Post_Admin_Page {
|
|
627 |
<li><strong>%IMG_WIDTH%</strong> - <?php _e('The width of the image.', 'nggallery'); ?></li>
|
628 |
<li><strong>%IMG_HEIGHT%</strong> - <?php _e('The height of the image.', 'nggallery'); ?></li>
|
629 |
</ul>
|
630 |
-
<form name="effectsform" method="POST" action="<?php echo $this->
|
631 |
<?php wp_nonce_field('ngg_settings') ?>
|
632 |
<input type="hidden" name="page_options" value="thumbEffect,thumbCode">
|
633 |
<table class="form-table ngg-options">
|
45 |
check_admin_referer('ngg_settings');
|
46 |
// get the hidden option fields, taken from WP core
|
47 |
if ( $_POST['page_options'] ) {
|
48 |
+
//$options = explode( ',', stripslashes( sanitize_text_field($_POST['page_options'] )) );
|
49 |
+
$options = explode( ',', stripslashes( ($_POST['page_options'] )) );
|
50 |
} else {
|
51 |
$options = false;
|
52 |
}
|
56 |
$option = trim($option);
|
57 |
$value = false;
|
58 |
if ( isset( $_POST[ $option ] ) ) {
|
59 |
+
//$value = sanitize_text_field( $_POST[ $option ] );
|
60 |
+
$value = $_POST[ $option ] ;
|
61 |
if ($value === "true") {
|
62 |
$value = true;
|
63 |
}
|
629 |
<li><strong>%IMG_WIDTH%</strong> - <?php _e('The width of the image.', 'nggallery'); ?></li>
|
630 |
<li><strong>%IMG_HEIGHT%</strong> - <?php _e('The height of the image.', 'nggallery'); ?></li>
|
631 |
</ul>
|
632 |
+
<form name="effectsform" method="POST" action="<?php echo $this->page . '#effects'; ?>">
|
633 |
<?php wp_nonce_field('ngg_settings') ?>
|
634 |
<input type="hidden" name="page_options" value="thumbEffect,thumbCode">
|
635 |
<table class="form-table ngg-options">
|
admin/class-ngg-roles.php
CHANGED
@@ -69,15 +69,15 @@ class NGG_Roles extends NGG_Post_Admin_Page {
|
|
69 |
check_admin_referer('ngg_addroles');
|
70 |
|
71 |
// now set or remove the capability
|
72 |
-
$this->ngg_set_capability(
|
73 |
-
$this->ngg_set_capability(
|
74 |
-
$this->ngg_set_capability(
|
75 |
-
$this->ngg_set_capability(
|
76 |
-
$this->ngg_set_capability(
|
77 |
-
$this->ngg_set_capability(
|
78 |
-
$this->ngg_set_capability(
|
79 |
-
$this->ngg_set_capability(
|
80 |
-
$this->ngg_set_capability(
|
81 |
|
82 |
nggGallery::show_message(__('Updated capabilities',"nggallery"));
|
83 |
}
|
69 |
check_admin_referer('ngg_addroles');
|
70 |
|
71 |
// now set or remove the capability
|
72 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['general']),"NextGEN Gallery overview");
|
73 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['tinymce']),"NextGEN Use TinyMCE");
|
74 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['add_gallery']),"NextGEN Upload images");
|
75 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['manage_gallery']),"NextGEN Manage gallery");
|
76 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['manage_others']),"NextGEN Manage others gallery");
|
77 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['manage_tags']),"NextGEN Manage tags");
|
78 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['edit_album']),"NextGEN Edit album");
|
79 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['change_style']),"NextGEN Change style");
|
80 |
+
$this->ngg_set_capability(sanitize_text_field($_POST['change_options']),"NextGEN Change options");
|
81 |
|
82 |
nggGallery::show_message(__('Updated capabilities',"nggallery"));
|
83 |
}
|
admin/functions.php
CHANGED
@@ -28,9 +28,7 @@ class nggAdmin{
|
|
28 |
|
29 |
static function create_gallery($title, $defaultpath, $output = true, $description = '') {
|
30 |
|
31 |
-
global $
|
32 |
-
|
33 |
-
get_currentuserinfo(); //get current user ID & sets global object $current_user
|
34 |
$name = sanitize_file_name( sanitize_title($title) ); //cleanup pathname
|
35 |
$name = apply_filters('ngg_gallery_name', $name);
|
36 |
|
@@ -108,7 +106,7 @@ class nggAdmin{
|
|
108 |
|
109 |
//clean the description and add the gallery
|
110 |
$description = nggGallery::suppress_injection($description);
|
111 |
-
$galleryID = nggdb::add_gallery($title, $nggpath, $description, 0, 0, $
|
112 |
// here you can inject a custom function
|
113 |
do_action('ngg_created_new_gallery', $galleryID);
|
114 |
|
@@ -142,10 +140,9 @@ class nggAdmin{
|
|
142 |
/**
|
143 |
* @global nggdb $nggdb
|
144 |
*/
|
145 |
-
global $wpdb, $
|
146 |
|
147 |
-
// get the current user ID
|
148 |
-
get_currentuserinfo();
|
149 |
|
150 |
$created_msg = NULL;
|
151 |
|
@@ -204,7 +201,7 @@ class nggAdmin{
|
|
204 |
|
205 |
if (!$gallery_id) {
|
206 |
// now add the gallery to the database
|
207 |
-
$gallery_id = nggdb::add_gallery( $galleryname, $galleryfolder, '', 0, 0, $
|
208 |
if (!$gallery_id) {
|
209 |
nggGallery::show_error(__('Database error. Could not add gallery!','nggallery'));
|
210 |
return;
|
@@ -317,106 +314,7 @@ class nggAdmin{
|
|
317 |
return;
|
318 |
|
319 |
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* nggAdmin::old_import_gallery()
|
323 |
-
* TODO: Check permission of existing thumb folder & images
|
324 |
-
* Use is not recommended!
|
325 |
-
*
|
326 |
-
* @class nggAdmin
|
327 |
-
* @param string $galleryfolder contains relative path to the gallery itself
|
328 |
-
* @return void
|
329 |
-
*/
|
330 |
-
static function old_import_gallery($galleryfolder) {
|
331 |
-
|
332 |
-
global $wpdb, $user_ID;
|
333 |
-
|
334 |
-
// get the current user ID
|
335 |
-
get_currentuserinfo();
|
336 |
-
|
337 |
-
$created_msg = '';
|
338 |
-
|
339 |
-
// remove trailing slash at the end, if somebody use it
|
340 |
-
$galleryfolder = untrailingslashit($galleryfolder);
|
341 |
-
$gallerypath = WINABSPATH . $galleryfolder;
|
342 |
-
|
343 |
-
if (!is_dir($gallerypath)) {
|
344 |
-
nggGallery::show_error(__('Directory', 'nggallery').' <strong>' . esc_html( $gallerypath ) .'</strong> '.__('doesn`t exist!', 'nggallery'));
|
345 |
-
return ;
|
346 |
-
}
|
347 |
-
|
348 |
-
// read list of images
|
349 |
-
$new_imageslist = nggAdmin::scandir($gallerypath);
|
350 |
|
351 |
-
if (empty($new_imageslist)) {
|
352 |
-
nggGallery::show_message(__('Directory', 'nggallery').' <strong>' . esc_html( $gallerypath ) . '</strong> '.__('contains no pictures', 'nggallery'));
|
353 |
-
return;
|
354 |
-
}
|
355 |
-
|
356 |
-
// check & create thumbnail folder
|
357 |
-
if ( !nggGallery::get_thumbnail_folder($gallerypath) )
|
358 |
-
return;
|
359 |
-
|
360 |
-
// take folder name as gallery name
|
361 |
-
$galleryname = basename($galleryfolder);
|
362 |
-
$galleryname = apply_filters('ngg_gallery_name', $galleryname);
|
363 |
-
|
364 |
-
// check for existing gallery folder
|
365 |
-
$gallery_id = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE path = '$galleryfolder' ");
|
366 |
-
|
367 |
-
if (!$gallery_id) {
|
368 |
-
// now add the gallery to the database
|
369 |
-
$gallery_id = nggdb::add_gallery( $galleryname, $galleryfolder, '', 0, 0, $user_ID );
|
370 |
-
if (!$gallery_id) {
|
371 |
-
nggGallery::show_error(__('Database error. Could not add gallery!','nggallery'));
|
372 |
-
return;
|
373 |
-
}
|
374 |
-
$created_msg = __( 'Gallery', 'nggallery' ) . ' <strong>' . esc_html( $galleryname ) . '</strong> ' . __('successfully created!','nggallery') . '<br />';
|
375 |
-
}
|
376 |
-
|
377 |
-
// Look for existing image list
|
378 |
-
$old_imageslist = $wpdb->get_col("SELECT filename FROM $wpdb->nggpictures WHERE galleryid = '$gallery_id' ");
|
379 |
-
|
380 |
-
// if no images are there, create empty array
|
381 |
-
if ($old_imageslist == NULL)
|
382 |
-
$old_imageslist = array();
|
383 |
-
|
384 |
-
// check difference
|
385 |
-
$new_images = array_diff($new_imageslist, $old_imageslist);
|
386 |
-
|
387 |
-
// all images must be valid files
|
388 |
-
foreach($new_images as $key => $picture) {
|
389 |
-
|
390 |
-
// filter function to rename/change/modify image before
|
391 |
-
$picture = apply_filters('ngg_pre_add_new_image', $picture, $gallery_id);
|
392 |
-
$new_images[$key] = $picture;
|
393 |
-
|
394 |
-
if (!@getimagesize($gallerypath . '/' . $picture) ) {
|
395 |
-
unset($new_images[$key]);
|
396 |
-
@unlink($gallerypath . '/' . $picture);
|
397 |
-
}
|
398 |
-
}
|
399 |
-
|
400 |
-
// add images to database
|
401 |
-
$image_ids = nggAdmin::add_Images($gallery_id, $new_images);
|
402 |
-
|
403 |
-
//add the preview image if needed
|
404 |
-
nggAdmin::set_gallery_preview ( $gallery_id );
|
405 |
-
|
406 |
-
// now create thumbnails
|
407 |
-
nggAdmin::do_ajax_operation( 'create_thumbnail' , $image_ids, __('Create new thumbnails','nggallery') );
|
408 |
-
|
409 |
-
//TODO:Message will not shown, because AJAX routine require more time, message should be passed to AJAX
|
410 |
-
$message = $created_msg . count($image_ids) .__(' picture(s) successfully added','nggallery');
|
411 |
-
$message .= ' [<a href="' . admin_url() . 'admin.php?page=nggallery-manage&mode=image&gid=' . $gallery_id . '" >';
|
412 |
-
$message .= __('Edit gallery','nggallery');
|
413 |
-
$message .= '</a>]';
|
414 |
-
|
415 |
-
nggGallery::show_message($message);
|
416 |
-
|
417 |
-
return;
|
418 |
-
|
419 |
-
}
|
420 |
|
421 |
/**
|
422 |
* Scan folder for new images
|
@@ -1253,13 +1151,13 @@ class nggAdmin{
|
|
1253 |
}
|
1254 |
|
1255 |
/**
|
1256 |
-
*
|
1257 |
*
|
1258 |
* @class nggAdmin
|
1259 |
* @param integer $galleryID
|
1260 |
* @return string $result
|
1261 |
*/
|
1262 |
-
static function
|
1263 |
|
1264 |
global $nggdb;
|
1265 |
|
@@ -1370,15 +1268,13 @@ class nggAdmin{
|
|
1370 |
global $user_ID, $wp_roles;
|
1371 |
|
1372 |
if ( !current_user_can('NextGEN Manage others gallery') ) {
|
1373 |
-
// get the current user ID
|
1374 |
-
get_currentuserinfo();
|
1375 |
|
1376 |
-
if ( $
|
1377 |
return false;
|
1378 |
}
|
1379 |
|
1380 |
return true;
|
1381 |
-
|
1382 |
}
|
1383 |
|
1384 |
/**
|
28 |
|
29 |
static function create_gallery($title, $defaultpath, $output = true, $description = '') {
|
30 |
|
31 |
+
$user = wp_get_current_user(); //get current user ID & sets global object $current_user (?well that was get_ucrrentuserinfo did)
|
|
|
|
|
32 |
$name = sanitize_file_name( sanitize_title($title) ); //cleanup pathname
|
33 |
$name = apply_filters('ngg_gallery_name', $name);
|
34 |
|
106 |
|
107 |
//clean the description and add the gallery
|
108 |
$description = nggGallery::suppress_injection($description);
|
109 |
+
$galleryID = nggdb::add_gallery($title, $nggpath, $description, 0, 0, $user->ID);
|
110 |
// here you can inject a custom function
|
111 |
do_action('ngg_created_new_gallery', $galleryID);
|
112 |
|
140 |
/**
|
141 |
* @global nggdb $nggdb
|
142 |
*/
|
143 |
+
global $wpdb, $nggdb;
|
144 |
|
145 |
+
$user=wp_get_current_user(); // get the current user ID
|
|
|
146 |
|
147 |
$created_msg = NULL;
|
148 |
|
201 |
|
202 |
if (!$gallery_id) {
|
203 |
// now add the gallery to the database
|
204 |
+
$gallery_id = nggdb::add_gallery( $galleryname, $galleryfolder, '', 0, 0, $user->ID );
|
205 |
if (!$gallery_id) {
|
206 |
nggGallery::show_error(__('Database error. Could not add gallery!','nggallery'));
|
207 |
return;
|
314 |
return;
|
315 |
|
316 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
|
319 |
/**
|
320 |
* Scan folder for new images
|
1151 |
}
|
1152 |
|
1153 |
/**
|
1154 |
+
* checks data validation when uploading a file. Return '0' if success, else string with error reason.
|
1155 |
*
|
1156 |
* @class nggAdmin
|
1157 |
* @param integer $galleryID
|
1158 |
* @return string $result
|
1159 |
*/
|
1160 |
+
static function check_upload_image($galleryID = 0) {
|
1161 |
|
1162 |
global $nggdb;
|
1163 |
|
1268 |
global $user_ID, $wp_roles;
|
1269 |
|
1270 |
if ( !current_user_can('NextGEN Manage others gallery') ) {
|
1271 |
+
$user=wp_get_current_user(); // get the current user ID
|
|
|
1272 |
|
1273 |
+
if ( $user->ID != $check_ID)
|
1274 |
return false;
|
1275 |
}
|
1276 |
|
1277 |
return true;
|
|
|
1278 |
}
|
1279 |
|
1280 |
/**
|
admin/manage/actions.php
CHANGED
@@ -5,21 +5,20 @@
|
|
5 |
* @access private
|
6 |
*/
|
7 |
|
8 |
-
require_once( '../../ngg-config.php' );
|
9 |
require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
|
10 |
|
11 |
if ( ! is_user_logged_in() || ! current_user_can( 'NextGEN Manage gallery' ) ) {
|
12 |
wp_die( __( 'Cheatin’ uh?' ) );
|
13 |
}
|
14 |
|
15 |
-
$id = (int) $
|
16 |
|
17 |
|
18 |
/**
|
19 |
* Change the output based on which action the user wants to do.
|
20 |
* If you need scripts, you should register them with the parent page.
|
21 |
*/
|
22 |
-
switch ( $
|
23 |
case "rotate":
|
24 |
ngg_rotate( $id );
|
25 |
break;
|
5 |
* @access private
|
6 |
*/
|
7 |
|
|
|
8 |
require_once( NGGALLERY_ABSPATH . '/lib/image.php' );
|
9 |
|
10 |
if ( ! is_user_logged_in() || ! current_user_can( 'NextGEN Manage gallery' ) ) {
|
11 |
wp_die( __( 'Cheatin’ uh?' ) );
|
12 |
}
|
13 |
|
14 |
+
$id = (int) $_POST['id'];
|
15 |
|
16 |
|
17 |
/**
|
18 |
* Change the output based on which action the user wants to do.
|
19 |
* If you need scripts, you should register them with the parent page.
|
20 |
*/
|
21 |
+
switch ( $_POST['cmd'] ) {
|
22 |
case "rotate":
|
23 |
ngg_rotate( $id );
|
24 |
break;
|
admin/manage/class-ngg-abstract-image-manager.php
CHANGED
@@ -20,9 +20,80 @@ abstract class NGG_Abstract_Image_Manager extends NGG_Manager {
|
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
-
* @todo
|
24 |
*/
|
25 |
protected function print_scripts() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
parent::print_scripts();
|
27 |
?>
|
28 |
<script type="text/javascript">
|
@@ -101,13 +172,20 @@ abstract class NGG_Abstract_Image_Manager extends NGG_Manager {
|
|
101 |
global $wpdb, $nggdb;
|
102 |
|
103 |
//TODO:Error message when update failed
|
104 |
-
|
105 |
$description = isset ( $_POST['description'] ) ? sanitize_text_field( $_POST['description']) : array();
|
106 |
$alttext = isset ( $_POST['alttext'] ) ? sanitize_text_field($_POST['alttext']) : array();
|
107 |
$exclude = isset ( $_POST['exclude'] ) ? sanitize_text_field($_POST['exclude']) : false;
|
108 |
$taglist = isset ( $_POST['tags'] ) ? sanitize_text_field($_POST['tags']) : false;
|
109 |
$pictures = isset ( $_POST['pid'] ) ? sanitize_text_field($_POST['pid']) : false;
|
110 |
$date = isset ( $_POST['date'] ) ? sanitize_text_field($_POST['date']) : "NOW()"; //Not sure if NOW() will work or not but in theory it should
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
if ( is_array( $pictures ) ) {
|
113 |
foreach ( $pictures as $pid ) {
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
+
* @todo Attempting to make WP Ajax Standard
|
24 |
*/
|
25 |
protected function print_scripts() {
|
26 |
+
parent::print_scripts();
|
27 |
+
?>
|
28 |
+
<script type="text/javascript">
|
29 |
+
|
30 |
+
|
31 |
+
var defaultAction = function(dialog) {
|
32 |
+
jQuery(dialog).dialog('close');
|
33 |
+
};
|
34 |
+
|
35 |
+
var doAction = defaultAction;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Load the content with AJAX.
|
39 |
+
*/
|
40 |
+
jQuery('a.ngg-dialog').click(function() {
|
41 |
+
//Get the spinner.
|
42 |
+
var $spinner = jQuery("#spinner");
|
43 |
+
var $this = jQuery(this);
|
44 |
+
var current_cmd = $this.data("action");
|
45 |
+
var current_id = $this.data("id");
|
46 |
+
|
47 |
+
if (!$spinner.length) {
|
48 |
+
jQuery("body").append('<div id="spinner"></div>');
|
49 |
+
}
|
50 |
+
|
51 |
+
$spinner.fadeIn();
|
52 |
+
|
53 |
+
var dialog = jQuery('<div style="display:none" class="ngg-load-dialog"></div>').appendTo('body');
|
54 |
+
// load the remote content
|
55 |
+
jQuery.post({
|
56 |
+
url: ajaxurl,
|
57 |
+
data: {action:"image_manager", cmd: current_cmd, id: current_id},
|
58 |
+
success: function(response){
|
59 |
+
dialog.append(response);
|
60 |
+
$spinner.hide(); //jQuery('#spinner').hide();
|
61 |
+
showDialog(dialog, ($this.attr('title')) ? $this.attr('title') : '', doAction);//doAction function must be defined in the actions.php
|
62 |
+
}
|
63 |
+
});
|
64 |
+
|
65 |
+
//prevent the browser to follow the link
|
66 |
+
return false;
|
67 |
+
});
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Show a message on the image action modal window.
|
71 |
+
*
|
72 |
+
* @param message string The message.
|
73 |
+
*/
|
74 |
+
function showMessage(message) {
|
75 |
+
jQuery('#thumbMsg').html(message).css({'display': 'block'});
|
76 |
+
setTimeout(function() {
|
77 |
+
jQuery('#thumbMsg').fadeOut('slow');
|
78 |
+
}, 1500);
|
79 |
+
|
80 |
+
var d = new Date();
|
81 |
+
var $image = jQuery("#imageToEdit");
|
82 |
+
var newUrl = $image.attr("src") + "?" + d.getTime();
|
83 |
+
$image.attr("src", newUrl);
|
84 |
+
}
|
85 |
+
</script>
|
86 |
+
|
87 |
+
<?php
|
88 |
+
}
|
89 |
+
|
90 |
+
|
91 |
+
/*************************************/
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @todo Make this better.
|
95 |
+
*/
|
96 |
+
protected function print_scripts_old() {
|
97 |
parent::print_scripts();
|
98 |
?>
|
99 |
<script type="text/javascript">
|
172 |
global $wpdb, $nggdb;
|
173 |
|
174 |
//TODO:Error message when update failed
|
175 |
+
/*
|
176 |
$description = isset ( $_POST['description'] ) ? sanitize_text_field( $_POST['description']) : array();
|
177 |
$alttext = isset ( $_POST['alttext'] ) ? sanitize_text_field($_POST['alttext']) : array();
|
178 |
$exclude = isset ( $_POST['exclude'] ) ? sanitize_text_field($_POST['exclude']) : false;
|
179 |
$taglist = isset ( $_POST['tags'] ) ? sanitize_text_field($_POST['tags']) : false;
|
180 |
$pictures = isset ( $_POST['pid'] ) ? sanitize_text_field($_POST['pid']) : false;
|
181 |
$date = isset ( $_POST['date'] ) ? sanitize_text_field($_POST['date']) : "NOW()"; //Not sure if NOW() will work or not but in theory it should
|
182 |
+
*/
|
183 |
+
$description = isset ( $_POST['description'] ) ? $_POST['description'] : array();
|
184 |
+
$alttext = isset ( $_POST['alttext'] ) ? $_POST['alttext'] : array();
|
185 |
+
$exclude = isset ( $_POST['exclude'] ) ? $_POST['exclude'] : false;
|
186 |
+
$taglist = isset ( $_POST['tags'] ) ? $_POST['tags'] : false;
|
187 |
+
$pictures = isset ( $_POST['pid'] ) ? $_POST['pid'] : false;
|
188 |
+
$date = isset ( $_POST['date'] ) ? $_POST['date']: "NOW()"; //Not sure if NOW() will work or not but in theory it should
|
189 |
|
190 |
if ( is_array( $pictures ) ) {
|
191 |
foreach ( $pictures as $pid ) {
|
admin/media-upload.php
CHANGED
@@ -22,7 +22,7 @@ function media_upload_nextgen() {
|
|
22 |
|
23 |
// Generate TinyMCE HTML output
|
24 |
if ( isset($_POST['send']) ) {
|
25 |
-
$keys = array_keys(
|
26 |
$send_id = (int) array_shift($keys);
|
27 |
$image = $_POST['image'][$send_id];
|
28 |
$alttext = stripslashes( htmlspecialchars ($image['alttext'], ENT_QUOTES));
|
@@ -35,6 +35,7 @@ function media_upload_nextgen() {
|
|
35 |
$class="ngg-singlepic ngg-{$image['align']}";
|
36 |
|
37 |
// Build output
|
|
|
38 |
if ($image['size'] == "thumbnail")
|
39 |
$html = "<img src='{$image['thumb']}' alt='$alttext' class='$class' />";
|
40 |
// Wrap the link to the fullsize image around
|
22 |
|
23 |
// Generate TinyMCE HTML output
|
24 |
if ( isset($_POST['send']) ) {
|
25 |
+
$keys = array_keys(($_POST['send']));
|
26 |
$send_id = (int) array_shift($keys);
|
27 |
$image = $_POST['image'][$send_id];
|
28 |
$alttext = stripslashes( htmlspecialchars ($image['alttext'], ENT_QUOTES));
|
35 |
$class="ngg-singlepic ngg-{$image['align']}";
|
36 |
|
37 |
// Build output
|
38 |
+
$html="";
|
39 |
if ($image['size'] == "thumbnail")
|
40 |
$html = "<img src='{$image['thumb']}' alt='$alttext' class='$class' />";
|
41 |
// Wrap the link to the fullsize image around
|
admin/tinymce/tiny_mce_popup.js
ADDED
@@ -0,0 +1,544 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* tinymce_mce_popup.js
|
3 |
+
*
|
4 |
+
* Released under LGPL License.
|
5 |
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
6 |
+
*
|
7 |
+
* License: http://www.tinymce.com/license
|
8 |
+
* Contributing: http://www.tinymce.com/contributing
|
9 |
+
*/
|
10 |
+
|
11 |
+
var tinymce, tinyMCE;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* TinyMCE popup/dialog helper class. This gives you easy access to the
|
15 |
+
* parent editor instance and a bunch of other things. It's higly recommended
|
16 |
+
* that you load this script into your dialogs.
|
17 |
+
*
|
18 |
+
* @static
|
19 |
+
* @class tinyMCEPopup
|
20 |
+
*/
|
21 |
+
var tinyMCEPopup = {
|
22 |
+
/**
|
23 |
+
* Initializes the popup this will be called automatically.
|
24 |
+
*
|
25 |
+
* @method init
|
26 |
+
*/
|
27 |
+
init: function () {
|
28 |
+
var self = this, parentWin, settings, uiWindow;
|
29 |
+
|
30 |
+
// Find window & API
|
31 |
+
parentWin = self.getWin();
|
32 |
+
tinymce = tinyMCE = parentWin.tinymce;
|
33 |
+
self.editor = tinymce.EditorManager.activeEditor;
|
34 |
+
self.params = self.editor.windowManager.getParams();
|
35 |
+
|
36 |
+
uiWindow = self.editor.windowManager.windows[self.editor.windowManager.windows.length - 1];
|
37 |
+
self.features = uiWindow.features;
|
38 |
+
self.uiWindow = uiWindow;
|
39 |
+
|
40 |
+
settings = self.editor.settings;
|
41 |
+
|
42 |
+
// Setup popup CSS path(s)
|
43 |
+
if (settings.popup_css !== false) {
|
44 |
+
if (settings.popup_css) {
|
45 |
+
settings.popup_css = self.editor.documentBaseURI.toAbsolute(settings.popup_css);
|
46 |
+
} else {
|
47 |
+
settings.popup_css = self.editor.baseURI.toAbsolute("plugins/compat3x/css/dialog.css");
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
if (settings.popup_css_add) {
|
52 |
+
settings.popup_css += ',' + self.editor.documentBaseURI.toAbsolute(settings.popup_css_add);
|
53 |
+
}
|
54 |
+
|
55 |
+
// Setup local DOM
|
56 |
+
//self.dom = self.editor.windowManager.createInstance('tinymce.plugins.dom.DOMUtils', document, {
|
57 |
+
//Wordrpress bug core https://core.trac.wordpress.org/ticket/41124?cversion=0&cnum_hist=1
|
58 |
+
self.dom = self.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document, {
|
59 |
+
ownEvents: true,
|
60 |
+
proxy: tinyMCEPopup._eventProxy
|
61 |
+
});
|
62 |
+
|
63 |
+
self.dom.bind(window, 'ready', self._onDOMLoaded, self);
|
64 |
+
|
65 |
+
// Enables you to skip loading the default css
|
66 |
+
if (self.features.popup_css !== false) {
|
67 |
+
self.dom.loadCSS(self.features.popup_css || self.editor.settings.popup_css);
|
68 |
+
}
|
69 |
+
|
70 |
+
// Setup on init listeners
|
71 |
+
self.listeners = [];
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Fires when the popup is initialized.
|
75 |
+
*
|
76 |
+
* @event onInit
|
77 |
+
* @param {tinymce.Editor} editor Editor instance.
|
78 |
+
* @example
|
79 |
+
* // Alerts the selected contents when the dialog is loaded
|
80 |
+
* tinyMCEPopup.onInit.add(function(ed) {
|
81 |
+
* alert(ed.selection.getContent());
|
82 |
+
* });
|
83 |
+
*
|
84 |
+
* // Executes the init method on page load in some object using the SomeObject scope
|
85 |
+
* tinyMCEPopup.onInit.add(SomeObject.init, SomeObject);
|
86 |
+
*/
|
87 |
+
self.onInit = {
|
88 |
+
add: function (func, scope) {
|
89 |
+
self.listeners.push({ func: func, scope: scope });
|
90 |
+
}
|
91 |
+
};
|
92 |
+
|
93 |
+
self.isWindow = !self.getWindowArg('mce_inline');
|
94 |
+
self.id = self.getWindowArg('mce_window_id');
|
95 |
+
},
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Returns the reference to the parent window that opened the dialog.
|
99 |
+
*
|
100 |
+
* @method getWin
|
101 |
+
* @return {Window} Reference to the parent window that opened the dialog.
|
102 |
+
*/
|
103 |
+
getWin: function () {
|
104 |
+
// Added frameElement check to fix bug: #2817583
|
105 |
+
return (!window.frameElement && window.dialogArguments) || opener || parent || top;
|
106 |
+
},
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Returns a window argument/parameter by name.
|
110 |
+
*
|
111 |
+
* @method getWindowArg
|
112 |
+
* @param {String} name Name of the window argument to retrieve.
|
113 |
+
* @param {String} defaultValue Optional default value to return.
|
114 |
+
* @return {String} Argument value or default value if it wasn't found.
|
115 |
+
*/
|
116 |
+
getWindowArg: function (name, defaultValue) {
|
117 |
+
var value = this.params[name];
|
118 |
+
|
119 |
+
return tinymce.is(value) ? value : defaultValue;
|
120 |
+
},
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Returns a editor parameter/config option value.
|
124 |
+
*
|
125 |
+
* @method getParam
|
126 |
+
* @param {String} name Name of the editor config option to retrieve.
|
127 |
+
* @param {String} defaultValue Optional default value to return.
|
128 |
+
* @return {String} Parameter value or default value if it wasn't found.
|
129 |
+
*/
|
130 |
+
getParam: function (name, defaultValue) {
|
131 |
+
return this.editor.getParam(name, defaultValue);
|
132 |
+
},
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Returns a language item by key.
|
136 |
+
*
|
137 |
+
* @method getLang
|
138 |
+
* @param {String} name Language item like mydialog.something.
|
139 |
+
* @param {String} defaultValue Optional default value to return.
|
140 |
+
* @return {String} Language value for the item like "my string" or the default value if it wasn't found.
|
141 |
+
*/
|
142 |
+
getLang: function (name, defaultValue) {
|
143 |
+
return this.editor.getLang(name, defaultValue);
|
144 |
+
},
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Executed a command on editor that opened the dialog/popup.
|
148 |
+
*
|
149 |
+
* @method execCommand
|
150 |
+
* @param {String} cmd Command to execute.
|
151 |
+
* @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not.
|
152 |
+
* @param {Object} val Optional value to pass with the comman like an URL.
|
153 |
+
* @param {Object} a Optional arguments object.
|
154 |
+
*/
|
155 |
+
execCommand: function (cmd, ui, val, args) {
|
156 |
+
args = args || {};
|
157 |
+
args.skip_focus = 1;
|
158 |
+
|
159 |
+
this.restoreSelection();
|
160 |
+
return this.editor.execCommand(cmd, ui, val, args);
|
161 |
+
},
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Resizes the dialog to the inner size of the window. This is needed since various browsers
|
165 |
+
* have different border sizes on windows.
|
166 |
+
*
|
167 |
+
* @method resizeToInnerSize
|
168 |
+
*/
|
169 |
+
resizeToInnerSize: function () {
|
170 |
+
/*var self = this;
|
171 |
+
|
172 |
+
// Detach it to workaround a Chrome specific bug
|
173 |
+
// https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281
|
174 |
+
setTimeout(function() {
|
175 |
+
var vp = self.dom.getViewPort(window);
|
176 |
+
|
177 |
+
self.editor.windowManager.resizeBy(
|
178 |
+
self.getWindowArg('mce_width') - vp.w,
|
179 |
+
self.getWindowArg('mce_height') - vp.h,
|
180 |
+
self.id || window
|
181 |
+
);
|
182 |
+
}, 10);*/
|
183 |
+
},
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Will executed the specified string when the page has been loaded. This function
|
187 |
+
* was added for compatibility with the 2.x branch.
|
188 |
+
*
|
189 |
+
* @method executeOnLoad
|
190 |
+
* @param {String} evil String to evalutate on init.
|
191 |
+
*/
|
192 |
+
executeOnLoad: function (evil) {
|
193 |
+
this.onInit.add(function () {
|
194 |
+
eval(evil);
|
195 |
+
});
|
196 |
+
},
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Stores the current editor selection for later restoration. This can be useful since some browsers
|
200 |
+
* looses it's selection if a control element is selected/focused inside the dialogs.
|
201 |
+
*
|
202 |
+
* @method storeSelection
|
203 |
+
*/
|
204 |
+
storeSelection: function () {
|
205 |
+
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
|
206 |
+
},
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Restores any stored selection. This can be useful since some browsers
|
210 |
+
* looses it's selection if a control element is selected/focused inside the dialogs.
|
211 |
+
*
|
212 |
+
* @method restoreSelection
|
213 |
+
*/
|
214 |
+
restoreSelection: function () {
|
215 |
+
var self = tinyMCEPopup;
|
216 |
+
|
217 |
+
if (!self.isWindow && tinymce.isIE) {
|
218 |
+
self.editor.selection.moveToBookmark(self.editor.windowManager.bookmark);
|
219 |
+
}
|
220 |
+
},
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Loads a specific dialog language pack. If you pass in plugin_url as a argument
|
224 |
+
* when you open the window it will load the <plugin url>/langs/<code>_dlg.js lang pack file.
|
225 |
+
*
|
226 |
+
* @method requireLangPack
|
227 |
+
*/
|
228 |
+
requireLangPack: function () {
|
229 |
+
var self = this, url = self.getWindowArg('plugin_url') || self.getWindowArg('theme_url'), settings = self.editor.settings, lang;
|
230 |
+
|
231 |
+
if (settings.language !== false) {
|
232 |
+
lang = settings.language || "en";
|
233 |
+
}
|
234 |
+
|
235 |
+
if (url && lang && self.features.translate_i18n !== false && settings.language_load !== false) {
|
236 |
+
url += '/langs/' + lang + '_dlg.js';
|
237 |
+
|
238 |
+
if (!tinymce.ScriptLoader.isDone(url)) {
|
239 |
+
document.write('<script type="text/javascript" src="' + url + '"></script>');
|
240 |
+
tinymce.ScriptLoader.markDone(url);
|
241 |
+
}
|
242 |
+
}
|
243 |
+
},
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Executes a color picker on the specified element id. When the user
|
247 |
+
* then selects a color it will be set as the value of the specified element.
|
248 |
+
*
|
249 |
+
* @method pickColor
|
250 |
+
* @param {DOMEvent} e DOM event object.
|
251 |
+
* @param {string} element_id Element id to be filled with the color value from the picker.
|
252 |
+
*/
|
253 |
+
pickColor: function (e, element_id) {
|
254 |
+
var el = document.getElementById(element_id), colorPickerCallback = this.editor.settings.color_picker_callback;
|
255 |
+
if (colorPickerCallback) {
|
256 |
+
colorPickerCallback.call(
|
257 |
+
this.editor,
|
258 |
+
function (value) {
|
259 |
+
el.value = value;
|
260 |
+
try {
|
261 |
+
el.onchange();
|
262 |
+
} catch (ex) {
|
263 |
+
// Try fire event, ignore errors
|
264 |
+
}
|
265 |
+
},
|
266 |
+
el.value
|
267 |
+
);
|
268 |
+
}
|
269 |
+
},
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Opens a filebrowser/imagebrowser this will set the output value from
|
273 |
+
* the browser as a value on the specified element.
|
274 |
+
*
|
275 |
+
* @method openBrowser
|
276 |
+
* @param {string} element_id Id of the element to set value in.
|
277 |
+
* @param {string} type Type of browser to open image/file/flash.
|
278 |
+
* @param {string} option Option name to get the file_broswer_callback function name from.
|
279 |
+
*/
|
280 |
+
openBrowser: function (element_id, type) {
|
281 |
+
tinyMCEPopup.restoreSelection();
|
282 |
+
this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
|
283 |
+
},
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Creates a confirm dialog. Please don't use the blocking behavior of this
|
287 |
+
* native version use the callback method instead then it can be extended.
|
288 |
+
*
|
289 |
+
* @method confirm
|
290 |
+
* @param {String} t Title for the new confirm dialog.
|
291 |
+
* @param {function} cb Callback function to be executed after the user has selected ok or cancel.
|
292 |
+
* @param {Object} s Optional scope to execute the callback in.
|
293 |
+
*/
|
294 |
+
confirm: function (t, cb, s) {
|
295 |
+
this.editor.windowManager.confirm(t, cb, s, window);
|
296 |
+
},
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Creates a alert dialog. Please don't use the blocking behavior of this
|
300 |
+
* native version use the callback method instead then it can be extended.
|
301 |
+
*
|
302 |
+
* @method alert
|
303 |
+
* @param {String} tx Title for the new alert dialog.
|
304 |
+
* @param {function} cb Callback function to be executed after the user has selected ok.
|
305 |
+
* @param {Object} s Optional scope to execute the callback in.
|
306 |
+
*/
|
307 |
+
alert: function (tx, cb, s) {
|
308 |
+
this.editor.windowManager.alert(tx, cb, s, window);
|
309 |
+
},
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Closes the current window.
|
313 |
+
*
|
314 |
+
* @method close
|
315 |
+
*/
|
316 |
+
close: function () {
|
317 |
+
var t = this;
|
318 |
+
|
319 |
+
// To avoid domain relaxing issue in Opera
|
320 |
+
function close() {
|
321 |
+
t.editor.windowManager.close(window);
|
322 |
+
tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
|
323 |
+
}
|
324 |
+
|
325 |
+
if (tinymce.isOpera) {
|
326 |
+
t.getWin().setTimeout(close, 0);
|
327 |
+
} else {
|
328 |
+
close();
|
329 |
+
}
|
330 |
+
},
|
331 |
+
|
332 |
+
// Internal functions
|
333 |
+
|
334 |
+
_restoreSelection: function () {
|
335 |
+
var e = window.event.srcElement;
|
336 |
+
|
337 |
+
if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) {
|
338 |
+
tinyMCEPopup.restoreSelection();
|
339 |
+
}
|
340 |
+
},
|
341 |
+
|
342 |
+
/* _restoreSelection : function() {
|
343 |
+
var e = window.event.srcElement;
|
344 |
+
|
345 |
+
// If user focus a non text input or textarea
|
346 |
+
if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
|
347 |
+
tinyMCEPopup.restoreSelection();
|
348 |
+
},*/
|
349 |
+
|
350 |
+
_onDOMLoaded: function () {
|
351 |
+
var t = tinyMCEPopup, ti = document.title, h, nv;
|
352 |
+
|
353 |
+
// Translate page
|
354 |
+
if (t.features.translate_i18n !== false) {
|
355 |
+
var map = {
|
356 |
+
"update": "Ok",
|
357 |
+
"insert": "Ok",
|
358 |
+
"cancel": "Cancel",
|
359 |
+
"not_set": "--",
|
360 |
+
"class_name": "Class name",
|
361 |
+
"browse": "Browse"
|
362 |
+
};
|
363 |
+
|
364 |
+
var langCode = (tinymce.settings ? tinymce.settings : t.editor.settings).language || 'en';
|
365 |
+
for (var key in map) {
|
366 |
+
tinymce.i18n.data[langCode + "." + key] = tinymce.i18n.translate(map[key]);
|
367 |
+
}
|
368 |
+
|
369 |
+
h = document.body.innerHTML;
|
370 |
+
|
371 |
+
// Replace a=x with a="x" in IE
|
372 |
+
if (tinymce.isIE) {
|
373 |
+
h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"');
|
374 |
+
}
|
375 |
+
|
376 |
+
document.dir = t.editor.getParam('directionality', '');
|
377 |
+
|
378 |
+
if ((nv = t.editor.translate(h)) && nv != h) {
|
379 |
+
document.body.innerHTML = nv;
|
380 |
+
}
|
381 |
+
|
382 |
+
if ((nv = t.editor.translate(ti)) && nv != ti) {
|
383 |
+
document.title = ti = nv;
|
384 |
+
}
|
385 |
+
}
|
386 |
+
|
387 |
+
if (!t.editor.getParam('browser_preferred_colors', false) || !t.isWindow) {
|
388 |
+
t.dom.addClass(document.body, 'forceColors');
|
389 |
+
}
|
390 |
+
|
391 |
+
document.body.style.display = '';
|
392 |
+
|
393 |
+
// Restore selection in IE when focus is placed on a non textarea or input element of the type text
|
394 |
+
if (tinymce.Env.ie) {
|
395 |
+
if (tinymce.Env.ie < 11) {
|
396 |
+
document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
|
397 |
+
|
398 |
+
// Add base target element for it since it would fail with modal dialogs
|
399 |
+
t.dom.add(t.dom.select('head')[0], 'base', { target: '_self' });
|
400 |
+
} else {
|
401 |
+
document.addEventListener('mouseup', tinyMCEPopup._restoreSelection, false);
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
t.restoreSelection();
|
406 |
+
t.resizeToInnerSize();
|
407 |
+
|
408 |
+
// Set inline title
|
409 |
+
if (!t.isWindow) {
|
410 |
+
t.editor.windowManager.setTitle(window, ti);
|
411 |
+
} else {
|
412 |
+
window.focus();
|
413 |
+
}
|
414 |
+
|
415 |
+
if (!tinymce.isIE && !t.isWindow) {
|
416 |
+
t.dom.bind(document, 'focus', function () {
|
417 |
+
t.editor.windowManager.focus(t.id);
|
418 |
+
});
|
419 |
+
}
|
420 |
+
|
421 |
+
// Patch for accessibility
|
422 |
+
tinymce.each(t.dom.select('select'), function (e) {
|
423 |
+
e.onkeydown = tinyMCEPopup._accessHandler;
|
424 |
+
});
|
425 |
+
|
426 |
+
// Call onInit
|
427 |
+
// Init must be called before focus so the selection won't get lost by the focus call
|
428 |
+
tinymce.each(t.listeners, function (o) {
|
429 |
+
o.func.call(o.scope, t.editor);
|
430 |
+
});
|
431 |
+
|
432 |
+
// Move focus to window
|
433 |
+
if (t.getWindowArg('mce_auto_focus', true)) {
|
434 |
+
window.focus();
|
435 |
+
|
436 |
+
// Focus element with mceFocus class
|
437 |
+
tinymce.each(document.forms, function (f) {
|
438 |
+
tinymce.each(f.elements, function (e) {
|
439 |
+
if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
|
440 |
+
e.focus();
|
441 |
+
return false; // Break loop
|
442 |
+
}
|
443 |
+
});
|
444 |
+
});
|
445 |
+
}
|
446 |
+
|
447 |
+
document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
|
448 |
+
|
449 |
+
if ('textContent' in document) {
|
450 |
+
t.uiWindow.getEl('head').firstChild.textContent = document.title;
|
451 |
+
} else {
|
452 |
+
t.uiWindow.getEl('head').firstChild.innerText = document.title;
|
453 |
+
}
|
454 |
+
},
|
455 |
+
|
456 |
+
_accessHandler: function (e) {
|
457 |
+
e = e || window.event;
|
458 |
+
|
459 |
+
if (e.keyCode == 13 || e.keyCode == 32) {
|
460 |
+
var elm = e.target || e.srcElement;
|
461 |
+
|
462 |
+
if (elm.onchange) {
|
463 |
+
elm.onchange();
|
464 |
+
}
|
465 |
+
|
466 |
+
return tinymce.dom.Event.cancel(e);
|
467 |
+
}
|
468 |
+
},
|
469 |
+
|
470 |
+
_closeWinKeyHandler: function (e) {
|
471 |
+
e = e || window.event;
|
472 |
+
|
473 |
+
if (e.keyCode == 27) {
|
474 |
+
tinyMCEPopup.close();
|
475 |
+
}
|
476 |
+
},
|
477 |
+
|
478 |
+
_eventProxy: function (id) {
|
479 |
+
return function (evt) {
|
480 |
+
tinyMCEPopup.dom.events.callNativeHandler(id, evt);
|
481 |
+
};
|
482 |
+
}
|
483 |
+
};
|
484 |
+
|
485 |
+
tinyMCEPopup.init();
|
486 |
+
|
487 |
+
tinymce.util.Dispatcher = function (scope) {
|
488 |
+
this.scope = scope || this;
|
489 |
+
this.listeners = [];
|
490 |
+
|
491 |
+
this.add = function (callback, scope) {
|
492 |
+
this.listeners.push({ cb: callback, scope: scope || this.scope });
|
493 |
+
|
494 |
+
return callback;
|
495 |
+
};
|
496 |
+
|
497 |
+
this.addToTop = function (callback, scope) {
|
498 |
+
var self = this, listener = { cb: callback, scope: scope || self.scope };
|
499 |
+
|
500 |
+
// Create new listeners if addToTop is executed in a dispatch loop
|
501 |
+
if (self.inDispatch) {
|
502 |
+
self.listeners = [listener].concat(self.listeners);
|
503 |
+
} else {
|
504 |
+
self.listeners.unshift(listener);
|
505 |
+
}
|
506 |
+
|
507 |
+
return callback;
|
508 |
+
};
|
509 |
+
|
510 |
+
this.remove = function (callback) {
|
511 |
+
var listeners = this.listeners, output = null;
|
512 |
+
|
513 |
+
tinymce.each(listeners, function (listener, i) {
|
514 |
+
if (callback == listener.cb) {
|
515 |
+
output = listener;
|
516 |
+
listeners.splice(i, 1);
|
517 |
+
return false;
|
518 |
+
}
|
519 |
+
});
|
520 |
+
|
521 |
+
return output;
|
522 |
+
};
|
523 |
+
|
524 |
+
this.dispatch = function () {
|
525 |
+
var self = this, returnValue, args = arguments, i, listeners = self.listeners, listener;
|
526 |
+
|
527 |
+
self.inDispatch = true;
|
528 |
+
|
529 |
+
// Needs to be a real loop since the listener count might change while looping
|
530 |
+
// And this is also more efficient
|
531 |
+
for (i = 0; i < listeners.length; i++) {
|
532 |
+
listener = listeners[i];
|
533 |
+
returnValue = listener.cb.apply(listener.scope, args.length > 0 ? args : [listener.scope]);
|
534 |
+
|
535 |
+
if (returnValue === false) {
|
536 |
+
break;
|
537 |
+
}
|
538 |
+
}
|
539 |
+
|
540 |
+
self.inDispatch = false;
|
541 |
+
|
542 |
+
return returnValue;
|
543 |
+
};
|
544 |
+
};
|
admin/tinymce/tinymce.php
CHANGED
@@ -21,7 +21,7 @@ class add_nextgen_button {
|
|
21 |
*
|
22 |
* @return void
|
23 |
*/
|
24 |
-
function
|
25 |
|
26 |
// Set path to editor_plugin.js
|
27 |
$this->path = NGGALLERY_URLPATH . 'admin/tinymce/';
|
21 |
*
|
22 |
* @return void
|
23 |
*/
|
24 |
+
function __construct() {
|
25 |
|
26 |
// Set path to editor_plugin.js
|
27 |
$this->path = NGGALLERY_URLPATH . 'admin/tinymce/';
|
admin/tinymce/utils/mctabs.js
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* mctabs.js
|
3 |
+
*
|
4 |
+
* Released under LGPL License.
|
5 |
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
6 |
+
*
|
7 |
+
* License: http://www.tinymce.com/license
|
8 |
+
* Contributing: http://www.tinymce.com/contributing
|
9 |
+
*/
|
10 |
+
|
11 |
+
/*jshint globals: tinyMCEPopup */
|
12 |
+
|
13 |
+
function MCTabs() {
|
14 |
+
this.settings = [];
|
15 |
+
//Wordpress bug core
|
16 |
+
//https://core.trac.wordpress.org/ticket/41124?cversion=0&cnum_hist=1
|
17 |
+
//this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.plugins.util.Dispatcher');
|
18 |
+
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
|
19 |
+
}
|
20 |
+
|
21 |
+
MCTabs.prototype.init = function (settings) {
|
22 |
+
this.settings = settings;
|
23 |
+
};
|
24 |
+
|
25 |
+
MCTabs.prototype.getParam = function (name, default_value) {
|
26 |
+
var value = null;
|
27 |
+
|
28 |
+
value = (typeof (this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
29 |
+
|
30 |
+
// Fix bool values
|
31 |
+
if (value == "true" || value == "false") {
|
32 |
+
return (value == "true");
|
33 |
+
}
|
34 |
+
|
35 |
+
return value;
|
36 |
+
};
|
37 |
+
|
38 |
+
MCTabs.prototype.showTab = function (tab) {
|
39 |
+
tab.className = 'current';
|
40 |
+
tab.setAttribute("aria-selected", true);
|
41 |
+
tab.setAttribute("aria-expanded", true);
|
42 |
+
tab.tabIndex = 0;
|
43 |
+
};
|
44 |
+
|
45 |
+
MCTabs.prototype.hideTab = function (tab) {
|
46 |
+
var t = this;
|
47 |
+
|
48 |
+
tab.className = '';
|
49 |
+
tab.setAttribute("aria-selected", false);
|
50 |
+
tab.setAttribute("aria-expanded", false);
|
51 |
+
tab.tabIndex = -1;
|
52 |
+
};
|
53 |
+
|
54 |
+
MCTabs.prototype.showPanel = function (panel) {
|
55 |
+
panel.className = 'current';
|
56 |
+
panel.setAttribute("aria-hidden", false);
|
57 |
+
};
|
58 |
+
|
59 |
+
MCTabs.prototype.hidePanel = function (panel) {
|
60 |
+
panel.className = 'panel';
|
61 |
+
panel.setAttribute("aria-hidden", true);
|
62 |
+
};
|
63 |
+
|
64 |
+
MCTabs.prototype.getPanelForTab = function (tabElm) {
|
65 |
+
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
|
66 |
+
};
|
67 |
+
|
68 |
+
MCTabs.prototype.displayTab = function (tab_id, panel_id, avoid_focus) {
|
69 |
+
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
|
70 |
+
|
71 |
+
tabElm = document.getElementById(tab_id);
|
72 |
+
|
73 |
+
if (panel_id === undefined) {
|
74 |
+
panel_id = t.getPanelForTab(tabElm);
|
75 |
+
}
|
76 |
+
|
77 |
+
panelElm = document.getElementById(panel_id);
|
78 |
+
panelContainerElm = panelElm ? panelElm.parentNode : null;
|
79 |
+
tabContainerElm = tabElm ? tabElm.parentNode : null;
|
80 |
+
selectionClass = t.getParam('selection_class', 'current');
|
81 |
+
|
82 |
+
if (tabElm && tabContainerElm) {
|
83 |
+
nodes = tabContainerElm.childNodes;
|
84 |
+
|
85 |
+
// Hide all other tabs
|
86 |
+
for (i = 0; i < nodes.length; i++) {
|
87 |
+
if (nodes[i].nodeName == "LI") {
|
88 |
+
t.hideTab(nodes[i]);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
// Show selected tab
|
93 |
+
t.showTab(tabElm);
|
94 |
+
}
|
95 |
+
|
96 |
+
if (panelElm && panelContainerElm) {
|
97 |
+
nodes = panelContainerElm.childNodes;
|
98 |
+
|
99 |
+
// Hide all other panels
|
100 |
+
for (i = 0; i < nodes.length; i++) {
|
101 |
+
if (nodes[i].nodeName == "DIV") {
|
102 |
+
t.hidePanel(nodes[i]);
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
if (!avoid_focus) {
|
107 |
+
tabElm.focus();
|
108 |
+
}
|
109 |
+
|
110 |
+
// Show selected panel
|
111 |
+
t.showPanel(panelElm);
|
112 |
+
}
|
113 |
+
};
|
114 |
+
|
115 |
+
MCTabs.prototype.getAnchor = function () {
|
116 |
+
var pos, url = document.location.href;
|
117 |
+
|
118 |
+
if ((pos = url.lastIndexOf('#')) != -1) {
|
119 |
+
return url.substring(pos + 1);
|
120 |
+
}
|
121 |
+
|
122 |
+
return "";
|
123 |
+
};
|
124 |
+
|
125 |
+
|
126 |
+
//Global instance
|
127 |
+
var mcTabs = new MCTabs();
|
128 |
+
|
129 |
+
tinyMCEPopup.onInit.add(function () {
|
130 |
+
var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
|
131 |
+
|
132 |
+
each(dom.select('div.tabs'), function (tabContainerElm) {
|
133 |
+
//var keyNav;
|
134 |
+
|
135 |
+
dom.setAttrib(tabContainerElm, "role", "tablist");
|
136 |
+
|
137 |
+
var items = tinyMCEPopup.dom.select('li', tabContainerElm);
|
138 |
+
var action = function (id) {
|
139 |
+
mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
|
140 |
+
mcTabs.onChange.dispatch(id);
|
141 |
+
};
|
142 |
+
|
143 |
+
each(items, function (item) {
|
144 |
+
dom.setAttrib(item, 'role', 'tab');
|
145 |
+
dom.bind(item, 'click', function (evt) {
|
146 |
+
action(item.id);
|
147 |
+
});
|
148 |
+
});
|
149 |
+
|
150 |
+
dom.bind(dom.getRoot(), 'keydown', function (evt) {
|
151 |
+
if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
|
152 |
+
//keyNav.moveFocus(evt.shiftKey ? -1 : 1);
|
153 |
+
tinymce.dom.Event.cancel(evt);
|
154 |
+
}
|
155 |
+
});
|
156 |
+
|
157 |
+
each(dom.select('a', tabContainerElm), function (a) {
|
158 |
+
dom.setAttrib(a, 'tabindex', '-1');
|
159 |
+
});
|
160 |
+
|
161 |
+
/*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.plugins.ui.KeyboardNavigation', {
|
162 |
+
root: tabContainerElm,
|
163 |
+
items: items,
|
164 |
+
onAction: action,
|
165 |
+
actOnFocus: true,
|
166 |
+
enableLeftRight: true,
|
167 |
+
enableUpDown: true
|
168 |
+
}, tinyMCEPopup.dom);*/
|
169 |
+
}
|
170 |
+
);
|
171 |
+
});
|
admin/upgrade.php
CHANGED
@@ -5,10 +5,8 @@
|
|
5 |
*/
|
6 |
function ngg_upgrade() {
|
7 |
|
8 |
-
global $wpdb
|
9 |
|
10 |
-
// get the current user ID
|
11 |
-
get_currentuserinfo();
|
12 |
|
13 |
// in multisite environment the pointer $wpdb->nggpictures need to be set again
|
14 |
$wpdb->nggpictures = $wpdb->prefix . 'ngg_pictures';
|
@@ -75,6 +73,8 @@ function ngg_upgrade() {
|
|
75 |
$ngg_options['irNumber'] = 20;
|
76 |
$ngg_options['irClick'] = true;
|
77 |
$ngg_options['silentUpgrade'] = false;
|
|
|
|
|
78 |
|
79 |
//Convert color
|
80 |
$ngg_options['wmColor'] = '#' . $ngg_options['wmColor'];
|
5 |
*/
|
6 |
function ngg_upgrade() {
|
7 |
|
8 |
+
global $wpdb;
|
9 |
|
|
|
|
|
10 |
|
11 |
// in multisite environment the pointer $wpdb->nggpictures need to be set again
|
12 |
$wpdb->nggpictures = $wpdb->prefix . 'ngg_pictures';
|
73 |
$ngg_options['irNumber'] = 20;
|
74 |
$ngg_options['irClick'] = true;
|
75 |
$ngg_options['silentUpgrade'] = false;
|
76 |
+
$ngg_options['thumbDifferentSize'] = false;
|
77 |
+
|
78 |
|
79 |
//Convert color
|
80 |
$ngg_options['wmColor'] = '#' . $ngg_options['wmColor'];
|
admin/upload.php
CHANGED
@@ -44,6 +44,6 @@ include_once (NGGALLERY_ABSPATH. 'admin/functions.php');
|
|
44 |
// get the gallery
|
45 |
$galleryID = (int) $_POST['galleryselect'];
|
46 |
|
47 |
-
echo nggAdmin::
|
48 |
|
49 |
?>
|
44 |
// get the gallery
|
45 |
$galleryID = (int) $_POST['galleryselect'];
|
46 |
|
47 |
+
echo nggAdmin::check_upload_image($galleryID);
|
48 |
|
49 |
?>
|
lib/gd.thumbnail.inc.php
CHANGED
@@ -112,7 +112,7 @@ class ngg_Thumbnail {
|
|
112 |
* @var string
|
113 |
*
|
114 |
*/
|
115 |
-
function
|
116 |
//make sure the GD library is installed
|
117 |
if(!function_exists("gd_info")) {
|
118 |
echo 'You do not have the GD Library installed. This class requires the GD library to function properly.' . "\n";
|
@@ -173,13 +173,13 @@ class ngg_Thumbnail {
|
|
173 |
|
174 |
switch($this->format) {
|
175 |
case 'GIF':
|
176 |
-
$this->oldImage =
|
177 |
break;
|
178 |
case 'JPG':
|
179 |
-
|
180 |
break;
|
181 |
case 'PNG':
|
182 |
-
$this->oldImage =
|
183 |
break;
|
184 |
}
|
185 |
if (!$this->oldImage) {
|
112 |
* @var string
|
113 |
*
|
114 |
*/
|
115 |
+
function __construct($fileName,$no_ErrorImage = false) {
|
116 |
//make sure the GD library is installed
|
117 |
if(!function_exists("gd_info")) {
|
118 |
echo 'You do not have the GD Library installed. This class requires the GD library to function properly.' . "\n";
|
173 |
|
174 |
switch($this->format) {
|
175 |
case 'GIF':
|
176 |
+
$this->oldImage = imagecreatefromgif($this->fileName);
|
177 |
break;
|
178 |
case 'JPG':
|
179 |
+
$this->oldImage = imagecreatefromjpeg($this->fileName);
|
180 |
break;
|
181 |
case 'PNG':
|
182 |
+
$this->oldImage = imagecreatefrompng($this->fileName);
|
183 |
break;
|
184 |
}
|
185 |
if (!$this->oldImage) {
|
lib/image.php
CHANGED
@@ -47,7 +47,7 @@ class nggImage{
|
|
47 |
* @param object $gallery The nggGallery object representing the gallery containing this image
|
48 |
* @return void
|
49 |
*/
|
50 |
-
function
|
51 |
|
52 |
//This must be an object
|
53 |
$gallery = (object) $gallery;
|
47 |
* @param object $gallery The nggGallery object representing the gallery containing this image
|
48 |
* @return void
|
49 |
*/
|
50 |
+
function __construct($gallery) {
|
51 |
|
52 |
//This must be an object
|
53 |
$gallery = (object) $gallery;
|
lib/meta.php
CHANGED
@@ -30,7 +30,7 @@ class nggMeta{
|
|
30 |
* @param bool $onlyEXIF parse only exif if needed
|
31 |
* @return
|
32 |
*/
|
33 |
-
function
|
34 |
|
35 |
//get the path and other data about the image
|
36 |
$this->image = nggdb::find_image( $pic_id );
|
30 |
* @param bool $onlyEXIF parse only exif if needed
|
31 |
* @return
|
32 |
*/
|
33 |
+
function __construct($pic_id, $onlyEXIF = false) {
|
34 |
|
35 |
//get the path and other data about the image
|
36 |
$this->image = nggdb::find_image( $pic_id );
|
lib/rewrite.php
CHANGED
@@ -32,7 +32,7 @@ class nggRewrite {
|
|
32 |
/**
|
33 |
* Constructor
|
34 |
*/
|
35 |
-
function
|
36 |
|
37 |
// read the option setting
|
38 |
$this->options = get_option('ngg_options');
|
32 |
/**
|
33 |
* Constructor
|
34 |
*/
|
35 |
+
function __construct() {
|
36 |
|
37 |
// read the option setting
|
38 |
$this->options = get_option('ngg_options');
|
ngg-config.php
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Bootstrap file for getting the ABSPATH constant to wp-load.php
|
4 |
-
* This is requried when a plugin requires access not via the admin screen.
|
5 |
-
*
|
6 |
-
* If the wp-load.php file is not found, then an error will be displayed
|
7 |
-
*
|
8 |
-
* @package WordPress
|
9 |
-
* @since Version 2.6
|
10 |
-
*/
|
11 |
-
|
12 |
-
/** Define the server path to the file wp-config here, if you placed WP-CONTENT outside the classic file structure */
|
13 |
-
|
14 |
-
/*
|
15 |
-
$path = ''; // It should be end with a trailing slash
|
16 |
-
*/
|
17 |
-
|
18 |
-
/** That's all, stop editing from here **/
|
19 |
-
/*
|
20 |
-
if ( !defined('WP_LOAD_PATH') ) {
|
21 |
-
|
22 |
-
//classic root path if wp-content and plugins is below wp-config.php
|
23 |
-
$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
|
24 |
-
|
25 |
-
if (file_exists( $classic_root . 'wp-load.php') )
|
26 |
-
define( 'WP_LOAD_PATH', $classic_root);
|
27 |
-
else
|
28 |
-
if (file_exists( $path . 'wp-load.php') )
|
29 |
-
define( 'WP_LOAD_PATH', $path);
|
30 |
-
else
|
31 |
-
exit("Could not find wp-load.php");
|
32 |
-
}
|
33 |
-
|
34 |
-
// let's load WordPress
|
35 |
-
require_once( WP_LOAD_PATH . 'wp-load.php');
|
36 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, Niknetniko based on Alex Rabe & PhotoCrati work.
|
7 |
Author URI: http://www.wpgetready.com
|
8 |
-
Version: 1.9.
|
9 |
|
10 |
Copyright (c) 2007-2011 by Alex Rabe & NextGEN DEV-Team
|
11 |
Copyright (c) 2012 Photocrati Media
|
@@ -53,7 +53,7 @@ if (!class_exists('nggLoader')) {
|
|
53 |
*/
|
54 |
class nggLoader {
|
55 |
|
56 |
-
var $version = '1.9.
|
57 |
var $dbversion = '1.8.3';
|
58 |
var $minimum_WP = '4.0';
|
59 |
var $options = '';
|
@@ -63,7 +63,7 @@ if (!class_exists('nggLoader')) {
|
|
63 |
/**
|
64 |
* class constructor
|
65 |
*/
|
66 |
-
function
|
67 |
|
68 |
// Stop the plugin if we missed the requirements
|
69 |
if ( ( !$this->required_version() ) || ( !$this->check_memory_limit() ) )
|
@@ -185,16 +185,14 @@ if (!class_exists('nggLoader')) {
|
|
185 |
/**
|
186 |
* Look for XML request
|
187 |
* @param $wp
|
|
|
188 |
*/
|
189 |
function check_request( $wp ) {
|
190 |
|
191 |
if ( !array_key_exists('callback', $wp->query_vars) )
|
192 |
return;
|
193 |
|
194 |
-
|
195 |
-
require_once (dirname (__FILE__) . '/xml/imagerotator.php');
|
196 |
-
exit();
|
197 |
-
}
|
198 |
|
199 |
if ( $wp->query_vars['callback'] == 'json') {
|
200 |
require_once (dirname (__FILE__) . '/xml/json.php');
|
5 |
Description: A Photo Gallery for WordPress providing NextGEN legacy compatibility from version 1.9.13
|
6 |
Author: WPGReady, Niknetniko based on Alex Rabe & PhotoCrati work.
|
7 |
Author URI: http://www.wpgetready.com
|
8 |
+
Version: 1.9.33
|
9 |
|
10 |
Copyright (c) 2007-2011 by Alex Rabe & NextGEN DEV-Team
|
11 |
Copyright (c) 2012 Photocrati Media
|
53 |
*/
|
54 |
class nggLoader {
|
55 |
|
56 |
+
var $version = '1.9.33';
|
57 |
var $dbversion = '1.8.3';
|
58 |
var $minimum_WP = '4.0';
|
59 |
var $options = '';
|
63 |
/**
|
64 |
* class constructor
|
65 |
*/
|
66 |
+
function __construct() {
|
67 |
|
68 |
// Stop the plugin if we missed the requirements
|
69 |
if ( ( !$this->required_version() ) || ( !$this->check_memory_limit() ) )
|
185 |
/**
|
186 |
* Look for XML request
|
187 |
* @param $wp
|
188 |
+
* 20170920: Deprecated imagerotator.php
|
189 |
*/
|
190 |
function check_request( $wp ) {
|
191 |
|
192 |
if ( !array_key_exists('callback', $wp->query_vars) )
|
193 |
return;
|
194 |
|
195 |
+
|
|
|
|
|
|
|
196 |
|
197 |
if ( $wp->query_vars['callback'] == 'json') {
|
198 |
require_once (dirname (__FILE__) . '/xml/json.php');
|
nggshow.php
CHANGED
@@ -1,9 +1,4 @@
|
|
1 |
<?php
|
2 |
-
// Load wp-config
|
3 |
-
|
4 |
-
if ( !defined('ABSPATH') )
|
5 |
-
require_once( dirname(__FILE__) . '/ngg-config.php');
|
6 |
-
|
7 |
// reference thumbnail class
|
8 |
include_once( nggGallery::graphic_library() );
|
9 |
include_once('lib/core.php');
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
// reference thumbnail class
|
3 |
include_once( nggGallery::graphic_library() );
|
4 |
include_once('lib/core.php');
|
readme.txt
CHANGED
@@ -2,19 +2,24 @@
|
|
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: 4.0
|
5 |
-
Tested up to: 4.
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2
|
8 |
|
9 |
== Description ==
|
10 |
|
11 |
-
=
|
12 |
|
13 |
What's in it for you?
|
14 |
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
VERY IMPORTANT: Read ON!
|
20 |
-----------------------
|
@@ -43,15 +48,14 @@ VERY IMPORTANT: Read ON!
|
|
43 |
|
44 |
= What do you get with NextCellent Gallery? =
|
45 |
|
46 |
-
-
|
|
|
47 |
|
48 |
-
-
|
49 |
|
50 |
-
-
|
51 |
-
|
52 |
-
- A place for updating the plugin without using FTP manual updates, but Wordpress plugin repository.
|
53 |
|
54 |
-
-
|
55 |
|
56 |
- **Development on Bitbucket open to developers suggestions**. (https://bitbucket.org/wpgetready/nextcellent). You are free to download , test and make suggestions and requests.
|
57 |
|
@@ -91,7 +95,7 @@ As a result, there is large and great community of users and developers, as well
|
|
91 |
== Credits ==
|
92 |
|
93 |
Copyright:<br>
|
94 |
-
WpGetReady 2013-
|
95 |
Photocrati Media 2012<br>
|
96 |
Alex Rabe 2007-2011<br>
|
97 |
|
@@ -101,10 +105,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
101 |
|
102 |
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
103 |
|
104 |
-
** Please note **
|
105 |
-
|
106 |
-
NextCellent Gallery's flash slideshow option is powered by the JW Image Rotator from Long Tail Video. The Image Rotator is NOT provided with this plugin. For more information, see the Long Tail Video website: http://www.longtailvideo.com.
|
107 |
-
|
108 |
== Installation ==
|
109 |
|
110 |
1. Download, and install from the usual Wordpress Panel.
|
@@ -128,7 +128,7 @@ That's it ... have fun!
|
|
128 |
|
129 |
== Shortcode ==
|
130 |
|
131 |
-
NextCellent Plugin Shortcodes
|
132 |
|
133 |
= Examples =
|
134 |
|
@@ -168,6 +168,7 @@ NextCellent Plugin Shortcodes are 100% backward compatible with older NGG shortc
|
|
168 |
- Plugin will deactivate if you install and activate any NextGEN version (any version).
|
169 |
- Minimal text changes to let the user know what plugin is running. This would affect translated texts in some cases.
|
170 |
- Lot of fixes
|
|
|
171 |
|
172 |
= What are the SIGNIFICATIVE differences between this NextCellent and NextGEN 2.x.x? =
|
173 |
|
@@ -208,7 +209,7 @@ NextCellent Plugin Shortcodes are 100% backward compatible with older NGG shortc
|
|
208 |
|
209 |
= I have NextGEN 1.9.13 or older, should I install NextCellent? =
|
210 |
|
211 |
-
- **YES** if you want an improved version
|
212 |
|
213 |
= If I have NextGEN 2.x.x, should I install NextCellent? =
|
214 |
|
@@ -272,10 +273,12 @@ Why then the name NextCellent instead NextGEN Legacy for example? =
|
|
272 |
|
273 |
The reason is very simple: I cannot include non-GPL compatible code inside the plugin , according Wordpress.org policies.
|
274 |
But you can. Please download it from http://www.longtailvideo.com and put in the plugin's root.
|
|
|
275 |
|
276 |
= Are the galleries flash based? =
|
277 |
|
278 |
NextCellent Gallery uses Javascript (J-Query) based displays to ensure compatibility across the widest range of displays possible.
|
|
|
279 |
|
280 |
= Are the galleries mobile friendly? =
|
281 |
|
@@ -315,7 +318,7 @@ Yes, since we use Javascript rather than flash, NextCellent Gallery is compatibl
|
|
315 |
|
316 |
= Can I add an external links to galleries? =
|
317 |
|
318 |
-
- Since the captions are fully HTML capable, you can add external links and any other type of mark up you wish.
|
319 |
|
320 |
= Is NextCellent Gallery available in foreign languages? =
|
321 |
|
@@ -324,13 +327,23 @@ Yes, since we use Javascript rather than flash, NextCellent Gallery is compatibl
|
|
324 |
|
325 |
== Changelog ==
|
326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
= 19.32 - 2017-07-12 = Vulnerability FIX
|
328 |
|
329 |
* Fixed few vulnerabilities that turned the plugin down on the repository
|
330 |
* Disabled temporarily upload zip files when creating galleries for vulnerability reasons
|
331 |
* Enforced parameter checking in many places.
|
332 |
|
333 |
-
|
334 |
= 1.9.31 - 2016-02-09 = FIX
|
335 |
|
336 |
* Added more help documentation
|
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: 4.0
|
5 |
+
Tested up to: 4.8.2
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2
|
8 |
|
9 |
== Description ==
|
10 |
|
11 |
+
= 1.9.33 - 2017-09-23 = Fixes for 1.9.32
|
12 |
|
13 |
What's in it for you?
|
14 |
|
15 |
+
* fix: issue around WP last version prevent from window popup opening.
|
16 |
+
* fix: internal issue prevent refer images using Media Add
|
17 |
+
* fix: removed (finally) dependency with AJAX and wp-load.php. Rotation, and thumbnail should work fine.
|
18 |
+
* fix: issues preventing to display correctly.
|
19 |
+
* fix: Class constructor warning on PHP 7.1 and aboved
|
20 |
+
* deprecadted: imagerotator.swf: older Nextcellent version depend on Flash part, now replaced with html counterpart
|
21 |
+
* deprecated: Nextcellent is plupload instead is using swfUpload. For legacy code reasons only swfUpload is mentined but not used.
|
22 |
+
* improve: core Ajax call simplified
|
23 |
|
24 |
VERY IMPORTANT: Read ON!
|
25 |
-----------------------
|
48 |
|
49 |
= What do you get with NextCellent Gallery? =
|
50 |
|
51 |
+
- This is a compatibility branch with the older NextGen 1.9.13. As such, it will steadily improving and keeping update with software upgrades.
|
52 |
+
For example, Nextcellent is not supporting Flash slideshow as 2017 for vulnerability reasons. In the same way Nextcellent should work fine with PHP 7.
|
53 |
|
54 |
+
- Backward compatibility with NextGEN plugin version (1.9.13). When we say 'backward' we mean to software level: most filters, actions and shortcodes should work.
|
55 |
|
56 |
+
- Slow evolving code path. Yep, you read it right: *slow* in counterpart as *fast*. Older code is good enough to keep a community and it worked (and works) for most people. Versions will rollup about once a month. There is another reason for that: we don't have resources to keep a fast pace. So we'll try to improve the code as much as possible, keeping a stable plugin instead developing new features here and there.
|
|
|
|
|
57 |
|
58 |
+
- A reliable way to work with already installed NextGEN galleries.
|
59 |
|
60 |
- **Development on Bitbucket open to developers suggestions**. (https://bitbucket.org/wpgetready/nextcellent). You are free to download , test and make suggestions and requests.
|
61 |
|
95 |
== Credits ==
|
96 |
|
97 |
Copyright:<br>
|
98 |
+
WpGetReady 2013-2017<br>
|
99 |
Photocrati Media 2012<br>
|
100 |
Alex Rabe 2007-2011<br>
|
101 |
|
105 |
|
106 |
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
107 |
|
|
|
|
|
|
|
|
|
108 |
== Installation ==
|
109 |
|
110 |
1. Download, and install from the usual Wordpress Panel.
|
128 |
|
129 |
== Shortcode ==
|
130 |
|
131 |
+
NextCellent Plugin Shortcodes should be backward compatible with older NGG shortcodes.
|
132 |
|
133 |
= Examples =
|
134 |
|
168 |
- Plugin will deactivate if you install and activate any NextGEN version (any version).
|
169 |
- Minimal text changes to let the user know what plugin is running. This would affect translated texts in some cases.
|
170 |
- Lot of fixes
|
171 |
+
- Faster
|
172 |
|
173 |
= What are the SIGNIFICATIVE differences between this NextCellent and NextGEN 2.x.x? =
|
174 |
|
209 |
|
210 |
= I have NextGEN 1.9.13 or older, should I install NextCellent? =
|
211 |
|
212 |
+
- **YES** if you want an improved version of the older NextGEN.
|
213 |
|
214 |
= If I have NextGEN 2.x.x, should I install NextCellent? =
|
215 |
|
273 |
|
274 |
The reason is very simple: I cannot include non-GPL compatible code inside the plugin , according Wordpress.org policies.
|
275 |
But you can. Please download it from http://www.longtailvideo.com and put in the plugin's root.
|
276 |
+
UPDATE: Nextcellent ceased support for imagerotator.swef
|
277 |
|
278 |
= Are the galleries flash based? =
|
279 |
|
280 |
NextCellent Gallery uses Javascript (J-Query) based displays to ensure compatibility across the widest range of displays possible.
|
281 |
+
For security reasons, Nextcellente ceased supporting Flash sliders.
|
282 |
|
283 |
= Are the galleries mobile friendly? =
|
284 |
|
318 |
|
319 |
= Can I add an external links to galleries? =
|
320 |
|
321 |
+
- Yes,Since the captions are fully HTML capable, you can add external links and any other type of mark up you wish.
|
322 |
|
323 |
= Is NextCellent Gallery available in foreign languages? =
|
324 |
|
327 |
|
328 |
== Changelog ==
|
329 |
|
330 |
+
= 1.9.33 - 2017-09-23 = Fixes for 1.9.32
|
331 |
+
|
332 |
+
* fix: issue around WP last version prevent from window popup opening.
|
333 |
+
* fix: internal issue prevent refer images using Media Add
|
334 |
+
* fix: removed (finally) dependency with AJAX and wp-load.php. Rotation, and thumbnail should work fine.
|
335 |
+
* fix: issues preventing to display correctly.
|
336 |
+
* fix: Class constructor warning on PHP 7.1 and aboved
|
337 |
+
* deprecated: imagerotator.swf: older Nextcellent version depend on Flash part, now replaced with html counterpart
|
338 |
+
* deprecated: Nextcellent is plupload instead is using swfUpload. For legacy code reasons only swfUpload is mentined but not used.
|
339 |
+
* improved: core Ajax call simplified
|
340 |
+
|
341 |
= 19.32 - 2017-07-12 = Vulnerability FIX
|
342 |
|
343 |
* Fixed few vulnerabilities that turned the plugin down on the repository
|
344 |
* Disabled temporarily upload zip files when creating galleries for vulnerability reasons
|
345 |
* Enforced parameter checking in many places.
|
346 |
|
|
|
347 |
= 1.9.31 - 2016-02-09 = FIX
|
348 |
|
349 |
* Added more help documentation
|
xml/imagerotator.php
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
+----------------------------------------------------------------+
|
5 |
-
+ imageRotartor-XML
|
6 |
-
+ by Alex Rabe
|
7 |
-
+ required for NextGEN Gallery
|
8 |
-
+----------------------------------------------------------------+
|
9 |
-
*/
|
10 |
-
|
11 |
-
// look up for the path
|
12 |
-
if ( !defined('ABSPATH') )
|
13 |
-
require_once( dirname(__FILE__) . '/../ngg-config.php');
|
14 |
-
|
15 |
-
global $wpdb;
|
16 |
-
|
17 |
-
$ngg_options = get_option ('ngg_options');
|
18 |
-
$siteurl = site_url();
|
19 |
-
|
20 |
-
// get the gallery id
|
21 |
-
$galleryID = (int) $_GET['gid'];
|
22 |
-
|
23 |
-
// get the pictures
|
24 |
-
if ($galleryID == 0) {
|
25 |
-
$thepictures = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 ORDER BY tt.{$ngg_options['galSort']} {$ngg_options['galSortDir']} ");
|
26 |
-
} else {
|
27 |
-
$thepictures = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid WHERE t.gid = '$galleryID' AND tt.exclude != 1 ORDER BY tt.{$ngg_options['galSort']} {$ngg_options['galSortDir']} ");
|
28 |
-
}
|
29 |
-
|
30 |
-
// Create XML output
|
31 |
-
header("content-type:text/xml;charset=utf-8");
|
32 |
-
|
33 |
-
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
|
34 |
-
echo " <title>".stripslashes(nggGallery::i18n($thepictures[0]->name))."</title>\n";
|
35 |
-
echo " <trackList>\n";
|
36 |
-
|
37 |
-
if (is_array ($thepictures)){
|
38 |
-
foreach ($thepictures as $picture) {
|
39 |
-
echo " <track>\n";
|
40 |
-
if (!empty($picture->description))
|
41 |
-
echo " <title>".strip_tags(stripslashes(html_entity_decode(nggGallery::i18n($picture->description, 'pic_' . $picture->pid . '_description'))))."</title>\n";
|
42 |
-
else if (!empty($picture->alttext))
|
43 |
-
echo " <title>".stripslashes(nggGallery::i18n($picture->alttext, 'pic_' . $picture->pid . '_alttext'))."</title>\n";
|
44 |
-
else
|
45 |
-
echo " <title>".$picture->filename."</title>\n";
|
46 |
-
echo " <location>".$siteurl."/".$picture->path."/".$picture->filename."</location>\n";
|
47 |
-
echo " </track>\n";
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
echo " </trackList>\n";
|
52 |
-
echo "</playlist>\n";
|
53 |
-
|
54 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xml/media-rss.php
CHANGED
@@ -23,8 +23,6 @@
|
|
23 |
* @param aid The album ID to show
|
24 |
*/
|
25 |
|
26 |
-
// Load required files and set some useful variables
|
27 |
-
require_once(dirname(__FILE__) . "/../ngg-config.php");
|
28 |
require_once(dirname(__FILE__) . "/../lib/media-rss.php");
|
29 |
|
30 |
// Check we have the required GET parameters
|
23 |
* @param aid The album ID to show
|
24 |
*/
|
25 |
|
|
|
|
|
26 |
require_once(dirname(__FILE__) . "/../lib/media-rss.php");
|
27 |
|
28 |
// Check we have the required GET parameters
|