PluginProbe
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code / 3.8.2
Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code v3.8.2
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 / email-address / widget.php

widget.php in Copy Anything to Clipboard for WordPress – Copy Button, Copy Text & Copy Code 3.8.2, at classes/elementor/widgets/email-address/widget.php

128 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Elementor Email Address Block
5 *
6 * @package Copy the Code
7 * @since 3.1.0
8 */
9 namespace CopyTheCode\Elementor\Block\Email;
10
11 use CopyTheCode\Helpers;
12 use Elementor\Widget_Base;
13 use Elementor\Controls_Manager;
14 /**
15 * Email Address Block
16 *
17 * @since 3.1.0
18 */
19 class Address extends Widget_Base {
20 public function __construct( $data = [], $args = null ) {
21 parent::__construct( $data, $args );
22 // Core.
23 wp_enqueue_style(
24 'ctc-blocks',
25 COPY_THE_CODE_URI . 'classes/blocks/assets/css/style.css',
26 [],
27 COPY_THE_CODE_VER,
28 'all'
29 );
30 wp_enqueue_script(
31 'ctc-clipboard',
32 COPY_THE_CODE_URI . 'assets/js/clipboard.js',
33 ['jquery'],
34 COPY_THE_CODE_VER,
35 true
36 );
37 // Block.
38 wp_enqueue_style(
39 'ctc-el-email-address',
40 COPY_THE_CODE_URI . 'classes/elementor/widgets/email-address/style.css',
41 ['ctc-blocks'],
42 COPY_THE_CODE_VER,
43 'all'
44 );
45 }
46
47 public function get_script_depends() {
48 return ['ctc-el-email-address'];
49 }
50
51 public function get_style_depends() {
52 return ['ctc-el-email-address'];
53 }
54
55 public function get_name() {
56 return 'ctc_copy_email_address';
57 }
58
59 public function get_title() {
60 return esc_html__( 'Email Address', 'copy-the-code' );
61 }
62
63 public function get_icon() {
64 return 'eicon-email-field';
65 }
66
67 public function get_categories() {
68 return Helpers::get_categories();
69 }
70
71 public function get_keywords() {
72 return Helpers::get_keywords( [
73 'email',
74 'copy',
75 'content',
76 'address'
77 ] );
78 }
79
80 public function render() {
81 $email = $this->get_settings( 'email' );
82 if ( empty( $email ) ) {
83 return;
84 }
85 ?>
86 <span class="ctc-block ctc-email-address">
87 <a href="mailto:<?php
88 echo esc_attr( $email );
89 ?>" class="ctc-block-content">
90 <?php
91 echo esc_html( $email );
92 ?>
93 </a>
94 <span class="ctc-block-copy ctc-block-copy-icon" role="button" aria-label="Copied">
95 <?php
96 echo Helpers::get_svg_copy_icon();
97 ?>
98 <?php
99 echo Helpers::get_svg_checked_icon();
100 ?>
101 </span>
102 <?php
103 Helpers::render_copy_content( $this, [
104 'content' => $email,
105 ] );
106 ?>
107 </span>
108 <?php
109 }
110
111 protected function _register_controls() {
112 $this->start_controls_section( 'email_address_section', [
113 'label' => esc_html__( 'Email', 'copy-the-code' ),
114 ] );
115 $this->add_control( 'email', [
116 'label' => esc_html__( 'Email Address', 'copy-the-code' ),
117 'type' => Controls_Manager::TEXT,
118 'default' => 'contact@clipboard.agency',
119 'dynamic' => [
120 'active' => true,
121 ],
122 ] );
123 $this->end_controls_section();
124 Helpers::register_pro_sections( $this, ['Email Address', 'Icon'] );
125 }
126
127 }
128