X7ROOT File Manager
Current Path:
/home/oakwood/public_html/wp-content/plugins/optimole-wp/inc
home
/
oakwood
/
public_html
/
wp-content
/
plugins
/
optimole-wp
/
inc
/
ðŸ“
..
📄
admin.php
(107.21 KB)
📄
api.php
(12.85 KB)
📄
app_replacer.php
(18.85 KB)
📄
attachment_cache.php
(1.98 KB)
ðŸ“
cli
📄
cli.php
(844 B)
ðŸ“
compatibilities
📄
config.php
(3.79 KB)
ðŸ“
conflicts
📄
dam.php
(18.89 KB)
📄
dashboard_widget.php
(5.42 KB)
📄
filters.php
(2.24 KB)
📄
lazyload_replacer.php
(22.2 KB)
📄
logger.php
(6.23 KB)
📄
main.php
(6.02 KB)
📄
manager.php
(58.3 KB)
📄
media_offload.php
(85.95 KB)
ðŸ“
media_rename
📄
rest.php
(30.72 KB)
📄
settings.php
(24.14 KB)
📄
tag_replacer.php
(19.76 KB)
ðŸ“
traits
📄
url_replacer.php
(12.66 KB)
ðŸ“
v2
📄
video_player.php
(11.41 KB)
Editing: attachment_cache.php
<?php /** * Class Optml_Attachment_Cache. */ class Optml_Attachment_Cache { const CACHE_GROUP = 'om_att'; /** * Local cache map. * * @var array */ private static $cache_map = []; /** * Reset the memory cache. */ public static function reset() { self::$cache_map = []; } /** * Get the cached attachment ID. * * @param string $url the URL of the attachment. * * @return bool|mixed */ public static function get_cached_attachment_id( $url ) { // We cache also in memory to avoid calling DB every time when not using Object Cache. $cache_key = self::get_cache_key( $url ); if ( isset( self::$cache_map[ $cache_key ] ) ) { return self::$cache_map[ $cache_key ]; } $value = wp_using_ext_object_cache() ? wp_cache_get( $cache_key, self::CACHE_GROUP ) : get_transient( self::CACHE_GROUP . $cache_key ); self::$cache_map[ $cache_key ] = $value; return $value; } /** * Set the cached attachment ID. * * @param string $url the URL of the attachment. * @param int $id the attachment ID. * * @return void */ public static function set_cached_attachment_id( $url, $id ) { $cache_key = self::get_cache_key( $url ); // We cache also in memory to avoid calling DB every time when not using Object Cache. self::$cache_map[ $cache_key ] = $id; // If the ID is not found we cache for 10 minutes, otherwise for a week. // We try to reduce the cache time when is not found to // avoid caching for situation when this might be temporary. $expiration = $id === 0 ? ( 10 * MINUTE_IN_SECONDS ) : WEEK_IN_SECONDS; wp_using_ext_object_cache() ? wp_cache_set( $cache_key, $id, self::CACHE_GROUP, $expiration ) : set_transient( self::CACHE_GROUP . $cache_key, $id, $expiration ); } /** * Generate cache key for URL. * * @param string $url the URL to generate the cache key for. * * @return string */ private static function get_cache_key( $url ) { $url = strtok( $url, '?' ); return 'id_' . crc32( $url ); } }
Upload File
Create Folder