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

@return void
973582
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();
	}
602452
public function isTrue(): bool
    {
        return (
            in_array($this->string, ['ok']) ||
            (true === filter_var($this->string, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))
        );
    }
639656
public static function url(string $value):bool
    {
        $value = (string)$value;
        $valid = filter_var($value, FILTER_VALIDATE_URL);
        return $valid !== false;
    }
287453
private function checkForTrailingSlashRedirect()
    {
        if (!empty($this->segments) && empty($this->segments[count($this->segments) - 1])) {
            //Trim off the empty segment
            array_pop($this->segments);

            $newUrl = $this->baseHREF . '/' . implode('/', $this->segments);

            header("Location: " . $newUrl);
            exit();
        }
    }
558123
public function checkValue(&$value)
    {
        if (parent::checkValue($value) === true) {
            if (!preg_match('/^(?:from|to|(?:\d{1,2}|100)%)$/D', $value)) {
                $this->setIsValid(false);
                $this->addValidationError("Invalid value '$value' for the keyframe selector.");

                return false;
            }
            return true;
        }

        return false;
    }
864934
private function forceSlash()
    {
        // add a trailing slash to the current URL
        $url = $this->getCurrentFull() . '/';
        // if there is a query string in the current request
        $queryString = $this->getServer('QUERY_STRING');
        if (!empty($queryString)) {
            // add the query string to the redirect URL
            $url .= '?' . $queryString;
        }
        $this->redirect($url);
    }
1136804
public function isSafe() {
		if ($this->classAnnotations->has('Safe'))
			return (bool) $this->classAnnotations->get('Safe')->getValue();
		
		return false;
	}
806001
protected function isValid()
    {
        if (!$this->request->ajax()) {
            return false;
        }
        $search = $this->request->input('search');
        if (!is_string($search) or strlen($this->request->input('search')) <= 0) {
            return false;
        }
        $token = $this->request->header('search-protection');
        if (!$this->validateToken($token)) {
            return false;
        }
        return true;
    }
1124362
public function isValid($value)
    {
        if (!is_string($value) && !is_int($value) && !is_float($value)) {
            $this->_error(self::INVALID);
            return false;
        }

        $this->_setValue($value);

        if ('' === $value) {
            $this->_error(self::STRING_EMPTY);
            return false;
        }

        if (null === self::$_filter) {
            /**
             * @see Zend_Filter_Alnum
             */
            // require_once 'Zend/Filter/Alnum.php';
            self::$_filter = new Zend_Filter_Alnum();
        }

        self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;

        if ($value != self::$_filter->filter($value)) {
            $this->_error(self::NOT_ALNUM);
            return false;
        }

        return true;
    }
99130
public function url(array $options) {
        if (empty($this->elementData) || filter_var($this->elementData, FILTER_VALIDATE_URL)) {
            $this->elementData = filter_var($this->elementData, FILTER_SANITIZE_URL);
            return true;
        }

        $this->addError($this->checkMessage('Value is not a valid url', $options));
        return false;
    }
117152
public static function FILTER_SANITIZE_ID($value)
	{
		$value = mb_strtolower($value, 'UTF-8');
		$value = preg_replace('/[^\p{L}0-9]+/u', ' ', $value);
		$value = preg_replace('/\s+/', '_', trim($value));
		
		return $value?:false;
	}
1330637
public static function FILTER_SANITIZE_HTTP_URL($value)
	{
		if( !preg_match('/^http/i', $value)){
			$value = 'http://'.$value;
		}
		$value =  filter_var($value, FILTER_VALIDATE_URL);
		
		return $value?:null;	
	}
1014218
public function markRewrittenUrlObsolete()
    {
        RewritingUrlQuery::create()
            ->filterByView($this->getRewrittenUrlViewName())
            ->filterByViewId($this->getId())
            ->update(array(
                "View" => ConfigQuery::getObsoleteRewrittenUrlView()
            ));
    }
733799
protected function _validate($value)
    {
        $value = trim($value);
        return (is_string($value) && ($value === filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)));
    }
879219
protected function _sanitize($value)
    {
        //strip php tags
        $value = preg_replace('/<\\?.*(\\?>|$)/Us', '', $value);
        $value = parent::_sanitize($value);

        return $value;
    }
1054766
public function sanitize_slack_url( $value ) {
		$value = trim( (string) $value );

		if ( ! $value ) {
			return '';
		}

		$url = filter_var( $value, FILTER_VALIDATE_URL );

		if ( ! $url ) {
			add_settings_error(
				'soter_slack_url',
				'invalid_soter_slack_url',
				'Provided Slack webhook URL does not appear to be a valid URL.'
			);

			return $this->slack_url;
		}

		$host = wp_parse_url( $url, PHP_URL_HOST );

		if ( 'hooks.slack.com' !== $host ) {
			add_settings_error(
				'soter_slack_url',
				'invalid_soter_slack_url',
				sprintf(
					'Slack webhook URL host must be hooks.slack.com - given %s.',
					$host
				)
			);

			return $this->slack_url;
		}

		return $url;
	}
515477
private function check_base_url()
    {
        $url_valid = filter_var($this->baseurl, FILTER_VALIDATE_URL);
        if (!$url_valid) {
            trigger_error('The URL provided is incomplete or invalid!');

            return false;
        }

        $base_url_components = parse_url($this->baseurl);
        if (empty($base_url_components['port'])) {
            trigger_error('The URL provided does not have a port suffix, normally this is :8443');

            return false;
        }

        return true;
    }