Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
81.82% |
9 / 11 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
Use_WP_Login | |
81.82% |
9 / 11 |
|
33.33% |
1 / 3 |
4.10 | |
0.00% |
0 / 1 |
get_is_checked_value | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
get_is_not_checked_value | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
__construct | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * This settings field is a checkbox to signify if autologin URLs should be redirect URLs via wp-login.php. |
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\Settings_Fields; |
12 | |
13 | use BrianHenryIE\WP_Autologin_URLs\Settings_Interface; |
14 | use BrianHenryIE\WP_Autologin_URLs\API\Settings; |
15 | |
16 | /** |
17 | * Class |
18 | */ |
19 | class Use_WP_Login extends Checkbox_Setting_Element_Abstract { |
20 | |
21 | protected function get_is_checked_value(): string { |
22 | return 'use_wp_login_is_enabled'; |
23 | } |
24 | protected function get_is_not_checked_value(): string { |
25 | return 'use_wp_login_is_not_enabled'; |
26 | } |
27 | |
28 | /** |
29 | * Admin_Enable constructor. |
30 | * |
31 | * @param string $settings_page_slug_name The slug of the page this setting is being displayed on. |
32 | * @param Settings_Interface $settings The existing settings saved in the database. |
33 | */ |
34 | public function __construct( string $settings_page_slug_name, Settings_Interface $settings ) { |
35 | |
36 | parent::__construct( $settings_page_slug_name ); |
37 | |
38 | $this->value = $settings->get_should_use_wp_login() ? 'use_wp_login_is_enabled' : 'use_wp_login_is_not_enabled'; |
39 | |
40 | $this->id = Settings::SHOULD_USE_WP_LOGIN; |
41 | $this->title = __( 'Use wp-login.php?', 'bh-wp-autologin-urls' ); |
42 | $this->page = $settings_page_slug_name; |
43 | |
44 | $this->register_setting_args['type'] = 'string'; |
45 | $this->register_setting_args['default'] = 'use_wp_login_is_not_enabled'; |
46 | |
47 | $this->add_settings_field_args['helper'] = __( 'If users are not being logged in or if they need to refresh the page after landing, this will perform the login on wp-login.php before redirecting to the correct URL.', 'bh-wp-autologin-urls' ); |
48 | $this->add_settings_field_args['supplemental'] = __( 'default: false', 'bh-wp-autologin-urls' ); |
49 | } |
50 | } |