| 1 |
<?php |
| 2 |
if (! defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
$data = MSE_FOOTER_HELP_DATA; |
| 6 |
?> |
| 7 |
|
| 8 |
<div class="premio-footer-help"> |
| 9 |
<div class="premio-help-wrap"> |
| 10 |
|
| 11 |
<div class="premio-help-menu"> |
| 12 |
|
| 13 |
<?php foreach ($data['footer_menu'] as $key => $value): ?> |
| 14 |
<?php if ($value['status'] == 1): ?> |
| 15 |
<a target="_blank" href="<?php echo esc_url($value['link']) ?>"><?php echo esc_html($value['title']) ?></a> |
| 16 |
<?php endif; ?> |
| 17 |
<?php endforeach; ?> |
| 18 |
</div> |
| 19 |
<div class="premio-help-content"> |
| 20 |
<p><?php esc_html_e("Powered by ", "mystickyelements") ?><a target="_blank" href="<?php echo esc_url($data['premio_site_info']) ?>"><?php esc_html_e("Premio", "mystickyelements") ?></a></p> |
| 21 |
</div> |
| 22 |
</div> |
| 23 |
<div class="premio-help-button-wrap"> |
| 24 |
<!-- Free/Pro Only URL Change --> |
| 25 |
<a class="premio-help-button" href="#"><img src="<?php echo esc_url($data['help_icon']) ?>" alt="<?php esc_html_e("Need help?", 'mystickyelements'); ?>" /></a> |
| 26 |
<a class="premio-help-close-btn" href="#"><img src="<?php echo esc_url($data['close_icon']) ?>" alt="<?php esc_html_e("Close", 'mystickyelements'); ?>" /></a> |
| 27 |
|
| 28 |
<?php |
| 29 |
$option = get_option("mse_help_cta"); |
| 30 |
if ($option !== "yes") { ?> |
| 31 |
<span class="tooltiptext"><?php esc_html_e("Support", "mystickyelements") ?></span> |
| 32 |
<?php } ?> |
| 33 |
<div class="premio-help-absulate-content"> |
| 34 |
<?php foreach ($data['support_widget'] as $key => $value): |
| 35 |
$link = $value['link'] == false ? '#' : esc_url($value['link']); |
| 36 |
$class = $key == 'contact' ? 'contact-us-btn' : 'premio-click-to-close'; |
| 37 |
$target = $key == 'contact' ? '' : '_blank'; |
| 38 |
$pro_class = $key == 'upgrade_to_pro' ? ' pro' : ''; |
| 39 |
?> |
| 40 |
<a target="<?php echo esc_attr($target); ?>" href="<?php echo esc_attr($link) ?>" class="premio-help-absulate-content-single <?php echo esc_attr($class); ?>"> |
| 41 |
<span class="text"><?php echo esc_html($value['title']) ?></span> |
| 42 |
<span class="icon-img <?php echo esc_attr($pro_class); ?>"><img src="<?php echo esc_url($value['icon']) ?>" alt=""></span> |
| 43 |
</a> |
| 44 |
<?php endforeach; ?> |
| 45 |
</div> |
| 46 |
|
| 47 |
</div> |
| 48 |
<div class="premio-help-form"> |
| 49 |
|
| 50 |
<form action="<?php echo esc_url(admin_url('admin-ajax.php')) ?>" method="post" id="premio-help-form"> |
| 51 |
<div class="premio-help-header"> |
| 52 |
<?php esc_html_e("Contact Us", "mystickyelements") ?> |
| 53 |
</div> |
| 54 |
<div class="premio-help-content"> |
| 55 |
<p><?php esc_html_e("Are you experiencing any issues with My Sticky Elements? Please let us know, we’d be happy to help 🙏", 'mystickyelements'); ?></p> |
| 56 |
<div class="premio-form-field"> |
| 57 |
<input type="text" name="user_email" id="user_email" placeholder="<?php esc_html_e("Email", 'mystickyelements'); ?>"> |
| 58 |
</div> |
| 59 |
<div class="premio-form-field"> |
| 60 |
<textarea type="text" name="textarea_text" id="textarea_text" placeholder="<?php esc_html_e("How can I help you?", 'mystickyelements'); ?>"></textarea> |
| 61 |
</div> |
| 62 |
<div class="form-button"> |
| 63 |
<button type="submit" class="premio-help-button-submit" ><?php esc_html_e("Chat", 'mystickyelements') ?></button> |
| 64 |
<input type="hidden" name="action" value="mystickyelements_admin_send_message_to_owner" > |
| 65 |
<input type="hidden" id="nonce" name="nonce" value="<?php echo wp_create_nonce("mystickyelements_send_message_to_owner") ?>"> |
| 66 |
</div> |
| 67 |
</div> |
| 68 |
</form> |
| 69 |
<div class="premio-form-response"></div> |
| 70 |
</div> |
| 71 |
</div> |
| 72 |
|
| 73 |
<script> |
| 74 |
jQuery(document).ready(function(){ |
| 75 |
|
| 76 |
jQuery(".premio-help-button").click(function(e){ |
| 77 |
e.stopPropagation(); |
| 78 |
jQuery(".premio-help-button-wrap .tooltiptext").hide(); |
| 79 |
jQuery(".premio-help-close-btn").addClass('show'); |
| 80 |
jQuery(".premio-help-button").addClass('hide'); |
| 81 |
jQuery(".premio-help-absulate-content").addClass('active'); |
| 82 |
jQuery(".premio-help-absulate-content").removeClass('hide'); |
| 83 |
|
| 84 |
}); |
| 85 |
jQuery(".premio-help-close-btn").click(function(e){ |
| 86 |
e.stopPropagation(); |
| 87 |
jQuery(".premio-help-close-btn").removeClass('show'); |
| 88 |
jQuery(".premio-help-button").removeClass('hide'); |
| 89 |
jQuery(".premio-help-absulate-content").removeClass('active'); |
| 90 |
jQuery(".premio-help-absulate-content").addClass('hide'); |
| 91 |
jQuery(".premio-help-form").hide(); |
| 92 |
|
| 93 |
}); |
| 94 |
jQuery(".premio-click-to-close").click(function(e){ |
| 95 |
jQuery(".premio-help-close-btn").removeClass('show'); |
| 96 |
jQuery(".premio-help-button").removeClass('hide'); |
| 97 |
jQuery(".premio-help-absulate-content").removeClass('active'); |
| 98 |
jQuery(".premio-help-absulate-content").addClass('hide'); |
| 99 |
|
| 100 |
}); |
| 101 |
jQuery("#premio-help-form").submit(function(){ |
| 102 |
jQuery(".premio-help-button-submit").attr("disabled",true); |
| 103 |
jQuery(".premio-help-button-submit").text("<?php esc_html_e("Sending Request...", "mystickyelements") ?>"); |
| 104 |
formData = jQuery(this).serialize(); |
| 105 |
jQuery.ajax({ |
| 106 |
url: "<?php echo esc_url(admin_url('admin-ajax.php')) ?>", |
| 107 |
data: formData, |
| 108 |
type: "post", |
| 109 |
success: function(responseArray){ |
| 110 |
jQuery("#premio-help-form").find(".error-message").remove(); |
| 111 |
jQuery("#premio-help-form").find(".input-error").removeClass("input-error"); |
| 112 |
if(responseArray.error == 1) { |
| 113 |
jQuery(".premio-help-button-submit").attr("disabled",false); |
| 114 |
jQuery(".premio-help-button-submit").text("<?php esc_html_e("Chat", 'mystickyelements'); ?>"); |
| 115 |
for(i=0;i<responseArray.errors.length;i++) { |
| 116 |
jQuery("#"+responseArray.errors[i]['key']).addClass("input-error"); |
| 117 |
jQuery("#"+responseArray.errors[i]['key']).after('<span class="error-message">'+responseArray.errors[i]['message']+'</span>'); |
| 118 |
} |
| 119 |
} else if(responseArray.status == 1) { |
| 120 |
jQuery(".premio-help-button-submit").text("<?php esc_html_e("Done!", 'mystickyelements'); ?>"); |
| 121 |
setTimeout(function(){ |
| 122 |
jQuery("#user_email").val(""); |
| 123 |
jQuery("#textarea_text").val(""); |
| 124 |
jQuery("#premio-help-form").hide(); |
| 125 |
jQuery(".premio-help-header").hide(); |
| 126 |
jQuery(".help-form-footer").hide(); |
| 127 |
jQuery(".premio-form-response").html("<p class='success-p'><?php esc_html_e("Your message is sent successfully.", 'mystickyelements'); ?></p>"); |
| 128 |
},1000); |
| 129 |
} else if(responseArray.status == 0) { |
| 130 |
jQuery("#premio-help-form").hide(); |
| 131 |
jQuery(".premio-help-header").hide(); |
| 132 |
jQuery(".help-form-footer").hide(); |
| 133 |
jQuery(".premio-form-response").html("<p class='error-p'><?php printf(esc_html__("There is some problem in sending request. Please send us mail on %1\$s", 'mystickyelements'), "<a href='mailto:contact@premio.io'>contact@premio.io</a>"); ?></p>"); |
| 134 |
} |
| 135 |
} |
| 136 |
}); |
| 137 |
return false; |
| 138 |
}); |
| 139 |
jQuery(".contact-us-btn").click(function(e){ |
| 140 |
e.stopPropagation(); |
| 141 |
jQuery(".premio-help-form").show(); |
| 142 |
jQuery(".premio-help-form").addClass('active'); |
| 143 |
jQuery(".premio-help-absulate-content").removeClass('active'); |
| 144 |
jQuery(".premio-help-absulate-content").addClass('hide'); |
| 145 |
if(jQuery(".premio-help-button-wrap .tooltiptext").length) { |
| 146 |
jQuery(".premio-help-button-wrap .tooltiptext").remove(); |
| 147 |
jQuery.ajax({ |
| 148 |
url: "<?php echo esc_url(admin_url('admin-ajax.php')) ?>", |
| 149 |
data: { |
| 150 |
nonce: "<?php echo esc_attr(wp_create_nonce("hide_mse_help_cta")) ?>", |
| 151 |
action: "hide_mse_help_cta" |
| 152 |
}, |
| 153 |
type: "post", |
| 154 |
success: function (responseText) { |
| 155 |
|
| 156 |
} |
| 157 |
}); |
| 158 |
} |
| 159 |
|
| 160 |
}); |
| 161 |
|
| 162 |
jQuery(".premio-help-form").click(function(e){ |
| 163 |
e.stopPropagation(); |
| 164 |
}); |
| 165 |
jQuery("body").click(function(){ |
| 166 |
if(jQuery(".premio-help-form").hasClass("active")) { |
| 167 |
jQuery(".premio-help-button").addClass('show'); |
| 168 |
jQuery(".premio-help-button").removeClass('hide'); |
| 169 |
|
| 170 |
jQuery(".premio-help-close-btn").addClass('hide'); |
| 171 |
jQuery(".premio-help-close-btn").removeClass('show'); |
| 172 |
} |
| 173 |
|
| 174 |
jQuery(".premio-help-form").removeClass("active"); |
| 175 |
}); |
| 176 |
}); |
| 177 |
</script> |
| 178 |
|