Version Description
- Fixed an issue where newline characters may not be properly retrieved
- Fixed an issue with localization not initializing properly
- Resolved a PHP Strict warning (props @bukka)
Download this release
Release Info
| Developer | jchristopher |
| Plugin | |
| Version | 3.5.2 |
| Comparing to | |
| See all releases | |
Code changes from version 3.5.1.1 to 3.5.2
- classes/class.attachments.php +16 -6
- docs/hooks.md +3 -2
- docs/usage.md +2 -2
- index.php +1 -1
- readme.txt +7 -2
- views/options.php +1 -1
classes/class.attachments.php
CHANGED
|
@@ -55,7 +55,7 @@ if( !class_exists( 'Attachments' ) ) :
|
|
| 55 |
global $_wp_additional_image_sizes;
|
| 56 |
|
| 57 |
// establish our environment variables
|
| 58 |
-
$this->version = '3.5.
|
| 59 |
$this->url = ATTACHMENTS_URL;
|
| 60 |
$this->dir = ATTACHMENTS_DIR;
|
| 61 |
$plugin = 'attachments/index.php';
|
|
@@ -274,7 +274,7 @@ if( !class_exists( 'Attachments' ) ) :
|
|
| 274 |
*/
|
| 275 |
function l10n()
|
| 276 |
{
|
| 277 |
-
|
| 278 |
}
|
| 279 |
|
| 280 |
|
|
@@ -809,7 +809,7 @@ if( !class_exists( 'Attachments' ) ) :
|
|
| 809 |
_.templateSettings = {
|
| 810 |
variable : 'attachments',
|
| 811 |
interpolate : /\{\{(.+?)\}\}/g
|
| 812 |
-
}
|
| 813 |
|
| 814 |
var template = _.template($('script#tmpl-attachments-<?php echo $instance->name; ?>').html());
|
| 815 |
|
|
@@ -1347,9 +1347,11 @@ if( !class_exists( 'Attachments' ) ) :
|
|
| 1347 |
if( !isset( $attachment_meta['file'] ))
|
| 1348 |
$attachment_meta['file'] = get_attached_file( $attachment->id );
|
| 1349 |
|
|
|
|
|
|
|
| 1350 |
$attachment->width = isset( $attachment_meta['width'] ) ? $attachment_meta['width'] : null;
|
| 1351 |
$attachment->height = isset( $attachment_meta['height'] ) ? $attachment_meta['height'] : null;
|
| 1352 |
-
$attachment->filename =
|
| 1353 |
|
| 1354 |
$attachment_mime = explode( '/', get_post_mime_type( $attachment->id ) );
|
| 1355 |
$attachment->type = isset( $attachment_mime[0] ) ? $attachment_mime[0] : null;
|
|
@@ -1541,7 +1543,7 @@ if( !class_exists( 'Attachments' ) ) :
|
|
| 1541 |
// loop through each Attachment of this instance
|
| 1542 |
foreach( $instance_attachments as $key => $attachment )
|
| 1543 |
{
|
| 1544 |
-
$attachment_exists = get_post( $attachment['id'] );
|
| 1545 |
// make sure the attachment exists
|
| 1546 |
if( $attachment_exists )
|
| 1547 |
{
|
|
@@ -1697,6 +1699,14 @@ if( !class_exists( 'Attachments' ) ) :
|
|
| 1697 |
$attachments_json = get_post_meta( $post_id, $this->meta_key, true );
|
| 1698 |
$attachments_raw = is_string( $attachments_json ) ? json_decode( $attachments_json ) : false;
|
| 1699 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1700 |
return $attachments_raw;
|
| 1701 |
}
|
| 1702 |
|
|
@@ -1748,7 +1758,7 @@ if( !class_exists( 'Attachments' ) ) :
|
|
| 1748 |
if( !is_object( $attachment ) || !is_string( $instance ) )
|
| 1749 |
return $attachment;
|
| 1750 |
|
| 1751 |
-
if( is_object( $attachment->fields ) )
|
| 1752 |
{
|
| 1753 |
foreach( $attachment->fields as $key => $value )
|
| 1754 |
{
|
| 55 |
global $_wp_additional_image_sizes;
|
| 56 |
|
| 57 |
// establish our environment variables
|
| 58 |
+
$this->version = '3.5.2';
|
| 59 |
$this->url = ATTACHMENTS_URL;
|
| 60 |
$this->dir = ATTACHMENTS_DIR;
|
| 61 |
$plugin = 'attachments/index.php';
|
| 274 |
*/
|
| 275 |
function l10n()
|
| 276 |
{
|
| 277 |
+
load_plugin_textdomain( 'attachments', false, 'attachments/languages/' );
|
| 278 |
}
|
| 279 |
|
| 280 |
|
| 809 |
_.templateSettings = {
|
| 810 |
variable : 'attachments',
|
| 811 |
interpolate : /\{\{(.+?)\}\}/g
|
| 812 |
+
};
|
| 813 |
|
| 814 |
var template = _.template($('script#tmpl-attachments-<?php echo $instance->name; ?>').html());
|
| 815 |
|
| 1347 |
if( !isset( $attachment_meta['file'] ))
|
| 1348 |
$attachment_meta['file'] = get_attached_file( $attachment->id );
|
| 1349 |
|
| 1350 |
+
$filename = explode( "/", $attachment_meta['file'] );
|
| 1351 |
+
|
| 1352 |
$attachment->width = isset( $attachment_meta['width'] ) ? $attachment_meta['width'] : null;
|
| 1353 |
$attachment->height = isset( $attachment_meta['height'] ) ? $attachment_meta['height'] : null;
|
| 1354 |
+
$attachment->filename = basename( $attachment_meta['file'] );
|
| 1355 |
|
| 1356 |
$attachment_mime = explode( '/', get_post_mime_type( $attachment->id ) );
|
| 1357 |
$attachment->type = isset( $attachment_mime[0] ) ? $attachment_mime[0] : null;
|
| 1543 |
// loop through each Attachment of this instance
|
| 1544 |
foreach( $instance_attachments as $key => $attachment )
|
| 1545 |
{
|
| 1546 |
+
$attachment_exists = isset( $attachment['id'] ) ? get_post( $attachment['id'] ) : false;
|
| 1547 |
// make sure the attachment exists
|
| 1548 |
if( $attachment_exists )
|
| 1549 |
{
|
| 1699 |
$attachments_json = get_post_meta( $post_id, $this->meta_key, true );
|
| 1700 |
$attachments_raw = is_string( $attachments_json ) ? json_decode( $attachments_json ) : false;
|
| 1701 |
|
| 1702 |
+
// convert field newline characters properly
|
| 1703 |
+
if( !empty( $attachments_raw ) )
|
| 1704 |
+
foreach( $attachments_raw as $instanceKey => $instance )
|
| 1705 |
+
foreach( $instance as $attachmentKey => $attachment )
|
| 1706 |
+
if( isset( $attachment->fields ) )
|
| 1707 |
+
foreach( $attachment->fields as $fieldKey => $fieldValue )
|
| 1708 |
+
$attachment->fields->$fieldKey = str_replace( '\\n', "\n", $fieldValue );
|
| 1709 |
+
|
| 1710 |
return $attachments_raw;
|
| 1711 |
}
|
| 1712 |
|
| 1758 |
if( !is_object( $attachment ) || !is_string( $instance ) )
|
| 1759 |
return $attachment;
|
| 1760 |
|
| 1761 |
+
if( isset( $attachment->fields ) && is_object( $attachment->fields ) )
|
| 1762 |
{
|
| 1763 |
foreach( $attachment->fields as $key => $value )
|
| 1764 |
{
|
docs/hooks.md
CHANGED
|
@@ -28,7 +28,8 @@ There may be a time where you'd like to alter Attachments' data before working w
|
|
| 28 |
```php
|
| 29 |
function my_attachments_randomize( $attachments )
|
| 30 |
{
|
| 31 |
-
|
|
|
|
| 32 |
}
|
| 33 |
|
| 34 |
add_filter( 'attachments_get_my_attachments', 'my_attachments_randomize' );
|
|
@@ -84,4 +85,4 @@ add_action( 'attachments_extension', 'init_my_attachments_extension', 10, 1 );
|
|
| 84 |
|
| 85 |
-----
|
| 86 |
|
| 87 |
-
#### Next: [Screenshots](screenshots.md)
|
| 28 |
```php
|
| 29 |
function my_attachments_randomize( $attachments )
|
| 30 |
{
|
| 31 |
+
shuffle( $attachments );
|
| 32 |
+
return $attachments;
|
| 33 |
}
|
| 34 |
|
| 35 |
add_filter( 'attachments_get_my_attachments', 'my_attachments_randomize' );
|
| 85 |
|
| 86 |
-----
|
| 87 |
|
| 88 |
+
#### Next: [Screenshots](screenshots.md)
|
docs/usage.md
CHANGED
|
@@ -6,7 +6,7 @@ Attachments is based on *instances* which correlate directly with the meta boxes
|
|
| 6 |
|
| 7 |
### Disable Settings Screen
|
| 8 |
|
| 9 |
-
Attachments ships with a `Settings` screen (found under the `Settings` menu in the main WordPress admin navigation) that facilitates data migration from version 1.x and also offers some code snippets. If you would like to
|
| 10 |
|
| 11 |
```php
|
| 12 |
define( 'ATTACHMENTS_SETTINGS_SCREEN', false ); // disable the Settings screen
|
|
@@ -299,4 +299,4 @@ Once you've performed your search, you can loop through the returned Attachments
|
|
| 299 |
|
| 300 |
-----
|
| 301 |
|
| 302 |
-
#### Next: [Hooks](hooks.md)
|
| 6 |
|
| 7 |
### Disable Settings Screen
|
| 8 |
|
| 9 |
+
Attachments ships with a `Settings` screen (found under the `Settings` menu in the main WordPress admin navigation) that facilitates data migration from version 1.x and also offers some code snippets. If you would like to *disable the Settings screen* add the following to your `wp-config.php` *before* `require_once(ABSPATH . 'wp-settings.php');`
|
| 10 |
|
| 11 |
```php
|
| 12 |
define( 'ATTACHMENTS_SETTINGS_SCREEN', false ); // disable the Settings screen
|
| 299 |
|
| 300 |
-----
|
| 301 |
|
| 302 |
+
#### Next: [Hooks](hooks.md)
|
index.php
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
* Description: Attachments gives the ability to append any number of Media Library items to Pages, Posts, and Custom Post Types
|
| 7 |
* Author: Jonathan Christopher
|
| 8 |
* Author URI: http://mondaybynoon.com/
|
| 9 |
-
* Version: 3.5.
|
| 10 |
* Text Domain: attachments
|
| 11 |
* Domain Path: /languages/
|
| 12 |
* License: GPLv2 or later
|
| 6 |
* Description: Attachments gives the ability to append any number of Media Library items to Pages, Posts, and Custom Post Types
|
| 7 |
* Author: Jonathan Christopher
|
| 8 |
* Author URI: http://mondaybynoon.com/
|
| 9 |
+
* Version: 3.5.2
|
| 10 |
* Text Domain: attachments
|
| 11 |
* Domain Path: /languages/
|
| 12 |
* License: GPLv2 or later
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: jchristopher
|
|
| 3 |
Donate link: http://mondaybynoon.com/donate/
|
| 4 |
Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
|
| 5 |
Requires at least: 3.0
|
| 6 |
-
Tested up to: 3.6
|
| 7 |
-
Stable tag: 3.5.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -91,6 +91,11 @@ Please see [Issues on GitHub](https://github.com/jchristopher/attachments/issues
|
|
| 91 |
|
| 92 |
Please see [Attachments' changelog on GitHub](https://github.com/jchristopher/attachments/docs/changelog.md)
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
= 3.5.1.1 =
|
| 95 |
* Fixed an issue where Featured Images may have become inadvertently disabled, props @deborre
|
| 96 |
|
| 3 |
Donate link: http://mondaybynoon.com/donate/
|
| 4 |
Tags: post, page, posts, pages, images, PDF, doc, Word, image, jpg, jpeg, picture, pictures, photos, attachment
|
| 5 |
Requires at least: 3.0
|
| 6 |
+
Tested up to: 3.6.1
|
| 7 |
+
Stable tag: 3.5.2
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 91 |
|
| 92 |
Please see [Attachments' changelog on GitHub](https://github.com/jchristopher/attachments/docs/changelog.md)
|
| 93 |
|
| 94 |
+
= 3.5.2 =
|
| 95 |
+
* Fixed an issue where newline characters may not be properly retrieved
|
| 96 |
+
* Fixed an issue with localization not initializing properly
|
| 97 |
+
* Resolved a PHP Strict warning (props @bukka)
|
| 98 |
+
|
| 99 |
= 3.5.1.1 =
|
| 100 |
* Fixed an issue where Featured Images may have become inadvertently disabled, props @deborre
|
| 101 |
|
views/options.php
CHANGED
|
@@ -135,7 +135,7 @@
|
|
| 135 |
<?php endif; ?>
|
| 136 |
|
| 137 |
<h2><?php _e( 'Usage', 'attachments' ); ?></h2>
|
| 138 |
-
<p>Full usage instructions are provided in <a href="">the official documentation</a>. You can also view the <a class="attachments-toggle-trigger" href="#usage">abridged version</a>.</p>
|
| 139 |
<div id="usage" class="attachments-toggle-target" style="display:none;">
|
| 140 |
<h2><?php _e( 'Revert to version 1.x', 'attachments' ); ?></h2>
|
| 141 |
<p><?php _e( 'If you would like to forcefully revert to the 1.x version branch of Attachments, add the following to your', 'attachments' ); ?> <code>wp-config.php</code>:</p>
|
| 135 |
<?php endif; ?>
|
| 136 |
|
| 137 |
<h2><?php _e( 'Usage', 'attachments' ); ?></h2>
|
| 138 |
+
<p>Full usage instructions are provided in <a href="https://github.com/jchristopher/attachments#documentation">the official documentation</a>. You can also view the <a class="attachments-toggle-trigger" href="#usage">abridged version</a>.</p>
|
| 139 |
<div id="usage" class="attachments-toggle-target" style="display:none;">
|
| 140 |
<h2><?php _e( 'Revert to version 1.x', 'attachments' ); ?></h2>
|
| 141 |
<p><?php _e( 'If you would like to forcefully revert to the 1.x version branch of Attachments, add the following to your', 'attachments' ); ?> <code>wp-config.php</code>:</p>
|
