Plugin Directory

Changeset 3238154


Ignore:
Timestamp:
02/10/2025 07:41:11 PM (14 months ago)
Author:
creativform
Message:

8.8.3

  • Fixed problem with transients (must delete them after update)
  • Improved cache algorithms
  • Optimized PHP code
Location:
cf-geoplugin
Files:
506 added
7 edited

Legend:

Unmodified
Added
Removed
  • cf-geoplugin/trunk/CHANGELOG.txt

    r3230991 r3238154  
    11== Changelog ==
     2
     3= 8.8.3 =
     4* Fixed problem with transients (must delete them after update)
     5* Improved cache algorithms
     6* Optimized PHP code
    27
    38= 8.8.2 =
  • cf-geoplugin/trunk/cf-geoplugin.php

    r3230991 r3238154  
    88 * Plugin URI:        https://wpgeocontroller.com/
    99 * Description:       Unlock the power of location-based functionality of WordPress – The ultimate all-in-one geolocation plugin for WordPress.
    10  * Version:           8.8.2
     10 * Version:           8.8.3
    1111 * Requires at least: 6.0
    1212 * Requires PHP:      7.0
  • cf-geoplugin/trunk/inc/Init.php

    r3153590 r3238154  
    1515        // Do translations
    1616        add_action('plugins_loaded', array(&$this, 'textdomain'));
     17       
     18        // Include Traits
     19        include_once CFGP_INC . '/traits/cache.php';
    1720       
    1821        // Call main classes
  • cf-geoplugin/trunk/inc/classes/Cache_DB.php

    r2985404 r3238154  
    3131            $wpdb->query( $wpdb->prepare("DELETE FROM `{$wpdb->cfgp_cache}` WHERE `expire` != 0 AND `expire` <= %d", time() ));
    3232        }
     33       
     34        add_action('wp_cache_flush', [__CLASS__, 'flush']);
    3335    }
    3436   
     
    5456                self::$cache[$key] = $default;
    5557            } else {
    56                 self::$cache[$key] = (is_serialized($transient) || self::is_serialized($transient)) ? unserialize($transient) : $transient;
     58                self::$cache[$key] = maybe_unserialize($transient);
    5759            }
    5860        }
     
    6668            $result = $wpdb->get_var($wpdb->prepare("SELECT `{$wpdb->cfgp_cache}`.`value` FROM `{$wpdb->cfgp_cache}` WHERE `{$wpdb->cfgp_cache}`.`key` = %s", $key));
    6769            if($result) {
    68                 self::$cache[$key] = (is_serialized($result) || self::is_serialized($result)) ? unserialize($result) : $result;
     70                self::$cache[$key] = maybe_unserialize($result);
    6971            } else {
    7072                self::$cache[$key] = $default;
     
    102104            $expire = ($expire > 0) ? (time()+$expire) : $expire;
    103105           
    104             if(is_array($value) || is_object($value) || is_bool($value)) {
    105                 $value = serialize($value);
    106             }
     106            $value = maybe_serialize($value);
    107107           
    108108            $save = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `{$wpdb->cfgp_cache}` (`key`, `value`, `expire`) VALUES (%s, %s, %d)", $key, $value, $expire));
     
    193193            $expire = ($expire > 0) ? (time() + $expire) : $expire;
    194194           
    195             $value = (is_array($value) || is_object($value) || is_bool($value)) ? serialize($value) : $value;
     195            $value = maybe_serialize($value);
    196196
    197197            $save = $wpdb->query($wpdb->prepare(
     
    345345            // Include important library
    346346            if(!function_exists('dbDelta')){
    347                 require_once ABSPATH . DIRECTORY_SEPARATOR . 'wp-admin' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'upgrade.php';
     347                require_once ABSPATH . '/wp-admin/includes/upgrade.php';
    348348            }
    349349           
  • cf-geoplugin/trunk/inc/classes/Plugins.php

    r3115292 r3238154  
    7777           
    7878            update_option(CFGP_NAME . '_dimiss_notice_plugin_support', true, true);
    79             set_transient(CFGP_NAME . '_dimiss_notice_plugin_support', true, (MONTH_IN_SECONDS * time()));
    8079           
    8180            echo 1; exit;
  • cf-geoplugin/trunk/inc/classes/Shortcodes.php

    r3151773 r3238154  
    606606       
    607607        // Set transient
    608         if( !get_transient('cfgp-' . $transient_id) ) {
    609             set_transient(
     608        if( !CFGP_DB_Cache::get('cfgp-' . $transient_id) ) {
     609            CFGP_DB_Cache::set(
    610610                'cfgp-' . $transient_id,
    611611                array_merge(
     
    617617                    ]
    618618                ),
    619                 YEAR_IN_SECONDS
     619                DAY_IN_SECONDS*7
    620620            );
    621621        }
     
    19431943        }
    19441944       
     1945        // Prevent shortcodes to be cached
     1946        if( in_array(str_replace([
     1947            'cfgeo_',
     1948            'cfgp_',
     1949            'geo_'
     1950        ], '', $shortcode), apply_filters('cfgp/shortcodes/cache/exclude', [
     1951            'request_url',
     1952            'timestamp_readable',
     1953            'timestamp',
     1954            'current_time',
     1955            'current_date',
     1956            'currency_converter',
     1957            'runtime',
     1958            'status',
     1959            'timezone_offset',
     1960            'timezone',
     1961            'available_lookup',
     1962            'limit',
     1963            'official_url',
     1964            'credit',
     1965            'version',
     1966            'error_message',
     1967            'error'
     1968        ], $shortcode, $content, $options)) !== false ) {
     1969            return $content;
     1970        }
     1971       
    19451972        // Sanitize the shortcode to ensure it's safe for use
    19461973        $shortcode = esc_attr($shortcode);
     
    19511978            $options = array_filter($options);
    19521979        }
     1980       
     1981       
    19531982
    19541983        // Generate a unique transient ID based on the shortcode, options, and post ID
    1955         $transient_id = CFGP_U::hash(serialize(['cfgeo_' . $shortcode, $options, $content, $default, get_the_ID()]), 'sha256');
     1984        $transient_id = CFGP_U::hash(serialize(['cfgeo_' . $shortcode, $options, strip_tags($content, '<svg><img><form><input><select><textarea>'), $default, get_the_ID()]), 'whirlpool');
    19561985
    19571986        // Store transient with content, default values, and shortcode for 1 year
    1958         if( !get_transient('cfgp-' . $transient_id) ) {
    1959             set_transient('cfgp-' . $transient_id, [
     1987        if( !CFGP_DB_Cache::get('cfgp-' . $transient_id) ) {
     1988            CFGP_DB_Cache::set('cfgp-' . $transient_id, [
    19601989                'content'   => $content,
    19611990                'default'   => $default,
     
    19651994                'hash'      => $transient_id, // for validation
    19661995                'key'       => CFGP_U::CACHE_KEY() // secret plugin key
    1967             ], YEAR_IN_SECONDS);
     1996            ], DAY_IN_SECONDS);
    19681997        }
    19691998
  • cf-geoplugin/trunk/readme.txt

    r3230991 r3238154  
    66Tested up to: 6.7
    77Requires PHP: 7.0
    8 Stable tag: 8.8.2
     8Stable tag: 8.8.3
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    414414== Changelog ==
    415415
     416= 8.8.3 =
     417* Fixed problem with transients (must delete them after update)
     418* Improved cache algorithms
     419* Optimized PHP code
     420
    416421= 8.8.2 =
    417422* License updates
     
    475480
    476481== Upgrade Notice ==
     482
     483= 8.8.3 =
     484* Fixed problem with transients (must delete them after update)
     485* Improved cache algorithms
     486* Optimized PHP code
    477487
    478488= 8.8.2 =
Note: See TracChangeset for help on using the changeset viewer.