Execute method

@param string $text
@param int $length
@param boolean $escape
@return string
186412
public function shortText($text, $length, $escape = true)
    {
        if (!$text) {
            return '';
        }

        if ($length <= 0) {
            throw new \Zend_View_Exception('Max length text must be great then 0.');
        }

        if ($this->view && (bool) $escape) {
            $text = $this->view->escape($text);
        }
        
        if (mb_strlen($text, $this->charset) > $length) {
            return mb_substr($text, 0, $length, $this->charset) . self::END_TEXT;
        } 

        return $text;
    }
907408
public static function cutStr(string $string, int $length = 9, string $dot = '...', string $char = 'utf8'): string {
		return (mb_strlen($string) > $length) ? mb_substr($string, 0, $length, $char) . $dot : $string;
	}
83624
private function truncate($text, $length, $suffix = '...')
    {
        $computedLength = $length - strlen($suffix);

        return strlen($text) > $computedLength ? substr($text, 0, $computedLength) . $suffix : $text;
    }
616012
public function asSecret(StringLength $length = null)
    {
        $this->checkDefaultType(function() { return ($this->default instanceof Secret); }, Secret::class);
        return $this->default;
    }
91556
def _escapeText(text):
	
	output = ""
	index = 0
	match = reCharsToEscape.search(text, index)
	while match:
		output = output + text[index:match.start()] + '\\' + text[match.start()]
		index = match.end()
		match = reCharsToEscape.search(text, index)
	output = output + text[index:]
	return output
1053810
public static function compare($string, $value, $length = 0) {
        $string = (string) $string;
        $value = (string) $value;

        if ($length > 0) {
            return strncasecmp($string, $value, $length);
        }

        return strcasecmp($string, $value);
    }
406054
public static function truncate(
        $string,
        $length,
        $suffix = '',
        $wordBreak = true,
        $encoding = null
    ) {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        if ($length >= Mbstring::strlen($string, $encoding)) {
            return $string;
        }

        $result = Mbstring::substr($string, 0, $length, $encoding);

        if (!$wordBreak && Mbstring::strpos($result, ' ', 0, $encoding) !== $length) {
            $position = Mbstring::strrpos($result, ' ', 0, $encoding);
            $result = Mbstring::substr($result, 0, $position, $encoding);
        }

        return $result . $suffix;
    }
258366
public function right($text, $length)
    {
        if (!$this->isValidLength($text, $length)) return $text;

        $textLength = strlen($text);

        return \substr($text, $textLength - $length, $textLength);
    }
86490
public function escape($text, $extra = false)
    {
        if (is_int($text) || is_float($text)) {
            return $text;
        }

        $text = str_replace("'", "''", $text);

        return addcslashes($text, "\000\n\r\\\032");
    }
150361
public function truncate($length, $substring = '') {
		if ($this->length() <= $length) {
			return new Text($this->string, $this->encoding);
		}

		$substrLen = mb_strlen($substring, $this->encoding);

		if ($this->length() + $substrLen > $length) {
			$length -= $substrLen;
		}

		return $this->substring(0, $length)->append($substring);
	}
48971
public static function escape($string, $context = 'html')
    {
        $method = 'escape'.ucfirst($context);

        if(!method_exists(__CLASS__, $method)) {
            throw new \InvalidArgumentException(sprintf('Cannot escape to: %s. Unknow context.', $context));
        }

        return static::$method($string);
    }
1349853
public static function shortenThis($str, int $length = null): string
    {
        if (!$length) {
            $length = 255;
        }

        if ($length > 255) {
            throw new \ErrorException('The length argument should be 255 or less.');
        }

        /**
         * [:space:] removes \t as well
         * http://stackoverflow.com/questions/2326125/remove-multiple-whitespaces
         * http://www.php.net/manual/en/regexp.reference.character-classes.php
         */
        $str = mb_ereg_replace(
            '[[:space:]]+',
            ' ',
            strip_tags($str),
            'ms'
        );
        $length = abs((int)$length - 1);

        /**
         * allow to only remove all special chars and html entities without shortening the string
         */
        if ($length === null) {
            return $str;
        }

        if (\strlen($str) > $length) {
            $str = mb_ereg_replace(
                '^(.{1,' . $length . '})([^\s]+)(\s.*|$)',
                '\\1\\2…',
                $str, 'ms'
            );
        }

        return $str;
    }
1294277
def _escape(self, text):
        """"""
        ret = EMPTYSTRING if text is None else str(text)
        if self.escape:
            return html_escape(ret)
        else:
            return ret
1294080
public function execute($text = null)
    {
        if ($this->cache instanceof \Zend_Cache_Core) {
            $this->cache->clean(\Zend_Cache::CLEANING_MODE_ALL);
            $this->getBatch()->addMessage($this->_('Cache cleaned'));
        }
    }
589271
static function Escape($str, $escapeQuotes = false)
	{
		if ($escapeQuotes)
		{
			$str = str_replace(VerySimpleXmlUtil::$replacementsAttrib,VerySimpleXmlUtil::$replacementsTempAttrib,$str);
			$str = str_replace(VerySimpleXmlUtil::$reservedAttrib,VerySimpleXmlUtil::$replacementsAttrib,$str);
			$str = str_replace(VerySimpleXmlUtil::$replacementsTempAttrib,VerySimpleXmlUtil::$replacementsAttrib,$str);
		}
		else
		{
			$str = str_replace(VerySimpleXmlUtil::$replacementsText,VerySimpleXmlUtil::$replacementsTempText,$str);
			$str = str_replace(VerySimpleXmlUtil::$reservedText,VerySimpleXmlUtil::$replacementsText,$str);
			$str = str_replace(VerySimpleXmlUtil::$replacementsTempText,VerySimpleXmlUtil::$replacementsText,$str);
		}
		return $str;
	}
197883
public static function escapeLike($string, $escapeChar = '=')
    {
        return str_replace(
            [
                $escapeChar,
                '_',
                '%',
            ],
            [
                $escapeChar . $escapeChar,
                $escapeChar . '_',
                $escapeChar . '%',
            ],
            $string
        );
    }
81765
public function escapeLikeString(string $input, bool $quote = true, bool $escape = true): string
    {
        if ($escape) {
            $input = $this->escapeString($input, $quote);
        }

        return addcslashes($input, '%_');
    }