Compile Sword section stop statements into valid PHP.

@param  string  $value
@return string
556658
protected function compileSectionStop($value)
	{
		$pattern = $this->createPlainMatcher('stop');

		$value = preg_replace($pattern, '$1<?php $__env->stopSection(); ?>$2', $value);

		$pattern = $this->createPlainMatcher('endsection');

		return preg_replace($pattern, '$1<?php $__env->stopSection(); ?>$2', $value);
	}
754084
public function compileString($value)
    {
        if (strpos($value, '@verbatim') !== false) {
            $value = $this->storeVerbatimBlocks($value);
        }

        $this->footer = [];

        if (strpos($value, '@php') !== false) {
            $value = $this->storePhpBlocks($value);
        }

        $result = '';

        // Here we will loop through all of the tokens returned by the Zend lexer and
        // parse each one into the corresponding valid PHP. We will then have this
        // template as the correctly rendered PHP that can be rendered natively.
        foreach (token_get_all($value) as $token) {
            $result .= is_array($token) ? $this->parseToken($token) : $token;
        }

        if (! empty($this->rawBlocks)) {
            $result = $this->restoreRawContent($result);
        }

        // If there are any footer lines that need to get added to a template we will
        // add them here at the end of the template. This gets used mainly for the
        // template inheritance via the extends keyword that should be appended.
        if (count($this->footer) > 0) {
            $result = $this->addFooters($result);
        }

        return $result;
    }
1119176
public static function stripInvalidXMLCharacters($value)
    {
        if (Lang::isUnicodeCompiled()) {
            return preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $value);
        } else {
            $ret = '';

            if (empty($value)) {
                return $ret;
            }

            $length = strlen($value);

            for ($i=0; $i < $length; $i++) {
                $current = ord($value{$i});
                if (($current == 0x9) ||
                    ($current == 0xA) ||
                    ($current == 0xD) ||
                    (($current >= 0x20) && ($current <= 0xD7FF)) ||
                    (($current >= 0xE000) && ($current <= 0xFFFD)) ||
                    (($current >= 0x10000) && ($current <= 0x10FFFF))) {
                    $ret .= chr($current);
                }
            }

            return $ret;
        }
    }
707978
public function compileString($value)
    {
        if (is_null(static::$cssFilesContent)) {
            static::$cssFilesContent = $this->getCssFilesContent($this->cssFiles);
        }

        return parent::compileString($this->convertStyles($value));
    }
1158745
public static function prep_value($value) {
		if (\is_array($value)) {
			$value=implode(",", $value);
		}
		if (self::containsCode($value)===false) {
			$value=\str_replace(["\\","\""], ["\\\\","\\\""], $value);
			$value='"'.$value.'"';
		}
		return trim($value,"%");
	}
373490
public function esc(?string $value): string
    {
        if ($value === null) {
            return 'NULL';
        }

        $value = substr($this->pdo->quote($value), 1, -1);

        return $value;
    }
845899
protected function prepareRegexRule($value)
    {
        $escape = ['$' => '\$', '?' => '\?', '.' => '\.', '*' => '.*'];
        foreach ($escape as $search => $replace) {
            $value = str_replace($search, $replace, $value);
        }
        if (mb_strlen($value) > 2 && mb_substr($value, -2) == '\$') {
            $value = substr($value, 0, -2) . '$';
        }
        if (mb_strrpos($value, '/') == (mb_strlen($value) - 1)
            || mb_strrpos($value, '=') == (mb_strlen($value) - 1)
            || mb_strrpos($value, '?') == (mb_strlen($value) - 1)
        ) {
            $value .= '.*';
        }

	    if (substr($value, 0, 2) != '.*') {
		    $value = '^' . $value;
	    }
        return $value;
    }
1270771
protected function compileString($value)
    {
        $result = '';

        // Block raw php
        if (strpos($value, '@php') !== false) {
            $value = $this->storePhpBlocks($value);
        }

        foreach (token_get_all($value) as $token) {
            $result .= is_array($token) ? $this->parseToken($token) : $token;
        }

        return $result;
    }
1020075
protected static function pad($value)
        {
            $pad = static::$block - (Inflector::length($value) % static::$block);
            return $value .= str_repeat(chr($pad), $pad);
        }
83645
protected function wrap($value)
    {
        if ($value instanceof Expression) {
            return $this->handleExpressions($value->getExpressions());
        }

        $wrapped = [];

        foreach (explode('.', $value) as $segment) {
            if ($segment == '*') {
                $wrapped[] = $segment;
            } else {
                $wrapped[] = sprintf($this->wrapper, $segment);
            }
        }

        return implode('.', $wrapped);
    }
1009225
public function sanitize($value)
    {
        $value = JApplicationHelper::stringURLSafe($value);

        //limit length
        if (mb_strlen($value) > $this->_length) {
            $value = mb_substr($value, 0, $this->_length);
        }

        return $value;
    }
957570
protected function preventXss($value)
    {
        $string = strtolower( html_entity_decode( $value ) );

        if (strpos($string, '<script>') !== false) {
            $value = '';
        }

        if (strpos($string, 'javascript') !== false) {
            $value = '';
        }

        if (strpos($string, 'fromcharcode') !== false) {
            $value = '';
        }

        if (strpos($string, '&#x') !== false) {
            $value = '';
        }

        return $value;
    }
406340
public function asCode($value)
    {
        $topLevel = true;
        if (func_num_args() > 1 && false === func_get_arg(1)) {
            $topLevel = false;
        }

        $inlineList = false;
        if (func_num_args() > 2) {
            $inlineList = func_get_arg(2);
        }

        if ($value instanceof Annotation) {
            $value = (string) $value;
        } elseif (is_bool($value)) {
            $value = $value ? 'true' : 'false';
        } elseif (is_string($value)) {
            $value = '"'.$value.'"';
        } elseif (is_array($value)) {
            $tmp = array();
            $useKey = !$this->isKeysNumeric($value);
            foreach ($value as $k => $v) {
                // skip null value
                if (null === $v) {
                    continue;
                }
                $v = $this->asCode($v, false, true);
                if (false === $topLevel) {
                    $k = sprintf('"%s"', $k);
                }

                $tmp[] = $useKey ? sprintf("%s%s%s", $k, ($inlineList ? ':' : '='), $v) : $v;
            }
            $multiline = $this->getOption('multiline') && count($value) > 1;
            $value = implode($multiline ? ",\n" : ', ', $tmp).($multiline ? "\n" : '');
            if ($topLevel) {
                $value = sprintf('(%s)', $value);
            } else {
                $value = sprintf('{%s}', $value);
            }
            if ($multiline) {
                $value = $this->wrapLines($value, 1);
            }
        }

        return $value;
    }
912539
protected function compileRegularEchos($value)
    {
        $pattern = sprintf('/(@)?%s\s*(.+?)\s*%s(\r?\n)?/s', $this->contentTags[0], $this->contentTags[1]);

        $callback = function($matches)
        {
            $whitespace = empty($matches[3]) ? '' : $matches[3] .$matches[3];

            return $matches[1] ? substr($matches[0], 1) : '<?php echo ' .$this->compileEchoDefaults($matches[2]) .'; ?>' .$whitespace;
        };

        return preg_replace_callback($pattern, $callback, $value);
    }
1043499
static public function stripslashes($value) 
    {
        if(!is_array($value)) {
            return stripslashes($value);
        }
        foreach($value as $key => $val) {
            $value[$key] = static::stripslashes($val);
        }
        return $value;
    }
691332
protected function compileEscapedEchos($value)
	{
		$me = $this;

		$pattern = sprintf('/%s\s*(.+?)\s*%s/s', $this->escapedTags[0], $this->escapedTags[1]);

		$callback = function($matches) use ($me)
		{
			return '<?php echo e('.$me->compileEchoDefaults($matches[1]).'); ?>';
		};

		return preg_replace_callback($pattern, $callback, $value);
	}
982042
static public function formatSearch($value)
    {
        $value = static::filter_xss($value);
        $value = static::html_entities($value);
        $value = str_replace('&lt;', '', $value);
        $value = str_replace('&gt;', '', $value);
        $value = static::sql_encode($value);
        $value = trim($value);
        
        return $value;
    }