templates
2 years ago
Admin_Settings.php
2 years ago
Assets.php
2 years ago
Module_Settings.php
2 years ago
notices.php
2 years ago
Admin_Settings.php
106 lines
| 1 | <?php |
| 2 | namespace SPEL\includes\Admin; |
| 3 | |
| 4 | // Exit if accessed directly |
| 5 | if (!defined('ABSPATH')) { |
| 6 | exit; |
| 7 | } |
| 8 | |
| 9 | /** |
| 10 | * Class Admin_Settings |
| 11 | * @package spiderElements\includes\Admin |
| 12 | */ |
| 13 | class Admin_Settings { |
| 14 | |
| 15 | const PAGE_ID = 'spider_elements_settings'; |
| 16 | |
| 17 | |
| 18 | public function __construct() { |
| 19 | |
| 20 | add_action( 'admin_menu', [ $this, 'add_menu_page' ] ); |
| 21 | |
| 22 | } |
| 23 | |
| 24 | |
| 25 | /** |
| 26 | * @return void |
| 27 | * Add menu page to the WordPress admin dashboard. |
| 28 | */ |
| 29 | public function add_menu_page() { |
| 30 | |
| 31 | add_menu_page( |
| 32 | __( 'Spider Elements', 'spider-elements' ), |
| 33 | __( 'Spider Elements', 'spider-elements' ), |
| 34 | 'manage_options', |
| 35 | self::PAGE_ID, |
| 36 | [ $this, 'render_plugin_page' ], |
| 37 | $this->spel_icon(), |
| 38 | 30 |
| 39 | ); |
| 40 | |
| 41 | } |
| 42 | |
| 43 | |
| 44 | /** |
| 45 | * @return void |
| 46 | * Render the content of the menu page. |
| 47 | * This is where you would add your custom HTML |
| 48 | */ |
| 49 | public function render_plugin_page() { |
| 50 | |
| 51 | echo '<form action="" method="post" id="spe-settings" name="spe-settings" class="wrapper spe_dashboard">'; |
| 52 | |
| 53 | //Sidebar's menu |
| 54 | echo '<div class="sidebar_navigation">'; |
| 55 | |
| 56 | if ( file_exists(require_once __DIR__ . '/templates/sidebar.php') ) { |
| 57 | require_once __DIR__ . 'parts/sidebar.php'; |
| 58 | } |
| 59 | |
| 60 | echo '</div>'; //End of sidebar menu |
| 61 | |
| 62 | |
| 63 | // Tab contents |
| 64 | echo '<div class="tab_contents">'; |
| 65 | |
| 66 | if ( file_exists(require_once __DIR__ . '/templates/dashboard.php') ) { |
| 67 | require_once __DIR__ . 'parts/dashboard.php'; |
| 68 | } |
| 69 | |
| 70 | if ( file_exists(require_once __DIR__ . '/templates/elements.php') ) { |
| 71 | require_once __DIR__ . 'parts/elements.php'; |
| 72 | } |
| 73 | |
| 74 | if ( file_exists(require_once __DIR__ . '/templates/features.php') ) { |
| 75 | require_once __DIR__ . 'parts/features.php'; |
| 76 | } |
| 77 | |
| 78 | if ( file_exists(require_once __DIR__ . '/templates/api-settings.php') ) { |
| 79 | require_once __DIR__ . 'parts/api-settings.php'; |
| 80 | } |
| 81 | |
| 82 | if ( file_exists(require_once __DIR__ . '/templates/integration.php') ) { |
| 83 | require_once __DIR__ . 'parts/integration.php'; |
| 84 | } |
| 85 | |
| 86 | if ( file_exists(require_once __DIR__ . '/templates/go-premium.php') ) { |
| 87 | require_once __DIR__ . 'parts/go-premium.php'; |
| 88 | } |
| 89 | |
| 90 | echo '</div>'; //End of tab contents |
| 91 | |
| 92 | echo '</form>'; //End of wrapper |
| 93 | |
| 94 | } |
| 95 | |
| 96 | |
| 97 | /** |
| 98 | * @return string |
| 99 | * Return the base64 encoded SVG icon. |
| 100 | */ |
| 101 | public function spel_icon() { |
| 102 | return 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODYiIGhlaWdodD0iODMiIHZpZXdCb3g9IjAgMCA4NiA4MyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzRfMjExMikiPgo8cGF0aCBkPSJNODYgMTkuNjE0MlYxNS45OTc2VjBINzAuMjI4M0gxNS43NzE3QzcuMDYwNTcgMCAwIDcuMTYxNzEgMCAxNS45OTc2SDc2LjAxMjJDNzguNzMxNCAxOC4yNTg0IDgyLjIwODcgMTkuNjE0MiA4NiAxOS42MTQyWiIgZmlsbD0idXJsKCNwYWludDBfbGluZ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