5
This solution worked in 2.5.7.1. Now I am on 2.5.9. and the additional extensions don't work anymore.
I added the extensions to class/textsanitizer/config.php or config-custom.php
"ref" => 1,
"bldwz" => 1)
Thereafter, [ref] appears in the text, it is not interpreted. This is ref.php
<?php
class MytsRef extends MyTextSanitizerExtension
{
// The code parser
public function load(&$ts)
{
$ts->patterns[] = "/[ref ([0-9]*)](.*)[/ref]/sU";
$ts->replacements[] = '<span class="refbal"> \1 <span><b>\1.</b> \2</span></span>';
$ts->patterns[] = "/[ref ([0-9]*) news=([0-9]*)](.*)[/ref]/sU";
$ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/news/article.php?storyid=\2" target="_top"><span class="refbal pointer"> \1 <span><b>\1.</b> \3</span></span></a>';
$ts->patterns[] = "/[ref ([0-9]*) smeb=([0-9]*)](.*)[/ref]/sU";
$ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/publisher/category.php?categoryid=\2" target="_top"><span class="refbal pointer"> \1 <span><b>\1.</b> \3</span></span></a>';
$ts->patterns[] = "/[ref ([0-9]*) smehf=([0-9]*)](.*)[/ref]/sU";
$ts->replacements[] = '<a href="' . XOOPS_URL . '/modules/publisher/item.php?itemid=\2" target="_top"><span class="refbal pointer"> \1 <span><b>\1.</b> \3</span></span></a>';
$ts->patterns[] = "/[ref ([0-9]*) url=(.*)](.*)[/ref]/sU";
$ts->replacements[] = '<a href="\2" target="_blank"><span class="refbal pointer"> \1 <span><b>\1.</b> \3</span></span></a>';
}
// Processing the text
public static function decode($text, $width, $height)
{
// Load config data if any
$config = parent::loadConfig( dirname(__FILE__) );
if ( empty($text) || empty($config['enabled']) ) return $text;
$ret = someFunctionToConvertTheTextToDefinedFormat($text);
return $ret;
}
}
?>
refbal is defined as class in style.css of my theme.
In the debug, there is one warning (many times repeated):
Waarschuwing: Parameter 1 to MytsRef::load() expected to be a reference, value given in bestand /class/module.textsanitizer.php regel 770
How can I get my extensions working ?
Thanks !
SMEDrieben