PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 4.0.0
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v4.0.0
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 trunk 1.0.0 2.0.0 2.0.1 2.0.2 2.0.3 3.0 3.0.1 3.0.2 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1
superb-blocks / src / components / admin / class-newsletter-form.php
superb-blocks / src / components / admin Last commit date
class-content-box-large.php 2 months ago class-encryption-notice.php 2 months ago class-enhancement-settings-component.php 2 months ago class-feature-request-box.php 2 months ago class-input-api-key.php 2 months ago class-input-checkbox.php 2 months ago class-link-box.php 2 months ago class-modal-feedback.php 2 months ago class-modal.php 2 months ago class-navigation.php 2 months ago class-newsletter-form.php 2 months ago class-outdated-browser-warning.php 2 months ago class-premium-box.php 2 months ago class-premium-feature-list.php 2 months ago class-review-box.php 2 months ago class-support-box.php 2 months ago class-support-link-boxes.php 2 months ago
class-newsletter-form.php
59 lines
1 <?php
2
3 namespace SuperbAddons\Components\Admin;
4
5 use SuperbAddons\Admin\Controllers\NewsletterSignupController;
6
7 defined('ABSPATH') || exit();
8
9 class NewsletterForm
10 {
11 public function __construct($title = false, $show_testominal_text = false)
12 {
13 $user_did_subcribe = get_user_meta(get_current_user_id(), 'superbaddons_newsletter_subscribed', true);
14 if ($user_did_subcribe) {
15 return;
16 }
17
18 wp_enqueue_script(NewsletterSignupController::ID, SUPERBADDONS_ASSETS_PATH . '/js/admin/newsletter-form.js', array('jquery'), SUPERBADDONS_VERSION, true);
19 wp_localize_script(NewsletterSignupController::ID, NewsletterSignupController::ACTION, array(
20 'ajax_url' => admin_url('admin-ajax.php'),
21 'nonce' => wp_create_nonce(NewsletterSignupController::ID),
22 'action' => NewsletterSignupController::ACTION,
23 'default_error_message' => __("An unknown error occurred. Please try again later.", "superb-blocks"),
24 ));
25
26 if (!$title) {
27 $title = __("Sign up for our newsletter!", "superb-blocks");
28 }
29
30 $this->Render($title, $show_testominal_text);
31 }
32
33 private function Render($title, $show_testominal_text)
34 {
35 ?>
36 <div class="superbthemes-module-newsletter">
37 <h3><?php echo esc_html($title); ?></h3>
38 <form id="<?php echo esc_attr(NewsletterSignupController::ID); ?>">
39 <input name="email" type="email" placeholder="<?php echo esc_attr__("Your email address...", "superb-blocks"); ?>" required>
40 <button class="superbaddons-newsletter-submit-button" type="submit">
41 <span id="superbaddons-newsletter-submit-text"><?php echo esc_html__("Subscribe", "superb-blocks"); ?></span>
42 <img id="superbaddons-newsletter-submit-spinner" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . "/img/blocks-spinner.svg"); ?>" width="24" height="24" alt="Loading..." style="display:none;">
43 </button>
44 </form>
45 <div id="superbaddons-newsletter-success" style="display:none;">
46 <p class="superbaddons-element-text-xs"><?php echo esc_html__("Thank you for subscribing! Stay tuned for updates, freebies, and more.", "superb-blocks"); ?></p>
47 </div>
48 <div id="superbaddons-newsletter-error" style="display:none;"></div>
49 </div>
50 <div class="superbthemes-module-testimonials">
51 <?php if ($show_testominal_text) : ?>
52 <h3><?php echo esc_html__("Trusted by users worldwide", "superb-blocks"); ?></h3>
53 <?php endif; ?>
54 <img aria-hidden="true" src="<?php echo esc_url(SUPERBADDONS_ASSETS_PATH . "/img/testimonials.svg"); ?>" width="287" height="37" alt="Testimonials">
55 </div>
56 <?php
57 }
58 }
59