Plugin Directory

Changeset 2968504


Ignore:
Timestamp:
09/19/2023 01:58:45 AM (3 years ago)
Author:
thanhtd
Message:

Update

Location:
clear-autoptimize-cache-automatically/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • clear-autoptimize-cache-automatically/trunk/CHANGELOG.txt

    r2820209 r2968504  
     1/**1.0.1 - 2023.09.19**/
     2- Fixed: Setting page url at admin bar
     3
    14/**1.0.0 - 2022.0.0**/
    25- Released
  • clear-autoptimize-cache-automatically/trunk/clear-autoptimize-cache-automatically.php

    r2828489 r2968504  
    44 * Plugin URI: https://villatheme.com/extensions/clear-autoptimize-cache-automatically/
    55 * Description: Automatically clear Autoptimize cache at a specific time of selected days
    6  * Version: 1.0.0
     6 * Version: 1.0.1
    77 * Author: VillaTheme(villatheme.com)
    88 * Author URI: https://villatheme.com
    99 * Text Domain: clear-autoptimize-cache-automatically
    1010 * Copyright 2022-2023 VillaTheme.com. All rights reserved.
    11  * Tested up to: 6.1
     11 * Tested up to: 6.3
    1212 * Requires PHP: 7.0
    1313 **/
     
    1616}
    1717
    18 define( 'VICACA_VERSION', '1.0.0' );
     18define( 'VICACA_VERSION', '1.0.1' );
    1919include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    2020if ( ! is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
     
    3939            add_action( 'admin_init', array( $this, 'save_settings' ) );
    4040            add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
    41             add_filter(
    42                 'plugin_action_links_clear-autoptimize-cache-automatically/clear-autoptimize-cache-automatically.php', array(
    43                     $this,
    44                     'settings_link'
    45                 )
    46             );
     41            add_filter( 'plugin_action_links_clear-autoptimize-cache-automatically/clear-autoptimize-cache-automatically.php', array( $this, 'settings_link' ) );
    4742            add_action( 'rest_api_init', array( $this, 'register_api' ) );
    4843        }
     
    185180        public function page_callback() {
    186181            ?>
    187             <div class="wrap">
    188                 <h2><?php esc_html_e( 'Clear Autoptimize Cache Automatically', 'clear-autoptimize-cache-automatically' ) ?></h2>
    189                 <form method="post" action="" class="vi-ui form">
     182            <div class="wrap">
     183                <h2><?php esc_html_e( 'Clear Autoptimize Cache Automatically', 'clear-autoptimize-cache-automatically' ) ?></h2>
     184                <form method="post" action="" class="vi-ui form">
    190185                    <?php wp_nonce_field( 'vicaca_save_settings', '_vicaca_save_settings_nonce' ); ?>
    191                     <div class="vi-ui segment">
    192                         <table class="form-table">
    193                             <tbody>
    194                             <tr>
    195                                 <th>
    196                                     <label for="<?php self::set_params( 'clear_by_cache_size', true ) ?>">
     186                    <div class="vi-ui segment">
     187                        <table class="form-table">
     188                            <tbody>
     189                            <tr>
     190                                <th>
     191                                    <label for="<?php self::set_params( 'clear_by_cache_size', true ) ?>">
    197192                                        <?php esc_html_e( 'Clear by cache size', 'clear-autoptimize-cache-automatically' ) ?>
    198                                     </label>
    199                                 </th>
    200                                 <td>
    201                                     <div class="vi-ui toggle checkbox">
    202                                         <input id="<?php self::set_params( 'clear_by_cache_size', true ) ?>"
    203                                                type="checkbox" <?php checked( self::$settings->get_params( 'clear_by_cache_size' ), 1 ) ?>
    204                                                value="1"
    205                                                name="<?php self::set_params( 'clear_by_cache_size' ) ?>"/>
    206                                         <label><?php esc_html_e( 'Yes', 'clear-autoptimize-cache-automatically' ) ?></label>
    207                                     </div>
    208                                     <p class="description"><?php esc_html_e( 'Clear cache whenever the cache size reaches the one set below', 'clear-autoptimize-cache-automatically' ) ?></p>
    209                                 </td>
    210                             </tr>
    211                             <tr>
    212                                 <th>
    213                                     <label for="<?php self::set_params( 'weekday', true ) ?>">
     193                                    </label>
     194                                </th>
     195                                <td>
     196                                    <div class="vi-ui toggle checkbox">
     197                                        <input id="<?php self::set_params( 'clear_by_cache_size', true ) ?>"
     198                                               type="checkbox" <?php checked( self::$settings->get_params( 'clear_by_cache_size' ), 1 ) ?>
     199                                               value="1"
     200                                               name="<?php self::set_params( 'clear_by_cache_size' ) ?>"/>
     201                                        <label><?php esc_html_e( 'Yes', 'clear-autoptimize-cache-automatically' ) ?></label>
     202                                    </div>
     203                                    <p class="description"><?php esc_html_e( 'Clear cache whenever the cache size reaches the one set below', 'clear-autoptimize-cache-automatically' ) ?></p>
     204                                </td>
     205                            </tr>
     206                            <tr>
     207                                <th>
     208                                    <label for="<?php self::set_params( 'weekday', true ) ?>">
    214209                                        <?php esc_html_e( 'Cache size', 'clear-autoptimize-cache-automatically' ) ?>
    215                                     </label>
    216                                 </th>
    217                                 <td>
    218                                     <div class="vi-ui right labeled input">
    219                                         <input type="number" min="0"
    220                                                name="<?php self::set_params( 'cache_size' ) ?>"
    221                                                id="<?php self::set_params( 'cache_size', true ) ?>"
    222                                                value="<?php echo esc_attr( self::$settings->get_params( 'cache_size' ) ) ?>">
    223                                         <label for="<?php self::set_params( 'cache_size', true ) ?>"
    224                                                class="vi-ui label">
    225                                             <select name="<?php self::set_params( 'cache_size_unit' ) ?>"
    226                                                     id="<?php self::set_params( 'cache_size_unit', true ) ?>"
    227                                                     class="<?php self::set_params( 'cache_size_unit', true ) ?> vi-ui dropdown">
     210                                    </label>
     211                                </th>
     212                                <td>
     213                                    <div class="vi-ui right labeled input">
     214                                        <input type="number" min="0"
     215                                               name="<?php self::set_params( 'cache_size' ) ?>"
     216                                               id="<?php self::set_params( 'cache_size', true ) ?>"
     217                                               value="<?php echo esc_attr( self::$settings->get_params( 'cache_size' ) ) ?>">
     218                                        <label for="<?php self::set_params( 'cache_size', true ) ?>"
     219                                               class="vi-ui label">
     220                                            <select name="<?php self::set_params( 'cache_size_unit' ) ?>"
     221                                                    id="<?php self::set_params( 'cache_size_unit', true ) ?>"
     222                                                    class="<?php self::set_params( 'cache_size_unit', true ) ?> vi-ui dropdown">
    228223                                                <?php
    229224                                                foreach (
     
    235230                                                ) {
    236231                                                    ?>
    237                                                     <option value="<?php echo esc_attr( $key ); ?>" <?php selected( self::$settings->get_params( 'cache_size_unit' ), $key ) ?>><?php echo esc_html( $value ) ?></option>
     232                                                    <option value="<?php echo esc_attr( $key ); ?>" <?php selected( self::$settings->get_params( 'cache_size_unit' ), $key ) ?>><?php echo esc_html( $value ) ?></option>
    238233                                                    <?php
    239234                                                }
    240235                                                ?>
    241                                             </select>
    242                                         </label>
    243                                     </div>
    244                                 </td>
    245                             </tr>
    246                             <tr>
    247                                 <th>
    248                                     <label for="<?php self::set_params( 'clear_by_time_interval', true ) ?>">
     236                                            </select>
     237                                        </label>
     238                                    </div>
     239                                </td>
     240                            </tr>
     241                            <tr>
     242                                <th>
     243                                    <label for="<?php self::set_params( 'clear_by_time_interval', true ) ?>">
    249244                                        <?php esc_html_e( 'Clear after a specific interval', 'clear-autoptimize-cache-automatically' ) ?>
    250                                     </label>
    251                                 </th>
    252                                 <td>
    253                                     <div class="vi-ui toggle checkbox">
    254                                         <input id="<?php self::set_params( 'clear_by_time_interval', true ) ?>"
    255                                                type="checkbox" <?php checked( self::$settings->get_params( 'clear_by_time_interval' ), 1 ) ?>
    256                                                value="1"
    257                                                name="<?php self::set_params( 'clear_by_time_interval' ) ?>"/>
    258                                         <label><?php esc_html_e( 'Yes', 'clear-autoptimize-cache-automatically' ) ?></label>
    259                                     </div>
    260                                     <p class="description"><?php esc_html_e( 'Enable this if you need the cache to be cleared every hour, every day... regardless of cache size.', 'clear-autoptimize-cache-automatically' ) ?></p>
    261                                 </td>
    262                             </tr>
    263                             <tr>
    264                                 <th>
    265                                     <label for="<?php self::set_params( 'weekday', true ) ?>">
     245                                    </label>
     246                                </th>
     247                                <td>
     248                                    <div class="vi-ui toggle checkbox">
     249                                        <input id="<?php self::set_params( 'clear_by_time_interval', true ) ?>"
     250                                               type="checkbox" <?php checked( self::$settings->get_params( 'clear_by_time_interval' ), 1 ) ?>
     251                                               value="1"
     252                                               name="<?php self::set_params( 'clear_by_time_interval' ) ?>"/>
     253                                        <label><?php esc_html_e( 'Yes', 'clear-autoptimize-cache-automatically' ) ?></label>
     254                                    </div>
     255                                    <p class="description"><?php esc_html_e( 'Enable this if you need the cache to be cleared every hour, every day... regardless of cache size.', 'clear-autoptimize-cache-automatically' ) ?></p>
     256                                </td>
     257                            </tr>
     258                            <tr>
     259                                <th>
     260                                    <label for="<?php self::set_params( 'weekday', true ) ?>">
    266261                                        <?php esc_html_e( 'Clear cache every', 'clear-autoptimize-cache-automatically' ) ?>
    267                                     </label>
    268                                 </th>
    269                                 <td>
    270                                     <div class="vi-ui right labeled input">
    271                                         <input type="number" min="1"
    272                                                name="<?php self::set_params( 'cache_interval' ) ?>"
    273                                                id="<?php self::set_params( 'cache_interval', true ) ?>"
    274                                                value="<?php echo esc_attr( self::$settings->get_params( 'cache_interval' ) ) ?>">
    275                                         <label for="<?php self::set_params( 'cache_interval', true ) ?>"
    276                                                class="vi-ui label">
    277                                             <select name="<?php self::set_params( 'cache_interval_unit' ) ?>"
    278                                                     id="<?php self::set_params( 'cache_interval_unit', true ) ?>"
    279                                                     class="<?php self::set_params( 'cache_interval_unit', true ) ?> vi-ui dropdown">
     262                                    </label>
     263                                </th>
     264                                <td>
     265                                    <div class="vi-ui right labeled input">
     266                                        <input type="number" min="1"
     267                                               name="<?php self::set_params( 'cache_interval' ) ?>"
     268                                               id="<?php self::set_params( 'cache_interval', true ) ?>"
     269                                               value="<?php echo esc_attr( self::$settings->get_params( 'cache_interval' ) ) ?>">
     270                                        <label for="<?php self::set_params( 'cache_interval', true ) ?>"
     271                                               class="vi-ui label">
     272                                            <select name="<?php self::set_params( 'cache_interval_unit' ) ?>"
     273                                                    id="<?php self::set_params( 'cache_interval_unit', true ) ?>"
     274                                                    class="<?php self::set_params( 'cache_interval_unit', true ) ?> vi-ui dropdown">
    280275                                                <?php
    281276                                                foreach (
     
    287282                                                ) {
    288283                                                    ?>
    289                                                     <option value="<?php echo esc_attr( $key ); ?>" <?php selected( self::$settings->get_params( 'cache_interval_unit' ), $key ) ?>><?php echo esc_html( $value ) ?></option>
     284                                                    <option value="<?php echo esc_attr( $key ); ?>" <?php selected( self::$settings->get_params( 'cache_interval_unit' ), $key ) ?>><?php echo esc_html( $value ) ?></option>
    290285                                                    <?php
    291286                                                }
    292287                                                ?>
    293                                             </select>
    294                                         </label>
    295                                     </div>
    296                                 </td>
    297                             </tr>
    298 
    299                             <tr>
    300                                 <th>
    301                                     <label for="<?php self::set_params( 'execution_link', true ) ?>">
     288                                            </select>
     289                                        </label>
     290                                    </div>
     291                                </td>
     292                            </tr>
     293
     294                            <tr>
     295                                <th>
     296                                    <label for="<?php self::set_params( 'execution_link', true ) ?>">
    302297                                        <?php esc_html_e( 'Enable execution link', 'clear-autoptimize-cache-automatically' ) ?>
    303                                     </label>
    304                                 </th>
    305                                 <td>
    306                                     <div class="vi-ui toggle checkbox">
    307                                         <input id="<?php self::set_params( 'execution_link', true ) ?>"
    308                                                type="checkbox" <?php checked( self::$settings->get_params( 'execution_link' ), 1 ) ?>
    309                                                value="1"
    310                                                name="<?php self::set_params( 'execution_link' ) ?>"/>
    311                                         <label><?php esc_html_e( 'Yes', 'clear-autoptimize-cache-automatically' ) ?></label>
    312                                     </div>
    313                                     <p class="description"><?php esc_html_e( 'Autoptimize cache will be cleared whenever a request is made to the Execution link below', 'clear-autoptimize-cache-automatically' ) ?></p>
    314                                 </td>
    315                             </tr>
     298                                    </label>
     299                                </th>
     300                                <td>
     301                                    <div class="vi-ui toggle checkbox">
     302                                        <input id="<?php self::set_params( 'execution_link', true ) ?>"
     303                                               type="checkbox" <?php checked( self::$settings->get_params( 'execution_link' ), 1 ) ?>
     304                                               value="1"
     305                                               name="<?php self::set_params( 'execution_link' ) ?>"/>
     306                                        <label><?php esc_html_e( 'Yes', 'clear-autoptimize-cache-automatically' ) ?></label>
     307                                    </div>
     308                                    <p class="description"><?php esc_html_e( 'Autoptimize cache will be cleared whenever a request is made to the Execution link below', 'clear-autoptimize-cache-automatically' ) ?></p>
     309                                </td>
     310                            </tr>
    316311                            <?php
    317312                            $execution_link_secret = self::$settings->get_params( 'execution_link_secret' );
    318313                            ?>
    319                             <tr>
    320                                 <th>
    321                                     <label for="<?php self::set_params( 'execution_link_url', true ) ?>">
     314                            <tr>
     315                                <th>
     316                                    <label for="<?php self::set_params( 'execution_link_url', true ) ?>">
    322317                                        <?php esc_html_e( 'Execution link', 'clear-autoptimize-cache-automatically' ) ?>
    323                                     </label>
    324                                 </th>
    325                                 <td>
    326                                     <div class="vi-ui left labeled fluid input">
    327                                         <label for="<?php self::set_params( 'execution_link_url', true ) ?>"
    328                                                class="vi-ui label">
     318                                    </label>
     319                                </th>
     320                                <td>
     321                                    <div class="vi-ui left labeled fluid input">
     322                                        <label for="<?php self::set_params( 'execution_link_url', true ) ?>"
     323                                               class="vi-ui label">
    329324                                            <span class="<?php self::set_params( 'execution_link_url_buttons', true ) ?>">
    330325                                                <span class="<?php self::set_params( 'execution_link_url_copy', true ) ?>"
    331326                                                      title="<?php esc_attr_e( 'Copy execution link', 'clear-autoptimize-cache-automatically' ) ?>"><i
    332                                                             class="icon copy"></i></span>
     327                                                            class="icon copy"></i></span>
    333328                                                <span class="<?php self::set_params( 'execution_link_secret_refresh', true ) ?>"
    334329                                                      title="<?php esc_attr_e( 'Generate a new secret for execution link', 'clear-autoptimize-cache-automatically' ) ?>"><i
    335                                                             class="icon refresh"></i></span>
     330                                                            class="icon refresh"></i></span>
    336331                                            </span></label>
    337                                         <input id="<?php self::set_params( 'execution_link_url', true ) ?>"
    338                                                type="text" readonly
    339                                                value="<?php echo esc_url_raw( add_query_arg( array( 'secret' => urlencode( $execution_link_secret ) ), get_rest_url( null, 'vicaca/clear' ) ) ) ?>"/>
    340                                         <input id="<?php self::set_params( 'execution_link_secret', true ) ?>"
    341                                                type="hidden"
    342                                                value="<?php echo esc_attr( $execution_link_secret ) ?>"
    343                                                name="<?php self::set_params( 'execution_link_secret' ) ?>"/>
    344                                     </div>
    345                                 </td>
    346                             </tr>
    347                             </tbody>
    348                         </table>
    349                     </div>
    350                     <p class="<?php self::set_params( 'save-settings-container', true ) ?>">
    351                         <button type="submit"
    352                                 class="vi-ui button labeled icon primary <?php self::set_params( 'save-settings', true ) ?>"
    353                                 name="<?php self::set_params( 'save-settings', true ) ?>"><i
    354                                     class="save icon"></i><?php esc_html_e( 'Save Settings', 'clear-autoptimize-cache-automatically' ) ?>
    355                         </button>
    356                     </p>
    357                 </form>
     332                                        <input id="<?php self::set_params( 'execution_link_url', true ) ?>"
     333                                               type="text" readonly
     334                                               value="<?php echo esc_url_raw( add_query_arg( array( 'secret' => urlencode( $execution_link_secret ) ), get_rest_url( null, 'vicaca/clear' ) ) ) ?>"/>
     335                                        <input id="<?php self::set_params( 'execution_link_secret', true ) ?>"
     336                                               type="hidden"
     337                                               value="<?php echo esc_attr( $execution_link_secret ) ?>"
     338                                               name="<?php self::set_params( 'execution_link_secret' ) ?>"/>
     339                                    </div>
     340                                </td>
     341                            </tr>
     342                            </tbody>
     343                        </table>
     344                    </div>
     345                    <p class="<?php self::set_params( 'save-settings-container', true ) ?>">
     346                        <button type="submit"
     347                                class="vi-ui button labeled icon primary <?php self::set_params( 'save-settings', true ) ?>"
     348                                name="<?php self::set_params( 'save-settings', true ) ?>"><i
     349                                    class="save icon"></i><?php esc_html_e( 'Save Settings', 'clear-autoptimize-cache-automatically' ) ?>
     350                        </button>
     351                    </p>
     352                </form>
    358353                <?php do_action( 'villatheme_support_clear-autoptimize-cache-automatically' ) ?>
    359             </div>
     354            </div>
    360355            <?php
    361356        }
     
    456451                        'image'      => VICACA_IMAGES,
    457452                        'slug'       => 'clear-autoptimize-cache-automatically',
    458                         'menu_slug'  => '',
     453                        'menu_slug'  => 'options-general.php?page=vicaca',
    459454                        'version'    => VICACA_VERSION,
    460455                        'survey_url' => 'https://script.google.com/macros/s/AKfycbxMCb9efYAjWvEy2w7Xn46WMAoXxgo5oP7UJCBVROADc5nrWyuGfiuTapX4xgBkVZDT/exec'
  • clear-autoptimize-cache-automatically/trunk/includes/support.php

    r2820209 r2968504  
    88    /**
    99     * Class VillaTheme_Support
    10      * 1.1.7
     10     * 1.1.8
    1111     */
    1212    class VillaTheme_Support {
    1313        protected $plugin_base_name;
    1414        protected $ads_data;
    15         protected $version = '1.1.7';
     15        protected $version = '1.1.8';
     16        protected $data = [];
    1617
    1718        public function __construct( $data ) {
     
    702703            $wp_admin_bar->add_node( array(
    703704                'id'     => 'villatheme_hide_toolbar',
    704                 'title'  => '<span style="font-family:dashicons" class="dashicons dashicons-dismiss"></span><span class="villatheme-hide-toolbar-button-title">Hide VillaTheme toolbar</span>',
     705                'title'  => '<span class="dashicons dashicons-dismiss"></span><span class="villatheme-hide-toolbar-button-title">Hide VillaTheme toolbar</span>',
    705706                'parent' => 'villatheme',
    706707                'href'   => add_query_arg( array( '_villatheme_nonce' => wp_create_nonce( 'villatheme_hide_toolbar' ) ) ),
     
    941942    }
    942943}
     944
     945if ( ! class_exists( 'VillaTheme_Require_Environment' ) ) {
     946    class VillaTheme_Require_Environment {
     947
     948        protected $args;
     949        protected $plugin_name;
     950        protected $notices = [];
     951
     952        public function __construct( $args ) {
     953            if ( ! did_action( 'plugins_loaded' ) ) {
     954                _doing_it_wrong( 'VillaTheme_Require_Environment', sprintf(
     955                /* translators: %s: plugins_loaded */
     956                    __( 'VillaTheme_Require_Environment should not be run before the %s hook.' ),
     957                    '<code>plugins_loaded</code>'
     958                ), '6.2.0' );
     959            }
     960
     961            $args = wp_parse_args( $args, [
     962                'plugin_name'     => '',
     963                'php_version'     => '',
     964                'wp_version'      => '',
     965                'wc_verison'      => '',
     966                'require_plugins' => [],
     967            ] );
     968
     969            $this->plugin_name = $args['plugin_name'];
     970
     971            $this->check( $args );
     972
     973            add_action( 'admin_notices', [ $this, 'notice' ] );
     974        }
     975
     976        protected function check( $args ) {
     977            if ( ! function_exists( 'install_plugin_install_status' ) ) {
     978                require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
     979            }
     980
     981            if ( ! function_exists( 'is_plugin_active' ) ) {
     982                require_once ABSPATH . 'wp-admin/includes/plugin.php';
     983            }
     984
     985            if ( ! empty( $args['php_version'] ) ) {
     986                $compatible_php = is_php_version_compatible( $args['php_version'] );
     987                if ( ! $compatible_php ) {
     988                    $this->notices[] = sprintf( "PHP version at least %s.", esc_html( $args['php_version'] ) );
     989                }
     990            }
     991
     992            if ( ! empty( $args['wp_version'] ) ) {
     993                $compatible_wp = is_wp_version_compatible( $args['wp_version'] );
     994                if ( ! $compatible_wp ) {
     995                    $this->notices[] = sprintf( "WordPress version at least %s.", esc_html( $args['wp_version'] ) );
     996                }
     997            }
     998
     999            if ( ! empty( $args['require_plugins'] ) ) {
     1000                foreach ( $args['require_plugins'] as $plugin ) {
     1001                    if ( empty( $plugin['version'] ) ) {
     1002                        $plugin['version'] = '';
     1003                    }
     1004
     1005                    $status              = install_plugin_install_status( $plugin );
     1006                    $require_plugin_name = $plugin['name'] ?? '';
     1007
     1008                    $requires_php = isset( $plugin['requires_php'] ) ? $plugin['requires_php'] : null;
     1009                    $requires_wp  = isset( $plugin['requires'] ) ? $plugin['requires'] : null;
     1010
     1011                    $compatible_php = is_php_version_compatible( $requires_php );
     1012                    $compatible_wp  = is_wp_version_compatible( $requires_wp );
     1013
     1014                    if ( ! $compatible_php || ! $compatible_wp ) {
     1015                        continue;
     1016                    }
     1017
     1018                    switch ( $status['status'] ) {
     1019
     1020                        case 'install':
     1021                            $this->notices[] = sprintf( "%s to be installed. <br><a href='%s' target='_blank' class='button button-primary' style='vertical-align: middle; margin-top: 5px;'>Install %s</a>",
     1022                                esc_html( $require_plugin_name ),
     1023                                esc_url( ! empty( $status['url'] ) ? $status['url'] : '#' ),
     1024                                esc_html( $require_plugin_name ) );
     1025
     1026                            break;
     1027
     1028                        default:
     1029
     1030                            if ( ! is_plugin_active( $status['file'] ) && current_user_can( 'activate_plugin', $status['file'] ) ) {
     1031                                $activate_url = add_query_arg(
     1032                                    [
     1033                                        '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
     1034                                        'action'   => 'activate',
     1035                                        'plugin'   => $status['file'],
     1036                                    ],
     1037                                    network_admin_url( 'plugins.php' )
     1038                                );
     1039
     1040                                $this->notices[] = sprintf( "%s is installed and activated. <br> <a href='%s' target='_blank' class='button button-primary' style='vertical-align: middle; margin-top: 5px;'>Active %s</a>",
     1041                                    esc_html( $require_plugin_name ),
     1042                                    esc_url( $activate_url ),
     1043                                    esc_html( $require_plugin_name ) );
     1044
     1045                            }
     1046
     1047                            if ( $plugin['slug'] == 'woocommerce' && ! empty( $args['wc_version'] ) && is_plugin_active( $status['file'] ) ) {
     1048                                $wc_current_version = get_option( 'woocommerce_version' );
     1049                                if ( ! version_compare( $wc_current_version, $args['wc_version'], '>=' ) ) {
     1050                                    $this->notices[] = sprintf( "WooCommerce version at least %s.", esc_html( $args['wc_version'] ) );
     1051                                }
     1052                            }
     1053
     1054                            break;
     1055                    }
     1056                }
     1057            }
     1058        }
     1059
     1060        public function notice() {
     1061            $screen = get_current_screen();
     1062
     1063            if ( ! current_user_can( 'manage_options' ) || $screen->id === 'update' ) {
     1064                return;
     1065            }
     1066
     1067            if ( ! empty( $this->notices ) ) {
     1068                ?>
     1069                <div class="error">
     1070                    <?php
     1071                    if ( count( $this->notices ) > 1 ) {
     1072                        printf( "<p>%s requires:</p>", esc_html( $this->plugin_name ) );
     1073                        ?>
     1074                        <ol>
     1075                            <?php
     1076                            foreach ( $this->notices as $notice ) {
     1077                                printf( "<li>%s</li>", wp_kses_post( $notice ) );
     1078                            }
     1079                            ?>
     1080                        </ol>
     1081                        <?php
     1082                    } else {
     1083                        printf( "<p>%s requires %s</p>", esc_html( $this->plugin_name ), wp_kses_post( current( $this->notices ) ) );
     1084                    }
     1085                    ?>
     1086                </div>
     1087                <?php
     1088            }
     1089        }
     1090
     1091        public function has_error() {
     1092            return ! empty( $this->notices );
     1093        }
     1094    }
     1095}
  • clear-autoptimize-cache-automatically/trunk/readme.txt

    r2825788 r2968504  
    2929
    3030### MAY BE YOU NEED
     31[SUBRE – Product Subscription for WooCommerce](https://bit.ly/subre-product-subscription-for-woo): Convert WooCommerce simple products(physical or downloadable/virtual) to subscription products and allow recurring payments
     32
     33[Clear Autoptimize Cache Automatically](https://bit.ly/clear-autoptimize-cache-automatically): Clear Autoptimize cache automatically by cache amount or by time interval
    3134
    3235[FEWC – WooCommerce Extra Checkout Fields](https://bit.ly/fewc-extra-checkout-fields-for-woocommerce): Manage checkout fields using WordPress Customizer
     
    130133
    131134== Changelog ==
    132 /**1.0.10 - 2022.07.22**/
    133 - Updated: VillaTheme_Support
    134 - Updated: Data sanitization/escaping check
    135135
    136 /**1.0.9 - 2022.05.07**/
    137 - Fixed: Error with URLs that contains more than 255 characters
     136/**1.0.1 - 2023.09.19**/
     137- Fixed: Setting page url at admin bar
    138138
    139 /**1.0.8 - 2022.04.19**/
    140 - Updated: VillaTheme_Support
    141 
    142 /**1.0.7 - 2022.04.14**/
    143 - Fixed: Use wp_http_validate_url before remote call
    144 
    145 /**1.0.6 - 2022.03.29**/
    146 - Updated: VillaTheme_Support
    147 
    148 /**1.0.5 - 2022.03.28**/
    149 - Fixed: Use wp_safe_remote_get instead of wp_remote_get to avoid redirection and request forgery attacks
    150 
    151 /**1.0.4 - 2022.03.21**/
    152 - Updated: VillaTheme_Support
    153 
    154 /**1.0.3 - 2022.01.14**/
    155 - Optimized: Enqueue script
    156 
    157 /**1.0.2.2 - 2022.01.10**/
    158 - Updated: VillaTheme_Support
    159 
    160 /**1.0.2.1 - 2021.12.13**/
    161 - Updated: Missing css/image files for class VillaTheme_Support
    162 
    163 /**1.0.2 - 2021.12.11**/
    164 - Added: Button to store external images to server in Media library/list view mode
    165 
    166 /**1.0.1 - 2021.12.08**/
    167 - Updated: Do not allow to edit(crop, rotate...) external images to avoid unexpected errors
    168 
    169 /**1.0.0 - 2021.12.07**/
    170  - Released
     139/**1.0.0 - 2022.0.0**/
     140- Released
Note: See TracChangeset for help on using the changeset viewer.