PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 3.7.0
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v3.7.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 / phone-number / widget.php

widget.php in Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code 3.7.0, at classes/elementor/widgets/phone-number/widget.php

168 lines 3.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 Phone Number 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 * Phone Number Block
16 *
17 * @since 3.1.0
18 */
19 class PhoneNumber extends Widget_Base
20 {
21 /**
22 * Constructor
23 */
24 public function __construct( $data = array(), $args = null )
25 {
26 parent::__construct( $data, $args );
27 // Core.
28 wp_enqueue_style(
29 'ctc-blocks',
30 COPY_THE_CODE_URI . 'classes/blocks/assets/css/style.css',
31 [],
32 COPY_THE_CODE_VER,
33 'all'
34 );
35 wp_enqueue_script(
36 'ctc-clipboard',
37 COPY_THE_CODE_URI . 'assets/js/clipboard.js',
38 [ 'jquery' ],
39 COPY_THE_CODE_VER,
40 true
41 );
42 // Block.
43 wp_enqueue_style(
44 'ctc-el-phone-number',
45 COPY_THE_CODE_URI . 'classes/elementor/widgets/phone-number/style.css',
46 [ 'ctc-blocks' ],
47 COPY_THE_CODE_VER,
48 'all'
49 );
50 }
51
52 /**
53 * Get script dependencies
54 */
55 public function get_script_depends()
56 {
57 return [ 'ctc-el-phone-number' ];
58 }
59
60 /**
61 * Get style dependencies
62 */
63 public function get_style_depends()
64 {
65 return [ 'ctc-el-phone-number' ];
66 }
67
68 /**
69 * Get name
70 */
71 public function get_name()
72 {
73 return 'ctc_phone_number';
74 }
75
76 /**
77 * Get title
78 */
79 public function get_title()
80 {
81 return esc_html__( 'Phone Number', 'copy-the-code' );
82 }
83
84 /**
85 * Get icon
86 */
87 public function get_icon()
88 {
89 return 'eicon-number-field';
90 }
91
92 /**
93 * Get categories
94 */
95 public function get_categories()
96 {
97 return Helpers::get_categories();
98 }
99
100 /**
101 * Get keywords
102 */
103 public function get_keywords()
104 {
105 return Helpers::get_keywords( [
106 'phone',
107 'copy',
108 'content',
109 'number'
110 ] );
111 }
112
113 /**
114 * Render
115 */
116 public function render()
117 {
118 $phone_number = $this->get_settings( 'phone_number' );
119 if ( empty($phone_number) ) {
120 return;
121 }
122 ?>
123 <span class="ctc-block ctc-phone-number">
124 <a href="tel:<?php
125 echo esc_attr( $phone_number ) ;
126 ?>" class="ctc-block-content">
127 <?php
128 echo esc_html( $phone_number ) ;
129 ?>
130 </a>
131 <span class="ctc-block-copy ctc-block-copy-icon" role="button" aria-label="Copied">
132 <?php
133 echo Helpers::get_svg_copy_icon() ;
134 ?>
135 <?php
136 echo Helpers::get_svg_checked_icon() ;
137 ?>
138 </span>
139 <?php
140 Helpers::render_copy_content( $this, [
141 'content' => $phone_number,
142 ] );
143 ?>
144 </span>
145 <?php
146 }
147
148 /**
149 * Register controls
150 */
151 protected function _register_controls()
152 {
153 $this->start_controls_section( 'phone_number_section', [
154 'label' => esc_html__( 'Phone Number', 'copy-the-code' ),
155 ] );
156 $this->add_control( 'phone_number', [
157 'label' => esc_html__( 'Phone Number', 'copy-the-code' ),
158 'type' => Controls_Manager::TEXT,
159 'default' => '+1234567890',
160 'dynamic' => [
161 'active' => true,
162 ],
163 ] );
164 $this->end_controls_section();
165 Helpers::register_pro_sections( $this, [ 'Phone Number', 'Icon' ] );
166 }
167
168 }