From 46e98f4f4c7aea3875702b17a812d2419e432775 Mon Sep 17 00:00:00 2001 From: selul Date: Tue, 28 May 2019 15:16:52 +0300 Subject: [PATCH] fix: improve admin bar quota looking and copyright fix #99 --- inc/admin.php | 46 +++++++++++++++++++++++++++++++++++--------- readme.txt | 53 ++++++++++++++++++++++++--------------------------- 2 files changed, 62 insertions(+), 37 deletions(-) diff --git a/inc/admin.php b/inc/admin.php index feeee9fc4..3b03d82ee 100644 --- a/inc/admin.php +++ b/inc/admin.php @@ -33,6 +33,7 @@ public function __construct() { add_action( 'admin_notices', array( $this, 'add_notice' ) ); add_action( 'admin_notices', array( $this, 'add_notice_upgrade' ) ); add_filter( 'admin_body_class', array( $this, 'add_body_class' ) ); + add_action( 'admin_head', array( $this, 'add_admin_css' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) ); add_action( 'admin_bar_menu', array( $this, 'add_traffic_node' ), 9999 ); @@ -214,7 +215,7 @@ public function add_notice_upgrade() { class="dashicons dashicons-external"> + href=" 'yes' ) ), 'hide_nonce', 'optml_nonce' ); ?>">

', '', '', '' ); ?>

+ class="button button-primary"> + href=" 'yes' ) ), 'hide_nonce', 'optml_nonce' ); ?>">

__( 'Watermark options', 'optimole-wp' ), 'conflicts_menu_item' => __( 'Conflicts', 'optimole-wp' ), 'conflicts' => array( - 'title' => __( 'Possible Conflicts', 'optimole-wp' ), - 'message' => __( 'Details', 'optimole-wp' ), - 'no_conflicts_found' => __( 'No conflicts found. We are all peachy now. ๐Ÿ‘', 'optimole-wp' ), + 'title' => __( 'Possible Conflicts', 'optimole-wp' ), + 'message' => __( 'Details', 'optimole-wp' ), + 'no_conflicts_found' => __( 'No conflicts found. We are all peachy now. ๐Ÿ‘', 'optimole-wp' ), ), 'upgrade' => array( 'title' => __( 'Upgrade to Pro', 'optimole-wp' ), @@ -621,6 +622,26 @@ private function get_dashboard_strings() { ); } + /** + * Add admin css + */ + public function add_admin_css() { + ?> + + settings = new Optml_Settings(); if ( ! $this->settings->is_connected() ) { return; } @@ -640,13 +660,21 @@ public function add_traffic_node( $wp_admin_bar ) { if ( empty( $service_data ) ) { return; } + $traffic = floatval( ( $service_data['usage'] / 1000 ) ); + $quota = floatval( ( $service_data['quota'] / 1000 ) ); + if ( $traffic > $quota ) { + $text = sprintf( __( '%sGB overage', 'optimole-wp' ), number_format( ( $traffic - $quota ), 2 ) ) . ''; + } else { + $text = sprintf( __( '%1$s of %2$sGB', 'optimole-wp' ), number_format( $traffic, 1 ), number_format( $quota, 0 ) ); + } + $args = array( 'id' => 'optml_image_quota', - 'title' => 'Optimole' . __( ' Image Traffic', 'optimole-wp' ) . ': ' . number_format( floatval( ( $service_data['usage'] / 1000 ) ), 3 ) . ' / ' . number_format( floatval( ( $service_data['quota'] / 1000 ) ), 0 ) . 'GB', + 'title' => 'Optimole' . __( ' Quota', 'optimole-wp' ) . ': ' . $text, 'href' => admin_url( 'upload.php?page=optimole' ), 'meta' => array( 'target' => '_blank', - 'class' => $should_load !== 'enabled' ? 'hidden' : '', + 'class' => 'optml-meter ' . ( $should_load !== 'enabled' ? 'hidden' : '' ), ), ); $wp_admin_bar->add_node( $args ); diff --git a/readme.txt b/readme.txt index cb46a8413..1d51e1ebe 100644 --- a/readme.txt +++ b/readme.txt @@ -1,29 +1,26 @@ === Image optimization service by Optimole === Contributors: optimole -Tags: image optimization, cdn, image compression, compress image, images, optimization, perfomance, photos +Tags: image optimization, convert webp, responsive images, lazy load, images, optimization, performance, photos Requires at least: 4.7 -Tested up to: 5.1 +Tested up to: 5.2 Requires PHP: 5.4 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html -End-to-end image processing -With OptiMole, your siteโ€™s images will be cropped, optimized and processed on-the-fly. - +Improve your site loading speed by delivering the optimal image for each device. Lazy load included. == Description == > **What makes Optimole so special?** > > * Smaller images. Same quality -> * Optimizes based on the visitor's actual device > * Fully automated; set and forget > * Supports all image types > * Supports both Retina and WebP images > * Serves images from a global CDN for free > * Optimizes based on the visitor's actual device (no more guesswork and width estimations) > * Full support for page builders like Elementor -> * Lazy loading without jQuery (better) +> * Lazy load without jQuery (better) > * Fully functional free version (we have paid plans as well) > @@ -45,13 +42,13 @@ With the basic plan, you will be able to optimize 1GB of images per month with 5 Better yet. The free version is fully functional and includes all of the following great features. **Format Based Optimization** -Our cloud-based transformation process means we can offer optimizations based on the format. If your visitor is using a WebP capable browser, then Optimole will send a WebP image to their device. +Our cloud-based transformation process means we can offer optimizations based on the format. If your visitor is using a WebP capable browser, then Optimole will convert to WebP the image and send it to their device. **Image Optimization** Our algorithms crunch the numbers to provide the best lossy or lossless optimization for the best-looking image at the smallest size. **Exact Used Size** -Optimole will use just one image and resize it to fit perfectly on your visitors' devices. No more awkward guesses at potential screen widths. +Optimole will use just one image and resize it delivering a responsive image to fit perfectly on your visitors' devices. No more awkward guesses at potential screen widths. **Retina Support** Optimole can detect Retina screens and deliver an image with the perfect Digital Pixel Ratio (DPR). @@ -71,7 +68,7 @@ Optimole provides an option to downgrade the image quality when it detects a slo Optimole loves page builders and has unique tweaks to solve image replacements. It also has full compatibility with the new block editor in WordPress 5.0 **CDN** -Optimole provides free access to a CDN with 7 edge locations around the world. Even more with the Pro version. +Optimole provides free access to a AWS CloudFront CDN with edge locations in Europe and North America. Even more with the Pro version. **What About Security?** The stripped EXGIF data is not stored on our service. Optimole likes to work behind the scenes, and won't interact with your site's visitors. No data is collected but you can check the [Terms of Service](https://optimole.com/terms/) @@ -254,37 +251,37 @@ Premium users will be able to optimize 10GB images per month with a 50GB viewing -= 1.1.2 - 2018-12-24 = += 1.1.2 - 2018-12-24 = * Minor fixes to Optimole dashboard page. * Fixes DNS prefetch call when lazyload is off. * Enable lazyload and javascript replacement by default for new users. -= 1.1.1 - 2018-12-10 = += 1.1.1 - 2018-12-10 = -* Improve the lazy loading mechanism and adds compatibility with the new javascript library. -* Improve sample images and quality selector integration. -* Adds a notice when the Rest API is not available. -* Adds notice for new users on how the plugin works. -* Tested up with WordPress 5.0, all working smooth. +* Improve the lazy loading mechanism and adds compatibility with the new javascript library. +* Improve sample images and quality selector integration. +* Adds a notice when the Rest API is not available. +* Adds notice for new users on how the plugin works. +* Tested up with WordPress 5.0, all working smooth. * Fix possible issues with thumbnails when the original image is available on a different url scheme. * Ignore lazyload replacement on feed/amp pages. -= 1.1.0 - 2018-11-16 = += 1.1.0 - 2018-11-16 = -* Integrates lazy load feature with support for low-quality placeholders ( LQIP ). +* Integrates lazy load feature with support for low-quality placeholders ( LQIP ). * Integrates Javascript library which delivers images at the right size for each device, including Retina. * Improve image replacement algorithm. -* Improves compatibility with Elementor and Gutenberg. +* Improves compatibility with Elementor and Gutenberg. * Adds support for Custom CNAME and Client hints. -* Improves support for custom CDN. -* Improves AMP support. +* Improves support for custom CDN. +* Improves AMP support. * Improves compatibility with WordPress Multisites. -= 1.0.5 - 2018-10-05 = += 1.0.5 - 2018-10-05 = * Adds max width/height option. * Improves registration workflow. @@ -292,7 +289,7 @@ Premium users will be able to optimize 10GB images per month with a 50GB viewing * Adds logo on link preload. -= 1.0.4 - 2018-10-03 = += 1.0.4 - 2018-10-03 = * Adds in-plugin service registration. * Adds image quality control. @@ -300,20 +297,20 @@ Premium users will be able to optimize 10GB images per month with a 50GB viewing * Improvements to UX and workflow. -= 1.0.3 - 2018-09-26 = += 1.0.3 - 2018-09-26 = * Adds redirect on first install. * Improve elementor assets replacement. -= 1.0.2 - 2018-09-25 = += 1.0.2 - 2018-09-25 = * Improve compatibility with elementor external css files. * Adds generator tag. * Improve replacer handler hook register. -= 1.0.1 - 2018-09-23 = += 1.0.1 - 2018-09-23 = * Tag first stable version for wordpress.org. @@ -342,7 +339,7 @@ Once you exceed these, we will contact you and kindly ask to upgrade to the plan = What Content Delivery Network (CDN) do you use? = -Our FREE plan uses our custom made CDN built with 7 locations around the globe. For the paid plans, we have direct integration with Amazon Cloudfront, with more than 130 locations around the globe. +Our FREE plan uses our AWS CloudFront CDN with locations only in Europe and North America. For the paid plans, we have a global full coverage, with more than 130 locations around the globe. = I'm already using a CDN, can I use that instead of yours ? =