Removes the comment place holders from a given text.

@param string $text
@param bool $deletePlaceholders
@return string
506700
public static function removeCommentPlaceholders($text, $deletePlaceholders = false)
    {
        if (is_string($text)) {
            // Fast pre-check, to optimize performance
            if (strpos($text, "_") !== false) {
                $removeStringPlaceholders = function ($matches) use ($deletePlaceholders) {
                    if ($deletePlaceholders === true) {
                        if (isset(self::$replacements[$matches[1]])) {
                            unset(self::$replacements[$matches[1]]);
                        }
                    }
                    return "";
                };
                $text = preg_replace_callback('/(?:_COMMENT_([a-f0-9]{32})_)/', $removeStringPlaceholders, $text);
            }
            return $text;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($text). "' for argument 'text' given."
            );
        }
    }
346833
public final void setPlaceholder(String text) {
        if (!text.equalsIgnoreCase(mText)) {
            setPlaceholderTextInternal(text, mTextColor, mTextSize, true);
        }
    }
346316
public static function comment(string $text = '', bool $addSpaces = false): string
    {
        $space = $addSpaces === true ? ' ' : '';
        return \sprintf('<!--%s%s%s-->', $space, $text, $space);
    }
236042
public function commentTag($text, $options=array()){

        $data = array();
        
        $data['text'] = $text;

        $data = array_merge($data, $options);
        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');

        return $this->request($this->commentTagUrl, $data);
    }
518189
public function purge($text)
    {
        if (!$matches = $this->getMatches($text)) {
            return $text;
        }

        return str_replace($matches, '', $text);
    }
150297
public static function replacePlaceholders($string, array $replacements) {
    // Make sure the replacements don't have any unneeded newlines.
    $replacements = array_map('trim', $replacements);
    $string = strtr($string, $replacements);
    // Remove noise caused by empty placeholders.
    $lines = explode("\n", $string);
    foreach ($lines as $index => $line) {
      // Remove leading punctuation, excess whitespace.
      $line = trim(preg_replace('/^[-,]+/', '', $line, 1));
      $line = preg_replace('/\s\s+/', ' ', $line);
      $lines[$index] = $line;
    }
    // Remove empty lines.
    $lines = array_filter($lines);

    return implode("\n", $lines);
  }
541092
public function purge($text)
    {
        foreach ($this->parsers as $parser) {
            $text = $parser->purge($text);
        }

        return $text;
    }
84646
protected function stripComments()
    {
        // PHP only supports $this inside anonymous functions since 5.4
        $minifier = $this;
        $callback = function ($match) use ($minifier) {
            $count = count($minifier->extracted);
            $placeholder = '/*'.$count.'*/';
            $minifier->extracted[$placeholder] = $match[0];

            return $placeholder;
        };
        // multi-line comments
        $this->registerPattern('/\n?\/\*(!|.*?@license|.*?@preserve).*?\*\/\n?/s', $callback);
        $this->registerPattern('/\/\*.*?\*\//s', '');

        // single-line comments
        $this->registerPattern('/\/\/.*$/m', '');
    }
1201407
public function replacePlaceholders($string, $values, $quoteIfNecessary = true)
    {
        foreach ($values as $placeholder => $value) {
            $replacement = $quoteIfNecessary ? $this->quoteIfNecessary($value) : $value;
            $string = str_replace(":{$placeholder}", $replacement, $string);
        }

        return $string;
    }
536167
public function clean($text)
    {
        if (!$this->type) {
            return $text;
        }

        return static::$filter->clean($text, $this->type);
    }
494346
private static function remove_decorations( $comment ) {
		$comment = preg_replace( '|^/\*\*[\r\n]+|', '', $comment );
		$comment = preg_replace( '|\n[\t ]*\*/$|', '', $comment );
		$comment = preg_replace( '|^[\t ]*\* ?|m', '', $comment );

		return $comment;
	}
558722
protected function replace($text, $replacements)
    {
        if (is_array($replacements)) {
            foreach ($replacements as $var => $replacement) {
                $regex = str_replace('key', preg_quote($var, '/'), $this->translateReplaceRegex);
                $text = preg_replace($regex, $replacement, $text);
            }
        }
        return $text;
    }
488456
public static function cleanMsChar($text, $quotesOnly=false)
	{
		$y = array(
			"\x7f"=>'',
			"\x80"=>'&#8364;',
			"\x81"=>'',
			"\x83"=>'&#402;',
			"\x85"=>'&#8230;',
			"\x86"=>'&#8224;',
			"\x87"=>'&#8225;',
			"\x88"=>'&#710;',
			"\x89"=>'&#8240;',
			"\x8a"=>'&#352;',
			"\x8b"=>'&#8249;',
			"\x8c"=>'&#338;',
			"\x8d"=>'',
			"\x8e"=>'&#381;',
			"\x8f"=>'',
			"\x90"=>'',
			"\x95"=>'&#8226;',
			"\x96"=>'&#8211;',
			"\x97"=>'&#8212;',
			"\x98"=>'&#732;',
			"\x99"=>'&#8482;',
			"\x9a"=>'&#353;',
			"\x9b"=>'&#8250;',
			"\x9c"=>'&#339;',
			"\x9d"=>'',
			"\x9e"=>'&#382;',
			"\x9f"=>'&#376;',
		);
		$x = array(
			"\x82"=>'\'',
			"\x84"=>'"',
			"\x91"=>'\'',
			"\x92"=>'\'',
			"\x93"=>'"',
			"\x94"=>'"'
		);
		if (!$quotesOnly)
		{
			$x = $y + $x;
		}

		$text = strtr($text, $x);

		return $text;
	}
1289491
public static function cleanText(string $text)
    {
        $text = preg_replace('/<script[^>]*>.*?</script>/si', '', $text);
        $text = preg_replace('/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text);
        $text = preg_replace('/<!--.+?-->/', '', $text);
        $text = preg_replace('/{.+?}/', '', $text);
        $text = preg_replace('/&nbsp;/', ' ', $text);
        $text = preg_replace('/&amp;/', ' ', $text);
        $text = preg_replace('/&quot;/', ' ', $text);
        $text = strip_tags($text);
        $text = htmlspecialchars($text);

        return $text;
    }
1142033
public static function removeDuplicateSpaces(string $text): string
    {
        while (strpos($text, '  ') !== false) {
            $text = str_replace('  ', ' ', $text);
        }

        return $text;
    }
557140
public function filterMentions($text) {
    $mentions = $this->getMentions($text);

    foreach ($mentions as $match) {
      $mention = $this->mentionsManager->createInstance($match['type']);

      if ($mention instanceof MentionsPluginInterface) {
        $output_settings = $this->outputSettings[$match['config_name']];
        $output = $mention->outputCallback($match, $output_settings);
        $build = [
          '#theme' => 'mention_link',
          '#mention_id' => $match['target']['entity_id'],
          '#link' => $output['link'],
          '#render_link' => $output_settings['renderlink'],
          '#render_value' => $output['value'],
        ];
        $mentions = $this->renderer->render($build);
        $text = str_replace($match['source']['string'], $mentions, $text);
      }
    }

    return $text;
  }
649384
public function censorText($text)
	{
		return preg_replace_callback(
			$this->regexp,
			function ($m)
			{
				return $this->getReplacement($m[0]);
			},
			$text
		);
	}