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 |