Plugin Directory

Changeset 3113906


Ignore:
Timestamp:
07/07/2024 09:54:56 PM (20 months ago)
Author:
pandaboxwp
Message:

Release version 2.3.1

Location:
wp-jquery-lightbox
Files:
22 added
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-jquery-lightbox/tags/2.3.1/admin/admin-settings.js

    r3105325 r3113906  
    9898            <a class="pro-action-button" href="https://lightpress.io/pro-lightbox" target="_blank">Learn More</a>
    9999            <a class="pro-action-button" href="https://lightpress.io/pro-lightbox" target="_blank">See Demos</a>
    100             <p style="font-style:italic;font-size:16px;'">See prices and buy directly from your WordPress dashboard <a href="${lightpress.proAdminUrl}">here</a>!</p>
     100            <p style="font-style:italic;font-size:16px;'">See prices and buy directly from your WordPress dashboard <a href="${lightpress.proLandingUrl}">here</a>!</p>
    101101        `;
    102102        document.querySelector( '.active-lightbox-heading' ).after( promoSection );
     
    106106(function($) {
    107107    $( document ).ready( function() {
    108         var container = $('.lightpress-review-notice');
    109         if ( container.length ) {
    110             container.find( '.lightpress-review-actions a' ).click(function() {
    111                 container.remove();
    112                 var rateAction = $( this ).attr( 'data-rate-action' );
    113                 $.post(
    114                     ajaxurl,
    115                     {
    116                         action: 'lightpress-review-action',
    117                         rate_action: rateAction,
    118                         _n: container.find( 'ul:first' ).attr( 'data-nonce' )
    119                     },
    120                     function( result ) {}
    121                 );
     108        window.onload = () => {
     109            if ( '1' === lightpress.openModal ) {
     110                const button = document.querySelector( '#lightpress-open-modal' );
     111                button.click();
     112            }
     113        };
    122114
    123                 if ( 'do-rate' !== rateAction ) {
    124                     return false;
     115        $( '.lightpress-optin-actions a' ).click( function() {
     116            const optinAction = $( this ).attr( 'data-optin-action' );
     117            const nonce = $( '.lightpress-optin-actions' ).attr( 'data-nonce' );
     118            const closeButton = $( '#TB_closeWindowButton' );
     119            $.post(
     120                ajaxurl,
     121                {
     122                    action: 'lightpress-optin-action',
     123                    optin_action: optinAction,
     124                    _n: nonce
     125                },
     126                function( result ) {
     127                    console.log( result );
    125128                }
    126             });
    127         }
     129            );
     130            closeButton.click();
     131        });
     132
    128133    });
    129134})( jQuery );
  • wp-jquery-lightbox/tags/2.3.1/admin/admin.css

    r3105325 r3113906  
    11/* All admin pages */
    2 
    3 .toplevel_page_lightpress-settings #wpbody {
    4     max-width: 90%;
    5 }
    62
    73.toplevel_page_lightpress-settings #wpbody-content > .notice {
     
    2420    text-transform: none !important;
    2521    font-size: 13px !important;
     22}
     23
     24.toplevel_page_lightpress-settings .lightpress-header {
     25    display: flex;
     26    align-items: center;
     27    justify-content: space-between;
     28    max-width: 90%;
     29    margin-top: 30px;
     30}
     31
     32.toplevel_page_lightpress-settings .lightpress-header .lightpress-logo {
     33    margin-top: 0;
     34}
     35
     36.toplevel_page_lightpress-settings .lightpress-header a,
     37.toplevel_page_lightpress-settings .lightpress-header a:hover,
     38.toplevel_page_lightpress-settings .lightpress-header a:focus,
     39.toplevel_page_lightpress-settings .lightpress-header a:visited {
     40    font-size: 16px;
     41    text-decoration: none;
     42    color: #5cbc67;
     43}
     44
     45.toplevel_page_lightpress-settings .sale-banner,
     46.lightbox_page_lightpress-pro .sale-banner {
     47    background: #5cbc67;
     48    padding: 8px 16px;
     49    margin: 0 -32px 14px -20px;
     50}
     51
     52.toplevel_page_lightpress-settings .sale-banner p,
     53.lightbox_page_lightpress-pro .sale-banner p {
     54    margin: 0;
     55    color:  white;
     56    font-weight: bold;
     57    font-size: 16px;
     58}
     59
     60.toplevel_page_lightpress-settings .sale-banner a,
     61.lightbox_page_lightpress-pro .sale-banner a,
     62.toplevel_page_lightpress-settings .sale-banner a:hover,
     63.lightbox_page_lightpress-pro .sale-banner a:hover,
     64.toplevel_page_lightpress-settings .sale-banner a:focus,
     65.lightbox_page_lightpress-pro .sale-banner a:focus {
     66    color:  white;
    2667}
    2768
     
    4081    margin-top: 20px;
    4182    margin-left: 0;
     83}
     84
     85.toplevel_page_lightpress-settings .settings-section {
     86    max-width: 90%;
    4287}
    4388
     
    160205    border-color: #4fa959;
    161206    color: #fff;
     207}
     208
     209/* Modal on settings page */
     210
     211.toplevel_page_lightpress-settings.modal-open {
     212    display: flex;
     213    justify-content: center;
     214    align-items: center;
     215}
     216
     217.toplevel_page_lightpress-settings #TB_overlay {
     218    opacity: .8
     219}
     220
     221.toplevel_page_lightpress-settings #TB_window {
     222    top: auto;
     223    left: auto;
     224    margin-top: -80px !important;
     225    margin-left: 0 !important;
     226    width: 520px !important;
     227    height: 260px !important;
     228    max-width: 95%;
     229}
     230
     231.toplevel_page_lightpress-settings #TB_window {
     232    transition: all 1s;
     233}
     234
     235
     236.toplevel_page_lightpress-settings  #TB_title {
     237    border-bottom: none;
     238}
     239
     240.toplevel_page_lightpress-settings #TB_ajaxContent {
     241    height: 230px !important;
     242    width: 100% !important;
     243    justify-content: center;
     244    box-sizing: border-box;
     245    padding: 0px 40px 12px;
     246}
     247
     248.toplevel_page_lightpress-settings #TB_ajaxContent h2 {
     249    margin-bottom: 0;
     250    font-size: 24px;
     251}
     252
     253.toplevel_page_lightpress-settings #TB_ajaxContent h3 {
     254    margin-top: 10px;
     255}
     256
     257.toplevel_page_lightpress-settings #TB_ajaxContent p {
     258    font-size: 16px;
     259}
     260
     261.toplevel_page_lightpress-settings #TB_ajaxContent .hero-section-actions {
     262    margin: 24px 0 2px;
     263}
     264
     265.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button {
     266    padding: 10px 24px;
     267    text-transform: none;
     268    font-weight: normal;
     269}
     270
     271.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button.link-only,
     272.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button.link-only:hover,
     273.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button.link-only:focus,
     274.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button.link-only:visited {
     275    background: transparent;
     276    color: #4fa959;
     277}
     278
     279.toplevel_page_lightpress-settings .dashicons-arrow-right-alt {
     280    margin-left: 6px;
     281    margin-right: -4px;
    162282}
    163283
  • wp-jquery-lightbox/tags/2.3.1/admin/views/pro-landing-page.php

    r3105325 r3113906  
    1111
    1212?>
     13<div class="sale-banner">
     14    <p><?php esc_html_e( 'LightPress Pro is launched! Take 30% off this week - use code LIGHTPRESS at checkout.', 'wp-jquery-lightbox' ); ?></p>
     15</div>
    1316<img class="lightpress-logo" src="<?php echo esc_url( LIGHTPRESS_PLUGIN_URL . 'admin/lightpress-logo.png' ); ?>"/>
    1417<div class="hero-section">
     
    3134<div class="pricing-section">
    3235    <div class="sale-notice">
    33         <h1><?php esc_html_e( '40% Off Launch Sale!', 'wp-jquery-lightbox' ); ?></h1>
     36        <h1><?php esc_html_e( '30% Off Launch Sale!', 'wp-jquery-lightbox' ); ?></h1>
    3437        <p><?php esc_html_e( 'Celebrate the launch of LightPress Pro!', 'wp-jquery-lightbox' ); ?></p>
    35         <p><?php esc_html_e( 'Use code LIGHTPRESS at checkout for 40% off.', 'wp' ); ?></p>
     38        <p><?php esc_html_e( 'Use code LIGHTPRESS at checkout.', 'wp' ); ?></p>
    3639    </div>
    3740    <div class="pricing-table">
    3841        <div class="plan">
    3942            <h3 class="plan-title">Basic</h3>
    40             <div class="plan-cost"><span class="plan-price">$59</span></div>
     43            <div class="plan-cost"><span class="plan-price">$49</span></div>
    4144            <ul class="plan-features">
    42             <li class="strong"><?php esc_html_e( 'All Features', 'wp-jquery-lightbox' ); ?></li>
     45            <li class="strong"><?php esc_html_e( 'Limited Pro Lightbox', 'wp-jquery-lightbox' ); ?></li>
    4346            <li class="strong excluded"><?php esc_html_e( 'PRO SUPPORT', 'wp-jquery-lightbox' ); ?></li>
    4447            <li class="strong included"><?php esc_html_e( 'PLUGIN UPDATES', 'wp-jquery-lightbox' ); ?></li>
    45             <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX', 'wp-jquery-lightbox' ); ?></li>
     48            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: IMAGES', 'wp-jquery-lightbox' ); ?></li>
     49            <li class="included"><?php esc_html_e( 'Open Most Image Formats', 'wp-jquery-lightbox' ); ?></li>
    4650            <li class="included"><?php esc_html_e( 'All Customization Options', 'wp-jquery-lightbox' ); ?></li>
    4751            <li class="included"><?php esc_html_e( 'Thumbnails in Lightbox', 'wp-jquery-lightbox' ); ?></li>
     
    5054            <li class="included"><?php esc_html_e( 'Fullscreen', 'wp-jquery-lightbox' ); ?></li>
    5155            <li class="included"><?php esc_html_e( 'Image Zooming', 'wp-jquery-lightbox' ); ?></li>
    52             <li class="included"><?php esc_html_e( 'Open Video', 'wp-jquery-lightbox' ); ?></li>
    53             <li class="included"><?php esc_html_e( 'Open PDFs', 'wp-jquery-lightbox' ); ?></li>
    54             <li class="included"><?php esc_html_e( 'Create Modals/Popups', 'wp-jquery-lightbox' ); ?></li>
    55             <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    56             <li class="included"><?php esc_html_e( 'Open Iframes', 'wp-jquery-lightbox' ); ?></li>
    57             <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
    58             <li class="included"><?php esc_html_e( 'Performance Optimizations', 'wp-jquery-lightbox' ); ?></li>
    59             <li class="strong excluded"><?php esc_html_e( 'UNLIMITED', 'wp-jquery-lightbox' ); ?></li>
    60             <li class="excluded"><?php esc_html_e( 'Unlimited Sites', 'wp-jquery-lightbox' ); ?></li>
     56            <li class="strong excluded"><?php esc_html_e( 'PRO LIGHTBOX: EXTENDED', 'wp-jquery-lightbox' ); ?></li>
     57            <li class="excluded"><?php esc_html_e( 'Open Vides', 'wp-jquery-lightbox' ); ?></li>
     58            <li class="excluded"><?php esc_html_e( 'Open PDFs', 'wp-jquery-lightbox' ); ?></li>
     59            <li class="excluded"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
     60            <li class="excluded"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
     61            <li class="excluded"><?php esc_html_e( 'Create Modals/Popups', 'wp-jquery-lightbox' ); ?></li>
     62            <li class="included"><?php esc_html_e( 'MOBILE OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     63            <li class="included"><?php esc_html_e( 'SPEED OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     64            <li class="strong excluded"><?php esc_html_e( 'UNLIMITED SITES', 'wp-jquery-lightbox' ); ?></li>
    6165            </ul>
    6266            <div class="plan-select">
    6367            <div class="plan-select-dropdown">
    6468                <select id="basic-licenses">
    65                 <option value="1"><?php esc_html_e( '1 Site License', 'wp-jquery-lightbox' ); ?> ($49)'</option>
    66                 <option value="5" selected="selected"><?php esc_html_e( '5 Site License', 'wp-jquery-lightbox' ); ?> ($59)</option>
    67                 <option value="25"><?php esc_html_e( '25 Site License', 'wp-jquery-lightbox' ); ?> ($139)</option>
     69                <option value="1"><?php esc_html_e( '1 Site License', 'wp-jquery-lightbox' ); ?> ($39)'</option>
     70                <option value="5" selected="selected"><?php esc_html_e( '5 Site License', 'wp-jquery-lightbox' ); ?> ($49)</option>
     71                <option value="25"><?php esc_html_e( '25 Site License', 'wp-jquery-lightbox' ); ?> ($99)</option>
    6872                </select>
    6973            </div>
     
    7377        <div class="plan featured">
    7478            <h3 class="plan-title">Pro<span class="most-popular"><?php esc_html_e( 'Most Popular!', 'wp-jquery-lightbox' ); ?></span></h3>
    75             <div class="plan-cost"><span class="plan-price">$99</span></div>
     79            <div class="plan-cost"><span class="plan-price">$79</span></div>
    7680            <ul class="plan-features">
    77             <li class="strong"><?php esc_html_e( 'All Features + Support', 'wp-jquery-lightbox' ); ?></li>
     81            <li class="strong"><?php esc_html_e( 'Pro Lightbox + Support', 'wp-jquery-lightbox' ); ?></li>
    7882            <li class="strong included"><?php esc_html_e( 'PRO SUPPORT', 'wp-jquery-lightbox' ); ?></li>
    7983            <li class="strong included"><?php esc_html_e( 'PLUGIN UPDATES', 'wp-jquery-lightbox' ); ?></li>
    80             <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX', 'wp-jquery-lightbox' ); ?></li>
     84            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: IMAGES', 'wp-jquery-lightbox' ); ?></li>
     85            <li class="included"><?php esc_html_e( 'Open Most Image Formats', 'wp-jquery-lightbox' ); ?></li>
    8186            <li class="included"><?php esc_html_e( 'All Customization Options', 'wp-jquery-lightbox' ); ?></li>
    8287            <li class="included"><?php esc_html_e( 'Thumbnails in Lightbox', 'wp-jquery-lightbox' ); ?></li>
     
    8590            <li class="included"><?php esc_html_e( 'Fullscreen', 'wp-jquery-lightbox' ); ?></li>
    8691            <li class="included"><?php esc_html_e( 'Image Zooming', 'wp-jquery-lightbox' ); ?></li>
    87             <li class="included"><?php esc_html_e( 'Open Video', 'wp-jquery-lightbox' ); ?></li>
     92            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: EXTENDED', 'wp-jquery-lightbox' ); ?></li>
     93            <li class="included"><?php esc_html_e( 'Open Videos', 'wp-jquery-lightbox' ); ?></li>
    8894            <li class="included"><?php esc_html_e( 'Open PDFs', 'wp-jquery-lightbox' ); ?></li>
     95            <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
     96            <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    8997            <li class="included"><?php esc_html_e( 'Create Modals/Popups', 'wp-jquery-lightbox' ); ?></li>
    90             <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    91             <li class="included"><?php esc_html_e( 'Open Iframes', 'wp-jquery-lightbox' ); ?></li>
    92             <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
    93             <li class="included"><?php esc_html_e( 'Performance Optimizations', 'wp-jquery-lightbox' ); ?></li>
    94             <li class="strong excluded"><?php esc_html_e( 'UNLIMITED', 'wp-jquery-lightbox' ); ?></li>
    95             <li class="excluded"><?php esc_html_e( 'Unlimited Sites', 'wp-jquery-lightbox' ); ?></li>
     98            <li class="included"><?php esc_html_e( 'MOBILE OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     99            <li class="included"><?php esc_html_e( 'SPEED OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     100            <li class="strong excluded"><?php esc_html_e( 'UNLIMITED SITES', 'wp-jquery-lightbox' ); ?></li>
    96101            </ul>
    97102            <div class="plan-select">
    98103            <div class="plan-select-dropdown">
    99104                <select id="pro-licenses">
    100                 <option value="1"><?php esc_html_e( '1 Site License', 'wp-jquery-lightbox' ); ?> ($79)</option>
    101                 <option value="5" selected="selected"><?php esc_html_e( '5 Site License', 'wp-jquery-lightbox' ); ?> ($99)</option>
    102                 <option value="25"><?php esc_html_e( '25 Site License', 'wp-jquery-lightbox' ); ?> ($179)</option>
     105                <option value="1"><?php esc_html_e( '1 Site License', 'wp-jquery-lightbox' ); ?> ($69)</option>
     106                <option value="5" selected="selected"><?php esc_html_e( '5 Site License', 'wp-jquery-lightbox' ); ?> ($79)</option>
     107                <option value="25"><?php esc_html_e( '25 Site License', 'wp-jquery-lightbox' ); ?> ($139)</option>
    103108                </select>
    104109            </div>
     
    108113        <div class="plan">
    109114            <h3 class="plan-title">Enterprise</h3>
    110             <div class="plan-cost"><span class="plan-price">$499</span></div>
     115            <div class="plan-cost"><span class="plan-price">$399</span></div>
    111116            <ul class="plan-features">
    112             <li class="strong"><?php esc_html_e( 'Unlimited', 'wp-jquery-lightbox' ); ?></li>
     117            <li class="strong"><?php esc_html_e( 'Unlimited Sites', 'wp-jquery-lightbox' ); ?></li>
    113118            <li class="strong included"><?php esc_html_e( 'PRO SUPPORT', 'wp-jquery-lightbox' ); ?></li>
    114119            <li class="strong included"><?php esc_html_e( 'PLUGIN UPDATES', 'wp-jquery-lightbox' ); ?></li>
    115             <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX', 'wp-jquery-lightbox' ); ?></li>
     120            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: IMAGES', 'wp-jquery-lightbox' ); ?></li>
     121            <li class="included"><?php esc_html_e( 'Open Most Image Formats', 'wp-jquery-lightbox' ); ?></li>
    116122            <li class="included"><?php esc_html_e( 'All Customization Options', 'wp-jquery-lightbox' ); ?></li>
    117123            <li class="included"><?php esc_html_e( 'Thumbnails in Lightbox', 'wp-jquery-lightbox' ); ?></li>
     
    120126            <li class="included"><?php esc_html_e( 'Fullscreen', 'wp-jquery-lightbox' ); ?></li>
    121127            <li class="included"><?php esc_html_e( 'Image Zooming', 'wp-jquery-lightbox' ); ?></li>
    122             <li class="included"><?php esc_html_e( 'Open Video', 'wp-jquery-lightbox' ); ?></li>
     128            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: EXTENDED', 'wp-jquery-lightbox' ); ?></li>
     129            <li class="included"><?php esc_html_e( 'Open Videos', 'wp-jquery-lightbox' ); ?></li>
    123130            <li class="included"><?php esc_html_e( 'Open PDFs', 'wp-jquery-lightbox' ); ?></li>
     131            <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
     132            <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    124133            <li class="included"><?php esc_html_e( 'Create Modals/Popups', 'wp-jquery-lightbox' ); ?></li>
    125             <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    126             <li class="included"><?php esc_html_e( 'Open Iframes', 'wp-jquery-lightbox' ); ?></li>
    127             <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
    128             <li class="included"><?php esc_html_e( 'Performance Optimizations', 'wp-jquery-lightbox' ); ?></li>
    129             <li class="strong included"><?php esc_html_e( 'UNLIMITED', 'wp-jquery-lightbox' ); ?></li>
    130             <li class="included"><?php esc_html_e( 'Unlimited Sites', 'wp-jquery-lightbox' ); ?></li>
     134            <li class="included"><?php esc_html_e( 'MOBILE OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     135            <li class="included"><?php esc_html_e( 'SPEED OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     136            <li class="strong included"><?php esc_html_e( 'UNLIMITED SITES', 'wp-jquery-lightbox' ); ?></li>
    131137            </ul>
    132138            <div class="plan-select">
    133139            <div class="plan-select-dropdown">
    134140                <select id="enterprise-licenses">
    135                 <option value="unlimited"><?php esc_html_e( 'Unlimited Sites', 'easy-fancybox' ); ?> ($499)</option>
     141                <option value="unlimited"><?php esc_html_e( 'Unlimited Sites', 'easy-fancybox' ); ?> ($399)</option>
    136142                </select>
    137143            </div>
  • wp-jquery-lightbox/tags/2.3.1/class-lightpress.php

    r3105325 r3113906  
    5757     * @var bool
    5858     */
    59     public static $show_pro_screen = false;
     59    public static $show_pro_screen = true;
    6060
    6161    /**
     
    8585            add_action( 'admin_init', array( $this, 'add_plugin_settings' ) );
    8686            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
     87            add_action( 'enqueue_block_assets', array( $this, 'block_editor_scripts' ) );
    8788            add_action( 'admin_notices', array( $this, 'show_review_request' ) );
    8889            add_action( 'wp_ajax_lightpress-review-action', array( $this, 'process_lightpress_review_action' ) );
    8990        }
     91
     92        // Email opt in.
     93        add_action( 'wp_ajax_lightpress-optin-action', array( $this, 'process_lightpress_optin_action' ) );
    9094
    9195        // Include WP JQuery Lightbox.
     
    105109            'manage_options',
    106110            'lightpress-settings',
    107             array( __CLASS__, 'options_page' ),
     111            array( $this, 'options_page' ),
    108112            'dashicons-format-image',
    109113            85
     
    123127                'manage_options',
    124128                'lightpress-pro',
    125                 array( __CLASS__, 'pro_landing_page' )
     129                array( $this, 'pro_landing_page' )
    126130            );
    127131        }
     
    142146     * This method generates the HTML for the settings page.
    143147     */
    144     public static function options_page() {
     148    public function options_page() {
     149        $opted_in    = get_option( 'lightpress_opted_in' );
     150        $opt_in_link = $opted_in
     151            ? ''
     152            : '<a id="lightpress-open-modal" href="#TB_inline?width=600&height=550&inlineId=lightpress-optin-modal" class="thickbox">Get email updates</a>';
     153
     154        if ( ! class_exists( 'LightPress_Pro' ) && ! $this->should_show_review_request() ) {
     155            echo '<div class="sale-banner"><p>';
     156            esc_html_e( 'LightPress Pro is launched! Take 30% off this week - use code LIGHTPRESS at checkout.', 'wp-jquery-lightbox' );
     157            echo ' <a href="https://lightpress.io/pro-lightbox" target="_blank">' . esc_html__( 'LEARN MORE', 'wp-jquery-lightbox' ) . '</a>';
     158            echo '</p></div>';
     159        }
     160
    145161        settings_errors();
    146         echo '<img class="lightpress-logo" src="' . esc_url( LIGHTPRESS_PLUGIN_URL ) . 'admin/lightpress-logo.png">';
     162
     163        echo '
     164            <div class="lightpress-header">
     165                <img class="lightpress-logo" src="' . esc_url( LIGHTPRESS_PLUGIN_URL ) . 'admin/lightpress-logo.png">'
     166                . $opt_in_link // phpcs:ignore
     167            . '</div>';
    147168        echo '<form method="post" action="options.php">';
    148169        settings_fields( 'lightpress-settings-group' );
     
    150171        submit_button();
    151172        echo '</form>';
     173
     174        // Show email optin modal.
     175        if ( ! $opted_in ) {
     176            add_thickbox();
     177            ?>
     178                <div id="lightpress-optin-modal" style="display:none;">
     179                    <div class="lightpress-optin-modal-content">
     180                        <h2><?php esc_html_e( 'Welcome to LightPress!', 'wp-jquery-lightbox' ); ?></h2>
     181                        <h3><?php esc_html_e( 'Never miss an important update.', 'wp-jquery-lightbox' ); ?></h3>
     182                        <p><?php esc_html_e( 'Opt in to receive emails about security & feature updates.', 'wp-jquery-lightbox' ); ?></p>
     183                        <div class="hero-section-actions lightpress-optin-actions" data-nonce="<?php echo esc_attr( wp_create_nonce( 'lightpress_optin_action_nonce' ) ); ?>">
     184                            <a class="pro-action-button" href="#" data-optin-action="do-optin"><?php esc_html_e( 'Allow and continue', 'wp-jquery-lightbox' ); ?><span class="dashicons dashicons-arrow-right-alt"></span></a>
     185                            <a class="pro-action-button link-only" href="#" data-optin-action="skip-optin"><?php esc_html_e( 'Miss updates', 'wp-jquery-lightbox' ); ?></a>
     186                        </div>
     187                    </div>
     188                </div>
     189            <?php
     190        }
    152191    }
    153192
     
    180219     * This method generates the HTML for the pro upgrade page.
    181220     */
    182     public static function pro_landing_page() {
     221    public function pro_landing_page() {
    183222        include LIGHTPRESS_PLUGIN_DIR . 'admin/views/pro-landing-page.php';
    184223    }
     
    188227     */
    189228    public static function add_plugin_settings() {
    190         // Register general plugin settings.
    191         register_setting(
    192             'lightpress-settings-group',
    193             'lightpress_active_lightbox',
    194             array(
    195                 'default'           => 'wp-jquery-lightbox',
    196                 'sanitize_callback' => 'sanitize_text_field',
    197             )
    198         );
    199         add_option( 'lightpress_active_lightbox', 'wp-jquery-lightbox' );
    200 
    201229        // Add general plugin settings section.
    202230        add_settings_section(
     
    211239        );
    212240
    213         // Add general plugin settings fields.
     241        // Register Choose Lightbox setting.
     242        register_setting(
     243            'lightpress-settings-group',
     244            'lightpress_active_lightbox',
     245            array(
     246                'default'           => 'wp-jquery-lightbox',
     247                'sanitize_callback' => 'sanitize_text_field',
     248            )
     249        );
     250        add_option( 'lightpress_active_lightbox', 'wp-jquery-lightbox' );
    214251        add_settings_field(
    215252            'lightpress_active_lightbox',
     
    220257            array( 'label_for' => 'lightpress_active_lightbox' )
    221258        );
     259
     260        // Other general settings.
     261        $general_lightpress_options = array(
     262            'enableBlockControls' => array(
     263                'id'                => 'lightpress_enableBlockControls',
     264                'title'             => __( 'Enable Block Controls', 'easy-fancybox' ),
     265                'input'             => 'checkbox',
     266                'sanitize_callback' => 'wp_validate_boolean',
     267                'status'            => '',
     268                'default'           => '1',
     269                'description'       => __( 'Show Lightbox control panel in the block editor.', 'easy-fancybox' ),
     270            ),
     271            'fancybox_openBlockControls' => array(
     272                'id'                => 'lightpress_openBlockControls',
     273                'title'             => __( 'Open Block Controls', 'easy-fancybox' ),
     274                'input'             => 'checkbox',
     275                'sanitize_callback' => 'wp_validate_boolean',
     276                'status'            => '',
     277                'default'           => '1',
     278                'description'       => __( 'Open Lightbox control panel by default in the block editor.', 'easy-fancybox' ),
     279            ),
     280        );
     281        foreach ( $general_lightpress_options as $key => $setting ) {
     282            $id                = $setting['id'];
     283            $title             = $setting['title'] ?? '';
     284            $default           = isset( $setting['default'] ) ? $setting['default'] : '';
     285            $sanitize_callback = isset( $setting['sanitize_callback'] ) ? $setting['sanitize_callback'] : null;
     286            register_setting(
     287                'lightpress-settings-group',
     288                $id,
     289                array(
     290                    'sanitize_callback' => $sanitize_callback,
     291                    'show_in_rest'      => true,
     292                    'default'           => $default,
     293                )
     294            );
     295            add_option( $id, $default );
     296            add_settings_field(
     297                $id, // Setting ID.
     298                $title, // Setting label.
     299                'LightPress::render_settings_fields', // Setting callback.
     300                'lightpress-settings', // Page ID.
     301                'lightpress-general-settings-section', // Section ID.
     302                $setting
     303            );
     304        }
    222305    }
    223306
     
    390473            'wp-jquery-lightbox' => esc_html__( 'WP JQuery Lightbox', 'wp-jquery-lightbox' ),
    391474        );
     475        if ( self::$show_pro_screen ) {
     476            $pro_promo = array( 'lightpress-pro-promo' => esc_html__( 'LightPress Pro', 'wp-jquery-lightbox' ) );
     477            $free_lightboxes = array_merge( $free_lightboxes, $pro_promo );
     478        }
    392479        return apply_filters( 'lightpress_get_lightboxes', $free_lightboxes );
    393480    }
     
    406493        $notice_js              = LIGHTPRESS_PLUGIN_URL . 'admin/admin-notice.js';
    407494        $css_file               = LIGHTPRESS_PLUGIN_URL . 'admin/admin.css';
    408         $version                = defined( 'WP_DEBUG' ) ? time() : EASY_FANCYBOX_PRO_VERSION;
     495        $version                = defined( 'WP_DEBUG' ) ? time() : LIGHTPRESS_VERSION;
    409496
    410497        if ( $is_pro_landing ) {
     
    432519        wp_localize_script(
    433520            'lightpress-settings-js',
    434             'settings',
     521            'lightpress',
    435522            array(
    436523                'proLandingUrl' => admin_url( 'admin.php?page=lightpress-pro' ),
     524                'openModal' => $this->should_show_email_optin(),
     525            )
     526        );
     527    }
     528
     529    /**
     530     * Enqueue block JavaScript and CSS for the editor
     531     */
     532    public function block_editor_scripts() {
     533        $enable_block_controls = '1' === get_option( 'lightpress_enableBlockControls', '1' );
     534        $lightbox_panel_open   = '1' === get_option( 'lightpress_openBlockControls', '1' );
     535
     536        if ( ! $enable_block_controls ) {
     537            return;
     538        }
     539
     540        $block_js  = LIGHTPRESS_PLUGIN_URL . 'build/index.js';
     541        $block_css = LIGHTPRESS_PLUGIN_URL . 'build/index.css';
     542        $version   = defined( 'WP_DEBUG' ) ? time() : LIGHTPRESS_VERSION;
     543
     544        $lightboxes      = self::get_lightboxes();
     545        $script_version  = get_option( 'lightpress_active_lightbox', 'wp-jquery-lightbox' );
     546        $active_lightbox = isset( $lightboxes[ $script_version ] )
     547            ? $lightboxes[ $script_version ]
     548            : esc_html__( 'WP JQuery Lightbox', 'wp-jquery-lightbox' );
     549        $is_pro_user     = class_exists( 'LightPress_Pro' ) && LightPress_Pro::has_valid_license();
     550
     551        // Enqueue block editor CSS.
     552        wp_enqueue_style(
     553            'lightpress-block-css',
     554            $block_css,
     555            array(),
     556            $version
     557        );
     558
     559        // Enqueue block editor JS.
     560        wp_enqueue_script(
     561            'lightpress-block-js',
     562            $block_js,
     563            array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor', 'wp-hooks' ),
     564            $version,
     565            true
     566        );
     567        wp_localize_script(
     568            'lightpress-block-js',
     569            'lightpress',
     570            array(
     571                'activeLightbox'    => $active_lightbox,
     572                'settingsUrl'       => esc_url( admin_url( 'admin.php?page=lightpress-settings' ) ),
     573                'isProUser'         => $is_pro_user,
     574                'lightboxPanelOpen' => $lightbox_panel_open,
    437575            )
    438576        );
     
    511649                return false;
    512650            }
     651        }
     652
     653        // Do not show if user interacted with reviews within last 7 days.
     654        $lightpress_last_optin_interaction = get_option( 'lightpress_last_optin_interaction' );
     655        if ( $lightpress_last_optin_interaction ) {
     656            $last_optin_interaction_date       = new DateTimeImmutable( $lightpress_last_optin_interaction );
     657            $days_since_last_optin_interaction = $last_optin_interaction_date->diff( $current_date )->days;
     658            if ( $days_since_last_optin_interaction < 7 ) {
     659                return false;
     660            }
     661        }
     662
     663        // Do not show if currently showing optin.
     664        if ( $this->should_show_email_optin() ) {
     665            return false;
    513666        }
    514667
     
    615768        remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
    616769    }
     770
     771    /**
     772     * Determine if the email opt in should be shown.
     773     *
     774     * To summarize, this will only show:
     775     * if is options screen
     776     * if has not already opted in
     777     * if use has not interacted with optin within 90 days
     778     * if use has not interacted with reviews within 7 days
     779     * if user is selected for metered rollout and
     780     * if user has plugin more than 60 days and
     781     *
     782     * @since 1.0.0
     783     * @access public
     784     *
     785     * @return bool Returns true if the email optin should be shown.
     786     */
     787    public function should_show_email_optin() {
     788        // Only show on settings screen.
     789        $screen                = get_current_screen();
     790        $is_lightpress_options = self::$settings_screen_id === $screen->id;
     791        if ( ! $is_lightpress_options ) {
     792            return false;
     793        }
     794
     795        // Don't show if already opted in.
     796        $already_opted_in = get_option( 'lightpress_opted_in' ) && get_option( 'lightpress_opted_in' ) === '1';
     797        if ( $already_opted_in ) {
     798            return false;
     799        }
     800
     801        // Don't show if interacted with email optin in last 90 days.
     802        $current_date                      = new DateTimeImmutable( gmdate( 'Y-m-d' ) );
     803        $lightpress_last_optin_interaction = get_option( 'lightpress_last_optin_interaction' );
     804        if ( $lightpress_last_optin_interaction ) {
     805            $last_optin_interaction_date = new DateTimeImmutable( $lightpress_last_optin_interaction );
     806            $days_since_last_interaction = $last_optin_interaction_date->diff( $current_date )->days;
     807            if ( $days_since_last_interaction < 90 ) {
     808                return false;
     809            }
     810        }
     811
     812        // Do not show if user interacted with reviews within last 7 days.
     813        $lightpress_last_review_interaction = get_option( 'lightpress_last_review_interaction' );
     814        if ( $lightpress_last_review_interaction ) {
     815            $last_review_interaction_date = new DateTimeImmutable( $lightpress_last_review_interaction );
     816            $days_since_last_interaction  = $last_review_interaction_date->diff( $current_date )->days;
     817            if ( $days_since_last_interaction < 7 ) {
     818                return false;
     819            }
     820        }
     821
     822        // Limit optin request to 20% of users initially.
     823        $user_review_number = get_option( 'lightpress_user_review_number' );
     824        if ( ! $user_review_number ) {
     825            $user_review_number = rand( 1, 10 ); // phpcs:ignore
     826            update_option( 'lightpress_user_review_number', $user_review_number );
     827        }
     828        $selected = '9' === $user_review_number || '10' === $user_review_number;
     829        if ( ! $selected ) {
     830            return false;
     831        }
     832
     833        return true;
     834    }
     835
     836    /**
     837     * Process Ajax request when user interacts with optin requests
     838     */
     839    public function process_lightpress_optin_action() {
     840        check_admin_referer( 'lightpress_optin_action_nonce', '_n' );
     841        if ( ! current_user_can( 'manage_options' ) ) {
     842            return;
     843        }
     844
     845        $optin_action           = isset( $_POST['optin_action'] )
     846            ? sanitize_text_field( wp_unslash( $_POST['optin_action'] ) )
     847            : '';
     848        $current_date           = new DateTimeImmutable( gmdate( 'Y-m-d' ) );
     849        $current_date_as_string = $current_date->format( 'Y-m-d' );
     850
     851        update_option( 'lightpress_last_optin_interaction', $current_date_as_string );
     852
     853        if ( 'do-optin' === $optin_action ) {
     854            update_option( 'lightpress_opted_in', 'true' );
     855            $current_user = wp_get_current_user();
     856            $first        = esc_html( $current_user->user_firstname );
     857            $last         = esc_html( $current_user->user_lastname );
     858            $email        = esc_html( $current_user->user_email );
     859
     860            $url = add_query_arg(
     861                array(
     862                    'first' => $first,
     863                    'last'  => $last,
     864                    'email' => $email,
     865                ),
     866                'https://6ro1aqyxgj.execute-api.us-east-1.amazonaws.com/lpmc/'
     867            );
     868
     869            $response = wp_remote_post( $url, array( 'method' => 'GET' ) );
     870
     871            wp_send_json_success(
     872                array(
     873                    'response' => $response['body'],
     874                    'email' => $email,
     875                )
     876            );
     877        }
     878
     879        exit;
     880    }
    617881}
  • wp-jquery-lightbox/tags/2.3.1/readme.txt

    r3105325 r3113906  
    33Tags: lightbox, photo, image, gallery
    44Requires at least: 5.0
    5 Tested up to: 6.5.4
    6 Stable tag: 2.2.0
     5Tested up to: 6.5.5
     6Stable tag: 2.3.1
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    114114
    115115== Changelog ==
     116
     117= 2.3.1 (2024-07-08) =
     118* Fix JavaScript error
     119* Fix license checks
     120
     121= 2.3.0 (2024-07-08) =
     122* Add block editor lightbox panel
     123* Add lightbox panel display options
     124* Add email opt in modal
     125* Add landing page for LightPress Pro
    116126
    117127= 2.2.0 (2024-06-20) =
  • wp-jquery-lightbox/tags/2.3.1/wp-jquery-lightbox.php

    r3105325 r3113906  
    44 * Plugin URI: http://wordpress.org/extend/plugins/wp-jquery-lightbox/
    55 * Description: Simple and lightweight lightbox for galleries and images. Formerly WP Jquery Lightbox.
    6  * Version: 2.2.0
     6 * Version: 2.3.1
    77 * Text Domain: wp-jquery-lightbox
    88 * Author: LightPress
     
    2323 * Define constants.
    2424 */
    25 define( 'LIGHTPRESS_VERSION', '2.2.0' );
     25define( 'LIGHTPRESS_VERSION', '2.3.1' );
    2626define( 'LIGHTPRESS_PLUGIN_BASE', plugin_basename( __FILE__ ) );
    2727define( 'LIGHTPRESS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); // Includes ending slash.
  • wp-jquery-lightbox/trunk/admin/admin-settings.js

    r3105325 r3113906  
    9898            <a class="pro-action-button" href="https://lightpress.io/pro-lightbox" target="_blank">Learn More</a>
    9999            <a class="pro-action-button" href="https://lightpress.io/pro-lightbox" target="_blank">See Demos</a>
    100             <p style="font-style:italic;font-size:16px;'">See prices and buy directly from your WordPress dashboard <a href="${lightpress.proAdminUrl}">here</a>!</p>
     100            <p style="font-style:italic;font-size:16px;'">See prices and buy directly from your WordPress dashboard <a href="${lightpress.proLandingUrl}">here</a>!</p>
    101101        `;
    102102        document.querySelector( '.active-lightbox-heading' ).after( promoSection );
     
    106106(function($) {
    107107    $( document ).ready( function() {
    108         var container = $('.lightpress-review-notice');
    109         if ( container.length ) {
    110             container.find( '.lightpress-review-actions a' ).click(function() {
    111                 container.remove();
    112                 var rateAction = $( this ).attr( 'data-rate-action' );
    113                 $.post(
    114                     ajaxurl,
    115                     {
    116                         action: 'lightpress-review-action',
    117                         rate_action: rateAction,
    118                         _n: container.find( 'ul:first' ).attr( 'data-nonce' )
    119                     },
    120                     function( result ) {}
    121                 );
     108        window.onload = () => {
     109            if ( '1' === lightpress.openModal ) {
     110                const button = document.querySelector( '#lightpress-open-modal' );
     111                button.click();
     112            }
     113        };
    122114
    123                 if ( 'do-rate' !== rateAction ) {
    124                     return false;
     115        $( '.lightpress-optin-actions a' ).click( function() {
     116            const optinAction = $( this ).attr( 'data-optin-action' );
     117            const nonce = $( '.lightpress-optin-actions' ).attr( 'data-nonce' );
     118            const closeButton = $( '#TB_closeWindowButton' );
     119            $.post(
     120                ajaxurl,
     121                {
     122                    action: 'lightpress-optin-action',
     123                    optin_action: optinAction,
     124                    _n: nonce
     125                },
     126                function( result ) {
     127                    console.log( result );
    125128                }
    126             });
    127         }
     129            );
     130            closeButton.click();
     131        });
     132
    128133    });
    129134})( jQuery );
  • wp-jquery-lightbox/trunk/admin/admin.css

    r3105325 r3113906  
    11/* All admin pages */
    2 
    3 .toplevel_page_lightpress-settings #wpbody {
    4     max-width: 90%;
    5 }
    62
    73.toplevel_page_lightpress-settings #wpbody-content > .notice {
     
    2420    text-transform: none !important;
    2521    font-size: 13px !important;
     22}
     23
     24.toplevel_page_lightpress-settings .lightpress-header {
     25    display: flex;
     26    align-items: center;
     27    justify-content: space-between;
     28    max-width: 90%;
     29    margin-top: 30px;
     30}
     31
     32.toplevel_page_lightpress-settings .lightpress-header .lightpress-logo {
     33    margin-top: 0;
     34}
     35
     36.toplevel_page_lightpress-settings .lightpress-header a,
     37.toplevel_page_lightpress-settings .lightpress-header a:hover,
     38.toplevel_page_lightpress-settings .lightpress-header a:focus,
     39.toplevel_page_lightpress-settings .lightpress-header a:visited {
     40    font-size: 16px;
     41    text-decoration: none;
     42    color: #5cbc67;
     43}
     44
     45.toplevel_page_lightpress-settings .sale-banner,
     46.lightbox_page_lightpress-pro .sale-banner {
     47    background: #5cbc67;
     48    padding: 8px 16px;
     49    margin: 0 -32px 14px -20px;
     50}
     51
     52.toplevel_page_lightpress-settings .sale-banner p,
     53.lightbox_page_lightpress-pro .sale-banner p {
     54    margin: 0;
     55    color:  white;
     56    font-weight: bold;
     57    font-size: 16px;
     58}
     59
     60.toplevel_page_lightpress-settings .sale-banner a,
     61.lightbox_page_lightpress-pro .sale-banner a,
     62.toplevel_page_lightpress-settings .sale-banner a:hover,
     63.lightbox_page_lightpress-pro .sale-banner a:hover,
     64.toplevel_page_lightpress-settings .sale-banner a:focus,
     65.lightbox_page_lightpress-pro .sale-banner a:focus {
     66    color:  white;
    2667}
    2768
     
    4081    margin-top: 20px;
    4182    margin-left: 0;
     83}
     84
     85.toplevel_page_lightpress-settings .settings-section {
     86    max-width: 90%;
    4287}
    4388
     
    160205    border-color: #4fa959;
    161206    color: #fff;
     207}
     208
     209/* Modal on settings page */
     210
     211.toplevel_page_lightpress-settings.modal-open {
     212    display: flex;
     213    justify-content: center;
     214    align-items: center;
     215}
     216
     217.toplevel_page_lightpress-settings #TB_overlay {
     218    opacity: .8
     219}
     220
     221.toplevel_page_lightpress-settings #TB_window {
     222    top: auto;
     223    left: auto;
     224    margin-top: -80px !important;
     225    margin-left: 0 !important;
     226    width: 520px !important;
     227    height: 260px !important;
     228    max-width: 95%;
     229}
     230
     231.toplevel_page_lightpress-settings #TB_window {
     232    transition: all 1s;
     233}
     234
     235
     236.toplevel_page_lightpress-settings  #TB_title {
     237    border-bottom: none;
     238}
     239
     240.toplevel_page_lightpress-settings #TB_ajaxContent {
     241    height: 230px !important;
     242    width: 100% !important;
     243    justify-content: center;
     244    box-sizing: border-box;
     245    padding: 0px 40px 12px;
     246}
     247
     248.toplevel_page_lightpress-settings #TB_ajaxContent h2 {
     249    margin-bottom: 0;
     250    font-size: 24px;
     251}
     252
     253.toplevel_page_lightpress-settings #TB_ajaxContent h3 {
     254    margin-top: 10px;
     255}
     256
     257.toplevel_page_lightpress-settings #TB_ajaxContent p {
     258    font-size: 16px;
     259}
     260
     261.toplevel_page_lightpress-settings #TB_ajaxContent .hero-section-actions {
     262    margin: 24px 0 2px;
     263}
     264
     265.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button {
     266    padding: 10px 24px;
     267    text-transform: none;
     268    font-weight: normal;
     269}
     270
     271.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button.link-only,
     272.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button.link-only:hover,
     273.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button.link-only:focus,
     274.toplevel_page_lightpress-settings #TB_ajaxContent .pro-action-button.link-only:visited {
     275    background: transparent;
     276    color: #4fa959;
     277}
     278
     279.toplevel_page_lightpress-settings .dashicons-arrow-right-alt {
     280    margin-left: 6px;
     281    margin-right: -4px;
    162282}
    163283
  • wp-jquery-lightbox/trunk/admin/views/pro-landing-page.php

    r3105325 r3113906  
    1111
    1212?>
     13<div class="sale-banner">
     14    <p><?php esc_html_e( 'LightPress Pro is launched! Take 30% off this week - use code LIGHTPRESS at checkout.', 'wp-jquery-lightbox' ); ?></p>
     15</div>
    1316<img class="lightpress-logo" src="<?php echo esc_url( LIGHTPRESS_PLUGIN_URL . 'admin/lightpress-logo.png' ); ?>"/>
    1417<div class="hero-section">
     
    3134<div class="pricing-section">
    3235    <div class="sale-notice">
    33         <h1><?php esc_html_e( '40% Off Launch Sale!', 'wp-jquery-lightbox' ); ?></h1>
     36        <h1><?php esc_html_e( '30% Off Launch Sale!', 'wp-jquery-lightbox' ); ?></h1>
    3437        <p><?php esc_html_e( 'Celebrate the launch of LightPress Pro!', 'wp-jquery-lightbox' ); ?></p>
    35         <p><?php esc_html_e( 'Use code LIGHTPRESS at checkout for 40% off.', 'wp' ); ?></p>
     38        <p><?php esc_html_e( 'Use code LIGHTPRESS at checkout.', 'wp' ); ?></p>
    3639    </div>
    3740    <div class="pricing-table">
    3841        <div class="plan">
    3942            <h3 class="plan-title">Basic</h3>
    40             <div class="plan-cost"><span class="plan-price">$59</span></div>
     43            <div class="plan-cost"><span class="plan-price">$49</span></div>
    4144            <ul class="plan-features">
    42             <li class="strong"><?php esc_html_e( 'All Features', 'wp-jquery-lightbox' ); ?></li>
     45            <li class="strong"><?php esc_html_e( 'Limited Pro Lightbox', 'wp-jquery-lightbox' ); ?></li>
    4346            <li class="strong excluded"><?php esc_html_e( 'PRO SUPPORT', 'wp-jquery-lightbox' ); ?></li>
    4447            <li class="strong included"><?php esc_html_e( 'PLUGIN UPDATES', 'wp-jquery-lightbox' ); ?></li>
    45             <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX', 'wp-jquery-lightbox' ); ?></li>
     48            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: IMAGES', 'wp-jquery-lightbox' ); ?></li>
     49            <li class="included"><?php esc_html_e( 'Open Most Image Formats', 'wp-jquery-lightbox' ); ?></li>
    4650            <li class="included"><?php esc_html_e( 'All Customization Options', 'wp-jquery-lightbox' ); ?></li>
    4751            <li class="included"><?php esc_html_e( 'Thumbnails in Lightbox', 'wp-jquery-lightbox' ); ?></li>
     
    5054            <li class="included"><?php esc_html_e( 'Fullscreen', 'wp-jquery-lightbox' ); ?></li>
    5155            <li class="included"><?php esc_html_e( 'Image Zooming', 'wp-jquery-lightbox' ); ?></li>
    52             <li class="included"><?php esc_html_e( 'Open Video', 'wp-jquery-lightbox' ); ?></li>
    53             <li class="included"><?php esc_html_e( 'Open PDFs', 'wp-jquery-lightbox' ); ?></li>
    54             <li class="included"><?php esc_html_e( 'Create Modals/Popups', 'wp-jquery-lightbox' ); ?></li>
    55             <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    56             <li class="included"><?php esc_html_e( 'Open Iframes', 'wp-jquery-lightbox' ); ?></li>
    57             <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
    58             <li class="included"><?php esc_html_e( 'Performance Optimizations', 'wp-jquery-lightbox' ); ?></li>
    59             <li class="strong excluded"><?php esc_html_e( 'UNLIMITED', 'wp-jquery-lightbox' ); ?></li>
    60             <li class="excluded"><?php esc_html_e( 'Unlimited Sites', 'wp-jquery-lightbox' ); ?></li>
     56            <li class="strong excluded"><?php esc_html_e( 'PRO LIGHTBOX: EXTENDED', 'wp-jquery-lightbox' ); ?></li>
     57            <li class="excluded"><?php esc_html_e( 'Open Vides', 'wp-jquery-lightbox' ); ?></li>
     58            <li class="excluded"><?php esc_html_e( 'Open PDFs', 'wp-jquery-lightbox' ); ?></li>
     59            <li class="excluded"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
     60            <li class="excluded"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
     61            <li class="excluded"><?php esc_html_e( 'Create Modals/Popups', 'wp-jquery-lightbox' ); ?></li>
     62            <li class="included"><?php esc_html_e( 'MOBILE OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     63            <li class="included"><?php esc_html_e( 'SPEED OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     64            <li class="strong excluded"><?php esc_html_e( 'UNLIMITED SITES', 'wp-jquery-lightbox' ); ?></li>
    6165            </ul>
    6266            <div class="plan-select">
    6367            <div class="plan-select-dropdown">
    6468                <select id="basic-licenses">
    65                 <option value="1"><?php esc_html_e( '1 Site License', 'wp-jquery-lightbox' ); ?> ($49)'</option>
    66                 <option value="5" selected="selected"><?php esc_html_e( '5 Site License', 'wp-jquery-lightbox' ); ?> ($59)</option>
    67                 <option value="25"><?php esc_html_e( '25 Site License', 'wp-jquery-lightbox' ); ?> ($139)</option>
     69                <option value="1"><?php esc_html_e( '1 Site License', 'wp-jquery-lightbox' ); ?> ($39)'</option>
     70                <option value="5" selected="selected"><?php esc_html_e( '5 Site License', 'wp-jquery-lightbox' ); ?> ($49)</option>
     71                <option value="25"><?php esc_html_e( '25 Site License', 'wp-jquery-lightbox' ); ?> ($99)</option>
    6872                </select>
    6973            </div>
     
    7377        <div class="plan featured">
    7478            <h3 class="plan-title">Pro<span class="most-popular"><?php esc_html_e( 'Most Popular!', 'wp-jquery-lightbox' ); ?></span></h3>
    75             <div class="plan-cost"><span class="plan-price">$99</span></div>
     79            <div class="plan-cost"><span class="plan-price">$79</span></div>
    7680            <ul class="plan-features">
    77             <li class="strong"><?php esc_html_e( 'All Features + Support', 'wp-jquery-lightbox' ); ?></li>
     81            <li class="strong"><?php esc_html_e( 'Pro Lightbox + Support', 'wp-jquery-lightbox' ); ?></li>
    7882            <li class="strong included"><?php esc_html_e( 'PRO SUPPORT', 'wp-jquery-lightbox' ); ?></li>
    7983            <li class="strong included"><?php esc_html_e( 'PLUGIN UPDATES', 'wp-jquery-lightbox' ); ?></li>
    80             <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX', 'wp-jquery-lightbox' ); ?></li>
     84            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: IMAGES', 'wp-jquery-lightbox' ); ?></li>
     85            <li class="included"><?php esc_html_e( 'Open Most Image Formats', 'wp-jquery-lightbox' ); ?></li>
    8186            <li class="included"><?php esc_html_e( 'All Customization Options', 'wp-jquery-lightbox' ); ?></li>
    8287            <li class="included"><?php esc_html_e( 'Thumbnails in Lightbox', 'wp-jquery-lightbox' ); ?></li>
     
    8590            <li class="included"><?php esc_html_e( 'Fullscreen', 'wp-jquery-lightbox' ); ?></li>
    8691            <li class="included"><?php esc_html_e( 'Image Zooming', 'wp-jquery-lightbox' ); ?></li>
    87             <li class="included"><?php esc_html_e( 'Open Video', 'wp-jquery-lightbox' ); ?></li>
     92            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: EXTENDED', 'wp-jquery-lightbox' ); ?></li>
     93            <li class="included"><?php esc_html_e( 'Open Videos', 'wp-jquery-lightbox' ); ?></li>
    8894            <li class="included"><?php esc_html_e( 'Open PDFs', 'wp-jquery-lightbox' ); ?></li>
     95            <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
     96            <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    8997            <li class="included"><?php esc_html_e( 'Create Modals/Popups', 'wp-jquery-lightbox' ); ?></li>
    90             <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    91             <li class="included"><?php esc_html_e( 'Open Iframes', 'wp-jquery-lightbox' ); ?></li>
    92             <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
    93             <li class="included"><?php esc_html_e( 'Performance Optimizations', 'wp-jquery-lightbox' ); ?></li>
    94             <li class="strong excluded"><?php esc_html_e( 'UNLIMITED', 'wp-jquery-lightbox' ); ?></li>
    95             <li class="excluded"><?php esc_html_e( 'Unlimited Sites', 'wp-jquery-lightbox' ); ?></li>
     98            <li class="included"><?php esc_html_e( 'MOBILE OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     99            <li class="included"><?php esc_html_e( 'SPEED OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     100            <li class="strong excluded"><?php esc_html_e( 'UNLIMITED SITES', 'wp-jquery-lightbox' ); ?></li>
    96101            </ul>
    97102            <div class="plan-select">
    98103            <div class="plan-select-dropdown">
    99104                <select id="pro-licenses">
    100                 <option value="1"><?php esc_html_e( '1 Site License', 'wp-jquery-lightbox' ); ?> ($79)</option>
    101                 <option value="5" selected="selected"><?php esc_html_e( '5 Site License', 'wp-jquery-lightbox' ); ?> ($99)</option>
    102                 <option value="25"><?php esc_html_e( '25 Site License', 'wp-jquery-lightbox' ); ?> ($179)</option>
     105                <option value="1"><?php esc_html_e( '1 Site License', 'wp-jquery-lightbox' ); ?> ($69)</option>
     106                <option value="5" selected="selected"><?php esc_html_e( '5 Site License', 'wp-jquery-lightbox' ); ?> ($79)</option>
     107                <option value="25"><?php esc_html_e( '25 Site License', 'wp-jquery-lightbox' ); ?> ($139)</option>
    103108                </select>
    104109            </div>
     
    108113        <div class="plan">
    109114            <h3 class="plan-title">Enterprise</h3>
    110             <div class="plan-cost"><span class="plan-price">$499</span></div>
     115            <div class="plan-cost"><span class="plan-price">$399</span></div>
    111116            <ul class="plan-features">
    112             <li class="strong"><?php esc_html_e( 'Unlimited', 'wp-jquery-lightbox' ); ?></li>
     117            <li class="strong"><?php esc_html_e( 'Unlimited Sites', 'wp-jquery-lightbox' ); ?></li>
    113118            <li class="strong included"><?php esc_html_e( 'PRO SUPPORT', 'wp-jquery-lightbox' ); ?></li>
    114119            <li class="strong included"><?php esc_html_e( 'PLUGIN UPDATES', 'wp-jquery-lightbox' ); ?></li>
    115             <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX', 'wp-jquery-lightbox' ); ?></li>
     120            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: IMAGES', 'wp-jquery-lightbox' ); ?></li>
     121            <li class="included"><?php esc_html_e( 'Open Most Image Formats', 'wp-jquery-lightbox' ); ?></li>
    116122            <li class="included"><?php esc_html_e( 'All Customization Options', 'wp-jquery-lightbox' ); ?></li>
    117123            <li class="included"><?php esc_html_e( 'Thumbnails in Lightbox', 'wp-jquery-lightbox' ); ?></li>
     
    120126            <li class="included"><?php esc_html_e( 'Fullscreen', 'wp-jquery-lightbox' ); ?></li>
    121127            <li class="included"><?php esc_html_e( 'Image Zooming', 'wp-jquery-lightbox' ); ?></li>
    122             <li class="included"><?php esc_html_e( 'Open Video', 'wp-jquery-lightbox' ); ?></li>
     128            <li class="strong included"><?php esc_html_e( 'PRO LIGHTBOX: EXTENDED', 'wp-jquery-lightbox' ); ?></li>
     129            <li class="included"><?php esc_html_e( 'Open Videos', 'wp-jquery-lightbox' ); ?></li>
    123130            <li class="included"><?php esc_html_e( 'Open PDFs', 'wp-jquery-lightbox' ); ?></li>
     131            <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
     132            <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    124133            <li class="included"><?php esc_html_e( 'Create Modals/Popups', 'wp-jquery-lightbox' ); ?></li>
    125             <li class="included"><?php esc_html_e( 'Open Inline Content', 'wp-jquery-lightbox' ); ?></li>
    126             <li class="included"><?php esc_html_e( 'Open Iframes', 'wp-jquery-lightbox' ); ?></li>
    127             <li class="included"><?php esc_html_e( 'Open Maps', 'wp-jquery-lightbox' ); ?></li>
    128             <li class="included"><?php esc_html_e( 'Performance Optimizations', 'wp-jquery-lightbox' ); ?></li>
    129             <li class="strong included"><?php esc_html_e( 'UNLIMITED', 'wp-jquery-lightbox' ); ?></li>
    130             <li class="included"><?php esc_html_e( 'Unlimited Sites', 'wp-jquery-lightbox' ); ?></li>
     134            <li class="included"><?php esc_html_e( 'MOBILE OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     135            <li class="included"><?php esc_html_e( 'SPEED OPTIMIZATION', 'wp-jquery-lightbox' ); ?></li>
     136            <li class="strong included"><?php esc_html_e( 'UNLIMITED SITES', 'wp-jquery-lightbox' ); ?></li>
    131137            </ul>
    132138            <div class="plan-select">
    133139            <div class="plan-select-dropdown">
    134140                <select id="enterprise-licenses">
    135                 <option value="unlimited"><?php esc_html_e( 'Unlimited Sites', 'easy-fancybox' ); ?> ($499)</option>
     141                <option value="unlimited"><?php esc_html_e( 'Unlimited Sites', 'easy-fancybox' ); ?> ($399)</option>
    136142                </select>
    137143            </div>
  • wp-jquery-lightbox/trunk/class-lightpress.php

    r3105325 r3113906  
    5757     * @var bool
    5858     */
    59     public static $show_pro_screen = false;
     59    public static $show_pro_screen = true;
    6060
    6161    /**
     
    8585            add_action( 'admin_init', array( $this, 'add_plugin_settings' ) );
    8686            add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
     87            add_action( 'enqueue_block_assets', array( $this, 'block_editor_scripts' ) );
    8788            add_action( 'admin_notices', array( $this, 'show_review_request' ) );
    8889            add_action( 'wp_ajax_lightpress-review-action', array( $this, 'process_lightpress_review_action' ) );
    8990        }
     91
     92        // Email opt in.
     93        add_action( 'wp_ajax_lightpress-optin-action', array( $this, 'process_lightpress_optin_action' ) );
    9094
    9195        // Include WP JQuery Lightbox.
     
    105109            'manage_options',
    106110            'lightpress-settings',
    107             array( __CLASS__, 'options_page' ),
     111            array( $this, 'options_page' ),
    108112            'dashicons-format-image',
    109113            85
     
    123127                'manage_options',
    124128                'lightpress-pro',
    125                 array( __CLASS__, 'pro_landing_page' )
     129                array( $this, 'pro_landing_page' )
    126130            );
    127131        }
     
    142146     * This method generates the HTML for the settings page.
    143147     */
    144     public static function options_page() {
     148    public function options_page() {
     149        $opted_in    = get_option( 'lightpress_opted_in' );
     150        $opt_in_link = $opted_in
     151            ? ''
     152            : '<a id="lightpress-open-modal" href="#TB_inline?width=600&height=550&inlineId=lightpress-optin-modal" class="thickbox">Get email updates</a>';
     153
     154        if ( ! class_exists( 'LightPress_Pro' ) && ! $this->should_show_review_request() ) {
     155            echo '<div class="sale-banner"><p>';
     156            esc_html_e( 'LightPress Pro is launched! Take 30% off this week - use code LIGHTPRESS at checkout.', 'wp-jquery-lightbox' );
     157            echo ' <a href="https://lightpress.io/pro-lightbox" target="_blank">' . esc_html__( 'LEARN MORE', 'wp-jquery-lightbox' ) . '</a>';
     158            echo '</p></div>';
     159        }
     160
    145161        settings_errors();
    146         echo '<img class="lightpress-logo" src="' . esc_url( LIGHTPRESS_PLUGIN_URL ) . 'admin/lightpress-logo.png">';
     162
     163        echo '
     164            <div class="lightpress-header">
     165                <img class="lightpress-logo" src="' . esc_url( LIGHTPRESS_PLUGIN_URL ) . 'admin/lightpress-logo.png">'
     166                . $opt_in_link // phpcs:ignore
     167            . '</div>';
    147168        echo '<form method="post" action="options.php">';
    148169        settings_fields( 'lightpress-settings-group' );
     
    150171        submit_button();
    151172        echo '</form>';
     173
     174        // Show email optin modal.
     175        if ( ! $opted_in ) {
     176            add_thickbox();
     177            ?>
     178                <div id="lightpress-optin-modal" style="display:none;">
     179                    <div class="lightpress-optin-modal-content">
     180                        <h2><?php esc_html_e( 'Welcome to LightPress!', 'wp-jquery-lightbox' ); ?></h2>
     181                        <h3><?php esc_html_e( 'Never miss an important update.', 'wp-jquery-lightbox' ); ?></h3>
     182                        <p><?php esc_html_e( 'Opt in to receive emails about security & feature updates.', 'wp-jquery-lightbox' ); ?></p>
     183                        <div class="hero-section-actions lightpress-optin-actions" data-nonce="<?php echo esc_attr( wp_create_nonce( 'lightpress_optin_action_nonce' ) ); ?>">
     184                            <a class="pro-action-button" href="#" data-optin-action="do-optin"><?php esc_html_e( 'Allow and continue', 'wp-jquery-lightbox' ); ?><span class="dashicons dashicons-arrow-right-alt"></span></a>
     185                            <a class="pro-action-button link-only" href="#" data-optin-action="skip-optin"><?php esc_html_e( 'Miss updates', 'wp-jquery-lightbox' ); ?></a>
     186                        </div>
     187                    </div>
     188                </div>
     189            <?php
     190        }
    152191    }
    153192
     
    180219     * This method generates the HTML for the pro upgrade page.
    181220     */
    182     public static function pro_landing_page() {
     221    public function pro_landing_page() {
    183222        include LIGHTPRESS_PLUGIN_DIR . 'admin/views/pro-landing-page.php';
    184223    }
     
    188227     */
    189228    public static function add_plugin_settings() {
    190         // Register general plugin settings.
    191         register_setting(
    192             'lightpress-settings-group',
    193             'lightpress_active_lightbox',
    194             array(
    195                 'default'           => 'wp-jquery-lightbox',
    196                 'sanitize_callback' => 'sanitize_text_field',
    197             )
    198         );
    199         add_option( 'lightpress_active_lightbox', 'wp-jquery-lightbox' );
    200 
    201229        // Add general plugin settings section.
    202230        add_settings_section(
     
    211239        );
    212240
    213         // Add general plugin settings fields.
     241        // Register Choose Lightbox setting.
     242        register_setting(
     243            'lightpress-settings-group',
     244            'lightpress_active_lightbox',
     245            array(
     246                'default'           => 'wp-jquery-lightbox',
     247                'sanitize_callback' => 'sanitize_text_field',
     248            )
     249        );
     250        add_option( 'lightpress_active_lightbox', 'wp-jquery-lightbox' );
    214251        add_settings_field(
    215252            'lightpress_active_lightbox',
     
    220257            array( 'label_for' => 'lightpress_active_lightbox' )
    221258        );
     259
     260        // Other general settings.
     261        $general_lightpress_options = array(
     262            'enableBlockControls' => array(
     263                'id'                => 'lightpress_enableBlockControls',
     264                'title'             => __( 'Enable Block Controls', 'easy-fancybox' ),
     265                'input'             => 'checkbox',
     266                'sanitize_callback' => 'wp_validate_boolean',
     267                'status'            => '',
     268                'default'           => '1',
     269                'description'       => __( 'Show Lightbox control panel in the block editor.', 'easy-fancybox' ),
     270            ),
     271            'fancybox_openBlockControls' => array(
     272                'id'                => 'lightpress_openBlockControls',
     273                'title'             => __( 'Open Block Controls', 'easy-fancybox' ),
     274                'input'             => 'checkbox',
     275                'sanitize_callback' => 'wp_validate_boolean',
     276                'status'            => '',
     277                'default'           => '1',
     278                'description'       => __( 'Open Lightbox control panel by default in the block editor.', 'easy-fancybox' ),
     279            ),
     280        );
     281        foreach ( $general_lightpress_options as $key => $setting ) {
     282            $id                = $setting['id'];
     283            $title             = $setting['title'] ?? '';
     284            $default           = isset( $setting['default'] ) ? $setting['default'] : '';
     285            $sanitize_callback = isset( $setting['sanitize_callback'] ) ? $setting['sanitize_callback'] : null;
     286            register_setting(
     287                'lightpress-settings-group',
     288                $id,
     289                array(
     290                    'sanitize_callback' => $sanitize_callback,
     291                    'show_in_rest'      => true,
     292                    'default'           => $default,
     293                )
     294            );
     295            add_option( $id, $default );
     296            add_settings_field(
     297                $id, // Setting ID.
     298                $title, // Setting label.
     299                'LightPress::render_settings_fields', // Setting callback.
     300                'lightpress-settings', // Page ID.
     301                'lightpress-general-settings-section', // Section ID.
     302                $setting
     303            );
     304        }
    222305    }
    223306
     
    390473            'wp-jquery-lightbox' => esc_html__( 'WP JQuery Lightbox', 'wp-jquery-lightbox' ),
    391474        );
     475        if ( self::$show_pro_screen ) {
     476            $pro_promo = array( 'lightpress-pro-promo' => esc_html__( 'LightPress Pro', 'wp-jquery-lightbox' ) );
     477            $free_lightboxes = array_merge( $free_lightboxes, $pro_promo );
     478        }
    392479        return apply_filters( 'lightpress_get_lightboxes', $free_lightboxes );
    393480    }
     
    406493        $notice_js              = LIGHTPRESS_PLUGIN_URL . 'admin/admin-notice.js';
    407494        $css_file               = LIGHTPRESS_PLUGIN_URL . 'admin/admin.css';
    408         $version                = defined( 'WP_DEBUG' ) ? time() : EASY_FANCYBOX_PRO_VERSION;
     495        $version                = defined( 'WP_DEBUG' ) ? time() : LIGHTPRESS_VERSION;
    409496
    410497        if ( $is_pro_landing ) {
     
    432519        wp_localize_script(
    433520            'lightpress-settings-js',
    434             'settings',
     521            'lightpress',
    435522            array(
    436523                'proLandingUrl' => admin_url( 'admin.php?page=lightpress-pro' ),
     524                'openModal' => $this->should_show_email_optin(),
     525            )
     526        );
     527    }
     528
     529    /**
     530     * Enqueue block JavaScript and CSS for the editor
     531     */
     532    public function block_editor_scripts() {
     533        $enable_block_controls = '1' === get_option( 'lightpress_enableBlockControls', '1' );
     534        $lightbox_panel_open   = '1' === get_option( 'lightpress_openBlockControls', '1' );
     535
     536        if ( ! $enable_block_controls ) {
     537            return;
     538        }
     539
     540        $block_js  = LIGHTPRESS_PLUGIN_URL . 'build/index.js';
     541        $block_css = LIGHTPRESS_PLUGIN_URL . 'build/index.css';
     542        $version   = defined( 'WP_DEBUG' ) ? time() : LIGHTPRESS_VERSION;
     543
     544        $lightboxes      = self::get_lightboxes();
     545        $script_version  = get_option( 'lightpress_active_lightbox', 'wp-jquery-lightbox' );
     546        $active_lightbox = isset( $lightboxes[ $script_version ] )
     547            ? $lightboxes[ $script_version ]
     548            : esc_html__( 'WP JQuery Lightbox', 'wp-jquery-lightbox' );
     549        $is_pro_user     = class_exists( 'LightPress_Pro' ) && LightPress_Pro::has_valid_license();
     550
     551        // Enqueue block editor CSS.
     552        wp_enqueue_style(
     553            'lightpress-block-css',
     554            $block_css,
     555            array(),
     556            $version
     557        );
     558
     559        // Enqueue block editor JS.
     560        wp_enqueue_script(
     561            'lightpress-block-js',
     562            $block_js,
     563            array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-components', 'wp-editor', 'wp-hooks' ),
     564            $version,
     565            true
     566        );
     567        wp_localize_script(
     568            'lightpress-block-js',
     569            'lightpress',
     570            array(
     571                'activeLightbox'    => $active_lightbox,
     572                'settingsUrl'       => esc_url( admin_url( 'admin.php?page=lightpress-settings' ) ),
     573                'isProUser'         => $is_pro_user,
     574                'lightboxPanelOpen' => $lightbox_panel_open,
    437575            )
    438576        );
     
    511649                return false;
    512650            }
     651        }
     652
     653        // Do not show if user interacted with reviews within last 7 days.
     654        $lightpress_last_optin_interaction = get_option( 'lightpress_last_optin_interaction' );
     655        if ( $lightpress_last_optin_interaction ) {
     656            $last_optin_interaction_date       = new DateTimeImmutable( $lightpress_last_optin_interaction );
     657            $days_since_last_optin_interaction = $last_optin_interaction_date->diff( $current_date )->days;
     658            if ( $days_since_last_optin_interaction < 7 ) {
     659                return false;
     660            }
     661        }
     662
     663        // Do not show if currently showing optin.
     664        if ( $this->should_show_email_optin() ) {
     665            return false;
    513666        }
    514667
     
    615768        remove_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
    616769    }
     770
     771    /**
     772     * Determine if the email opt in should be shown.
     773     *
     774     * To summarize, this will only show:
     775     * if is options screen
     776     * if has not already opted in
     777     * if use has not interacted with optin within 90 days
     778     * if use has not interacted with reviews within 7 days
     779     * if user is selected for metered rollout and
     780     * if user has plugin more than 60 days and
     781     *
     782     * @since 1.0.0
     783     * @access public
     784     *
     785     * @return bool Returns true if the email optin should be shown.
     786     */
     787    public function should_show_email_optin() {
     788        // Only show on settings screen.
     789        $screen                = get_current_screen();
     790        $is_lightpress_options = self::$settings_screen_id === $screen->id;
     791        if ( ! $is_lightpress_options ) {
     792            return false;
     793        }
     794
     795        // Don't show if already opted in.
     796        $already_opted_in = get_option( 'lightpress_opted_in' ) && get_option( 'lightpress_opted_in' ) === '1';
     797        if ( $already_opted_in ) {
     798            return false;
     799        }
     800
     801        // Don't show if interacted with email optin in last 90 days.
     802        $current_date                      = new DateTimeImmutable( gmdate( 'Y-m-d' ) );
     803        $lightpress_last_optin_interaction = get_option( 'lightpress_last_optin_interaction' );
     804        if ( $lightpress_last_optin_interaction ) {
     805            $last_optin_interaction_date = new DateTimeImmutable( $lightpress_last_optin_interaction );
     806            $days_since_last_interaction = $last_optin_interaction_date->diff( $current_date )->days;
     807            if ( $days_since_last_interaction < 90 ) {
     808                return false;
     809            }
     810        }
     811
     812        // Do not show if user interacted with reviews within last 7 days.
     813        $lightpress_last_review_interaction = get_option( 'lightpress_last_review_interaction' );
     814        if ( $lightpress_last_review_interaction ) {
     815            $last_review_interaction_date = new DateTimeImmutable( $lightpress_last_review_interaction );
     816            $days_since_last_interaction  = $last_review_interaction_date->diff( $current_date )->days;
     817            if ( $days_since_last_interaction < 7 ) {
     818                return false;
     819            }
     820        }
     821
     822        // Limit optin request to 20% of users initially.
     823        $user_review_number = get_option( 'lightpress_user_review_number' );
     824        if ( ! $user_review_number ) {
     825            $user_review_number = rand( 1, 10 ); // phpcs:ignore
     826            update_option( 'lightpress_user_review_number', $user_review_number );
     827        }
     828        $selected = '9' === $user_review_number || '10' === $user_review_number;
     829        if ( ! $selected ) {
     830            return false;
     831        }
     832
     833        return true;
     834    }
     835
     836    /**
     837     * Process Ajax request when user interacts with optin requests
     838     */
     839    public function process_lightpress_optin_action() {
     840        check_admin_referer( 'lightpress_optin_action_nonce', '_n' );
     841        if ( ! current_user_can( 'manage_options' ) ) {
     842            return;
     843        }
     844
     845        $optin_action           = isset( $_POST['optin_action'] )
     846            ? sanitize_text_field( wp_unslash( $_POST['optin_action'] ) )
     847            : '';
     848        $current_date           = new DateTimeImmutable( gmdate( 'Y-m-d' ) );
     849        $current_date_as_string = $current_date->format( 'Y-m-d' );
     850
     851        update_option( 'lightpress_last_optin_interaction', $current_date_as_string );
     852
     853        if ( 'do-optin' === $optin_action ) {
     854            update_option( 'lightpress_opted_in', 'true' );
     855            $current_user = wp_get_current_user();
     856            $first        = esc_html( $current_user->user_firstname );
     857            $last         = esc_html( $current_user->user_lastname );
     858            $email        = esc_html( $current_user->user_email );
     859
     860            $url = add_query_arg(
     861                array(
     862                    'first' => $first,
     863                    'last'  => $last,
     864                    'email' => $email,
     865                ),
     866                'https://6ro1aqyxgj.execute-api.us-east-1.amazonaws.com/lpmc/'
     867            );
     868
     869            $response = wp_remote_post( $url, array( 'method' => 'GET' ) );
     870
     871            wp_send_json_success(
     872                array(
     873                    'response' => $response['body'],
     874                    'email' => $email,
     875                )
     876            );
     877        }
     878
     879        exit;
     880    }
    617881}
  • wp-jquery-lightbox/trunk/readme.txt

    r3105325 r3113906  
    33Tags: lightbox, photo, image, gallery
    44Requires at least: 5.0
    5 Tested up to: 6.5.4
    6 Stable tag: 2.2.0
     5Tested up to: 6.5.5
     6Stable tag: 2.3.1
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    114114
    115115== Changelog ==
     116
     117= 2.3.1 (2024-07-08) =
     118* Fix JavaScript error
     119* Fix license checks
     120
     121= 2.3.0 (2024-07-08) =
     122* Add block editor lightbox panel
     123* Add lightbox panel display options
     124* Add email opt in modal
     125* Add landing page for LightPress Pro
    116126
    117127= 2.2.0 (2024-06-20) =
  • wp-jquery-lightbox/trunk/wp-jquery-lightbox.php

    r3105325 r3113906  
    44 * Plugin URI: http://wordpress.org/extend/plugins/wp-jquery-lightbox/
    55 * Description: Simple and lightweight lightbox for galleries and images. Formerly WP Jquery Lightbox.
    6  * Version: 2.2.0
     6 * Version: 2.3.1
    77 * Text Domain: wp-jquery-lightbox
    88 * Author: LightPress
     
    2323 * Define constants.
    2424 */
    25 define( 'LIGHTPRESS_VERSION', '2.2.0' );
     25define( 'LIGHTPRESS_VERSION', '2.3.1' );
    2626define( 'LIGHTPRESS_PLUGIN_BASE', plugin_basename( __FILE__ ) );
    2727define( 'LIGHTPRESS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); // Includes ending slash.
Note: See TracChangeset for help on using the changeset viewer.