Skip to content

Commit

Permalink
fix: improve admin bar quota looking and copyright #99
Browse files Browse the repository at this point in the history
  • Loading branch information
selul committed May 29, 2019
1 parent 8a2da71 commit 200e746
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 37 deletions.
46 changes: 37 additions & 9 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -214,7 +215,7 @@ public function add_notice_upgrade() {
class="dashicons dashicons-external"></span><?php _e( 'Check upgrade plans', 'optimole-wp' ); ?>
</a>
<a class="button"
href="<?php echo wp_nonce_url( add_query_arg( array( 'optml_hide_upg' => 'yes' ) ), 'hide_nonce', 'optml_nonce' ); ?>"><?php _e( 'I\'ve done this', 'optimole-wp' ); ?></a>
href="<?php echo wp_nonce_url( add_query_arg( array( 'optml_hide_upg' => 'yes' ) ), 'hide_nonce', 'optml_nonce' ); ?>"><?php _e( 'I\'ve done this', 'optimole-wp' ); ?></a>
</p>
</div>
<?php
Expand Down Expand Up @@ -267,9 +268,9 @@ public function add_notice() {
<p> <?php printf( __( 'Welcome to %1$sOptiMole%2$s, the easiest way to optimize your website images. Your users will enjoy a %3$sfaster%4$s website after you connect it with our service.', 'optimole-wp' ), '<strong>', '</strong>', '<strong>', '</strong>' ); ?></p>
<p>
<a href="<?php echo esc_url( admin_url( 'upload.php?page=optimole' ) ); ?>"
class="button button-primary"><?php _e( 'Connect to OptiMole', 'optimole-wp' ); ?></a>
class="button button-primary"><?php _e( 'Connect to OptiMole', 'optimole-wp' ); ?></a>
<a class="button"
href="<?php echo wp_nonce_url( add_query_arg( array( 'optml_hide_optin' => 'yes' ) ), 'hide_nonce', 'optml_nonce' ); ?>"><?php _e( 'I will do it later', 'optimole-wp' ); ?></a>
href="<?php echo wp_nonce_url( add_query_arg( array( 'optml_hide_optin' => 'yes' ) ), 'hide_nonce', 'optml_nonce' ); ?>"><?php _e( 'I will do it later', 'optimole-wp' ); ?></a>
</p>
</div>
<?php
Expand Down Expand Up @@ -528,9 +529,9 @@ private function get_dashboard_strings() {
'watermarks_menu_item' => __( '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' ),
Expand Down Expand Up @@ -621,6 +622,26 @@ private function get_dashboard_strings() {
);
}

/**
* Add admin css
*/
public function add_admin_css() {
?>
<style type="text/css">
#wpadminbar .optml-meter .ab-icon {
float: right !important;
margin-left: 3px;
}

#wpadminbar .optml-meter .ab-icon:before {
content: "\f534";
font-size: 80%;
color: #D54222 !important;
}
</style>
<?php
}

/**
* Add top admin bar notice of traffic quota/usage.
*
Expand All @@ -630,7 +651,6 @@ public function add_traffic_node( $wp_admin_bar ) {
if ( ! is_user_logged_in() ) {
return;
}
$this->settings = new Optml_Settings();
if ( ! $this->settings->is_connected() ) {
return;
}
Expand All @@ -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 ) ) . '<span class="ab-icon"></span>';
} 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 );
Expand Down
53 changes: 25 additions & 28 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -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)
>

Expand All @@ -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).
Expand All @@ -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/)
Expand Down Expand Up @@ -254,66 +251,66 @@ 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.
* Adds image comparison slider ratio.
* 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.
* Adds slider for image comparison.
* 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.

Expand Down Expand Up @@ -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 ? =

Expand Down

0 comments on commit 200e746

Please sign in to comment.