HEX
Server: LiteSpeed
System: Linux host.point2pointhosting.com 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
User: nolabhpoint2p (1291)
PHP: 8.4.15
Disabled: NONE
Upload Files
File: /home/nolabhpoint2p/public_html/wp-content/themes/PoinTheme/functions/admin/class-mfn-update.php
<?php
if( ! defined( 'ABSPATH' ) ){
	exit; // Exit if accessed directly
}

class Mfn_Update extends Mfn_API {

	protected $code = '';

	/**
	 * Mfn_Update constructor
	 */

	public function __construct(){

		$this->code = mfn_get_purchase_code();

		// It runs when wordpress check for updates
		add_filter( 'pre_set_site_transient_update_themes', array( $this, 'pre_set_site_transient_update_themes' ) );

	}

	/**
	 * Filter WP Update transient
	 *
	 * @param unknown $transient
	 * @return unknown
	 */

	public function pre_set_site_transient_update_themes( $transient ) {

		if( ! mfn_is_registered() ){
			return $transient;
		}

		$new_version = $this->remote_get_version();
		$theme_template = get_template();

		if( version_compare( wp_get_theme( $theme_template )->get( 'Version' ), $new_version, '<' ) ) {

			$args = array(
				'code' => $this->code,
			);

			if( mfn_is_hosted() ){
				$args[ 'ish' ] = mfn_get_ish();
			}

			$transient->response[ $theme_template ] = array(
				'theme' => $theme_template,
				'new_version' => $new_version,
				'url' => $this->get_url( 'changelog' ),
				'package' => add_query_arg( $args, $this->get_url( 'theme_download' ) ),
			);

		}

		return $transient;
	}

}

$mfn_update = new Mfn_Update();