Version Description
-
Enhancement: Adding support for
tax_name
_include_children attribute, as requested by John. Thanks for the suggestion! - Enhancement: Thumber.co authentication secret is no longer output in the options dump on the admin settings tab, removing the possibility of this information being inadvertently printed in the support forum.
Download this release
Release Info
Developer | dan.rossiter |
Plugin | Document Gallery |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.14 to 4.2
- README.txt +8 -1
- admin/tabs/advanced-tab.php +6 -2
- document-gallery.php +2 -2
- inc/class-gallery-sanitization.php +18 -0
- inc/class-gallery.php +18 -9
README.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: attachments, library, thumbnail, documents, gallery, word, pdf
|
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
5 |
Requires at least: 4.1
|
6 |
Tested up to: 4.4
|
7 |
-
Stable tag: 4.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -422,6 +422,13 @@ To see a list of features planned for the future as well as to propose your own
|
|
422 |
ideas for future Document Gallery development, take a look at our
|
423 |
[issue tracker](https://github.com/thenadz/document-gallery/issues).
|
424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
= 4.1.14 =
|
426 |
* **Bug Fix:** The handling of saving [Thumber.co](https://thumber.co) subscriptions was broken for some use cases.
|
427 |
The logic has been updated to work correctly in all cases.
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=EE5LWRLG933EN&lc=US&item_name=Document%20Gallery%20Plugin&item_number=document%2dgallery¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
5 |
Requires at least: 4.1
|
6 |
Tested up to: 4.4
|
7 |
+
Stable tag: 4.2
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
422 |
ideas for future Document Gallery development, take a look at our
|
423 |
[issue tracker](https://github.com/thenadz/document-gallery/issues).
|
424 |
|
425 |
+
= 4.2 =
|
426 |
+
* **Enhancement:** Adding support for `tax_name`_include_children attribute, as requested by
|
427 |
+
[John](https://wordpress.org/support/topic/add-shortcode-attribute-for-include_children). Thanks for the suggestion!
|
428 |
+
* **Enhancement:** [Thumber.co](https://thumber.co) authentication secret is no longer output in the options
|
429 |
+
dump on the admin settings tab, removing the possibility of this information being inadvertently printed in the
|
430 |
+
support forum.
|
431 |
+
|
432 |
= 4.1.14 =
|
433 |
* **Bug Fix:** The handling of saving [Thumber.co](https://thumber.co) subscriptions was broken for some use cases.
|
434 |
The logic has been updated to work correctly in all cases.
|
admin/tabs/advanced-tab.php
CHANGED
@@ -104,7 +104,11 @@ function dg_render_advanced_section() {
|
|
104 |
* Renders a readonly textfield containing a dump of current DG options.
|
105 |
*/
|
106 |
function dg_render_options_dump_section() {
|
107 |
-
|
|
|
|
|
|
|
|
|
108 |
<p><?php
|
109 |
_e( 'The following <em>readonly text</em> should be provided when <a href="http://wordpress.org/support/plugin/document-gallery" target="_blank">reporting a bug</a>:', 'documet-gallery' );
|
110 |
?></p>
|
@@ -113,7 +117,7 @@ function dg_render_options_dump_section() {
|
|
113 |
<tr valign="top">
|
114 |
<td>
|
115 |
<textarea readonly="true" rows="10" cols="50" id="options-dump"
|
116 |
-
class="large-text code"><?php print_r( $
|
117 |
</td>
|
118 |
</tr>
|
119 |
</tbody>
|
104 |
* Renders a readonly textfield containing a dump of current DG options.
|
105 |
*/
|
106 |
function dg_render_options_dump_section() {
|
107 |
+
$options = $GLOBALS['dg_options'];
|
108 |
+
if ( !is_null( $options['thumber-co']['secret'] ) )
|
109 |
+
$options['thumber-co']['secret'] = '******';
|
110 |
+
|
111 |
+
?>
|
112 |
<p><?php
|
113 |
_e( 'The following <em>readonly text</em> should be provided when <a href="http://wordpress.org/support/plugin/document-gallery" target="_blank">reporting a bug</a>:', 'documet-gallery' );
|
114 |
?></p>
|
117 |
<tr valign="top">
|
118 |
<td>
|
119 |
<textarea readonly="true" rows="10" cols="50" id="options-dump"
|
120 |
+
class="large-text code"><?php print_r( $options ); ?></textarea>
|
121 |
</td>
|
122 |
</tr>
|
123 |
</tbody>
|
document-gallery.php
CHANGED
@@ -5,14 +5,14 @@ defined( 'WPINC' ) OR exit;
|
|
5 |
Plugin Name: Document Gallery
|
6 |
Plugin URI: http://wordpress.org/extend/plugins/document-gallery/
|
7 |
Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
|
8 |
-
Version: 4.
|
9 |
Author: Dan Rossiter
|
10 |
Author URI: http://danrossiter.org/
|
11 |
License: GPLv3
|
12 |
Text Domain: document-gallery
|
13 |
*/
|
14 |
|
15 |
-
define( 'DG_VERSION', '4.
|
16 |
|
17 |
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
|
18 |
add_action( 'admin_notices', 'dg_php_lt_three' );
|
5 |
Plugin Name: Document Gallery
|
6 |
Plugin URI: http://wordpress.org/extend/plugins/document-gallery/
|
7 |
Description: Display non-images (and images) in gallery format on a page or post with the [dg] shortcode.
|
8 |
+
Version: 4.2
|
9 |
Author: Dan Rossiter
|
10 |
Author URI: http://danrossiter.org/
|
11 |
License: GPLv3
|
12 |
Text Domain: document-gallery
|
13 |
*/
|
14 |
|
15 |
+
define( 'DG_VERSION', '4.2' );
|
16 |
|
17 |
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
|
18 |
add_action( 'admin_notices', 'dg_php_lt_three' );
|
inc/class-gallery-sanitization.php
CHANGED
@@ -213,6 +213,24 @@ class DG_GallerySanitization {
|
|
213 |
return self::sanitizeIdList( 'Include', $value, $err );
|
214 |
}
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
/**
|
217 |
* Takes the provided value and returns a sanitized value.
|
218 |
*
|
213 |
return self::sanitizeIdList( 'Include', $value, $err );
|
214 |
}
|
215 |
|
216 |
+
/**
|
217 |
+
* Takes the provided value and returns a sanitized value.
|
218 |
+
*
|
219 |
+
* @param string $value The include_children value to be sanitized.
|
220 |
+
* @param string &$err String to be initialized with error, if any.
|
221 |
+
*
|
222 |
+
* @return bool|null The sanitized include_children value.
|
223 |
+
*/
|
224 |
+
private static function sanitizeIncludeChildren( $value, &$err ) {
|
225 |
+
$ret = DG_Util::toBool( $value );
|
226 |
+
|
227 |
+
if ( is_null( $ret ) ) {
|
228 |
+
$err = sprintf( self::$binary_err, 'include_children', 'true', 'false', $value );
|
229 |
+
}
|
230 |
+
|
231 |
+
return $ret;
|
232 |
+
}
|
233 |
+
|
234 |
/**
|
235 |
* Takes the provided value and returns a sanitized value.
|
236 |
*
|
inc/class-gallery.php
CHANGED
@@ -268,25 +268,33 @@ class DG_Gallery {
|
|
268 |
*/
|
269 |
private function setTaxa( &$query ) {
|
270 |
if ( ! empty( $this->taxa ) ) {
|
271 |
-
static $
|
272 |
-
$
|
273 |
-
$
|
274 |
-
|
275 |
-
|
276 |
-
|
|
|
|
|
277 |
foreach ( $this->taxa as $key => $value ) {
|
278 |
-
if ( preg_match( $
|
279 |
$base = $matches[1];
|
280 |
if ( isset( $this->taxa[$base] ) ) {
|
281 |
$operator[$base] = DG_GallerySanitization::sanitizeParameter( 'operator', $value, $this->errs );
|
282 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
}
|
284 |
}
|
285 |
}
|
286 |
|
287 |
// build tax query
|
288 |
foreach ( $this->taxa as $taxon => $terms ) {
|
289 |
-
if ( in_array( $taxon, $
|
290 |
|
291 |
$terms = $this->getTermIdsByNames( $taxon, explode( ',', $terms ) );
|
292 |
|
@@ -294,6 +302,7 @@ class DG_Gallery {
|
|
294 |
'taxonomy' => $taxon,
|
295 |
'field' => 'id',
|
296 |
'terms' => $terms,
|
|
|
297 |
'operator' => isset( $operator[ $taxon ] ) ? $operator[ $taxon ] : 'IN'
|
298 |
);
|
299 |
}
|
268 |
*/
|
269 |
private function setTaxa( &$query ) {
|
270 |
if ( ! empty( $this->taxa ) ) {
|
271 |
+
static $op_regex = '/(.+)_(?:relation|operator)$/i';
|
272 |
+
static $inc_child_regex = '/(.+)_include_children$/i';
|
273 |
+
$taxa = array( 'relation' => $this->atts['relation'] );
|
274 |
+
$operator = array();
|
275 |
+
$include_children = array();
|
276 |
+
|
277 |
+
// find any taxa-specific settings
|
278 |
+
$excluded_keys = array();
|
279 |
foreach ( $this->taxa as $key => $value ) {
|
280 |
+
if ( preg_match( $op_regex, $key, $matches ) ) {
|
281 |
$base = $matches[1];
|
282 |
if ( isset( $this->taxa[$base] ) ) {
|
283 |
$operator[$base] = DG_GallerySanitization::sanitizeParameter( 'operator', $value, $this->errs );
|
284 |
+
$excluded_keys[] = $key;
|
285 |
+
}
|
286 |
+
} elseif ( preg_match( $inc_child_regex, $key, $matches ) ) {
|
287 |
+
$base = $matches[1];
|
288 |
+
if ( isset( $this->taxa[$base] ) ) {
|
289 |
+
$include_children[$base] = DG_GallerySanitization::sanitizeParameter( 'include_children', $value, $this->errs );
|
290 |
+
$excluded_keys[] = $key;
|
291 |
}
|
292 |
}
|
293 |
}
|
294 |
|
295 |
// build tax query
|
296 |
foreach ( $this->taxa as $taxon => $terms ) {
|
297 |
+
if ( in_array( $taxon, $excluded_keys ) ) continue;
|
298 |
|
299 |
$terms = $this->getTermIdsByNames( $taxon, explode( ',', $terms ) );
|
300 |
|
302 |
'taxonomy' => $taxon,
|
303 |
'field' => 'id',
|
304 |
'terms' => $terms,
|
305 |
+
'include_children' => isset( $include_children[ $taxon ] ) ? $include_children[$taxon] : true,
|
306 |
'operator' => isset( $operator[ $taxon ] ) ? $operator[ $taxon ] : 'IN'
|
307 |
);
|
308 |
}
|