PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 4.0.4
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v4.0.4
5.5.3 3.1.0 3.2.0 3.2.1 3.3.0 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.6.0 3.7.0 3.8.0 3.8.1 3.8.2 3.8.3 4.0.0 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 All 78 releases
copy-the-code / classes / elementor / widgets / message / widget.php

widget.php in Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code 4.0.4, at classes/elementor/widgets/message/widget.php

189 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Elementor Message Block
5 *
6 * @package Copy the Code
7 * @since 3.1.0
8 */
9 namespace CopyTheCode\Elementor\Block;
10
11 use CopyTheCode\Helpers;
12 use Elementor\Widget_Base;
13 use Elementor\Controls_Manager;
14 /**
15 * Message Block
16 *
17 * @since 3.1.0
18 */
19 class Message extends Widget_Base {
20 /**
21 * Constructor
22 *
23 * @param array $data
24 * @param array $args
25 *
26 * @since 3.1.0
27 */
28 public function __construct( $data = [], $args = null ) {
29 parent::__construct( $data, $args );
30 // Core.
31 wp_enqueue_style(
32 'ctc-blocks-core',
33 COPY_THE_CODE_URI . 'classes/blocks/assets/css/style.css',
34 [],
35 COPY_THE_CODE_VER,
36 'all'
37 );
38 wp_enqueue_script(
39 'ctc-clipboard',
40 COPY_THE_CODE_URI . 'assets/js/clipboard.js',
41 ['jquery'],
42 COPY_THE_CODE_VER,
43 true
44 );
45 wp_enqueue_script(
46 'ctc-blocks-core',
47 COPY_THE_CODE_URI . 'classes/blocks/assets/js/core.js',
48 ['ctc-clipboard'],
49 COPY_THE_CODE_VER,
50 true
51 );
52 // Block.
53 wp_enqueue_style(
54 'ctc-el-message',
55 COPY_THE_CODE_URI . 'classes/elementor/widgets/message/style.css',
56 ['ctc-blocks-core'],
57 COPY_THE_CODE_VER,
58 'all'
59 );
60 }
61
62 /**
63 * Get script dependencies
64 */
65 public function get_script_depends() {
66 return ['ctc-el-message'];
67 }
68
69 /**
70 * Get style dependencies
71 */
72 public function get_style_depends() {
73 return ['ctc-clipboard', 'ctc-blocks-core'];
74 }
75
76 /**
77 * Get name
78 */
79 public function get_name() {
80 return 'ctc_message';
81 }
82
83 /**
84 * Get title
85 */
86 public function get_title() {
87 return esc_html__( 'Message', 'copy-the-code' );
88 }
89
90 /**
91 * Get icon
92 */
93 public function get_icon() {
94 return 'eicon-columns';
95 }
96
97 /**
98 * Get categories
99 */
100 public function get_categories() {
101 return Helpers::get_categories();
102 }
103
104 /**
105 * Get keywords
106 */
107 public function get_keywords() {
108 return Helpers::get_keywords( ['message'] );
109 }
110
111 /**
112 * Render
113 */
114 public function render() {
115 $message = $this->get_settings_for_display( 'message' );
116 if ( empty( $message ) ) {
117 return;
118 }
119 $message = wpautop( $message );
120 ?>
121 <div class="ctc-block ctc-message">
122 <div class="ctc-block-content">
123 <div class="ctc-message-box">
124 <div class="ctc-message-text"><?php
125 echo wp_kses_post( $message );
126 ?></div>
127 </div>
128 </div>
129 <div class="ctc-block-actions">
130 <?php
131 Helpers::render_copy_button( $this );
132 ?>
133 </div>
134 <?php
135 Helpers::render_copy_content( $this );
136 ?>
137 </div>
138 <?php
139 }
140
141 /**
142 * Register controls
143 */
144 protected function _register_controls() {
145 $default = 'May your birthday be filled with many happy hours and your life with many happy birthdays.
146
147 HAPPY BIRTHDAY !!';
148 Helpers::register_copy_content_section( $this, [
149 'default' => $default,
150 ] );
151 /**
152 * Group: message Section
153 */
154 $this->start_controls_section( 'message_section', [
155 'label' => esc_html__( 'Message', 'copy-the-code' ),
156 ] );
157 // Two paragraph gap in pixcel.
158 $this->add_responsive_control( 'line_gap', [
159 'label' => esc_html__( 'Line Gap', 'copy-the-code' ),
160 'type' => Controls_Manager::SLIDER,
161 'size_units' => ['px', 'em'],
162 'range' => [
163 'px' => [
164 'min' => 0,
165 'max' => 100,
166 ],
167 ],
168 'selectors' => [
169 '{{WRAPPER}} .ctc-message-text p' => 'margin-bottom: {{SIZE}}{{UNIT}};',
170 ],
171 ] );
172 $this->add_control( 'message', [
173 'label' => esc_html__( 'Message', 'copy-the-code' ),
174 'type' => Controls_Manager::WYSIWYG,
175 'default' => $default,
176 'dynamic' => [
177 'active' => true,
178 ],
179 ] );
180 $this->end_controls_section();
181 Helpers::register_copy_button_section( $this, [
182 'button_text' => esc_html__( 'Copy Message', 'copy-the-code' ),
183 ] );
184 Helpers::register_pro_sections( $this, ['Message Box', 'Message'] );
185 Helpers::register_copy_button_style_section( $this );
186 }
187
188 }
189