|'),
'since' => '1',
'seprator' => '|',
'filter' => 'text',
'default' => '',
],
'first' => [
'required' => false,
'name' => tra('First'),
'description' => tra('Cells specified are ordered first left to right across rows (default) or top to
bottom down columns'),
'since' => '1',
'filter' => 'alpha',
'default' => 'line',
'options' => [
['text' => '', 'value' => ''],
['text' => tra('Column'), 'value' => 'col'],
['text' => tra('Line'), 'value' => 'line']
]
],
'edit' => [
'required' => false,
'name' => tra('Editable'),
'description' => tr('Display edit icon for each section. Works when used on a wiki page and the %0
parameter is set to %1', 'first', 'col'),
'since' => '1',
'filter' => 'alpha',
'default' => 'n',
'options' => [
['text' => '', 'value' => ''],
['text' => tra('Yes'), 'value' => 'y'],
['text' => tra('No'), 'value' => 'n']
]
],
'customclass' => [
'required' => false,
'name' => tra('Custom Class'),
'description' => tra('Add a class to customize the design'),
'since' => '3.0',
'filter' => 'text',
'default' => '',
],
],
];
}
function wikiplugin_split_rollback($data, $hashes)
{
foreach ($hashes as $hash => $match) {
$data = str_replace($hash, $match, $data);
}
return $data;
}
/*
* \note This plugin should carefuly change text it have to parse
* because some of wiki syntaxes are sensitive for
* start of new line ('\n' character - e.g. lists and headers)... such
* user lines must stay with the same layout when applying
* this plugin to render them properly after...
* $data = the preparsed data (plugin, code, np.... already parsed)
* $pos is the position in the object where the non-parsed data begins
*/
function wikiplugin_split($data, $params, $pos)
{
global $tikilib, $tiki_p_admin_wiki, $tiki_p_admin, $section;
global $replacement;
preg_match_all('/{(SPLIT|CODE|HTML|FADE|JQ|JS|MOUSEOVER|VERSIONS).+{\1}/ismU', $data, $matches);
$hashes = [];
foreach ($matches[0] as $match) {
if (empty($match)) {
continue;
}
$hash = md5($match);
$hashes[$hash] = $match;
$data = str_replace($match, $hash, $data);
}
// Remove first | '
// Insert "\n" at data begin (so start-of-line-sensitive syntaxes will be parsed OK)
. "\n"
// now prepend any carriage return and newline char with br
. preg_replace("/\r?\n/", " \r\n", $i) . ' | ';
}
$result .= "
| ';
foreach ($r as $i) {
if (substr($i, 0, 2) == "\r\n") {
$i = substr($i, 2);
$ind += 2;
}
if ($edit == 'y' && $perm && $section == 'wiki page') {
$result .= ' ';
$result .= "$pos-$icell-" . htmlspecialchars(substr($data, $pos, 10));
$result .= ''
. ' '; $ind += strlen($i); while (isset($data[$ind]) && ($data[$ind] == '-' || $data[$ind] == '@')) { ++$ind; } } else { $result .= ' ';
}
$result .= "\n" . preg_replace("/\r?\n/", " ';
++$icell;
}
++$idx;
$result .= '\r\n", $i) . ' | ';
}
$result .= '
|\\';
$no_parsed_end = '';
$match = '@@@+|----*|\{SPLIT\}|\{SPLIT\(|~np~|~pp~|\\|\\';
while (true) {
if (! preg_match("#($match)#m", substr($data, $pos), $matches)) {
if ($cell) {
$end = $start;
}
break;
} else {
$end = $pos + strpos(substr($data, $pos), $matches[1]);
$start_next_tag = $end + strlen($matches[1]);
if (substr($matches[1], 0, 3) == '@@@' || $matches[1] == '---') {
if (! $cell) {
break;
}
--$cell;
if (! $cell) {
$start = $start_next_tag;
}
} elseif ($matches[1] == $match) {
$match = '@@@+|----*|\{SPLIT\}|\{SPLIT\(|~np~|~pp~|\\|\\';
} elseif ($matches[1] == '{SPLIT}') {
if (! $cell) {
break;
}
} elseif ($matches[1] == '{SPLIT(') {
$match = '{SPLIT}';
} elseif ($matches[1] == '~np~') {
$match = '~/np~';
} elseif ($matches[1] == '~pp~') {
$match = '~/pp~';
} elseif ($matches[1] == '') {
$match = '';
} elseif ($matches[1] == '') {
$match = '';
}
$pos = $start_next_tag;
}
}
return [$start, $end - $start];
}