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/wptuneprotect/wp-content/plugins/wpgetapi/includes/class-licenses.php
<?php

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


/**
 * Wpgetapi_License_Handler Class
 */
class Wpgetapi_License_Handler {

	/**
     * Main constructor
     * @since 1.0.0
     */
    public function __construct() {
    	$this->hooks();
    }

    /**
     * Hooks
     * @since  1.0.0
     */
    public function hooks() {
    	add_action( 'admin_menu', array( $this, 'license_menu' ) );
    	add_action( 'admin_notices', array( $this, 'admin_notices' ) );
    }

	/**
	 * Adds the plugin license page to the admin menu.
	 *
	 * @return void
	 */
	function license_menu() {
		if ( 
			is_plugin_active('wpgetapi-woocommerce/wpgetapi-woocommerce.php' ) || 
			is_plugin_active('wpgetapi-post-import/wpgetapi-post-import.php' ) || 
			is_plugin_active('wpgetapi-oauth/wpgetapi-oauth.php' ) || 
			is_plugin_active('wpgetapi-extras/wpgetapi-extras.php' ) 
		) {
			add_submenu_page(
				'wpgetapi_setup',
				__( 'Plugin Licenses' ),
				__( 'Licenses' ),
				'manage_options',
				WPGETAPILICENSEPAGE,
				array( $this, 'license_page' )
			);
		}

	}
	

	function license_page() {

		add_settings_section(
			'wpgetapi_licenses_section',
			__( '' ),
			array( $this, 'license_key_settings_section' ),
			WPGETAPILICENSEPAGE
		);

		?>
		<div class="wrap">
			<h2><?php esc_html_e( 'WPGetAPI Extension Licenses' ); ?></h2>
			<form method="post" action="options.php">

				<?php
				do_settings_sections( WPGETAPILICENSEPAGE );
				settings_fields( 'wpgetapi_licenses_section' );
				submit_button();
				?>

			</form>
		<?php
	}


	/**
	 * Adds content to the settings section.
	 *
	 * @return void
	 */
	function license_key_settings_section() {

		?>
			<div class="intro">
				<p>License fields will appear here if you have purchased any of our premium plugin extensions.<br>Enter your license keys to receive updates for your premium plugins.</p>
				<p><a class="button" target="_blank" href="https://wpgetapi.com">View premium extensions</a></p>
			</div>

		<?php

	}


	/**
	 * This is a means of catching errors from the activation method above and displaying it to the customer
	 */
	function admin_notices() {
		if ( isset( $_GET['sl_activation'] ) && ! empty( $_GET['message'] ) ) {

			switch ( $_GET['sl_activation'] ) {

				case 'false':
					$message = urldecode( $_GET['message'] );
					?>
					<div class="error">
						<p><?php echo wp_kses_post( $message ); ?></p>
					</div>
					<?php
					break;

				case 'true':
				default:
					?>
					<div class="error">
						<p>Activated successfully.</p>
					</div>
					<?php
					// Developers can put a custom success message here for when activation is successful if they way.
					break;

			}
		}
	}
	


}

return new Wpgetapi_License_Handler();