Changeset 3184499
- Timestamp:
- 11/08/2024 02:45:51 PM (17 months ago)
- Location:
- hide-my-wp/trunk/models
- Files:
-
- 2 edited
-
Compatibility.php (modified) (1 diff)
-
compatibility/LiteSpeed.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hide-my-wp/trunk/models/Compatibility.php
r3184244 r3184499 271 271 // Change the paths in the cached css 272 272 if ( HMWP_Classes_Tools::isPluginActive( 'litespeed-cache/litespeed-cache.php' ) ) { 273 // Set the cache directory for this plugin 273 274 //Set the cache directory for this plugin 274 275 $path = $content_dir . 'litespeed/'; 276 277 //if set by the plugin, them select the defined folder 278 if( defined('LITESPEED_DATA_FOLDER') && LITESPEED_DATA_FOLDER <> ''){ 279 $path = $content_dir . LITESPEED_DATA_FOLDER . '/'; 280 } 281 275 282 if ( $wp_filesystem->is_dir( $path ) ) { 276 283 HMWP_Classes_ObjController::getClass( 'HMWP_Models_Cache' )->setCachePath( $path ); -
hide-my-wp/trunk/models/compatibility/LiteSpeed.php
r3184244 r3184499 10 10 11 11 class HMWP_Models_Compatibility_LiteSpeed extends HMWP_Models_Compatibility_Abstract { 12 13 public function __construct() { 14 15 parent::__construct(); 16 17 defined( 'LITESPEED_DATA_FOLDER' ) || define( 'LITESPEED_DATA_FOLDER', 'cache/ls' ); 18 } 12 19 13 20 public function hookAdmin() { … … 31 38 // Only if the litespeed plugin is installed 32 39 if ( HMWP_Classes_Tools::isPluginActive( 'litespeed-cache/litespeed-cache.php' ) ) { 33 add_action( 'hmwp_mappsettings_saved', array( $this, 'doMapping' ) );34 40 35 41 if ( ! HMWP_Classes_Tools::isWpengine() ) { 36 add_action( 'hmwp_settings_saved', array( $this, 'doMapping' ) );37 42 add_action( 'hmwp_settings_saved', array( $this, 'doExclude' ) ); 38 43 } … … 56 61 add_filter( 'hmwp_priority_buffer', '__return_true' ); 57 62 add_filter( 'litespeed_comment', '__return_false' ); 58 59 }60 61 /**62 * Adds the URL and text mappings for the wp-rocket plugin, particularly63 * mapping specific paths and script branding for litespeed caching.64 *65 * @return void66 * @throws Exception67 */68 public function doMapping() {69 70 // Add the URL mapping for wp-rocket plugin71 if ( HMWP_Classes_Tools::getDefault( 'hmwp_wp-content_url' ) <> HMWP_Classes_Tools::getOption( 'hmwp_wp-content_url' ) ) {72 $hmwp_url_mapping = json_decode( HMWP_Classes_Tools::getOption( 'hmwp_url_mapping' ), true );73 $hmwp_text_mapping = json_decode( HMWP_Classes_Tools::getOption( 'hmwp_text_mapping' ), true );74 75 // Map the litespeed default cache path76 if ( HMWP_Classes_Tools::getDefault( 'hmwp_wp-content_url' ) <> HMWP_Classes_Tools::getOption( 'hmwp_wp-content_url' ) ) {77 if ( empty( $hmwp_url_mapping['from'] ) || ! in_array( '/' . HMWP_Classes_Tools::getOption( 'hmwp_wp-content_url' ) . '/litespeed/', $hmwp_url_mapping['from'] ) ) {78 $hmwp_url_mapping['from'][] = '/' . HMWP_Classes_Tools::getOption( 'hmwp_wp-content_url' ) . '/litespeed/';79 $hmwp_url_mapping['to'][] = '/' . HMWP_Classes_Tools::getOption( 'hmwp_wp-content_url' ) . '/mycache/';80 }81 }82 83 // Map the litespeed script branding84 if ( empty( $hmwp_text_mapping['from'] ) || ! in_array( 'litespeed', $hmwp_text_mapping['from'] ) ) {85 $hmwp_text_mapping['from'][] = 'litespeed';86 $hmwp_text_mapping['to'][] = 'text';87 }88 89 //Save Text Mapping and URL Mapping90 HMWP_Classes_ObjController::getClass( 'HMWP_Models_Settings' )->saveURLMapping( $hmwp_url_mapping['from'], $hmwp_url_mapping['to'] );91 HMWP_Classes_ObjController::getClass( 'HMWP_Models_Settings' )->saveTextMapping( $hmwp_text_mapping['from'], $hmwp_text_mapping['to'] );92 }93 63 94 64 }
Note: See TracChangeset
for help on using the changeset viewer.