public function get_form($form = '')
{
//todo: nonce required
if (empty($form)) {
$form = filter_input(INPUT_POST, 'form' . FILTER_SANITIZE_STRING);
$form = isset($form) ? $form : 'premium_support';
}
$meta_title = '';
switch ($form) {
case 'bug_report':
$meta_title = esc_html__('Submit a Bug Report', 'buddypress-media');
break;
case 'new_feature':
$meta_title = esc_html__('Submit a New Feature Request', 'buddypress-media');
break;
case 'premium_support':
$meta_title = esc_html__('Submit Support Request', 'buddypress-media');
break;
}
if ('premium_support' === $form) {
if (!has_filter('rtmedia_license_tabs') && !has_action('rtmedia_addon_license_details')) {
$content = '<h3 class="rtm-option-title">' . esc_html($meta_title) . '</h3>';
$content .= '<p>' . sprintf(esc_html__('If your site has some issues due to rtMedia and you want support, feel free to create a support topic on %s', 'buddypress-media'), '<a target="_blank" href="http://community.rtcamp.com/c/rtmedia/?utm_source=dashboard&utm_medium=plugin&utm_campaign=buddypress-media">' . esc_html__('Community Forum', 'buddypress-media') . '</a>.') . '</p>';
$content .= '<p>' . sprintf(esc_html__('If you have any suggestions, enhancements or bug reports, then you can open a new issue on %s', 'buddypress-media'), '<a target="_blank" href="https://github.com/rtCamp/rtmedia/issues/new">' . esc_html__('GitHub', 'buddypress-media') . '</a>.') . '</p>';
echo $content;
// @codingStandardsIgnoreLine
} else {
$website = filter_input(INPUT_POST, 'website', FILTER_SANITIZE_URL);
$subject = filter_input(INPUT_POST, 'subject', FILTER_SANITIZE_STRING);
$details = filter_input(INPUT_POST, 'details', FILTER_SANITIZE_STRING);
$server_addr = rtm_get_server_var('SERVER_ADDR', 'FILTER_VALIDATE_IP');
$remote_addr = rtm_get_server_var('REMOTE_ADDR', 'FILTER_VALIDATE_IP');
$server_software = rtm_get_server_var('SERVER_SOFTWARE', 'FILTER_SANITIZE_STRING');
$http_user_agent = rtm_get_server_var('HTTP_USER_AGENT', 'FILTER_SANITIZE_STRING');
?>
<h3 class="rtm-option-title"><?php
echo esc_html($meta_title);
?>
</h3>
<div id="support-form" class="bp-media-form rtm-support-form rtm-option-wrapper">
<div class="rtm-form-filed clearfix">
<label class="bp-media-label"
for="name"><?php
esc_html_e('Name', 'buddypress-media');
?>
</label>
<input class="bp-media-input" id="name" type="text" name="name" value="" required/>
<span class="rtm-tooltip">
<i class="dashicons dashicons-info rtmicon"></i>
<span class="rtm-tip">
<?php
esc_html_e('Use actual user name which used during purchased.', 'buddypress-media');
?>
</span>
</span>
</div>
<div class="rtm-form-filed clearfix">
<label class="bp-media-label"
for="email"><?php
esc_html_e('Email', 'buddypress-media');
?>
</label>
<input id="email" class="bp-media-input" type="text" name="email" value="" required/>
<span class="rtm-tooltip">
<i class="dashicons dashicons-info rtmicon"></i>
<span class="rtm-tip">
<?php
esc_html_e('Use email id which used during purchased', 'buddypress-media');
?>
</span>
</span>
</div>
<div class="rtm-form-filed clearfix">
<label class="bp-media-label"
for="website"><?php
esc_html_e('Website', 'buddypress-media');
?>
</label>
<input id="website" class="bp-media-input" type="text" name="website"
value="<?php
echo esc_url(isset($website) ? $website : get_bloginfo('url'));
?>
"
required/>
</div>
<div class="rtm-form-filed clearfix">
<label class="bp-media-label"
for="subject"><?php
esc_html_e('Subject', 'buddypress-media');
?>
</label>
<input id="subject" class="bp-media-input" type="text" name="subject"
value="<?php
echo esc_attr(isset($subject) ? esc_attr($subject) : '');
?>
"
required/>
</div>
<div class="rtm-form-filed clearfix">
<label class="bp-media-label"
for="details"><?php
esc_html_e('Details', 'buddypress-media');
?>
</label>
<textarea id="details" class="bp-media-textarea" name="details"
required><?php
echo esc_html(isset($details) ? esc_textarea($details) : '');
?>
</textarea>
<input type="hidden" name="request_type" value="<?php
echo esc_attr($form);
?>
"/>
<input type="hidden" name="request_id"
value="<?php
echo esc_attr(wp_create_nonce(date('YmdHis')));
?>
"/>
<input type="hidden" name="server_address" value="<?php
echo esc_attr($server_addr);
?>
"/>
<input type="hidden" name="ip_address" value="<?php
echo esc_attr($remote_addr);
?>
"/>
<input type="hidden" name="server_type" value="<?php
echo esc_attr($server_software);
?>
"/>
<input type="hidden" name="user_agent" value="<?php
echo esc_attr($http_user_agent);
?>
"/>
<input type="hidden" name="debuglog_temp_path" id="debuglog_temp_path" />
</div>
<div class="rtm-form-filed clearfix">
<label class="bp-media-label"
for="subject"><?php
esc_html_e('Attachement', 'buddypress-media');
?>
</label>
<input id="debuglog" class="bp-media-input" type="file" name="debuglog" />
<span class="rtm-tooltip">
<i class="dashicons dashicons-info rtmicon"></i>
<span class="rtm-tip">
<?php
esc_html_e('Allowed file types are : images, documents and texts.', 'buddypress-media');
?>
</span>
</span>
</div>
</div><!-- .submit-bug-box -->
<div class="rtm-form-filed rtm-button-wrapper clearfix">
<?php
wp_nonce_field('rtmedia-support-request', 'support_wpnonce');
?>
<?php
submit_button('Submit', 'primary', 'rtmedia-submit-request', false);
?>
<?php
submit_button('Cancel', 'secondary', 'cancel-request', false);
?>
</div>
<?php
}
}
}