master
Gnieark 8 years ago
parent 88fa57ff30
commit cd22ce3a98

@ -26,7 +26,7 @@ $this->registerModule(
/* Name */ "YASH Fork", /* Name */ "YASH Fork",
/* Description*/ "Fork of Yet Another Syntax Highlighter. Modification: Juste one javascript called on public pages for yash3", /* 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", /* Author */ "Forked and modified by Gnieark, origin Pep and contributors",
/* Version */ '0.8', /* Version */ '0.8.1',
array( array(
/* Dependencies */ 'requires' => array(array('core','2.9')), /* Dependencies */ 'requires' => array(array('core','2.9')),
/* Permissions */ 'permissions' => 'usage,contentadmin', /* Permissions */ 'permissions' => 'usage,contentadmin',

@ -36,43 +36,45 @@ class dcYASH
* send the css or js file * send the css or js file
* Don't take care about all path vars * Don't take care about all path vars
*/ */
global $core;
list($osef,$ext) = explode(".",$args); list($osef,$ext) = explode(".",$args);
switch($args){ switch($ext){
case "css": case "css":
$ext = "css"; $ext = "css";
header("Content-type: text/css");
break; break;
case "js": case "js":
header('Content-Type: application/javascript');
$ext = "js"; $ext = "js";
break; break;
default: default:
self::p404(); throw new Exception ("Page not found",404);
break; break;
} }
$fileToSend = path::real(DC_VAR)."/yash3/". $fileToSend = path::real(DC_VAR)."/yash3/".
$core->blog->id."/". $core->blog->id."/".
$core->blog->settings->yash3->yash3_concat_version. $core->blog->settings->yash3->yash3_concat_version.".".
$ext; $ext;
if(file_exists($fileToSend)){ if(file_exists($fileToSend)){
echo file_get_contents($fileToSend); echo file_get_contents($fileToSend);
}else{ }else{
self::p404(); throw new Exception ("Page not found",404);
} }
} }
public static function publicHeadContent() public static function publicHeadContent()
{ {
global $core; global $core;
error_log($core->blog->url.$core->url->getBase('yash3'));
$core->blog->settings->addNamespace('yash3'); $core->blog->settings->addNamespace('yash3');
if ($core->blog->settings->yash3->yash3_active) if ($core->blog->settings->yash3->yash3_active)
{ {
echo dcUtils::cssLoad( echo dcUtils::cssLoad(
$core->blog->getPF( $core->blog->url.$core->url->getBase('yash3')."/".
"yash3/syntaxhighlighter/css/shThemeConcatened". $core->blog->settings->yash3->yash3_concat_version.
$core->blog->settings->yash3->yash3_concat_version. ".css"
".css"
)
); );
} }
} }
@ -82,8 +84,11 @@ class dcYASH
$core->blog->settings->addNamespace('yash3'); $core->blog->settings->addNamespace('yash3');
if ($core->blog->settings->yash3->yash3_active){ if ($core->blog->settings->yash3->yash3_active){
echo dcUtils::jsLoad($core->blog->getPF('yash3/syntaxhighlighter/js/shConcatened'. echo dcUtils::jsLoad(
$core->blog->settings->yash3->yash3_concat_version.'.js')); $core->blog->url.$core->url->getBase('yash3')."/".
$core->blog->settings->yash3->yash3_concat_version.
".js"
);
} }
} }
} }

@ -139,7 +139,7 @@ if (!empty($_POST['saveconfig'])) {
//Generate the CSS concatened //Generate the CSS concatened
if(file_exists($cssPreviousFileRealPath)){ if(file_exists($cssPreviousFileRealPath)){
//delete It //delete It
unlink(dirname(__FILE__)."/syntaxhighlighter/css/shThemeConcatened".$concat_version.".css"); unlink($cssPreviousFileRealPath);
} }
$custom_css = $core->blog->settings->yash3->yash3_custom_css; $custom_css = $core->blog->settings->yash3->yash3_custom_css;
if (!empty($custom_css)) { if (!empty($custom_css)) {
@ -166,11 +166,11 @@ if (!empty($_POST['saveconfig'])) {
file_get_contents($cssPathFile); file_get_contents($cssPathFile);
// Remove comments // Remove comments
$fContent = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $fContent); //$fContent = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $fContent);
// Remove space after colons // Remove space after colons
$fContent = str_replace(': ', ':', $fContent); //$fContent = str_replace(': ', ':', $fContent);
// Remove whitespace // 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 //create the file
file_put_contents( $cssFutureFileRealPath, $fContent ); file_put_contents( $cssFutureFileRealPath, $fContent );

Loading…
Cancel
Save