From cd22ce3a9897d6df3593331984c11dd28526c957 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Fri, 23 Dec 2016 00:16:32 +0100 Subject: [PATCH] fixes --- _define.php | 2 +- _public.php | 29 +++++++++++++++++------------ index.php | 8 ++++---- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/_define.php b/_define.php index c640898..05fe299 100755 --- a/_define.php +++ b/_define.php @@ -26,7 +26,7 @@ $this->registerModule( /* Name */ "YASH Fork", /* Description*/ "Fork of Yet Another Syntax Highlighter. Modification: Juste one javascript called on public pages for yash3", /* Author */ "Forked and modified by Gnieark, origin Pep and contributors", - /* Version */ '0.8', + /* Version */ '0.8.1', array( /* Dependencies */ 'requires' => array(array('core','2.9')), /* Permissions */ 'permissions' => 'usage,contentadmin', diff --git a/_public.php b/_public.php index c5b252a..3e7935f 100755 --- a/_public.php +++ b/_public.php @@ -36,43 +36,45 @@ class dcYASH * send the css or js file * Don't take care about all path vars */ + global $core; list($osef,$ext) = explode(".",$args); - switch($args){ + switch($ext){ case "css": $ext = "css"; + header("Content-type: text/css"); break; case "js": + header('Content-Type: application/javascript'); $ext = "js"; break; default: - self::p404(); + throw new Exception ("Page not found",404); break; } $fileToSend = path::real(DC_VAR)."/yash3/". $core->blog->id."/". - $core->blog->settings->yash3->yash3_concat_version. + $core->blog->settings->yash3->yash3_concat_version.".". $ext; if(file_exists($fileToSend)){ echo file_get_contents($fileToSend); }else{ - self::p404(); + throw new Exception ("Page not found",404); } } public static function publicHeadContent() { global $core; - + error_log($core->blog->url.$core->url->getBase('yash3')); $core->blog->settings->addNamespace('yash3'); if ($core->blog->settings->yash3->yash3_active) { echo dcUtils::cssLoad( - $core->blog->getPF( - "yash3/syntaxhighlighter/css/shThemeConcatened". - $core->blog->settings->yash3->yash3_concat_version. - ".css" - ) + $core->blog->url.$core->url->getBase('yash3')."/". + $core->blog->settings->yash3->yash3_concat_version. + ".css" + ); } } @@ -82,8 +84,11 @@ class dcYASH $core->blog->settings->addNamespace('yash3'); if ($core->blog->settings->yash3->yash3_active){ - echo dcUtils::jsLoad($core->blog->getPF('yash3/syntaxhighlighter/js/shConcatened'. - $core->blog->settings->yash3->yash3_concat_version.'.js')); + echo dcUtils::jsLoad( + $core->blog->url.$core->url->getBase('yash3')."/". + $core->blog->settings->yash3->yash3_concat_version. + ".js" + ); } } } diff --git a/index.php b/index.php index dd73bfc..4c4f7d9 100755 --- a/index.php +++ b/index.php @@ -139,7 +139,7 @@ if (!empty($_POST['saveconfig'])) { //Generate the CSS concatened if(file_exists($cssPreviousFileRealPath)){ //delete It - unlink(dirname(__FILE__)."/syntaxhighlighter/css/shThemeConcatened".$concat_version.".css"); + unlink($cssPreviousFileRealPath); } $custom_css = $core->blog->settings->yash3->yash3_custom_css; if (!empty($custom_css)) { @@ -166,11 +166,11 @@ if (!empty($_POST['saveconfig'])) { file_get_contents($cssPathFile); // Remove comments - $fContent = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $fContent); + //$fContent = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $fContent); // Remove space after colons - $fContent = str_replace(': ', ':', $fContent); + //$fContent = str_replace(': ', ':', $fContent); // Remove whitespace - $fContent = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $fContent); + //$fContent = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $fContent); //create the file file_put_contents( $cssFutureFileRealPath, $fContent );