Refactor CDN assets URL to separate service
[MAILPOET-3076]
This commit is contained in:
committed by
Veljko V
parent
e7206193e8
commit
6fb755eda7
18
lib/Util/CdnAssetUrl.php
Normal file
18
lib/Util/CdnAssetUrl.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace MailPoet\Util;
|
||||
|
||||
class CdnAssetUrl {
|
||||
const CDN_URL = 'https://ps.w.org/mailpoet/';
|
||||
/** @var string */
|
||||
private $baseUrl;
|
||||
|
||||
public function __construct(string $baseUrl) {
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
public function generateCdnUrl($path) {
|
||||
$useCdn = defined('MAILPOET_USE_CDN') ? MAILPOET_USE_CDN : true;
|
||||
return ($useCdn ? self::CDN_URL : $this->baseUrl . '/plugin_repository/') . "assets/$path";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user