Revert "WIKI CUSTOM - geshi - add custom code hilighter extensions"
This reverts commit c55c1d32bb
.
This commit is contained in:
parent
2f9eb41a1a
commit
a34d54426e
|
@ -594,8 +594,7 @@ class GeSHi {
|
|||
* {@link GeSHi->set_language_path()}
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function GeSHi($source = '', $language = '', $path = '', $extndir = '') {
|
||||
$this->extndir = $extndir;
|
||||
function GeSHi($source = '', $language = '', $path = '') {
|
||||
if (!empty($source)) {
|
||||
$this->set_source($source);
|
||||
}
|
||||
|
@ -690,10 +689,6 @@ class GeSHi {
|
|||
// this language is already loaded!
|
||||
return;
|
||||
}
|
||||
if (!empty($this->extndir)) {
|
||||
$file_extn_link = $this->extndir . '/' . $language . '/keyword-link.txt';
|
||||
$file_extn_list = $this->extndir . '/' . $language . '/keyword-list.txt';
|
||||
}
|
||||
|
||||
$this->language = $language;
|
||||
|
||||
|
@ -707,7 +702,7 @@ class GeSHi {
|
|||
}
|
||||
|
||||
// Load the language for parsing
|
||||
$this->load_language($file_name, $file_extn_link, $file_extn_list);
|
||||
$this->load_language($file_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3745,7 +3740,7 @@ class GeSHi {
|
|||
* @access private
|
||||
* @todo Needs to load keys for lexic permissions for keywords, regexps etc
|
||||
*/
|
||||
function load_language($file_name, $file_extn_link, $file_extn_list) {
|
||||
function load_language($file_name) {
|
||||
if ($file_name == $this->loaded_language) {
|
||||
// this file is already loaded!
|
||||
return;
|
||||
|
@ -3760,14 +3755,6 @@ class GeSHi {
|
|||
//Load the language file
|
||||
require $file_name;
|
||||
|
||||
if (!empty($file_extn_link) && !empty($file_extn_list) &&
|
||||
file_exists($file_extn_link) && file_exists($file_extn_list)) {
|
||||
$link_array = file($file_extn_link, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$keys_array = file($file_extn_list, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$language_data['URLS'][5] = $link_array[0];
|
||||
$language_data['KEYWORDS'][5] = $keys_array;
|
||||
}
|
||||
|
||||
// Perhaps some checking might be added here later to check that
|
||||
// $language data is a valid thing but maybe not
|
||||
$this->language_data = $language_data;
|
||||
|
@ -4785,4 +4772,4 @@ if (!function_exists('geshi_highlight')) {
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
|
@ -743,33 +743,17 @@ function p_xhtml_cached_geshi($code, $language, $wrapper='pre') {
|
|||
// remove any leading or trailing blank lines
|
||||
$code = preg_replace('/^\s*?\n|\s*?\n$/','',$code);
|
||||
|
||||
$extn_dir = $conf['datadir'] . '/' . $conf['code_extn'];
|
||||
if (!file_exists($extn_dir)) {
|
||||
$extn_dir = '';
|
||||
}
|
||||
else {
|
||||
$extn_link = $extn_dir . '/' . $language . '/keyword-link.txt';
|
||||
$extn_list = $extn_dir . '/' . $language . '/keyword-list.txt';
|
||||
if (!file_exists($extn_link) || !file_exists($extn_list)) {
|
||||
$extn_link = '';
|
||||
$extn_list = '';
|
||||
}
|
||||
}
|
||||
|
||||
$cache = getCacheName($language.$code,".code");
|
||||
$ctime = @filemtime($cache);
|
||||
if($ctime && !$INPUT->bool('purge') &&
|
||||
((!empty($extn_link) &&
|
||||
(($ctime > filemtime($extn_link)) &&
|
||||
($ctime > filemtime($extn_list)))) ||
|
||||
(empty($extn_link))) &&
|
||||
$ctime > filemtime(DOKU_INC.'inc/geshi.php') && // geshi changed
|
||||
$ctime > @filemtime(DOKU_INC.'inc/geshi/'.$language.'.php') && // language syntax definition changed
|
||||
$ctime > filemtime(reset($config_cascade['main']['default']))){ // dokuwiki changed
|
||||
$highlighted_code = io_readFile($cache, false);
|
||||
|
||||
} else {
|
||||
$geshi = new GeSHi($code, $language, DOKU_INC . 'inc/geshi', $conf['datadir'] . '/' . $conf['code_extn']);
|
||||
|
||||
$geshi = new GeSHi($code, $language, DOKU_INC . 'inc/geshi');
|
||||
$geshi->set_encoding('utf-8');
|
||||
$geshi->enable_classes();
|
||||
$geshi->set_header_type(GESHI_HEADER_PRE);
|
||||
|
|
Loading…
Reference in New Issue