1 | <?php |
||
7 | class Helper |
||
8 | { |
||
9 | /** |
||
10 | * @param string $name |
||
11 | * @param string $path |
||
12 | * @return string |
||
13 | */ |
||
14 | public function buildClassName( $name, $path = '' ) |
||
22 | |||
23 | /** |
||
24 | * @param string $name |
||
25 | * @param string $prefix |
||
26 | * @return string |
||
27 | */ |
||
28 | public function buildMethodName( $name, $prefix = 'get' ) |
||
32 | |||
33 | /** |
||
34 | * @param string $needle |
||
35 | * @param string $haystack |
||
36 | * @return bool |
||
37 | */ |
||
38 | public function endsWith( $needle, $haystack ) |
||
45 | |||
46 | /** |
||
47 | * @param mixed $fromClass |
||
48 | * @return string |
||
49 | */ |
||
50 | public function getClassname( $fromClass ) |
||
58 | |||
59 | /** |
||
60 | * get_current_screen() is unreliable because it is defined on most admin pages, but not all. |
||
61 | * @return WP_Screen |
||
62 | */ |
||
63 | public function getCurrentScreen() |
||
64 | { |
||
65 | global $hook_suffix, $pagenow; |
||
66 | $screen = function_exists( 'get_current_screen' ) |
||
67 | ? get_current_screen() |
||
68 | : (object) [ |
||
69 | 'base' => $hook_suffix, |
||
70 | 'id' => $hook_suffix, |
||
71 | ]; |
||
72 | $screen->pagenow = $pagenow; |
||
73 | return $screen; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * @param string $needle |
||
78 | * @param string $haystack |
||
79 | * @return bool |
||
80 | */ |
||
81 | public function startsWith( $needle, $haystack ) |
||
85 | |||
86 | /** |
||
87 | * @param mixed $value |
||
88 | * @return array |
||
89 | */ |
||
90 | public function toArray( $value ) |
||
94 | } |
||
95 |