Skip to content

Commit

Permalink
Deploying version 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
A5hleyRich committed Nov 2, 2016
1 parent e8e0163 commit d5fcc4c
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 19 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
**Requires at least:** 4.4
**Tested up to:** 4.6.1
**Stable tag:** 1.1.1
**Stable tag:** 1.1.2
**License:** GPLv3

Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
Expand Down Expand Up @@ -69,12 +69,16 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

## Changelog ##

### WP Offload S3 Lite 1.1.2 - 2016-11-02 ###
* Improvement: Better content filtering support for third party plugins and themes
* Bug fix: PHP Warning: Division by zero

### WP Offload S3 Lite 1.1.1 - 2016-10-17 ###
* New: Filter post excerpts - S3 URLs will no longer be saved to the database
* Bug fix: PHP 5.3 Fatal error: Using $this when not in object context
* Bug fix: Query string parameters incorrectly encoded for Media Library items

### WP Offload S3 Lite 1.1 - 2016-10-29 ###
### WP Offload S3 Lite 1.1 - 2016-09-29 ###
* New: Filter post content. S3 URLs will no longer be saved to the database
* New: Upgrade routine to replace all S3 URLs in content with local URLs
* New: Support for theme custom logos
Expand Down
4 changes: 2 additions & 2 deletions classes/amazon-s3-and-cloudfront.php
Original file line number Diff line number Diff line change
Expand Up @@ -1937,8 +1937,8 @@ protected function maybe_sign_intermediate_size( $url, $attachment_id, $size, $s
* @return null|string
*/
protected function convert_dimensions_to_size_name( $attachment_id, $dimensions ) {
$w = $dimensions[0];
$h = $dimensions[1];
$w = ( isset( $dimensions[0] ) && $dimensions[0] > 0 ) ? $dimensions[0] : 1;
$h = ( isset( $dimensions[1] ) && $dimensions[1] > 0 ) ? $dimensions[1] : 1;
$original_aspect_ratio = $w / $h;
$meta = wp_get_attachment_metadata( $attachment_id );

Expand Down
5 changes: 5 additions & 0 deletions classes/as3cf-filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public function filter_post( $content ) {
* @return mixed
*/
protected function process_content( $content, $cache, &$to_cache ) {
if ( empty( $content ) ) {
// Nothing to filter, return
return $content;
}

if ( ! $this->should_filter_content() ) {
// Not filtering content, return
return $content;
Expand Down
57 changes: 47 additions & 10 deletions classes/filters/as3cf-local-to-s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,66 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
* Init.
*/
protected function init() {
// Hot fix for 4.4 responsive images
$priority = 1;

global $wp_version;
if ( 0 === version_compare( $wp_version, '4.4' ) ) {
$priority = 10;
}

// EDD
add_filter( 'edd_download_files', array( $this, 'filter_edd_download_files' ) );
// Customizer
add_filter( 'theme_mod_background_image', array( $this, 'filter_customizer_image' ) );
add_filter( 'theme_mod_header_image', array( $this, 'filter_customizer_image' ) );
// Posts
add_filter( 'the_content', array( $this, 'filter_post' ), $priority, 1 );
add_action( 'the_post', array( $this, 'filter_post_data' ) );
add_filter( 'content_pagination', array( $this, 'filter_content_pagination' ) );
add_filter( 'the_content', array( $this, 'filter_post' ), 100 );
add_filter( 'the_excerpt', array( $this, 'filter_post' ), 100 );
add_filter( 'content_edit_pre', array( $this, 'filter_post' ) );
add_filter( 'the_excerpt', array( $this, 'filter_post' ) );
add_filter( 'excerpt_edit_pre', array( $this, 'filter_post' ) );
// Widgets
add_filter( 'widget_text', array( $this, 'filter_widget' ) );
add_filter( 'widget_form_callback', array( $this, 'filter_widget_form' ), 10, 2 );
}

/**
* Filter post data.
*
* @param WP_Post $post
*/
public function filter_post_data( $post ) {
global $pages;

$cache = $this->get_post_cache();
$to_cache = array();

if ( count( $pages ) === 1 ) {
// Post already filtered and available on global $page array, continue
$post->post_content = $pages[0];
} else {
$post->post_content = $this->process_content( $post->post_content, $cache, $to_cache );
}

$post->post_excerpt = $this->process_content( $post->post_excerpt, $cache, $to_cache );

$this->maybe_update_post_cache( $to_cache );
}

/**
* Filter content pagination.
*
* @param array $pages
*
* @return array
*/
public function filter_content_pagination( $pages ) {
$cache = $this->get_post_cache();
$to_cache = array();

foreach ( $pages as $key => $page ) {
$pages[ $key ] = $this->process_content( $page, $cache, $to_cache );
}

$this->maybe_update_post_cache( $to_cache );

return $pages;
}

/**
* Filter widget.
*
Expand Down
2 changes: 1 addition & 1 deletion languages/amazon-s3-and-cloudfront-en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: amazon-s3-and-cloudfront\n"
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
"POT-Creation-Date: 2016-10-17 13:06+0100\n"
"POT-Creation-Date: 2016-11-02 13:33+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: bradt, deliciousbrains
Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
Requires at least: 4.4
Tested up to: 4.6.1
Stable tag: 1.1.1
Stable tag: 1.1.2
License: GPLv3

Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
Expand Down Expand Up @@ -65,12 +65,16 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

== Changelog ==

= WP Offload S3 Lite 1.1.2 - 2016-11-02 =
* Improvement: Better content filtering support for third party plugins and themes
* Bug fix: PHP Warning: Division by zero

= WP Offload S3 Lite 1.1.1 - 2016-10-17 =
* New: Filter post excerpts - S3 URLs will no longer be saved to the database
* Bug fix: PHP 5.3 Fatal error: Using $this when not in object context
* Bug fix: Query string parameters incorrectly encoded for Media Library items

= WP Offload S3 Lite 1.1 - 2016-10-29 =
= WP Offload S3 Lite 1.1 - 2016-09-29 =
* New: Filter post content. S3 URLs will no longer be saved to the database
* New: Upgrade routine to replace all S3 URLs in content with local URLs
* New: Support for theme custom logos
Expand Down
4 changes: 2 additions & 2 deletions wordpress-s3.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/
Description: Automatically copies media uploads to Amazon S3 for storage and delivery. Optionally configure Amazon CloudFront for even faster delivery.
Author: Delicious Brains
Version: 1.1.1
Version: 1.1.2
Author URI: http://deliciousbrains.com/
Network: True
Text Domain: amazon-s3-and-cloudfront
Expand All @@ -26,7 +26,7 @@
// Then completely rewritten.
*/

$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '1.1.1';
$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '1.1.2';

$aws_plugin_version_required = '1.0';

Expand Down

0 comments on commit d5fcc4c

Please sign in to comment.