예제 #1
0
 public function widget($args, $instance)
 {
     if (empty($instance['title'])) {
         $title = FrmForm::getName($instance['form']);
     } else {
         $title = $instance['title'];
     }
     $title = apply_filters('widget_title', $title);
     $instance['description'] = isset($instance['description']) ? $instance['description'] : false;
     echo $args['before_widget'];
     echo '<div class="frm_form_widget">';
     if ($title) {
         echo $args['before_title'] . stripslashes($title) . $args['after_title'];
     }
     echo FrmFormsController::show_form($instance['form'], '', false, $instance['description']);
     echo '</div>';
     echo $args['after_widget'];
 }
예제 #2
0
 function widget($args, $instance)
 {
     extract($args);
     $frm_form = new FrmForm();
     $form_name = $frm_form->getName($instance['form']);
     $title = apply_filters('widget_title', empty($instance['title']) ? $form_name : $instance['title']);
     $instance['description'] = isset($instance['description']) ? $instance['description'] : false;
     echo $before_widget;
     $select_class = (isset($instance['select_width']) and $instance['select_width']) ? ' frm_set_select' : '';
     echo '<div class="frm_form_widget' . $select_class . '">';
     if ($title) {
         echo $before_title . stripslashes($title) . $after_title;
     }
     if (isset($instance['size']) and is_numeric($instance['size'])) {
         global $frm_vars;
         $frm_vars['sidebar_width'] = $instance['size'];
     }
     echo FrmFormsController::show_form($instance['form'], '', false, $instance['description']);
     $frm_vars['sidebar_width'] = '';
     echo '</div>';
     echo $after_widget;
 }
예제 #3
0
 public static function show_form($id = '', $key = '', $title = false, $description = false)
 {
     _deprecated_function(__FUNCTION__, '1.07.05', 'FrmFormsController::show_form()');
     return FrmFormsController::show_form($id, $key, $title, $description);
 }
예제 #4
0
<html <?php 
language_attributes();
?>
>
<head>
	<title><?php 
bloginfo('name');
?>
 | <?php 
echo esc_html($form->name);
?>
</title>
	<meta charset="<?php 
bloginfo('charset');
?>
" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
	<?php 
wp_head();
?>
</head>
<body class="frm_preview_page">
	<?php 
echo FrmFormsController::show_form($form->id, '', true, true);
?>
	<?php 
wp_footer();
?>
</body>
</html>
 public static function ajax_create()
 {
     if (!FrmAppHelper::doing_ajax() || !isset($_POST['form_id'])) {
         // normally, this function would be triggered with the wp_ajax hook, but we need it fired sooner
         return;
     }
     $allowed_actions = array('frm_entries_create', 'frm_entries_update');
     if (!in_array(FrmAppHelper::get_post_param('action', '', 'sanitize_title'), $allowed_actions)) {
         // allow ajax creating and updating
         return;
     }
     $form = FrmForm::getOne((int) $_POST['form_id']);
     if (!$form) {
         echo false;
         wp_die();
     }
     $no_ajax_fields = array('file');
     $errors = FrmEntryValidate::validate($_POST, $no_ajax_fields);
     if (empty($errors)) {
         if (FrmProForm::is_ajax_on($form)) {
             global $frm_vars;
             $frm_vars['ajax'] = true;
             $frm_vars['css_loaded'] = true;
             // don't load scripts if we are going backwards in the form
             $going_backwards = FrmProFormsHelper::going_to_prev($form->id);
             // save the entry if there is not another page or when saving a draft
             if (!isset($_POST['frm_page_order_' . $form->id]) && !$going_backwards || FrmProFormsHelper::saving_draft()) {
                 $processed = true;
                 FrmEntriesController::process_entry($errors, true);
             }
             echo FrmFormsController::show_form($form->id);
             // trigger the footer scripts if there is a form to show
             if ($errors || !isset($processed) || !empty($frm_vars['forms_loaded'])) {
                 self::print_ajax_scripts($going_backwards ? 'none' : '');
             }
         } else {
             echo false;
         }
     } else {
         $obj = array();
         foreach ($errors as $field => $error) {
             $field_id = str_replace('field', '', $field);
             $obj[$field_id] = $error;
         }
         echo json_encode($obj);
     }
     wp_die();
 }
 public static function ajax_create()
 {
     global $frm_entry;
     $frm_form = new FrmForm();
     $form = $frm_form->getOne($_POST['form_id']);
     if (!$form) {
         echo false;
         die;
     }
     $no_ajax_fields = array('file');
     $errors = $frm_entry->validate($_POST, $no_ajax_fields);
     if (empty($errors)) {
         global $wpdb;
         $where = $wpdb->prepare("form_id=%d", $form->id);
         if (isset($_POST['frm_page_order_' . $form->id])) {
             $where .= $wpdb->prepare(" AND field_order < %d", $_POST['frm_page_order_' . $form->id]);
         }
         $ajax = isset($form->options['ajax_submit']) ? $form->options['ajax_submit'] : 0;
         //ajax submit if no file, rte, captcha
         if ($ajax) {
             $no_ajax = $wpdb->get_var("SELECT id FROM {$wpdb->prefix}frm_fields WHERE type in ('" . implode("','", $no_ajax_fields) . "') AND {$where} LIMIT 1");
             if ($no_ajax) {
                 $ajax = false;
             }
         }
         if ($ajax) {
             global $frm_vars;
             $frm_vars['ajax'] = true;
             $frm_vars['css_loaded'] = true;
             if (!isset($_POST['frm_page_order_' . $form->id]) && !FrmProFormsHelper::going_to_prev($form->id) || FrmProFormsHelper::saving_draft($form->id)) {
                 $processed = true;
                 FrmEntriesController::process_entry($errors, true);
             }
             echo FrmFormsController::show_form($form->id);
             // trigger the footer scripts if there is a form to show
             if ($errors || !isset($form->options['show_form']) || $form->options['show_form'] || !isset($processed)) {
                 self::register_scripts();
                 FrmProEntriesController::enqueue_footer_js();
                 wp_deregister_script('formidable');
                 global $wp_scripts, $wp_styles;
                 foreach (array('jquery', 'jquery-ui-core', 'jquery-migrate', 'thickbox') as $s) {
                     if (isset($wp_scripts->registered[$s])) {
                         $wp_scripts->done[] = $s;
                     }
                     unset($s);
                 }
                 $keep_styles = apply_filters('frm_ajax_load_styles', array('dashicons', 'jquery-theme'));
                 foreach ($wp_styles->registered as $s => $info) {
                     if (!is_array($keep_styles) || !in_array($s, $keep_styles)) {
                         $wp_styles->done[] = $s;
                     }
                     unset($s);
                 }
                 wp_print_footer_scripts();
                 FrmProEntriesController::footer_js();
             }
         } else {
             echo false;
         }
     } else {
         $errors = str_replace('"', '&quot;', $errors);
         $obj = array();
         foreach ($errors as $field => $error) {
             $field_id = str_replace('field', '', $field);
             $obj[$field_id] = $error;
         }
         echo json_encode($obj);
     }
     die;
 }
예제 #7
0
                   
					<div class="agents-pagination-container"></div>
					
					
                </div>
                <!-- modal sample -->
                <div class="modal fade" id="agentModal" tabindex="-1" role="dialog" aria-labelledby="agentModal" aria-hidden="true" data-agent="">
                    <div class="modal-dialog modal-lg">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title">Send Message</h4>
                            </div>
                            <div class="modal-body">
							<?php 
echo FrmFormsController::show_form(6, $key = '', $title = true, $description = true);
?>
                                <!-- <p>Fill-up the form below to send your question or inquires to <span class="contact-agent-name"></span>.</p>
                                <div class="well">
                                    <form>
                                        <div class="form-group">
                                            <label for="agentContactFullName">Full Name</label>
                                            <input type="text" class="form-control" id="agentContactFullName" placeholder="full name">
                                        </div>
                                        <div class="form-group">
                                            <label for="agentContactEmailAddress">Email Address</label>
                                            <input type="email" class="form-control" id="agentContactEmailAddress" placeholder="email address">
                                        </div>
                                        <div class="form-group">
                                            <label for="agentContactNumber">Contact Number</label>
                                            <input type="email" class="form-control" id="agentContactNumber" placeholder="contact number">