diff --git a/admin/actions.php b/admin/actions.php new file mode 100644 index 0000000..9763032 --- /dev/null +++ b/admin/actions.php @@ -0,0 +1,49 @@ + 1 ) ); + } else { + wp_nonce_ays( '' ); + } + } + + if ( '__rocket_lazyload_imagify_notice' === $args['box'] ) { + update_option( 'rocket_lazyload_dismiss_imagify_notice', 0 ); + } + + global $current_user; + $actual = get_user_meta( $current_user->ID, 'rocket_lazyload_boxes', true ); + $actual = array_merge( (array) $actual, array( $args['box'] ) ); + $actual = array_filter( $actual ); + $actual = array_unique( $actual ); + update_user_meta( $current_user->ID, 'rocket_lazyload_boxes', $actual ); + delete_transient( $args['box'] ); + + if ( 'admin-post.php' === $GLOBALS['pagenow'] ) { + if ( defined( 'DOING_AJAX' ) ) { + wp_send_json( array( 'error' => 0 ) ); + } else { + wp_safe_redirect( wp_get_referer() ); + die(); + } + } + } +} +add_action( 'wp_ajax_rocket_lazyload_ignore', 'rocket_lazyload_dismiss_boxes' ); +add_action( 'admin_post_rocket_lazyload_ignore', 'rocket_lazyload_dismiss_boxes' ); diff --git a/admin/admin.php b/admin/admin.php index 7878c54..807395d 100644 --- a/admin/admin.php +++ b/admin/admin.php @@ -8,7 +8,7 @@ * @return void */ function rocket_lazyload_add_menu() { - add_options_page( __( 'Rocket LazyLoad', 'rocket-lazy-load' ), __( 'Rocket LazyLoad', 'rocket-lazy-load' ), 'manage_options', 'rocket-lazyload', 'rocket_lazyload_options_output' ); + add_options_page( __( 'LazyLoad by WP Rocket', 'rocket-lazy-load' ), __( 'LazyLoad', 'rocket-lazy-load' ), 'manage_options', 'rocket-lazyload', 'rocket_lazyload_options_output' ); } add_action( 'admin_menu', 'rocket_lazyload_add_menu' ); @@ -70,6 +70,7 @@ function rocket_lazyload_options_output() { ?>
+ = 0 ? 'h1' : 'h2'; ?> < class="screen-reader-text">>
diff --git a/admin/notices.php b/admin/notices.php new file mode 100644 index 0000000..81f8381 --- /dev/null +++ b/admin/notices.php @@ -0,0 +1,79 @@ +base ) ) { + return; + } + + $boxes = get_user_meta( $GLOBALS['current_user']->ID, 'rocket_lazyload_boxes', true ); + + if ( defined( 'IMAGIFY_VERSION' ) || in_array( __FUNCTION__, (array) $boxes, true ) || 1 === get_option( 'rocket_lazyload_dismiss_imagify_notice' ) || ! current_user_can( 'manage_options' ) ) { + return; + } + + $action_url = wp_nonce_url( add_query_arg( + array( + 'action' => 'install-plugin', + 'plugin' => 'imagify', + ), + admin_url( 'update.php' ) + ), 'install-plugin_imagify' ); + + $classes = ' install-now'; + $cta_txt = esc_html__( 'Install Imagify for Free', 'rocket-lazyload' ); + + $dismiss_url = wp_nonce_url( + admin_url( 'admin-post.php?action=rocket_lazyload_ignore&box=' . __FUNCTION__ ), + 'rocket_lazyload_ignore_' . __FUNCTION__ + ); + ?> + +
+ + + +

+ +

+

+ +

+
+ + + jQuery( document ).ready( function( $ ){ + $( '.rktll-cross' ).on( 'click', function( e ) { + e.preventDefault(); + var url = $( this ).attr( 'href' ).replace( 'admin-post', 'admin-ajax' ); + $.get( url ).done( $( this ).parent().hide( 'slow' ) ); + }); + } ); + +HTML; +} +add_action( 'admin_footer', 'rocket_lazyload_notice_script' ); diff --git a/assets/css/admin.css b/assets/css/admin.css index 86fd878..3e231b3 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -32,7 +32,7 @@ flex-wrap: wrap; -webkit-box-align: center; -ms-flex-align: center; - align-items: center; + align-items: center; -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between; @@ -202,7 +202,7 @@ display: flex; -webkit-box-align: center; -ms-flex-align: center; - align-items: center; + align-items: center; margin: -10px 20px 20px 20px; padding: 26px; background: #F6F6F6; @@ -214,9 +214,11 @@ flex-basis: 250px; padding-right: 38px; } + .rocket-lazyload-cta-block { margin-top: 1.75em; } + .rocket-lazyload-cta-promo { display: block; padding: 15px; @@ -227,14 +229,17 @@ font-weight: bold; color: #F56640; } + .rocket-lazyload-cta-promo strong { color: #0E1B23; } + .rocket-lazyload-cta-block.rocket-lazyload-cta-block .button-primary { width: 100%; text-align: center; font-size: 13px; } + .rll-upgrade-item { position: relative; margin: 1.5em auto; @@ -242,6 +247,7 @@ font-size: 13px; color: #71787D; } + .rll-upgrade-item:before { content: "✓"; position: absolute; @@ -251,24 +257,29 @@ color: #39CE9A; font-weight: normal; } + .rll-upgrade-item strong { color: #39CE9A; font-weight: bold; } + .rocket-lazyload-upgrade p { margin: 0; } + .rocket-lazyload-upgrade .rocket-lazyload-subtitle { margin-bottom: 8px; font-size: 14px; letter-spacing: 1px; color: #F56640; } + .rocket-lazyload-bigtext { font-size: 28px; font-weight: bold; color: #0E1B23; } + .rocket-lazyload-rocket-logo { display: block; margin-top: 12px; @@ -297,6 +308,7 @@ font-weight: bold; text-shadow: none; } + .rocket-lazyload-form .button-primary:hover, .rocket-lazyload-form .button-primary:focus { text-shadow: none; @@ -308,6 +320,102 @@ margin-left: 8px; } +.rktll-imagify-notice.rktll-imagify-notice { + position: relative; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; + -ms-grid-row-align: center; + align-items: center; + float: none; + width: auto; + padding: 5px 45px 5px 0; + border: 0 none; + box-shadow: none; + color: #FFF; + background: #2e3243; +} + +.rktll-imagify-notice .rktll-cross { + position: absolute; + right: 8px; + top: 50%; + width: 22px; + height: 22px; + padding: 0; + margin-top: -11px; + background: #FFF; + color: #2e3243; + border-radius: 50%; + transition: all .275s; +} +.rktll-imagify-notice .rktll-cross:hover, +.rktll-imagify-notice .rktll-cross:focus { + opacity: .5; + color: #2e3243; + text-decoration: none; + border-bottom: 0 none; +} + +.rktll-cross .dashicons, +.rktll-cross .dashicons * { + display: inline; + text-decoration: none; + vertical-align: text-bottom; +} + +.rktll-imagify-notice .rktll-cross .dashicons { + position: relative; + top: 2px; + left: 1px; + transition: all .275s; +} + +.rktll-imagify-notice .rktll-imagify-logo, +.rktll-imagify-notice .rktll-imagify-cta { + -webkit-flex-shrink: 0; + -ms-flex-negative: 0; + flex-shrink: 0; +} + +.rktll-imagify-notice .rktll-imagify-logo { + width: 160px !important; + text-align: right; + padding: 0 15px; + line-height: 0.8; +} + +.rktll-imagify-notice .rktll-imagify-msg { + width: 100% !important; + padding: 0 15px; +} + +.rktll-imagify-notice .rktll-imagify-cta { + -webkit-box-flex: 1; + -webkit-flex-grow: 1; + -ms-flex-positive: 1; + flex-grow: 1; + -webkit-flex-basis: 200px; + -ms-flex-preferred-size: 200px; + flex-basis: 200px; + padding-top: 7px; +} + +.rktll-imagify-notice .button.button { + height: auto; + font-weight: 600; + font-size: 14px; + box-shadow: 0 3px 0 rgba(0,0,0,.15); + border: 0 none; + padding: 4px 18px; + background: #40B1D0; + text-shadow: 1px 1px 1px rgba(0,0,0,.2); +} + @media (max-width: 820px) { .rocket-lazyload-header .rocket-lazyload-rate-us { margin: 1.5em 0 0; @@ -315,7 +423,6 @@ } } - @media (max-width: 650px) { .rocket-lazyload-upgrade { -ms-flex-wrap: wrap; diff --git a/assets/img/logo-imagify.png b/assets/img/logo-imagify.png new file mode 100644 index 0000000..29bfae5 Binary files /dev/null and b/assets/img/logo-imagify.png differ diff --git a/assets/img/logo-imagify.svg b/assets/img/logo-imagify.svg new file mode 100644 index 0000000..1ff2da9 --- /dev/null +++ b/assets/img/logo-imagify.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.txt b/readme.txt index a62cc4c..dfa772d 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: creativejuiz, tabrisrp, wp_media Tags: lazyload, lazy load, images, iframes, thumbnail, thumbnails, smiley, smilies, avatar, gravatar Requires at least: 3.0 Tested up to: 4.8 -Stable tag: 1.4.4 +Stable tag: 1.4.5 The tiny Lazy Load script for WordPress without jQuery, works for images and iframes. @@ -64,6 +64,10 @@ Some plugins are not compatible without lazy loading. Please open a support thre == Changelog == += 1.4.5 = +* Rename Setting Page Name in WP Menu +* New Product Banner in Settings Page + = 1.4.4 = * Admin Redesign diff --git a/rocket-lazy-load.php b/rocket-lazy-load.php index a561044..0abe73f 100644 --- a/rocket-lazy-load.php +++ b/rocket-lazy-load.php @@ -3,7 +3,7 @@ * Plugin Name: Lazy Load by WP Rocket * Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/ * Description: The tiny Lazy Load script for WordPress without jQuery or others libraries. - * Version: 1.4.4 + * Version: 1.4.5 * Author: WP Media * Author URI: https://wp-rocket.me * Text Domain: rocket-lazy-load @@ -26,7 +26,7 @@ */ defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' ); -define( 'ROCKET_LL_VERSION', '1.4.4' ); +define( 'ROCKET_LL_VERSION', '1.4.5' ); define( 'ROCKET_LL_PATH', realpath( plugin_dir_path( __FILE__ ) ) . '/' ); define( 'ROCKET_LL_3RD_PARTY_PATH', ROCKET_LL_PATH . '3rd-party/' ); define( 'ROCKET_LL_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets/' ); @@ -46,6 +46,8 @@ function rocket_lazyload_init() { require ROCKET_LL_3RD_PARTY_PATH . '3rd-party.php'; if ( is_admin() ) { + require ROCKET_LL_PATH . 'admin/actions.php'; + require ROCKET_LL_PATH . 'admin/notices.php'; require ROCKET_LL_PATH . 'admin/admin.php'; } } @@ -503,7 +505,7 @@ function rocket_lazyload_iframes( $html ) { * * @param array $html Output that will be printed. */ - $iframe_lazyload = apply_filters( 'rocket_lazyload_iframe_html', str_replace( $iframe[1], $placeholder . '" data-fitvidscompatible="1" data-lazy-src="' . $iframe[1], $iframe[0] ) ); + $iframe_lazyload = apply_filters( 'rocket_lazyload_iframe_html', str_replace( $iframe[1], $placeholder . '" data-rocket-lazyload="fitvidscompatible" data-lazy-src="' . $iframe[1], $iframe[0] ) ); $iframe_lazyload .= $iframe_noscript; $html = str_replace( $iframe[0], $iframe_lazyload, $html );