Skip to content

Commit 23bf6af

Browse files
committed
fix cname, remove deprecated function
1 parent b5df435 commit 23bf6af

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

Diff for: Helper/Config.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ public function getCName()
8484
*/
8585
public function buildUrl($inputUrl)
8686
{
87+
$baseUrl = "//" . $this->getToken() . ".cloudimg.io/";
8788
if (!empty($this->getCName())) {
88-
$baseUrl = "//" . $this->getCName() . "/";
89-
} else {
90-
$baseUrl = "//" . $this->getToken() . ".cloudimg.io/";
89+
$inputUrl = str_replace($this->getCName(), "", $inputUrl);
9190
}
9291

9392
if (!$this->isRemoveV7()) {

Diff for: Helper/Images.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,9 @@ public function processHtml($html)
107107

108108
$imageSrc = $element->getAttribute('src') . $quality;
109109

110-
if (!empty($this->config->getCName())) {
111-
if (stripos($imageSrc, $this->config->getCName()) === false) {
112-
$ciSrc = $this->config->buildUrl($imageSrc);
113-
$element->setAttribute('src', $ciSrc);
114-
}
115-
} else {
116-
if (stripos($imageSrc, $this->config->getToken()) === false) {
117-
$ciSrc = $this->config->buildUrl($imageSrc);
118-
$element->setAttribute('src', $ciSrc);
119-
}
110+
if (stripos($imageSrc, $this->config->getToken()) === false) {
111+
$ciSrc = $this->config->buildUrl($imageSrc);
112+
$element->setAttribute('src', $ciSrc);
120113
}
121114
} else {
122115
if ($element->hasAttribute('data-lazy-off')

Diff for: Plugin/ResponsiveBlock.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ResponsiveBlock
2424
/**
2525
* @var Images
2626
*/
27-
private $helper;
27+
private $images;
2828

2929
public function __construct(
3030
Config $config,

0 commit comments

Comments
 (0)