LLMS_Helper_Upgrader::upgrader_package_options( array $options )

Get a real package download url for a LifterLMS add-on


Description Description

This is called immediately prior to package upgrades.


Top ↑

Parameters Parameters

$options

(array) (Required) Package option data.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: libraries/lifterlms-helper/includes/class-llms-helper-upgrader.php

	public function upgrader_package_options( $options ) {

		if ( ! isset( $options['hook_extra'] ) ) {
			return $options;
		}

		if ( isset( $options['hook_extra']['plugin'] ) ) {
			$file = $options['hook_extra']['plugin'];
		} elseif ( isset( $options['hook_extra']['theme'] ) ) {
			$file = $options['hook_extra']['theme'];
		} else {
			return $options;
		}

		$addon = llms_get_add_on( $file, 'update_file' );
		if ( ! $addon || ! $addon->is_installable() || ( $addon->requires_license() && ! $addon->is_licensed() ) ) {
			return $options;
		}

		$info = $addon->get_download_info();
		if ( is_wp_error( $info ) || ! isset( $info['data'] ) || ! isset( $info['data']['url'] ) ) {
			return $options;
		}

		if ( true === $options['package'] ) {
			$options['package'] = $info['data']['url'];
		}

		return $options;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.2.1 Correctly process addons which do not require a license (e.g. free products).
3.0.2 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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