Version Description
- 03.24.2020 =
- Changed: Resource manager disabled by default
- Changed: Remove ngg_load_frontend_logic filter
- Fixed: Refactored to resolve over 300 plugin & theme conflicts
- Fixed: Problem reported with taxonomy controller
Download this release
Release Info
Developer | photocrati |
Plugin | NextGEN Gallery – WordPress Gallery Plugin |
Version | 3.9.0 |
Comparing to | |
See all releases |
Code changes from version 3.8.0 to 3.9.0
- changelog.txt +11 -4
- nggallery.php +3 -17
- non_pope/class.nextgen_shortcode_manager.php +41 -17
- non_pope/class.photocrati_resource_manager.php +38 -20
- products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php +2 -9
- products/photocrati_nextgen/modules/dynamic_stylesheet/package.module.dynamic_stylesheet.php +1 -1
- products/photocrati_nextgen/modules/dynamic_thumbnails/module.dynamic_thumbnails.php +2 -3
- products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php +28 -37
- products/photocrati_nextgen/modules/nextgen_basic_album/package.module.nextgen_basic_album.php +58 -17
- products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php +37 -87
- products/photocrati_nextgen/modules/nextgen_basic_gallery/package.module.nextgen_basic_gallery.php +30 -10
- products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php +7 -11
- products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/package.module.nextgen_basic_imagebrowser.php +1 -1
- products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php +13 -31
- products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php +21 -37
- products/photocrati_nextgen/modules/nextgen_basic_tagcloud/package.module.nextgen_basic_tagcloud.php +34 -10
- products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php +131 -97
- products/photocrati_nextgen/modules/nextgen_gallery_display/package.module.nextgen_gallery_display.php +20 -3
- products/photocrati_nextgen/modules/rest/rest testing.http +10 -0
- products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php +0 -63
- products/photocrati_nextgen/modules/widget/module.widget.php +2 -2
- products/photocrati_nextgen/modules/widget/package.module.widget.php +125 -37
- readme.txt +14 -7
changelog.txt
CHANGED
@@ -1,11 +1,18 @@
|
|
1 |
NextGEN Gallery
|
2 |
by Imagely
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
= V3.8.0 - 02.24.2020 =
|
5 |
-
* NEW: NGG featured image support for custom post types
|
6 |
-
* Fixed: Compatibility with Custom Post Type UI plugin
|
7 |
-
* Fixed: Compatibility with Advanced Custom Fields plugin
|
8 |
-
* Fixed: Compatibility with Photo Station plugin
|
|
|
9 |
|
10 |
= V3.7.0 - 02.17.2020 =
|
11 |
* Fixed: Added ellipsis to pagination to show pages skipped (1099) (1157)
|
1 |
NextGEN Gallery
|
2 |
by Imagely
|
3 |
|
4 |
+
= V3.9.0 - 03.24.2020 =
|
5 |
+
* Changed: Resource manager disabled by default
|
6 |
+
* Changed: Remove ngg_load_frontend_logic filter
|
7 |
+
* Fixed: Refactored to resolve over 300 plugin & theme conflicts
|
8 |
+
* Fixed: Problem reported with taxonomy controller
|
9 |
+
|
10 |
= V3.8.0 - 02.24.2020 =
|
11 |
+
* NEW: NGG featured image support for custom post types (1076)
|
12 |
+
* Fixed: Compatibility with Custom Post Type UI plugin (1076)
|
13 |
+
* Fixed: Compatibility with Advanced Custom Fields plugin (1150)
|
14 |
+
* Fixed: Compatibility with Photo Station plugin (855)
|
15 |
+
* Fixed: Compatibility with Stackable (981)
|
16 |
|
17 |
= V3.7.0 - 02.17.2020 =
|
18 |
* Fixed: Added ellipsis to pagination to show pages skipped (1099) (1157)
|
nggallery.php
CHANGED
@@ -4,7 +4,7 @@ if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You
|
|
4 |
/**
|
5 |
* Plugin Name: NextGEN Gallery
|
6 |
* Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 30 million downloads.
|
7 |
-
* Version: 3.
|
8 |
* Author: Imagely
|
9 |
* Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
|
10 |
* Author URI: https://www.imagely.com
|
@@ -214,7 +214,7 @@ class C_NextGEN_Bootstrap
|
|
214 |
// Load the installer
|
215 |
include_once('non_pope/class.photocrati_installer.php');
|
216 |
|
217 |
-
// Load the resource manager
|
218 |
include_once('non_pope/class.photocrati_resource_manager.php');
|
219 |
C_Photocrati_Resource_Manager::init();
|
220 |
|
@@ -466,20 +466,6 @@ class C_NextGEN_Bootstrap
|
|
466 |
}
|
467 |
|
468 |
add_action('all_admin_notices', [$this, 'render_jquery_wp_55_warning']);
|
469 |
-
|
470 |
-
add_filter('ngg_load_frontend_logic', array($this, 'disable_frontend_logic'), -10, 2);
|
471 |
-
|
472 |
-
}
|
473 |
-
|
474 |
-
function disable_frontend_logic($enabled, $module_id)
|
475 |
-
{
|
476 |
-
if (is_admin())
|
477 |
-
{
|
478 |
-
$settings = C_NextGen_Settings::get_instance();
|
479 |
-
if (!$settings->get('always_enable_frontend_logic'))
|
480 |
-
$enabled = FALSE;
|
481 |
-
}
|
482 |
-
return $enabled;
|
483 |
}
|
484 |
|
485 |
function handle_activation_redirect()
|
@@ -726,7 +712,7 @@ class C_NextGEN_Bootstrap
|
|
726 |
define('NGG_PRODUCT_URL', path_join(str_replace("\\" , '/', NGG_PLUGIN_URL), 'products'));
|
727 |
define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
|
728 |
define('NGG_PLUGIN_STARTED_AT', microtime());
|
729 |
-
define('NGG_PLUGIN_VERSION', '3.
|
730 |
|
731 |
define(
|
732 |
'NGG_SCRIPT_VERSION',
|
4 |
/**
|
5 |
* Plugin Name: NextGEN Gallery
|
6 |
* Description: The most popular gallery plugin for WordPress and one of the most popular plugins of all time with over 30 million downloads.
|
7 |
+
* Version: 3.9.0
|
8 |
* Author: Imagely
|
9 |
* Plugin URI: https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/
|
10 |
* Author URI: https://www.imagely.com
|
214 |
// Load the installer
|
215 |
include_once('non_pope/class.photocrati_installer.php');
|
216 |
|
217 |
+
// Load the (mostly deprecated) resource manager
|
218 |
include_once('non_pope/class.photocrati_resource_manager.php');
|
219 |
C_Photocrati_Resource_Manager::init();
|
220 |
|
466 |
}
|
467 |
|
468 |
add_action('all_admin_notices', [$this, 'render_jquery_wp_55_warning']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
}
|
470 |
|
471 |
function handle_activation_redirect()
|
712 |
define('NGG_PRODUCT_URL', path_join(str_replace("\\" , '/', NGG_PLUGIN_URL), 'products'));
|
713 |
define('NGG_MODULE_URL', path_join(str_replace("\\", '/', NGG_PRODUCT_URL), 'photocrati_nextgen/modules'));
|
714 |
define('NGG_PLUGIN_STARTED_AT', microtime());
|
715 |
+
define('NGG_PLUGIN_VERSION', '3.9.0');
|
716 |
|
717 |
define(
|
718 |
'NGG_SCRIPT_VERSION',
|
non_pope/class.nextgen_shortcode_manager.php
CHANGED
@@ -52,13 +52,22 @@ class C_NextGen_Shortcode_Manager
|
|
52 |
* Adds a shortcode
|
53 |
* @param $name
|
54 |
* @param $callback
|
|
|
55 |
*/
|
56 |
-
static function add($name, $callback)
|
57 |
{
|
58 |
$manager = self::get_instance();
|
59 |
-
$manager->add_shortcode($name, $callback);
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
/**
|
63 |
* Removes a previously added shortcode
|
64 |
* @param $name
|
@@ -92,7 +101,7 @@ class C_NextGen_Shortcode_Manager
|
|
92 |
function fix_nested_shortcodes($content)
|
93 |
{
|
94 |
// Try to find each registered shortcode in the content
|
95 |
-
foreach ($this->_shortcodes as $tag => $
|
96 |
$shortcode_start_tag = "[{$tag}";
|
97 |
$offset = 0;
|
98 |
|
@@ -198,14 +207,28 @@ class C_NextGen_Shortcode_Manager
|
|
198 |
return $content;
|
199 |
}
|
200 |
|
|
|
|
|
|
|
|
|
|
|
201 |
function execute_found_shortcode($found_id)
|
202 |
{
|
203 |
-
$
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
-
else
|
|
|
|
|
209 |
|
210 |
return $retval;
|
211 |
}
|
@@ -214,11 +237,12 @@ class C_NextGen_Shortcode_Manager
|
|
214 |
* Adds a shortcode
|
215 |
* @param $name
|
216 |
* @param $callback
|
|
|
217 |
*/
|
218 |
-
function add_shortcode($name, $callback)
|
219 |
{
|
220 |
-
$this->_shortcodes[$name] = $callback;
|
221 |
-
add_shortcode($name, array(
|
222 |
}
|
223 |
|
224 |
/**
|
@@ -248,18 +272,18 @@ class C_NextGen_Shortcode_Manager
|
|
248 |
|
249 |
function __call($method, $args)
|
250 |
{
|
251 |
-
$retval = '';
|
252 |
$params = array_shift($args);
|
253 |
-
$
|
254 |
$parts = explode('____', $method);
|
255 |
$shortcode = array_shift($parts);
|
256 |
-
|
|
|
|
|
257 |
$retval = $this->replace_with_placeholder($shortcode, $params, $inner_content);
|
258 |
}
|
259 |
-
|
260 |
-
// For widgets, don't use placeholders
|
261 |
else {
|
262 |
-
|
|
|
263 |
$retval = call_user_func($callback, $params, $inner_content);
|
264 |
}
|
265 |
|
52 |
* Adds a shortcode
|
53 |
* @param $name
|
54 |
* @param $callback
|
55 |
+
* @param callable|null Parameters transformer
|
56 |
*/
|
57 |
+
static function add($name, $callback, $transformer = NULL)
|
58 |
{
|
59 |
$manager = self::get_instance();
|
60 |
+
$manager->add_shortcode($name, $callback, $transformer);
|
61 |
}
|
62 |
|
63 |
+
/**
|
64 |
+
* @return string[]
|
65 |
+
*/
|
66 |
+
public function get_shortcodes()
|
67 |
+
{
|
68 |
+
return $this->_shortcodes;
|
69 |
+
}
|
70 |
+
|
71 |
/**
|
72 |
* Removes a previously added shortcode
|
73 |
* @param $name
|
101 |
function fix_nested_shortcodes($content)
|
102 |
{
|
103 |
// Try to find each registered shortcode in the content
|
104 |
+
foreach ($this->_shortcodes as $tag => $tag_details) {
|
105 |
$shortcode_start_tag = "[{$tag}";
|
106 |
$offset = 0;
|
107 |
|
207 |
return $content;
|
208 |
}
|
209 |
|
210 |
+
function render_legacy_shortcode($params, $inner_content)
|
211 |
+
{
|
212 |
+
return C_Displayed_Gallery_Renderer::get_instance()->display_images($params, $inner_content);
|
213 |
+
}
|
214 |
+
|
215 |
function execute_found_shortcode($found_id)
|
216 |
{
|
217 |
+
$details = $this->_found[$found_id];
|
218 |
+
if (isset($this->_shortcodes[$details['shortcode']]))
|
219 |
+
{
|
220 |
+
$shortcode = $this->_shortcodes[$details['shortcode']];
|
221 |
+
|
222 |
+
if (is_callable($shortcode['transformer']))
|
223 |
+
$details['params'] = call_user_func($shortcode['transformer'], $details['params']);
|
224 |
+
|
225 |
+
$method = (is_null($shortcode['callback']) && is_callable($shortcode['transformer'])) ? [$this, 'render_legacy_shortcode'] : $shortcode['callback'];
|
226 |
+
|
227 |
+
$retval = call_user_func($method, $details['params'], $details['inner_content']);
|
228 |
}
|
229 |
+
else {
|
230 |
+
$retval = "Invalid shortcode";
|
231 |
+
}
|
232 |
|
233 |
return $retval;
|
234 |
}
|
237 |
* Adds a shortcode
|
238 |
* @param $name
|
239 |
* @param $callback
|
240 |
+
* @param callable|null $transformer
|
241 |
*/
|
242 |
+
function add_shortcode($name, $callback, $transformer = NULL)
|
243 |
{
|
244 |
+
$this->_shortcodes[$name] = ['callback' => $callback, 'transformer' => $transformer];
|
245 |
+
add_shortcode($name, array($this, $name . '____wrapper'));
|
246 |
}
|
247 |
|
248 |
/**
|
272 |
|
273 |
function __call($method, $args)
|
274 |
{
|
|
|
275 |
$params = array_shift($args);
|
276 |
+
$inner_content = array_shift($args);
|
277 |
$parts = explode('____', $method);
|
278 |
$shortcode = array_shift($parts);
|
279 |
+
|
280 |
+
if (doing_filter('the_content') && !doing_filter('widget_text'))
|
281 |
+
{
|
282 |
$retval = $this->replace_with_placeholder($shortcode, $params, $inner_content);
|
283 |
}
|
|
|
|
|
284 |
else {
|
285 |
+
// For widgets, don't use placeholders
|
286 |
+
$callback = $this->_shortcodes[$shortcode]['callback'];
|
287 |
$retval = call_user_func($callback, $params, $inner_content);
|
288 |
}
|
289 |
|
non_pope/class.photocrati_resource_manager.php
CHANGED
@@ -23,8 +23,9 @@ class C_Photocrati_Resource_Manager
|
|
23 |
{
|
24 |
// Validate the request
|
25 |
$this->validate_request();
|
26 |
-
|
27 |
-
add_action('
|
|
|
28 |
}
|
29 |
|
30 |
/**
|
@@ -33,8 +34,12 @@ class C_Photocrati_Resource_Manager
|
|
33 |
*/
|
34 |
function print_marker()
|
35 |
{
|
|
|
|
|
|
|
36 |
// is_feed() is important to not break Wordpress feeds and the WooCommerce api
|
37 |
-
if ($this->valid_request && !is_feed())
|
|
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -45,6 +50,27 @@ class C_Photocrati_Resource_Manager
|
|
45 |
$this->valid_request = $this->is_valid_request();
|
46 |
}
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
function is_valid_request()
|
49 |
{
|
50 |
$retval = TRUE;
|
@@ -82,28 +108,20 @@ class C_Photocrati_Resource_Manager
|
|
82 |
*/
|
83 |
function start_buffer()
|
84 |
{
|
85 |
-
|
86 |
-
|
87 |
-
$force = TRUE;
|
88 |
-
else
|
89 |
-
$force = FALSE;
|
90 |
|
91 |
-
if (
|
92 |
-
|
|
|
|
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
add_action('wp_print_footer_scripts', array(&$this, 'get_resources'), 1);
|
99 |
-
add_action('admin_print_footer_scripts', array(&$this, 'get_resources'), 1);
|
100 |
-
add_action('shutdown', array(&$this, 'shutdown'));
|
101 |
}
|
102 |
}
|
103 |
|
104 |
-
/**
|
105 |
-
*
|
106 |
-
**/
|
107 |
function get_resources()
|
108 |
{
|
109 |
ob_start();
|
23 |
{
|
24 |
// Validate the request
|
25 |
$this->validate_request();
|
26 |
+
|
27 |
+
add_action('init', [$this, 'start_buffer'], -1);
|
28 |
+
add_action('wp_footer', [$this, 'print_marker'], -1);
|
29 |
}
|
30 |
|
31 |
/**
|
34 |
*/
|
35 |
function print_marker()
|
36 |
{
|
37 |
+
if ($this->is_disabled())
|
38 |
+
return;
|
39 |
+
|
40 |
// is_feed() is important to not break Wordpress feeds and the WooCommerce api
|
41 |
+
if ($this->valid_request && !is_feed())
|
42 |
+
print $this->marker;
|
43 |
}
|
44 |
|
45 |
/**
|
50 |
$this->valid_request = $this->is_valid_request();
|
51 |
}
|
52 |
|
53 |
+
public function is_disabled()
|
54 |
+
{
|
55 |
+
// This is admittedly an ugly hack, but much easier than reworking the entire nextgen_admin modules
|
56 |
+
if (!empty($_GET['page']) && $_GET['page'] === 'ngg_addgallery' && isset($_GET['attach_to_post']))
|
57 |
+
return FALSE;
|
58 |
+
|
59 |
+
// Provide users a method of forcing this on should it be necessary
|
60 |
+
if (defined('NGG_ENABLE_RESOURCE_MANAGER') && NGG_ENABLE_RESOURCE_MANAGER)
|
61 |
+
return FALSE;
|
62 |
+
|
63 |
+
// Pro, Plus, and Starter versions below these were not ready to function without the resource manager
|
64 |
+
if (defined('NGG_PRO_PLUGIN_VERSION') && version_compare(NGG_PRO_PLUGIN_VERSION, '3.3', '<'))
|
65 |
+
return FALSE;
|
66 |
+
if (defined('NGG_STARTER_PLUGIN_VERSION') && version_compare(NGG_STARTER_PLUGIN_VERSION, '1.1', '<'))
|
67 |
+
return FALSE;
|
68 |
+
if (defined('NGG_PLUS_PLUGIN_VERSION') && version_compare(NGG_PLUS_PLUGIN_VERSION, '1.8', '<'))
|
69 |
+
return FALSE;
|
70 |
+
|
71 |
+
return TRUE;
|
72 |
+
}
|
73 |
+
|
74 |
function is_valid_request()
|
75 |
{
|
76 |
$retval = TRUE;
|
108 |
*/
|
109 |
function start_buffer()
|
110 |
{
|
111 |
+
if ($this->is_disabled())
|
112 |
+
return;
|
|
|
|
|
|
|
113 |
|
114 |
+
if (apply_filters('run_ngg_resource_manager', $this->valid_request))
|
115 |
+
{
|
116 |
+
ob_start([$this, 'output_buffer_handler']);
|
117 |
+
ob_start([$this, 'get_buffer']);
|
118 |
|
119 |
+
add_action('wp_print_footer_scripts', [$this, 'get_resources'], 1);
|
120 |
+
add_action('admin_print_footer_scripts', [$this, 'get_resources'], 1);
|
121 |
+
add_action('shutdown', [$this, 'shutdown']);
|
|
|
|
|
|
|
|
|
122 |
}
|
123 |
}
|
124 |
|
|
|
|
|
|
|
125 |
function get_resources()
|
126 |
{
|
127 |
ob_start();
|
products/photocrati_nextgen/modules/attach_to_post/module.attach_to_post.php
CHANGED
@@ -105,12 +105,6 @@ class M_Attach_To_Post extends C_Base_Module
|
|
105 |
return (strpos($_SERVER['REQUEST_URI'], 'attach_to_post') !== FALSE OR (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'attach_to_post') !== FALSE) OR array_key_exists('attach_to_post', $_REQUEST));
|
106 |
}
|
107 |
|
108 |
-
function disable_resource_manager($retval)
|
109 |
-
{
|
110 |
-
if (isset($_REQUEST[NGG_ATTACH_TO_POST_SLUG])) $retval = FALSE;
|
111 |
-
return $retval;
|
112 |
-
}
|
113 |
-
|
114 |
function _register_hooks()
|
115 |
{
|
116 |
add_action('ngg_routes', array($this, 'define_routes'), 2);
|
@@ -128,9 +122,8 @@ class M_Attach_To_Post extends C_Base_Module
|
|
128 |
}
|
129 |
|
130 |
// Admin-only hooks
|
131 |
-
if (is_admin())
|
132 |
-
|
133 |
-
|
134 |
add_action(
|
135 |
'admin_enqueue_scripts',
|
136 |
array($this, 'enqueue_static_resources'),
|
105 |
return (strpos($_SERVER['REQUEST_URI'], 'attach_to_post') !== FALSE OR (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'attach_to_post') !== FALSE) OR array_key_exists('attach_to_post', $_REQUEST));
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
function _register_hooks()
|
109 |
{
|
110 |
add_action('ngg_routes', array($this, 'define_routes'), 2);
|
122 |
}
|
123 |
|
124 |
// Admin-only hooks
|
125 |
+
if (is_admin())
|
126 |
+
{
|
|
|
127 |
add_action(
|
128 |
'admin_enqueue_scripts',
|
129 |
array($this, 'enqueue_static_resources'),
|
products/photocrati_nextgen/modules/dynamic_stylesheet/package.module.dynamic_stylesheet.php
CHANGED
@@ -77,7 +77,7 @@ class Mixin_Dynamic_Stylesheet_Instance_Methods extends Mixin
|
|
77 |
wp_add_inline_style('ngg_dyncss', $css);
|
78 |
} else {
|
79 |
$data = $this->object->encode($data);
|
80 |
-
wp_enqueue_style('dyncss-' . $index . $data . '@dynamic', $this->object->get_router()->get_url("/{$this->object->_app}",
|
81 |
}
|
82 |
}
|
83 |
}
|
77 |
wp_add_inline_style('ngg_dyncss', $css);
|
78 |
} else {
|
79 |
$data = $this->object->encode($data);
|
80 |
+
wp_enqueue_style('dyncss-' . $index . $data . '@dynamic', $this->object->get_router()->get_url("/{$this->object->_app}", TRUE) . "?index={$index}&data={$data}", FALSE, NGG_SCRIPT_VERSION);
|
81 |
}
|
82 |
}
|
83 |
}
|
products/photocrati_nextgen/modules/dynamic_thumbnails/module.dynamic_thumbnails.php
CHANGED
@@ -20,7 +20,7 @@ class M_Dynamic_Thumbnails extends C_Base_Module
|
|
20 |
'photocrati-dynamic_thumbnails',
|
21 |
'Dynamic Thumbnails',
|
22 |
'Adds support for dynamic thumbnails',
|
23 |
-
'3.
|
24 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
25 |
'Imagely',
|
26 |
'https://www.imagely.com'
|
@@ -32,8 +32,7 @@ class M_Dynamic_Thumbnails extends C_Base_Module
|
|
32 |
function _register_utilities()
|
33 |
{
|
34 |
$this->get_registry()->add_utility('I_Dynamic_Thumbnails_Manager', 'C_Dynamic_Thumbnails_Manager');
|
35 |
-
|
36 |
-
$this->get_registry()->add_utility('I_Dynamic_Thumbnails_Controller', 'C_Dynamic_Thumbnails_Controller');
|
37 |
}
|
38 |
|
39 |
function _register_hooks()
|
20 |
'photocrati-dynamic_thumbnails',
|
21 |
'Dynamic Thumbnails',
|
22 |
'Adds support for dynamic thumbnails',
|
23 |
+
'3.9.0',
|
24 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
25 |
'Imagely',
|
26 |
'https://www.imagely.com'
|
32 |
function _register_utilities()
|
33 |
{
|
34 |
$this->get_registry()->add_utility('I_Dynamic_Thumbnails_Manager', 'C_Dynamic_Thumbnails_Manager');
|
35 |
+
$this->get_registry()->add_utility('I_Dynamic_Thumbnails_Controller', 'C_Dynamic_Thumbnails_Controller');
|
|
|
36 |
}
|
37 |
|
38 |
function _register_hooks()
|
products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php
CHANGED
@@ -26,7 +26,7 @@ class M_NextGen_Basic_Album extends C_Base_Module
|
|
26 |
NGG_BASIC_ALBUM,
|
27 |
'NextGEN Basic Album',
|
28 |
"Provides support for NextGEN's Basic Album",
|
29 |
-
'3.
|
30 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
31 |
'Imagely',
|
32 |
'https://www.imagely.com'
|
@@ -61,30 +61,26 @@ class M_NextGen_Basic_Album extends C_Base_Module
|
|
61 |
'A_NextGen_Basic_Album'
|
62 |
);
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
)
|
75 |
-
);
|
76 |
-
|
77 |
-
// Add a generic adapter for display types to do late url rewriting
|
78 |
-
$this->get_registry()->add_adapter(
|
79 |
-
'I_Displayed_Gallery_Renderer',
|
80 |
-
'A_NextGen_Basic_Album_Routes'
|
81 |
-
);
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
87 |
|
|
|
|
|
|
|
88 |
|
89 |
// Add a mapper for setting the defaults for the album
|
90 |
$this->get_registry()->add_adapter(
|
@@ -116,18 +112,16 @@ class M_NextGen_Basic_Album extends C_Base_Module
|
|
116 |
|
117 |
function _register_hooks()
|
118 |
{
|
119 |
-
if (!
|
120 |
-
&& (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES))
|
121 |
{
|
122 |
-
C_NextGen_Shortcode_Manager::add('album',
|
123 |
-
C_NextGen_Shortcode_Manager::add('nggalbum',
|
124 |
}
|
125 |
|
126 |
add_filter('ngg_atp_show_display_type', array($this, 'atp_show_basic_albums'), 10, 2);
|
127 |
|
128 |
-
add_filter('ngg_' . NGG_BASIC_COMPACT_ALBUM . '_template_dirs',
|
129 |
-
|
130 |
-
add_filter('ngg_' . NGG_BASIC_EXTENDED_ALBUM . '_template_dirs', array($this, 'filter_extended_view_dir'));
|
131 |
}
|
132 |
|
133 |
/**
|
@@ -161,19 +155,16 @@ class M_NextGen_Basic_Album extends C_Base_Module
|
|
161 |
/**
|
162 |
* Renders the shortcode for rendering an album
|
163 |
* @param array $params
|
164 |
-
* @
|
165 |
-
* @return string
|
166 |
*/
|
167 |
-
function ngglegacy_shortcode($params
|
168 |
{
|
169 |
$params['source'] = $this->_get_param('source', 'albums', $params);
|
170 |
$params['container_ids'] = $this->_get_param('id', NULL, $params);
|
171 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_COMPACT_ALBUM, $params);
|
172 |
|
173 |
unset($params['id']);
|
174 |
-
|
175 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
176 |
-
return $renderer->display_images($params, $inner_content);
|
177 |
}
|
178 |
|
179 |
function get_type_list()
|
@@ -185,7 +176,7 @@ class M_NextGen_Basic_Album extends C_Base_Module
|
|
185 |
'A_Nextgen_Basic_Album' => 'adapter.nextgen_basic_album.php',
|
186 |
'A_Nextgen_Basic_Album_Controller' => 'adapter.nextgen_basic_album_controller.php',
|
187 |
'A_Nextgen_Basic_Album_Mapper' => 'adapter.nextgen_basic_album_mapper.php',
|
188 |
-
'
|
189 |
'A_Nextgen_Basic_Album_Urls' => 'adapter.nextgen_basic_album_urls.php',
|
190 |
'A_Nextgen_Basic_Compact_Album_Form' => 'adapter.nextgen_basic_compact_album_form.php',
|
191 |
'A_Nextgen_Basic_Extended_Album_Form' => 'adapter.nextgen_basic_extended_album_form.php',
|
26 |
NGG_BASIC_ALBUM,
|
27 |
'NextGEN Basic Album',
|
28 |
"Provides support for NextGEN's Basic Album",
|
29 |
+
'3.9.0',
|
30 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
31 |
'Imagely',
|
32 |
'https://www.imagely.com'
|
61 |
'A_NextGen_Basic_Album'
|
62 |
);
|
63 |
|
64 |
+
// Add a controller for displaying albums on the front-end
|
65 |
+
$this->get_registry()->add_adapter(
|
66 |
+
'I_Display_Type_Controller',
|
67 |
+
'A_NextGen_Basic_Album_Controller',
|
68 |
+
array(
|
69 |
+
NGG_BASIC_COMPACT_ALBUM,
|
70 |
+
NGG_BASIC_EXTENDED_ALBUM,
|
71 |
+
$this->module_id
|
72 |
+
)
|
73 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
+
// Add a generic adapter for display types to do late url rewriting
|
76 |
+
$this->get_registry()->add_adapter(
|
77 |
+
'I_Displayed_Gallery_Renderer',
|
78 |
+
'A_NextGen_Basic_Album_Routes'
|
79 |
+
);
|
80 |
|
81 |
+
$this->get_registry()->add_adapter('I_MVC_View', 'A_NextGen_Album_Breadcrumbs');
|
82 |
+
$this->get_registry()->add_adapter('I_MVC_View', 'A_NextGen_Album_Descriptions');
|
83 |
+
$this->get_registry()->add_adapter('I_MVC_View', 'A_NextGen_Album_Child_Entities');
|
84 |
|
85 |
// Add a mapper for setting the defaults for the album
|
86 |
$this->get_registry()->add_adapter(
|
112 |
|
113 |
function _register_hooks()
|
114 |
{
|
115 |
+
if (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES)
|
|
|
116 |
{
|
117 |
+
C_NextGen_Shortcode_Manager::add('album', NULL, [$this, 'ngglegacy_shortcode']);
|
118 |
+
C_NextGen_Shortcode_Manager::add('nggalbum', NULL, [$this, 'ngglegacy_shortcode']);
|
119 |
}
|
120 |
|
121 |
add_filter('ngg_atp_show_display_type', array($this, 'atp_show_basic_albums'), 10, 2);
|
122 |
|
123 |
+
add_filter('ngg_' . NGG_BASIC_COMPACT_ALBUM . '_template_dirs', [$this, 'filter_compact_view_dir']);
|
124 |
+
add_filter('ngg_' . NGG_BASIC_EXTENDED_ALBUM . '_template_dirs', [$this, 'filter_extended_view_dir']);
|
|
|
125 |
}
|
126 |
|
127 |
/**
|
155 |
/**
|
156 |
* Renders the shortcode for rendering an album
|
157 |
* @param array $params
|
158 |
+
* @return array
|
|
|
159 |
*/
|
160 |
+
function ngglegacy_shortcode($params)
|
161 |
{
|
162 |
$params['source'] = $this->_get_param('source', 'albums', $params);
|
163 |
$params['container_ids'] = $this->_get_param('id', NULL, $params);
|
164 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_COMPACT_ALBUM, $params);
|
165 |
|
166 |
unset($params['id']);
|
167 |
+
return $params;
|
|
|
|
|
168 |
}
|
169 |
|
170 |
function get_type_list()
|
176 |
'A_Nextgen_Basic_Album' => 'adapter.nextgen_basic_album.php',
|
177 |
'A_Nextgen_Basic_Album_Controller' => 'adapter.nextgen_basic_album_controller.php',
|
178 |
'A_Nextgen_Basic_Album_Mapper' => 'adapter.nextgen_basic_album_mapper.php',
|
179 |
+
'A_NextGen_Basic_Album_Routes' => 'adapter.nextgen_basic_album_routes.php',
|
180 |
'A_Nextgen_Basic_Album_Urls' => 'adapter.nextgen_basic_album_urls.php',
|
181 |
'A_Nextgen_Basic_Compact_Album_Form' => 'adapter.nextgen_basic_compact_album_form.php',
|
182 |
'A_Nextgen_Basic_Extended_Album_Form' => 'adapter.nextgen_basic_extended_album_form.php',
|
products/photocrati_nextgen/modules/nextgen_basic_album/package.module.nextgen_basic_album.php
CHANGED
@@ -408,10 +408,46 @@ class A_NextGen_Basic_Album extends Mixin
|
|
408 |
* Class A_NextGen_Basic_Album_Controller
|
409 |
* @mixin C_Display_Type_Controller
|
410 |
* @adapts I_Display_Type_Controller
|
|
|
411 |
*/
|
412 |
class A_NextGen_Basic_Album_Controller extends Mixin_NextGen_Basic_Pagination
|
413 |
{
|
414 |
var $albums = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
415 |
/**
|
416 |
* Renders the front-end for the NextGen Basic Album display type
|
417 |
*
|
@@ -428,7 +464,6 @@ class A_NextGen_Basic_Album_Controller extends Mixin_NextGen_Basic_Pagination
|
|
428 |
// a parent_id, which is the album that it belongs to. We need to do this
|
429 |
// because the link to the gallery, is not /nggallery/gallery--id, but
|
430 |
// /nggallery/album--id/gallery--id
|
431 |
-
$parent_albums = $displayed_gallery->get_albums();
|
432 |
// Are we to display a gallery? Ensure our 'gallery' isn't just a paginated album view
|
433 |
$gallery = $gallery_slug = $this->param('gallery');
|
434 |
if ($gallery && strpos($gallery, 'nggpage--') !== 0) {
|
@@ -437,21 +472,16 @@ class A_NextGen_Basic_Album_Controller extends Mixin_NextGen_Basic_Pagination
|
|
437 |
return '';
|
438 |
}
|
439 |
$GLOBALS['nggShowGallery'] = TRUE;
|
440 |
-
$
|
441 |
-
if ($
|
442 |
-
$
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
|
|
448 |
}
|
449 |
-
add_filter('ngg_displayed_gallery_rendering', array($this, 'add_description_to_legacy_templates'), 8, 2);
|
450 |
-
add_filter('ngg_displayed_gallery_rendering', array($this, 'add_breadcrumbs_to_legacy_templates'), 9, 2);
|
451 |
-
$output = $renderer->display_images($gallery_params, $return);
|
452 |
-
remove_filter('ngg_displayed_gallery_rendering', array($this, 'add_breadcrumbs_to_legacy_templates'));
|
453 |
-
remove_filter('ngg_displayed_gallery_rendering', array($this, 'add_description_to_legacy_templates'));
|
454 |
-
return $output;
|
455 |
} else {
|
456 |
if ($album = $this->param('album')) {
|
457 |
// Are we to display a sub-album?
|
@@ -464,7 +494,7 @@ class A_NextGen_Basic_Album_Controller extends Mixin_NextGen_Basic_Pagination
|
|
464 |
$displayed_gallery->sortorder = array();
|
465 |
$displayed_gallery->container_ids = ($album === '0' or $album === 'all') ? array() : array($album);
|
466 |
$displayed_gallery->display_settings['original_album_id'] = 'a' . $album_sub;
|
467 |
-
$displayed_gallery->display_settings['original_album_entities'] = $
|
468 |
}
|
469 |
}
|
470 |
// Get the albums
|
@@ -741,11 +771,18 @@ class A_NextGen_Basic_Album_Mapper extends Mixin
|
|
741 |
* Class A_NextGen_Basic_Album_Routes
|
742 |
* @mixin C_Displayed_Gallery_Renderer
|
743 |
* @adapts I_Displayed_Gallery_Renderer
|
|
|
744 |
*/
|
745 |
class A_NextGen_Basic_Album_Routes extends Mixin
|
746 |
{
|
747 |
-
|
|
|
748 |
{
|
|
|
|
|
|
|
|
|
|
|
749 |
$do_rewrites = FALSE;
|
750 |
$app = NULL;
|
751 |
// Get display types
|
@@ -781,6 +818,10 @@ class A_NextGen_Basic_Album_Routes extends Mixin
|
|
781 |
if ($do_rewrites && $app) {
|
782 |
$app->do_rewrites();
|
783 |
}
|
|
|
|
|
|
|
|
|
784 |
return $this->call_parent('render', $displayed_gallery, $return, $mode);
|
785 |
}
|
786 |
}
|
408 |
* Class A_NextGen_Basic_Album_Controller
|
409 |
* @mixin C_Display_Type_Controller
|
410 |
* @adapts I_Display_Type_Controller
|
411 |
+
* @property C_Display_Type_Controller|A_NextGen_Basic_Album_Controller $object
|
412 |
*/
|
413 |
class A_NextGen_Basic_Album_Controller extends Mixin_NextGen_Basic_Pagination
|
414 |
{
|
415 |
var $albums = array();
|
416 |
+
protected static $alternate_displayed_galleries = array();
|
417 |
+
/**
|
418 |
+
* @param C_Displayed_Gallery $displayed_gallery
|
419 |
+
* @return C_Displayed_Gallery
|
420 |
+
*/
|
421 |
+
function get_alternate_displayed_gallery($displayed_gallery)
|
422 |
+
{
|
423 |
+
// Prevent recursive checks for further alternates causing additional modifications to the settings array
|
424 |
+
$id = $displayed_gallery->id();
|
425 |
+
if (!empty(self::$alternate_displayed_galleries[$id])) {
|
426 |
+
return self::$alternate_displayed_galleries[$id];
|
427 |
+
}
|
428 |
+
// Without this line the param() method will always return NULL when in wp_enqueue_scripts
|
429 |
+
$renderer = C_Displayed_Gallery_Renderer::get_instance('inner');
|
430 |
+
$renderer->do_app_rewrites($displayed_gallery);
|
431 |
+
$display_settings = $displayed_gallery->display_settings;
|
432 |
+
$gallery = $gallery_slug = $this->param('gallery');
|
433 |
+
if ($gallery && strpos($gallery, 'nggpage--') !== 0) {
|
434 |
+
$result = C_Gallery_Mapper::get_instance()->get_by_slug($gallery);
|
435 |
+
if ($result) {
|
436 |
+
$gallery = $result->{$result->id_field};
|
437 |
+
}
|
438 |
+
$parent_albums = $displayed_gallery->get_albums();
|
439 |
+
$gallery_params = array('source' => 'galleries', 'container_ids' => array($gallery), 'display_type' => $display_settings['gallery_display_type'], 'original_display_type' => $displayed_gallery->display_type, 'original_settings' => $display_settings, 'original_album_entities' => $parent_albums);
|
440 |
+
if (!empty($display_settings['gallery_display_template'])) {
|
441 |
+
$gallery_params['template'] = $display_settings['gallery_display_template'];
|
442 |
+
}
|
443 |
+
$displayed_gallery = $renderer->params_to_displayed_gallery($gallery_params);
|
444 |
+
if (is_null($displayed_gallery->id())) {
|
445 |
+
$displayed_gallery->id(md5(json_encode($displayed_gallery->get_entity())));
|
446 |
+
}
|
447 |
+
self::$alternate_displayed_galleries[$id] = $displayed_gallery;
|
448 |
+
}
|
449 |
+
return $displayed_gallery;
|
450 |
+
}
|
451 |
/**
|
452 |
* Renders the front-end for the NextGen Basic Album display type
|
453 |
*
|
464 |
// a parent_id, which is the album that it belongs to. We need to do this
|
465 |
// because the link to the gallery, is not /nggallery/gallery--id, but
|
466 |
// /nggallery/album--id/gallery--id
|
|
|
467 |
// Are we to display a gallery? Ensure our 'gallery' isn't just a paginated album view
|
468 |
$gallery = $gallery_slug = $this->param('gallery');
|
469 |
if ($gallery && strpos($gallery, 'nggpage--') !== 0) {
|
472 |
return '';
|
473 |
}
|
474 |
$GLOBALS['nggShowGallery'] = TRUE;
|
475 |
+
$alternate_displayed_gallery = $this->object->get_alternate_displayed_gallery($displayed_gallery);
|
476 |
+
if ($alternate_displayed_gallery !== $displayed_gallery) {
|
477 |
+
$renderer = C_Displayed_Gallery_Renderer::get_instance('inner');
|
478 |
+
add_filter('ngg_displayed_gallery_rendering', array($this, 'add_description_to_legacy_templates'), 8, 2);
|
479 |
+
add_filter('ngg_displayed_gallery_rendering', array($this, 'add_breadcrumbs_to_legacy_templates'), 9, 2);
|
480 |
+
$output = $renderer->display_images($alternate_displayed_gallery, $return);
|
481 |
+
remove_filter('ngg_displayed_gallery_rendering', array($this, 'add_breadcrumbs_to_legacy_templates'));
|
482 |
+
remove_filter('ngg_displayed_gallery_rendering', array($this, 'add_description_to_legacy_templates'));
|
483 |
+
return $output;
|
484 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
} else {
|
486 |
if ($album = $this->param('album')) {
|
487 |
// Are we to display a sub-album?
|
494 |
$displayed_gallery->sortorder = array();
|
495 |
$displayed_gallery->container_ids = ($album === '0' or $album === 'all') ? array() : array($album);
|
496 |
$displayed_gallery->display_settings['original_album_id'] = 'a' . $album_sub;
|
497 |
+
$displayed_gallery->display_settings['original_album_entities'] = $displayed_gallery->get_albums();
|
498 |
}
|
499 |
}
|
500 |
// Get the albums
|
771 |
* Class A_NextGen_Basic_Album_Routes
|
772 |
* @mixin C_Displayed_Gallery_Renderer
|
773 |
* @adapts I_Displayed_Gallery_Renderer
|
774 |
+
* @property A_NextGen_Basic_Album_Routes|C_Displayed_Gallery_Renderer $object
|
775 |
*/
|
776 |
class A_NextGen_Basic_Album_Routes extends Mixin
|
777 |
{
|
778 |
+
protected static $has_ran;
|
779 |
+
function do_app_rewrites($displayed_gallery)
|
780 |
{
|
781 |
+
if (self::$has_ran) {
|
782 |
+
return;
|
783 |
+
}
|
784 |
+
self::$has_ran = TRUE;
|
785 |
+
$this->object->call_parent('do_app_rewrites', $displayed_gallery);
|
786 |
$do_rewrites = FALSE;
|
787 |
$app = NULL;
|
788 |
// Get display types
|
818 |
if ($do_rewrites && $app) {
|
819 |
$app->do_rewrites();
|
820 |
}
|
821 |
+
}
|
822 |
+
function render($displayed_gallery, $return = FALSE, $mode = NULL)
|
823 |
+
{
|
824 |
+
$this->object->do_app_rewrites($displayed_gallery);
|
825 |
return $this->call_parent('render', $displayed_gallery, $return, $mode);
|
826 |
}
|
827 |
}
|
products/photocrati_nextgen/modules/nextgen_basic_gallery/module.nextgen_basic_gallery.php
CHANGED
@@ -37,7 +37,7 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
|
|
37 |
NGG_BASIC_GALLERY,
|
38 |
'NextGEN Basic Gallery',
|
39 |
"Provides NextGEN Gallery's basic thumbnail/slideshow integrated gallery",
|
40 |
-
'3.
|
41 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
42 |
'Imagely',
|
43 |
'https://www.imagely.com'
|
@@ -91,67 +91,36 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
|
|
91 |
);
|
92 |
}
|
93 |
|
94 |
-
//
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
'I_Display_Type_Controller',
|
100 |
-
'A_NextGen_Basic_Slideshow_Controller',
|
101 |
-
NGG_BASIC_SLIDESHOW
|
102 |
-
);
|
103 |
-
$this->get_registry()->add_adapter(
|
104 |
-
'I_Display_Type_Controller',
|
105 |
-
'A_NextGen_Basic_Thumbnails_Controller',
|
106 |
-
NGG_BASIC_THUMBNAILS
|
107 |
-
);
|
108 |
|
109 |
-
$this->get_registry()->add_adapter(
|
110 |
-
'I_Display_Type_Controller',
|
111 |
-
'A_NextGen_Basic_Gallery_Controller',
|
112 |
-
NGG_BASIC_SLIDESHOW
|
113 |
-
);
|
114 |
-
$this->get_registry()->add_adapter(
|
115 |
-
'I_Display_Type_Controller',
|
116 |
-
'A_NextGen_Basic_Gallery_Controller',
|
117 |
-
NGG_BASIC_THUMBNAILS
|
118 |
-
);
|
119 |
-
}
|
120 |
-
|
121 |
// Provide defaults for the display types
|
122 |
-
$this->get_registry()->add_adapter(
|
123 |
-
'I_Display_Type_Mapper',
|
124 |
-
'A_NextGen_Basic_Gallery_Mapper'
|
125 |
-
);
|
126 |
|
127 |
// Provides validation for the display types
|
128 |
-
$this->get_registry()->add_adapter(
|
129 |
-
'I_Display_Type',
|
130 |
-
'A_NextGen_Basic_Gallery_Validation'
|
131 |
-
);
|
132 |
|
133 |
// Provides url generation support for the display types
|
134 |
-
$this->get_registry()->add_adapter(
|
135 |
-
'I_Routing_App',
|
136 |
-
'A_NextGen_Basic_Gallery_Urls'
|
137 |
-
);
|
138 |
}
|
139 |
|
140 |
function _register_hooks()
|
141 |
{
|
142 |
-
if (
|
143 |
-
&& (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES))
|
144 |
{
|
145 |
-
C_NextGen_Shortcode_Manager::add('random',
|
146 |
-
C_NextGen_Shortcode_Manager::add('recent',
|
147 |
-
C_NextGen_Shortcode_Manager::add('thumb',
|
148 |
-
C_NextGen_Shortcode_Manager::add('slideshow',
|
149 |
-
C_NextGen_Shortcode_Manager::add('nggallery',
|
150 |
-
C_NextGen_Shortcode_Manager::add('nggtags',
|
151 |
-
C_NextGen_Shortcode_Manager::add('nggslideshow',
|
152 |
-
C_NextGen_Shortcode_Manager::add('nggrandom',
|
153 |
-
C_NextGen_Shortcode_Manager::add('nggrecent',
|
154 |
-
C_NextGen_Shortcode_Manager::add('nggthumb',
|
155 |
}
|
156 |
|
157 |
add_action('ngg_routes', array(&$this, 'define_routes'));
|
@@ -202,100 +171,81 @@ class M_NextGen_Basic_Gallery extends C_Base_Module
|
|
202 |
return (isset($params[$name])) ? $params[$name] : $default;
|
203 |
}
|
204 |
|
|
|
205 |
/**
|
206 |
* Short-cut for rendering an thumbnail gallery
|
207 |
* @param array $params
|
208 |
-
* @
|
209 |
-
* @return string
|
210 |
*/
|
211 |
-
function
|
212 |
{
|
213 |
$params['gallery_ids'] = $this->_get_param('id', NULL, $params);
|
214 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
215 |
if (isset($params['images']))
|
216 |
-
{
|
217 |
$params['images_per_page'] = $this->_get_param('images', NULL, $params);
|
218 |
-
}
|
219 |
unset($params['id']);
|
220 |
unset($params['images']);
|
221 |
-
|
222 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
223 |
-
return $renderer->display_images($params, $inner_content);
|
224 |
}
|
225 |
|
226 |
-
function render_based_on_tags($params
|
227 |
{
|
228 |
$params['tag_ids'] = $this->_get_param('gallery', $this->_get_param('album', array(), $params), $params);
|
229 |
$params['source'] = $this->_get_param('source', 'tags', $params);
|
230 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
231 |
unset($params['gallery']);
|
232 |
-
|
233 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
234 |
-
return $renderer->display_images($params, $inner_content);
|
235 |
}
|
236 |
|
237 |
-
function render_random_images($params
|
238 |
{
|
239 |
$params['source'] = $this->_get_param('source', 'random', $params);
|
240 |
$params['images_per_page'] = $this->_get_param('max', NULL, $params);
|
241 |
$params['disable_pagination'] = $this->_get_param('disable_pagination', TRUE, $params);
|
242 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
243 |
|
244 |
-
// inside if because Mixin_Displayed_Gallery_Instance_Methods->get_entities() doesn't handle NULL container_ids
|
245 |
-
// correctly
|
246 |
if (isset($params['id']))
|
247 |
-
{
|
248 |
$params['container_ids'] = $this->_get_param('id', NULL, $params);
|
249 |
-
}
|
250 |
|
251 |
unset($params['max']);
|
252 |
unset($params['id']);
|
253 |
-
|
254 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
255 |
-
return $renderer->display_images($params, $inner_content);
|
256 |
}
|
257 |
|
258 |
-
function render_recent_images($params
|
259 |
{
|
260 |
-
|
261 |
$params['images_per_page'] = $this->_get_param('max', NULL, $params);
|
262 |
$params['disable_pagination'] = $this->_get_param('disable_pagination', TRUE, $params);
|
263 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
264 |
|
265 |
if (isset($params['id']))
|
266 |
-
{
|
267 |
$params['container_ids'] = $this->_get_param('id', NULL, $params);
|
268 |
-
}
|
269 |
|
270 |
unset($params['max']);
|
271 |
unset($params['id']);
|
272 |
-
|
273 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
274 |
-
return $renderer->display_images($params, $inner_content);
|
275 |
}
|
276 |
|
277 |
-
function render_thumb_shortcode($params
|
278 |
{
|
279 |
$params['entity_ids'] = $this->_get_param('id', NULL, $params);
|
280 |
$params['source'] = $this->_get_param('source', 'galleries', $params);
|
281 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
282 |
unset($params['id']);
|
283 |
-
|
284 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
285 |
-
return $renderer->display_images($params, $inner_content);
|
286 |
}
|
287 |
|
288 |
-
function render_slideshow($params
|
289 |
{
|
290 |
$params['gallery_ids'] = $this->_get_param('id', NULL, $params);
|
291 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_SLIDESHOW, $params);
|
292 |
$params['gallery_width'] = $this->_get_param('w', NULL, $params);
|
293 |
$params['gallery_height'] = $this->_get_param('h', NULL, $params);
|
294 |
unset($params['id'], $params['w'], $params['h']);
|
295 |
-
|
296 |
-
|
297 |
-
return $renderer->display_images($params, $inner_content);
|
298 |
-
}
|
299 |
|
300 |
function filter_thumbnail_view_dir($dirs)
|
301 |
{
|
37 |
NGG_BASIC_GALLERY,
|
38 |
'NextGEN Basic Gallery',
|
39 |
"Provides NextGEN Gallery's basic thumbnail/slideshow integrated gallery",
|
40 |
+
'3.9.0',
|
41 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
42 |
'Imagely',
|
43 |
'https://www.imagely.com'
|
91 |
);
|
92 |
}
|
93 |
|
94 |
+
// Provides the controllers for the display types
|
95 |
+
$this->get_registry()->add_adapter('I_Display_Type_Controller', 'A_NextGen_Basic_Slideshow_Controller', NGG_BASIC_SLIDESHOW);
|
96 |
+
$this->get_registry()->add_adapter('I_Display_Type_Controller', 'A_NextGen_Basic_Thumbnails_Controller', NGG_BASIC_THUMBNAILS);
|
97 |
+
$this->get_registry()->add_adapter('I_Display_Type_Controller', 'A_NextGen_Basic_Gallery_Controller', NGG_BASIC_SLIDESHOW);
|
98 |
+
$this->get_registry()->add_adapter('I_Display_Type_Controller', 'A_NextGen_Basic_Gallery_Controller', NGG_BASIC_THUMBNAILS);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
// Provide defaults for the display types
|
101 |
+
$this->get_registry()->add_adapter('I_Display_Type_Mapper', 'A_NextGen_Basic_Gallery_Mapper');
|
|
|
|
|
|
|
102 |
|
103 |
// Provides validation for the display types
|
104 |
+
$this->get_registry()->add_adapter('I_Display_Type', 'A_NextGen_Basic_Gallery_Validation');
|
|
|
|
|
|
|
105 |
|
106 |
// Provides url generation support for the display types
|
107 |
+
$this->get_registry()->add_adapter('I_Routing_App', 'A_NextGen_Basic_Gallery_Urls');
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
function _register_hooks()
|
111 |
{
|
112 |
+
if (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES)
|
|
|
113 |
{
|
114 |
+
C_NextGen_Shortcode_Manager::add('random', NULL, [$this, 'render_random_images']);
|
115 |
+
C_NextGen_Shortcode_Manager::add('recent', NULL, [$this, 'render_recent_images']);
|
116 |
+
C_NextGen_Shortcode_Manager::add('thumb', NULL, [$this, 'render_thumb_shortcode']);
|
117 |
+
C_NextGen_Shortcode_Manager::add('slideshow', NULL, [$this, 'render_slideshow']);
|
118 |
+
C_NextGen_Shortcode_Manager::add('nggallery', NULL, [$this, 'render_nggallery']);
|
119 |
+
C_NextGen_Shortcode_Manager::add('nggtags', NULL, [$this, 'render_based_on_tags']);
|
120 |
+
C_NextGen_Shortcode_Manager::add('nggslideshow', NULL, [$this, 'render_slideshow']);
|
121 |
+
C_NextGen_Shortcode_Manager::add('nggrandom', NULL, [$this, 'render_random_images']);
|
122 |
+
C_NextGen_Shortcode_Manager::add('nggrecent', NULL, [$this, 'render_recent_images']);
|
123 |
+
C_NextGen_Shortcode_Manager::add('nggthumb', NULL, [$this, 'render_thumb_shortcode']);
|
124 |
}
|
125 |
|
126 |
add_action('ngg_routes', array(&$this, 'define_routes'));
|
171 |
return (isset($params[$name])) ? $params[$name] : $default;
|
172 |
}
|
173 |
|
174 |
+
|
175 |
/**
|
176 |
* Short-cut for rendering an thumbnail gallery
|
177 |
* @param array $params
|
178 |
+
* @return array
|
|
|
179 |
*/
|
180 |
+
function render_nggallery($params)
|
181 |
{
|
182 |
$params['gallery_ids'] = $this->_get_param('id', NULL, $params);
|
183 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
184 |
if (isset($params['images']))
|
|
|
185 |
$params['images_per_page'] = $this->_get_param('images', NULL, $params);
|
|
|
186 |
unset($params['id']);
|
187 |
unset($params['images']);
|
188 |
+
return $params;
|
|
|
|
|
189 |
}
|
190 |
|
191 |
+
function render_based_on_tags($params)
|
192 |
{
|
193 |
$params['tag_ids'] = $this->_get_param('gallery', $this->_get_param('album', array(), $params), $params);
|
194 |
$params['source'] = $this->_get_param('source', 'tags', $params);
|
195 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
196 |
unset($params['gallery']);
|
197 |
+
return $params;
|
|
|
|
|
198 |
}
|
199 |
|
200 |
+
function render_random_images($params)
|
201 |
{
|
202 |
$params['source'] = $this->_get_param('source', 'random', $params);
|
203 |
$params['images_per_page'] = $this->_get_param('max', NULL, $params);
|
204 |
$params['disable_pagination'] = $this->_get_param('disable_pagination', TRUE, $params);
|
205 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
206 |
|
207 |
+
// inside if because Mixin_Displayed_Gallery_Instance_Methods->get_entities() doesn't handle NULL container_ids correctly
|
|
|
208 |
if (isset($params['id']))
|
|
|
209 |
$params['container_ids'] = $this->_get_param('id', NULL, $params);
|
|
|
210 |
|
211 |
unset($params['max']);
|
212 |
unset($params['id']);
|
213 |
+
return $params;
|
|
|
|
|
214 |
}
|
215 |
|
216 |
+
function render_recent_images($params)
|
217 |
{
|
218 |
+
$params['source'] = $this->_get_param('source', 'recent', $params);
|
219 |
$params['images_per_page'] = $this->_get_param('max', NULL, $params);
|
220 |
$params['disable_pagination'] = $this->_get_param('disable_pagination', TRUE, $params);
|
221 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
222 |
|
223 |
if (isset($params['id']))
|
|
|
224 |
$params['container_ids'] = $this->_get_param('id', NULL, $params);
|
|
|
225 |
|
226 |
unset($params['max']);
|
227 |
unset($params['id']);
|
228 |
+
return $params;
|
|
|
|
|
229 |
}
|
230 |
|
231 |
+
function render_thumb_shortcode($params)
|
232 |
{
|
233 |
$params['entity_ids'] = $this->_get_param('id', NULL, $params);
|
234 |
$params['source'] = $this->_get_param('source', 'galleries', $params);
|
235 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_THUMBNAILS, $params);
|
236 |
unset($params['id']);
|
237 |
+
return $params;
|
|
|
|
|
238 |
}
|
239 |
|
240 |
+
function render_slideshow($params)
|
241 |
{
|
242 |
$params['gallery_ids'] = $this->_get_param('id', NULL, $params);
|
243 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_SLIDESHOW, $params);
|
244 |
$params['gallery_width'] = $this->_get_param('w', NULL, $params);
|
245 |
$params['gallery_height'] = $this->_get_param('h', NULL, $params);
|
246 |
unset($params['id'], $params['w'], $params['h']);
|
247 |
+
return $params;
|
248 |
+
}
|
|
|
|
|
249 |
|
250 |
function filter_thumbnail_view_dir($dirs)
|
251 |
{
|
products/photocrati_nextgen/modules/nextgen_basic_gallery/package.module.nextgen_basic_gallery.php
CHANGED
@@ -3,13 +3,22 @@
|
|
3 |
* Class A_NextGen_Basic_Gallery_Controller
|
4 |
* @mixin C_Display_Type_Controller
|
5 |
* @adapts I_Display_Type_Controller for both "photocrati-nextgen_basic_slideshow" and "photocrati-nextgen_basic_thumbnails" contexts
|
|
|
6 |
*/
|
7 |
class A_NextGen_Basic_Gallery_Controller extends Mixin
|
8 |
{
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
10 |
{
|
11 |
-
|
12 |
-
$
|
|
|
|
|
|
|
13 |
$show = $this->object->param('show');
|
14 |
$pid = $this->object->param('pid');
|
15 |
if (!empty($pid) && isset($displayed_gallery->display_settings['use_imagebrowser_effect']) && intval($displayed_gallery->display_settings['use_imagebrowser_effect'])) {
|
@@ -22,16 +31,27 @@ class A_NextGen_Basic_Gallery_Controller extends Mixin
|
|
22 |
if ((!empty($ds['show_slideshow_link']) || !empty($ds['show_thumbnail_link']) || !empty($ds['use_imagebrowser_effect'])) && $show != $this->object->context) {
|
23 |
// Render the new display type
|
24 |
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
25 |
-
$
|
26 |
-
$
|
27 |
-
$
|
28 |
-
$params = (array) $displayed_gallery->get_entity();
|
29 |
$params['display_settings'] = array();
|
30 |
-
$
|
31 |
-
$
|
|
|
|
|
|
|
32 |
}
|
33 |
}
|
34 |
-
return $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
/**
|
37 |
* Returns a url to view the displayed gallery using an alternate display
|
3 |
* Class A_NextGen_Basic_Gallery_Controller
|
4 |
* @mixin C_Display_Type_Controller
|
5 |
* @adapts I_Display_Type_Controller for both "photocrati-nextgen_basic_slideshow" and "photocrati-nextgen_basic_thumbnails" contexts
|
6 |
+
* @property C_Display_Type_Controller|A_NextGen_Basic_Gallery_Controller $object
|
7 |
*/
|
8 |
class A_NextGen_Basic_Gallery_Controller extends Mixin
|
9 |
{
|
10 |
+
protected static $alternate_displayed_galleries = array();
|
11 |
+
/**
|
12 |
+
* @param C_Displayed_Gallery $displayed_gallery
|
13 |
+
* @return C_Displayed_Gallery
|
14 |
+
*/
|
15 |
+
function get_alternate_displayed_gallery($displayed_gallery)
|
16 |
{
|
17 |
+
// Prevent recursive checks for further alternates causing additional modifications to the settings array
|
18 |
+
$id = $displayed_gallery->id();
|
19 |
+
if (!empty(self::$alternate_displayed_galleries[$id])) {
|
20 |
+
return self::$alternate_displayed_galleries[$id];
|
21 |
+
}
|
22 |
$show = $this->object->param('show');
|
23 |
$pid = $this->object->param('pid');
|
24 |
if (!empty($pid) && isset($displayed_gallery->display_settings['use_imagebrowser_effect']) && intval($displayed_gallery->display_settings['use_imagebrowser_effect'])) {
|
31 |
if ((!empty($ds['show_slideshow_link']) || !empty($ds['show_thumbnail_link']) || !empty($ds['use_imagebrowser_effect'])) && $show != $this->object->context) {
|
32 |
// Render the new display type
|
33 |
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
34 |
+
$params['original_display_type'] = $displayed_gallery->display_type;
|
35 |
+
$params['original_settings'] = $displayed_gallery->display_settings;
|
36 |
+
$params['display_type'] = $show;
|
|
|
37 |
$params['display_settings'] = array();
|
38 |
+
$displayed_gallery = $renderer->params_to_displayed_gallery($params);
|
39 |
+
if (is_null($displayed_gallery->id())) {
|
40 |
+
$displayed_gallery->id(md5(json_encode($displayed_gallery->get_entity())));
|
41 |
+
}
|
42 |
+
self::$alternate_displayed_galleries[$id] = $displayed_gallery;
|
43 |
}
|
44 |
}
|
45 |
+
return $displayed_gallery;
|
46 |
+
}
|
47 |
+
function index_action($displayed_gallery, $return = FALSE)
|
48 |
+
{
|
49 |
+
$alternate_displayed_gallery = $this->object->get_alternate_displayed_gallery($displayed_gallery);
|
50 |
+
if ($displayed_gallery !== $alternate_displayed_gallery) {
|
51 |
+
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
52 |
+
return $renderer->display_images($alternate_displayed_gallery, $return);
|
53 |
+
}
|
54 |
+
return $this->call_parent('index_action', $displayed_gallery, $return);
|
55 |
}
|
56 |
/**
|
57 |
* Returns a url to view the displayed gallery using an alternate display
|
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php
CHANGED
@@ -17,7 +17,7 @@ class M_NextGen_Basic_ImageBrowser extends C_Base_Module
|
|
17 |
NGG_BASIC_IMAGEBROWSER,
|
18 |
'NextGEN Basic ImageBrowser',
|
19 |
'Provides the NextGEN Basic ImageBrowser Display Type',
|
20 |
-
'3.
|
21 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
22 |
'Imagely',
|
23 |
'https://www.imagely.com'
|
@@ -50,17 +50,15 @@ class M_NextGen_Basic_ImageBrowser extends C_Base_Module
|
|
50 |
if (M_Attach_To_Post::is_atp_url() || is_admin())
|
51 |
$registry->add_adapter('I_Form', 'A_NextGen_Basic_ImageBrowser_Form', $this->module_id);
|
52 |
|
53 |
-
|
54 |
-
$registry->add_adapter('I_Display_Type_Controller', 'A_NextGen_Basic_ImageBrowser_Controller', $this->module_id);
|
55 |
}
|
56 |
|
57 |
function _register_hooks()
|
58 |
{
|
59 |
-
if (
|
60 |
-
&& (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES))
|
61 |
{
|
62 |
-
C_NextGen_Shortcode_Manager::add('imagebrowser',
|
63 |
-
C_NextGen_Shortcode_Manager::add('nggimagebrowser',
|
64 |
}
|
65 |
|
66 |
add_action('ngg_routes', array(&$this, 'define_routes'));
|
@@ -85,16 +83,14 @@ class M_NextGen_Basic_ImageBrowser extends C_Base_Module
|
|
85 |
return (isset($params[$name])) ? $params[$name] : $default;
|
86 |
}
|
87 |
|
88 |
-
function render_shortcode($params
|
89 |
{
|
90 |
$params['gallery_ids'] = $this->_get_param('id', NULL, $params);
|
91 |
$params['source'] = $this->_get_param('source', 'galleries', $params);
|
92 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_IMAGEBROWSER, $params);
|
93 |
|
94 |
unset($params['id']);
|
95 |
-
|
96 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
97 |
-
return $renderer->display_images($params, $inner_content);
|
98 |
}
|
99 |
|
100 |
function get_type_list()
|
17 |
NGG_BASIC_IMAGEBROWSER,
|
18 |
'NextGEN Basic ImageBrowser',
|
19 |
'Provides the NextGEN Basic ImageBrowser Display Type',
|
20 |
+
'3.9.0',
|
21 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
22 |
'Imagely',
|
23 |
'https://www.imagely.com'
|
50 |
if (M_Attach_To_Post::is_atp_url() || is_admin())
|
51 |
$registry->add_adapter('I_Form', 'A_NextGen_Basic_ImageBrowser_Form', $this->module_id);
|
52 |
|
53 |
+
$registry->add_adapter('I_Display_Type_Controller', 'A_NextGen_Basic_ImageBrowser_Controller', $this->module_id);
|
|
|
54 |
}
|
55 |
|
56 |
function _register_hooks()
|
57 |
{
|
58 |
+
if (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES)
|
|
|
59 |
{
|
60 |
+
C_NextGen_Shortcode_Manager::add('imagebrowser', NULL, [$this, 'render_shortcode']);
|
61 |
+
C_NextGen_Shortcode_Manager::add('nggimagebrowser', NULL, [$this, 'render_shortcode']);
|
62 |
}
|
63 |
|
64 |
add_action('ngg_routes', array(&$this, 'define_routes'));
|
83 |
return (isset($params[$name])) ? $params[$name] : $default;
|
84 |
}
|
85 |
|
86 |
+
function render_shortcode($params)
|
87 |
{
|
88 |
$params['gallery_ids'] = $this->_get_param('id', NULL, $params);
|
89 |
$params['source'] = $this->_get_param('source', 'galleries', $params);
|
90 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_IMAGEBROWSER, $params);
|
91 |
|
92 |
unset($params['id']);
|
93 |
+
return $params;
|
|
|
|
|
94 |
}
|
95 |
|
96 |
function get_type_list()
|
products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/package.module.nextgen_basic_imagebrowser.php
CHANGED
@@ -148,7 +148,7 @@ class A_NextGen_Basic_ImageBrowser_Controller extends Mixin
|
|
148 |
{
|
149 |
$this->call_parent('enqueue_frontend_resources', $displayed_gallery);
|
150 |
wp_enqueue_style('nextgen_basic_imagebrowser_style', $this->get_static_url('photocrati-nextgen_basic_imagebrowser#style.css'), array(), NGG_SCRIPT_VERSION);
|
151 |
-
wp_enqueue_script('nextgen_basic_imagebrowser_script', $this->object->get_static_url(NGG_BASIC_IMAGEBROWSER . '#imagebrowser.js'), array('ngg_common'), NGG_SCRIPT_VERSION);
|
152 |
$this->enqueue_ngg_styles();
|
153 |
}
|
154 |
}
|
148 |
{
|
149 |
$this->call_parent('enqueue_frontend_resources', $displayed_gallery);
|
150 |
wp_enqueue_style('nextgen_basic_imagebrowser_style', $this->get_static_url('photocrati-nextgen_basic_imagebrowser#style.css'), array(), NGG_SCRIPT_VERSION);
|
151 |
+
wp_enqueue_script('nextgen_basic_imagebrowser_script', $this->object->get_static_url(NGG_BASIC_IMAGEBROWSER . '#imagebrowser.js'), array('ngg_common'), NGG_SCRIPT_VERSION, TRUE);
|
152 |
$this->enqueue_ngg_styles();
|
153 |
}
|
154 |
}
|
products/photocrati_nextgen/modules/nextgen_basic_singlepic/module.nextgen_basic_singlepic.php
CHANGED
@@ -24,7 +24,7 @@ class M_NextGen_Basic_Singlepic extends C_Base_Module
|
|
24 |
NGG_BASIC_SINGLEPIC,
|
25 |
'NextGen Basic Singlepic',
|
26 |
'Provides a singlepic gallery for NextGEN Gallery',
|
27 |
-
'3.
|
28 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
29 |
'Imagely',
|
30 |
'https://www.imagely.com'
|
@@ -48,43 +48,27 @@ class M_NextGen_Basic_Singlepic extends C_Base_Module
|
|
48 |
function _register_adapters()
|
49 |
{
|
50 |
// Provides default values for the display type
|
51 |
-
$this->get_registry()->add_adapter(
|
52 |
-
'I_Display_Type_Mapper',
|
53 |
-
'A_NextGen_Basic_Singlepic_Mapper'
|
54 |
-
);
|
55 |
|
|
|
56 |
if (M_Attach_To_Post::is_atp_url() || is_admin())
|
57 |
-
|
58 |
-
// Provides the display settings form for the SinglePic display type
|
59 |
-
$this->get_registry()->add_adapter(
|
60 |
-
'I_Form',
|
61 |
-
'A_NextGen_Basic_SinglePic_Form',
|
62 |
-
$this->module_id
|
63 |
-
);
|
64 |
-
}
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
// Provides settings fields and frontend rendering
|
69 |
-
$this->get_registry()->add_adapter(
|
70 |
-
'I_Display_Type_Controller',
|
71 |
-
'A_NextGen_Basic_Singlepic_Controller',
|
72 |
-
$this->module_id
|
73 |
-
);
|
74 |
-
}
|
75 |
}
|
76 |
|
77 |
function _register_hooks()
|
78 |
{
|
79 |
-
if (
|
80 |
-
&& (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES))
|
81 |
{
|
82 |
-
C_NextGen_Shortcode_Manager::add('singlepic',
|
83 |
-
C_NextGen_Shortcode_Manager::add('nggsinglepic',
|
84 |
|
85 |
// TODO - why aren't we using the singlepic controller for this instead?
|
86 |
// enqueue the singlepic CSS if an inline image has the ngg-singlepic class
|
87 |
-
if (!$this->is_rest_request())
|
|
|
88 |
}
|
89 |
}
|
90 |
|
@@ -127,14 +111,12 @@ class M_NextGen_Basic_Singlepic extends C_Base_Module
|
|
127 |
return (isset($params[$name])) ? $params[$name] : $default;
|
128 |
}
|
129 |
|
130 |
-
function render_singlepic($params
|
131 |
{
|
132 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_SINGLEPIC, $params);
|
133 |
$params['image_ids'] = $this->_get_param('id', NULL, $params);
|
134 |
unset($params['id']);
|
135 |
-
|
136 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
137 |
-
return $renderer->display_images($params, $inner_content);
|
138 |
}
|
139 |
|
140 |
function get_type_list()
|
24 |
NGG_BASIC_SINGLEPIC,
|
25 |
'NextGen Basic Singlepic',
|
26 |
'Provides a singlepic gallery for NextGEN Gallery',
|
27 |
+
'3.9.0',
|
28 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
29 |
'Imagely',
|
30 |
'https://www.imagely.com'
|
48 |
function _register_adapters()
|
49 |
{
|
50 |
// Provides default values for the display type
|
51 |
+
$this->get_registry()->add_adapter('I_Display_Type_Mapper', 'A_NextGen_Basic_Singlepic_Mapper');
|
|
|
|
|
|
|
52 |
|
53 |
+
// Provides the display settings form for the SinglePic display type
|
54 |
if (M_Attach_To_Post::is_atp_url() || is_admin())
|
55 |
+
$this->get_registry()->add_adapter('I_Form', 'A_NextGen_Basic_SinglePic_Form', $this->module_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
+
// Provides settings fields and frontend rendering
|
58 |
+
$this->get_registry()->add_adapter('I_Display_Type_Controller', 'A_NextGen_Basic_Singlepic_Controller', $this->module_id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
function _register_hooks()
|
62 |
{
|
63 |
+
if (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES)
|
|
|
64 |
{
|
65 |
+
C_NextGen_Shortcode_Manager::add('singlepic', NULL, [$this, 'render_singlepic']);
|
66 |
+
C_NextGen_Shortcode_Manager::add('nggsinglepic', NULL, [$this, 'render_singlepic']);
|
67 |
|
68 |
// TODO - why aren't we using the singlepic controller for this instead?
|
69 |
// enqueue the singlepic CSS if an inline image has the ngg-singlepic class
|
70 |
+
if (!$this->is_rest_request())
|
71 |
+
add_filter('the_content', array(&$this, 'enqueue_singlepic_css'), PHP_INT_MAX, 1);
|
72 |
}
|
73 |
}
|
74 |
|
111 |
return (isset($params[$name])) ? $params[$name] : $default;
|
112 |
}
|
113 |
|
114 |
+
function render_singlepic($params)
|
115 |
{
|
116 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_SINGLEPIC, $params);
|
117 |
$params['image_ids'] = $this->_get_param('id', NULL, $params);
|
118 |
unset($params['id']);
|
119 |
+
return $params;
|
|
|
|
|
120 |
}
|
121 |
|
122 |
function get_type_list()
|
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php
CHANGED
@@ -24,7 +24,7 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
|
|
24 |
NGG_BASIC_TAGCLOUD,
|
25 |
'NextGen Basic Tagcloud',
|
26 |
'Provides a tagcloud for NextGEN Gallery',
|
27 |
-
'3.
|
28 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
29 |
'Imagely',
|
30 |
'https://www.imagely.com'
|
@@ -47,8 +47,7 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
|
|
47 |
|
48 |
function _register_utilities()
|
49 |
{
|
50 |
-
|
51 |
-
$this->get_registry()->add_utility('I_Taxonomy_Controller', 'C_Taxonomy_Controller');
|
52 |
}
|
53 |
|
54 |
function _register_adapters()
|
@@ -75,40 +74,28 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
|
|
75 |
);
|
76 |
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
$this->module_id
|
85 |
-
);
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
}
|
93 |
}
|
94 |
|
95 |
function _register_hooks()
|
96 |
{
|
97 |
-
if (
|
98 |
-
&& (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES))
|
99 |
{
|
100 |
-
C_NextGen_Shortcode_Manager::add('tagcloud',
|
101 |
-
C_NextGen_Shortcode_Manager::add('nggtagcloud',
|
102 |
-
|
103 |
-
add_filter(
|
104 |
-
'the_posts',
|
105 |
-
array(
|
106 |
-
C_Taxonomy_Controller::get_instance(),
|
107 |
-
'detect_ngg_tag'
|
108 |
-
),
|
109 |
-
-10,
|
110 |
-
2
|
111 |
-
);
|
112 |
}
|
113 |
|
114 |
add_action('ngg_routes', array(&$this, 'define_routes'));
|
@@ -136,17 +123,14 @@ class M_NextGen_Basic_Tagcloud extends C_Base_Module
|
|
136 |
/**
|
137 |
* Short-cut for rendering a thumbnail gallery based on tags
|
138 |
* @param array $params
|
139 |
-
* @
|
140 |
-
* @return string
|
141 |
*/
|
142 |
-
function render_shortcode($params
|
143 |
{
|
144 |
$params['tagcloud'] = $this->_get_param('tagcloud', 'yes', $params);
|
145 |
$params['source'] = $this->_get_param('source', 'tags', $params);
|
146 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_TAGCLOUD, $params);
|
147 |
-
|
148 |
-
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
149 |
-
return $renderer->display_images($params, $inner_content);
|
150 |
}
|
151 |
|
152 |
function get_type_list()
|
24 |
NGG_BASIC_TAGCLOUD,
|
25 |
'NextGen Basic Tagcloud',
|
26 |
'Provides a tagcloud for NextGEN Gallery',
|
27 |
+
'3.9.0',
|
28 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
29 |
'Imagely',
|
30 |
'https://www.imagely.com'
|
47 |
|
48 |
function _register_utilities()
|
49 |
{
|
50 |
+
$this->get_registry()->add_utility('I_Taxonomy_Controller', 'C_Taxonomy_Controller');
|
|
|
51 |
}
|
52 |
|
53 |
function _register_adapters()
|
74 |
);
|
75 |
}
|
76 |
|
77 |
+
// Provides settings fields and frontend rendering
|
78 |
+
$this->get_registry()->add_adapter(
|
79 |
+
'I_Display_Type_Controller',
|
80 |
+
'A_NextGen_Basic_Tagcloud_Controller',
|
81 |
+
$this->module_id
|
82 |
+
);
|
|
|
|
|
83 |
|
84 |
+
// Add legacy urls
|
85 |
+
$this->get_registry()->add_adapter(
|
86 |
+
'I_Routing_App',
|
87 |
+
'A_NextGen_Basic_TagCloud_Urls'
|
88 |
+
);
|
|
|
89 |
}
|
90 |
|
91 |
function _register_hooks()
|
92 |
{
|
93 |
+
if (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES)
|
|
|
94 |
{
|
95 |
+
C_NextGen_Shortcode_Manager::add('tagcloud', NULL, [$this, 'render_shortcode']);
|
96 |
+
C_NextGen_Shortcode_Manager::add('nggtagcloud', NULL, [$this, 'render_shortcode']);
|
97 |
+
|
98 |
+
add_filter('the_posts', [C_Taxonomy_Controller::get_instance(), 'detect_ngg_tag'], -10, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
|
101 |
add_action('ngg_routes', array(&$this, 'define_routes'));
|
123 |
/**
|
124 |
* Short-cut for rendering a thumbnail gallery based on tags
|
125 |
* @param array $params
|
126 |
+
* @return array
|
|
|
127 |
*/
|
128 |
+
function render_shortcode($params)
|
129 |
{
|
130 |
$params['tagcloud'] = $this->_get_param('tagcloud', 'yes', $params);
|
131 |
$params['source'] = $this->_get_param('source', 'tags', $params);
|
132 |
$params['display_type'] = $this->_get_param('display_type', NGG_BASIC_TAGCLOUD, $params);
|
133 |
+
return $params;
|
|
|
|
|
134 |
}
|
135 |
|
136 |
function get_type_list()
|
products/photocrati_nextgen/modules/nextgen_basic_tagcloud/package.module.nextgen_basic_tagcloud.php
CHANGED
@@ -25,6 +25,33 @@ class A_NextGen_Basic_Tagcloud extends Mixin
|
|
25 |
*/
|
26 |
class A_NextGen_Basic_Tagcloud_Controller extends Mixin
|
27 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/**
|
29 |
* Displays the 'tagcloud' display type
|
30 |
*
|
@@ -34,18 +61,13 @@ class A_NextGen_Basic_Tagcloud_Controller extends Mixin
|
|
34 |
*/
|
35 |
function index_action($displayed_gallery, $return = FALSE)
|
36 |
{
|
37 |
-
$display_settings = $displayed_gallery->display_settings;
|
38 |
-
$application = C_Router::get_instance()->get_routed_app();
|
39 |
-
$tag = urldecode($this->param('gallerytag'));
|
40 |
-
// The display setting 'display_type' has been removed to 'gallery_display_type'
|
41 |
-
if (isset($display_settings['display_type'])) {
|
42 |
-
$display_settings['gallery_display_type'] = $display_settings['display_type'];
|
43 |
-
unset($display_settings['display_type']);
|
44 |
-
}
|
45 |
// we're looking at a tag, so show images w/that tag as a thumbnail gallery
|
46 |
-
if (!is_home() && !empty($
|
47 |
-
|
|
|
48 |
}
|
|
|
|
|
49 |
$defaults = array('exclude' => '', 'format' => 'list', 'include' => $displayed_gallery->get_term_ids_for_tags(), 'largest' => 22, 'link' => 'view', 'number' => $display_settings['number'], 'order' => 'ASC', 'orderby' => 'name', 'smallest' => 8, 'taxonomy' => 'ngg_tag', 'unit' => 'pt');
|
50 |
$args = wp_parse_args('', $defaults);
|
51 |
// Always query top tags
|
@@ -239,6 +261,8 @@ class C_Taxonomy_Controller extends C_MVC_Controller
|
|
239 |
}
|
240 |
// This appears to be necessary for multisite installations, but I can't imagine why. More hackery..
|
241 |
$tag = urldecode(get_query_var('ngg_tag') ? get_query_var('ngg_tag') : get_query_var('name'));
|
|
|
|
|
242 |
if (!$this->ngg_tag_detection_has_run && !is_admin() && !empty($tag) && (stripos($wp->request, 'ngg_tag') === 0 || isset($wp_query->query_vars['page_id']) && $wp_query->query_vars['page_id'] === 'ngg_tag')) {
|
243 |
$this->ngg_tag_detection_has_run = TRUE;
|
244 |
// Wordpress somewhat-correctly generates several notices, so silence them as they're really unnecessary
|
25 |
*/
|
26 |
class A_NextGen_Basic_Tagcloud_Controller extends Mixin
|
27 |
{
|
28 |
+
protected static $alternate_displayed_galleries = array();
|
29 |
+
function get_alternate_displayed_gallery($displayed_gallery)
|
30 |
+
{
|
31 |
+
// Prevent recursive checks for further alternates causing additional modifications to the settings array
|
32 |
+
$id = $displayed_gallery->id();
|
33 |
+
if (!empty(self::$alternate_displayed_galleries[$id])) {
|
34 |
+
return self::$alternate_displayed_galleries[$id];
|
35 |
+
}
|
36 |
+
$tag = urldecode($this->param('gallerytag'));
|
37 |
+
// The display setting 'display_type' has been removed to 'gallery_display_type'
|
38 |
+
if (isset($display_settings['display_type'])) {
|
39 |
+
$display_settings['gallery_display_type'] = $display_settings['display_type'];
|
40 |
+
unset($display_settings['display_type']);
|
41 |
+
}
|
42 |
+
// we're looking at a tag, so show images w/that tag as a thumbnail gallery
|
43 |
+
if (!is_home() && !empty($tag)) {
|
44 |
+
$params = ['source' => 'tags', 'container_ids' => array(esc_attr($tag)), 'display_type' => $displayed_gallery->display_settings['gallery_display_type'], 'original_display_type' => $displayed_gallery->display_type, 'original_settings' => $displayed_gallery->display_settings];
|
45 |
+
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
46 |
+
$alternate_displayed_gallery = $renderer->params_to_displayed_gallery($params);
|
47 |
+
if (is_null($alternate_displayed_gallery->id())) {
|
48 |
+
$alternate_displayed_gallery->id(md5(json_encode($alternate_displayed_gallery->get_entity())));
|
49 |
+
}
|
50 |
+
self::$alternate_displayed_galleries[$id] = $alternate_displayed_gallery;
|
51 |
+
return $alternate_displayed_gallery;
|
52 |
+
}
|
53 |
+
return $displayed_gallery;
|
54 |
+
}
|
55 |
/**
|
56 |
* Displays the 'tagcloud' display type
|
57 |
*
|
61 |
*/
|
62 |
function index_action($displayed_gallery, $return = FALSE)
|
63 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
// we're looking at a tag, so show images w/that tag as a thumbnail gallery
|
65 |
+
if (!is_home() && !empty($this->param('gallerytag'))) {
|
66 |
+
$displayed_gallery = $this->get_alternate_displayed_gallery($displayed_gallery);
|
67 |
+
return C_Displayed_Gallery_Renderer::get_instance()->display_images($displayed_gallery);
|
68 |
}
|
69 |
+
$application = C_Router::get_instance()->get_routed_app();
|
70 |
+
$display_settings = $displayed_gallery->display_settings;
|
71 |
$defaults = array('exclude' => '', 'format' => 'list', 'include' => $displayed_gallery->get_term_ids_for_tags(), 'largest' => 22, 'link' => 'view', 'number' => $display_settings['number'], 'order' => 'ASC', 'orderby' => 'name', 'smallest' => 8, 'taxonomy' => 'ngg_tag', 'unit' => 'pt');
|
72 |
$args = wp_parse_args('', $defaults);
|
73 |
// Always query top tags
|
261 |
}
|
262 |
// This appears to be necessary for multisite installations, but I can't imagine why. More hackery..
|
263 |
$tag = urldecode(get_query_var('ngg_tag') ? get_query_var('ngg_tag') : get_query_var('name'));
|
264 |
+
$tag = stripslashes(M_NextGen_Data::strip_html($tag));
|
265 |
+
// Tags may not include HTML
|
266 |
if (!$this->ngg_tag_detection_has_run && !is_admin() && !empty($tag) && (stripos($wp->request, 'ngg_tag') === 0 || isset($wp_query->query_vars['page_id']) && $wp_query->query_vars['page_id'] === 'ngg_tag')) {
|
267 |
$this->ngg_tag_detection_has_run = TRUE;
|
268 |
// Wordpress somewhat-correctly generates several notices, so silence them as they're really unnecessary
|
products/photocrati_nextgen/modules/nextgen_gallery_display/module.nextgen_gallery_display.php
CHANGED
@@ -10,6 +10,8 @@ if (!defined('NGG_SHOW_DISPLAYED_GALLERY_ERRORS')) define('NGG_SHOW_DISPLAYED_GA
|
|
10 |
|
11 |
class M_Gallery_Display extends C_Base_Module
|
12 |
{
|
|
|
|
|
13 |
function define($id = 'pope-module',
|
14 |
$name = 'Pope Module',
|
15 |
$description = '',
|
@@ -37,36 +39,18 @@ class M_Gallery_Display extends C_Base_Module
|
|
37 |
*/
|
38 |
function _register_utilities()
|
39 |
{
|
40 |
-
//
|
41 |
-
|
42 |
-
{
|
43 |
-
// This utility provides a controller to render the settings form
|
44 |
-
// for a display type, or render the front-end of a display type
|
45 |
-
$this->get_registry()->add_utility(
|
46 |
-
'I_Display_Type_Controller',
|
47 |
-
'C_Display_Type_Controller'
|
48 |
-
);
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
'I_Displayed_Gallery_Renderer',
|
53 |
-
'C_Displayed_Gallery_Renderer'
|
54 |
-
);
|
55 |
-
}
|
56 |
|
57 |
// This utility provides a datamapper for Display Types
|
58 |
-
$this->get_registry()->add_utility(
|
59 |
-
'I_Display_Type_Mapper',
|
60 |
-
'C_Display_Type_Mapper'
|
61 |
-
);
|
62 |
|
63 |
-
// This utility provides a datamapper for Displayed Galleries. A
|
64 |
-
|
65 |
-
|
66 |
-
$this->get_registry()->add_utility(
|
67 |
-
'I_Displayed_Gallery_Mapper',
|
68 |
-
'C_Displayed_Gallery_Mapper'
|
69 |
-
);
|
70 |
}
|
71 |
|
72 |
/**
|
@@ -79,26 +63,15 @@ class M_Gallery_Display extends C_Base_Module
|
|
79 |
'I_Component_Factory', 'A_Gallery_Display_Factory'
|
80 |
);
|
81 |
|
82 |
-
if (is_admin())
|
83 |
-
$this->get_registry()->add_adapter(
|
84 |
-
'I_Page_Manager',
|
85 |
-
'A_Display_Settings_Page'
|
86 |
-
);
|
87 |
-
|
88 |
-
$this->get_registry()->add_adapter(
|
89 |
-
'I_NextGen_Admin_Page',
|
90 |
-
'A_Display_Settings_Controller',
|
91 |
-
NGG_DISPLAY_SETTINGS_SLUG
|
92 |
-
);
|
93 |
-
}
|
94 |
-
|
95 |
-
// Frontend-only components
|
96 |
-
if (!is_admin() && apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id))
|
97 |
{
|
98 |
-
$this->get_registry()->add_adapter('
|
99 |
-
$this->get_registry()->add_adapter('
|
100 |
-
$this->get_registry()->add_adapter('I_Display_Type_Controller', 'A_Displayed_Gallery_Trigger_Resources');
|
101 |
}
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
/**
|
@@ -106,17 +79,12 @@ class M_Gallery_Display extends C_Base_Module
|
|
106 |
*/
|
107 |
function _register_hooks()
|
108 |
{
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
C_NextGen_Shortcode_Manager::add('ngg_images', array(&$this, 'display_images'));
|
113 |
-
add_action('wp_enqueue_scripts', array(&$this, 'no_resources_mode'), PHP_INT_MAX-1);
|
114 |
-
add_filter('the_content', array($this, '_render_related_images'));
|
115 |
-
}
|
116 |
|
117 |
add_action('init', array(&$this, 'register_resources'), 12);
|
118 |
add_action('admin_bar_menu', array(&$this, 'add_admin_bar_menu'), 100);
|
119 |
-
add_filter('run_ngg_resource_manager', array(&$this, 'no_resources_mode'));
|
120 |
|
121 |
// Add hook to delete displayed galleries when removed from a post
|
122 |
add_action('pre_post_update', array(&$this, 'locate_stale_displayed_galleries'));
|
@@ -125,8 +93,94 @@ class M_Gallery_Display extends C_Base_Module
|
|
125 |
add_action('after_delete_post', array(&$this, 'cleanup_displayed_galleries'));
|
126 |
|
127 |
add_action('wp_print_styles', array($this, 'fix_nextgen_custom_css_order'), PHP_INT_MAX-1);
|
|
|
|
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
/**
|
131 |
* This moves the NextGen custom CSS to the last of the queue
|
132 |
*/
|
@@ -250,22 +304,6 @@ class M_Gallery_Display extends C_Base_Module
|
|
250 |
return str_replace(' src', ' defer integrity="sha384-kW+oWsYx3YpxvjtZjFXqazFpA7UP/MbiY4jvs+RWZo2+N94PFZ36T6TFkc9O3qoB" crossorigin="anonymous" data-auto-replace-svg="false" data-keep-original-source="false" data-search-pseudo-elements src', $tag);
|
251 |
}
|
252 |
|
253 |
-
function no_resources_mode($valid_request=TRUE)
|
254 |
-
{
|
255 |
-
if (isset($_REQUEST['ngg_no_resources'])) {
|
256 |
-
global $wp_scripts, $wp_styles;
|
257 |
-
|
258 |
-
// Don't enqueue any stylesheets
|
259 |
-
if ($wp_scripts)
|
260 |
-
$wp_scripts->queue = $wp_styles->queue = array();
|
261 |
-
|
262 |
-
// Don't run the resource manager
|
263 |
-
$valid_request = FALSE;
|
264 |
-
}
|
265 |
-
|
266 |
-
return $valid_request;
|
267 |
-
}
|
268 |
-
|
269 |
static function _render_related_string($sluglist=array(), $maxImages=NULL, $type=NULL)
|
270 |
{
|
271 |
$settings = C_NextGen_Settings::get_instance();
|
@@ -396,38 +434,34 @@ class M_Gallery_Display extends C_Base_Module
|
|
396 |
NGG_SCRIPT_VERSION
|
397 |
);
|
398 |
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
NGG_SCRIPT_VERSION
|
419 |
-
);
|
420 |
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
}
|
428 |
}
|
429 |
|
430 |
-
|
431 |
/**
|
432 |
* Adds the display settings page to wp-admin
|
433 |
*/
|
10 |
|
11 |
class M_Gallery_Display extends C_Base_Module
|
12 |
{
|
13 |
+
public static $enqueued_displayed_gallery_ids = [];
|
14 |
+
|
15 |
function define($id = 'pope-module',
|
16 |
$name = 'Pope Module',
|
17 |
$description = '',
|
39 |
*/
|
40 |
function _register_utilities()
|
41 |
{
|
42 |
+
// This utility provides a controller to render the settings form for a display type, or render the front-end of a display type
|
43 |
+
$this->get_registry()->add_utility('I_Display_Type_Controller', 'C_Display_Type_Controller');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
// This utility provides the capabilities of rendering a display type
|
46 |
+
$this->get_registry()->add_utility('I_Displayed_Gallery_Renderer', 'C_Displayed_Gallery_Renderer');
|
|
|
|
|
|
|
|
|
47 |
|
48 |
// This utility provides a datamapper for Display Types
|
49 |
+
$this->get_registry()->add_utility('I_Display_Type_Mapper', 'C_Display_Type_Mapper');
|
|
|
|
|
|
|
50 |
|
51 |
+
// This utility provides a datamapper for Displayed Galleries. A displayed gallery is the association between
|
52 |
+
// some entities (images or galleries) and a display type
|
53 |
+
$this->get_registry()->add_utility('I_Displayed_Gallery_Mapper', 'C_Displayed_Gallery_Mapper') ;
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
/**
|
63 |
'I_Component_Factory', 'A_Gallery_Display_Factory'
|
64 |
);
|
65 |
|
66 |
+
if (is_admin())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
{
|
68 |
+
$this->get_registry()->add_adapter('I_Page_Manager', 'A_Display_Settings_Page');
|
69 |
+
$this->get_registry()->add_adapter('I_NextGen_Admin_Page', 'A_Display_Settings_Controller', NGG_DISPLAY_SETTINGS_SLUG);
|
|
|
70 |
}
|
71 |
+
|
72 |
+
$this->get_registry()->add_adapter('I_MVC_View', 'A_Gallery_Display_View');
|
73 |
+
$this->get_registry()->add_adapter('I_MVC_View', 'A_Displayed_Gallery_Trigger_Element');
|
74 |
+
$this->get_registry()->add_adapter('I_Display_Type_Controller', 'A_Displayed_Gallery_Trigger_Resources');
|
75 |
}
|
76 |
|
77 |
/**
|
79 |
*/
|
80 |
function _register_hooks()
|
81 |
{
|
82 |
+
C_NextGen_Shortcode_Manager::add('ngg', [$this, 'display_images']);
|
83 |
+
C_NextGen_Shortcode_Manager::add('ngg_images', [$this, 'display_images']);
|
84 |
+
add_filter('the_content', array($this, '_render_related_images'));
|
|
|
|
|
|
|
|
|
85 |
|
86 |
add_action('init', array(&$this, 'register_resources'), 12);
|
87 |
add_action('admin_bar_menu', array(&$this, 'add_admin_bar_menu'), 100);
|
|
|
88 |
|
89 |
// Add hook to delete displayed galleries when removed from a post
|
90 |
add_action('pre_post_update', array(&$this, 'locate_stale_displayed_galleries'));
|
93 |
add_action('after_delete_post', array(&$this, 'cleanup_displayed_galleries'));
|
94 |
|
95 |
add_action('wp_print_styles', array($this, 'fix_nextgen_custom_css_order'), PHP_INT_MAX-1);
|
96 |
+
|
97 |
+
add_action('wp_enqueue_scripts', [$this, 'enqueue_frontend_resources']);
|
98 |
}
|
99 |
|
100 |
+
function enqueue_frontend_resources()
|
101 |
+
{
|
102 |
+
global $post;
|
103 |
+
|
104 |
+
if (have_posts())
|
105 |
+
{
|
106 |
+
while (have_posts()) {
|
107 |
+
the_post();
|
108 |
+
|
109 |
+
if ((defined('NGG_SKIP_LOAD_SCRIPTS') && NGG_SKIP_LOAD_SCRIPTS) || $this->is_rest_request() || empty($post->post_content))
|
110 |
+
return;
|
111 |
+
|
112 |
+
preg_match_all('/' . get_shortcode_regex() . '/', $post->post_content, $matches, PREG_SET_ORDER);
|
113 |
+
|
114 |
+
$manager = C_NextGen_Shortcode_Manager::get_instance();
|
115 |
+
$ngg_shortcodes = $manager->get_shortcodes();
|
116 |
+
$shortcode_keys = array_keys($ngg_shortcodes);
|
117 |
+
|
118 |
+
foreach ($matches as $shortcode) {
|
119 |
+
// Only process our 'ngg' shortcodes
|
120 |
+
$this_shortcode_name = $shortcode[2];
|
121 |
+
if (!in_array($this_shortcode_name, $shortcode_keys))
|
122 |
+
continue;
|
123 |
+
|
124 |
+
$params = shortcode_parse_atts(trim($shortcode[0], '[]'));
|
125 |
+
if (in_array($params[0], $shortcode_keys)) // Don't pass 0 => 'ngg' as a parameter, it's just part of the shortcode itself
|
126 |
+
unset($params[0]);
|
127 |
+
|
128 |
+
// And do the enqueueing process
|
129 |
+
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
130 |
+
|
131 |
+
// This is necessary for legacy shortcode compatibility
|
132 |
+
if (is_callable($ngg_shortcodes[$this_shortcode_name]['transformer']))
|
133 |
+
$params = call_user_func($ngg_shortcodes[$this_shortcode_name]['transformer'], $params);
|
134 |
+
|
135 |
+
$displayed_gallery = $renderer->params_to_displayed_gallery($params);
|
136 |
+
|
137 |
+
$controller = C_Display_Type_Controller::get_instance($displayed_gallery->display_type);
|
138 |
+
|
139 |
+
if (!$displayed_gallery || empty($params))
|
140 |
+
continue;
|
141 |
+
|
142 |
+
self::enqueue_frontend_resources_for_displayed_gallery($displayed_gallery, $controller);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* @param C_Displayed_Gallery $displayed_gallery
|
150 |
+
* @param C_Display_Type_Controller $controller
|
151 |
+
*/
|
152 |
+
public static function enqueue_frontend_resources_for_alternate_displayed_gallery($displayed_gallery, $controller)
|
153 |
+
{
|
154 |
+
// Allow basic thumbnails "use imagebrowser effect" feature to seamlessly change between display types as well
|
155 |
+
// as for album display types to show galleries
|
156 |
+
$alternate_displayed_gallery = $controller->get_alternate_displayed_gallery($displayed_gallery);
|
157 |
+
if ($alternate_displayed_gallery === $displayed_gallery)
|
158 |
+
return;
|
159 |
+
|
160 |
+
$alternate_controller = C_Display_Type_Controller::get_instance($alternate_displayed_gallery->display_type);
|
161 |
+
self::enqueue_frontend_resources_for_displayed_gallery($alternate_displayed_gallery, $alternate_controller);
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* @param C_Displayed_Gallery $displayed_gallery
|
166 |
+
* @param C_Display_Type_Controller $controller
|
167 |
+
*/
|
168 |
+
public static function enqueue_frontend_resources_for_displayed_gallery($displayed_gallery, $controller)
|
169 |
+
{
|
170 |
+
if (is_null($displayed_gallery->id()))
|
171 |
+
$displayed_gallery->id(md5(json_encode($displayed_gallery->get_entity())));
|
172 |
+
|
173 |
+
self::$enqueued_displayed_gallery_ids[] = $displayed_gallery->id();
|
174 |
+
|
175 |
+
$controller->enqueue_frontend_resources($displayed_gallery);
|
176 |
+
self::enqueue_frontend_resources_for_alternate_displayed_gallery($displayed_gallery, $controller);
|
177 |
+
}
|
178 |
+
|
179 |
+
function is_rest_request()
|
180 |
+
{
|
181 |
+
return defined('REST_REQUEST') || strpos($_SERVER['REQUEST_URI'], 'wp-json') !== FALSE;
|
182 |
+
}
|
183 |
+
|
184 |
/**
|
185 |
* This moves the NextGen custom CSS to the last of the queue
|
186 |
*/
|
304 |
return str_replace(' src', ' defer integrity="sha384-kW+oWsYx3YpxvjtZjFXqazFpA7UP/MbiY4jvs+RWZo2+N94PFZ36T6TFkc9O3qoB" crossorigin="anonymous" data-auto-replace-svg="false" data-keep-original-source="false" data-search-pseudo-elements src', $tag);
|
305 |
}
|
306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
static function _render_related_string($sluglist=array(), $maxImages=NULL, $type=NULL)
|
308 |
{
|
309 |
$settings = C_NextGen_Settings::get_instance();
|
434 |
NGG_SCRIPT_VERSION
|
435 |
);
|
436 |
|
437 |
+
wp_register_style(
|
438 |
+
'nextgen_gallery_related_images',
|
439 |
+
$router->get_static_url('photocrati-nextgen_gallery_display#nextgen_gallery_related_images.css'),
|
440 |
+
array(),
|
441 |
+
NGG_SCRIPT_VERSION
|
442 |
+
);
|
443 |
+
wp_register_script(
|
444 |
+
'ngg_common',
|
445 |
+
$router->get_static_url('photocrati-nextgen_gallery_display#common.js'),
|
446 |
+
array('jquery', 'photocrati_ajax'),
|
447 |
+
NGG_SCRIPT_VERSION,
|
448 |
+
TRUE
|
449 |
+
);
|
450 |
+
wp_register_style(
|
451 |
+
'ngg_trigger_buttons',
|
452 |
+
$router->get_static_url('photocrati-nextgen_gallery_display#trigger_buttons.css'),
|
453 |
+
array(),
|
454 |
+
NGG_SCRIPT_VERSION
|
455 |
+
);
|
|
|
|
|
456 |
|
457 |
+
wp_register_script(
|
458 |
+
'ngg_waitforimages',
|
459 |
+
$router->get_static_url('photocrati-nextgen_gallery_display#jquery.waitforimages-2.4.0-modded.js'),
|
460 |
+
array('jquery'),
|
461 |
+
NGG_SCRIPT_VERSION
|
462 |
+
);
|
|
|
463 |
}
|
464 |
|
|
|
465 |
/**
|
466 |
* Adds the display settings page to wp-admin
|
467 |
*/
|
products/photocrati_nextgen/modules/nextgen_gallery_display/package.module.nextgen_gallery_display.php
CHANGED
@@ -595,6 +595,18 @@ class Mixin_Display_Type_Controller extends Mixin
|
|
595 |
/* Return template. If no match is found, returns the original template */
|
596 |
return $template;
|
597 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
}
|
599 |
/**
|
600 |
* Provides a datamapper to perform CRUD operations for Display Types
|
@@ -1940,8 +1952,11 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
|
|
1940 |
} elseif (!NGG_RENDERING_CACHE_ENABLED) {
|
1941 |
$lookup = FALSE;
|
1942 |
}
|
1943 |
-
//
|
1944 |
-
|
|
|
|
|
|
|
1945 |
$controller->enqueue_frontend_resources($displayed_gallery);
|
1946 |
}
|
1947 |
// Try cache lookup, if we're to do so
|
@@ -1983,7 +1998,6 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
|
|
1983 |
// If a cached version doesn't exist, then create the cache
|
1984 |
if (!$html) {
|
1985 |
$retval .= $this->debug_msg("Rendering displayed gallery");
|
1986 |
-
$current_mode = $controller->get_render_mode();
|
1987 |
$controller->set_render_mode($mode);
|
1988 |
$html = apply_filters('ngg_displayed_gallery_rendering', $controller->index_action($displayed_gallery, TRUE), $displayed_gallery);
|
1989 |
if ($key != null) {
|
@@ -2003,6 +2017,9 @@ class Mixin_Displayed_Gallery_Renderer extends Mixin
|
|
2003 |
{
|
2004 |
return defined('REST_REQUEST') || strpos($_SERVER['REQUEST_URI'], 'wp-json') !== FALSE;
|
2005 |
}
|
|
|
|
|
|
|
2006 |
}
|
2007 |
class C_Displayed_Gallery_Source_Manager
|
2008 |
{
|
595 |
/* Return template. If no match is found, returns the original template */
|
596 |
return $template;
|
597 |
}
|
598 |
+
/**
|
599 |
+
* The basic thumbnails and slideshow have options to display galleries with the other display type, and albums
|
600 |
+
* of course display child of an entirely different kind. Implementing this method allows displays to alter
|
601 |
+
* the displayed gallery passed to their index_action() method.
|
602 |
+
*
|
603 |
+
* @param C_Displayed_Gallery $displayed_gallery
|
604 |
+
* @return C_Displayed_Gallery mixed
|
605 |
+
*/
|
606 |
+
function get_alternate_displayed_gallery($displayed_gallery)
|
607 |
+
{
|
608 |
+
return $displayed_gallery;
|
609 |
+
}
|
610 |
}
|
611 |
/**
|
612 |
* Provides a datamapper to perform CRUD operations for Display Types
|
1952 |
} elseif (!NGG_RENDERING_CACHE_ENABLED) {
|
1953 |
$lookup = FALSE;
|
1954 |
}
|
1955 |
+
// Just in case M_Gallery_Display could not find this displayed gallery during wp_enqueue_scripts (most likely
|
1956 |
+
// because this displayed gallery was created through do_shortcode) we'll enqueue it now. This may potentially
|
1957 |
+
// cause issues with displays adding their JS or CSS after the <body> has began or finished.
|
1958 |
+
if ((!defined('NGG_SKIP_LOAD_SCRIPTS') || !NGG_SKIP_LOAD_SCRIPTS) && !$this->is_rest_request() && !in_array($displayed_gallery->id(), M_Gallery_Display::$enqueued_displayed_gallery_ids)) {
|
1959 |
+
M_Gallery_Display::$enqueued_displayed_gallery_ids[] = $displayed_gallery->id();
|
1960 |
$controller->enqueue_frontend_resources($displayed_gallery);
|
1961 |
}
|
1962 |
// Try cache lookup, if we're to do so
|
1998 |
// If a cached version doesn't exist, then create the cache
|
1999 |
if (!$html) {
|
2000 |
$retval .= $this->debug_msg("Rendering displayed gallery");
|
|
|
2001 |
$controller->set_render_mode($mode);
|
2002 |
$html = apply_filters('ngg_displayed_gallery_rendering', $controller->index_action($displayed_gallery, TRUE), $displayed_gallery);
|
2003 |
if ($key != null) {
|
2017 |
{
|
2018 |
return defined('REST_REQUEST') || strpos($_SERVER['REQUEST_URI'], 'wp-json') !== FALSE;
|
2019 |
}
|
2020 |
+
function do_app_rewrites($displayed_gallery)
|
2021 |
+
{
|
2022 |
+
}
|
2023 |
}
|
2024 |
class C_Displayed_Gallery_Source_Manager
|
2025 |
{
|
products/photocrati_nextgen/modules/rest/rest testing.http
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#POST https://test.benjamin.pictures/wp-json/ngg/v1/settings/thumbwidth
|
2 |
+
#Content-Type: application/x-www-form-urlencoded
|
3 |
+
#
|
4 |
+
#value=240
|
5 |
+
|
6 |
+
GET https://test.benjamin.pictures/wp-json/ngg/v1/display_types/photocrati-nextgen_basic_thumbnails
|
7 |
+
|
8 |
+
#POST https://test.benjamin.pictures/wp-json/ngg/v1/display_types/photocrati-nextgen_basic_thumbnails/images_per_page
|
9 |
+
#Content-Type: application/x-www-form-urlencoded
|
10 |
+
#value=40
|
products/photocrati_nextgen/modules/third_party_compat/module.third_party_compat.php
CHANGED
@@ -70,33 +70,6 @@ class M_Third_Party_Compat extends C_Base_Module
|
|
70 |
if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 4) {
|
71 |
@ini_set('zlib.output_compression', 'Off');
|
72 |
}
|
73 |
-
|
74 |
-
// Detect 'Adminer' and whether the user is viewing its loader.php
|
75 |
-
if (class_exists('AdminerForWP') && function_exists('adminer_object'))
|
76 |
-
{
|
77 |
-
if (!defined('NGG_DISABLE_RESOURCE_MANAGER'))
|
78 |
-
define('NGG_DISABLE_RESOURCE_MANAGER', TRUE);
|
79 |
-
}
|
80 |
-
|
81 |
-
// Cornerstone's page builder requires a 'clean slate' of css/js that our resource manager interefers with
|
82 |
-
if (class_exists('Cornerstone'))
|
83 |
-
{
|
84 |
-
if (!defined('NGG_DISABLE_FILTER_THE_CONTENT')) define('NGG_DISABLE_FILTER_THE_CONTENT', TRUE);
|
85 |
-
if (!defined('NGG_DISABLE_RESOURCE_MANAGER')) define('NGG_DISABLE_RESOURCE_MANAGER', TRUE);
|
86 |
-
}
|
87 |
-
|
88 |
-
// Genesis Tabs creates a new query / do_shortcode loop which requires these be set
|
89 |
-
if (class_exists('Genesis_Tabs'))
|
90 |
-
{
|
91 |
-
if (!defined('NGG_DISABLE_FILTER_THE_CONTENT')) define('NGG_DISABLE_FILTER_THE_CONTENT', TRUE);
|
92 |
-
if (!defined('NGG_DISABLE_RESOURCE_MANAGER')) define('NGG_DISABLE_RESOURCE_MANAGER', TRUE);
|
93 |
-
}
|
94 |
-
|
95 |
-
// Elementor's graphical builder is broken by our resource manager
|
96 |
-
if (defined('ELEMENTOR_VERSION'))
|
97 |
-
{
|
98 |
-
if (!defined('NGG_DISABLE_RESOURCE_MANAGER')) define('NGG_DISABLE_RESOURCE_MANAGER', TRUE);
|
99 |
-
}
|
100 |
}
|
101 |
|
102 |
function _register_adapters()
|
@@ -129,7 +102,6 @@ class M_Third_Party_Compat extends C_Base_Module
|
|
129 |
add_action('debug_bar_enqueue_scripts', array($this, 'no_debug_bar'));
|
130 |
add_filter('ngg_non_minified_modules', array($this, 'dont_minify_nextgen_pro_cssjs'));
|
131 |
add_filter('ngg_atp_show_display_type', array($this, 'atp_check_pro_albums'), 10, 2);
|
132 |
-
add_filter('run_ngg_resource_manager', array($this, 'run_ngg_resource_manager'));
|
133 |
add_filter('wpseo_sitemap_urlimages', array($this, 'add_wpseo_xml_sitemap_images'), 10, 2);
|
134 |
add_filter('ngg_pre_delete_unused_term_id', array($this, 'dont_auto_purge_wpml_terms'));
|
135 |
|
@@ -219,41 +191,6 @@ class M_Third_Party_Compat extends C_Base_Module
|
|
219 |
}
|
220 |
}
|
221 |
|
222 |
-
/**
|
223 |
-
* Some other plugins output content and die(); this causes problems with our resource manager which uses output buffering
|
224 |
-
*
|
225 |
-
* @param bool $valid_request
|
226 |
-
* @return bool
|
227 |
-
*/
|
228 |
-
function run_ngg_resource_manager($valid_request = TRUE)
|
229 |
-
{
|
230 |
-
// WP-Post-To-PDF-Enhanced
|
231 |
-
if (class_exists('wpptopdfenh') && !empty($_GET['format']))
|
232 |
-
$valid_request = FALSE;
|
233 |
-
|
234 |
-
// WP-Photo-Seller download
|
235 |
-
if (class_exists('WPS') && isset($_REQUEST['wps_file_dl']) && $_REQUEST['wps_file_dl'] == '1')
|
236 |
-
$valid_request = FALSE;
|
237 |
-
|
238 |
-
// Multiverso Advanced File Sharing download
|
239 |
-
if (function_exists('mv_install') && isset($_GET['upf']) && isset($_GET['id']))
|
240 |
-
$valid_request = FALSE;
|
241 |
-
|
242 |
-
// WooCommerce downloads
|
243 |
-
if (class_exists('WC_Download_Handler') && isset($_GET['download_file']) && isset($_GET['order']) && isset($_GET['email']))
|
244 |
-
$valid_request = FALSE;
|
245 |
-
|
246 |
-
// WP-E-Commerce
|
247 |
-
if (isset($_GET['wpsc_download_id']) || (function_exists('wpsc_download_file') && isset($_GET['downloadid'])))
|
248 |
-
$valid_request = FALSE;
|
249 |
-
|
250 |
-
// Easy Digital Downloads
|
251 |
-
if (function_exists('edd_process_download') && (isset($_GET['download_id']) || isset($_GET['download'])))
|
252 |
-
$valid_request = FALSE;
|
253 |
-
|
254 |
-
return $valid_request;
|
255 |
-
}
|
256 |
-
|
257 |
/**
|
258 |
* This style causes problems with Excellent Themes admin settings
|
259 |
*/
|
70 |
if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 4) {
|
71 |
@ini_set('zlib.output_compression', 'Off');
|
72 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
function _register_adapters()
|
102 |
add_action('debug_bar_enqueue_scripts', array($this, 'no_debug_bar'));
|
103 |
add_filter('ngg_non_minified_modules', array($this, 'dont_minify_nextgen_pro_cssjs'));
|
104 |
add_filter('ngg_atp_show_display_type', array($this, 'atp_check_pro_albums'), 10, 2);
|
|
|
105 |
add_filter('wpseo_sitemap_urlimages', array($this, 'add_wpseo_xml_sitemap_images'), 10, 2);
|
106 |
add_filter('ngg_pre_delete_unused_term_id', array($this, 'dont_auto_purge_wpml_terms'));
|
107 |
|
191 |
}
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
/**
|
195 |
* This style causes problems with Excellent Themes admin settings
|
196 |
*/
|
products/photocrati_nextgen/modules/widget/module.widget.php
CHANGED
@@ -17,7 +17,7 @@ class M_Widget extends C_Base_Module
|
|
17 |
'photocrati-widget',
|
18 |
'Widget',
|
19 |
'Handles clearing of NextGen Widgets',
|
20 |
-
'3.
|
21 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
22 |
'Imagely',
|
23 |
'https://www.imagely.com'
|
@@ -37,7 +37,7 @@ class M_Widget extends C_Base_Module
|
|
37 |
*/
|
38 |
function _register_hooks()
|
39 |
{
|
40 |
-
|
41 |
|
42 |
add_action('ngg_delete_image', function() {
|
43 |
C_Photocrati_Transient_Manager::flush('random_widget_gallery_ids');
|
17 |
'photocrati-widget',
|
18 |
'Widget',
|
19 |
'Handles clearing of NextGen Widgets',
|
20 |
+
'3.9.0',
|
21 |
'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
|
22 |
'Imagely',
|
23 |
'https://www.imagely.com'
|
37 |
*/
|
38 |
function _register_hooks()
|
39 |
{
|
40 |
+
add_action('widgets_init', [$this, 'register_widgets']);
|
41 |
|
42 |
add_action('ngg_delete_image', function() {
|
43 |
C_Photocrati_Transient_Manager::flush('random_widget_gallery_ids');
|
products/photocrati_nextgen/modules/widget/package.module.widget.php
CHANGED
@@ -68,10 +68,43 @@ class Mixin_Widget extends Mixin
|
|
68 |
}
|
69 |
class C_Widget_Gallery extends WP_Widget
|
70 |
{
|
|
|
71 |
function __construct()
|
72 |
{
|
73 |
-
$widget_ops =
|
74 |
parent::__construct('ngg-images', __('NextGEN Widget', 'nggallery'), $widget_ops);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
function form($instance)
|
77 |
{
|
@@ -119,12 +152,14 @@ class C_Widget_Gallery extends WP_Widget
|
|
119 |
$instance['webslice'] = (bool) $new_instance['webslice'];
|
120 |
return $instance;
|
121 |
}
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
123 |
{
|
124 |
$settings = C_NextGen_Settings::get_instance();
|
125 |
-
$router = C_Router::get_instance();
|
126 |
-
wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'), array(), NGG_SCRIPT_VERSION);
|
127 |
-
wp_enqueue_style('nextgen_basic_thumbnails_style', $router->get_static_url('photocrati-nextgen_basic_gallery#thumbnails/nextgen_basic_thumbnails.css'), array(), NGG_SCRIPT_VERSION);
|
128 |
// these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
|
129 |
$before_widget = NULL;
|
130 |
$before_title = NULL;
|
@@ -191,7 +226,17 @@ class C_Widget_Gallery extends WP_Widget
|
|
191 |
$params['source'] = 'images';
|
192 |
unset($params['container_ids']);
|
193 |
}
|
194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
}
|
197 |
class C_Widget_MediaRSS extends WP_Widget
|
@@ -253,10 +298,77 @@ class C_Widget_MediaRSS extends WP_Widget
|
|
253 |
}
|
254 |
class C_Widget_Slideshow extends WP_Widget
|
255 |
{
|
|
|
256 |
function __construct()
|
257 |
{
|
258 |
-
$widget_ops =
|
259 |
parent::__construct('slideshow', __('NextGEN Slideshow', 'nggallery'), $widget_ops);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
}
|
261 |
function form($instance)
|
262 |
{
|
@@ -290,9 +402,6 @@ class C_Widget_Slideshow extends WP_Widget
|
|
290 |
}
|
291 |
function widget($args, $instance)
|
292 |
{
|
293 |
-
$router = C_Router::get_instance();
|
294 |
-
wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'), array(), NGG_SCRIPT_VERSION);
|
295 |
-
wp_enqueue_style('nextgen_basic_slideshow_style', $router->get_static_url('photocrati-nextgen_basic_gallery#slideshow/ngg_basic_slideshow.css'), array(), NGG_SCRIPT_VERSION);
|
296 |
// these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
|
297 |
$before_widget = NULL;
|
298 |
$before_title = NULL;
|
@@ -302,37 +411,16 @@ class C_Widget_Slideshow extends WP_Widget
|
|
302 |
extract($args);
|
303 |
$parent = C_Component_Registry::get_instance()->get_utility('I_Widget');
|
304 |
$title = apply_filters('widget_title', empty($instance['title']) ? __('Slideshow', 'nggallery') : $instance['title'], $instance, $this->id_base);
|
305 |
-
|
306 |
-
$instance['limit'] = 10;
|
307 |
-
}
|
308 |
-
$out = $this->render_slideshow($instance['galleryid'], $instance['width'], $instance['height'], $instance['limit'], $args);
|
309 |
$parent->render_partial('photocrati-widget#display_slideshow', array('self' => $this, 'instance' => $instance, 'title' => $title, 'out' => $out, 'before_widget' => $before_widget, 'before_title' => $before_title, 'after_widget' => $after_widget, 'after_title' => $after_title, 'widget_id' => $widget_id));
|
310 |
}
|
311 |
-
function render_slideshow($
|
312 |
{
|
313 |
-
|
|
|
314 |
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
315 |
-
$
|
316 |
-
|
317 |
-
'display_type' => 'photocrati-nextgen_basic_slideshow',
|
318 |
-
'gallery_width' => $irWidth,
|
319 |
-
'gallery_height' => $irHeight,
|
320 |
-
'source' => 'galleries',
|
321 |
-
'slug' => 'widget-' . $args['widget_id'],
|
322 |
-
'entity_types' => array('image'),
|
323 |
-
'show_thumbnail_link' => FALSE,
|
324 |
-
'show_slideshow_link' => FALSE,
|
325 |
-
'use_imagebrowser_effect' => FALSE,
|
326 |
-
// just to be safe
|
327 |
-
'ngg_triggers_display' => 'never',
|
328 |
-
);
|
329 |
-
if (0 === $galleryID) {
|
330 |
-
$params['source'] = 'random_images';
|
331 |
-
$params['maximum_entity_count'] = $limit;
|
332 |
-
unset($params['container_ids']);
|
333 |
-
}
|
334 |
-
$retval = $renderer->display_images($params, NULL);
|
335 |
-
$retval = apply_filters('ngg_show_slideshow_widget_content', $retval, $galleryID, $irWidth, $irHeight);
|
336 |
return $retval;
|
337 |
}
|
338 |
}
|
68 |
}
|
69 |
class C_Widget_Gallery extends WP_Widget
|
70 |
{
|
71 |
+
protected static $displayed_gallery_ids = array();
|
72 |
function __construct()
|
73 |
{
|
74 |
+
$widget_ops = ['classname' => 'ngg_images', 'description' => __('Add recent or random images from the galleries', 'nggallery')];
|
75 |
parent::__construct('ngg-images', __('NextGEN Widget', 'nggallery'), $widget_ops);
|
76 |
+
// Determine what widgets will exist in the future, create their displayed galleries, enqueue their resources,
|
77 |
+
// and cache the resulting displayed gallery for later rendering to avoid the ID changing due to misc attributes
|
78 |
+
// in $args being different now and at render time ($args is sidebar information that is not relevant)
|
79 |
+
add_action('wp_enqueue_scripts', function () {
|
80 |
+
global $wp_registered_sidebars;
|
81 |
+
$sidebars = wp_get_sidebars_widgets();
|
82 |
+
$options = $this->get_settings();
|
83 |
+
foreach ($sidebars as $sidebar_name => $sidebar) {
|
84 |
+
if ($sidebar_name === 'wp_inactive_widgets') {
|
85 |
+
continue;
|
86 |
+
}
|
87 |
+
foreach ($sidebar as $widget) {
|
88 |
+
if (strpos($widget, 'ngg-images-', 0) !== 0) {
|
89 |
+
continue;
|
90 |
+
}
|
91 |
+
$id = str_replace('ngg-images-', '', $widget);
|
92 |
+
if (isset($options[$id])) {
|
93 |
+
$sidebar_data = $wp_registered_sidebars[$sidebar_name];
|
94 |
+
$sidebar_data['widget_id'] = $widget;
|
95 |
+
$displayed_gallery = $this->get_displayed_gallery($sidebar_data, $options[$id]);
|
96 |
+
self::$displayed_gallery_ids[$widget] = $displayed_gallery;
|
97 |
+
$controller = C_Display_Type_Controller::get_instance(NGG_BASIC_THUMBNAILS);
|
98 |
+
M_Gallery_Display::enqueue_frontend_resources_for_displayed_gallery($displayed_gallery, $controller);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
// Now enqueue the basic styling for the display itself
|
103 |
+
$router = C_Router::get_instance();
|
104 |
+
wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'), [], NGG_SCRIPT_VERSION);
|
105 |
+
wp_enqueue_style('nextgen_basic_thumbnails_style', $router->get_static_url('photocrati-nextgen_basic_gallery#thumbnails/nextgen_basic_thumbnails.css'), [], NGG_SCRIPT_VERSION);
|
106 |
+
}, 11);
|
107 |
+
// It is important that this run at priority 11 or higher so that M_Gallery_Display->enqueue_frontend_resources() has run first
|
108 |
}
|
109 |
function form($instance)
|
110 |
{
|
152 |
$instance['webslice'] = (bool) $new_instance['webslice'];
|
153 |
return $instance;
|
154 |
}
|
155 |
+
/**
|
156 |
+
* @param array $args
|
157 |
+
* @param array $instance
|
158 |
+
* @return C_Displayed_Gallery
|
159 |
+
*/
|
160 |
+
public function get_displayed_gallery($args, $instance)
|
161 |
{
|
162 |
$settings = C_NextGen_Settings::get_instance();
|
|
|
|
|
|
|
163 |
// these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
|
164 |
$before_widget = NULL;
|
165 |
$before_title = NULL;
|
226 |
$params['source'] = 'images';
|
227 |
unset($params['container_ids']);
|
228 |
}
|
229 |
+
$final_displayed_gallery = $renderer->params_to_displayed_gallery($params);
|
230 |
+
if (is_null($final_displayed_gallery->id())) {
|
231 |
+
$final_displayed_gallery->id(md5(json_encode($final_displayed_gallery->get_entity())));
|
232 |
+
}
|
233 |
+
return $final_displayed_gallery;
|
234 |
+
}
|
235 |
+
function widget($args, $instance)
|
236 |
+
{
|
237 |
+
// The displayed gallery was created during the action wp_enqueue_resources and was cached to avoid ID conflicts
|
238 |
+
$displayed_gallery = self::$displayed_gallery_ids[$args['widget_id']];
|
239 |
+
print C_Displayed_Gallery_Renderer::get_instance()->display_images($displayed_gallery);
|
240 |
}
|
241 |
}
|
242 |
class C_Widget_MediaRSS extends WP_Widget
|
298 |
}
|
299 |
class C_Widget_Slideshow extends WP_Widget
|
300 |
{
|
301 |
+
protected static $displayed_gallery_ids = array();
|
302 |
function __construct()
|
303 |
{
|
304 |
+
$widget_ops = ['classname' => 'widget_slideshow', 'description' => __('Show a NextGEN Gallery Slideshow', 'nggallery')];
|
305 |
parent::__construct('slideshow', __('NextGEN Slideshow', 'nggallery'), $widget_ops);
|
306 |
+
// Determine what widgets will exist in the future, create their displayed galleries, enqueue their resources,
|
307 |
+
// and cache the resulting displayed gallery for later rendering to avoid the ID changing due to misc attributes
|
308 |
+
// in $args being different now and at render time ($args is sidebar information that is not relevant)
|
309 |
+
add_action('wp_enqueue_scripts', function () {
|
310 |
+
global $wp_registered_sidebars;
|
311 |
+
$sidebars = wp_get_sidebars_widgets();
|
312 |
+
$options = $this->get_settings();
|
313 |
+
foreach ($sidebars as $sidebar_name => $sidebar) {
|
314 |
+
if ($sidebar_name === 'wp_inactive_widgets') {
|
315 |
+
continue;
|
316 |
+
}
|
317 |
+
foreach ($sidebar as $widget) {
|
318 |
+
if (strpos($widget, 'slideshow-', 0) !== 0) {
|
319 |
+
continue;
|
320 |
+
}
|
321 |
+
$id = str_replace('slideshow-', '', $widget);
|
322 |
+
if (isset($options[$id])) {
|
323 |
+
$sidebar_data = $wp_registered_sidebars[$sidebar_name];
|
324 |
+
$sidebar_data['widget_id'] = $widget;
|
325 |
+
$displayed_gallery = $this->get_displayed_gallery($sidebar_data, $options[$id]);
|
326 |
+
self::$displayed_gallery_ids[$widget] = $displayed_gallery;
|
327 |
+
$controller = C_Display_Type_Controller::get_instance(NGG_BASIC_SLIDESHOW);
|
328 |
+
M_Gallery_Display::enqueue_frontend_resources_for_displayed_gallery($displayed_gallery, $controller);
|
329 |
+
}
|
330 |
+
}
|
331 |
+
}
|
332 |
+
$router = C_Router::get_instance();
|
333 |
+
wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'), array(), NGG_SCRIPT_VERSION);
|
334 |
+
wp_enqueue_style('nextgen_basic_slideshow_style', $router->get_static_url('photocrati-nextgen_basic_gallery#slideshow/ngg_basic_slideshow.css'), array(), NGG_SCRIPT_VERSION);
|
335 |
+
}, 11);
|
336 |
+
}
|
337 |
+
/**
|
338 |
+
* @param array $args
|
339 |
+
* @param array $instance
|
340 |
+
* @return C_Displayed_Gallery
|
341 |
+
*/
|
342 |
+
public function get_displayed_gallery($args, $instance)
|
343 |
+
{
|
344 |
+
if (empty($instance['limit'])) {
|
345 |
+
$instance['limit'] = 10;
|
346 |
+
}
|
347 |
+
$params = array(
|
348 |
+
'container_ids' => $instance['galleryid'],
|
349 |
+
'display_type' => 'photocrati-nextgen_basic_slideshow',
|
350 |
+
'gallery_width' => $instance['width'],
|
351 |
+
'gallery_height' => $instance['height'],
|
352 |
+
'source' => 'galleries',
|
353 |
+
'slug' => 'widget-' . $args['widget_id'],
|
354 |
+
'entity_types' => array('image'),
|
355 |
+
'show_thumbnail_link' => FALSE,
|
356 |
+
'show_slideshow_link' => FALSE,
|
357 |
+
'use_imagebrowser_effect' => FALSE,
|
358 |
+
// just to be safe
|
359 |
+
'ngg_triggers_display' => 'never',
|
360 |
+
);
|
361 |
+
if (0 === $instance['galleryid']) {
|
362 |
+
$params['source'] = 'random_images';
|
363 |
+
$params['maximum_entity_count'] = $instance['limit'];
|
364 |
+
unset($params['container_ids']);
|
365 |
+
}
|
366 |
+
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
367 |
+
$displayed_gallery = $renderer->params_to_displayed_gallery($params);
|
368 |
+
if (is_null($displayed_gallery->id())) {
|
369 |
+
$displayed_gallery->id(md5(json_encode($displayed_gallery->get_entity())));
|
370 |
+
}
|
371 |
+
return $displayed_gallery;
|
372 |
}
|
373 |
function form($instance)
|
374 |
{
|
402 |
}
|
403 |
function widget($args, $instance)
|
404 |
{
|
|
|
|
|
|
|
405 |
// these are handled by extract() but I want to silence my IDE warnings that these vars don't exist
|
406 |
$before_widget = NULL;
|
407 |
$before_title = NULL;
|
411 |
extract($args);
|
412 |
$parent = C_Component_Registry::get_instance()->get_utility('I_Widget');
|
413 |
$title = apply_filters('widget_title', empty($instance['title']) ? __('Slideshow', 'nggallery') : $instance['title'], $instance, $this->id_base);
|
414 |
+
$out = $this->render_slideshow($args, $instance);
|
|
|
|
|
|
|
415 |
$parent->render_partial('photocrati-widget#display_slideshow', array('self' => $this, 'instance' => $instance, 'title' => $title, 'out' => $out, 'before_widget' => $before_widget, 'before_title' => $before_title, 'after_widget' => $after_widget, 'after_title' => $after_title, 'widget_id' => $widget_id));
|
416 |
}
|
417 |
+
function render_slideshow($args, $instance)
|
418 |
{
|
419 |
+
// The displayed gallery was created during the action wp_enqueue_resources and was cached to avoid ID conflicts
|
420 |
+
$displayed_gallery = self::$displayed_gallery_ids[$args['widget_id']];
|
421 |
$renderer = C_Displayed_Gallery_Renderer::get_instance();
|
422 |
+
$retval = $renderer->display_images($displayed_gallery);
|
423 |
+
$retval = apply_filters('ngg_show_slideshow_widget_content', $retval, $instance['galleryid'], $instance['width'], $instance['height']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
return $retval;
|
425 |
}
|
426 |
}
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== WordPress Gallery Plugin - NextGEN Gallery ===
|
2 |
Contributors: photocrati, imagely
|
3 |
Tags: wordpress gallery plugin, gallery, nextgen, nextgen gallery, photo gallery, image gallery, photography, slideshow, images, photo, photo album, watermark
|
4 |
-
Requires at least: 5.
|
5 |
-
Stable tag: 3.
|
6 |
-
Tested up to: 5.
|
7 |
License: GPLv3
|
8 |
Requires PHP: 5.6
|
9 |
|
@@ -179,11 +179,18 @@ For more information, feel free to visit the official website for the NextGEN Ga
|
|
179 |
|
180 |
== Changelog ==
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
= V3.8.0 - 02.24.2020 =
|
183 |
-
* NEW: NGG featured image support for custom post types
|
184 |
-
* Fixed: Compatibility with Custom Post Type UI plugin
|
185 |
-
* Fixed: Compatibility with Advanced Custom Fields plugin
|
186 |
-
* Fixed: Compatibility with Photo Station plugin
|
|
|
187 |
|
188 |
= V3.7.0 - 02.17.2020 =
|
189 |
* Fixed: Added ellipsis to pagination to show pages skipped (1099) (1157)
|
1 |
=== WordPress Gallery Plugin - NextGEN Gallery ===
|
2 |
Contributors: photocrati, imagely
|
3 |
Tags: wordpress gallery plugin, gallery, nextgen, nextgen gallery, photo gallery, image gallery, photography, slideshow, images, photo, photo album, watermark
|
4 |
+
Requires at least: 5.5.0
|
5 |
+
Stable tag: 3.9.0
|
6 |
+
Tested up to: 5.7.0
|
7 |
License: GPLv3
|
8 |
Requires PHP: 5.6
|
9 |
|
179 |
|
180 |
== Changelog ==
|
181 |
|
182 |
+
= V3.9.0 - 03.24.2020 =
|
183 |
+
* Changed: Resource manager disabled by default
|
184 |
+
* Changed: Remove ngg_load_frontend_logic filter
|
185 |
+
* Fixed: Refactored to resolve over 300 plugin & theme conflicts
|
186 |
+
* Fixed: Problem reported with taxonomy controller
|
187 |
+
|
188 |
= V3.8.0 - 02.24.2020 =
|
189 |
+
* NEW: NGG featured image support for custom post types (1076)
|
190 |
+
* Fixed: Compatibility with Custom Post Type UI plugin (1076)
|
191 |
+
* Fixed: Compatibility with Advanced Custom Fields plugin (1150)
|
192 |
+
* Fixed: Compatibility with Photo Station plugin (855)
|
193 |
+
* Fixed: Compatibility with Stackable (981)
|
194 |
|
195 |
= V3.7.0 - 02.17.2020 =
|
196 |
* Fixed: Added ellipsis to pagination to show pages skipped (1099) (1157)
|