<?php
/**
 * Admin settings helper
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package     Kemet
 * @author      Kemet
 * @copyright   Copyright (c) 2019, Kemet
 * @link        https://kemet.io/
 * @since       Kemet 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'Kemet_Admin_Settings' ) ) {

	/**
	 * Kemet Admin Settings
	 */
	class Kemet_Admin_Settings {


		/**
		 * View all actions
		 *
		 * @var array $view_actions
		 */
		public static $view_actions = array();

		/**
		 * Menu page title
		 *
		 * @var array $menu_page_title
		 */
		public static $menu_page_title = 'Kemet Theme';

		/**
		 * Page title
		 *
		 * @var array $page_title
		 */
		public static $page_title = 'kemet';

		/**
		 * Plugin slug
		 *
		 * @var array $plugin_slug
		 */
		public static $plugin_slug = 'kemet';

		/**
		 * Constructor
		 */
		public function __construct() {
			if ( ! is_admin() ) {
				return;
			}
			add_action( 'admin_menu', array( $this, 'register_kemet_custom_menu_page' ), 1 );
			add_action( 'admin_menu', array( $this, 'remove_kemet_submenu_menu' ), 99 );
		}

		/**
		 * Rwmove Kemet submenu Item
		 *
		 * @return void
		 */
		public function remove_kemet_submenu_menu() {
			if ( apply_filters( 'enable_kemet_admin_menu_item', false ) ) {
				remove_submenu_page( 'kemet_panel', 'kemet_panel' );
			}
		}

		/**
		 * Add Kemet menu Item
		 *
		 * @return void
		 */
		public function register_kemet_custom_menu_page() {
			if ( apply_filters( 'enable_kemet_admin_menu_item', false ) ) {
				$icon = 'data:image/svg+xml;base64,PHN2ZyBjbGFzc05hbWU9ImttdC1zdmctaWNvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMyA1OC4wNCI+PHN0eWxlPi5jbHMtMXtmaWxsOiNmZmZmZmY7fTwvc3R5bGU+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMSwyOFY0NEg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