HEX
Server: Apache
System: Linux uws7-179.cafe24.com 3.10.0-1160.119.1p.el7.x86_64 #1 SMP Thu Sep 11 14:15:01 KST 2025 x86_64
User: medikors (1589)
PHP: 7.3.1p1
Disabled: mysql_pconnect
Upload Files
File: /medikors/www/wp-content/plugins/jet-blog/includes/modules/jet-dashboard/inc/modules/base.php
<?php
namespace Jet_Dashboard\Base;

use Jet_Dashboard\Dashboard as Dashboard;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}

abstract class Module {

	abstract public function get_slug();

	public function __construct() {

		$this->init();

		add_action(
			'jet-dashboard/before-enqueue-assets/' . $this->get_slug(),
			array( $this, 'assets' )
		);

		add_action( 'wp_ajax_jet_dashboard/' . $this->get_slug(), array( $this, 'process_ajax' ) );
	}

	/**
	 * Initialize module-specific parts
	 *
	 * @return [type] [description]
	 */
	public function init() {}

	/**
	 * Register module assets
	 *
	 * @return [type] [description]
	 */
	public function assets() {

		$this->enqueue_module_assets();

		add_filter( 'jet-dashboard/js-page-config', array( $this, 'page_config' ), 10, 2 );
		add_filter( 'jet-dashboard/js-page-templates', array( $this, 'page_templates' ), 10, 2 );
	}

	/**
	 * Process ajax
	 *
	 * @return [type] [description]
	 */
	public function process_ajax() {

		$handler = isset( $_REQUEST['handler'] ) ? $_REQUEST['handler'] : false;

		if ( ! $handler || ! is_callable( array( $this, $handler ) ) ) {
			return;
		}

		if ( ! current_user_can( 'manage_options' ) ) {
			wp_send_json_error( array(
				'message' => 'You are not allowed to access this',
			) );
		}

		$nonce = isset( $_REQUEST['nonce'] ) ? esc_attr( $_REQUEST['nonce'] ) : false;

		if ( ! $nonce || ! wp_verify_nonce( $nonce, Dashboard::get_instance()->get_dashboard_page_url() ) ) {
			wp_send_json_error( array(
				'message' => 'Nonce verfictaion failed',
			) );
		}

		call_user_func( array( $this, $handler ) );

	}

	/**
	 * Enqueue module-specific assets
	 *
	 * @return void
	 */
	public function enqueue_module_assets() {}

	/**
	 * Modify page config
	 *
	 * @param  [type] $config [description]
	 * @return [type]         [description]
	 */
	public function page_config( $config = array(), $subpage = '' ) {
		return $config;
	}

	/**
	 * Add page templates
	 *
	 * @param  [type] $config [description]
	 * @return [type]         [description]
	 */
	public function page_templates( $templates = array(), $subpage = '' ) {
		return $templates;
	}

	/**
	 * Returns link to current page
	 *
	 * @return [type] [description]
	 */
	public function get_page_link() {
		return Dashboard::get_instance()->get_dashboard_page_url( $this->get_slug() );
	}

}