?> ; -webkit-border-radius:<?php echo esc_html($border_radius . $important); ?> ; border-radius:<?php echo esc_html($border_radius . $important); ?> ; font-size:<?php echo esc_html($submit_font_size . $important); ?> ; font-family:<?php echo FrmAppHelper::kses(stripslashes($font) . $important); ?> ; font-weight:<?php echo esc_html($submit_weight . $important); ?> ; color:#<?php echo esc_html($submit_text_color . $important); ?> ; background:#<?php echo esc_html($submit_bg_color . $important); ?> ; border-width:<?php
public static function send_email($atts) { $admin_email = get_option('admin_email'); $defaults = array('to_email' => $admin_email, 'subject' => '', 'message' => '', 'from' => $admin_email, 'from_name' => '', 'cc' => '', 'bcc' => '', 'plain_text' => true, 'reply_to' => $admin_email, 'attachments' => array()); $atts = wp_parse_args($atts, $defaults); // Put To, BCC, CC, Reply To, and From fields in the correct format self::format_email_fields($atts, $admin_email); $recipient = $atts['to_email']; //recipient $header = array(); $header[] = 'From: ' . $atts['from']; //Allow for cc and bcc arrays $array_fields = array('CC' => $atts['cc'], 'BCC' => $atts['bcc']); $cc = array('CC' => array(), 'BCC' => array()); foreach ($array_fields as $key => $a_field) { if (empty($a_field)) { continue; } foreach ((array) $a_field as $email) { $cc[$key][] = $email; } unset($key, $a_field); } $cc = array_filter($cc); // remove cc and bcc if they are empty foreach ($cc as $k => $v) { $header[] = $k . ': ' . implode(',', $v); } $content_type = $atts['plain_text'] ? 'text/plain' : 'text/html'; $charset = get_option('blog_charset'); $header[] = 'Reply-To: ' . $atts['reply_to']; $header[] = 'Content-Type: ' . $content_type . '; charset="' . esc_attr($charset) . '"'; $atts['subject'] = wp_specialchars_decode(strip_tags(stripslashes($atts['subject'])), ENT_QUOTES); $message = do_shortcode($atts['message']); if ($atts['plain_text']) { //$message = wordwrap($message, 70, "\r\n"); //in case any lines are longer than 70 chars $message = wp_specialchars_decode(strip_tags($message), ENT_QUOTES); } else { // remove line breaks in HTML emails to prevent conflicts with Mandrill add_filter('mandrill_nl2br', 'FrmNotification::remove_mandrill_br'); } $header = apply_filters('frm_email_header', $header, array('to_email' => $atts['to_email'], 'subject' => $atts['subject'])); if (apply_filters('frm_encode_subject', 1, $atts['subject'])) { $atts['subject'] = '=?' . $charset . '?B?' . base64_encode($atts['subject']) . '?='; } remove_filter('wp_mail_from', 'bp_core_email_from_address_filter'); remove_filter('wp_mail_from_name', 'bp_core_email_from_name_filter'); $sent = wp_mail($recipient, $atts['subject'], $message, $header, $atts['attachments']); if (!$sent) { $header = 'From: ' . $atts['from'] . "\r\n"; $recipient = implode(',', (array) $recipient); $sent = mail($recipient, $atts['subject'], $message, $header); } // remove the filter now so other emails can still use it remove_filter('mandrill_nl2br', 'FrmNotification::remove_mandrill_br'); do_action('frm_notification', $recipient, $atts['subject'], $message); if ($sent) { $sent_to = array_merge((array) $atts['to_email'], (array) $atts['cc'], (array) $atts['bcc']); $sent_to = array_filter($sent_to); if (apply_filters('frm_echo_emails', false)) { $temp = str_replace('<', '<', $sent_to); echo ' ' . FrmAppHelper::kses(implode(', ', (array) $temp)); } return $sent_to; } }
public static function activate() { FrmAppHelper::permission_check('frm_change_settings'); check_ajax_referer('frm_ajax', 'nonce'); if (!isset($_POST['license']) || empty($_POST['license'])) { wp_die(__('Oops! You forgot to enter your license number.', 'formidable')); } $license = stripslashes(sanitize_text_field($_POST['license'])); $plugin_slug = sanitize_text_field($_POST['plugin']); $this_plugin = self::get_addon($plugin_slug); $this_plugin->set_license($license); $response = array('success' => false, 'message' => ''); try { $license_data = $this_plugin->send_mothership_request('activate_license', $license); // $license_data->license will be either "valid" or "invalid" $is_valid = 'invalid'; if (is_array($license_data)) { if ($license_data['license'] == 'valid') { $is_valid = $license_data['license']; $response['message'] = __('Your license has been activated. Enjoy!', 'formidable'); $response['success'] = true; } else { if ($license_data['license'] == 'invalid') { $response['message'] = __('That license key is invalid', 'formidable'); } } } else { if ($license_data == 'expired') { $response['message'] = __('That license is expired', 'formidable'); } else { if ($license_data == 'no_activations_left') { $response['message'] = __('That license has been used on too many sites', 'formidable'); } else { if ($license_data == 'invalid_item_id') { $response['message'] = __('Oops! That is the wrong license key for this plugin.', 'formidable'); } else { if ($license_data == 'missing') { $response['message'] = __('That license key is invalid', 'formidable'); } else { $response['message'] = FrmAppHelper::kses($license_data, array('a')); } } } } } $this_plugin->set_active($is_valid); } catch (Exception $e) { $response['message'] = $e->getMessage(); } echo json_encode($response); wp_die(); }
public static function process_bulk_form_actions($errors) { if (!$_REQUEST) { return $errors; } $bulkaction = FrmAppHelper::get_param('action', '', 'get', 'sanitize_text_field'); if ($bulkaction == -1) { $bulkaction = FrmAppHelper::get_param('action2', '', 'get', 'sanitize_title'); } if (!empty($bulkaction) && strpos($bulkaction, 'bulk_') === 0) { FrmAppHelper::remove_get_action(); $bulkaction = str_replace('bulk_', '', $bulkaction); } $ids = FrmAppHelper::get_param('item-action', ''); if (empty($ids)) { $errors[] = __('No forms were specified', 'formidable'); return $errors; } $permission_error = FrmAppHelper::permission_nonce_error('', '_wpnonce', 'bulk-toplevel_page_formidable'); if ($permission_error !== false) { $errors[] = $permission_error; return $errors; } if (!is_array($ids)) { $ids = explode(',', $ids); } switch ($bulkaction) { case 'delete': $message = self::bulk_destroy($ids); break; case 'trash': $message = self::bulk_trash($ids); break; case 'untrash': $message = self::bulk_untrash($ids); break; case 'create_template': $message = self::bulk_create_template($ids); break; } if (isset($message) && !empty($message)) { echo '<div id="message" class="updated frm_msg_padding">' . FrmAppHelper::kses($message) . '</div>'; } return $errors; }
/** * @param string $edit_link */ private function get_form_name($item, $actions, $edit_link, $mode = 'list') { $form_name = $item->name; if (trim($form_name) == '') { $form_name = __('(no title)'); } $form_name = FrmAppHelper::kses($form_name); if ('excerpt' != $mode) { $form_name = FrmAppHelper::truncate($form_name, 50); } $val = '<strong>'; if ('trash' == $this->status) { $val .= $form_name; } else { $val .= '<a href="' . esc_url(isset($actions['frm_edit']) ? $edit_link : FrmFormsHelper::get_direct_link($item->form_key, $item)) . '" class="row-title">' . FrmAppHelper::kses($form_name) . '</a> '; } $this->add_draft_label($item, $val); $val .= '</strong>'; $this->add_form_description($item, $val); return $val; }
/** * @covers FrmAppHelper::kses */ function test_kses() { $start_value = '<script><script>Hello, <a href="/test">click here</a>'; $stripped_value = FrmAppHelper::kses($start_value); $this->assertEquals($stripped_value, 'Hello, click here'); $stripped_value = FrmAppHelper::kses($start_value, array('a')); $this->assertEquals($stripped_value, 'Hello, <a href="/test">click here</a>'); }
?> ; -webkit-border-radius:<?php echo esc_html($border_radius . $important); ?> ; border-radius:<?php echo esc_html($border_radius . $important); ?> ; font-size:<?php echo esc_html($submit_font_size . $important); ?> ; font-family:<?php echo FrmAppHelper::kses($font . $important); ?> ; font-weight:<?php echo esc_html($submit_weight . $important); ?> ; color:#<?php echo esc_html($submit_text_color . $important); ?> ; background:#<?php echo esc_html($submit_bg_color . $important); ?> ; border-width:<?php
private function activate() { $creds = $this->get_pro_cred_form_vals(); $license = $creds['license']; $response = array('auth' => false, 'response' => ''); if (empty($license)) { $response['response'] = __('Oops! You forgot to enter your license number.', 'formidable'); return $response; } try { $license_data = $this->send_mothership_request('activate_license', $license); // $license_data->license will be either "valid" or "invalid" $is_valid = false; $response['response'] = __('That license is invalid', 'formidable'); if (is_array($license_data)) { if ($license_data['license'] == 'valid') { $this->manually_queue_update(); $is_valid = $license_data['license']; $response['response'] = __('Enjoy!', 'formidable'); $is_valid = true; $response['auth'] = true; } } else { if ($license_data == 'expired') { $response['response'] = __('That license is expired', 'formidable'); } else { if ($license_data == 'no_activations_left') { $response['response'] = __('That license has been used too many times', 'formidable'); } else { $response['response'] = FrmAppHelper::kses($license_data, array('a')); } } } $this->_update_auth($creds, $is_valid); } catch (Exception $e) { $response['response'] = $e->getMessage(); } return $response; }
<tr class="frm_comment_block" id="frmcomment<?php echo esc_attr($comment->id); ?> "> <th scope="row"> <p><strong><?php echo FrmAppHelper::kses(FrmProFieldsHelper::get_display_name($meta['user_id'], 'display_name', array('link' => true))); ?> </strong><br/> <?php echo FrmAppHelper::kses(FrmAppHelper::get_formatted_time($comment->created_at, $date_format, $time_format)); ?> </p> </th> <td><div class="frm_comment"><?php echo wpautop(FrmAppHelper::kses($meta['comment'])); ?> </div></td> </tr> <?php } ?> </table> <a href="#" class="button-secondary alignright frm_show_comment" data-frmtoggle="#frm_comment_form">+ <?php esc_html_e('Add Note/Comment', 'formidable'); ?> </a> <div class="clear"></div> <form action="<?php echo esc_url('?page=formidable-entries&frm_action=show&id=' . absint($entry->form_id) . '#frm_comment_form');
private static function maybe_show_upgrade_bar() { $page = FrmAppHelper::simple_get('page', 'sanitize_title'); if (strpos($page, 'formidable') !== 0) { return; } if (FrmAppHelper::pro_is_installed()) { return; } $affiliate = FrmAppHelper::get_affiliate(); if (!empty($affiliate)) { $tip = FrmTipsHelper::get_banner_tip(); ?> <div class="update-nag frm-update-to-pro"> <?php echo FrmAppHelper::kses($tip['tip']); ?> <span><?php echo FrmAppHelper::kses($tip['call']); ?> </span> <a href="<?php echo esc_url(FrmAppHelper::make_affiliate_url('https://formidablepro.com?banner=1&tip=' . absint($tip['num']))); ?> " class="button">Upgrade to Pro</a> </div> <?php } }
public static function activate() { FrmAppHelper::permission_check('frm_change_settings'); check_ajax_referer('frm_ajax', 'nonce'); if (!isset($_POST['license']) || empty($_POST['license'])) { wp_die(__('Oops! You forgot to enter your license number.', 'formidable')); } $license = stripslashes(sanitize_text_field($_POST['license'])); $plugin_slug = sanitize_text_field($_POST['plugin']); $this_plugin = self::get_addon($plugin_slug); $this_plugin->set_license($license); $this_plugin->license = $license; $response = $this_plugin->get_license_status(); $response['message'] = ''; $response['success'] = false; if ($response['error']) { $response['message'] = $response['status']; } else { $messages = $this_plugin->get_messages(); if (is_string($response['status']) && isset($messages[$response['status']])) { $response['message'] = $messages[$response['status']]; } else { $response['message'] = FrmAppHelper::kses($response['status'], array('a')); } $is_valid = false; if ($response['status'] == 'valid') { $is_valid = 'valid'; $response['success'] = true; } $this_plugin->set_active($is_valid); } echo json_encode($response); wp_die(); }
function form($instance) { $pages = get_posts(array('post_type' => 'page', 'post_status' => 'publish', 'numberposts' => 999, 'order_by' => 'post_title', 'order' => 'ASC')); $displays = FrmProDisplay::getAll(array('meta_key' => 'frm_show_count', 'meta_value' => 'dynamic')); //Defaults $instance = wp_parse_args((array) $instance, array('title' => false, 'display_id' => false, 'post_id' => false, 'title_id' => false, 'cat_list' => false, 'cat_name' => false, 'cat_count' => false, 'cat_id' => false, 'limit' => false)); if ($instance['display_id']) { $selected_display = FrmProDisplay::getOne($instance['display_id']); if ($selected_display) { $selected_form_id = get_post_meta($selected_display->ID, 'frm_form_id', true); $title_opts = FrmField::getAll(array('fi.form_id' => (int) $selected_form_id, 'type not' => FrmField::no_save_fields()), 'field_order'); $instance['display_id'] = $selected_display->ID; } } ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title', 'formidable'); ?> :</label> <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " value="<?php echo esc_attr(stripslashes($instance['title'])); ?> " /></p> <p><label for="<?php echo $this->get_field_id('display_id'); ?> "><?php _e('Use Settings from View', 'formidable'); ?> :</label> <select name="<?php echo $this->get_field_name('display_id'); ?> " id="<?php echo $this->get_field_id('display_id'); ?> " class="widefat frm_list_items_display_id"> <option value=""> </option> <?php foreach ($displays as $display) { echo '<option value="' . esc_attr($display->ID) . '" ' . selected($instance['display_id'], $display->ID, false) . '>' . FrmAppHelper::kses($display->post_title) . '</option>'; } ?> </select> </p> <p class="description"><?php _e('Views with a "Both (Dynamic)" format will show here.', 'formidable'); ?> </p> <p><label for="<?php echo $this->get_field_id('post_id'); ?> "><?php _e('Page if not specified in View settings', 'formidable'); ?> :</label> <select name="<?php echo $this->get_field_name('post_id'); ?> " id="<?php echo $this->get_field_id('post_id'); ?> " class="widefat"> <option value=""> </option> <?php foreach ($pages as $page) { echo '<option value="' . esc_attr($page->ID) . '" ' . selected($instance['post_id'], $page->ID, false) . '>' . $page->post_title . '</option>'; } ?> </select> </p> <p><label for="<?php echo $this->get_field_id('title_id'); ?> "><?php _e('Title Field', 'formidable'); ?> :</label> <select name="<?php echo $this->get_field_name('title_id'); ?> " id="<?php echo $this->get_field_id('title_id'); ?> " class="widefat frm_list_items_title_id"> <option value=""> </option> <?php if (isset($title_opts) && $title_opts) { foreach ($title_opts as $title_opt) { if ($title_opt->type != 'checkbox') { ?> <option value="<?php echo $title_opt->id; ?> " <?php selected($instance['title_id'], $title_opt->id); ?> ><?php echo $title_opt->name; ?> </option> <?php } } } ?> </select> </p> <p><label for="<?php echo $this->get_field_id('cat_list'); ?> "><input class="checkbox frm_list_items_cat_list" type="checkbox" <?php checked($instance['cat_list'], true); ?> id="<?php echo $this->get_field_id('cat_list'); ?> " name="<?php echo $this->get_field_name('cat_list'); ?> " value="1" /> <?php _e('List Entries by Category', 'formidable'); ?> </label></p> <div id="<?php echo $this->get_field_id('hide_cat_opts'); ?> " class="frm_list_items_hide_cat_opts <?php echo $instance['cat_list'] ? '' : 'frm_hidden'; ?> "> <p><label for="<?php echo $this->get_field_id('cat_id'); ?> "><?php _e('Category Field', 'formidable'); ?> :</label> <select name="<?php echo $this->get_field_name('cat_id'); ?> " id="<?php echo $this->get_field_id('cat_id'); ?> " class="widefat frm_list_items_cat_id"> <option value=""> </option> <?php if (isset($title_opts) && $title_opts) { foreach ($title_opts as $title_opt) { if (in_array($title_opt->type, array('select', 'radio', 'checkbox'))) { echo '<option value="' . esc_attr($title_opt->id) . '"' . selected($instance['cat_id'], $title_opt->id, false) . '>' . FrmAppHelper::kses($title_opt->name) . '</option>'; } } } ?> </select> </p> <p><label for="<?php echo $this->get_field_id('cat_count'); ?> "><input class="checkbox" type="checkbox" <?php checked($instance['cat_count'], true); ?> id="<?php echo $this->get_field_id('cat_count'); ?> " name="<?php echo $this->get_field_name('cat_count'); ?> " value="1" /> <?php _e('Show Entry Counts', 'formidable'); ?> </label></p> <p><input class="checkbox" type="radio" <?php checked($instance['cat_name'], 1); ?> id="<?php echo $this->get_field_id('cat_name'); ?> " name="<?php echo $this->get_field_name('cat_name'); ?> " value="1" /> <label for="<?php echo $this->get_field_id('cat_name'); ?> "><?php _e('Show Only Category Name', 'formidable'); ?> </label><br/> <input class="checkbox" type="radio" <?php checked($instance['cat_name'], 0); ?> id="<?php echo $this->get_field_id('cat_name'); ?> " name="<?php echo $this->get_field_name('cat_name'); ?> " value="0" /> <label for="<?php echo $this->get_field_id('cat_name'); ?> "><?php _e('Show Entries Beneath Categories', 'formidable'); ?> </label></p> </div> <p><label for="<?php echo $this->get_field_id('limit'); ?> "><?php _e('Entry Limit (leave blank to list all)', 'formidable'); ?> :</label> <input type="text" class="widefat" id="<?php echo $this->get_field_id('limit'); ?> " name="<?php echo $this->get_field_name('limit'); ?> " value="<?php echo esc_attr($instance['limit']); ?> " /></p> <?php }
</h2> <?php foreach ($plugins as $slug => $plugin) { $license = get_option('edd_' . $slug . '_license_key'); $status = get_option('edd_' . $slug . '_license_active'); $activate = false !== $license && $status == 'valid' ? 'deactivate' : 'activate'; $icon_class = empty($license) ? 'frm_hidden' : ''; ?> <div class="edd_frm_license_row"> <label class="frm_left_label" for="edd_<?php echo esc_attr($slug); ?> _license_key"><?php echo FrmAppHelper::kses($plugin->plugin_name); ?> </label> <div class="edd_frm_authorized alignleft <?php echo esc_attr($activate == 'activate') ? 'frm_hidden' : ''; ?> "> <span class="edd_frm_license"><?php echo esc_html($license); ?> </span> <span class="frm_icon_font frm_action_icon frm_error_icon edd_frm_status_icon frm_inactive_icon"></span> <input type="button" class="button-secondary edd_frm_save_license" data-plugin="<?php echo esc_attr($slug); ?> " name="edd_<?php