| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 4 |
|
| 5 |
if ( ! class_exists( 'Dfrapi_Admin_Help' ) ) : |
| 6 |
|
| 7 |
/** |
| 8 |
* Dfrapi_Admin_Help Class |
| 9 |
*/ |
| 10 |
class Dfrapi_Admin_Help { |
| 11 |
|
| 12 |
/** |
| 13 |
* Hook in tabs. |
| 14 |
*/ |
| 15 |
public function __construct() { |
| 16 |
add_action( "current_screen", array( $this, 'add_tabs' ), 50 ); |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Add help tabs |
| 21 |
*/ |
| 22 |
public function add_tabs() { |
| 23 |
|
| 24 |
$screen = get_current_screen(); |
| 25 |
|
| 26 |
/* |
| 27 |
[id] => toplevel_page_dfrapi |
| 28 |
[id] => datafeedr-api_page_dfrapi_networks |
| 29 |
[id] => datafeedr-api_page_dfrapi_merchants |
| 30 |
[id] => datafeedr-api_page_dfrapi_tools |
| 31 |
[id] => datafeedr-api_page_dfrapi_export |
| 32 |
[id] => datafeedr-api_page_dfrapi_import |
| 33 |
[id] => datafeedr-api_page_dfrapi_account |
| 34 |
*/ |
| 35 |
$possible_screens = array( |
| 36 |
'toplevel_page_dfrapi', |
| 37 |
'datafeedr-api_page_dfrapi_networks', |
| 38 |
'datafeedr-api_page_dfrapi_merchants', |
| 39 |
'datafeedr-api_page_dfrapi_tools', |
| 40 |
'datafeedr-api_page_dfrapi_export', |
| 41 |
'datafeedr-api_page_dfrapi_import', |
| 42 |
'datafeedr-api_page_dfrapi_account', |
| 43 |
); |
| 44 |
|
| 45 |
if ( ! in_array( $screen->id, $possible_screens ) ) { return; } |
| 46 |
|
| 47 |
// The following tabs appear on ALL screens. |
| 48 |
dfrapi_help_tab( $screen ); |
| 49 |
|
| 50 |
|
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
endif; |
| 55 |
|
| 56 |
return new Dfrapi_Admin_Help(); |