Completed
Branch FET-10486-add-timestamp-checki... (611b15)
by
unknown
136:24 queued 121:17
created

CoreAdmin   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
dl 0
loc 63
rs 10
c 2
b 0
f 1
wmc 3
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A adminUrl() 0 7 3
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
}