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 / email-sample / widget.php

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

170 lines 4.4 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 Sample Block
5 *
6 * @package CTC
7 * @since 5.0.0
8 */
9 namespace CTC\Elementor\Block\Email;
10
11 use CTC\Helpers;
12 use Elementor\Widget_Base;
13 use Elementor\Controls_Manager;
14 /**
15 * Email Sample Block
16 *
17 * @since 5.0.0
18 */
19 class Sample 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-email-sample',
54 CTC_URI . 'includes/elementor/widgets/email-sample/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-email-sample'];
73 }
74
75 /**
76 * Get name
77 */
78 public function get_name() {
79 return 'ctc_copy_email_sample';
80 }
81
82 /**
83 * Get title
84 */
85 public function get_title() {
86 return esc_html__( 'Email Sample', 'ctc' );
87 }
88
89 /**
90 * Get icon
91 */
92 public function get_icon() {
93 return 'eicon-facebook-comments';
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( [
108 'email',
109 'copy',
110 'content',
111 'template'
112 ] );
113 }
114
115 /**
116 * Render
117 */
118 public function render() {
119 $sample_email = $this->get_settings_for_display( 'sample_email' );
120 if ( empty( $sample_email ) ) {
121 return;
122 }
123 $display_content = preg_replace( '/\\[([^\\]]*)\\]/', '<span class="ctc-email-highlight">[$1]</span>', $sample_email );
124 $display_content = wpautop( $display_content );
125 ?>
126 <div class="ctc-block ctc-email-sample">
127 <div class="ctc-block-content">
128 <?php
129 echo wp_kses_post( $display_content );
130 ?>
131 </div>
132 <div class="ctc-block-actions">
133 <?php
134 Helpers::render_copy_button( $this );
135 ?>
136 </div>
137 <?php
138 Helpers::render_copy_content( $this, [
139 'content' => wp_kses_post( $sample_email ),
140 ] );
141 ?>
142 </div>
143 <?php
144 }
145
146 /**
147 * Register controls
148 */
149 protected function _register_controls() {
150 /**
151 * Group: Email Section
152 */
153 $this->start_controls_section( 'email_section', [
154 'label' => esc_html__( 'Email Sample', 'ctc' ),
155 ] );
156 $this->add_control( 'sample_email', [
157 'label' => esc_html__( 'Email Sample', 'ctc' ),
158 'type' => Controls_Manager::TEXTAREA,
159 'default' => "Subject: Application for [Job Title] - [Your Name]\n\nDear [Hiring Manager's Name],\n\nI hope this email finds you well. I am writing to express my strong interest in the [Job Title] position at [Company Name], as advertised on your website. With my background in [Relevant Skill/Experience] and a passion for [Company's Mission or Industry], I believe I am a strong fit for your team.\n\nSincerely,\n[Your Name]\n[Your Contact Information]",
160 'rows' => 10,
161 'description' => esc_html__( 'Use [ ] to highlight the text.', 'ctc' ),
162 ] );
163 $this->end_controls_section();
164 Helpers::register_copy_button_section( $this );
165 Helpers::register_pro_sections( $this, ['Email Sample', 'Highlight Text'] );
166 Helpers::register_copy_button_style_section( $this );
167 }
168
169 }
170