Returns Bootstrap label markup. By default, uses `<SPAN>`.

@param string $text Text to show in label.
@param array|string $options Additional HTML attributes.
@return string HTML icon markup.
160209
public function label($text, $options = [])
    {
        if (is_string($options)) {
            $options = ['type' => $options];
        }

        $options += [
            'tag' => 'span',
            'type' => 'default',
        ];

        $classes = ['label', 'label-' . $options['type']];
        $tag = $options['tag'];
        unset($options['tag'], $options['type']);

        return $this->tag($tag, $text, $this->injectClasses($classes, $options));
    }
1209446
protected function parse_markdown( $text ) {
		static $markdown = null;

		if ( null === $markdown ) {
			$markdown = new Parsedown();
		}

		return $markdown->text( $text );
	}
418272
public static function text2icons($text)
    {
        // This is a lookbehind assertion which will exclude html entities
        // E.g. situation when ";)" in "&quot;)" shouldn't be replaced by the icon
        // It's so long because of assertion format restrictions
        $entity = '(?<!&'
            . '[a-zA-Z0-9]{2}' . '|' . '#[0-9]{2}' . '|'
            . '[a-zA-Z0-9]{3}' . '|' . '#[0-9]{3}' . '|'
            . '[a-zA-Z0-9]{4}' . '|' . '#[0-9]{4}' . '|'
            . '[a-zA-Z0-9]{5}' . '|'
            . '[a-zA-Z0-9]{6}' . '|'
            . '[a-zA-Z0-9]{7}'
            . ')';

        // map of emoticon replacements
        $map = array(
            '/(?<!mailto):D/'   => self::img_tag('smiley-laughing.gif',    ':D'    ),
            '/:-D/'             => self::img_tag('smiley-laughing.gif',    ':-D'   ),
            '/:\(/'             => self::img_tag('smiley-frown.gif',       ':('    ),
            '/:-\(/'            => self::img_tag('smiley-frown.gif',       ':-('   ),
            '/'.$entity.';\)/'  => self::img_tag('smiley-wink.gif',        ';)'    ),
            '/'.$entity.';-\)/' => self::img_tag('smiley-wink.gif',        ';-)'   ),
            '/8\)/'             => self::img_tag('smiley-cool.gif',        '8)'    ),
            '/8-\)/'            => self::img_tag('smiley-cool.gif',        '8-)'   ),
            '/(?<!mailto):O/i'  => self::img_tag('smiley-surprised.gif',   ':O'    ),
            '/(?<!mailto):-O/i' => self::img_tag('smiley-surprised.gif',   ':-O'   ),
            '/(?<!mailto):P/i'  => self::img_tag('smiley-tongue-out.gif',  ':P'    ),
            '/(?<!mailto):-P/i' => self::img_tag('smiley-tongue-out.gif',  ':-P'   ),
            '/(?<!mailto):@/i'  => self::img_tag('smiley-yell.gif',        ':@'    ),
            '/(?<!mailto):-@/i' => self::img_tag('smiley-yell.gif',        ':-@'   ),
            '/O:\)/i'           => self::img_tag('smiley-innocent.gif',    'O:)'   ),
            '/O:-\)/i'          => self::img_tag('smiley-innocent.gif',    'O:-)'  ),
            '/(?<!O):\)/'       => self::img_tag('smiley-smile.gif',       ':)'    ),
            '/(?<!O):-\)/'      => self::img_tag('smiley-smile.gif',       ':-)'   ),
            '/(?<!mailto):\$/'  => self::img_tag('smiley-embarassed.gif',  ':$'    ),
            '/(?<!mailto):-\$/' => self::img_tag('smiley-embarassed.gif',  ':-$'   ),
            '/(?<!mailto):\*/i'  => self::img_tag('smiley-kiss.gif',       ':*'    ),
            '/(?<!mailto):-\*/i' => self::img_tag('smiley-kiss.gif',       ':-*'   ),
            '/(?<!mailto):S/i'  => self::img_tag('smiley-undecided.gif',   ':S'    ),
            '/(?<!mailto):-S/i' => self::img_tag('smiley-undecided.gif',   ':-S'   ),
        );

        return preg_replace(array_keys($map), array_values($map), $text);
    }
303247
public function renderLabel(array $options = [])
    {
        $attrs['id'] = $this->getAttribute('labelId', $this->getId() . '-label');
        $attrs['class'] = $this->getAttribute('labelClass');
        $attrs['for'] = $this->getAttribute('for', $this->getId());
        $attrs['title'] = $this->getAttribute('description');

        $attrs = array_merge($attrs, (array) $this->getAttribute('labelAttribs'));

        if ($this->form && $this->form->getRenderer()) {
            return $this->form->getRenderer()->renderLabel($this, $attrs, $options);
        }

        $label = $this->getLabel();

        if ($this->required) {
            $label = '<span class="windwalker-input-required-hint">*</span> ' . $label;
        }

        return (string) new HtmlElement('label', $label, $attrs);
    }
877704
public static function label(string $text, string $icon = null, array $iconArguments = null) {
		$content = "";
		if(isset($icon)) {
			$iconString = (string)Fa::createIcon($icon, $iconArguments);
			$content .= $iconString." ";
		}
		$content .= $text;
		return Html::el()->setHtml($content);
	}
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;
    }
936567
public function tokens($text, $options = [])
    {
        self::getClient()->indices()->analyze(array_merge(['index' => $this->getName(), 'text' => $text], $options));
    }
557193
public function truncate($text, $options = array())
    {
        $default = array('length' => 300, 'read_more' => false, 'ending' => '...', 'exact' => true, 'consider_html' => false);

        $options = array_merge($default, $options);

        extract($options, EXTR_SKIP);

        if ($consider_html) {
            // if the plain text is shorter than the maximum length, return the whole text
            if (strlen(preg_replace('/<.*?>/', '', $text)) <= $length) {
                return $text;
            }

            // splits all html-tags to scanable lines
            preg_match_all('/(<.+?>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER);

            $total_length = strlen($ending);
            $open_tags = array();
            $truncate = '';

            foreach ($lines as $line_matchings) {
                // if there is any html-tag in this line, handle it and add it (uncounted) to the output
                if (!empty($line_matchings[1])) {
                    // if it's an "empty element" with or without xhtml-conform closing slash (f.e. <br/>)
                    if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) {
                        // do nothing
                    // if tag is a closing tag (f.e. </b>)
                    } elseif (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
                        // delete tag from $open_tags list
                        $pos = array_search($tag_matchings[1], $open_tags);
                        if ($pos !== false) {
                            unset($open_tags[$pos]);
                        }
                    // if tag is an opening tag (f.e. <b>)
                    } elseif (preg_match('/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
                        // add tag to the beginning of $open_tags list
                        array_unshift($open_tags, strtolower($tag_matchings[1]));
                    }
                    // add html-tag to $truncate'd text
                    $truncate .= $line_matchings[1];
                }

                // calculate the length of the plain text part of the line; handle entities as one character
                $content_length = strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', ' ', $line_matchings[2]));
                if ($total_length + $content_length > $length) {
                    // the number of characters which are left
                    $left = $length - $total_length;
                    $entities_length = 0;
                    // search for html entities
                    if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) {
                        // calculate the real length of all entities in the legal range
                        foreach ($entities[0] as $entity) {
                            if ($entity[1] + 1 - $entities_length <= $left) {
                                --$left;
                                $entities_length += strlen($entity[0]);
                            } else {
                                // no more characters left
                                break;
                            }
                        }
                    }
                    $truncate .= AnHelperString::substr($line_matchings[2], 0, $left + $entities_length);
                    // maximum lenght is reached, so get off the loop
                    break;
                } else {
                    $truncate .= $line_matchings[2];
                    $total_length += $content_length;
                }

                // if the maximum length is reached, get off the loop
                if ($total_length >= $length) {
                    break;
                }
            }
        } else {
            if (strlen($text) <= $length) {
                return $text;
            } else {
                $truncate = AnHelperString::substr($text, 0, $length - strlen($ending));
            }
        }

        // if the words shouldn't be cut in the middle...
        if (!$exact) {
            // ...search the last occurance of a space...
            $spacepos = strrpos($truncate, ' ');
            if (isset($spacepos)) {
                // ...and cut the text in this position
                $truncate = AnHelperString::substr($truncate, 0, $spacepos);
            }
        }

        // add the defined ending to the text
        $truncate .= $ending;

        if ($consider_html) {
            // close all unclosed html-tags
            foreach ($open_tags as $tag) {
                $truncate .= '</'.$tag.'>';
            }
        }

        if ($read_more) {
            $short_id = uniqid();
            $full_id = uniqid();
            $read_more = ' <a class="an-read-more" data-trigger="ReadMore" data-short="'.$short_id.'" data-full="'.$full_id.'" href="#">'.AnTranslator::_('LIB-AN-READMORE').'</a>';
            $read_less = ' <a class="an-read-less" data-trigger="ReadLess" data-short="'.$short_id.'" data-full="'.$full_id.'" href="#">'.AnTranslator::_('LIB-AN-READLESS').'</a>';
            $truncate = '<div id="'.$short_id.'">'.$truncate.$read_more.'</div>';
            $truncate .= '<div id="'.$full_id.'" class="hide">'.$text.$read_less.'</div>';
        }

        return $truncate;
    }
1355448
public static function navbarText($text, $htmlOptions = array(), $tag = 'p')
    {
        self::addCssClass('navbar-text', $htmlOptions);
        return self::tag($tag, $htmlOptions, $text);
    }
131195
public function badge($text, $options = [])
    {
        $defaults = array_merge(['class' => 'badge'], $options);
        return parent::tag('span', $text, $defaults);
    }
1351929
public function smartypants($text): Markup
    {
        $text = $this->normalizeText($text);
        return Template::raw(Typogrify::$plugin->typogrify->smartypants($text));
    }
1252938
public static function a( $text, $url = NULL, $options = [] ) {
		if ( ! is_null( $url ) ) {
			$options['href'] = $url;
		}
		
		return static::tag('a', $text, $options );
	}
578176
private function tag_get_default(string $text){
    if (
      ($this->mode === 'js') ||
      ($this->mode === 'vue')
    ){
      preg_match('/(?:\[)(.+)(?:\])/', $text, $def, PREG_OFFSET_CAPTURE);
    }
    return $def;
  }
1359582
public function text(String $text, Array $settings = []) : GD
    {
        return $this->char($text, $settings, 'string');
    }
365378
public function addIconToText($text, OptionsParser $options)
    {
        $icon = $options->consume('icon');
        $align = $options->consume('icon-align');

        if (!$icon) {
            return [$text, $options];
        }

        $icon = $this->icon($icon);

        if (empty($text)) {
            $text = $icon;
        } elseif ($align === 'right') {
            $text = sprintf('%s %s', $text, $icon);
        } else {
            $text = sprintf('%s %s', $icon, $text);
        }

        return [$text, $options];
    }
832878
public static function helpBlock($text, $htmlOptions = array())
    {
        $htmlOptions['type'] = self::HELP_TYPE_BLOCK;
        return self::help($text, $htmlOptions);
    }
673518
public function textarea(array $options, $text = '')
    {
        $label = (!empty($options['name']) ? ucwords($options['name']) : '');

        return '
            <div class="input-field">
                '.parent::plainTextarea(array_merge([
            'class' => 'materialize-textarea',
            'id'    => $this->genId($label),
        ], $options), $text).'
                '.(empty($label) | (substr($label, 0,
                1) == '_') ? '' : '<label for="'.$this->genId($label).'">'.$this->inputToRead($label).'</label>').'
            </div>';
    }