Skip to content

Commit

Permalink
v1.14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
optipic-io committed Apr 26, 2021
1 parent 6e35ac3 commit 26bcbe1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions optipic/ImgUrlConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ public static function getUrlFromRelative($relativeUrl, $baseUrl=false) {
}

if(!$baseUrl) {
$baseUrl = pathinfo($_SERVER['REQUEST_URI'], PATHINFO_DIRNAME);
//$baseUrl = pathinfo($_SERVER['REQUEST_URI'], PATHINFO_DIRNAME);
$baseUrl = self::getBaseDirOfUrl($_SERVER['REQUEST_URI']);
}
$baseUrl .= '/';
$url = str_replace('//', '/', $baseUrl.$relativeUrl);
Expand All @@ -444,11 +445,13 @@ public static function getUrlFromRelative($relativeUrl, $baseUrl=false) {
* https://domain.com/catalog/catalog.php --> https://domain.com/catalog/
*/
public static function getBaseDirOfUrl($url) {
$pathinfo = pathinfo($url);
$urlParsed = parse_url($url);
$urlPath = $urlParsed['path'];
$pathinfo = pathinfo($urlPath);
if(!empty($pathinfo['extension'])) {
return $pathinfo['dirname'];
}
return $url;
return $urlPath;
}

public static function getBaseUrlFromHtml($html) {
Expand Down
2 changes: 1 addition & 1 deletion optipic/optipic.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function onAfterRender()
$uri = JUri::getInstance();
$host = $uri->getHost();

$js = '<script src="https://optipic.io/api/cp/stat?domain='.$host.'&sid='.$sid.'&cms=joomla&stype=cdn&append_to=%23general%3Afirst&version=1.14.0"></script>';
$js = '<script src="https://optipic.io/api/cp/stat?domain='.$host.'&sid='.$sid.'&cms=joomla&stype=cdn&append_to=%23general%3Afirst&version=1.14.1"></script>';

$bodyHtml = str_replace ("</body>", $js." </body>", $bodyHtml);
$app->setBody($bodyHtml);
Expand Down
2 changes: 1 addition & 1 deletion optipic/optipic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU General Public License version 2 or later</license>
<authorEmail>info@optipic.io</authorEmail>
<authorUrl>https://optipic.io/cdn/</authorUrl>
<version>1.14.0</version>
<version>1.14.1</version>
<description>PLG_SYSTEM_OPTIPIC_DESC</description>
<files>
<filename plugin="optipic">optipic.php</filename>
Expand Down

0 comments on commit 26bcbe1

Please sign in to comment.