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_Install::_migrate_300()

Migrate to version 3.0.0


Return Return

(void)


Top ↑

Source Source

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

	private static function _migrate_300() {

		$text  = '<p><strong>' . __( 'Welcome to the LifterLMS Helper', 'lifterlms' ) . '</strong></p>';
		$text .= '<p>' . __( 'This plugin allows your website to interact with your subscriptions at LifterLMS.com to ensure your add-ons stay up to date.', 'lifterlms' ) . '</p>';
		// Translators: %1$s = Opening anchor tag; %2$s = closing anchor tag.
		$text .= '<p>' . sprintf( __( 'You can activate your add-ons from the %1$sAdd-Ons & More%2$s screen.', 'lifterlms' ), '<a href="' . admin_url( 'admin.php?page=llms-add-ons' ) . '">', '</a>' ) . '</p>';

		$keys   = array();
		$addons = llms_get_add_ons();
		if ( ! is_wp_error( $addons ) && isset( $addons['items'] ) ) {
			foreach ( $addons['items'] as $addon ) {

				$addon = llms_get_add_on( $addon );

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

				$option_name = sprintf( '%s_activation_key', $addon->get( 'slug' ) );

				$key = get_option( $option_name );
				if ( $key ) {
					$keys[] = get_option( $option_name );
				}

				delete_option( $option_name );
				delete_option( sprintf( '%s_update_key', $addon->get( 'slug' ) ) );

			}
		}

		if ( $keys ) {

			$res = LLMS_Helper_Keys::activate_keys( $keys );

			if ( ! is_wp_error( $res ) ) {

				$data = $res['data'];
				if ( isset( $data['activations'] ) ) {

					// Translators: %d = Number of keys that have been migrated.
					$text .= '<p>' . sprintf( _n( '%d license has been automatically migrated from the previous version of the LifterLMS Helper', '%d licenses have been automatically migrated from the previous version of the LifterLMS Helper.', count( $data['activations'] ), 'lifterlms' ), count( $data['activations'] ) ) . ':</p>';

					foreach ( $data['activations'] as $activation ) {
						LLMS_Helper_Keys::add_license_key( $activation );
						$text .= '<p><em>' . $activation['license_key'] . '</em></p>';
					}
				}
			}
		}

		LLMS_Admin_Notices::flash_notice( $text, 'info' );

		// Clean up legacy options.
		$remove = array(
			'lifterlms_stripe_activation_key',
			'lifterlms_paypal_activation_key',
			'lifterlms_gravityforms_activation_key',
			'lifterlms_mailchimp_activation_key',
			'llms_helper_key_migration',
		);

		foreach ( $remove as $opt ) {
			delete_option( $opt );
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.4.0 Use core textdomain.
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.