src/Http/Guard.php
public function authorized() {
		// if the rule is public, always authorized
		if ( 'public' === $this->options['rule'] ) {
			return true;
		}

		// enable passing in callback
		if ( 'callback' === $this->options['rule'] && is_callable( $this->options['callback'] ) ) {
			return call_user_func( $this->options['callback'] );
		}

		// map rule to method
		if ( method_exists( $this, $method = $this->options['rule'] ) ) {
			return $this->{$method}();
		}

		// disable in rule is misconfigused
		// @todo set up internal translations
		// @todo also, this error message kinda sucks
		return new WP_Error( '500', __( 'Guard failure', 'jaxion' ) );
	}
public function authorized() {
		// if the rule is public, always authorized
		if ( 'public' === $this->options['rule'] ) {
			return true;
		}

		// enable passing in callback
		if ( 'callback' === $this->options['rule'] && is_callable( $this->options['callback'] ) ) {
			return call_user_func( $this->options['callback'] );
		}

		// map rule to method
		if ( method_exists( $this, $method = $this->options['rule'] ) ) {
			return $this->{$method}();
		}

		// disable in rule is misconfigused
		// @todo set up internal translations
		// @todo also, this error message kinda sucks
		return new WP_Error( '500', __( 'Guard failure', 'jaxion' ) );
	}
public function authorized ( ) { // if the rule is public, always authorized if ( 'public' === $ this -> options [ 'rule' ] ) { return true ; } // enable passing in callback if ( 'callback' === $ this -> options [ 'rule' ] && is_callable ( $ this -> options [ 'callback' ] ) ) { return call_user_func ( $ this -> options [ 'callback' ] ) ; } // map rule to method if ( method_exists ( $ this , $ method = $ this -> options [ 'rule' ] ) ) { return $ this -> { $ method } ( ) ; } // disable in rule is misconfigused // @todo set up internal translations // @todo also, this error message kinda sucks return new WP_Error ( '500' , __ ( 'Guard failure' , 'jaxion' ) ) ; }
Validates whether the current user is authorized.

@return true|WP_Error
Validates whether the current user is authorized .