This repository has been archived by the owner on Mar 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eugen
committed
Jun 27, 2018
0 parents
commit 90c5fc9
Showing
14 changed files
with
1,667 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* This file is part of WEA IT-Solutions wea_assets_management module. | ||
* | ||
* WEA IT-Solutions wea_assets_management module is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* WEA IT-Solutions wea_assets_management module is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with WEA IT-Solutions wea_assets_management module. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* @link http://www.wea-it.com | ||
* @copyright (C) WEA IT-Solutions 2018 | ||
*/ | ||
|
||
|
||
namespace WeaItSolutions\Oxid\AssetsManagement\Core; | ||
|
||
class Config extends Config_parent | ||
{ | ||
/** | ||
* Returns cdn url if configured. | ||
* | ||
* @param null $ssl | ||
* @param null $admin | ||
* @param bool $nativeImg | ||
* @return mixed | ||
*/ | ||
public function getOutUrl($ssl = null, $admin = null, $nativeImg = false) | ||
{ | ||
$sParentOutUrl = parent::getOutUrl($ssl, $admin, $nativeImg); | ||
$admin = is_null($admin) ? $this->isAdmin() : $admin; | ||
$ssl = is_null($ssl) ? $this->isSsl() : $ssl; | ||
$sCdnUrl = $this->getConfig()->getConfigParam('wea_assets_mgnt_cdn'); | ||
if(!$admin && $sCdnUrl){ | ||
$sShopUrl = $this->getConfigParam('sShopURL'); | ||
if($ssl){ | ||
$sShopUrl = $this->getConfigParam('sSSLShopURL'); | ||
} | ||
|
||
return str_replace(rtrim($sShopUrl, '/'), rtrim($sCdnUrl, '/'), $sParentOutUrl); | ||
} | ||
|
||
return $sParentOutUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
/** | ||
* This file is part of WEA IT-Solutions wea_assets_management module. | ||
* | ||
* WEA IT-Solutions wea_assets_management module is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* WEA IT-Solutions wea_assets_management module is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with WEA IT-Solutions wea_assets_management module. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* @link http://www.wea-it.com | ||
* @copyright (C) WEA IT-Solutions 2018 | ||
*/ | ||
|
||
|
||
namespace WeaItSolutions\Oxid\AssetsManagement\Core; | ||
|
||
|
||
class ViewConfig extends ViewConfig_parent | ||
{ | ||
/** | ||
* Returns external cdn url if is one defined. | ||
* | ||
* @param $sModule | ||
* @param string $sFile | ||
* @return mixed | ||
*/ | ||
public function getModuleUrl($sModule, $sFile = '') | ||
{ | ||
if (!$this->isAdmin() && $this->getConfig()->getConfigParam('wea_assets_mgnt_cdn')) { | ||
$sUrl = str_replace( | ||
rtrim($this->getConfig()->getConfigParam('sShopDir'), '/'), | ||
rtrim($this->getConfig()->getConfigParam('wea_assets_mgnt_cdn'), '/'), | ||
$this->getModulePath($sModule, $sFile) | ||
); | ||
} else { | ||
$sUrl = parent::getModuleUrl($sModule, $sFile); | ||
} | ||
|
||
return $sUrl; | ||
|
||
} | ||
|
||
/** | ||
* @param null $sFile | ||
* @return mixed | ||
*/ | ||
public function getResourceUrl($sFile = null) | ||
{ | ||
if (!$sFile && !$this->isAdmin() && $this->getViewConfigParam('basetpldir') === null) { | ||
if ($sCdnUri = $this->getConfig()->getConfigParam('wea_assets_mgnt_cdn')) { | ||
$sValue = $this->getConfig()->getResourceUrl('', $this->isAdmin()); | ||
|
||
if ($this->getConfig()->getConfigParam('blNativeImages')) { | ||
$sCurrentUrl = $this->getConfig()->getSslShopUrl(); | ||
} else { | ||
$sCurrentUrl = $this->getConfig()->getConfigParam('sSSLShopURL'); | ||
} | ||
|
||
$sValue = str_replace($sCurrentUrl, $sCdnUri, $sValue); | ||
$this->setViewConfigParam('basetpldir', $sValue); | ||
} | ||
} | ||
|
||
return parent::getResourceUrl($sFile); | ||
|
||
} | ||
} |
Oops, something went wrong.