PluginProbe
BeyondWords – AI audio for publishers / 6.0.3
BeyondWords – AI audio for publishers v6.0.3
7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.7.0 All 43 releases
speechkit / src / Component / Settings / Tabs / Player / Player.php

Player.php in BeyondWords – AI audio for publishers 6.0.3, at src/Component/Settings/Tabs/Player/Player.php

132 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 /**
6 * Settings > BeyondWords > Player
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\Player;
14
15 use Beyondwords\Wordpress\Component\Settings\Fields\CallToAction\CallToAction;
16 use Beyondwords\Wordpress\Component\Settings\Fields\PlaybackFromSegments\PlaybackFromSegments;
17 use Beyondwords\Wordpress\Component\Settings\Fields\PlaybackControls\PlaybackControls;
18 use Beyondwords\Wordpress\Component\Settings\Fields\PlayerColors\PlayerColors;
19 use Beyondwords\Wordpress\Component\Settings\Fields\PlayerUI\PlayerUI;
20 use Beyondwords\Wordpress\Component\Settings\Fields\PlayerStyle\PlayerStyle;
21 use Beyondwords\Wordpress\Component\Settings\Fields\WidgetPosition\WidgetPosition;
22 use Beyondwords\Wordpress\Component\Settings\Fields\WidgetStyle\WidgetStyle;
23 use Beyondwords\Wordpress\Component\Settings\Fields\TextHighlighting\TextHighlighting;
24
25 /**
26 * "Player" settings tab
27 * @since 5.0.0
28 */
29 class Player
30 {
31 /**
32 * Init
33 *
34 * @since 5.0.0
35 * @since 6.0.0 Make static.
36 */
37 public static function init()
38 {
39 (new PlayerUI())::init();
40 (new PlayerStyle())::init();
41 (new PlayerColors())::init();
42 (new CallToAction())::init();
43 (new WidgetStyle())::init();
44 (new WidgetPosition())::init();
45 (new TextHighlighting())::init();
46 (new PlaybackFromSegments())::init();
47 (new PlaybackControls())::init();
48
49 add_action('admin_init', [self::class, 'addSettingsSection'], 5);
50 }
51
52 /**
53 * Add Settings sections.
54 *
55 * @since 5.0.0
56 * @since 6.0.0 Make static.
57 */
58 public static function addSettingsSection()
59 {
60 add_settings_section(
61 'player',
62 __('Player', 'speechkit'),
63 [self::class, 'sectionCallback'],
64 'beyondwords_player',
65 );
66
67 $toggledSectionArgs = [
68 'before_section' => '<div class="%s">',
69 'after_section' => '</div>',
70 'section_class' => 'beyondwords-settings__player-field-toggle'
71 ];
72
73 add_settings_section(
74 'styling',
75 __('Styling', 'speechkit'),
76 false,
77 'beyondwords_player',
78 $toggledSectionArgs,
79 );
80
81 add_settings_section(
82 'widget',
83 __('Widget', 'speechkit'),
84 false,
85 'beyondwords_player',
86 $toggledSectionArgs,
87 );
88
89 add_settings_section(
90 'playback-controls',
91 __('Playback controls', 'speechkit'),
92 false,
93 'beyondwords_player',
94 $toggledSectionArgs,
95 );
96 }
97
98 /**
99 * Section callback
100 *
101 * @since 5.0.0
102 * @since 6.0.0 Make static.
103 *
104 * @return void
105 **/
106 public static function sectionCallback()
107 {
108 ?>
109 <p class="description">
110 <?php
111 esc_html_e(
112 'By default, these settings are applied to the BeyondWords player for all existing and future posts.',
113 'speechkit'
114 );
115 ?>
116 </p>
117 <p class="description">
118 <?php
119 printf(
120 /* translators: %s is replaced with the beyondwords_player_sdk_params docs link */
121 esc_html__('Unique player settings per-post is supported via the %s filter.', 'speechkit'),
122 sprintf(
123 '<a href="https://docs.beyondwords.io/docs-and-guides/content/connect-cms/wordpress/wordpress-filters/beyondwords_player_sdk_params" target="_blank" rel="nofollow">%s</a>', // phpcs:ignore Generic.Files.LineLength.TooLong
124 'beyondwords_player_sdk_params'
125 )
126 );
127 ?>
128 </p>
129 <?php
130 }
131 }
132