acf_pro_updates{}ACF 1.0

Хуков нет.

Использование

$acf_pro_updates = new acf_pro_updates();
// use class methods

Методы

  1. public __construct()
  2. public init()
  3. public modify_plugin_update_message( $plugin_data, $response )

Код acf_pro_updates{} ACF 6.4.2

class acf_pro_updates {

	/**
	 * Initialize filters, action, variables and includes
	 *
	 * @since 5.0.0
	 */
	public function __construct() {
		add_action( 'init', array( $this, 'init' ), 20 );
	}

	/**
	 * Initializes the ACF PRO updates functionality.
	 *
	 * @since 5.5.10
	 */
	public function init() {
		// Enable defined license activation regardless of `show_updates` setting.
		add_action( 'admin_init', 'acf_pro_check_defined_license', 20 );
		add_action( 'admin_init', 'acf_pro_maybe_reactivate_license', 25 );
		add_action( 'current_screen', 'acf_pro_display_activation_error', 30 );

		// Bail early if the updates page is not visible.
		if ( ! acf_pro_is_updates_page_visible() ) {
			return;
		}

		acf_register_plugin_update(
			array(
				'id'       => 'pro',
				'key'      => acf_pro_get_license_key(),
				'slug'     => acf_get_setting( 'slug' ),
				'basename' => acf_get_setting( 'basename' ),
				'version'  => acf_get_setting( 'version' ),
			)
		);

		if ( is_admin() ) {
			add_action( 'in_plugin_update_message-' . acf_get_setting( 'basename' ), array( $this, 'modify_plugin_update_message' ), 10, 2 );
		}
	}

	/**
	 * Displays an update message for plugin list screens.
	 *
	 * @since   5.3.8
	 *
	 * @param array  $plugin_data An array of plugin metadata.
	 * @param object $response    An object of metadata about the available plugin update.
	 * @return void
	 */
	public function modify_plugin_update_message( $plugin_data, $response ) {
		// Bail early if we have a key.
		if ( acf_pro_get_license_key() ) {
			return;
		}

		if ( is_multisite() ) {
			/* translators: %1 A link to the updates page. %2 link to the pricing page */
			$message           = __( 'To enable updates, please enter your license key on the <a href="%1$s">Updates</a> page of the main site. If you don\'t have a license key, please see <a href="%2$s" target="_blank">details & pricing</a>.', 'acf' );
			$updates_page_link = get_admin_url( get_main_site_id(), 'edit.php?post_type=acf-field-group&page=acf-settings-updates' );
		} else {
			/* translators: %1 A link to the updates page. %2 link to the pricing page */
			$message           = __( 'To enable updates, please enter your license key on the <a href="%1$s">Updates</a> page. If you don\'t have a license key, please see <a href="%2$s" target="_blank">details & pricing</a>.', 'acf' );
			$updates_page_link = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates' );
		}

		// Display message.
		echo '<br />' . wp_kses_post( sprintf( $message, $updates_page_link, acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'updates' ) ) );
	}
}