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 | * @since 5.0.0 |
| 24 | */ |
| 25 | class Voices |
| 26 | { |
| 27 | /** |
| 28 | * Init |
| 29 | * |
| 30 | * @since 5.0.0 |
| 31 | * @since 6.0.0 Make static. |
| 32 | */ |
| 33 | public static function init() |
| 34 | { |
| 35 | Language::init(); |
| 36 | TitleVoice::init(); |
| 37 | TitleVoiceSpeakingRate::init(); |
| 38 | BodyVoice::init(); |
| 39 | BodyVoiceSpeakingRate::init(); |
| 40 | |
| 41 | add_action('admin_init', [self::class, 'addSettingsSection'], 5); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Add Settings sections. |
| 46 | * |
| 47 | * @since 5.0.0 |
| 48 | * @since 6.0.0 Make static. |
| 49 | */ |
| 50 | public static function addSettingsSection() |
| 51 | { |
| 52 | add_settings_section( |
| 53 | 'voices', |
| 54 | __('Voices', 'speechkit'), |
| 55 | [self::class, 'sectionCallback'], |
| 56 | 'beyondwords_voices', |
| 57 | ); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Section callback |
| 62 | * |
| 63 | * @since 5.0.0 |
| 64 | * @since 6.0.0 Make static. |
| 65 | * |
| 66 | * @return void |
| 67 | **/ |
| 68 | public static 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 | } |