PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 4.0.0
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v4.0.0
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 / sms / widget.php

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

184 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Elementor SMS 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 * SMS Block
16 *
17 * @since 3.1.0
18 */
19 class SMS 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-sms',
55 COPY_THE_CODE_URI . 'classes/elementor/widgets/sms/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-sms'];
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_sms';
81 }
82
83 /**
84 * Get title
85 */
86 public function get_title() {
87 return esc_html__( 'SMS', '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( ['sms'] );
109 }
110
111 /**
112 * Render
113 */
114 public function render() {
115 $sms = $this->get_settings_for_display( 'sms' );
116 if ( empty( $sms ) ) {
117 return;
118 }
119 $sms = wpautop( $sms );
120 ?>
121 <div class="ctc-block ctc-sms">
122 <div class="ctc-block-content">
123 <div class="ctc-sms-box">
124 <div class="ctc-sms-text"><?php
125 echo wp_kses_post( $sms );
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 = 'You are the most special person in my life. I love you from the deepest core of my heart.';
146 Helpers::register_copy_content_section( $this, [
147 'default' => $default,
148 ] );
149 /**
150 * Group: SMS Section
151 */
152 $this->start_controls_section( 'sms_section', [
153 'label' => esc_html__( 'SMS', 'copy-the-code' ),
154 ] );
155 // Two paragraph gap in pixcel.
156 $this->add_responsive_control( 'line_gap', [
157 'label' => esc_html__( 'Line Gap', 'copy-the-code' ),
158 'type' => Controls_Manager::SLIDER,
159 'size_units' => ['px', 'em'],
160 'range' => [
161 'px' => [
162 'min' => 0,
163 'max' => 100,
164 ],
165 ],
166 'selectors' => [
167 '{{WRAPPER}} .ctc-sms-text p' => 'margin-bottom: {{SIZE}}{{UNIT}};',
168 ],
169 ] );
170 $this->add_control( 'sms', [
171 'label' => esc_html__( 'SMS', 'copy-the-code' ),
172 'type' => Controls_Manager::WYSIWYG,
173 'default' => $default,
174 ] );
175 $this->end_controls_section();
176 Helpers::register_copy_button_section( $this, [
177 'button_text' => esc_html__( 'Copy SMS', 'copy-the-code' ),
178 ] );
179 Helpers::register_pro_sections( $this, ['SMS Box', 'SMS'] );
180 Helpers::register_copy_button_style_section( $this );
181 }
182
183 }
184