"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/formatter/class/wackoformatter.php" between
wacko.6.1.18.zip and wacko.6.1.19.zip

About: WackoWiki is a multilingual Wiki-engine that supports WYTIWYG-editing, page rights (ACLs), design themes (skins), file upload, email notification and much more.

wackoformatter.php  (wacko.6.1.18):wackoformatter.php  (wacko.6.1.19)
skipping to change at line 96 skipping to change at line 96
"<\[.*?\]>|" . "<\[.*?\]>|" .
// small text ++...++ // small text ++...++
"\+\+\S\+\+|" . "\+\+\S\+\+|" .
"\+\+(\S[^\n]*?\S)\+\+|" . "\+\+(\S[^\n]*?\S)\+\+|" .
// link ...://... or [mailto|xmpp]:...@... // link ...://... or [mailto|xmpp]:...@...
"\b[[:alpha:]]+:\/\/\S+|(mailto|xmpp)\:[[:alnum:]\-\_\.]+ \@[[:alnum:]\-\_\.]+|" . "\b[[:alpha:]]+:\/\/\S+|(mailto|xmpp)\:[[:alnum:]\-\_\.]+ \@[[:alnum:]\-\_\.]+|" .
// highlighting ??...?? // highlighting ??...??
"\?\?\S\?\?|" . "\?\?\S\?\?|" .
"\?\?(\S.*?\S)\?\?|" . "\?\?(\S.*?\S)\?\?|" .
// \\\\... // \\\\...
"\\\\\\\\[" . $object->lang['ALPHANUM_P'] . "\-\_\\\!\.]+ |" . "\\\\\\\\[" . $object::PATTERN['ALPHANUM_P'] . "\-\_\\\!\ .]+|" .
// bold text **...** // bold text **...**
"\*\*[^\n]*?\*\*|" . "\*\*[^\n]*?\*\*|" .
// code ##...## // code ##...##
"\#\#[^\n]*?\#\#|" . "\#\#[^\n]*?\#\#|" .
// code ¹¹...¹¹ // code ¹¹...¹¹
"\¹\¹[^\n]*?\¹\¹|" . "\¹\¹[^\n]*?\¹\¹|" .
// note ''...'' // note ''...''
"\'\'.*?\'\'|" . "\'\'.*?\'\'|" .
// note !!...!! // note !!...!!
"\!\!\S\!\!|" . "\!\!\S\!\!|" .
skipping to change at line 142 skipping to change at line 142
// separator // separator
"-{4,}|" . "-{4,}|" .
// line break // line break
"---\n?\s*|" . "---\n?\s*|" .
// strikethrough // strikethrough
"--\S--|" . "--\S--|" .
"--(\S.*?[^- \t\n\r])--|" . "--(\S.*?[^- \t\n\r])--|" .
// list including multilevel // list including multilevel
"\n(\t+|([ ]{2})+)(-|\*|([a-zA-Z]{1,3}|[ivIV]+|(\d{1,3})) [\.\)](\#\d{1,3})?)?|" . "\n(\t+|([ ]{2})+)(-|\*|([a-zA-Z]{1,3}|[ivIV]+|(\d{1,3})) [\.\)](\#\d{1,3})?)?|" .
// media links // media links
"file:((\.\.|!)?\/)?[\p{L}\p{Nd}][\p{L}\p{Nd}\/\-\_\.]+\. (mp4|ogv|webm|m4a|mp3|ogg|opus|avif|gif|jp(?:eg|e|g)|jxl|png|svg|webp)(\?[[:alnu m:]\&]+)?|" . "file:((\.\.|!)?\/)?[\p{L}\p{Nd}][\p{L}\p{Nd}\/\-\_\.]+\. (" . $object::PATTERN['AUDIO'] . '|' . $object::PATTERN['BITMAP'] . '|' . $objec t::PATTERN['DRAWING'] . '|' . $object::PATTERN['VIDEO'] . ")(\?[[:alnum:]\&]+)?| " .
// interwiki links // interwiki links
"\b[[:alnum:]]+:[" . $object->lang['ALPHANUM_P'] . "\!\.] [" . $object->lang['ALPHANUM_P'] . "\(\)\-\_\.\+\&\=\#]+|" . "\b[[:alnum:]]+:[" . $object::PATTERN['ALPHANUM_P'] . "\! \.][" . $object::PATTERN['ALPHANUM_P'] . "\(\)\-\_\.\+\&\=\#]+|" .
// disabled WikiNames // disabled WikiNames
"~([^ \t\n]+)|" . "~([^ \t\n]+)|" .
// wiki links (beside actions) // wiki links (beside actions)
($this->object->db->disable_wikilinks ($this->object->db->disable_wikilinks
? '' ? ''
: "(~?)(?<=[^\." . $object->lang['ALPHANUM_P'] . "]|^)(((\.\.|!)?\/)?" . $object->lang['UPPER'] . $object->lang['LOWER'] . "+" . $object->lang['UPPERNUM'] . $object->lang['ALPHANUM'] . "*)\b|") . : "(~?)(?<=[^\." . $object::PATTERN['ALPHANUM_P'] . "]|^)(((\.\.|!)?\/)?" . $object::PATTERN['UPPER'] . $object::PATTERN['LOWER'] . "+" . $object::PATTERN['UPPERNUM'] . $object::PATTERN['ALPHANUM'] . "*)\b|") .
"\n)/usm"; "\n)/usm";
$this->PRE_REGEX = $this->PRE_REGEX =
"/(" . "/(" .
// formatter %%...%% and ``...`` // formatter %%...%% and ``...``
($this->object->db->disable_formatters ($this->object->db->disable_formatters
? '' ? ''
: "``.*?``|" . : "``.*?``|" .
"\%\%.*?\%\%|") . "\%\%.*?\%\%|") .
// escaped ~... // escaped ~...
skipping to change at line 378 skipping to change at line 378
if (isset($wacko->page['page_id'])) if (isset($wacko->page['page_id']))
{ {
$this->page_id = $wacko->page['page_id']; $this->page_id = $wacko->page['page_id'];
} }
else if (isset($wacko->resync_page_id)) else if (isset($wacko->resync_page_id))
{ {
$this->page_id = $wacko->resync_page_id; $this->page_id = $wacko->resync_page_id;
} }
if (!$this->page_id || isset($wacko->new_comment)) if (!$this->page_id || $wacko->new_comment)
{ {
// for new page or comment with not yet created db record // for new page or comment with not yet created db record
// temporary random hashid for paragrafica (toc, p) // temporary random hashid for paragrafica (toc, p)
$this->page_id = substr((string) hash('crc32', (string) t ime()), 0, 5); $this->page_id = substr((string) hash('crc32', (string) t ime()), 0, 5);
} }
// convert HTML thingies // convert HTML thingies
if ($thing == '<') if ($thing == '<')
{ {
return '&lt;'; return '&lt;';
skipping to change at line 522 skipping to change at line 522
} }
return '<mark>' . preg_replace_callback($this->LONG_REGEX , $callback, $matches[1]) . '</mark>'; return '<mark>' . preg_replace_callback($this->LONG_REGEX , $callback, $matches[1]) . '</mark>';
} }
// urls // urls
else if ( preg_match('/^([[:alpha:]]+:\/\/\S+?)([^[:alnum:]^\/\( \)\-\_\=]?)$/u', $thing, $matches) else if ( preg_match('/^([[:alpha:]]+:\/\/\S+?)([^[:alnum:]^\/\( \)\-\_\=]?)$/u', $thing, $matches)
|| preg_match('/^(mailto\:[[:alnum:]\-\_\.]+\@[[: alnum:]\-\.\_]+?|xmpp\:[[:alnum:]\-\_\.]+\@[[:alnum:]\-\.\_]+?)([^[:alnum:]^\/\- \_\=]?)$/u', $thing, $matches)) || preg_match('/^(mailto\:[[:alnum:]\-\_\.]+\@[[: alnum:]\-\.\_]+?|xmpp\:[[:alnum:]\-\_\.]+\@[[:alnum:]\-\.\_]+?)([^[:alnum:]^\/\- \_\=]?)$/u', $thing, $matches))
{ {
$url = mb_strtolower($matches[1]); $url = mb_strtolower($matches[1]);
if (preg_match('/^(http|https|ftp):\/\/([^\\s\"<>]+)\.((m 4a|mp3|ogg|opus)|(avif|gif|jpg|jpe|jpeg|jxl|png|svg|webp)|(mp4|ogv|webm))$/u', $ url, $media)) if (preg_match('/^(http|https|ftp):\/\/([^\\s\"<>]+)\.((' . $wacko::PATTERN['AUDIO'] . ')|(' . $wacko::PATTERN['BITMAP'] . '|' . $wacko:: PATTERN['DRAWING'] . ')|(' . $wacko::PATTERN['VIDEO'] . '))$/u', $url, $media))
{ {
// audio // audio
if ($media[4]) if ($media[4])
{ {
return '<audio src="' . $matches[1] . '" controls></audio>' . $matches[2]; return '<audio src="' . $matches[1] . '" controls></audio>' . $matches[2];
} }
// image // image
if ($media[5]) if ($media[5])
{ {
return '<img src="' . $matches[1] . '">' . $matches[2]; return '<img src="' . $matches[1] . '">' . $matches[2];
skipping to change at line 553 skipping to change at line 553
$url = mb_substr($matches[1], 0, 30) . '[...]' . mb_substr($matches[1], -20); $url = mb_substr($matches[1], 0, 30) . '[...]' . mb_substr($matches[1], -20);
return $wacko->pre_link($matches[1], $url) . $mat ches[2]; return $wacko->pre_link($matches[1], $url) . $mat ches[2];
} }
else else
{ {
return $wacko->pre_link($matches[1], $matches[1]) . $matches[2]; return $wacko->pre_link($matches[1], $matches[1]) . $matches[2];
} }
} }
// lan path // lan path
else if (preg_match('/^\\\\\\\\([' . $wacko->lang['ALPHANUM_P'] . '\\\!\.\-\_]+)$/u', $thing, $matches)) else if (preg_match('/^\\\\\\\\([' . $wacko::PATTERN['ALPHANUM_P' ] . '\\\!\.\-\_]+)$/u', $thing, $matches))
{ {
return '<a href="file://///' . str_replace('\\', '/', $ma tches[1]) . '">\\\\' . $matches[1] . '</a>'; return '<a href="file://///' . str_replace('\\', '/', $ma tches[1]) . '">\\\\' . $matches[1] . '</a>';
} }
// citated // citated
else if (preg_match('/^\n[ \t]*(>+)(.*)$/us', $thing, $matches)) else if (preg_match('/^\n[ \t]*(>+)(.*)$/us', $thing, $matches))
{ {
return return
'<div class="email' . strlen($matches[1]) . ' ema il-' . (strlen($matches[1]) % 2 ? 'odd' : 'even') . '">' . '<div class="email' . strlen($matches[1]) . ' ema il-' . (strlen($matches[1]) % 2 ? 'odd' : 'even') . '">' .
Ut::html($matches[1]) . preg_replace_call back($this->LONG_REGEX, $callback, $matches[2]) . Ut::html($matches[1]) . preg_replace_call back($this->LONG_REGEX, $callback, $matches[2]) .
'</div>'; '</div>';
skipping to change at line 878 skipping to change at line 878
$this->br = false; $this->br = false;
} }
$result .= $this->br ? "<br>\n" : "\n"; $result .= $this->br ? "<br>\n" : "\n";
$this->br = true; $this->br = true;
return $result; return $result;
} }
// media file links // media file links
else if (preg_match('/^file:((\.\.|!)?\/)?[\p{L}\p{Nd}][\p{L}\p{N d}\/\-\_\.]+\.(mp4|ogv|webm|m4a|mp3|ogg|opus|avif|gif|jpg|jpe|jpeg|jxl|png|svg|w ebp)(\?[[:alnum:]\&]+)?$/us', $thing, $matches)) else if (preg_match('/^file:((\.\.|!)?\/)?[\p{L}\p{Nd}][\p{L}\p{N d}\/\-\_\.]+\.(' . $wacko::PATTERN['AUDIO'] . '|' . $wacko::PATTERN['BITMAP'] . '|' . $wacko::PATTERN['DRAWING'] . '|' . $wacko::PATTERN['VIDEO'] . ')(\?[[:alnu m:]\&]+)?$/us', $thing, $matches))
{ {
$caption = 0; $caption = 0;
if(!empty($matches[4]) && preg_match('/caption/ui', $matc hes[4])) if(!empty($matches[4]) && preg_match('/caption/ui', $matc hes[4]))
{ {
$caption = 2; $caption = 2;
} }
#Diag::dbg('GOLD', ' ::fileimg:: ' . $thing . ' => ' . $m atches[1] . ' -> ' . $matches[2]); #Diag::dbg('GOLD', ' ::fileimg:: ' . $thing . ' => ' . $m atches[1] . ' -> ' . $matches[2]);
return $wacko->pre_link($thing, '', true, $caption); return $wacko->pre_link($thing, '', true, $caption);
} }
// interwiki links // interwiki links
else if (preg_match('/^([[:alnum:]]+:[' . $wacko->lang['ALPHANUM_ P'] . '\!\.][' . $wacko->lang['ALPHANUM_P'] . '\(\)\-\_\.\+\&\=\#]+?)([^[:alnum: ]^\/\(\)\-\_\=]?)$/us', $thing, $matches)) else if (preg_match('/^([[:alnum:]]+:[' . $wacko::PATTERN['ALPHAN UM_P'] . '\!\.][' . $wacko::PATTERN['ALPHANUM_P'] . '\(\)\-\_\.\+\&\=\#]+?)([^[: alnum:]^\/\(\)\-\_\=]?)$/us', $thing, $matches))
{ {
#Diag::dbg('GOLD', ' ::iw:: ' . $thing . ' => ' . $matche s[1] . ' -> ' . $matches[2]); #Diag::dbg('GOLD', ' ::iw:: ' . $thing . ' => ' . $matche s[1] . ' -> ' . $matches[2]);
return $wacko->pre_link($matches[1]) . $matches[2]; return $wacko->pre_link($matches[1]) . $matches[2];
} }
// wacko links! // wacko links!
else if ((!$wacko->noautolinks) else if ((!$wacko->noautolinks)
&& (preg_match('/^(((\.\.)|!)?\/?|~)?(' . $wacko- >lang['UPPER'] . $wacko->lang['LOWER'] . '+' . $wacko->lang['UPPERNUM'] . $wacko ->lang['ALPHANUM'] . '*)$/us', $thing, $matches))) && (preg_match('/^(((\.\.)|!)?\/?|~)?(' . $wacko: :PATTERN['UPPER'] . $wacko::PATTERN['LOWER'] . '+' . $wacko::PATTERN['UPPERNUM'] . $wacko::PATTERN['ALPHANUM'] . '*)$/us', $thing, $matches)))
{ {
if ($matches[1] == '~') if ($matches[1] == '~')
{ {
return $matches[4]; return $matches[4];
} }
return $wacko->pre_link($thing); return $wacko->pre_link($thing);
} }
if (($thing[0] == '~') && ($thing[1] != '~')) if (($thing[0] == '~') && ($thing[1] != '~'))
skipping to change at line 1042 skipping to change at line 1042
$this->br = false; $this->br = false;
$wacko->header_count++; $wacko->header_count++;
$header_id = 'h' . $this->page_id . '-' . $wacko->header_cou nt; $header_id = 'h' . $this->page_id . '-' . $wacko->header_cou nt;
if ($wacko->db->section_edit if ($wacko->db->section_edit
&& $h_level > 1 && $h_level > 1
&& !isset($_POST['preview']) && !isset($_POST['preview'])
&& (in_array($wacko->method, ['addcomment', 'edit', 'show ']) || $wacko->db->ap_mode)) && (in_array($wacko->method, ['addcomment', 'edit', 'show ']) || $wacko->db->ap_mode))
{ {
$wacko->section_count++; $wacko->section_count++;
$section_tag = $wacko->section_tag ?? ($wacko->page['tag' $section_tag = $wacko->section_tag
] ?? ''); ?? (isset($wacko->page['c
omment_on_id']) && $wacko->page['comment_on_id']
? $wacko->page['t
ag']
: '');
// non-static section edit link via action // non-static section edit link via action
$section_edit = $section_edit =
'<!--notypo--><!--action:begin-->' . '<!--notypo--><!--action:begin-->' .
'editsection ' . 'editsection ' .
'page=' . '/' . $section_tag . ' ($section_tag
' . ? 'page=' . '/' . $section_tag .
' '
: '') .
'section=' . $wacko->section_coun t . 'section=' . $wacko->section_coun t .
'<!--action:end--><!--/notypo-->'; '<!--action:end--><!--/notypo-->';
} }
return $result . return $result .
'<h' . $h_level . ' id="' . $header_id . '" class="headin g">' . '<h' . $h_level . ' id="' . $header_id . '" class="headin g">' .
preg_replace_callback($this->LONG_REGEX, $callbac k, $matches[2]) . preg_replace_callback($this->LONG_REGEX, $callbac k, $matches[2]) .
'<a class="self-link" href="#' . $header_id . '"> </a>' . '<a class="self-link" href="#' . $header_id . '"> </a>' .
($section_edit ?? '') . ($section_edit ?? '') .
 End of changes. 12 change blocks. 
14 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)