1
|
|
|
<?php |
2
|
|
|
namespace Page; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* CoreAdmin |
6
|
|
|
* This is a set of page properties and helper methods for any generic EE Admin page stuff. Typically, |
7
|
|
|
* specific EE Admin Page will extend this for their functionality. |
8
|
|
|
* |
9
|
|
|
* @package Page |
10
|
|
|
* @author Darren Ethier |
11
|
|
|
* @since 1.0.0 |
12
|
|
|
*/ |
13
|
|
|
class CoreAdmin |
14
|
|
|
{ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
const URL_PREFIX = 'admin.php?page='; |
20
|
|
|
|
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* This is the selector for the next page button on list tables. |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
const ADMIN_LIST_TABLE_NEXT_PAGE_CLASS = '.next-page'; |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The selector for the search input submit button on list table pages |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
const LIST_TABLE_SEARCH_SUBMIT_SELECTOR = '#search-submit'; |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Selector for the screen options dropdown. |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
const WP_SCREEN_SETTINGS_LINK_SELECTOR = '#show-settings-link'; |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Selector for the per page field setting selector (found within screen options dropdown) |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
const WP_SCREEN_SETTINGS_PER_PAGE_FIELD_SELECTOR = '.screen-per-page'; |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Selector for apply screen options settings. |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
const WP_SCREEN_OPTIONS_APPLY_SETTINGS_BUTTON_SELECTOR = '#screen-options-apply'; |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Get the EE admin url for the given properties. |
59
|
|
|
* Note, this is JUST the endpoint for the admin route. It is expected that the actor/test would be calling this |
60
|
|
|
* with `amOnAdminPage` action. |
61
|
|
|
* |
62
|
|
|
* @param string $page |
63
|
|
|
* @param string $action |
64
|
|
|
* @param string $additional_params |
65
|
|
|
* @return string |
66
|
|
|
*/ |
67
|
|
|
public static function adminUrl($page = 'espresso_events', $action = 'default', $additional_params = '') |
68
|
|
|
{ |
69
|
|
|
$url = self::URL_PREFIX . $page; |
70
|
|
|
$url .= $action ? '&action=' . $action : ''; |
71
|
|
|
$url .= $additional_params ? '&' . ltrim('&', ltrim('?', $additional_params)) : ''; |
72
|
|
|
return $url; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Returns the selector for the text tab switcher for a wp-editor instance. |
78
|
|
|
* @param $field_reference |
79
|
|
|
* @return string |
80
|
|
|
*/ |
81
|
|
|
public static function wpEditorTextTabSelector($field_reference) |
82
|
|
|
{ |
83
|
|
|
return '#content-' . $field_reference . '-content-html'; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Returns the selector for the textarea exposed when clicing the text tab switcher for a wp-editor instance. |
89
|
|
|
* @param $field_reference |
90
|
|
|
* @return string |
91
|
|
|
*/ |
92
|
|
|
public static function wpEditorTextAreaSelector($field_reference) |
93
|
|
|
{ |
94
|
|
|
return '#content-' . $field_reference . '-content'; |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|