LLMS_Helper_Upgrader::pre_set_site_transient_update_things( obj $value )

Handle setting the site transient for plugin updates


Parameters Parameters

$value

(obj) (Required) Transient value.


Top ↑

Return Return

(obj)


Top ↑

Source Source

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

			$addon = llms_get_add_on( 'lifterlms-com-lifterlms' );
			if ( false !== strpos( $addon->get_channel_subscription(), 'beta' ) ) {
				remove_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 );
				$args->slug = 'lifterlms-com-lifterlms';
				$core       = true;
			}
		}

		if ( 0 !== strpos( $args->slug, 'lifterlms-com-' ) ) {
			return $response;
		}

		$response = $this->set_plugins_api( $args->slug, true );

		if ( $core ) {
			add_filter( 'plugins_api', array( $this, 'plugins_api' ), 10, 3 );
		}

		return $response;
	}

	/**
	 * Handle setting the site transient for plugin updates
	 *
	 * @since 3.0.0
	 * @since 3.0.2 Unknown.
	 *
	 * @param obj $value Transient value.
	 * @return obj
	 */
	public function pre_set_site_transient_update_things( $value ) {

		if ( empty( $value ) ) {
			return $value;
		}

		$which = current_filter();
		if ( 'pre_set_site_transient_update_plugins' === $which ) {
			$type = 'plugin';
		} elseif ( 'pre_set_site_transient_update_themes' === $which ) {
			$type = 'theme';
		} else {
			return $value;
		}

		$all_products = llms_get_add_ons( false );
		if ( is_wp_error( $all_products ) || ! isset( $all_products['items'] ) ) {
			return $value;
		}

		foreach ( $all_products['items'] as $addon_data ) {

			$addon = llms_get_add_on( $addon_data );

			if ( ! $addon->is_installable() || ! $addon->is_installed() ) {
				continue;
			}

			if ( $type !== $addon->get_type() ) {
				continue;
			}

			$file = $addon->get( 'update_file' );

			if ( 'plugin' === $type ) {

				if ( 'lifterlms-com-lifterlms' === $addon->get( 'id' ) ) {
					if ( 'stable' === $addon->get_channel_subscription() || ! $addon->get( 'version_beta' ) ) {
						continue;
					}

Top ↑

Changelog Changelog

Changelog
Version Description
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.