protected function evaluateSafenessAsURL()
	{
		$regexpInfo = RegexpParser::parse($this->vars['regexp']);

		// Match any number of "(" optionally followed by "?:"
		$captureStart = '(?>\\((?:\\?:)?)*';

		// Regexps that start with a fixed scheme are considered safe. As a special case, we
		// allow the scheme part to end with a single ? to allow the regexp "https?"
		$regexp = '#^\\^' . $captureStart . '(?!data|\\w*script)[a-z0-9]+\\??:#i';
		if (preg_match($regexp, $regexpInfo['regexp'])
		 && strpos($regexpInfo['modifiers'], 'm') === false)
		{
			$this->markAsSafeAsURL();

			return;
		}

		// Test whether this regexp could allow any character that's disallowed in URLs
		$regexp = RegexpParser::getAllowedCharacterRegexp($this->vars['regexp']);
		foreach (ContextSafeness::getDisallowedCharactersAsURL() as $char)
		{
			if (preg_match($regexp, $char))
			{
				return;
			}
		}

		$this->markAsSafeAsURL();
	}
protected function evaluateSafenessAsURL()
	{
		$regexpInfo = RegexpParser::parse($this->vars['regexp']);

		// Match any number of "(" optionally followed by "?:"
		$captureStart = '(?>\\((?:\\?:)?)*';

		// Regexps that start with a fixed scheme are considered safe. As a special case, we
		// allow the scheme part to end with a single ? to allow the regexp "https?"
		$regexp = '#^\\^' . $captureStart . '(?!data|\\w*script)[a-z0-9]+\\??:#i';
		if (preg_match($regexp, $regexpInfo['regexp'])
		 && strpos($regexpInfo['modifiers'], 'm') === false)
		{
			$this->markAsSafeAsURL();

			return;
		}

		// Test whether this regexp could allow any character that's disallowed in URLs
		$regexp = RegexpParser::getAllowedCharacterRegexp($this->vars['regexp']);
		foreach (ContextSafeness::getDisallowedCharactersAsURL() as $char)
		{
			if (preg_match($regexp, $char))
			{
				return;
			}
		}

		$this->markAsSafeAsURL();
	}
protected function evaluateSafenessAsURL ( ) { $ regexpInfo = RegexpParser :: parse ( $ this -> vars [ 'regexp' ] ) ; // Match any number of "(" optionally followed by "?:" $ captureStart = '(?>\\((?:\\?:)?)*' ; // Regexps that start with a fixed scheme are considered safe. As a special case, we // allow the scheme part to end with a single ? to allow the regexp "https?" $ regexp = '#^\\^' . $ captureStart . '(?!data|\\w*script)[a-z0-9]+\\??:#i' ; if ( preg_match ( $ regexp , $ regexpInfo [ 'regexp' ] ) && strpos ( $ regexpInfo [ 'modifiers' ] , 'm' ) === false ) { $ this -> markAsSafeAsURL ( ) ; return ; } // Test whether this regexp could allow any character that's disallowed in URLs $ regexp = RegexpParser :: getAllowedCharacterRegexp ( $ this -> vars [ 'regexp' ] ) ; foreach ( ContextSafeness :: getDisallowedCharactersAsURL ( ) as $ char ) { if ( preg_match ( $ regexp , $ char ) ) { return ; } } $ this -> markAsSafeAsURL ( ) ; }
Mark whether this filter makes a value safe to be used as a URL

@return void
Mark whether this filter makes a value safe to be used as a URL