Warning: Constant SEO_LINKS_API_ENDPOINT already defined in /www/wwwroot/fni.gov.mz/wp-content/plugins/wordpress-plugin/wordpress-plugin.php on line 10
HEX
HEX
Server: Apache
System: Linux paginas.localdomain 4.15.0-200-generic #211-Ubuntu SMP Thu Nov 24 18:16:04 UTC 2022 x86_64
User: www (1002)
PHP: 8.0.11
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/fni.gov.mz/wp-content/plugins/pdf-embedder/src/Admin/License.php
<?php

namespace PDFEmbedder\Admin;

use PDFEmbedder\Helpers\Macroable;

/**
 * License class.
 *
 * @since 4.7.0
 */
class License {
	use Macroable;

	/**
	 * Option key where the license status is stored.
	 *
	 * @since 4.7.0
	 */
	const OPTION_STATUS = 'pdfemb_premium_license_status';

	/**
	 * Get the current installation license key.
	 * PDFEMB_LICENSE_KEY constant has higher priority.
	 *
	 * @since 4.7.0
	 */
	public static function get_key(): string {

		// Allow wp-config constant to pass key.
		if ( defined( 'PDFEMB_LICENSE_KEY' ) && PDFEMB_LICENSE_KEY ) {
			return PDFEMB_LICENSE_KEY;
		}

		return pdf_embedder()->options()->get()['pdfemb_license_key'] ?? '';
	}

	/**
	 * Get the current installation license type.
	 * TODO: Implement the correct type (lite, premium, secure).
	 *
	 * @since 4.7.0
	 */
	public static function get_type(): string {

		/**
		 * Filter the license type.
		 *
		 * @since 4.7.0
		 *
		 * @param string $type License type.
		 */
		return (string) apply_filters( 'pdfemb_license_type', 'lite' );
	}

	/**
	 * Get the current installation license status.
	 *
	 * @since 4.7.0
	 */
	public static function get_status(): string {

		/**
		 * Filter the license status.
		 *
		 * @since 4.7.0
		 *
		 * @param string $status License status.
		 */
		return (string) apply_filters( 'pdfemb_license_status', 'lite' );
	}

	/**
	 * Get the error text depending on the type of the error.
	 *
	 * @since 4.7.0
	 *
	 * @param string $error License error.
	 */
	public static function get_error_text( string $error ): string {

		$error_strings = [
			'too_short'     => esc_html__( 'License key is too short.', 'pdf-embedder' ),
			'invalid'       => esc_html__( 'License key failed to activate.', 'pdf-embedder' ),
			'missing'       => esc_html__( 'License key does not exist in our system.', 'pdf-embedder' ),
			'expired'       => esc_html__( 'License key has expired.', 'pdf-embedder' ),
			'site_inactive' => esc_html__( 'License key is not permitted for this website.', 'pdf-embedder' ),
			'inactive'      => esc_html__( 'License key is not active for this website.', 'pdf-embedder' ),
			'disabled'      => esc_html__( 'License key has been disabled.', 'pdf-embedder' ),
			'empty'         => esc_html__( 'License key was not provided.', 'pdf-embedder' ),
		];

		return $error_strings[ $error ] ?? esc_html__( 'Unspecified error', 'pdf-embedder' );
	}
}