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