| 1 |
<?php |
| 2 |
defined('ABSPATH') || die('Access Denied'); |
| 3 |
|
| 4 |
class REACG_Form { |
| 5 |
private $obj; |
| 6 |
|
| 7 |
public function __construct($that, $type = 'support') { |
| 8 |
$this->obj = $that; |
| 9 |
|
| 10 |
if ( is_admin() ) { |
| 11 |
$this->enqueue_scripts(); |
| 12 |
if ( $type === 'support' ) { |
| 13 |
add_action('admin_footer', array( $this, 'support_content' )); |
| 14 |
} |
| 15 |
else if ( $type === 'book-a-call' ) { |
| 16 |
add_action('admin_footer', array( $this, 'book_a_call_content' )); |
| 17 |
} |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
public function support_content() { |
| 22 |
?> |
| 23 |
<div id="reacg-support-popup-overlay" class="reacg-form-popup-overlay" style="display: none;"> |
| 24 |
<div class="reacg-popup"> |
| 25 |
<div class="reacg-popup-header"> |
| 26 |
<?php esc_html_e("Support", 'regallery'); ?> |
| 27 |
<span class="reacg-popup-close dashicons dashicons-no"></span> |
| 28 |
</div> |
| 29 |
<div class="reacg-popup-body"> |
| 30 |
<div class="reacg-note-wrapper"> |
| 31 |
<?php esc_html_e("Have a question or issue?", 'regallery'); ?> |
| 32 |
</div> |
| 33 |
<p> |
| 34 |
<?php esc_html_e("Please post it on our support forum so we can help you faster.", 'regallery'); ?> |
| 35 |
<?php esc_html_e("We actively monitor and prioritize new questions to ensure quick responses.", 'regallery'); ?> |
| 36 |
</p> |
| 37 |
<div class="reacg-buttons-wrapper"> |
| 38 |
<a class="button button-primary" href="https://wordpress.org/support/plugin/regallery/#new-topic-0" target="_blank"> |
| 39 |
<?php esc_html_e("Support Forum", 'regallery'); ?> |
| 40 |
</a> |
| 41 |
</div> |
| 42 |
</div> |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
<?php |
| 46 |
} |
| 47 |
|
| 48 |
public function book_a_call_content() { |
| 49 |
$reasons = [ |
| 50 |
1 => __("Explore Re Gallery Pro with an Expert", "regallery"), |
| 51 |
2 => __("Technical Question", "regallery"), |
| 52 |
3 => __("Plugin Demo", "regallery"), |
| 53 |
4 => __("I have an issue", "regallery"), |
| 54 |
]; |
| 55 |
$current_user = wp_get_current_user(); |
| 56 |
$email = $current_user->exists() ? $current_user->user_email : ""; |
| 57 |
?> |
| 58 |
<div id="reacg-form-popup-overlay" class="reacg-form-popup-overlay" style="display: none;"> |
| 59 |
<div class="reacg-popup" data-version="<?php echo esc_attr($this->obj->version); ?>"> |
| 60 |
<div class="reacg-popup-header"> |
| 61 |
<?php esc_html_e("Talk to a Gallery Expert", 'regallery'); ?> |
| 62 |
<span class="reacg-popup-close dashicons dashicons-no"></span> |
| 63 |
</div> |
| 64 |
<div class="reacg-popup-body"> |
| 65 |
<div class="reacg-note-wrapper"> |
| 66 |
<?php esc_html_e("Choose the reason for your call so we can prepare in advance and help you faster.", 'regallery'); ?> |
| 67 |
</div> |
| 68 |
<div class="reacg-reasonType-wrapper"> |
| 69 |
<?php |
| 70 |
foreach ( $reasons as $key => $reason ) { |
| 71 |
?> |
| 72 |
<div> |
| 73 |
<label> |
| 74 |
<input type="radio" class="reacg-reasonType" name="reacg-reasonType" value="<?php echo esc_attr($key); ?>" alt="<?php echo esc_attr($reason); ?>" /> |
| 75 |
<?php echo esc_attr($reason); ?> |
| 76 |
</label> |
| 77 |
</div> |
| 78 |
<?php |
| 79 |
} |
| 80 |
?> |
| 81 |
</div> |
| 82 |
<div class="reacg-reason-wrapper" style="display: none;"> |
| 83 |
<label> |
| 84 |
<strong><?php esc_html_e("Please describe the issue:", 'regallery'); ?></strong> |
| 85 |
<textarea class="reacg-reason" rows="4"></textarea> |
| 86 |
</label> |
| 87 |
</div> |
| 88 |
</div> |
| 89 |
<div class="reacg-popup-footer"> |
| 90 |
<div class="reacg-email-wrapper"> |
| 91 |
<input type="email" name="reacg-email" placeholder="<?php esc_html_e("Please enter your email", 'regallery'); ?>" value="<?php echo esc_attr(sanitize_email($email)); ?>" /> |
| 92 |
</div> |
| 93 |
<div class="reacg-agreement-wrapper"> |
| 94 |
<label> |
| 95 |
<input type="checkbox" class="reacg-agreement" /> |
| 96 |
<?php |
| 97 |
/* translators: 1: opening anchor tag, 2: closing anchor tag */ |
| 98 |
echo sprintf(esc_html__('I agree to the %1$sprivacy policy%2$s and allow Re Gallery to contact me regarding this request.', 'regallery'), '<a target="_blank" href="https://regallery.team/core/privacy-policy/">', '</a>') |
| 99 |
?> |
| 100 |
</label> |
| 101 |
</div> |
| 102 |
<div class="reacg-buttons-wrapper"> |
| 103 |
<a class="button button-primary reacg-submit" disabled="disabled"> |
| 104 |
<?php esc_html_e("Schedule My Demo", 'regallery'); ?> |
| 105 |
</a> |
| 106 |
<span class="spinner"></span> |
| 107 |
<a class="button reacg-skip"> |
| 108 |
<?php esc_html_e("Cancel", 'regallery'); ?> |
| 109 |
</a> |
| 110 |
</div> |
| 111 |
</div> |
| 112 |
</div> |
| 113 |
</div> |
| 114 |
<?php |
| 115 |
} |
| 116 |
|
| 117 |
public function enqueue_scripts() { |
| 118 |
wp_enqueue_style($this->obj->prefix . '_form', $this->obj->plugin_url . '/assets/css/form.css', [], $this->obj->version); |
| 119 |
wp_enqueue_script($this->obj->prefix . '_form', $this->obj->plugin_url . '/assets/js/form.js', ['jquery'], $this->obj->version, TRUE); |
| 120 |
wp_localize_script($this->obj->prefix . '_form', 'reacg_form', array( |
| 121 |
'core_rest_url_v2' => $this->obj->core_rest_url_v2, |
| 122 |
)); |
| 123 |
} |
| 124 |
} |
| 125 |
|