PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.5.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.5.5
4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.5.2 All 199 releases
betterdocs / includes / Editors / BlockEditor / Blocks / ReadingTime.php

ReadingTime.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.5.5, at includes/Editors/BlockEditor/Blocks/ReadingTime.php

43 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPDeveloper\BetterDocs\Editors\BlockEditor\Blocks;
4
5 use WPDeveloper\BetterDocs\Editors\BlockEditor\Block;
6
7 class ReadingTime extends Block {
8
9 protected $frontend_styles = [
10 'reading-time'
11 ];
12
13 protected $editor_styles = [
14 'reading-time'
15 ];
16
17 public function get_name() {
18 return 'reading-time';
19 }
20
21 public function get_default_attributes() {
22 return [
23 'blockId' => '',
24 'readingTimeTitle' => '',
25 'readingTimeText' => __( 'min read', 'betterdocs' ),
26 'singularReadingTimeText' => __( 'min read', 'betterdocs' )
27 ];
28 }
29
30 public function render( $attributes, $content ) {
31 $settings = $attributes;
32 echo '<div class="' . esc_attr( $settings['blockId'] ) . '">';
33 echo do_shortcode( '[betterdocs_reading_time singular_reading_text="' . esc_html( $settings['singularReadingTimeText'] ) . '" reading_text="' . esc_html( $settings['readingTimeText'] ) . '" reading_title="' . esc_html( $settings['readingTimeTitle'] ) . '"]' );
34 echo '</div>';
35 }
36
37 public function view_params() {
38 return [
39 'reactions_text' => $this->attributes['reaction_text']
40 ];
41 }
42 }
43