Last active
January 21, 2020 09:34
-
-
Save fransallen/b1e028f656e28becab7642e614f8f08b to your computer and use it in GitHub Desktop.
Statically OpenCart Integration with VQmod
This file contains hidden or 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
<modification> | |
<id><![CDATA[Statically OpenCart Integration]]></id> | |
<version><![CDATA[2.4+]]></version> | |
<vqmver><![CDATA[1.0.0]]></vqmver> | |
<author><![CDATA[https://www.statically.io]]></author> | |
<file name="system/library/response.php"> | |
<operation> | |
<search position="replace"><![CDATA[echo $output;]]></search> | |
<add><![CDATA[echo $this->cdn_output($output);]]></add> | |
</operation> | |
<operation> | |
<search position="before"><![CDATA[public function output() {]]></search> | |
<add> | |
<![CDATA[ | |
function cdn_output($result) { | |
$cdn_domain = 'cdn.statically.io'; | |
$github_repo = 'fransallen/example'; | |
$github_tag = 'master'; | |
$http_scheme = (isset($_SERVER['HTTPS']) && (($_SERVER['HTTPS'] == 'on') || ($_SERVER['HTTPS'] == '1'))) ? 'https' : 'http'; | |
$cdn_domain = $http_scheme .'://'. $cdn_domain; | |
$result = str_replace($http_scheme . "://" . $_SERVER['HTTP_HOST'] . '/image/', $cdn_domain . '/img/' . $_SERVER['HTTP_HOST'] . '/image/', $result); | |
$result = str_replace('src="catalog/view/javascript/', 'src="' . $cdn_domain . '/gh/' . $github_repo . '/' . $github_tag . '/catalog/view/javascript/', $result); | |
$result = str_replace('href="catalog/view/javascript/', 'href="' . $cdn_domain . '/gh/' . $github_repo . '/' . $github_tag . '/catalog/view/javascript/', $result); | |
$result = str_replace('src="' . $http_scheme . "://" . $_SERVER['HTTP_HOST'] . '/catalog/view/javascript/', 'src="' . $cdn_domain . '/gh/' . $github_repo . '/' . $github_tag . '/catalog/view/javascript/', $result); | |
$result = str_replace('src="catalog/view/theme/journal2/image/', 'src="' . $cdn_domain . '/gh/' . $github_repo . '/' . $github_tag . '/catalog/view/theme/journal2/image/', $result); | |
$result = str_replace('src="catalog/view/theme/default/image/', 'src="' . $cdn_domain . '/gh/' . $github_repo . '/' . $github_tag . '/catalog/view/theme/default/image/', $result); | |
$result = str_replace('href="catalog/view/theme/journal2/stylesheet/', 'href="' . $cdn_domain . '/gh/' . $github_repo . '/' . $github_tag . '/catalog/view/theme/journal2/stylesheet/', $result); | |
$result = str_replace('href="catalog/view/theme/default/stylesheet/', 'href="' . $cdn_domain . '/gh/' . $github_repo . '/' . $github_tag . '/catalog/view/theme/default/stylesheet/', $result); | |
return $result; | |
} | |
]]> | |
</add> | |
</operation> | |
</file> | |
</modification> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment