HEX
Server: Apache/2
System: Linux server-80-13-140-150.da.direct 5.14.0-362.24.1.el9_3.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 4 22:31:43 UTC 2024 x86_64
User: cpt (1004)
PHP: 8.1.24
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/cpt/public_html/wp-content/plugins/wpforms/src/Admin/Payments/Views/Coupons/Education.php
<?php

namespace WPForms\Admin\Payments\Views\Coupons;

use WPForms\Admin\Payments\Views\Overview\Helpers;
use WPForms\Admin\Payments\Views\PaymentsViewsInterface;

/**
 * Payments Coupons Education class.
 *
 * @since 1.8.2.2
 */
class Education implements PaymentsViewsInterface {

	/**
	 * Coupons addon data.
	 *
	 * @since 1.8.2.2
	 *
	 * @var array
	 */
	private $addon;

	/**
	 * Initialize class.
	 *
	 * @since 1.8.2.2
	 */
	public function init() {

		$this->hooks();
	}

	/**
	 * Register hooks.
	 *
	 * @since 1.8.2.2
	 */
	private function hooks() {

		add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
	}

	/**
	 * Get the page label.
	 *
	 * @since 1.8.2.2
	 *
	 * @return string
	 */
	public function get_tab_label() {

		return __( 'Coupons', 'wpforms-lite' );
	}

	/**
	 * Enqueue scripts.
	 *
	 * @since 1.8.2.2
	 */
	public function enqueue_scripts() {

		// Lity - lightbox for images.
		wp_enqueue_style(
			'wpforms-lity',
			WPFORMS_PLUGIN_URL . 'assets/lib/lity/lity.min.css',
			null,
			'3.0.0'
		);

		wp_enqueue_script(
			'wpforms-lity',
			WPFORMS_PLUGIN_URL . 'assets/lib/lity/lity.min.js',
			[ 'jquery' ],
			'3.0.0',
			true
		);
	}

	/**
	 * Check if the current user has the capability to view the page.
	 *
	 * @since 1.8.2.2
	 *
	 * @return bool
	 */
	public function current_user_can() {

		if ( ! wpforms_current_user_can() ) {
			return false;
		}

		$this->addon = wpforms()->get( 'addons' )->get_addon( 'coupons' );

		if (
			empty( $this->addon ) ||
			empty( $this->addon['status'] ) ||
			empty( $this->addon['action'] )
		) {
			return false;
		}

		return true;
	}

	/**
	 * Page heading content.
	 *
	 * @since 1.8.2.2
	 */
	public function heading() {

		Helpers::get_default_heading();
	}

	/**
	 * Page content.
	 *
	 * @since 1.8.2.2
	 */
	public function display() {

		// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
		echo wpforms_render( 'education/admin/payments/coupons', $this->addon, true );
	}
}