| 1 |
<?php |
| 2 |
// @codingStandardsIgnoreFile |
| 3 |
/** |
| 4 |
* Get Help Panel (markup only; $draft and $notice provided by class). |
| 5 |
* |
| 6 |
* @package s2Member\Menu_Pages |
| 7 |
* @since 250824 |
| 8 |
*/ |
| 9 |
|
| 10 |
if (!defined('WPINC')) |
| 11 |
exit('Do not access this file directly.'); |
| 12 |
|
| 13 |
// Build action URL (same page, strip noisy args). |
| 14 |
$action = esc_url(remove_query_arg( |
| 15 |
array('s2m_help','updated','settings-updated','error'), |
| 16 |
wp_unslash($_SERVER['REQUEST_URI']) |
| 17 |
)); |
| 18 |
|
| 19 |
// Visible mailbox (filterable) + optional support portal link. |
| 20 |
$mailbox = apply_filters('ws_plugin__s2member_get_help_mailbox', 'support@wpsharks.com'); |
| 21 |
$subject_def = apply_filters('ws_plugin__s2member_get_help_subject', ''); // keep default blank |
| 22 |
$support_url = 'https://s2member.com/support?s2=1'; |
| 23 |
|
| 24 |
echo '<style> |
| 25 |
.ws-plugin--s2member-get-help-panel label {font-size: 115%; weight: 600;} |
| 26 |
.ws-plugin--s2member-get-help-panel input:not([type="submit"]), |
| 27 |
.ws-plugin--s2member-get-help-panel textarea {max-width: 700px !important;} |
| 28 |
</style>'; |
| 29 |
|
| 30 |
echo '<div class="ws-menu-page-group" title="Need Help? 🛟 " default-state="closed">' . "\n"; |
| 31 |
echo ' <div class="ws-menu-page-section ws-plugin--s2member-get-help-panel">' . "\n"; |
| 32 |
|
| 33 |
if (!empty($notice['type'])) { |
| 34 |
$class = $notice['type'] === 'success' ? 'notice-success' : 'notice-error'; |
| 35 |
echo ' <div class="notice '.$class.' is-dismissible" style="margin:0 0 12px;"><p>'.esc_html($notice['text']).'</p></div>'."\n"; |
| 36 |
} |
| 37 |
|
| 38 |
echo ' <p>If you have questions, run into a problem, or aren’t sure how to achieve the setup you have in mind, free support is available.</p>'."\n"; |
| 39 |
|
| 40 |
echo ' <p>If you’d like us to take care of setup, configuration, customizations, or even build new features for you, we also offer professional services.</p>'."\n"; |
| 41 |
|
| 42 |
echo ' <p>Please use the form below to tell us the details of what you need or want:</p>'."\n"; |
| 43 |
|
| 44 |
echo ' <form method="post" action="'.$action.'" style="margin-top:.75em;" onsubmit="this.querySelector(\'button[type=submit]\').setAttribute(\'disabled\',\'disabled\');">' . "\n"; |
| 45 |
echo ' ' . wp_nonce_field('s2member_get_help', 's2m_help_nonce', true, false) . "\n"; |
| 46 |
echo ' <input type="hidden" name="s2m_help_submit" value="1" />' . "\n"; |
| 47 |
|
| 48 |
echo ' <p><label for="s2m_help_name"><strong>Your Name</strong></label><br />' . "\n"; |
| 49 |
echo ' <input type="text" id="s2m_help_name" name="name" class="regular-text" value="'.esc_attr($draft['name']).'" /></p>' . "\n"; |
| 50 |
|
| 51 |
echo ' <p><label for="s2m_help_email"><strong>Your Email</strong></label> *<br />' . "\n"; |
| 52 |
echo ' <input type="email" id="s2m_help_email" name="email" class="regular-text" value="'.esc_attr($draft['email']).'" required /></p>' . "\n"; |
| 53 |
|
| 54 |
echo ' <p><label for="s2m_help_subject"><strong>Subject</strong></label> *<br />' . "\n"; |
| 55 |
echo ' <input type="text" id="s2m_help_subject" name="subject" class="regular-text" value="'.esc_attr($draft['subject']).'" placeholder="'.esc_attr($subject_def).'" required /></p>' . "\n"; |
| 56 |
|
| 57 |
echo ' <p><label for="s2m_help_details"><strong>How can I help?</strong></label> *<br />' . "\n"; |
| 58 |
echo ' <textarea id="s2m_help_details" name="details" class="large-text code" rows="6" placeholder="Describe your support question or what you need done." required>'.esc_textarea($draft['details']).'</textarea></p>' . "\n"; |
| 59 |
|
| 60 |
echo ' <p><label for="s2m_help_meta"><strong>Additional details</strong></label><br />' . "\n"; |
| 61 |
echo ' <textarea id="s2m_help_meta" name="meta" class="large-text code" rows="2">'.esc_textarea($draft['meta']).'</textarea></p>' . "\n"; |
| 62 |
|
| 63 |
echo ' <p>' . "\n"; |
| 64 |
echo ' <button type="submit" class="button button-primary">Send</button> ' . "\n"; |
| 65 |
echo ' <span style="margin-left:.5em;color:#555d66;">(You’ll get a copy.) Or email <a href="mailto:'.esc_attr($mailbox).'">'.esc_html($mailbox).'</a>. ' . "\n"; |
| 66 |
echo ' Or <a href="'.esc_url($support_url).'" target="_blank" rel="noopener">open the Support page</a>.</span>' . "\n"; |
| 67 |
echo ' </p>' . "\n"; |
| 68 |
|
| 69 |
echo ' </form>' . "\n"; |
| 70 |
|
| 71 |
echo ' </div>' . "\n"; |
| 72 |
echo '</div>' . "\n"; |
| 73 |
|