Skip to content

Commit a692a9e

Browse files
Process images links from element attribute
1 parent 5aee638 commit a692a9e

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

src/cdn.cls.php

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ public function init()
9595
}
9696
}
9797

98+
// Add IMAGES to rewrite if CDN Mapping setting is enabled
99+
if (!empty($this->_cfg_cdn_mapping[Base::CDN_MAPPING_INC_IMG])) {
100+
$add_images_type = apply_filters('litespeed_cdn_add_filetypes_image', array('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp', '.avif'));
101+
foreach ($add_images_type as $ext) {
102+
$this->_cfg_cdn_mapping[$ext] = $this->_cfg_cdn_mapping[Base::CDN_MAPPING_INC_IMG];
103+
}
104+
}
105+
98106
// Add CSS to rewrite if CDN Mapping setting is enabled
99107
if (!empty($this->_cfg_cdn_mapping[Base::CDN_MAPPING_INC_CSS])) {
100108
$this->_cfg_cdn_mapping['.css'] = $this->_cfg_cdn_mapping[Base::CDN_MAPPING_INC_CSS];
@@ -164,25 +172,6 @@ private function _append_cdn_mapping($filetype, $url)
164172
}
165173
}
166174

167-
/**
168-
* If include css/js in CDN
169-
*
170-
* @since 1.6.2.1
171-
* @return bool true if included in CDN
172-
*/
173-
public function inc_type($type)
174-
{
175-
if ($type == 'css' && !empty($this->_cfg_cdn_mapping[Base::CDN_MAPPING_INC_CSS])) {
176-
return true;
177-
}
178-
179-
if ($type == 'js' && !empty($this->_cfg_cdn_mapping[Base::CDN_MAPPING_INC_JS])) {
180-
return true;
181-
}
182-
183-
return false;
184-
}
185-
186175
/**
187176
* Run CDN process
188177
* NOTE: As this is after cache finalized, can NOT set any cache control anymore
@@ -196,6 +185,8 @@ public function finalize($content)
196185
$this->content = $content;
197186

198187
$this->_finalize();
188+
189+
Debug2::debug2('[TIMMM] mapping ' . print_r($this->content, true));
199190
return $this->content;
200191
}
201192

0 commit comments

Comments
 (0)