master
Gnieark 7 years ago
parent 88fa57ff30
commit cd22ce3a98

@ -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',

@ -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"
);
}
}
}

@ -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 );

Loading…
Cancel
Save