HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
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: //proc/self/cwd/wp-content/plugins/email-log/include/Core/Request/OverridePluginAPI.php
<?php namespace EmailLog\Core\Request;

use EmailLog\Addon\API\EDDUpdater;
use EmailLog\Core\Loadie;

defined( 'ABSPATH' ) || exit; // Exit if accessed directly.

/**
 * Override WordPress Plugin API.
 * This is already done by EDD_SL_Plugin_Updater for Active add-on
 * and this class does it for all in active or yet to be installed add-ons.
 *
 * @since 2.0.0
 */
class OverridePluginAPI implements Loadie {

	/**
	 * Setup actions.
	 *
	 * @inheritdoc
	 */
	public function load() {
		add_action( 'admin_init', array( $this, 'setup_updaters_for_inactive_addons' ) );

		add_filter( 'plugins_api_result', array( $this, 'add_version_to_plugin_api_response' ), 100, 3 );
	}

	/**
	 * Setup updaters for all in-active addons.
	 */
	public function setup_updaters_for_inactive_addons() {
		$email_log = email_log();
		$licenser  = $email_log->get_licenser();

		if ( is_null( $licenser ) ) {
			return;
		}

		$inactive_addons = $licenser->get_addon_list()->get_inactive_addons();

		foreach ( $inactive_addons as $inactive_addon ) {
			$license_key = $licenser->get_addon_license_key( $inactive_addon->name );

			$updater = new EDDUpdater(
				$email_log->get_store_url(),
				$inactive_addon->file,
				array(
					'version'   => $inactive_addon->get_version(),
					'license'   => $license_key,
					'item_name' => $inactive_addon->name,
					'author'    => $inactive_addon->author,
				)
			);

			$licenser->add_updater( $updater );
		}
	}

	/**
	 * Add version attribute to plugin API response.
	 *
	 * The API response generated by EDD doesn't have the version attribute and it results in some warnings.
	 * This method fixes it by manually adding the version attribute to the API response.
	 *
	 * @since 2.1.0
	 *
	 * @param object $response API Response.
	 * @param string $action   Action name.
	 * @param array  $args     Arguments for the function.
	 *
	 * @return object Modified API response.
	 */
	public function add_version_to_plugin_api_response( $response, $action, $args ) {
		if ( 'plugin_information' !== $action ) {
			return $response;
		}

		if ( ! isset( $args->slug ) || ( substr( $args->slug, 0, 10 ) != 'email-log-' ) ) {
			return $response;
		}

		if ( isset( $response->version ) ) {
			return $response;
		}

		if ( ! isset( $response->new_version ) ) {
			return $response;
		}

		$response->version = $response->new_version;

		return $response;
	}
}