HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //proc/thread-self/cwd/wp-content/plugins/automatewoo/includes/AdminNotices/UpdateNoticeManager.php
<?php

namespace AutomateWoo\AdminNotices;

use AutomateWoo\Admin;
use AutomateWoo\AdminNotices;

/**
 * Display an admin notice on plugin update
 *
 * @since   5.0.0
 * @package AutomateWoo
 */
class UpdateNoticeManager {
	const NOTICE_ID = 'update';

	/**
	 * The version this notice relates to.
	 *
	 * @var string
	 *
	 * @see output_admin_notice method to update the version number displayed in the notice
	 */
	protected static $version = '5.2';

	/**
	 * Attach callbacks.
	 *
	 * @since 5.0.0
	 */
	public static function init() {
		add_action( 'automatewoo_version_changed', [ __CLASS__, 'maybe_add_admin_notice' ], 10, 2 );
		add_action( 'automatewoo/admin_notice/update', [ __CLASS__, 'output_admin_notice' ] );
	}

	/**
	 * Add an admin notice when the plugin is updated.
	 *
	 * @param string $previous_version The version of AutomateWoo the store was running prior to updating.
	 * @param string $current_version  The new version the site has been updated to.
	 *
	 * @since 5.0.0
	 */
	public static function maybe_add_admin_notice( $previous_version, $current_version ) {
		if ( '' !== $previous_version && version_compare( $previous_version, self::$version, '<' ) && version_compare( $current_version, self::$version, '>=' ) ) {
			AdminNotices::add_notice( 'update' );
			AdminNotices::remove_notice( 'welcome' );
		}
	}

	/**
	 * Outputs the update notice including details about the update.
	 */
	public static function output_admin_notice() {
		$title       = __( 'Thanks for updating to AutomateWoo 5.2!', 'automatewoo' );
		$description = sprintf(
			__(
				'In this release we have introduced some minor new features, added support for PHP 8 and finished converting all background processing to the <%1$s>Action Scheduler<%2$s> library which is used in WooCommerce core.',
				'automatewoo'
			),
			'a href="https://actionscheduler.org/" target="_blank"',
			'/a'
		);
		$links       = [
			[
				'text'           => __( 'View changelog', 'automatewoo' ),
				'href'           => 'https://dzv365zjfbd8v.cloudfront.net/changelogs/automatewoo/changelog.txt',
				'class'          => 'button-primary',
				'data_link_type' => 'changelog',
				'target'         => '_blank',
			],
		];

		Admin::get_view(
			'welcome-notice',
			[
				'notice_identifier' => self::NOTICE_ID,
				'title'             => $title,
				'description'       => $description,
				'links'             => $links,
			]
		);
	}

}