Tribe__Events__Aggregator__API__Origins::is_oauth_enabled( string $origin )

Returns whether oauth for a given origin is enabled.

The OAuth status for the origin is enabled on EA Service side.


Parameters

$origin

(string) (Required) The origin to check the OAuth status for.


Top ↑

Return

(boolean) Whether OAuth is enabled for the origin or not.


Top ↑

Source

File: src/Tribe/Aggregator/API/Origins.php

	public function is_oauth_enabled( $origin ) {

		if (  'eventbrite' !== $origin && ! tribe( 'events-aggregator.main' )->is_service_active() ) {
			return false;
		}

		if (  'eventbrite' === $origin && class_exists( 'Tribe__Events__Tickets__Eventbrite__Main' ) ) {
			return true;
		}

		$cached_oauth_settings = get_transient( "{$this->cache_group}_origin_oauth" );
		if ( $cached_oauth_settings && isset( $cached_oauth_settings->$origin ) ) {
			return (bool) $cached_oauth_settings->$origin;
		}

		$service_origins = $this->fetch_origin_data();

		if ( ! isset( $service_origins->oauth->$origin ) ) {
			return false;
		}

		return (bool) $service_origins->oauth->$origin;
	}