Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Helper_Upgrader::set_plugins_api( string $id, bool $include_sections = true )

Setup an object of addon data for use when requesting plugin information normally acquired from wp.org.


Parameters Parameters

$id

(string) (Required) Addon id.

$include_sections

(bool) (Optional) Whether or not to include additional sections like the description and changelog.

Default value: true


Top ↑

Return Return

(object)


Top ↑

Source Source

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

	private function set_plugins_api( $id, $include_sections = true ) {

		$addon = llms_get_add_on( $id );

		if ( 'lifterlms-com-lifterlms' === $id && false !== strpos( $addon->get_latest_version(), 'beta' ) ) {

			require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
			$item              = plugins_api(
				'plugin_information',
				array(
					'slug'   => 'lifterlms',
					'fields' => array(
						'banners' => true,
						'icons'   => true,
					),
				)
			);
			$item->version     = $addon->get_latest_version();
			$item->new_version = $addon->get_latest_version();
			$item->package     = true;

			unset( $item->versions );

			$item->sections['changelog'] = $this->get_changelog_for_api( $addon );

			return $item;

		}

		$item = array(
			'name'           => $addon->get( 'title' ),
			'slug'           => $id,
			'plugin'         => $addon->get( 'update_file' ),
			'version'        => $addon->get_latest_version(),
			'new_version'    => $addon->get_latest_version(),
			'author'         => '<a href="https://lifterlms.com/">' . $addon->get( 'author' )['name'] . '</a>',
			'author_profile' => $addon->get( 'author' )['link'],
			'requires'       => $addon->get( 'version_wp' ),
			'tested'         => '',
			'requires_php'   => $addon->get( 'version_php' ),
			'compatibility'  => '',
			'homepage'       => $addon->get( 'permalink' ),
			'download_link'  => '',
			'package'        => ( $addon->is_licensed() || ! $addon->requires_license() ),
			'banners'        => array(
				'low' => $addon->get( 'image' ),
			),
		);

		if ( $include_sections ) {

			$item['sections'] = array(
				'description' => $addon->get( 'description' ),
				'changelog'   => $this->get_changelog_for_api( $addon ),
			);

		}

		return (object) $item;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.4.2 Added a plugin property to the returned plugin object, which is required by WP_Plugin_Install_List_Table::prepare_items().
3.2.1 Set package to true for add-ons which don't require a license.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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