Esempio n. 1
0
 function load(&$ts, $source, $language)
 {
     $config = parent::loadConfig(dirname(__FILE__));
     if (empty($config['highlight'])) {
         return "<pre>{$source}</pre>";
     }
     if ($config['highlight'] == 'geshi') {
         $language = str_replace('=', '', $language);
         $language = $language ? $language : $config['language'];
         $language = strtolower($language);
         if ($source = MytsSyntaxhighlight::geshi($source, $language)) {
             return $source;
         }
     }
     $source = MytsSyntaxhighlight::php($source);
     return $source;
 }
Esempio n. 2
0
 /**
  * @param MyTextSanitizer $ts
  * @param string $source
  * @param string $language
  * @return bool|mixed|string
  */
 public function load(MyTextSanitizer &$ts, $source, $language)
 {
     $config = parent::loadConfig(__DIR__);
     if (empty($config['highlight'])) {
         return "<pre>{$source}</pre>";
     }
     $source = $ts->undoHtmlSpecialChars($source);
     $source = stripslashes($source);
     if ($config['highlight'] == 'geshi') {
         $language = str_replace('=', '', $language);
         $language = $language ? $language : $config['language'];
         $language = strtolower($language);
         if ($source2 = MytsSyntaxhighlight::geshi($source, $language)) {
             return $source2;
         }
     }
     $source = MytsSyntaxhighlight::php($source);
     return $source;
 }