Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
41.38% |
12 / 29 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
Voices | |
41.38% |
12 / 29 |
|
66.67% |
2 / 3 |
4.81 | |
0.00% |
0 / 1 |
init | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
addSettingsSection | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
sectionCallback | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | /** |
6 | * Settings > BeyondWords > Voices |
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\Voices; |
14 | |
15 | use Beyondwords\Wordpress\Component\Settings\Fields\SpeakingRate\BodyVoiceSpeakingRate; |
16 | use Beyondwords\Wordpress\Component\Settings\Fields\SpeakingRate\TitleVoiceSpeakingRate; |
17 | use Beyondwords\Wordpress\Component\Settings\Fields\Voice\BodyVoice; |
18 | use Beyondwords\Wordpress\Component\Settings\Fields\Voice\TitleVoice; |
19 | use Beyondwords\Wordpress\Component\Settings\Fields\Language\Language; |
20 | |
21 | /** |
22 | * "Voices" settings tab |
23 | * |
24 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
25 | * |
26 | * @since 5.0.0 |
27 | */ |
28 | class Voices |
29 | { |
30 | /** |
31 | * Init |
32 | * |
33 | * @since 5.0.0 |
34 | */ |
35 | public function init() |
36 | { |
37 | (new Language())->init(); |
38 | (new TitleVoice())->init(); |
39 | (new TitleVoiceSpeakingRate())->init(); |
40 | (new BodyVoice())->init(); |
41 | (new BodyVoiceSpeakingRate())->init(); |
42 | |
43 | add_action('admin_init', array($this, 'addSettingsSection'), 5); |
44 | } |
45 | |
46 | /** |
47 | * Add Settings sections. |
48 | * |
49 | * @since 5.0.0 |
50 | */ |
51 | public function addSettingsSection() |
52 | { |
53 | add_settings_section( |
54 | 'voices', |
55 | __('Voices', 'speechkit'), |
56 | [$this, 'sectionCallback'], |
57 | 'beyondwords_voices', |
58 | ); |
59 | } |
60 | |
61 | /** |
62 | * Section callback |
63 | * |
64 | * @since 5.0.0 |
65 | * |
66 | * @return void |
67 | **/ |
68 | public function sectionCallback() |
69 | { |
70 | ?> |
71 | <p class="description"> |
72 | <?php |
73 | esc_html_e( |
74 | 'Choose the default voices you want for your audio.', |
75 | 'speechkit' |
76 | ); |
77 | ?> |
78 | </p> |
79 | <p class="description hint"> |
80 | <em> |
81 | <?php |
82 | esc_html_e( |
83 | 'To generate audio for existing posts or apply updates to them, you must update the posts.', |
84 | 'speechkit' |
85 | ); |
86 | ?> |
87 | </em> |
88 | </p> |
89 | <?php |
90 | } |
91 | } |