| 1 |
<?php |
| 2 |
|
| 3 |
namespace Wpxero\Marqueex\Admin; |
| 4 |
|
| 5 |
use Wpxero\Marqueex\Traits\Singleton; |
| 6 |
|
| 7 |
if (!defined('ABSPATH')) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
|
| 11 |
class Menu { |
| 12 |
use Singleton; |
| 13 |
|
| 14 |
private function __construct() { |
| 15 |
add_action('admin_menu', [$this, 'register_menu']); |
| 16 |
} |
| 17 |
|
| 18 |
public function register_menu() { |
| 19 |
// Add main menu |
| 20 |
add_menu_page( |
| 21 |
__('MarqueeX', 'marqueex'), |
| 22 |
__('MarqueeX', 'marqueex'), |
| 23 |
'manage_options', |
| 24 |
'marqueex', |
| 25 |
[$this, 'render_menu_page'], |
| 26 |
'data:image/svg+xml;base64,' . base64_encode('<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" id="Maya-Logo--Streamline-Logos" height="24" width="24"><path fill="#fff" fill-rule="evenodd" d="M1 1.948 7 1.5l4.994 10.987L13.988 18H10.5l-4.727 -6.913 -4.772 -9.139Zm0 3.24v14.71c1.574 -2.424 2.857 -4.752 3.76 -7.511L1 5.187ZM1.064 22.5c2.955 -0.003 4.125 -0.214 4.65 -1v-7.325c-1.169 3.028 -2.779 5.59 -4.65 8.325Zm13.905 -6.197 2.77 -4.847L22.967 2H16.5l-3.636 8.483 2.105 5.82ZM23 5.04l-5 9.046v5.468a35.72 35.72 0 0 0 2.834 -5.037C21.96 12.081 22.768 9.61 23 7.584V5.039Zm0 8.227a35.322 35.322 0 0 1 -0.804 1.879c-1.174 2.542 -2.66 5.01 -4.15 6.878L19 22.5h4v-9.234Z" clip-rule="evenodd" stroke-width="1"></path></svg>'), |
| 27 |
30 |
| 28 |
); |
| 29 |
// One screen, so one submenu item — registered against the parent slug so |
| 30 |
// it renames WordPress's auto-generated duplicate rather than adding a |
| 31 |
// second registered page. (A second page slug was why "Settings" used to |
| 32 |
// open the app with no sub_page and land on the wrong tab.) |
| 33 |
add_submenu_page( |
| 34 |
'marqueex', |
| 35 |
esc_html__('Settings', 'marqueex'), |
| 36 |
esc_html__('Settings', 'marqueex'), |
| 37 |
'manage_options', |
| 38 |
'marqueex', |
| 39 |
[$this, 'render_menu_page'] |
| 40 |
); |
| 41 |
} |
| 42 |
|
| 43 |
public function render_menu_page() { |
| 44 |
echo '<div class="wrap">'; |
| 45 |
echo '<div id="marqueex-admin-page"></div>'; |
| 46 |
echo '</div>'; |
| 47 |
} |
| 48 |
} |
| 49 |
|