From edfd0e687d380b219d927f52751e7e991c364b74 Mon Sep 17 00:00:00 2001 From: Jonathan Buttigieg Date: Wed, 5 Apr 2017 12:26:18 +0200 Subject: [PATCH 1/6] =?UTF-8?q?Replace=20"am=C3=A9liorez"=20by=20"am=C3=A9?= =?UTF-8?q?lior=C3=A9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/imagify-fr_FR.mo | Bin 26681 -> 26679 bytes languages/imagify-fr_FR.po | 28 ++++++++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/languages/imagify-fr_FR.mo b/languages/imagify-fr_FR.mo index 285a712cc88108632915522cb3093b0458bd35ec..65eed3dee6f25635870f91a1481f0d45a0a3248e 100755 GIT binary patch delta 1944 zcmZA1eN0t#9LMo5w}3zS%28v zKsF!BMYYr!L>Z%|EqgHL7Ojz1Th@A7TiPGdWNfaq_5O6uUu}%n?|be!_jkSzzk7N# z=DpFFx0l67Px{OzO3jX#S#P=7EDYUamW^SYjZfq4cnmk;hggQW^Ud_#qnuTUX*o=#@2Mh5Mrej=%Sv+Q9 z3g)3+v=nc{Ri3RliTD}Rb1$G?^wo-}Srv;@T!_O7OvUS%gUOX{1&Z-j;yToeZT8{_ zYQyJH8TMiZ4&Y=wkGlV&7ypWF#DAjpZHz8*OYu7D&ECbC_&Kh?F;rzL?lp_xK1_)* z^YOG^D81UvJQqX6C8$K&aRx?E6*`0k*o$h_XQ&oLM_FXC_yv`L-Dj2tN%&t$QJIvY zGOI#Wr~%JnJ1WCD^d}oDkv|LbPc1l({dg9a;8y-M;2@r1e@k9!*2RSpd>9+E&oa5EO7df$a<>~F8I&_+X^ z=TIAdiF)u``~)w1_SL%Aw=Z{Fwg(v(>+#}?s0v=eIQ$307)w9*V+&5har}+_En%hm zz*SW5<5#)8D?pX71~t7+$UE3JR7*~yNGgXj8Sd4 zn}vq2*Slc|6Nt}aB3{6J{28_Jq&3`&>8R(1P#KS43jTyGIF7S%!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spr)Oi-VQ`Q^6CS}SRE9BHStaPkRE(o)>);}M7CEtY z5|`j*oR5`lZjD!=;!UVe@Z*?|`%pV@6rV(A%=;nmFrP~Y84^`tAupB4x7QBMR zSjcRh^EJ2|J5axWf!gY8ScJV@?x`8^`~Vkn{Yy;4KT*ef2J=+ZYYfztdE4CP3*mC& z7OcY|%){?cHM@$1n3afUjFm+r!Ej|T6e$QtYpU)Dgu5dlG-tGz9+z\n" "Language-Team: \n" "Language: fr_FR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 1.8.6\n" +"X-Generator: Poedit 2.0\n" "X-Poedit-Basepath: ..\n" "X-Poedit-WPHeader: imagify.php\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" @@ -466,7 +466,7 @@ msgid "" "%1$sCongratulations%2$s, you have optimized %1$s%3$d images%2$s and improved " "your website's speed by reducing your images size." msgstr "" -"%1$sFélicitations%2$s ! Vous avez optimisé %1$s%3$d images%2$s et améliorez le " +"%1$sFélicitations%2$s ! Vous avez optimisé %1$s%3$d images%2$s et amélioré le " "temps de chargement de votre site en réduisant le poids de vos images." #: inc/admin/ui/notices.php:365 inc/admin/ui/options.php:59 @@ -693,7 +693,7 @@ msgstr "" "baisse de qualité sur vos images, nous vous recommandons ce niveau." #: inc/admin/ui/options.php:357 inc/admin/ui/options.php:479 -#: inc/functions/admin-ui.php:619 inc/functions/i18n.php:64 +#: inc/functions/admin-ui.php:617 inc/functions/i18n.php:64 msgid "Close" msgstr "Fermer" @@ -890,7 +890,7 @@ msgid "/month" msgstr "/mois" #: inc/functions/admin-ui.php:351 inc/functions/admin-ui.php:399 -#: inc/functions/admin-ui.php:505 inc/functions/admin-ui.php:557 +#: inc/functions/admin-ui.php:505 inc/functions/admin-ui.php:555 #, php-format msgid "approx: %s images" msgstr "approx : %s images" @@ -964,11 +964,11 @@ msgstr "" "facturation arrive automatiquement tous les mois ou années dépendamment de " "votre choix de période de facturation." -#: inc/functions/admin-ui.php:517 inc/functions/admin-ui.php:565 +#: inc/functions/admin-ui.php:517 inc/functions/admin-ui.php:563 msgid "we recommend for you" msgstr "nous vous recommandons" -#: inc/functions/admin-ui.php:525 inc/functions/admin-ui.php:569 +#: inc/functions/admin-ui.php:525 inc/functions/admin-ui.php:567 msgid "Choose plan" msgstr "Choisir ce plan" @@ -994,28 +994,28 @@ msgstr "" "qui ont besoin d’être optimisées. Vous pouvez l’utiliser pour une optimisation " "en masse de vos images passées. Vous ne paierez qu’une fois." -#: inc/functions/admin-ui.php:614 +#: inc/functions/admin-ui.php:612 msgid "Thank you for being awesome!" msgstr "Merci à vous d’être aussi fabuleux !" -#: inc/functions/admin-ui.php:626 +#: inc/functions/admin-ui.php:624 msgid "What do our user think about Imagify" msgstr "Ce que nos utilisateurs pensent d’Imagify" -#: inc/functions/admin-ui.php:660 +#: inc/functions/admin-ui.php:658 msgid "Secure Credit Card Payment" msgstr "Paiement par carte sécurisé" -#: inc/functions/admin-ui.php:661 +#: inc/functions/admin-ui.php:659 msgid "This is secure 128-bits SSL encrypted payment" msgstr "Paiement sécurisé par cryptage SSL 128-bits" -#: inc/functions/admin-ui.php:683 +#: inc/functions/admin-ui.php:681 #, php-format msgid "%s OFF on all the subscriptions" msgstr "%s de remise sur tous les abonnements" -#: inc/functions/admin-ui.php:685 +#: inc/functions/admin-ui.php:683 #, php-format msgid "Special Offer
Until %s" msgstr "Offre spéciale
Jusqu’au %s" From 17fc497061640609dc4195ab4e67dd823912cbb4 Mon Sep 17 00:00:00 2001 From: Jonathan Buttigieg Date: Wed, 5 Apr 2017 12:28:28 +0200 Subject: [PATCH 2/6] Return a dedicated message for 413 HTTP error --- inc/api/imagify.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) mode change 100755 => 100644 inc/api/imagify.php diff --git a/inc/api/imagify.php b/inc/api/imagify.php old mode 100755 new mode 100644 index 49dabb4fd..1e05278ec --- a/inc/api/imagify.php +++ b/inc/api/imagify.php @@ -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 **/ @@ -217,7 +217,7 @@ public function createUser( $data ) { 'method' => 'POST', 'post_data' => $data ); - + return $this->httpCall( 'users/', $args ); } @@ -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 ); } @@ -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 ); } @@ -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 ); @@ -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 ) : ''; @@ -439,4 +441,4 @@ private function httpCall( $url, $args = array() ) { function Imagify() { return Imagify::instance(); } -$GLOBALS['imagify'] = Imagify(); \ No newline at end of file +$GLOBALS['imagify'] = Imagify(); From 863e9bc11f46bee60f23f7cbe63fd0c65769854f Mon Sep 17 00:00:00 2001 From: Jonathan Buttigieg Date: Wed, 5 Apr 2017 16:04:18 +0200 Subject: [PATCH 3/6] Add Re-optimize link even when it already optimized in a lower level --- inc/functions/admin-ui.php | 163 +++++++++++++++++++------------------ 1 file changed, 85 insertions(+), 78 deletions(-) mode change 100755 => 100644 inc/functions/admin-ui.php diff --git a/inc/functions/admin-ui.php b/inc/functions/admin-ui.php old mode 100755 new mode 100644 index 1c1942065..30f13f6ba --- a/inc/functions/admin-ui.php +++ b/inc/functions/admin-ui.php @@ -12,24 +12,24 @@ */ function get_imagify_attachment_optimization_text( $attachment, $context = 'wp' ) { global $pagenow; - + $attachment_id = $attachment->id; $data = $attachment->get_data(); - $output = ( 'post.php' != $pagenow ) ? '
    ' : ''; - $output_before = ( 'post.php' != $pagenow ) ? '
  • ' : '
    '; + $output = ( 'post.php' !== $pagenow ) ? '
      ' : ''; + $output_before = ( 'post.php' !== $pagenow ) ? '
    • ' : '
      '; $output_after = ( 'post.php' != $pagenow ) ? '
    • ' : '
    '; - $reoptimize_output = ''; - - if ( $error = get_imagify_attachment_error_text( $attachment, $context ) ) { - $error = ( 'post.php' === $pagenow ) ? $output_before . $error . $output_after : $error; - return $error; - } + $reoptimize_link = get_imagify_attachment_reoptimize_link( $attachment, $context ); + $reoptimize_output = ( $reoptimize_link ) ? $reoptimize_link : ''; + $reoptimize_output_before = ''; $optimization_level = $attachment->get_optimization_level_label(); - if ( imagify_valid_key() && $attachment->has_backup() ) { - $reoptimize_link = get_imagify_attachment_reoptimize_link( $attachment, $context ); - $reoptimize_output = ( $reoptimize_link ) ? $reoptimize_link : ''; + if ( $error = get_imagify_attachment_error_text( $attachment, $context ) ) { + $reoptimize_output = $reoptimize_output_before . $reoptimize_output . $reoptimize_output_after; + $error = ( 'post.php' === $pagenow ) ? $output_before . $error . $reoptimize_output . $output_after : $error . $reoptimize_output; + + return $error; } if ( 'post.php' !== $pagenow ) { @@ -43,10 +43,10 @@ function get_imagify_attachment_optimization_text( $attachment, $context = 'wp' '; $output .= $output_before . '' . __( 'Original Saving:', 'imagify' ) . ' - ' . ( ( 'post.php' != $pagenow ) ? $chart : '' ) . '' . $data['sizes']['full']['percent'] . '%' . $output_after; + ' . ( ( 'post.php' !== $pagenow ) ? $chart : '' ) . '' . $data['sizes']['full']['percent'] . '%' . $output_after; // more details section - if ( 'post.php' != $pagenow ) { + if ( 'post.php' !== $pagenow ) { // new list $output .= '
'; $output .= '

' . __( 'View details', 'imagify' ) . '

'; @@ -64,24 +64,24 @@ function get_imagify_attachment_optimization_text( $attachment, $context = 'wp' } // end of list - $output .= ( 'post.php' != $pagenow ) ? '' : ''; + $output .= ( 'post.php' !== $pagenow ) ? '' : ''; // actions section - $output .= ( 'post.php' != $pagenow ) ? '' : $output_before; - $output .= ''; - $output .= ( 'post.php' != $pagenow ) ? '' : $output_after; + + $output .= $reoptimize_output_after; + $output .= ( 'post.php' !== $pagenow ) ? '' : $output_after; return $output; } @@ -107,13 +107,13 @@ function get_imagify_attachment_optimization_text( $attachment, $context = 'wp' */ function get_imagify_attachment_error_text( $attachment, $context = 'wp' ) { global $pagenow; - + $attachment_id = $attachment->id; $data = $attachment->get_data(); $output = ''; $args = array( 'attachment_id' => $attachment_id, - 'context' => $context + 'context' => $context, ); if ( isset( $data['sizes']['full']['success'] ) && ! $data['sizes']['full']['success'] ) { @@ -135,36 +135,43 @@ function get_imagify_attachment_error_text( $attachment, $context = 'wp' ) { */ function get_imagify_attachment_reoptimize_link( $attachment, $context = 'wp' ) { global $pagenow; - + $attachment_id = $attachment->id; $level = (int) $attachment->get_optimization_level(); - $args = array( + $args = array( 'attachment_id' => $attachment_id, - 'context' => $context + 'context' => $context, ); $output = ''; - if ( $attachment->has_backup() ) { - $class = ( 'post.php' !== $pagenow ) ? 'button-imagify-manual-override-upload' : ''; - - // Re-optimize to Ultra - if ( 1 === $level || 0 === $level ) { - $args['optimization_level'] = 2; - $output .= '' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Ultra', 'imagify' ) ) . ''; - } - - // Re-optimize to Aggressive - if ( 2 === $level || 0 === $level ) { - $args['optimization_level'] = 1; - $output .= '' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Aggressive', 'imagify' ) ) . ''; - } - - // Re-optimize to Normal - if ( 2 === $level || 1 === $level ) { - $args['optimization_level'] = 0; - $output .= '' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Normal', 'imagify' ) ) . ''; - } - + // Stop the process if the API key isn't valid + if ( ! imagify_valid_key() ) { + return $output; + } + + // Don't display anything if there is no backup or the image has been optimized. + if ( ! $attachment->has_backup() && ! $attachment->is_already_optimized() ) { + return $output; + } + + $class = ( 'post.php' !== $pagenow ) ? 'button-imagify-manual-override-upload' : ''; + + // Re-optimize to Ultra + if ( 1 === $level || 0 === $level ) { + $args['optimization_level'] = 2; + $output .= '' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Ultra', 'imagify' ) ) . ''; + } + + // Re-optimize to Aggressive + if ( ( 2 === $level && ! $attachment->is_already_optimized() ) || 0 === $level ) { + $args['optimization_level'] = 1; + $output .= '' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Aggressive', 'imagify' ) ) . ''; + } + + // Re-optimize to Normal + if ( ( 2 === $level || 1 === $level ) && ! $attachment->is_already_optimized() ) { + $args['optimization_level'] = 0; + $output .= '' . sprintf( __( 'Re-Optimize to %s', 'imagify' ), __( 'Normal', 'imagify' ) ) . ''; } return $output; @@ -180,16 +187,16 @@ function get_imagify_attachment_reoptimize_link( $attachment, $context = 'wp' ) * @return string The output to print. */ function get_imagify_media_column_content( $attachment, $context = 'wp' ) { - $attachment_id = $attachment->id; + $attachment_id = $attachment->id; $attachment_ext = $attachment->get_extension(); $output = ''; - + // Check if the attachment extension is allowed if ( 'wp' === $context && ! wp_attachment_is_image( $attachment_id ) ) { $output = sprintf( __( '%s can\'t be optimized', 'imagify' ), strtoupper( $attachment_ext ) ); return $output; } - + // Check if the API key is valid if ( ! imagify_valid_key() && ! $attachment->is_optimized() ) { $output .= __( 'Invalid API key', 'imagify' ); @@ -197,10 +204,10 @@ function get_imagify_media_column_content( $attachment, $context = 'wp' ) { $output .= '' . __( 'Check your Settings', 'imagify' ) . ''; return $output; } - + $transient_context = ( 'wp' !== $context ) ? strtolower( $context ) . '-' : ''; $transient_name = 'imagify-' . $transient_context . 'async-in-progress-' . $attachment_id; - + if ( false !== get_transient( $transient_name ) ) { $output = '
' . __( 'Optimizing...', 'imagify' ) . '
'; return $output; @@ -210,7 +217,7 @@ function get_imagify_media_column_content( $attachment, $context = 'wp' ) { if ( ! $attachment->is_optimized() && ! $attachment->has_error() ) { $args = array( 'attachment_id' => $attachment_id, - 'context' => $context + 'context' => $context, ); $output .= '' . __( 'Optimize', 'imagify' ) . ''; return $output; @@ -227,7 +234,7 @@ function get_imagify_media_column_content( $attachment, $context = 'wp' ) { * * @since 1.6 * @author Geoffrey - * + * * @todo add only for no-payable users? */ function get_imagify_new_to_imagify() { @@ -251,7 +258,7 @@ function get_imagify_new_to_imagify() { /** * Return the formatted price present in pricing tables - * + * * @param float $value the price value * @return string the markuped price * @@ -260,7 +267,7 @@ function get_imagify_new_to_imagify() { */ function get_imagify_price_table_format( $value ) { $v = explode( '.', (string) $value ); - + return '' . $v[0] . ' .' . ( strlen( $v[1] ) === 1 ? $v[1] . '0' : $v[1] ) . ''; } @@ -292,13 +299,13 @@ function imagify_payment_modal() {

- + <?php esc_attr_e( 'Analyzing', 'imagify' ); ?>

- ' . $attachments_number . '' ); ?>

@@ -420,7 +427,7 @@ function imagify_payment_modal() {

- + <?php esc_attr_e( 'Checking Coupon', 'imagify' ); ?> @@ -446,15 +453,15 @@ function imagify_payment_modal() {

- + @@ -477,7 +484,7 @@ function imagify_payment_modal() {
- +

@@ -494,10 +501,10 @@ function imagify_payment_modal() {
- +
- +

@@ -548,7 +555,7 @@ function imagify_payment_modal() {