| 1 |
<?php |
| 2 |
|
| 3 |
add_action( |
| 4 |
'admin_menu', |
| 5 |
function () { |
| 6 |
$menu_title = __( 'SendWP', 'sendwp' ); |
| 7 |
$page_title = $menu_title; |
| 8 |
$capability = 'manage_options'; |
| 9 |
$menu_slug = 'sendwp'; |
| 10 |
$function = function () { |
| 11 |
do_action( 'sendwp_heartbeat' ); |
| 12 |
|
| 13 |
$vars = array( |
| 14 |
'enabled' => __( 'SendWP is currently enabled and sending email.', 'sendwp' ), |
| 15 |
'disabled' => __( 'SendWP is currently disabled and NOT sending email.', 'sendwp' ), |
| 16 |
'loading' => __( 'Loading', 'sendwp' ) . '...', |
| 17 |
'ajaxNonce' => wp_create_nonce( 'sendwp_settings_nonce' ), |
| 18 |
); |
| 19 |
|
| 20 |
include 'views/menu.html.php'; |
| 21 |
|
| 22 |
wp_enqueue_script( 'sendwp-settings', plugins_url( 'assets/js/admin/settings.js', dirname( __DIR__ ) ) ); |
| 23 |
wp_localize_script( 'sendwp-settings', 'sendwpAdmin', $vars ); |
| 24 |
wp_enqueue_style( 'sendwp-settings', plugins_url( 'assets/css/admin/settings.css', dirname( __DIR__ ) ) ); |
| 25 |
}; |
| 26 |
|
| 27 |
$position = 100; // After bottom seperator. |
| 28 |
|
| 29 |
add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
| 30 |
} |
| 31 |
); |
| 32 |
|