DataInconsistency
2 weeks ago
License
2 months ago
Notices
2 months ago
pQuery
2 months ago
APIPermissionHelper.php
1 year ago
CdnAssetUrl.php
3 years ago
ConflictResolver.php
1 month ago
Cookies.php
2 months ago
DBCollationChecker.php
2 months ago
DOM.php
2 years ago
DateConverter.php
3 years ago
FreeDomains.php
3 years ago
Headers.php
1 year ago
Helpers.php
1 month ago
Installation.php
1 year ago
LegacyDatabase.php
1 year ago
Request.php
2 months ago
SecondLevelDomainNames.php
3 years ago
Security.php
2 months ago
ThirdPartyOutput.php
1 month ago
Url.php
2 months ago
index.php
3 years ago
CdnAssetUrl.php
24 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Util; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | class CdnAssetUrl { |
| 9 | const CDN_URL = 'https://ps.w.org/mailpoet/'; |
| 10 | /** @var string */ |
| 11 | private $baseUrl; |
| 12 | |
| 13 | public function __construct( |
| 14 | string $baseUrl |
| 15 | ) { |
| 16 | $this->baseUrl = $baseUrl; |
| 17 | } |
| 18 | |
| 19 | public function generateCdnUrl($path) { |
| 20 | $useCdn = defined('MAILPOET_USE_CDN') ? MAILPOET_USE_CDN : true; |
| 21 | return ($useCdn ? self::CDN_URL : $this->baseUrl . '/plugin_repository/') . "assets/$path"; |
| 22 | } |
| 23 | } |
| 24 |