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.
Parameters Parameters
- $options
-
(array) (Required) Package option data.
Return Return
(array)
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;
}
Expand full source code Collapse full source code View on GitHub
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. |