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;
	}
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;
	}
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 ; }
Sanitize the Slack WebHook URL setting.

@param  string $value The value provided by the user.

@return string
Sanitize the Slack WebHook URL setting .