PluginProbe
BeyondWords – AI audio for publishers / 4.1.1
BeyondWords – AI audio for publishers v4.1.1
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 / PrependExcerpt / PrependExcerpt.php

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

96 lines 1.9 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 <stu@beyondwords.io>
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 * Constructor
26 */
27 public function __construct()
28 {
29 add_action('admin_init', array($this, 'init'));
30 }
31
32 /**
33 * Init setting.
34 *
35 * @since 3.0.0
36 *
37 * @return void
38 */
39 public function init()
40 {
41 if (! SettingsUtils::hasApiSettings()) {
42 return;
43 }
44
45 register_setting(
46 'beyondwords',
47 'beyondwords_prepend_excerpt',
48 [
49 'default' => '',
50 ]
51 );
52
53 add_settings_field(
54 'beyondwords-prepend-excerpt',
55 __('Process excerpts', 'speechkit'),
56 array($this, 'render'),
57 'beyondwords',
58 'content'
59 );
60 }
61
62 /**
63 * Render setting field.
64 *
65 * @since 3.0.0
66 * @since 4.0.0 Updated label and description
67 *
68 * @return void
69 **/
70 public function render()
71 {
72 $prependExcerpt = get_option('beyondwords_prepend_excerpt', '');
73 ?>
74 <div>
75 <label>
76 <input
77 type="checkbox"
78 name="beyondwords_prepend_excerpt"
79 value="1"
80 <?php checked($prependExcerpt, '1'); ?>
81 />
82 <?php _e('Use excerpts for summaries', 'speechkit'); ?>
83 </label>
84 </div>
85 <p class="description">
86 <?php
87 _e(
88 'Summaries are read aloud in-between titles and body content.',
89 'speechkit'
90 );
91 ?>
92 </p>
93 <?php
94 }
95 }
96