Plugin Directory

Changeset 3144108


Ignore:
Timestamp:
08/30/2024 07:37:43 AM (19 months ago)
Author:
integrationclaspo
Message:

Updated to version 1.0.2

Location:
claspo/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • claspo/trunk/claspo.php

    r3137558 r3144108  
    55 * Plugin URI: https://github.com/Claspo/claspo-wordpress-plugin
    66 * Description: Adds the Claspo script to all pages of the site.
    7  * Version: 1.0.0
     7 * Version: 1.0.2
    88 * Author: Claspo
    99 * Author URI: https://github.com/Claspo
     
    6161                set_transient( 'claspo_success_message', true, 30 );
    6262                delete_transient( 'claspo_api_error' );
     63
     64                claspo_clear_cache();
    6365            } else {
    6466                set_transient( 'claspo_api_error', 'Invalid response from API', 30 );
     
    139141                set_transient( 'claspo_success_message', true, 30 );
    140142                delete_transient( 'claspo_api_error' );
     143
     144                claspo_clear_cache();
    141145            } else {
    142146                set_transient( 'claspo_api_error', 'Invalid response from API', 30 );
     
    160164    delete_option( 'claspo_script_id' );
    161165    delete_option( 'claspo_script_code' );
     166
     167    claspo_clear_cache();
    162168
    163169    wp_safe_redirect( admin_url( 'admin.php?page=claspo_script_plugin' ) );
     
    213219    $to = 'integrations.feedback@claspo.io';
    214220    $subject = 'Feedback from WordPress plugin';
    215     $body = "Domain: " . $wp_domain .  "\n\nScript ID: " . esc_html($script_id) . "\n\nFeedback:\n" . esc_html($feedback);
     221    $body = "Domain: " . $wp_domain
     222            . "\n\nScript ID: " . esc_html($script_id)
     223            . "\n\nFeedback:\n" . esc_html($feedback)
     224            . "\n\nPlugin version:\n" . esc_html( get_plugin_data( __FILE__ )['Version'] )
     225            . "\n\nWordPress version:\n" . esc_html( get_bloginfo( 'version' ) )
     226            . "\n\nPHP version:\n" . esc_html( phpversion() );
     227    ;
    216228
    217229    wp_mail( $to, $subject, $body );
     
    221233
    222234    deactivate_plugins( plugin_basename( __FILE__ ), true );
     235
     236    claspo_clear_cache();
    223237    wp_safe_redirect( admin_url( 'plugins.php?deactivated=true' ) );
    224238    exit;
     
    250264// Додаємо дію для виконання редіректу після ініціалізації адміністративної частини
    251265add_action('admin_init', 'claspo_plugin_redirect');
     266
     267
     268function claspo_clear_cache() {
     269    try {
     270        global $wp_fastest_cache;
     271        // if W3 Total Cache is being used, clear the cache
     272        if (function_exists('w3tc_flush_all')) {
     273            w3tc_flush_all();
     274        }
     275        /* if WP Super Cache is being used, clear the cache */
     276        if (function_exists('wp_cache_clean_cache')) {
     277            global $file_prefix, $supercachedir;
     278            if (empty($supercachedir) && function_exists('get_supercache_dir')) {
     279                $supercachedir = get_supercache_dir();
     280            }
     281            wp_cache_clean_cache($file_prefix);
     282        }
     283
     284        if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) {
     285            $wp_fastest_cache->deleteCache();
     286        }
     287        if (function_exists('rocket_clean_domain')) {
     288            rocket_clean_domain();
     289            // Preload cache.
     290            if (function_exists('run_rocket_sitemap_preload')) {
     291                run_rocket_sitemap_preload();
     292            }
     293        }
     294
     295        if (class_exists("autoptimizeCache") && method_exists("autoptimizeCache", "clearall")) {
     296            autoptimizeCache::clearall();
     297        }
     298
     299        if (class_exists("LiteSpeed_Cache_API") && method_exists("autoptimizeCache", "purge_all")) {
     300            LiteSpeed_Cache_API::purge_all();
     301        }
     302
     303        if (class_exists('\Hummingbird\Core\Utils')) {
     304            $modules = \Hummingbird\Core\Utils::get_active_cache_modules();
     305            foreach ($modules as $module => $name) {
     306                $mod = \Hummingbird\Core\Utils::get_module($module);
     307
     308                if ($mod->is_active()) {
     309                    if ('minify' === $module) {
     310                        $mod->clear_files();
     311                    } else {
     312                        $mod->clear_cache();
     313                    }
     314                }
     315            }
     316        }
     317    } catch (Exception $e) {
     318        // do nothing
     319    }
     320}
     321
     322
     323?>
  • claspo/trunk/readme.txt

    r3137558 r3144108  
    44Requires at least: 1.0
    55Tested up to: 6.6
    6 Stable tag: 1.0.1
     6Stable tag: 1.0.2
    77Requires PHP: 7.0
    88Plugin URI: https://www.claspo.io
     
    258258== Changelog ==
    259259
     260= 1.0.2 =
     261* Introduced compatibility with popular caching plugins such as WP Rocket, WP Fastest Cache, LiteSpeed Cache, Autoptimize, and Hummingbird.
     262
    260263= 1.0.1 =
    261264* Bug fixes.
Note: See TracChangeset for help on using the changeset viewer.