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/pixel-caffeine/includes/admin/class-aepc-admin-menu.php
<?php
/**
 * Manage the admin menu
 *
 * @package Pixel Caffeine
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Main class for admin pages
 *
 * @class AEPC_Admin_Menu
 */
class AEPC_Admin_Menu {

	/**
	 * The page ID
	 *
	 * @var string
	 */
	public static $page_id = 'aepc-settings';

	/**
	 * The hook page ID
	 *
	 * @var string
	 */
	public static $hook_page = '';

	/**
	 * AEPC_Admin_Menu Constructor.
	 *
	 * @return void
	 */
	public static function init() {
		add_action( 'admin_menu', array( __CLASS__, 'add_menu' ) );
	}

	/**
	 * Define here the page titles
	 *
	 * @return array
	 */
	public static function get_page_titles() {
		return array(
			'welcome'          => _x( 'Welcome to the new version of Pixel Caffeine', 'page title', 'pixel-caffeine' ),
			'dashboard'        => _x( 'Dashboard', 'page title', 'pixel-caffeine' ),
			'custom-audiences' => _x( 'Custom Audiences', 'page title', 'pixel-caffeine' ),
			'conversions'      => _x( 'Conversions/Events', 'page title', 'pixel-caffeine' ),
			'general-settings' => _x( 'General Settings', 'page title', 'pixel-caffeine' ),
			'product-catalog'  => _x( 'Product Catalog', 'page title', 'pixel-caffeine' ),
			'logs'             => _x( 'Logs', 'page title', 'pixel-caffeine' ),
		);
	}

	/**
	 * Add the menu page
	 *
	 * @return void
	 */
	public static function add_menu() {

		// Titles.
		$titles = self::get_page_titles();
		// phpcs:ignore WordPress.Security.NonceVerification
		$page = isset( $_GET['tab'] ) ? sanitize_key( $_GET['tab'] ) : 'dashboard';

		// Detect page title.
		$page_title = AEPC_Admin::PLUGIN_NAME;
		if ( isset( $titles[ $page ] ) ) {
			$page_title .= ' - ' . $titles[ $page ];
		}

		self::$hook_page = add_menu_page(
			$page_title,
			AEPC_Admin::PLUGIN_NAME,
			'manage_ads',
			self::$page_id,
			array( __CLASS__, 'view' ),
			''
		);
	}

	/**
	 * Show template for the dashboard
	 *
	 * @return void
	 */
	public static function view() {
		$page = sanitize_key( filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING ) ?: 'dashboard' );
		AEPC_Admin::get_page( $page )->output();
	}
}