LLMS_Helper_Add_On::find_license()

Find a license key for the add-on


Return Return

(string|false)


Top ↑

Source Source

File: libraries/lifterlms-helper/includes/models/class-llms-helper-add-on.php

	public function find_license() {

		/**
		 * If the addon doesn't require a license return the first found license to ensure
		 * that the core can be updated via a license when subscribed to a beta channel
		 * and that the helper can always be upgraded.
		 */
		$requires_license = $this->requires_license();

		$id = $this->get( 'id' );
		foreach ( llms_helper_options()->get_license_keys() as $data ) {
			/**
			 * 1. If license is not required, return the first license found.
			 * 2. If the addon matches the licensed product
			 * 3. If the addon is included in the licensed bundle product.
			 */
			if ( ! $requires_license || $id === $data['product_id'] || in_array( $id, $data['addons'], true ) ) {
				return $data;
			}
		}

		return false;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.2.1 Use requires_license() rather than checking the add-on's has_license prop directly.
3.2.0 Use strict comparison for in_array().
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.