74 if (
false === strpos(
$path,
'/')) {
75 if (is_dir(
$ts->path_basic .
'/' .
$path)) {
78 if (is_dir(
$ts->path_plugin .
'/' .
$path)) {
84 $config_default = array();
85 $config_custom = array();
92 return self::mergeConfig($config_default, $config_custom);
104 if (is_array($config_custom)) {
105 foreach ($config_custom as $key => $val) {
106 if (array_key_exists($key, $config_default) and is_array($config_default[$key])) {
107 $config_default[$key] = self::mergeConfig($config_default[$key], $config_custom[$key]);
109 $config_default[$key] = $val;
113 return $config_default;
221 $config_default =
include $this->path_basic .
'/config.php';
222 $config_custom = array();
226 return $this->
mergeConfig($config_default, $config_custom);
236 if (is_array($config_custom)) {
237 foreach ($config_custom as $key => $val) {
238 if (isset($config_default[$key]) && is_array($config_default[$key])) {
239 $config_default[$key] = $this->
mergeConfig($config_default[$key], $config_custom[$key]);
241 $config_default[$key] = $val;
245 return $config_default;
257 if (!isset($instance)) {
259 $instance =
new $class();
293 return $match[1].
"<a href=\"$match[2]://$match[3]\" title=\"$match[2]://$match[3]\" rel=\"external\">$match[2]://".$this->
truncate( $match[3] ).
'</a>';
298 return $match[1] .
"<a href=\"http://www.$match[2]$match[6]\" title=\"www.$match[2]$match[6]\" rel=\"external\">" .$this->truncate(
'www.'.$match[2].$match[6]) .
'</a>';
303 return $match[1].
"<a href=\"ftp://ftp.$match[2].$match[3]\" title=\"ftp.$match[2].$match[3]\" rel=\"external\">" . $this->
truncate(
'ftp.'.$match[2].$match[3]) .
'</a>';
308 return $match[1].
"<a href=\"mailto:$match[2]@$match[3]\" title=\"$match[2]@$match[3]\">" .$this->truncate($match[2].
"@".$match[3]) .
'</a>';
319 $valid_chars =
"a-z0-9\/\-_+=.~!%@?#&;:$\|";
320 $end_chars =
"a-z0-9\/\-_+=~!%@?#&;:$\|";
343 $pattern =
"/(^|[^]_a-z0-9-=\"'\/])([a-z]+?):\/\/([{$valid_chars}]+[{$end_chars}])/i";
344 $text = preg_replace_callback($pattern,
'self::makeClickableCallback01',
$text);
346 $pattern =
"/(^|[^]_a-z0-9-=\"'\/:\.])www\.((([a-zA-Z0-9\-]*\.){1,}){1}([a-zA-Z]{2,6}){1})((\/([a-zA-Z0-9\-\._\?\,\'\/\\+&%\$#\=~])*)*)/i";
347 $text = preg_replace_callback($pattern,
'self::makeClickableCallback02',
$text);
350 $pattern =
"/(^|[^]_a-z0-9-=\"'\/])ftp\.([a-z0-9\-]+)\.([{$valid_chars}]+[{$end_chars}])/i";
351 $text = preg_replace_callback($pattern,
'self::makeClickableCallback03',
$text);
353 $pattern =
"/(^|[^]_a-z0-9-=\"'\/:\.])([-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+)@((?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?)/i";
354 $text = preg_replace_callback($pattern,
'self::makeClickableCallback04',
$text);
368 if (empty(
$text) || empty($instance->config[
'truncate_length']) || strlen(
$text) < $instance->config[
'truncate_length']) {
371 $len = (((strlen(
$text) - $instance->config[
'truncate_length']) - 5) / 2);
373 $ret = substr(
$text, 0, $len) .
' ... ' . substr(
$text, -$len);
375 $ret = substr(
$text,0,$instance->config[
'truncate_length']);
392 $patterns[] =
"/\[siteurl=(['\"]?)([^\"'<>]*)\\1](.*)\[\/siteurl\]/sU";
394 $patterns[] =
"/\[url=(['\"]?)(http[s]?:\/\/[^\"'<>]*)\\1](.*)\[\/url\]/sU";
395 $replacements[] =
'<a href="\\2" rel="external" title="">\\3</a>';
396 $patterns[] =
"/\[url=(['\"]?)(ftp[s]?:\/\/[^\"'<>]*)\\1](.*)\[\/url\]/sU";
397 $replacements[] =
'<a href="\\2" rel="external" title="">\\3</a>';
398 $patterns[] =
"/\[url=(['\"]?)([^'\"<>]*)\\1](.*)\[\/url\]/sU";
399 $replacements[] =
'<a href="http://\\2" rel="external" title="">\\3</a>';
400 $patterns[] =
"/\[color=(['\"]?)([a-zA-Z0-9]*)\\1](.*)\[\/color\]/sU";
402 $patterns[] =
"/\[size=(['\"]?)([a-z0-9-]*)\\1](.*)\[\/size\]/sU";
403 $replacements[] =
'<span style="font-size: \\2;">\\3</span>';
404 $patterns[] =
"/\[font=(['\"]?)([^;<>\*\(\)\"']*)\\1](.*)\[\/font\]/sU";
405 $replacements[] =
'<span style="font-family: \\2;">\\3</span>';
406 $patterns[] =
"/\[email]([^;<>\*\(\)\"']*)\[\/email\]/sU";
417 $patterns[] =
"/\[center](.*)\[\/center\]/sU";
418 $replacements[] =
'<div style="text-align: center;">\\1</div>';
419 $patterns[] =
"/\[left](.*)\[\/left\]/sU";
420 $replacements[] =
'<div style="text-align: left;">\\1</div>';
421 $patterns[] =
"/\[right](.*)\[\/right\]/sU";
422 $replacements[] =
'<div style="text-align: right;">\\1</div>';
428 $this->
config[
'allowimage'] = $allowimage;
431 $text = preg_replace($this->patterns, $this->replacements, $this->text);
436 $text = preg_replace_callback($this->callbackPatterns[
$i], $this->callbacks[$i] ,
$text);
452 $pattern =
"/\[quote](.*)\[\/quote\]/sU";
453 $replacement =
XoopsLocale::C_QUOTE .
'<div class="xoopsQuote"><blockquote>\\1</blockquote></div>';
478 $patterns[] =
"/\bj{$c}a{$c}v{$c}a{$c}s{$c}c{$c}r{$c}i{$c}p{$c}t{$c}[\s]*:/si";
480 $patterns[] =
"/\ba{$c}b{$c}o{$c}u{$c}t{$c}[\s]*:/si";
482 $patterns[] =
"/\bx{$c}s{$c}s{$c}[\s]*:/si";
496 return preg_replace(
'/(\015\012)|(\015)|(\012)/',
'<br />',
$text);
507 if (!get_magic_quotes_gpc()) {
521 if (get_magic_quotes_gpc()) {
538 if (version_compare(phpversion(),
'5.2.3',
'>=')) {
541 $text = htmlspecialchars(
$text, $quote_style);
543 return preg_replace(array(
'/&/i' ,
'/ /i'), array(
'&' ,
'&nbsp;'),
$text);
554 return preg_replace(array(
'/>/i' ,
'/</i' ,
'/"/i' ,
'/'/i' ,
'/&nbsp;/i'), array(
'>' ,
'<' ,
'"' ,
'\'' ,
" "),
$text);
594 if (!empty($this->
config[
'filterxss_on_display'])) {
627 if ($ret ===
false) {
645 $patterns =
"/\[code([^\]]*?)\](.*)\[\/code\]/sU";
647 function ($matches) {
648 return '[code' . $matches[1] .
']' . base64_encode($matches[2]).
'[/code]';
659 return '<div class=\"xoopsCode\">'. $this->
executeExtension(
'syntaxhighlight', str_replace(
'\\\"',
'\"', base64_decode($match[2])), $match[1]).
'</div>';
675 $patterns =
"/\[code([^\]]*?)\](.*)\[\/code\]/sU";
689 $extensions = array_filter($this->
config[
'extensions']);
690 if (empty($extensions)) {
693 foreach (array_keys($extensions) as $extension) {
714 $class =
'Myts' . ucfirst($name);
715 if (!class_exists($class,
false)) {
716 trigger_error(
"Extension '{$name}' does not exist", E_USER_WARNING);
720 $extension =
new $class($this);
733 if (!$extension)
return false;
734 $args = array_slice(func_get_args(), 1);
735 return call_user_func_array(array($extension ,
'load'), array_merge(array(&$this), $args));
749 if ($ret ===
false) {
codePreConv($text, $xcode=1)
static decode($url, $width, $height)
previewTarea($text, $html=0, $smiley=1, $xcode=1, $image=1, $br=1)
if(empty($image_id)) $image
textFilter($text, $force=false)
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
makeClickableCallback03($match)
if(!$xoops->security() ->validateToken(@$_POST['token'], false)) $html
static mergeConfig($config_default, $config_custom)
codeConv($text, $xcode=1)
mergeConfig($config_default, $config_custom)
makeClickableCallback02($match)
defined('DS') or define('DS' DIRECTORY_SEPARATOR
if(DIRECTORY_SEPARATOR!="/") $xoops_root_path
htmlSpecialChars($text, $quote_style=ENT_QUOTES, $charset=null, $double_encode=true)
__construct(MyTextSanitizer &$ts)
undoHtmlSpecialChars($text)
makeClickableCallback01($match)
displayTarea($text, $html=0, $smiley=1, $xcode=1, $image=1, $br=1)
static loadConfig($path=null)
xoopsCodeDecode(&$text, $allowimage=1)
makeClickableCallback04($match)