HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
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,pcntl_unshare,
Upload Files
File: /var/www/html/wpwisesolutions/wp-content/plugins/pofo-addons/updater/pofo-addons-auto-update.php
<?php

if( ! class_exists( 'pofo_addons_plugin_update' ) ) {

	class pofo_addons_plugin_update {
		private $pofo_current_version;
		private $pofo_update_path;
		private $pofo_plugin_slug;
		private $pofo_slug;

		public function __construct( $pofo_current_version, $pofo_update_path, $pofo_plugin_slug ) {
			// Set the class public variables
			$this->pofo_current_version = $pofo_current_version;
			$this->pofo_update_path = $pofo_update_path;

			// Set the Plugin Slug	
			$this->pofo_plugin_slug = $pofo_plugin_slug;
			list ($t1, $t2) = explode( '/', $pofo_plugin_slug );
			$this->pofo_slug = str_replace( '.php', '', $t2 );

			// define the alternative API for updating checking
			add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'pofo_addons_check_update' ) );

			// Define the alternative response for information checking
			add_filter( 'plugins_api', array( $this, 'pofo_addons_check_info' ), 10, 3 );
		}

		public function pofo_addons_check_update( $transient ) {
			if ( empty( $transient->checked ) ) {
				return $transient;
			}

			// Get the latest version from remote file
			$pofo_addons_remote_version = $this->pofo_addons_getRemote_version();

			// If a newer version is available, add the update
			if ( ! empty( $this->pofo_current_version ) && ! empty( $pofo_addons_remote_version->new_version ) && version_compare( $this->pofo_current_version, $pofo_addons_remote_version->new_version, '<' ) ) {
				$obj = new stdClass();
				$obj->slug = $this->pofo_slug;
				$obj->new_version = $pofo_addons_remote_version->new_version;

				$transient->response[$this->pofo_plugin_slug] = $obj;
			}
			return $transient;
		}

		public function pofo_addons_check_info( $obj, $action, $arg ) {
			if (isset($arg->slug) && $arg->slug === $this->pofo_slug) {
				$pofo_addons_information = $this->pofo_addons_getRemote_information();
				$pofo_addons_information->sections = (array) $pofo_addons_information->sections;
				return $pofo_addons_information;
			}
			return $obj;
		}

		public function pofo_addons_getRemote_information() {
			$pofo_addons_info_request = wp_remote_get( 'http://api.themezaa.com/pofo/data.json' );
			if ( ! is_wp_error( $pofo_addons_info_request ) || wp_remote_retrieve_response_code( $pofo_addons_info_request ) === 200 ) {
				return json_decode( $pofo_addons_info_request['body'] );
			}
			return false;
		}

		public function pofo_addons_getRemote_version() {
			$params = array( 'body' => array( 'action' => 'version' ) );
			// Make the POST request
			$pofo_addons_version_request = wp_remote_post($this->pofo_update_path, $params );
			// Check if response is valid
			if ( !is_wp_error( $pofo_addons_version_request ) || wp_remote_retrieve_response_code( $pofo_addons_version_request ) === 200 ) {
				return @unserialize( $pofo_addons_version_request['body'] );
			}
			return false;
		}
	}
}