for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace dokuwiki\ParserMode;
/**
* @fixme is this actually used?
*/
class Wordblock extends AbstractMode
{
protected $badwords = array();
protected $pattern = '';
* Wordblock constructor.
* @param $badwords
public function __construct($badwords)
$this->badwords = $badwords;
}
/** @inheritdoc */
public function preConnect()
if (count($this->badwords) == 0 || $this->pattern != '') {
return;
$sep = '';
foreach ($this->badwords as $badword) {
$this->pattern .= $sep.'(?<=\b)(?i)'.Doku_Lexer_Escape($badword).'(?-i)(?=\b)';
$sep = '|';
public function connectTo($mode)
if (strlen($this->pattern) > 0) {
$this->Lexer->addSpecialPattern($this->pattern, $mode, 'wordblock');
public function getSort()
return 250;