From a41d09250ed2ac793d7067d9a799800ee4b446e0 Mon Sep 17 00:00:00 2001
From: lucha <lucha@paranoici.org>
Date: Sun, 30 Dec 2018 13:22:25 -0800
Subject: [PATCH] [auto] plugin: nextgen-gallery 3.1.4

---
 .../plugins/nextgen-gallery/changelog.txt     |   6 +
 .../plugins/nextgen-gallery/nggallery.php     |   6 +-
 .../attach_to_post/module.attach_to_post.php  |   2 +-
 .../static/attach_to_post_dialog.css          |   2 +-
 .../static/attach_to_post_dialog.min.css      |   2 +-
 .../ngg_attach_to_post_tinymce_plugin.js      | 119 +++++++++---------
 .../ngg_attach_to_post_tinymce_plugin.min.js  |   2 +-
 .../ngglegacy/admin/manage-galleries.php      |   8 +-
 .../modules/ngglegacy/admin/manage-images.php |  12 +-
 .../modules/ngglegacy/admin/manage.php        |   6 +-
 .../modules/ngglegacy/module.ngglegacy.php    |   2 +-
 wp-content/plugins/nextgen-gallery/readme.txt |  10 +-
 12 files changed, 98 insertions(+), 79 deletions(-)

diff --git a/wp-content/plugins/nextgen-gallery/changelog.txt b/wp-content/plugins/nextgen-gallery/changelog.txt
index a10c7c44b..c39b71f7a 100644
--- a/wp-content/plugins/nextgen-gallery/changelog.txt
+++ b/wp-content/plugins/nextgen-gallery/changelog.txt
@@ -1,6 +1,12 @@
 NextGEN Gallery
 by Imagely
 
+= V3.1.4 - 12.21.2018 =
+* Fixed:   Visual shortcode not displaying in WP 5.0.2
+
+= V3.1.2 - 12.18.2018 =
+* Fixed:   Variable mismatch error when using central gallery management pages
+
 = V3.1.1 - 11.29.2018 =
 * Fixed:   Don't enqueue block editor assets on frontend.
 * Fixed:   Broken styling for column blocks
diff --git a/wp-content/plugins/nextgen-gallery/nggallery.php b/wp-content/plugins/nextgen-gallery/nggallery.php
index e4780e394..c5378f723 100644
--- a/wp-content/plugins/nextgen-gallery/nggallery.php
+++ b/wp-content/plugins/nextgen-gallery/nggallery.php
@@ -4,7 +4,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
 /**
  * Plugin Name: NextGEN Gallery
  * Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 23 million downloads.
- * Version: 3.1.1
+ * Version: 3.1.4
  * Author: Imagely
  * Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
  * Author URI: https://www.imagely.com
@@ -671,10 +671,10 @@ class C_NextGEN_Bootstrap
 		define('NGG_TESTS_DIR',   implode(DIRECTORY_SEPARATOR, array(rtrim(NGG_PLUGIN_DIR, "/\\"), 'tests')));
 		define('NGG_PRODUCT_DIR', implode(DIRECTORY_SEPARATOR, array(rtrim(NGG_PLUGIN_DIR, "/\\"), 'products')));
 		define('NGG_MODULE_DIR', implode(DIRECTORY_SEPARATOR, array(rtrim(NGG_PRODUCT_DIR, "/\\"), 'photocrati_nextgen', 'modules')));
-		define('NGG_PRODUCT_URL', path_join(str_replace("\\", '/', NGG_PLUGIN_URL), 'products'));
+		define('NGG_PRODUCT_URL', path_join(str_replace("\\" , '/', NGG_PLUGIN_URL), 'products'));
 		define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
 		define('NGG_PLUGIN_STARTED_AT', microtime());
-		define('NGG_PLUGIN_VERSION', '3.1.1');
+		define('NGG_PLUGIN_VERSION', '3.1.4');
 
 		if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)
 			define('NGG_SCRIPT_VERSION', (string)mt_rand(0, mt_getrandmax()));
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php
index d7d00a0b5..06609fa39 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php
@@ -1,7 +1,7 @@
 <?php
 
 define('NGG_ATTACH_TO_POST_SLUG', 'nextgen-attach_to_post');
-define('NGG_ATTACH_TO_POST_VERSION', '3.1.0');
+define('NGG_ATTACH_TO_POST_VERSION', '3.1.4');
 
 class M_Attach_To_Post extends C_Base_Module
 {
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post_dialog.css b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post_dialog.css
index c45f52303..9302e5625 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post_dialog.css
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post_dialog.css
@@ -166,7 +166,7 @@ div[aria-label="Block: Classic"] .nggPlaceholder {
 }
 
 div[aria-label="Block: Classic"] .nggPlaceholder h3 {
-    color: #fff;
+    color: #fff !important;
     font-family: Lato, sans-serif;
     font-size: 16px;
     font-size: 1.6rem;
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post_dialog.min.css b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post_dialog.min.css
index 0e581d305..db85319cc 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post_dialog.min.css
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/attach_to_post_dialog.min.css
@@ -1 +1 @@
-#TB_window.ngg_tb_window{box-shadow:0 0 20px 10px rgba(0,0,0,.5)}.ngg_tb_window #TB_iframeContent{height:100.1%!important}.ngg_tb_window #TB_title{height:0!important;border:none!important}.ngg_tb_window #TB_closeWindowButton{background:0 0;top:10px;right:20px}.ngg_tb_window #TB_closeWindowButton:focus .tb-close-icon,.ngg_tb_window .tb-close-icon{color:#fff;border:none;box-shadow:none;background:#9fbb1a;border-radius:50%;padding:1px;height:20px;width:20px;font-size:12px}.ngg_tb_window #TB_closeWindowButton:focus .tb-close-icon,.ngg_tb_window #TB_closeWindowButton:hover .tb-close-icon{color:#fff}.ngg_tb_window .tb-close-icon:before{font:400 18px dashicons}#ngg_attach_to_post_dialog{width:95%!important;left:2.5%!important}#ngg_attach_to_post_dialog-head #ngg_attach_to_post_dialog-title{display:none}#ngg_attach_to_post_dialog-body{width:100%!important}#ngg_attach_to_post_dialog-head{min-height:0;height:0;border:none}#ngg_attach_to_post_dialog-head .mce-close{position:absolute;background:0 0;top:10px!important;right:20px!important;z-index:2}#ngg_attach_to_post_dialog-head .mce-close i,#ngg_attach_to_post_dialog-head .mce-close:focus i{color:#fff;border:none;box-shadow:none;background:#9fbb1a;border-radius:50%;padding:1px;height:20px;width:20px;font-size:12px}#ngg_attach_to_post_dialog-head .mce-close:focus i,#ngg_attach_to_post_dialog-head .mce-close:hover i{color:#fff}#ngg_attach_to_post_dialog-head .mce-close i:before{font:400 17px dashicons;color:#fff;margin:1.2px 0 0 -8px}.ngg_attach_to_post_window{position:relative;border:none!important}.ngg_attach_to_post_window .mceBottom,.ngg_attach_to_post_window .mceCenter,.ngg_attach_to_post_window .mceLeft,.ngg_attach_to_post_window .mceResize,.ngg_attach_to_post_window .mceRight,.ngg_attach_to_post_window .mceTop{background:0 0!important;border:none!important}.ngg_attach_to_post_window .mceMiddle span{padding-top:6px!important}.ngg_attach_to_post_window .mceTop{display:block!important;height:0!important;font-size:0!important}.ngg_attach_to_post_window .mceClose{background:url(uploader-icons.png) -100px 0!important;display:block!important;margin:0!important;padding:0!important;width:15px!important;height:15px!important;position:absolute!important;top:44px!important;right:30px!important}#ngg_attach_to_post_dialog-body{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;background:rgba(255,255,255,.6);border-top:none}div[aria-label="Block: Classic"] .nggPlaceholder{padding:30px 30px 65px;text-align:center;background-color:#143650;box-sizing:border-box;border-radius:2px;font-family:sans-serif;font-size:20px;color:#9fbb1a;border-top:5px solid #b8d330;outline:0!important;box-shadow:0 0 4px 1px rgba(0,0,0,.05);margin-top:0;position:relative;z-index:2}div[aria-label="Block: Classic"] .nggPlaceholder h3{color:#fff;font-family:Lato,sans-serif;font-size:16px;font-size:1.6rem;font-weight:600;margin:24px 0 0}div[aria-label="Block: Classic"] .nggPlaceholderButton{background:#9ebd00!important;border-radius:2px;border:none!important;box-shadow:none!important;color:#fff!important;display:inline-block!important;font-size:13px;font-weight:700;font-family:Lato,sans-serif!important!important;height:36px!important;line-height:36px!important;letter-spacing:1.2px;margin:2px;padding:0;width:110px;text-align:center;text-transform:uppercase!important;text-shadow:none!important;cursor:pointer}div[aria-label="Block: Classic"] .nggPlaceholderButton:hover{background:#a5c31a!important}@media (max-width:781px){#TB_window.ngg_tb_window{position:absolute!important}}
\ No newline at end of file
+#TB_window.ngg_tb_window{box-shadow:0 0 20px 10px rgba(0,0,0,.5)}.ngg_tb_window #TB_iframeContent{height:100.1%!important}.ngg_tb_window #TB_title{height:0!important;border:none!important}.ngg_tb_window #TB_closeWindowButton{background:0 0;top:10px;right:20px}.ngg_tb_window #TB_closeWindowButton:focus .tb-close-icon,.ngg_tb_window .tb-close-icon{color:#fff;border:none;box-shadow:none;background:#9fbb1a;border-radius:50%;padding:1px;height:20px;width:20px;font-size:12px}.ngg_tb_window #TB_closeWindowButton:focus .tb-close-icon,.ngg_tb_window #TB_closeWindowButton:hover .tb-close-icon{color:#fff}.ngg_tb_window .tb-close-icon:before{font:400 18px dashicons}#ngg_attach_to_post_dialog{width:95%!important;left:2.5%!important}#ngg_attach_to_post_dialog-head #ngg_attach_to_post_dialog-title{display:none}#ngg_attach_to_post_dialog-body{width:100%!important}#ngg_attach_to_post_dialog-head{min-height:0;height:0;border:none}#ngg_attach_to_post_dialog-head .mce-close{position:absolute;background:0 0;top:10px!important;right:20px!important;z-index:2}#ngg_attach_to_post_dialog-head .mce-close i,#ngg_attach_to_post_dialog-head .mce-close:focus i{color:#fff;border:none;box-shadow:none;background:#9fbb1a;border-radius:50%;padding:1px;height:20px;width:20px;font-size:12px}#ngg_attach_to_post_dialog-head .mce-close:focus i,#ngg_attach_to_post_dialog-head .mce-close:hover i{color:#fff}#ngg_attach_to_post_dialog-head .mce-close i:before{font:400 17px dashicons;color:#fff;margin:1.2px 0 0 -8px}.ngg_attach_to_post_window{position:relative;border:none!important}.ngg_attach_to_post_window .mceBottom,.ngg_attach_to_post_window .mceCenter,.ngg_attach_to_post_window .mceLeft,.ngg_attach_to_post_window .mceResize,.ngg_attach_to_post_window .mceRight,.ngg_attach_to_post_window .mceTop{background:0 0!important;border:none!important}.ngg_attach_to_post_window .mceMiddle span{padding-top:6px!important}.ngg_attach_to_post_window .mceTop{display:block!important;height:0!important;font-size:0!important}.ngg_attach_to_post_window .mceClose{background:url(uploader-icons.png) -100px 0!important;display:block!important;margin:0!important;padding:0!important;width:15px!important;height:15px!important;position:absolute!important;top:44px!important;right:30px!important}#ngg_attach_to_post_dialog-body{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;background:rgba(255,255,255,.6);border-top:none}div[aria-label="Block: Classic"] .nggPlaceholder{padding:30px 30px 65px;text-align:center;background-color:#143650;box-sizing:border-box;border-radius:2px;font-family:sans-serif;font-size:20px;color:#9fbb1a;border-top:5px solid #b8d330;outline:0!important;box-shadow:0 0 4px 1px rgba(0,0,0,.05);margin-top:0;position:relative;z-index:2}div[aria-label="Block: Classic"] .nggPlaceholder h3{color:#fff!important;font-family:Lato,sans-serif;font-size:16px;font-size:1.6rem;font-weight:600;margin:24px 0 0}div[aria-label="Block: Classic"] .nggPlaceholderButton{background:#9ebd00!important;border-radius:2px;border:none!important;box-shadow:none!important;color:#fff!important;display:inline-block!important;font-size:13px;font-weight:700;font-family:Lato,sans-serif!important!important;height:36px!important;line-height:36px!important;letter-spacing:1.2px;margin:2px;padding:0;width:110px;text-align:center;text-transform:uppercase!important;text-shadow:none!important;cursor:pointer}div[aria-label="Block: Classic"] .nggPlaceholderButton:hover{background:#a5c31a!important}@media (max-width:781px){#TB_window.ngg_tb_window{position:absolute!important}}
\ No newline at end of file
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.js b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.js
index 7a70c3e59..b48f0069c 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.js
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.js
@@ -54,6 +54,13 @@
 				image:	plugin_url+'/igw_button.png'
 			});
 
+			editor.on('SaveContent', function(event) {
+				if (wp.blocks) {
+					handle_shortcode(event, '[ngg_images ');
+					handle_shortcode(event, '[ngg ');
+				}
+			});
+
 			/**
 			 * Listen for click events to our placeholder
 			 */
@@ -115,60 +122,8 @@
 			 * in templates/tinymce_placeholder.php
 			 */
 			editor.on('BeforeSetContent', function(event) {
-				function handle_shortcode(shortcode_opening_tag) {
-                    while (event.content.indexOf(shortcode_opening_tag) >= 0) {
-                        var start_of_shortcode = event.content.indexOf(shortcode_opening_tag);
-                        var index = start_of_shortcode + shortcode_opening_tag.length;
-                        var found_attribute_assignment = false;
-                        var current_attribute_enclosure = null;
-                        var last_found_char = false;
-                        var content_length = event.content.length;
-                        while (true) {
-                            var char = event.content[index];
-                            if (char == '"' || char == "'" && last_found_char == '=') {
-                                // Is this the closing quote for an already found attribute assignment?
-                                if (found_attribute_assignment && current_attribute_enclosure == char) {
-                                    found_attribute_assignment = false;
-                                    current_attribute_enclosure = null;
-                                }
-                                else {
-                                    found_attribute_assignment = true;
-                                    current_attribute_enclosure = char;
-                                }
-                            }
-                            else if (char == ']') {
-                                // we've found a shortcode closing tag. But, we need to ensure
-                                // that this ] isn't within the value of a shortcode attribute
-                                if (!found_attribute_assignment) {
-                                    break; //exit loop - we've found the shortcode
-                                }
-                            }
-
-                            last_found_char = char;
-
-                            if (index == content_length) {
-                                break;
-                            }
-
-                            index++;
-                        }
-
-                        // Replace the shortcode with a placeholder
-                        var match = event.content.substring(start_of_shortcode, ++index);
-                        var shortcode = match.substring(1, match.length-1);
-                        shortcode = shortcode.replace('[', '&#91;');
-                        shortcode = shortcode.replace(']', '&#93;');
-
-                        var template = _.template($('#ngg-igw-placeholder').html());
-                        event.content = event.content.replace(match, template($.extend(ngg_igw_i18n, {
-                            shortcode: shortcode,
-                            ref: _.now()
-                        })));
-                    }
-				}
-
-				handle_shortcode('[ngg_images ');
-				handle_shortcode('[ngg ');
+				handle_shortcode(event, '[ngg_images ');
+				handle_shortcode(event, '[ngg ');
 			});
 
             /**
@@ -179,11 +134,63 @@
                 $content.find('.nggPlaceholder').toArray().forEach(function(placeholder){
                     var $placeholder = $(placeholder);
                     var shortcode = $placeholder.data('shortcode');
-                    shortcode = "<p>[" + _.unescape(shortcode) + "]</p>";
+                    shortcode = "[" + _.unescape(shortcode) + "]";
                     $placeholder.replaceWith(shortcode);
                 });
-                event.content = $content.html();
+                event.content = $content[0].innerHTML;
 			});
+
+			function handle_shortcode(event, shortcode_opening_tag) {
+				while (event.content.indexOf(shortcode_opening_tag) >= 0) {
+					var start_of_shortcode = event.content.indexOf(shortcode_opening_tag);
+					var index = start_of_shortcode + shortcode_opening_tag.length;
+					var found_attribute_assignment = false;
+					var current_attribute_enclosure = null;
+					var last_found_char = false;
+					var content_length = event.content.length;
+					while (true) {
+						var char = event.content[index];
+						if (char == '"' || char == "'" && last_found_char == '=') {
+							// Is this the closing quote for an already found attribute assignment?
+							if (found_attribute_assignment && current_attribute_enclosure == char) {
+								found_attribute_assignment = false;
+								current_attribute_enclosure = null;
+							}
+							else {
+								found_attribute_assignment = true;
+								current_attribute_enclosure = char;
+							}
+						}
+						else if (char == ']') {
+							// we've found a shortcode closing tag. But, we need to ensure
+							// that this ] isn't within the value of a shortcode attribute
+							if (!found_attribute_assignment) {
+								break; //exit loop - we've found the shortcode
+							}
+						}
+
+						last_found_char = char;
+
+						if (index == content_length) {
+							break;
+						}
+
+						index++;
+					}
+
+					// Replace the shortcode with a placeholder
+					var match = event.content.substring(start_of_shortcode, ++index);
+					var shortcode = match.substring(1, match.length-1);
+					shortcode = shortcode.replace('[', '&#91;');
+					shortcode = shortcode.replace(']', '&#93;');
+
+					var template = _.template($('#ngg-igw-placeholder').html());
+					event.content = event.content.replace(match, template($.extend(ngg_igw_i18n, {
+						shortcode: shortcode,
+						ref: _.now()
+					})));
+				}
+			}
 		},
 
 		get_class_name: function(node) {
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.min.js b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.min.js
index 1ede19d30..7e179af24 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.min.js
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/attach_to_post/static/ngg_attach_to_post_tinymce_plugin.min.js
@@ -1 +1 @@
-!function(t,e){window.id="wordpress-post-page",tinyMCE.addI18n("en.ngg_attach_to_post",{title:"Attach NextGEN Gallery to Post"}),tinymce.create("tinymce.plugins.NextGEN_AttachToPost",{siteurl:t,getInfo:function(){return{longname:"NextGEN Gallery",author:"Imagely",authorurl:"https://www.imagely.com",infourl:"https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/",version:"0.1"}},init:function(t,n){var o=this;t.windowManager.nggOldOpen=t.windowManager.open,t.windowManager.open=function(e,n){var a=t.windowManager.nggOldOpen(e,n);return a.on("close",o.wm_close_event),a},t.addCommand("ngg_attach_to_post",this.render_attach_to_post_interface,{editor:t,plugin:t.plugins.NextGEN_AttachToPost}),t.addButton("NextGEN_AttachToPost",{title:"ngg_attach_to_post.title",cmd:"ngg_attach_to_post",image:n+"/igw_button.png"}),t.on("mouseup touchend",function(n){if(tinymce.extend(o,{editor:t,plugin:t.plugins.NextGEN_AttachToPost}),"IMG"==n.target.tagName){if(o.get_class_name(n.target).indexOf("ngg_displayed_gallery")>=0){t.dom.events.cancel(n);var a=n.target.src.match(/\d+$/);a&&(a=a.pop()),o.render_attach_to_post_interface({key:"id",val:a})}}else{var r=e(n.target);if(r.hasClass("nggPlaceholderButton"))if(r.hasClass("nggIgwRemove")){var i=r.parents(".nggPlaceholder"),c=i[0].getAttribute("data-shortcode");t.fire("ngg-removed",{shortcode:c}),i.remove()}else window.igw_shortcode=e(n.target).parents(".nggPlaceholder")[0].getAttribute("data-shortcode"),o.render_attach_to_post_interface({key:"shortcode",val:Base64.encode(window.igw_shortcode),ref:e(n.target).parents(".nggPlaceholder").attr("id")})}}),t.on("BeforeSetContent",function(t){function n(n){for(;t.content.indexOf(n)>=0;){for(var o=t.content.indexOf(n),a=o+n.length,r=!1,i=null,c=!1,l=t.content.length;;){var g=t.content[a];if('"'==g||"'"==g&&"="==c)r&&i==g?(r=!1,i=null):(r=!0,i=g);else if("]"==g&&!r)break;if(c=g,a==l)break;a++}var s=t.content.substring(o,++a),d=s.substring(1,s.length-1);d=d.replace("[","&#91;"),d=d.replace("]","&#93;");var h=_.template(e("#ngg-igw-placeholder").html());t.content=t.content.replace(s,h(e.extend(ngg_igw_i18n,{shortcode:d,ref:_.now()})))}}n("[ngg_images "),n("[ngg ")}),t.on("PostProcess",function(t){var n=e("<div/>").append(t.content);n.find(".nggPlaceholder").toArray().forEach(function(t){var n=e(t),o=n.data("shortcode");o="<p>["+_.unescape(o)+"]</p>",n.replaceWith(o)}),t.content=n.html()})},get_class_name:function(t){var e=t.getAttribute("class")?t.getAttribute("class"):t.className;return e||""},wm_close_event:function(t){t&&t.target&&t.target._id&&"ngg_attach_to_post_dialog"==t.target._id&&(e("html,body").css("overflow","auto"),tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.dom.select("p")[0]),tinyMCE.activeEditor.selection.collapse(0))},render_attach_to_post_interface:function(t){var n=nextgen_gallery_attach_to_post_url;void 0!==t&&(n+="&"+t.key+"="+encodeURIComponent(t.val),void 0!==t.ref&&(n+="&ref="+encodeURIComponent(t.ref))),n+="&editor="+this.editor.id;for(var o=window;null!=o.parent&&o.parent!=o;)o=o.parent;o=e(o);var a=o.width(),r=o.height(),i=1600,c=1200,l=a-.05*a,g=r-.1*r;l<800&&(l=a-20),g<600&&(g=r-40),i>l&&(i=l),c>g&&(c=g),document.activeElement.blur(),Array.prototype.forEach.call(document.querySelectorAll("input, textarea"),function(t){t.blur()}),this.editor.windowManager.open({url:n,id:"ngg_attach_to_post_dialog",width:i,height:c,title:"NextGEN Gallery - Attach To Post"}),e("html,body").css("overflow","hidden"),e("#ngg_attach_to_post_dialog_ifr").css("overflow-y","auto"),e("#ngg_attach_to_post_dialog_ifr").css("overflow-x","hidden")}}),tinymce.PluginManager.add("NextGEN_AttachToPost",tinymce.plugins.NextGEN_AttachToPost)}(photocrati_ajax.wp_site_url,jQuery);
\ No newline at end of file
+!function(t,e){window.id="wordpress-post-page",tinyMCE.addI18n("en.ngg_attach_to_post",{title:"Attach NextGEN Gallery to Post"}),tinymce.create("tinymce.plugins.NextGEN_AttachToPost",{siteurl:t,getInfo:function(){return{longname:"NextGEN Gallery",author:"Imagely",authorurl:"https://www.imagely.com",infourl:"https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/",version:"0.1"}},init:function(t,n){function o(t,n){for(;t.content.indexOf(n)>=0;){for(var o=t.content.indexOf(n),a=o+n.length,r=!1,i=null,c=!1,g=t.content.length;;){var l=t.content[a];if('"'==l||"'"==l&&"="==c)r&&i==l?(r=!1,i=null):(r=!0,i=l);else if("]"==l&&!r)break;if(c=l,a==g)break;a++}var s=t.content.substring(o,++a),d=s.substring(1,s.length-1);d=d.replace("[","&#91;"),d=d.replace("]","&#93;");var h=_.template(e("#ngg-igw-placeholder").html());t.content=t.content.replace(s,h(e.extend(ngg_igw_i18n,{shortcode:d,ref:_.now()})))}}var a=this;t.windowManager.nggOldOpen=t.windowManager.open,t.windowManager.open=function(e,n){var o=t.windowManager.nggOldOpen(e,n);return o.on("close",a.wm_close_event),o},t.addCommand("ngg_attach_to_post",this.render_attach_to_post_interface,{editor:t,plugin:t.plugins.NextGEN_AttachToPost}),t.addButton("NextGEN_AttachToPost",{title:"ngg_attach_to_post.title",cmd:"ngg_attach_to_post",image:n+"/igw_button.png"}),t.on("SaveContent",function(t){wp.blocks&&(o(t,"[ngg_images "),o(t,"[ngg "))}),t.on("mouseup touchend",function(n){if(tinymce.extend(a,{editor:t,plugin:t.plugins.NextGEN_AttachToPost}),"IMG"==n.target.tagName){if(a.get_class_name(n.target).indexOf("ngg_displayed_gallery")>=0){t.dom.events.cancel(n);var o=n.target.src.match(/\d+$/);o&&(o=o.pop()),a.render_attach_to_post_interface({key:"id",val:o})}}else{var r=e(n.target);if(r.hasClass("nggPlaceholderButton"))if(r.hasClass("nggIgwRemove")){var i=r.parents(".nggPlaceholder"),c=i[0].getAttribute("data-shortcode");t.fire("ngg-removed",{shortcode:c}),i.remove()}else window.igw_shortcode=e(n.target).parents(".nggPlaceholder")[0].getAttribute("data-shortcode"),a.render_attach_to_post_interface({key:"shortcode",val:Base64.encode(window.igw_shortcode),ref:e(n.target).parents(".nggPlaceholder").attr("id")})}}),t.on("BeforeSetContent",function(t){o(t,"[ngg_images "),o(t,"[ngg ")}),t.on("PostProcess",function(t){var n=e("<div/>").append(t.content);n.find(".nggPlaceholder").toArray().forEach(function(t){var n=e(t),o=n.data("shortcode");o="["+_.unescape(o)+"]",n.replaceWith(o)}),t.content=n[0].innerHTML})},get_class_name:function(t){var e=t.getAttribute("class")?t.getAttribute("class"):t.className;return e||""},wm_close_event:function(t){t&&t.target&&t.target._id&&"ngg_attach_to_post_dialog"==t.target._id&&(e("html,body").css("overflow","auto"),tinyMCE.activeEditor.selection.select(tinyMCE.activeEditor.dom.select("p")[0]),tinyMCE.activeEditor.selection.collapse(0))},render_attach_to_post_interface:function(t){var n=nextgen_gallery_attach_to_post_url;void 0!==t&&(n+="&"+t.key+"="+encodeURIComponent(t.val),void 0!==t.ref&&(n+="&ref="+encodeURIComponent(t.ref))),n+="&editor="+this.editor.id;for(var o=window;null!=o.parent&&o.parent!=o;)o=o.parent;o=e(o);var a=o.width(),r=o.height(),i=1600,c=1200,g=a-.05*a,l=r-.1*r;g<800&&(g=a-20),l<600&&(l=r-40),i>g&&(i=g),c>l&&(c=l),document.activeElement.blur(),Array.prototype.forEach.call(document.querySelectorAll("input, textarea"),function(t){t.blur()}),this.editor.windowManager.open({url:n,id:"ngg_attach_to_post_dialog",width:i,height:c,title:"NextGEN Gallery - Attach To Post"}),e("html,body").css("overflow","hidden"),e("#ngg_attach_to_post_dialog_ifr").css("overflow-y","auto"),e("#ngg_attach_to_post_dialog_ifr").css("overflow-x","hidden")}}),tinymce.PluginManager.add("NextGEN_AttachToPost",tinymce.plugins.NextGEN_AttachToPost)}(photocrati_ajax.wp_site_url,jQuery);
\ No newline at end of file
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-galleries.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-galleries.php
index e216a3a83..c9373f217 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-galleries.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-galleries.php
@@ -194,7 +194,7 @@ function nggallery_manage_gallery_main() {
 			</form>
 			<form id="editgalleries" class="nggform" method="POST" action="<?php echo nextgen_esc_url($ngg->manage_page->base_page . '&orderby=' . $orderby . '&order=' . $order . '&paged=' . $_GET['paged']); ?>" accept-charset="utf-8">
 			<?php wp_nonce_field('ngg_bulkgallery') ?>
-			<input type="hidden" name="page" value="manage-galleries" />
+			<input type="hidden" name="nggpage" value="manage-galleries" />
 
 			<div class="tablenav top">
 
@@ -339,7 +339,7 @@ function nggallery_manage_gallery_main() {
 	<div id="addGallery" style="display: none;" >
 		<form id="form-tags" method="POST" accept-charset="utf-8">
 		<?php wp_nonce_field('ngg_addgallery'); ?>
-		<input type="hidden" name="page" value="manage-galleries" />
+		<input type="hidden" name="nggpage" value="manage-galleries" />
 		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
 		  	<tr>
 		    	<td>
@@ -369,7 +369,7 @@ function nggallery_manage_gallery_main() {
 		<?php wp_nonce_field('ngg_thickbox_form') ?>
 		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
 		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
-		<input type="hidden" name="page" value="manage-galleries" />
+		<input type="hidden" name="nggpage" value="manage-galleries" />
 		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
 			<tr valign="top">
 				<td>
@@ -398,7 +398,7 @@ function nggallery_manage_gallery_main() {
 		<?php wp_nonce_field('ngg_thickbox_form') ?>
 		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
 		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
-		<input type="hidden" name="page" value="manage-galleries" />
+		<input type="hidden" name="nggpage" value="manage-galleries" />
 		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
 			<tr valign="top">
 				<th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php
index f23a5b8fb..1f43bb9fe 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php
@@ -332,7 +332,7 @@ jQuery(document).ready( function($) {
 		<form id="updategallery" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;s=' . get_search_query(); ?>" accept-charset="utf-8">
 		
 			<?php wp_nonce_field('ngg_updategallery') ?>
-			<input type="hidden" name="page" value="manage-images" />
+			<input type="hidden" name="nggpage" value="manage-images" />
 
 		<!-- form#updategallery continues below end of if statement -->
 
@@ -348,7 +348,7 @@ jQuery(document).ready( function($) {
 		<form id="updategallery" class="nggform" method="POST" action="<?php echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid . '&amp;paged=' . esc_attr($_GET['paged']); ?>" accept-charset="utf-8">
 		
 			<?php wp_nonce_field('ngg_updategallery') ?>
-			<input type="hidden" name="page" value="manage-images" />
+			<input type="hidden" name="nggpage" value="manage-images" />
 
 			<?php if ( nggGallery::current_user_can( 'NextGEN Edit gallery options' )) : ?>
 
@@ -516,7 +516,7 @@ jQuery(document).ready( function($) {
 		<?php wp_nonce_field('ngg_thickbox_form') ?>
 		<input type="hidden" id="entertags_imagelist" name="TB_imagelist" value="" />
 		<input type="hidden" id="entertags_bulkaction" name="TB_bulkaction" value="" />
-		<input type="hidden" name="page" value="manage-images" />
+		<input type="hidden" name="nggpage" value="manage-images" />
 		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
 		  	<tr>
 		    	<th><?php _e("Enter the tags",'nggallery'); ?> : <input name="taglist" type="text" style="width:90%" value="" /></th>
@@ -539,7 +539,7 @@ jQuery(document).ready( function($) {
 		<?php wp_nonce_field('ngg_thickbox_form') ?>
 		<input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
 		<input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
-		<input type="hidden" name="page" value="manage-images" />
+		<input type="hidden" name="nggpage" value="manage-images" />
 		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
 		  	<tr>
 		    	<th>
@@ -575,7 +575,7 @@ jQuery(document).ready( function($) {
 		<?php wp_nonce_field('ngg_thickbox_form') ?>
 		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
 		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
-		<input type="hidden" name="page" value="manage-images" />
+		<input type="hidden" name="nggpage" value="manage-images" />
 		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
 			<tr valign="top">
 				<td>
@@ -604,7 +604,7 @@ jQuery(document).ready( function($) {
 		<?php wp_nonce_field('ngg_thickbox_form') ?>
 		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
 		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
-		<input type="hidden" name="page" value="manage-images" />
+		<input type="hidden" name="nggpage" value="manage-images" />
     <table width="100%" border="0" cellspacing="3" cellpadding="3" >
 			<tr valign="top">
 				<th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage.php
index dd50b2611..5d7384bb6 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage.php
@@ -31,13 +31,13 @@ class nggManageGallery {
             }
         }
         // Should be only called via manage galleries overview
-		if ( isset($_POST['page']) && $_POST['page'] == 'manage-galleries' )
+		if ( isset($_POST['nggpage']) && $_POST['nggpage'] == 'manage-galleries' )
 			$this->post_processor_galleries();
 		// Should be only called via a edit single gallery page
-		if ( isset($_POST['page']) && $_POST['page'] == 'manage-images' )
+		if ( isset($_POST['nggpage']) && $_POST['nggpage'] == 'manage-images' )
 			$this->post_processor_images();
 		// Should be called via a publish dialog
-		if ( isset($_POST['page']) && $_POST['page'] == 'publish-post' )
+		if ( isset($_POST['nggpage']) && $_POST['nggpage'] == 'publish-post' )
 			$this->publish_post();
 
 		//Look for other POST process
diff --git a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php
index 4e18173b4..01b0965bd 100644
--- a/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php
+++ b/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/module.ngglegacy.php
@@ -23,7 +23,7 @@ class M_NggLegacy extends C_Base_Module
 			'photocrati-nextgen-legacy',
 			'NextGEN Legacy',
 			'Embeds the original version of NextGEN 1.9.3 by Alex Rabe',
-			'3.1.0',
+			'3.1.2',
 			'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
 			'Imagely',
 			'https://www.imagely.com'
diff --git a/wp-content/plugins/nextgen-gallery/readme.txt b/wp-content/plugins/nextgen-gallery/readme.txt
index 1b17880a8..5029ebd52 100644
--- a/wp-content/plugins/nextgen-gallery/readme.txt
+++ b/wp-content/plugins/nextgen-gallery/readme.txt
@@ -2,8 +2,8 @@
 Contributors: photocrati, imagely
 Tags: wordpress gallery plugin, gallery, nextgen, nextgen gallery, photo gallery, image gallery, photography, slideshow, images, photo, photo album, watermark
 Requires at least: 4.0.0
-Stable tag: 3.1.1
-Tested up to: 5.0.0
+Stable tag: 3.1.4
+Tested up to: 5.0.2
 License: GPLv2
 
 The most popular WordPress gallery plugin and one of the most popular plugins of all time with over 23 million downloads.
@@ -183,6 +183,12 @@ For more information, feel free to visit the official website for the NextGEN Ga
 
 == Changelog ==
 
+= V3.1.4 - 12.21.2018 =
+* Fixed:   Visual shortcode not displaying in WP 5.0.2
+
+= V3.1.2 - 12.18.2018 =
+* Fixed:   Variable mismatch error when using central gallery management pages
+
 = V3.1.1 - 11.29.2018 =
 * Fixed:   Don't enqueue block editor assets on frontend.
 * Fixed:   Broken styling for column blocks
-- 
GitLab