PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.5.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.5.3
4.9.2 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 All 200 releases
← All changes | includes/Shortcodes/Reactions.php +37 -79 4.9.23.5.3 View file →
@@ -1,93 +1,51 @@
1 1 <?php
2 2
3 3 namespace WPDeveloper\BetterDocs\Shortcodes;
4 -
5 4 use WPDeveloper\BetterDocs\Core\Shortcode;
6 5
7 6 class Reactions extends Shortcode {
8 - public $view_wrapper = 'betterdocs-article-reactions';
7 + public $view_wrapper = 'betterdocs-article-reactions';
9 8
10 - public function get_name() {
11 - return 'betterdocs_article_reactions';
12 - }
9 + public function get_name() {
10 + return 'betterdocs_article_reactions';
11 + }
13 12
14 - public function get_style_depends() {
15 - return [ 'betterdocs-reactions' ];
16 - }
13 + public function get_style_depends() {
14 + return ['betterdocs-reactions'];
15 + }
17 16
18 - public function get_script_depends() {
19 - return [ 'betterdocs-reactions' ];
20 - }
17 + public function get_script_depends() {
18 + return ['betterdocs-reactions'];
19 + }
21 20
22 - /**
23 - * Summary of default_attributes
24 - * @return array
25 - */
26 - public function default_attributes() {
27 - return [
28 - 'text' => '',
29 - 'text_tag' => 'h5',
30 - 'layout' => 'layout-1',
31 - 'happy' => true,
32 - 'happy_icon' => '',
33 - 'normal' => true,
34 - 'normal_icon' => '',
35 - 'sad' => true,
36 - 'sad_icon' => '',
37 - ];
38 - }
21 + /**
22 + * Summary of default_attributes
23 + * @return array
24 + */
25 + public function default_attributes() {
26 + return [
27 + 'text' => ''
28 + ];
29 + }
39 30
40 - public function generate_attributes() {
41 - $attributes = [
42 - 'class' => [
43 - $this->attributes['layout']
44 - ]
45 - ];
31 + /**
32 + * Summary of render
33 + *
34 + * @param mixed $atts
35 + * @param mixed $content
36 + * @return mixed
37 + */
38 + public function render( $atts, $content = null ) {
39 + $this->views( 'widgets/reactions' );
40 + }
46 41
47 - return $attributes;
48 - }
42 + public function view_params() {
43 + $reactions_text = ! empty( $this->attributes['text'] ) ? $this->attributes['text'] : $this->customizer->get(
44 + 'betterdocs_post_reactions_text', __( 'What are your Feelings', 'betterdocs' )
45 + );
49 46
50 - /**
51 - * Summary of render
52 - *
53 - * @param mixed $atts
54 - * @param mixed $content
55 - * @return mixed
56 - */
57 - public function render( $atts, $content = null ) {
58 - $args = [
59 - 'happy' => $atts['happy'],
60 - 'happy_icon' => $atts['happy_icon'],
61 - 'normal' => $atts['normal'],
62 - 'normal_icon' => $atts['normal_icon'],
63 - 'sad' => $atts['sad'],
64 - 'sad_icon' => $atts['sad_icon']
65 - ];
66 -
67 - if ( isset( $atts['layout'] ) && $atts['layout'] == 'layout-2' ) {
68 - $this->views( 'widgets/reactions-2', $args );
69 - } elseif ( isset( $atts['layout'] ) && $atts['layout'] == 'layout-3' ) {
70 - $this->views( 'widgets/reactions-3', $args );
71 - } else {
72 - $this->views( 'widgets/reactions', $args );
73 - }
74 - }
75 -
76 - public function view_params() {
77 - $wrapper_attr = $this->generate_attributes();
78 - $reactions_text = ! empty( $this->attributes['text'] ) ? $this->attributes['text'] : $this->customizer->get(
79 - 'betterdocs_post_reactions_text',
80 - __( 'What are your Feelings', 'betterdocs' )
81 - );
82 - $text_tag = ! empty( $this->attributes['text_tag'] ) ? $this->attributes['text_tag'] : $this->customizer->get(
83 - 'betterdocs_reactions_title_tag',
84 - 'h5'
85 - );
86 -
87 - return [
88 - 'wrapper_attr' => $wrapper_attr,
89 - 'reactions_text' => $reactions_text,
90 - 'text_tag' => $text_tag
91 - ];
92 - }
47 + return [
48 + 'reactions_text' => $reactions_text
49 + ];
50 + }
93 51 }