| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
if ( !defined( 'ABSPATH' ) ) { exit; } |
| 5 |
|
| 6 |
class TSBproAdminMenu { |
| 7 |
public function __construct() { |
| 8 |
add_action( 'admin_menu', [ $this, 'adminMenu' ] ); |
| 9 |
add_action( 'admin_enqueue_scripts', [$this, 'adminEnqueueScripts'] ); |
| 10 |
} |
| 11 |
|
| 12 |
|
| 13 |
public function adminMenu(){ |
| 14 |
$icon = " |
| 15 |
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 388.266 388.266' fill='currentColor' color='rgba(240, 246, 252, .6)'> |
| 16 |
<path d='M388.172,55.218L116.189,1.089l-0.654-0.128L26.397,1.125L0,1.089v386.216h388.266V64.598L388.172,55.218z |
| 17 |
M319.291,144.434C293.78,121.517,213.527,66.745,159.834,30.772l206.154,42.069C361.865,90.479,350.016,126.11,319.291,144.434z |
| 18 |
M321.917,166.114c21.45-10.299,36.072-26.548,45.986-43.079v243.904H20.362V21.497l4.5-0.011l84.381,0.112 |
| 19 |
c67.822,44.747,184.602,123.856,200.608,142.056l5.089,5.787L321.917,166.114z'/> |
| 20 |
</svg> |
| 21 |
"; |
| 22 |
|
| 23 |
|
| 24 |
// add_menu_page( |
| 25 |
// __('Team Section- bPlugins', 'team-section'), |
| 26 |
// __('Team Section', 'team-section'), |
| 27 |
// 'manage_options', |
| 28 |
// 'team-section-dashboard', |
| 29 |
// '', |
| 30 |
// 'data:image/svg+xml;base64,' . base64_encode( $icon ), |
| 31 |
// 20 |
| 32 |
// ); |
| 33 |
add_submenu_page( |
| 34 |
'edit.php?post_type=tsb', |
| 35 |
__('Help And Demo - bPlugins', 'team-section'), |
| 36 |
__('Help And Demo', 'team-section'), |
| 37 |
'manage_options', |
| 38 |
'team-section-dashboard', |
| 39 |
[$this, 'renderDashboardPage'], |
| 40 |
1 |
| 41 |
); |
| 42 |
|
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
public function renderDashboardPage(){ ?> |
| 47 |
<div |
| 48 |
id='tsm_team_section_block' |
| 49 |
data-info='<?php echo esc_attr( wp_json_encode( [ |
| 50 |
'version' => TSB_VERSION, |
| 51 |
'isPremium' => tsbIsPremium(), |
| 52 |
'hasPro' => TEAM_SECTION_BLOCK_PRO |
| 53 |
] ) ); ?>' |
| 54 |
></div> |
| 55 |
<?php } |
| 56 |
|
| 57 |
function adminEnqueueScripts( $hook ) { |
| 58 |
if( strpos( $hook, 'team-section-dashboard' ) ){ |
| 59 |
wp_enqueue_style( 'tsb-admin-dashboard', TSB_DIR_URL . 'build/admin-dashboard.css', [], TSB_VERSION ); |
| 60 |
wp_enqueue_script( 'tsb-admin-dashboard', TSB_DIR_URL . 'build/admin-dashboard.js', [ 'react', 'react-dom' ], TSB_VERSION, true ); |
| 61 |
wp_set_script_translations( 'tsb-admin-dashboard', 'click-to-copy', TSB_DIR_PATH . 'languages' ); |
| 62 |
|
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
new TSBproAdminMenu(); |
| 67 |
|