PluginProbe
BeyondWords – AI audio for publishers / 4.6.0
BeyondWords – AI audio for publishers v4.6.0
7.2.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 All 44 releases
speechkit / src / Component / Settings / PrependExcerpt / PrependExcerpt.php

PrependExcerpt.php in BeyondWords – AI audio for publishers 4.6.0, at src/Component/Settings/PrependExcerpt/PrependExcerpt.php

109 lines 2.2 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 * Setting: Process excerpts
7 *
8 * @package Beyondwords\Wordpress
9 * @author Stuart McAlpine <[email protected]>
10 * @since 3.0.0
11 */
12
13 namespace Beyondwords\Wordpress\Component\Settings\PrependExcerpt;
14
15 use Beyondwords\Wordpress\Component\Settings\SettingsUtils;
16
17 /**
18 * PrependExcerpt setup
19 *
20 * @since 3.0.0
21 */
22 class PrependExcerpt
23 {
24 /**
25 * Init.
26 *
27 * @since 4.0.0
28 */
29 public function init()
30 {
31 add_action('admin_init', array($this, 'registerSetting'));
32 add_action('admin_init', array($this, 'addSettingsField'));
33 }
34
35 /**
36 * Init setting.
37 *
38 * @since 3.0.0
39 *
40 * @return void
41 */
42 public function registerSetting()
43 {
44 if (! SettingsUtils::hasApiSettings()) {
45 return;
46 }
47
48 register_setting(
49 'beyondwords',
50 'beyondwords_prepend_excerpt',
51 [
52 'default' => '',
53 ]
54 );
55 }
56
57 /**
58 * Init setting.
59 *
60 * @since 3.0.0
61 *
62 * @return void
63 */
64 public function addSettingsField()
65 {
66 add_settings_field(
67 'beyondwords-prepend-excerpt',
68 __('Process excerpts', 'speechkit'),
69 array($this, 'render'),
70 'beyondwords',
71 'content'
72 );
73 }
74
75 /**
76 * Render setting field.
77 *
78 * @since 3.0.0
79 * @since 4.0.0 Updated label and description
80 *
81 * @return void
82 **/
83 public function render()
84 {
85 $prependExcerpt = get_option('beyondwords_prepend_excerpt', '');
86 ?>
87 <div>
88 <label>
89 <input
90 type="checkbox"
91 name="beyondwords_prepend_excerpt"
92 value="1"
93 <?php checked($prependExcerpt, '1'); ?>
94 />
95 <?php _e('Use excerpts for summaries', 'speechkit'); ?>
96 </label>
97 </div>
98 <p class="description">
99 <?php
100 _e(
101 'Summaries are read aloud in-between titles and body content.',
102 'speechkit'
103 );
104 ?>
105 </p>
106 <?php
107 }
108 }
109