PluginProbe
BeyondWords – AI audio for publishers / 6.3.0
BeyondWords – AI audio for publishers v6.3.0
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.3.0, at src/Component/Settings/Tabs/Player/Player.php

134 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 defined('ABSPATH') || exit;
30
31 class Player
32 {
33 /**
34 * Init
35 *
36 * @since 5.0.0
37 * @since 6.0.0 Make static.
38 */
39 public static function init()
40 {
41 (new PlayerUI())::init();
42 (new PlayerStyle())::init();
43 (new PlayerColors())::init();
44 (new CallToAction())::init();
45 (new WidgetStyle())::init();
46 (new WidgetPosition())::init();
47 (new TextHighlighting())::init();
48 (new PlaybackFromSegments())::init();
49 (new PlaybackControls())::init();
50
51 add_action('admin_init', [self::class, 'addSettingsSection'], 5);
52 }
53
54 /**
55 * Add Settings sections.
56 *
57 * @since 5.0.0
58 * @since 6.0.0 Make static.
59 */
60 public static function addSettingsSection()
61 {
62 add_settings_section(
63 'player',
64 __('Player', 'speechkit'),
65 [self::class, 'sectionCallback'],
66 'beyondwords_player',
67 );
68
69 $toggledSectionArgs = [
70 'before_section' => '<div class="%s">',
71 'after_section' => '</div>',
72 'section_class' => 'beyondwords-settings__player-field-toggle'
73 ];
74
75 add_settings_section(
76 'styling',
77 __('Styling', 'speechkit'),
78 false,
79 'beyondwords_player',
80 $toggledSectionArgs,
81 );
82
83 add_settings_section(
84 'widget',
85 __('Widget', 'speechkit'),
86 false,
87 'beyondwords_player',
88 $toggledSectionArgs,
89 );
90
91 add_settings_section(
92 'playback-controls',
93 __('Playback controls', 'speechkit'),
94 false,
95 'beyondwords_player',
96 $toggledSectionArgs,
97 );
98 }
99
100 /**
101 * Section callback
102 *
103 * @since 5.0.0
104 * @since 6.0.0 Make static.
105 *
106 * @return void
107 **/
108 public static function sectionCallback()
109 {
110 ?>
111 <p class="description">
112 <?php
113 esc_html_e(
114 'By default, these settings are applied to the BeyondWords player for all existing and future posts.',
115 'speechkit'
116 );
117 ?>
118 </p>
119 <p class="description">
120 <?php
121 printf(
122 /* translators: %s is replaced with the beyondwords_player_sdk_params docs link */
123 esc_html__('Unique player settings per-post is supported via the %s filter.', 'speechkit'),
124 sprintf(
125 '<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
126 'beyondwords_player_sdk_params'
127 )
128 );
129 ?>
130 </p>
131 <?php
132 }
133 }
134