Tribe__PUE__Checker::license_key_status( array $query_args )

Returns plugin/license key data based on the provided query arguments.

Calling this method will also take care of setting up admin notices for any keys that are invalid or have expired, etc.

See also


Top ↑

Parameters

$query_args

(array) (Required) Additional query arguments to append to the request.


Top ↑

Return

(Tribe__PUE__Plugin_Info|null)


Top ↑

Source

File: src/Tribe/PUE/Checker.php

		public function license_key_status( $query_args ) {
			$pue_notices = Tribe__Main::instance()->pue_notices();
			$plugin_info = $this->request_info( $query_args );
			$plugin_name = empty( $this->plugin_name ) ? $this->get_plugin_name() : $this->plugin_name;

			if ( empty( $plugin_name ) ) {
				return $plugin_info;
			}

			$install_key = $this->get_key();

			// Check for expired keys
			if ( ! empty( $plugin_info->api_expired ) ) {
				$pue_notices->add_notice( Tribe__PUE__Notices::EXPIRED_KEY, $plugin_name );
			} elseif ( ! empty( $plugin_info->api_upgrade ) ) {
				// Check for keys that are out of installs (*must* happen before the api_invalid test)
				$pue_notices->add_notice( Tribe__PUE__Notices::UPGRADE_KEY, $plugin_name );
			} elseif (
				// Check for invalid keys last of all (upgrades/empty keys will be flagged as invalid)
				! empty( $plugin_info->api_invalid )
				&& (
					'component' === $this->context
					|| (
						'service' === $this->context
						&& $install_key
					)
				)
			) {
				$pue_notices->add_notice( Tribe__PUE__Notices::INVALID_KEY, $plugin_name );
			} else {
				// If none of the above were satisfied we can assume the key is valid
				$pue_notices->clear_notices( $plugin_name );
			}

			return $plugin_info;
		}