PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 5.5.4
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v5.5.4
5.5.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 All 79 releases
copy-the-code / includes / elementor / widgets / sms / widget.php

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

183 lines 4.2 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 CTC
7 * @since 5.0.0
8 */
9 namespace CTC\Elementor\Block;
10
11 use CTC\Helpers;
12 use Elementor\Widget_Base;
13 use Elementor\Controls_Manager;
14 /**
15 * SMS Block
16 *
17 * @since 5.0.0
18 */
19 class SMS extends Widget_Base {
20 /**
21 * Constructor
22 *
23 * @param array $data
24 * @param array $args
25 *
26 * @since 5.0.0
27 */
28 public function __construct( $data = [], $args = null ) {
29 parent::__construct( $data, $args );
30 // Register assets; Elementor enqueues via get_*_depends() when used.
31 wp_register_style(
32 'ctc-blocks-core',
33 CTC_URI . 'includes/assets/css/style.css',
34 [],
35 CTC_VER,
36 'all'
37 );
38 wp_register_script(
39 'ctc-lib-core',
40 CTC_URI . 'assets/frontend/js/lib/ctc.js',
41 ['jquery'],
42 CTC_VER,
43 true
44 );
45 wp_register_script(
46 'ctc-blocks-core',
47 CTC_URI . 'includes/assets/js/core.js',
48 ['ctc-lib-core'],
49 CTC_VER,
50 true
51 );
52 wp_register_style(
53 'ctc-el-sms',
54 CTC_URI . 'includes/elementor/widgets/sms/style.css',
55 ['ctc-blocks-core'],
56 CTC_VER,
57 'all'
58 );
59 }
60
61 /**
62 * Get script dependencies
63 */
64 public function get_script_depends() {
65 return ['ctc-lib-core', 'ctc-blocks-core'];
66 }
67
68 /**
69 * Get style dependencies
70 */
71 public function get_style_depends() {
72 return ['ctc-el-sms'];
73 }
74
75 /**
76 * Get name
77 */
78 public function get_name() {
79 return 'ctc_sms';
80 }
81
82 /**
83 * Get title
84 */
85 public function get_title() {
86 return esc_html__( 'SMS', 'ctc' );
87 }
88
89 /**
90 * Get icon
91 */
92 public function get_icon() {
93 return 'eicon-columns';
94 }
95
96 /**
97 * Get categories
98 */
99 public function get_categories() {
100 return Helpers::get_categories();
101 }
102
103 /**
104 * Get keywords
105 */
106 public function get_keywords() {
107 return Helpers::get_keywords( ['sms'] );
108 }
109
110 /**
111 * Render
112 */
113 public function render() {
114 $sms = $this->get_settings_for_display( 'sms' );
115 if ( empty( $sms ) ) {
116 return;
117 }
118 $sms = wpautop( $sms );
119 ?>
120 <div class="ctc-block ctc-sms">
121 <div class="ctc-block-content">
122 <div class="ctc-sms-box">
123 <div class="ctc-sms-text"><?php
124 echo wp_kses_post( $sms );
125 ?></div>
126 </div>
127 </div>
128 <div class="ctc-block-actions">
129 <?php
130 Helpers::render_copy_button( $this );
131 ?>
132 </div>
133 <?php
134 Helpers::render_copy_content( $this );
135 ?>
136 </div>
137 <?php
138 }
139
140 /**
141 * Register controls
142 */
143 protected function _register_controls() {
144 $default = 'You are the most special person in my life. I love you from the deepest core of my heart.';
145 Helpers::register_copy_content_section( $this, [
146 'default' => $default,
147 ] );
148 /**
149 * Group: SMS Section
150 */
151 $this->start_controls_section( 'sms_section', [
152 'label' => esc_html__( 'SMS', 'ctc' ),
153 ] );
154 // Two paragraph gap in pixcel.
155 $this->add_responsive_control( 'line_gap', [
156 'label' => esc_html__( 'Line Gap', 'ctc' ),
157 'type' => Controls_Manager::SLIDER,
158 'size_units' => ['px', 'em'],
159 'range' => [
160 'px' => [
161 'min' => 0,
162 'max' => 100,
163 ],
164 ],
165 'selectors' => [
166 '{{WRAPPER}} .ctc-sms-text p' => 'margin-bottom: {{SIZE}}{{UNIT}};',
167 ],
168 ] );
169 $this->add_control( 'sms', [
170 'label' => esc_html__( 'SMS', 'ctc' ),
171 'type' => Controls_Manager::WYSIWYG,
172 'default' => $default,
173 ] );
174 $this->end_controls_section();
175 Helpers::register_copy_button_section( $this, [
176 'button_text' => esc_html__( 'Copy SMS', 'ctc' ),
177 ] );
178 Helpers::register_pro_sections( $this, ['SMS Box', 'SMS'] );
179 Helpers::register_copy_button_style_section( $this );
180 }
181
182 }
183