Generates an abbreviation with a help text.
@param string $text the abbreviation.
@param string $word the word the abbreviation is for.
@param array $htmlOptions additional HTML attributes.
@return string the generated abbreviation.
16722
public static function abbr($text, $word, $htmlOptions = array())
    {
        if (TbArray::popValue('small', $htmlOptions, false)) {
            self::addCssClass('initialism', $htmlOptions);
        }
        $htmlOptions['title'] = $word;
        return self::tag('abbr', $htmlOptions, $text);
    }
329552
public function setText($text, $html = false)
    {
        $this->value = $text;
        $this->html = $html;
        $this->ajaxvalue = "";
    }
1297383
public function escape(string $text): string
    {
        $replacements = [
            '&' => '&amp;',
            '<' => '&lt;',
            '>' => '&gt;',
        ];

        return str_replace(array_keys($replacements), array_values($replacements), $text);
    }
1030005
static public function underscore($word)
 	{
 		$let = strtolower(substr($word,0,1));
 		$word = $let.substr($word,1);
		$word = preg_replace('/([A-Z])/', '_\\1', $word);
		return strtolower($word);
	}
1203016
public function writeRawData($text)
    {
        if (is_array($text)) {
            $text = implode("\n", $text);
        }

        if (method_exists($this, 'writeRaw')) {
            return $this->writeRaw(htmlspecialchars($text));
        }

        return $this->text($text);
    }
162906
public static function nl2paragraph($text)
    {
        $paragraphs = explode("\n", $text);

        foreach ($paragraphs as &$paragraph) {
            $paragraph = "<p>$paragraph</p>";
        }

        return implode('', $paragraphs);
    }
1196622
public static function highlight($text, $phrase, $html = false) {
        if(empty($phrase))
            return $text;

        if(is_string($phrase))
            $phrase = [$phrase];

        foreach($phrase as $idx => $one)
            $phrase[$idx] = self::regex($one);

        $phrase = implode('|', $phrase);
        if($html)
            $phrase = "(?![^<]+>){$phrase}(?![^<]+>)";

        return preg_replace(sprintf(self::$re, $phrase), '<span class="highlight">\1</span>', $text);
    }
474856
public function addHelpText(string $text, string $link = null, $critical = false)
    {
        if(!$link) {
            $this->help_texts[] = $text;
        }else{
            $this->help_texts[] = [$text, $link];
        }
        if($critical)
            $this->critical_help_texts = true;

        return $this;
    }
1205101
public static function simplify( string $text, string $whitespace = '+', string $any = '-' ): string {

    // lowercase
    $text = mb_convert_case( $text, MB_CASE_LOWER, 'UTF-8' );

    // change the chars
    $text = preg_replace( [
      // accented characters
      '/á/i', '/é/i', '/ű|ú|ü/i', '/ő|ó|ö/i', '/í/i',
      // whitespaces
      '/[\s]+/',
      // special characters
      '/[^\w\+]+/iu',
      // shrink multiple separators
      '/[\-]+/i', '/[\+]+/i',
      // change the separators next to each other
      '/(\-\+)|(\+\-)/i'
    ], [
      'a', 'e', 'u', 'o', 'i',
      $whitespace,
      $any,
      $any, $whitespace,
      $whitespace
    ], $text );

    // trim special chars the beginning or end of the string
    $text = trim( $text, $whitespace . $any );

    return $text;
  }
934393
private static function _getPrefix($word)
    {
        $questionMarkPosition = strpos($word, '?');
        $astrericPosition     = strpos($word, '*');

        if ($questionMarkPosition !== false) {
            if ($astrericPosition !== false) {
                return substr($word, 0, min($questionMarkPosition, $astrericPosition));
            }

            return substr($word, 0, $questionMarkPosition);
        } else if ($astrericPosition !== false) {
            return substr($word, 0, $astrericPosition);
        }

        return $word;
    }
552910
public static function quote($text, $htmlOptions = array())
    {
        $paragraphOptions = TbArray::popValue('paragraphOptions', $htmlOptions, array());
        $source = TbArray::popValue('source', $htmlOptions);
        $sourceOptions = TbArray::popValue('sourceOptions', $htmlOptions, array());
        $cite = TbArray::popValue('cite', $htmlOptions);
        $citeOptions = TbArray::popValue('citeOptions', $htmlOptions, array());
        $cite = isset($cite) ? ' ' . self::tag('cite', $citeOptions, $cite) : '';
        $source = isset($source) ? self::tag('small', $sourceOptions, $source . $cite) : '';
        $text = self::tag('p', $paragraphOptions, $text) . $source;
        return self::tag('blockquote', $htmlOptions, $text);
    }
1355448
public static function navbarText($text, $htmlOptions = array(), $tag = 'p')
    {
        self::addCssClass('navbar-text', $htmlOptions);
        return self::tag($tag, $htmlOptions, $text);
    }
356456
private static function inflect($text)
    {
        $words = \trim(\preg_replace('/[\s_-]+/', ' ', \preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));

        return \implode(' ', \array_map('ucfirst', \explode(' ', $words)));
    }
404636
public function setText($text)
	{
		if (!is_array($text) && !$text instanceof self) {
			$text = htmlspecialchars((string)$text, ENT_NOQUOTES, 'UTF-8');
		}

		return $this->setHtml($text);
	}
556314
public static function html($text, $options = [])
	{
		$config = self::_buildHtmlPurifierConfig($options);
		$htmlPurifierWhitelist  = $config->getHTMLDefinition(true);

		self::_addElementsToHtmlPurifierWhitelist($htmlPurifierWhitelist);
		self::_addAttributesToHtmlPurifierWhitelist($htmlPurifierWhitelist);

		$purifier = new \HTMLPurifier($config);

		return $purifier->purify($text);
	}
163354
function get_words($text = null, $is_html=false)
    {
        if ($is_html) {
            $text = $this->html2text($text);
        }

        if ($this->backend) {
            return $this->backend->get_words($text);
        }

        return array();
    }
271786
public function getHtml(string $text) : string
    {
        $textAsHtml = htmlspecialchars($text, ENT_QUOTES);
        $textWithNewLines = nl2br($textAsHtml);

        $tokenized = $this->tokenizer->tokenize($textWithNewLines);
        $html = $this->bbCode->format($tokenized);

        return $html;
    }