Plugin Directory

Changeset 1745483


Ignore:
Timestamp:
10/12/2017 01:40:49 PM (8 years ago)
Author:
ScientiaMobile
Message:

added funtionality to require valid token for the plugin to be enabled

Location:
wp-imageengine/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-imageengine/trunk/functions.php

    r1714049 r1745483  
    243243}
    244244if($wpie_options['enabled']) {
    245     add_filter('the_content', 'wpie_imgs_find_and_replace'); // Add filter to post and page contents
    246     add_filter('widget_text', 'wpie_imgs_find_and_replace'); // Add filter to widgets text
    247     add_filter('post_thumbnail_html', 'wpie_imgs_find_and_replace'); // Add filter to wp thumbanils functions
     245    $data = wpie_get_real_settings( $user_setting );
     246    if(!empty($data['key'])){
     247        add_filter('the_content', 'wpie_imgs_find_and_replace'); // Add filter to post and page contents
     248        add_filter('widget_text', 'wpie_imgs_find_and_replace'); // Add filter to widgets text
     249        add_filter('post_thumbnail_html', 'wpie_imgs_find_and_replace'); // Add filter to wp thumbanils functions
     250    }
    248251}
    249252/**
     
    280283 */
    281284if(function_exists('wp_calculate_image_srcset') && $wpie_options['enabled']) {
    282     add_filter('wp_calculate_image_srcset', 'wpie_srcset_filter', 21, 5);
    283 }
     285    $data = wpie_get_real_settings( $user_setting );
     286    if(!empty($data['key'])){
     287        add_filter('wp_calculate_image_srcset', 'wpie_srcset_filter', 21, 5);
     288    }
     289}
  • wp-imageengine/trunk/index.php

    r1714049 r1745483  
    1414}
    1515
    16 define( 'IMGENG_VERSION', '1.4.2');
     16define( 'IMGENG_VERSION', '1.4.3');
    1717define( 'IMGENG_PATH', plugin_dir_path( __FILE__ ) );
    1818define( 'IMGENG_URL', plugin_dir_url( __FILE__ ) );
  • wp-imageengine/trunk/options.php

    r1714049 r1745483  
    2727            'fit'       => $_POST['wpie_fit']
    2828        );
     29        if(empty($_POST['wpie_key'])){
     30            $data['enabled']=0;
     31        }
     32       
    2933        $save_res = update_option('wpie_options',$data);
    3034        if($save_res){
     
    3337            echo '<div class="error notice"><p>'.__('Nothing changed!','imageengine').'</p></div>';
    3438        }
     39
    3540    }
    3641    $data = get_option('wpie_options');
     
    9196                        <?php _e('Then, copy your token into the text field below.','imageengine'); ?>
    9297                    </p>
    93                     <p><?php _e('NOTE: If you activate the plugin without a token ,or an invalid token, your images may be watermarked.','imageengine'); ?></p>
    9498             <div class="input-group has-error">
    9599                <?php endif; ?>
     
    153157                    <?php endif; ?>
    154158                    <li><a target="_blank" href="https://www.scientiamobile.com/myaccount?utm_source=wp-imageengine-admin&amp;utm_medium=Wordress&amp;utm_term=wp-imageengine&amp;utm_campaign=wp-imageengine"><?php _e('Your account','imageengine'); ?></a></li>
    155                     <li><a target="_blank" href="http://www.scientiamobile.com/page/WP-ImageEngine?utm_source=wp-imageengine-admin&amp;utm_medium=Wordress&amp;utm_term=wp-imageengine&amp;utm_campaign=wp-imageengine"><?php _e('Plugin Homepage','imageengine'); ?></a></li>
     159                    <li><a target="_blank" href="https://www.scientiamobile.com/page/WP-ImageEngine?utm_source=wp-imageengine-admin&amp;utm_medium=Wordress&amp;utm_term=wp-imageengine&amp;utm_campaign=wp-imageengine"><?php _e('Plugin Homepage','imageengine'); ?></a></li>
    156160                    <li><a target="_blank" href="https://www.scientiamobile.com/forum/viewforum.php?f=21&amp;utm_source=wp-imageengine-admin&amp;utm_medium=Wordress&amp;utm_term=wp-imageengine&amp;utm_campaign=wp-imageengine"><?php _e('Support Forum','imageengine'); ?></a></li>
    157161            </div>
     
    169173    if(empty($data['key'])){
    170174        ?>
    171         <div class="notice error my_wpie_admin_notice is-dismissible" >
    172             <p><?php _e( '<a href="options-general.php?page=wpie-options-page">ImageEngine Alert</a>: Application Token missing. You need to <a href="'.IMGENG_LITE_REGISTRATION_URL.'" target="_blank">register to get an application token</a>. Then, copy the token and paste it into the "Your token" input field below before you save.', 'imageengine' ); ?></p>
     175        <div class="notice error my_wpie_admin_notice" >
     176            <p><?php _e( '<a href="options-general.php?page=wpie-options-page">ImageEngine Alert</a>: <b>Application Token missing.</b> You need to <a href="'.IMGENG_LITE_REGISTRATION_URL.'" target="_blank">register to get an application token</a>. Then, copy the token and paste it into the "Your Token" input field below before you save. Until the token is present, the plugin will not optimize your images.', 'imageengine' ); ?></p>
    173177        </div>
    174178    <?php
    175179    }
    176180}
    177 
    178181add_action( 'admin_notices', 'my_wpie_admin_notice' );
     182
     183
     184function my_wpie_admin_notice_inactive() {
     185    $data = get_option('wpie_options');
     186    if(!$data['enabled']){
     187        ?>
     188        <div class="notice notice-warning my_wpie_admin_notice_inactive" >
     189            <p><?php _e( '<a href="options-general.php?page=wpie-options-page">ImageEngine Alert</a>: <b>Local development mode is enabled.</b> Images are currently not optimized. Please remember to disable "Local Development Mode", when the site is publicly available.', 'imageengine' ); ?></p>
     190        </div>
     191    <?php
     192    }
     193}
     194add_action( 'admin_notices', 'my_wpie_admin_notice_inactive' );
     195
    179196
    180197/**
  • wp-imageengine/trunk/readme.txt

    r1714049 r1745483  
    44Requires at least: 4.0.8
    55Tested up to: 4.8
    6 Stable tag: 1.4.2
     6Stable tag: 1.4.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1919The plugin will automatically optimize the images you include in your posts and pages. For images baked into your theme, there is a php API available (See FAQ).
    2020
    21 [Registration](https://scientiamobile.com/imageengine/signup?utm_source=wordpress.org&utm_medium=page&utm_term=wp-imageengine&utm_campaign=wp-imageengine#imageengine-lite) is required to get the most out of ImageEngine.
     21[Registration](https://scientiamobile.com/imageengine/signup?utm_source=wordpress.org&utm_medium=page&utm_term=wp-imageengine&utm_campaign=wp-imageengine#imageengine-lite) is required to get your unique application token. Without this token, the plugin will not be activated.
     22
    2223
    2324= Responsive Images Support =
     
    7677= Is the plugin compatible with other plugins? =
    7778
    78 If you have other plugins altering the URLs of images or plugins for other CDNs you might want to do a test before launching. We constantly monitor this, but if you stumble upon a case of incompability, please submit a ticket.
     79If you have other plugins altering the URLs of images or plugins for other CDNs you might want to do a test before launching. We constantly monitor this, but if you stumble upon a case of incompability, please submit a ticket. Note that if you use plugins that caches the markup or plugins enabling CDNs, you might need to purge the cache or disable the plugins fully if you want to turn on or off ImageEngine.
    7980
    8081= Can I use it in my theme or plugin ? =
     
    117118
    118119== Changelog ==
     120
     121= 1.4.3 =
     122- If no token is present, the plugin is now disabled (local dev mode)
     123- doc tweaks
    119124
    120125= 1.4.2 =
Note: See TracChangeset for help on using the changeset viewer.