Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
Admin_Assets | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
enqueue_styles | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
enqueue_scripts | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * The admin-specific functionality of the plugin. |
4 | * |
5 | * @link https://BrianHenry.ie |
6 | * @since 1.0.0 |
7 | * |
8 | * @package bh-wp-autologin-urls |
9 | */ |
10 | |
11 | namespace BrianHenryIE\WP_Autologin_URLs\Admin; |
12 | |
13 | use BrianHenryIE\WP_Autologin_URLs\Settings_Interface; |
14 | |
15 | /** |
16 | * The admin area functionality of the plugin. |
17 | */ |
18 | class Admin_Assets { |
19 | |
20 | /** |
21 | * Needed for the css/js handle, and the version for cache invalidation. |
22 | * |
23 | * @var Settings_Interface |
24 | */ |
25 | protected Settings_Interface $settings; |
26 | |
27 | /** |
28 | * Constructor |
29 | * |
30 | * @param Settings_Interface $settings Plugin settings for slug and version. |
31 | */ |
32 | public function __construct( Settings_Interface $settings ) { |
33 | $this->settings = $settings; |
34 | } |
35 | |
36 | /** |
37 | * Register the stylesheets for the admin area. |
38 | * |
39 | * @hooked admin_enqueue_scripts |
40 | * |
41 | * @since 1.0.0 |
42 | */ |
43 | public function enqueue_styles(): void { |
44 | |
45 | wp_enqueue_style( $this->settings->get_plugin_slug(), plugin_dir_url( $this->settings->get_plugin_basename() ) . 'assets/bh-wp-autologin-urls-admin.css', array(), $this->settings->get_plugin_version(), 'all' ); |
46 | } |
47 | |
48 | /** |
49 | * Register the JavaScript for the admin area. |
50 | * |
51 | * @hooked admin_enqueue_scripts. |
52 | * |
53 | * @since 1.0.0 |
54 | */ |
55 | public function enqueue_scripts(): void { |
56 | |
57 | wp_enqueue_script( $this->settings->get_plugin_slug(), plugin_dir_url( $this->settings->get_plugin_basename() ) . 'assets/bh-wp-autologin-urls-admin.js', array( 'jquery' ), $this->settings->get_plugin_version(), true ); |
58 | } |
59 | } |