/** * Print the premium help section with inline support form. * * @since 4.7 */ function wprss_premium_help_display() { // Get the first valid license. $addon = ''; $statuses = get_option('wprss_settings_license_statuses', array()); foreach ($statuses as $key => $value) { // If we're looking at a license status key... if (strpos($key, '_license_status') !== FALSE) { // ...and the license is valid... if ($value === 'valid') { $addon = substr($key, 0, strpos($key, '_license_status')); break; } } } // If we didn't find an add-on with a valid license, show the free help text. if ($addon === '') { wprss_free_help_display(); return; } // Get the full license info so we can prefill the name and email $license = wprss_edd_check_license($addon, NULL, 'ALL'); $customer_name = is_object($license) ? $license->customer_name : ''; $customer_email = is_object($license) ? $license->customer_email : ''; echo '<h3>' . __('Email Support', WPRSS_TEXT_DOMAIN) . '</h3>'; echo wpautop(__("If you still can't find an answer to your query after reading the documentation and going through the FAQ, just fill out the support request form below. We'll be happy to help you out.", WPRSS_TEXT_DOMAIN)); ?> <form method="post"> <table> <tr> <td><strong><?php _e('From: ', WPRSS_TEXT_DOMAIN); ?> </strong></td> <td><input type='text' name='support-name' value="<?php echo esc_attr($customer_name); ?> " placeholder='<?php echo esc_attr('Name', WPRSS_TEXT_DOMAIN); ?> ' style='width:100%;'></td> <td><input type='text' name='support-email' value="<?php echo esc_attr($customer_email); ?> " placeholder='<?php echo esc_attr('Email', WPRSS_TEXT_DOMAIN); ?> ' style='width:100%;'></td> </tr> <tr> <td colspan="3" style="text-align:right;"><small><?php _e('Replies will be sent to this email address.'); ?> </small></td> </tr> <tr> <td colspan="3"><input type='text' name='support-subject' placeholder='<?php echo esc_attr('Subject', WPRSS_TEXT_DOMAIN); ?> ' style='width:100%;'></td> </tr> <tr> <td colspan="3"><textarea name='support-message' rows='10' cols='80' placeholder='<?php echo esc_attr('Message', WPRSS_TEXT_DOMAIN); ?> '></textarea></td> </tr> <tr> <td colspan="3"><strong><?php _e('Attachments', WPRSS_TEXT_DOMAIN); ?> : </strong></td> </tr> <tr> <td colspan="3"><input type='checkbox' name='support-include-log' value='checked' checked><?php _e('WP RSS Aggregator log file', WPRSS_TEXT_DOMAIN); ?> </td> </tr> <tr> <td colspan="3"><input type='checkbox' name='support-include-sys' value='checked' checked><?php _e('WordPress information', WPRSS_TEXT_DOMAIN); ?> </td> </tr> </table> </form> <div style='line-height:2.3em;'> <button id='send-message-btn' class='button button-primary'><?php _e('Send Message', WPRSS_TEXT_DOMAIN); ?> </button> <span id='support-error'></span> </div> <?php }
/** * Renders the activate/deactivate license button for a particular add-on. * * @since 4.4.5 */ function wprss_activate_license_button($args) { $addon_id = $args[0]; $status = wprss_edd_check_license($addon_id); if ($status === 'site_inactive') { $status = 'inactive'; } $valid = $status == 'valid'; $btn_text = $valid ? 'Deactivate License' : 'Activate License'; $btn_name = "wprss_{$addon_id}_license_" . ($valid ? 'deactivate' : 'activate'); wp_nonce_field("wprss_{$addon_id}_license_nonce", "wprss_{$addon_id}_license_nonce"); ?> <input type="submit" class="button-secondary" name="<?php echo $btn_name; ?> " value="<?php _e($btn_text, 'wprss'); ?> " /> <span id="wprss-<?php echo $addon_id; ?> -license-status-text"> <strong>Status: <span class="wprss-<?php echo $addon_id; ?> -license-<?php echo $status; ?> "> <?php _e(ucfirst($status), 'wprss'); ?> <?php if ($status === 'valid') { ?> <i class="fa fa-check"></i> <?php } elseif ($status === 'invalid') { ?> <i class="fa fa-times"></i> <?php } elseif ($status === 'inactive') { ?> <i class="fa fa-warning"></i> <?php } ?> </strong> </span> </span> <style type="text/css"> .wprss-<?php echo $addon_id; ?> -license-valid { color: green; } .wprss-<?php echo $addon_id; ?> -license-invalid { color: #b71919; } .wprss-<?php echo $addon_id; ?> -license-inactive { color: #d19e5b; } #wprss-<?php echo $addon_id; ?> -license-status-text { margin-left: 8px; line-height: 27px; vertical-align: middle; } </style> <?php }
/** * Renders the activate/deactivate license button for a particular add-on. * * @since 4.4.5 */ function wprss_activate_license_button($args) { $addon_id = $args[0]; $data = wprss_edd_check_license($addon_id, NULL, 'ALL'); $status = is_string($data) ? $data : $data->license; if ($status === 'site_inactive') { $status = 'inactive'; } if ($status === 'item_name_mismatch') { $status = 'invalid'; } $valid = $status == 'valid'; $btn_text = $valid ? 'Deactivate License' : 'Activate License'; $btn_name = "wprss_{$addon_id}_license_" . ($valid ? 'deactivate' : 'activate'); $btn_class = "button-" . ($valid ? 'deactivate' : 'activate') . "-license"; wp_nonce_field("wprss_{$addon_id}_license_nonce", "wprss_{$addon_id}_license_nonce", false); ?> <input type="button" class="<?php echo $btn_class; ?> button-process-license button-secondary" name="<?php echo $btn_name; ?> " value="<?php _e($btn_text, WPRSS_TEXT_DOMAIN); ?> " /> <span id="wprss-<?php echo $addon_id; ?> -license-status-text"> <strong><?php _e('Status', WPRSS_TEXT_DOMAIN); ?> : <span class="wprss-<?php echo $addon_id; ?> -license-<?php echo $status; ?> "> <?php _e(ucfirst($status), WPRSS_TEXT_DOMAIN); ?> <?php if ($status === 'valid') { ?> <i class="fa fa-check"></i> <?php } elseif ($status === 'invalid' || $status === 'expired') { ?> <i class="fa fa-times"></i> <?php } elseif ($status === 'inactive') { ?> <i class="fa fa-warning"></i> <?php } ?> </strong> </span> </span> <p> <?php $license_key = wprss_get_license_key($addon_id); if (!empty($license_key)) { if (is_object($data)) { $acts_current = $data->site_count; $acts_left = $data->activations_left; $acts_limit = $data->license_limit; $expires = $data->expires; $expires = substr($expires, 0, strpos($expires, " ")); // If the license key is garbage, don't show any of the data. if (!empty($data->payment_id) && !empty($data->license_limit)) { ?> <small> <?php if ($status !== 'valid' && $acts_left === 0) { ?> <?php $account_url = 'https://www.wprssaggregator.com/account/?action=manage_licenses&payment_id=' . $data->payment_id; ?> <a href="<?php echo $account_url; ?> "><?php _e("No activations left. Click here to manage the sites you've activated licenses on.", WPRSS_TEXT_DOMAIN); ?> </a> <br/> <?php } ?> <?php if (strtotime($expires) < strtotime("+2 weeks")) { ?> <?php $renewal_url = esc_attr(WPRSS_SL_STORE_URL . '/checkout/?edd_license_key=' . $license_key); ?> <a href="<?php echo $renewal_url; ?> "><?php _e('Renew your license to continue receiving updates and support.', WPRSS_TEXT_DOMAIN); ?> </a> <br/> <?php } ?> <strong><?php _e('Activations', WPRSS_TEXT_DOMAIN); ?> :</strong> <?php echo $acts_current . '/' . $acts_limit; ?> (<?php echo $acts_left; ?> left) <br/> <strong><?php _e('Expires on', WPRSS_TEXT_DOMAIN); ?> :</strong> <code><?php echo $expires; ?> </code> <br/> <strong><?php _e('Registered to', WPRSS_TEXT_DOMAIN); ?> :</strong> <?php echo $data->customer_name; ?> (<code><?php echo $data->customer_email; ?> </code>) </small> <?php } ?> <?php } else { ?> <small><?php _e('Failed to get license information. This is a temporary problem. Check your internet connection and try again later.', WPRSS_TEXT_DOMAIN); ?> </small> <?php } ?> <?php } ?> </p> <style type="text/css"> .wprss-<?php echo $addon_id; ?> -license-valid { color: green; } .wprss-<?php echo $addon_id; ?> -license-invalid, .wprss-<?php echo $addon_id; ?> -license-expired { color: #b71919; } .wprss-<?php echo $addon_id; ?> -license-inactive { color: #d19e5b; } #wprss-<?php echo $addon_id; ?> -license-status-text { margin-left: 8px; line-height: 27px; vertical-align: middle; } </style> <?php }
/** * Renders the activate/deactivate license button for a particular add-on. * * @since 4.4.5 */ function wprss_activate_license_button($args) { $addon_id = $args[0]; $data = wprss_edd_check_license($addon_id, NULL, 'ALL'); $status = $data->license; if ($status === 'site_inactive') { $status = 'inactive'; } if ($status === 'item_name_mismatch') { $status = 'invalid'; } $valid = $status == 'valid'; $btn_text = $valid ? 'Deactivate License' : 'Activate License'; $btn_name = "wprss_{$addon_id}_license_" . ($valid ? 'deactivate' : 'activate'); wp_nonce_field("wprss_{$addon_id}_license_nonce", "wprss_{$addon_id}_license_nonce"); ?> <input type="submit" class="button-secondary" name="<?php echo $btn_name; ?> " value="<?php _e($btn_text, WPRSS_TEXT_DOMAIN); ?> " /> <span id="wprss-<?php echo $addon_id; ?> -license-status-text"> <strong>Status: <span class="wprss-<?php echo $addon_id; ?> -license-<?php echo $status; ?> "> <?php _e(ucfirst($status), WPRSS_TEXT_DOMAIN); ?> <?php if ($status === 'valid') { ?> <i class="fa fa-check"></i> <?php } elseif ($status === 'invalid') { ?> <i class="fa fa-times"></i> <?php } elseif ($status === 'inactive') { ?> <i class="fa fa-warning"></i> <?php } ?> </strong> </span> </span> <p> <?php $license_key = wprss_get_license_key($addon_id); $acts_current = $data->site_count; $acts_left = $data->activations_left; $acts_limit = $data->license_limit; $expires = $data->expires; $expires = substr($expires, 0, strpos($expires, " ")); if (!empty($license_key)) { ?> <small> <strong>Activations:</strong> <?php echo $acts_current . '/' . $acts_limit; ?> (<?php echo $acts_left; ?> left) <br/> <strong>Expires on:</strong> <code><?php echo $expires; ?> </code> <br/> <strong>Registered to:</strong> <?php echo $data->customer_name; ?> (<code><?php echo $data->customer_email; ?> </code>) </small> <?php } ?> </p> <style type="text/css"> .wprss-<?php echo $addon_id; ?> -license-valid { color: green; } .wprss-<?php echo $addon_id; ?> -license-invalid { color: #b71919; } .wprss-<?php echo $addon_id; ?> -license-inactive { color: #d19e5b; } #wprss-<?php echo $addon_id; ?> -license-status-text { margin-left: 8px; line-height: 27px; vertical-align: middle; } </style> <?php }