| @@ -1,31 +1,28 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -add_action( 'admin_menu', function () { | |
| 4 | - $page_title = $menu_title = __( 'SendWP', 'sendwp' ); | |
| 5 | - $capability = 'manage_options'; | |
| 6 | - $menu_slug = 'sendwp'; | |
| 7 | - | |
| 8 | - $function = function () { | |
| 9 | - do_action('sendwp_heartbeat'); | |
| 10 | - $vars = [ | |
| 11 | - 'enabled' => __('SendWP is currently enabled and sending email.', 'sendwp'), | |
| 12 | - 'disabled' => __('SendWP is currently disabled and NOT sending email.', 'sendwp'), | |
| 13 | - 'loading' => __('Loading', 'sendwp') . '...', | |
| 14 | - 'ajaxNonce' => wp_create_nonce( 'sendwp_settings_nonce' ) | |
| 15 | - ]; | |
| 16 | - include 'views/menu.html.php'; | |
| 17 | - wp_enqueue_script('sendwp-settings', plugins_url( 'assets/js/admin/settings.js', dirname(__DIR__))); | |
| 18 | - wp_localize_script('sendwp-settings', 'sendwpAdmin', $vars); | |
| 19 | - wp_enqueue_style('sendwp-settings', plugins_url( 'assets/css/admin/settings.css', dirname(__DIR__))); | |
| 20 | - }; | |
| 21 | - | |
| 22 | - if( isset( $_GET['page'] ) && $_GET['page'] === 'sendwp' && ! empty( $_GET['grant-access'] ) ) { | |
| 23 | - $function = function() { | |
| 24 | - do_action( 'trustedlogin/sendwp/auth_screen' ); | |
| 25 | - }; | |
| 26 | - } | |
| 27 | - | |
| 28 | - $position = 100; // After bottom seperator. | |
| 29 | - | |
| 30 | - add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); | |
| 31 | -} ); | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +add_action( 'admin_menu', function () { | |
| 4 | + $page_title = $menu_title = __( 'SendWP', 'sendwp' ); | |
| 5 | + $capability = 'manage_options'; | |
| 6 | + $menu_slug = 'sendwp'; | |
| 7 | + $function = function () { | |
| 8 | + do_action('sendwp_heartbeat'); | |
| 9 | + $vars = [ | |
| 10 | + 'enabled' => __('SendWP is currently enabled and sending email.', 'sendwp'), | |
| 11 | + 'disabled' => __('SendWP is currently disabled and NOT sending email.', 'sendwp'), | |
| 12 | + 'loading' => __('Loading', 'sendwp') . '...', | |
| 13 | + 'ajaxNonce' => wp_create_nonce( 'sendwp_settings_nonce' ) | |
| 14 | + ]; | |
| 15 | + include 'views/menu.html.php'; | |
| 16 | + wp_enqueue_script('sendwp-settings', plugins_url( 'assets/js/admin/settings.js', dirname(__DIR__))); | |
| 17 | + wp_localize_script('sendwp-settings', 'sendwpAdmin', $vars); | |
| 18 | + wp_enqueue_style('sendwp-settings', plugins_url( 'assets/css/admin/settings.css', dirname(__DIR__))); | |
| 19 | + }; | |
| 20 | + $icon = 'dashicons-email'; | |
| 21 | + $position = 100; // After bottom seperator. | |
| 22 | + | |
| 23 | + if(!sendwp_forwarding_enabled()){ | |
| 24 | + $menu_title .= ' <span class="update-plugins"><span class="update-count">!</span></span>'; | |
| 25 | + } | |
| 26 | + | |
| 27 | + add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon, $position ); | |
| 28 | +} ); | |