Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
28.00% |
7 / 25 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
Pronunciations | |
28.00% |
7 / 25 |
|
66.67% |
2 / 3 |
6.36 | |
0.00% |
0 / 1 |
init | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
addSettingsSection | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
sectionCallback | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | /** |
6 | * Settings > BeyondWords > Pronunciations |
7 | * |
8 | * @package Beyondwords\Wordpress |
9 | * @author Stuart McAlpine <stu@beyondwords.io> |
10 | * @since 5.0.0 |
11 | */ |
12 | |
13 | namespace Beyondwords\Wordpress\Component\Settings\Tabs\Pronunciations; |
14 | |
15 | use Beyondwords\Wordpress\Core\Environment; |
16 | |
17 | /** |
18 | * "Pronunciations" settings tab |
19 | * |
20 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
21 | * |
22 | * @since 5.0.0 |
23 | */ |
24 | class Pronunciations |
25 | { |
26 | /** |
27 | * Init |
28 | * |
29 | * @since 5.0.0 |
30 | */ |
31 | public function init() |
32 | { |
33 | add_action('admin_init', array($this, 'addSettingsSection'), 5); |
34 | } |
35 | |
36 | /** |
37 | * Add Settings sections. |
38 | * |
39 | * @since 5.0.0 |
40 | */ |
41 | public function addSettingsSection() |
42 | { |
43 | add_settings_section( |
44 | 'pronunciations', |
45 | __('Pronunciations', 'speechkit'), |
46 | array($this, 'sectionCallback'), |
47 | 'beyondwords_pronunciations', |
48 | ); |
49 | } |
50 | |
51 | /** |
52 | * Section callback |
53 | * |
54 | * @since 5.0.0 |
55 | * |
56 | * @return void |
57 | **/ |
58 | public function sectionCallback() |
59 | { |
60 | $rulesUrl = sprintf( |
61 | '%s/dashboard/project/%s/settings?tab=rules', |
62 | Environment::getDashboardUrl(), |
63 | get_option('beyondwords_project_id'), |
64 | ); |
65 | ?> |
66 | <p class="description"> |
67 | <?php |
68 | esc_html_e( |
69 | 'Create a custom pronunciation rule for any word or phrase.', |
70 | 'speechkit' |
71 | ); |
72 | ?> |
73 | </p> |
74 | <p class="description"> |
75 | <a href="<?php echo esc_url($rulesUrl); ?>" target="_blank" class="button button-primary"> |
76 | <?php esc_html_e('Manage pronunciations', 'speechkit'); ?> |
77 | </a> |
78 | </p> |
79 | <?php |
80 | } |
81 | } |