Skip to content

Commit

Permalink
Merge pull request #56 from wp-media/branch/1.6.4
Browse files Browse the repository at this point in the history
1.6.4
  • Loading branch information
GeekPress authored Apr 6, 2017
2 parents 604d0c3 + 7223cca commit cd5e84c
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 142 deletions.
4 changes: 2 additions & 2 deletions imagify.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Imagify
Plugin URI: https://wordpress.org/plugins/imagify/
Description: Dramaticaly reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwith using Imagify, the new most advanced image optimization tool.
Version: 1.6.3
Version: 1.6.4
Author: WP Media
Author URI: http://wp-media.me
Licence: GPLv2
Expand All @@ -17,7 +17,7 @@
defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );

// Imagify defines
define( 'IMAGIFY_VERSION' , '1.6.3' );
define( 'IMAGIFY_VERSION' , '1.6.4' );
define( 'IMAGIFY_SLUG' , 'imagify' );
define( 'IMAGIFY_SETTINGS_SLUG' , IMAGIFY_SLUG . '_settings' );
define( 'IMAGIFY_WEB_MAIN' , 'https://imagify.io' );
Expand Down
26 changes: 14 additions & 12 deletions inc/api/imagify.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ function get_imagify_all_prices() {

/**
* Check if Coupon Code exists
*
*
* @param string $coupon the coupon code to check
* @return object
*
*
* @since 1.6
* @author Geoffrey Crofte
**/
Expand Down Expand Up @@ -217,7 +217,7 @@ public function createUser( $data ) {
'method' => 'POST',
'post_data' => $data
);

return $this->httpCall( 'users/', $args );
}

Expand Down Expand Up @@ -281,9 +281,9 @@ public function updateUser( $data ) {
$args = array(
'method' => 'PUT',
'post_data' => $data,
'timeout' => 10
'timeout' => 10
);

return $this->httpCall( 'users/me/', $args );
}

Expand All @@ -297,12 +297,12 @@ public function uploadImage( $data ) {
if ( isset( $this->headers['Accept'], $this->headers['Content-Type'] ) ) {
unset( $this->headers['Accept'], $this->headers['Content-Type'] );
}

$args = array(
'method' => 'POST',
'post_data' => $data
);

return $this->httpCall( 'upload/', $args );
}

Expand Down Expand Up @@ -382,10 +382,10 @@ public function getPublicInfo() {
* @return object
**/
private function httpCall( $url, $args = array() ) {
$default = array(
'method' => 'GET',
'post_data' => null,
'timeout' => 45
$default = array(
'method' => 'GET',
'post_data' => null,
'timeout' => 45
);
$args = array_merge( $default, $args );

Expand Down Expand Up @@ -421,6 +421,8 @@ private function httpCall( $url, $args = array() ) {

if ( 200 != $http_code && isset( $response->code, $response->detail ) ) {
return new WP_Error( $http_code, $response->detail );
} elseif ( 413 == $http_code ) {
return new WP_Error( $http_code, 'Your image is too big to be uploaded on our server.' );
} elseif ( 200 != $http_code ) {
$http_code = (int) $http_code;
$error = '' != $error ? ' - ' . htmlentities( $error ) : '';
Expand All @@ -439,4 +441,4 @@ private function httpCall( $url, $args = array() ) {
function Imagify() {
return Imagify::instance();
}
$GLOBALS['imagify'] = Imagify();
$GLOBALS['imagify'] = Imagify();
Loading

0 comments on commit cd5e84c

Please sign in to comment.