Filter the string blocking the bad words with the blocker string.

@return string
19941
public function filter()
    {
        $bad_words = collect($this->badWords())->pluck('word')->toArray();

        return collect(explode(' ', $this->text))->map(function ($value) use ($bad_words) {
            if ($this->strict) {
                return (str_contains(strtolower($value), $bad_words)) ? $this->blockWord($value) : $value;
            }

            return in_array(strtolower($value), $bad_words) ? $this->blockWord($value) : $value;
        })->implode(' ');
    }
153013
public function getMissingText()
    {
        $missing = $this->missing ?: $this->dataFilter->getMissingTemplate();
        return U::formatString($missing, array(
            'attrib' => $this->name
        ));
    }
422021
protected function prepareWords()
    {
        $cleanHtml = HtmlPurifier::process(trim($this->content));
        $purged = preg_replace('/<[^>]+>/', ' ', $cleanHtml);
        $wordsRaw = array_unique(preg_split('/[\s,\.\n]+/', $purged));
        $allWords = [];
        foreach ($wordsRaw as $word) {
            if (mb_strlen($word, 'UTF-8') > 2 && mb_strlen($word, 'UTF-8') <= 255) {
                $allWords[] = $word;
            }
        }
        return $allWords;
    }
1350779
public function doesNotContainStringIgnoringCase()
    {
        $this->data = array(
            strtolower($this->data[0]),
            strtolower($this->data[1])
        );
        return $this->doesNotContainString();
    }
356892
public static function paranoid($string, $allowed = array())
	{
		$allow = null;
		if (!empty($allowed))
		{
			foreach ($allowed as $value)
			{
				$allow .= "\\$value";
			}
		}

		if (!is_array($string))
		{
			return preg_replace("/[^{$allow}a-zA-Z0-9]/", '', $string);
		}

		$cleaned = array();
		foreach ($string as $key => $clean)
		{
			$cleaned[$key] = preg_replace("/[^{$allow}a-zA-Z0-9]/", '', $clean);
		}

		return $cleaned;
	}
599034
public function string($data, $default = "", $options = [], $allowmarkup = false, $blacklisted = [])
    {
        //FILTER_SANITIZE_STRING
        //FILTER_SANITIZE_STRIPPED
        //\IS\HTML;
        //check custom filters and flags in options array;
        list($filter, $flags, $parameters) = $this->readFiltersAndFlags(
            $options,
            (!$allowmarkup) ? static::FILTER_STRING : static::FILTER_SPECIAL_CHARS,
            [FILTER_FLAG_STRIP_LOW, FILTER_FLAG_ENCODE_HIGH]
        );
        //push custom filters and flags from options to their respective array;

        $string = $this->scrub($data, $filter, $parameters);

        //@TODO validate is interger before return
        return (empty($string)) ? (string)$default : trim($string);
    }
1259260
public function UsageListAsString()
    {
        $pages = implode(', ', $this->Pages()->column('URLSegment'));
        $sets = implode(', ', $this->BlockSets()->column('Title'));
        $_t_pages = _t('Block.PagesAsString', 'Pages: {pages}', '', ['pages' => $pages]);
        $_t_sets = _t('Block.BlockSetsAsString', 'Block Sets: {sets}', '', ['sets' => $sets]);
        if ($pages && $sets) {
            return "$_t_pages<br />$_t_sets";
        }
        if ($pages) {
            return $_t_pages;
        }
        if ($sets) {
            return $_t_sets;
        }
    }
1158453
public function filterLanguage()
    {
        $this->lexer->moveNext();

        $node = $this->filterNode();

        // Check for end of string
        if ($this->lexer->lookahead !== null) {
            $this->syntaxError('end of string');
        }

        return $node;
    }
876771
public function sanitizeFilename()
	{
		// Regex for replacing special chars
		$filename = $this->filename;
		$filename = preg_replace('/\s+/', '_', $filename);
		$filename = preg_replace('/[^a-z1-9\.\-\_]/i', '', $filename);
		// removes any dots except the last one.
		$filename = preg_replace('/\.(?=.*?\.)/', '', $filename);
		$this->filename = $filename;

		return $this;
	}
71343
public function cleanString()
		{
			//get rid of newline holders in values
			$this->processString = str_replace('\\\\\\\\n', ' ', $this->processString);

			//replace newline holders with newline
			$this->processString = str_replace('\n', "\n", $this->processString);

			//match returns extra curly bracket at EOL, get rid of it
			$this->processString = substr($this->processString, 0, -1);

			//convert unicode encoded characters to html entities hex
			$this->processString = preg_replace('/\\\\u([0-9a-fA-F]{4})/', '&#x$1;', $this->processString);

			//get rid of escapes added for javascript
			$this->processString = stripslashes($this->processString);
		}
666760
public function filterSlug(string $string): string
    {
        return mb_strtolower(trim((string) preg_replace('~[^0-9a-z]+~i', '-', html_entity_decode((string) preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8')), '-'));
    }
1241097
public function GetQueryRestrictionForActiveFilter()
    {
        $sQuery = '';
        $sValue = $this->GetActiveValue();
        if ('1' == $sValue) {
            $sQuery = '`shop_article`.`price_reference` > 0 AND `shop_article`.`price_reference` != `shop_article`.`price` ';
        } elseif ('0' == $sValue) {
            $sQuery = '`shop_article`.`price_reference` = 0 OR `shop_article`.`price_reference` = `shop_article`.`price` ';
        }

        return $sQuery;
    }
777857
public function getInputFilterSpecification()
    {
        $spec = array();
        foreach ($this->getElements() as $element) {
            $name = (string) $element->getName();
            $spec[$name] = array(
                'name' => $name,
            );
        }
        return $spec;
    }
663047
public function getTagFiltersExpanded()
    {
        $tagFilters = $this->getTagFilters();
        if ($tagFilters === null) {
            $result = null;
        } else {
            $result = [];
            $m = null;
            foreach ($tagFilters as $tagFilter) {
                if (preg_match('/^\s*([<>=]+)\s*(\d+(?:\.\d+)?)\s*$/', $tagFilter, $m)) {
                    switch ($m[1]) {
                        case '<=':
                        case '<':
                        case '=':
                        case '>=':
                        case '>':
                            $result[] = ['operator' => $m[1], 'version' => $m[2]];
                            break;
                    }
                }
            }
        }

        return $result;
    }
740387
protected function toRtf()
	{
		$rtf = '';
		
		// if a word exists
		if ($this->word) {
			// if the word is ignored
			if ($this->isIgnored) {
				// prepend the ignored control symbol
				$rtf = '\\*';
			}
			// append the word and its parameter
			$rtf .= "\\{$this->word}{$this->parameter}";
			// if the word is space-delimited, append the space
			if ($this->isSpaceDelimited) {
				$rtf .= ' ';
			}	
		}
		
		return $rtf;
	}
408836
private function getMessage()
    {
        $ret = '';
        // Filter good messages
        $goodTypes = [ValidationResult::TYPE_GOOD, ValidationResult::TYPE_INFO];
        $good = array_filter(
            $this->result->getMessages(),
            function ($val, $key) use ($goodTypes) {
                if (in_array($val['messageType'], $goodTypes)) {
                    return true;
                }
                return false;
            },
            ARRAY_FILTER_USE_BOTH
        );
        if (!empty($good)) {
            $ret .= "GOOD: " . implode('; ', array_column($good, 'message')) . " ";
        }

        // Filter bad messages
        $badTypes = [ValidationResult::TYPE_ERROR, ValidationResult::TYPE_WARNING];
        $bad = array_filter(
            $this->result->getMessages(),
            function ($val, $key) use ($badTypes) {
                if (in_array($val['messageType'], $badTypes)) {
                    return true;
                }
                return false;
            },
            ARRAY_FILTER_USE_BOTH
        );
        if (!empty($bad)) {
            $ret .= "BAD: " . implode('; ', array_column($bad, 'message'));
        }
        return $ret;
    }
272052
protected function _filterText($text)
    {
        // return true means `yes, it's banned`
        if (is_callable($this->config('bannedWords'))) {
            $isBanned = function ($word) {
                $callable = $this->config('bannedWords');

                return $callable($word);
            };
        } else {
            $isBanned = function ($word) {
                return in_array($word, (array)$this->config('bannedWords')) || empty($word);
            };
        }

        $words = explode(' ', $text);
        foreach ($words as $i => $w) {
            if ($isBanned($w)) {
                unset($words[$i]);
            }
        }

        return implode(' ', $words);
    }