public function build_shortcode($atts, $content = null) { extract(shortcode_atts(array('id' => '', 'title' => false, 'description' => false, 'minimize' => false, 'custom_css_class' => ''), $atts)); $output = '<div class="avca-formidable ' . $custom_css_class . '">'; $output .= FrmFormsController::get_form_shortcode(array('id' => $id, 'title' => $title, 'description' => $description, 'minimize' => $minimize)); $output .= '</div>'; return $output; }
/** * @covers FrmFormsController::update * without ajax */ function test_form_update_no_ajax() { $form_id = $this->factory->form->get_id_by_key($this->contact_form_key); $this->set_current_user_to_1(); self::_setup_post_values($form_id); self::_check_doing_ajax(); ob_start(); FrmFormsController::update(); $html = ob_get_contents(); ob_end_clean(); self::_check_updated_values($form_id); }
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']; }
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; }
function upgrade() { global $wpdb; $db_version = 14; // this is the version of the database we're moving to $old_db_version = get_option('frmpro_db_version'); if ($db_version != $old_db_version) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $charset_collate = ''; if ($wpdb->has_cap('collation')) { if (!empty($wpdb->charset)) { $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}"; } if (!empty($wpdb->collate)) { $charset_collate .= " COLLATE {$wpdb->collate}"; } } /* Create/Upgrade Display Table */ $sql = "CREATE TABLE {$this->displays} (\n id int(11) NOT NULL auto_increment,\n display_key varchar(255) default NULL,\n name varchar(255) default NULL,\n description text default NULL,\n content longtext default NULL,\n dyncontent longtext default NULL,\n insert_loc varchar(255) default NULL,\n param varchar(255) default NULL,\n type varchar(255) default NULL,\n show_count varchar(255) default NULL,\n options longtext default NULL,\n form_id int(11) default NULL,\n entry_id int(11) default NULL,\n post_id int(11) default NULL,\n created_at datetime NOT NULL,\n PRIMARY KEY id (id),\n KEY form_id (form_id),\n KEY entry_id (entry_id),\n KEY post_id (post_id),\n UNIQUE KEY display_key (display_key)\n ) {$charset_collate};"; dbDelta($sql); if ($db_version >= 3 and $old_db_version < 3) { //migrate hidden field data into the parent field $wpdb->update($frmdb->fields, array('type' => 'scale'), array('type' => '10radio')); $fields = FrmField::getAll(); foreach ($fields as $field) { $field->field_options = maybe_unserialize($field->field_options); if (isset($field->field_options['hide_field']) and is_numeric($field->field_options['hide_field']) and (isset($field->field_options['hide_opt']) and !empty($field->field_options['hide_opt']) or isset($field->field_options['form_select']) and !empty($field->field_options['form_select']))) { global $frm_field; //save hidden fields to parent field $parent_field = FrmField::getOne($field->field_options['hide_field']); if ($parent_field) { $parent_options = maybe_unserialize($parent_field->field_options); if (!isset($parent_options['dependent_fields'])) { $parent_options['dependent_fields'] = array(); } else { foreach ($parent_options['dependent_fields'] as $child_id => $child_opt) { if (empty($child_opt) or $child_opt == '') { unset($parent_options['dependent_fields'][$child_id]); } else { if ($child_id != $field->id) { //check to make sure this field is still dependent $check_field = FrmField::getOne($child_id); $check_options = maybe_unserialize($check_field->field_options); if (!is_numeric($check_options['hide_field']) or $check_options['hide_field'] != $parent_field->id or empty($check_options['hide_opt']) and empty($check_options['form_select'])) { unset($parent_options['dependent_fields'][$child_id]); } } } } } $dep_fields = array(); if ($field->type == 'data' and isset($field->field_options['form_select']) and is_numeric($field_options['form_select'])) { $dep_fields[] = $field->field_options['form_select']; $dep_fields[] = $field->field_options['data_type']; } else { if (isset($field->field_options['hide_opt']) and !empty($field->field_options['hide_opt'])) { $dep_fields[] = $field->field_options['hide_opt']; } } if (!empty($dep_fields)) { $parent_options['dependent_fields'][$field->id] = $dep_fields; } $frm_field->update($parent_field->id, array('field_options' => $parent_options)); } } } } /**** ADD DEFAULT TEMPLATES ****/ FrmFormsController::add_default_templates(FRMPRO_TEMPLATES_PATH); update_option('frmpro_db_version', $db_version); global $frmpro_settings; $frmpro_settings->store(); //update the styling settings } }
<div id="frm_adv_info" class="postbox"> <div class="handlediv" title="<?php esc_attr_e('Click to toggle', 'formidable'); ?> "><br/></div> <h3 class="hndle"><span><?php _e('Customization', 'formidable'); ?> </span></h3> <div class="inside"> <?php FrmFormsController::mb_tags_box($id); ?> </div> </div>
echo esc_attr($form->id); ?> _container"> <div class="frm_error_style"><strong><?php _e('Oops!', 'formidable'); ?> </strong> <?php printf(__('You did not add any fields to your form. %1$sGo back%2$s and add some.', 'formidable'), '<a href="' . esc_url(admin_url('?page=formidable&frm_action=edit&id=' . $form->id)) . '">', '</a>'); ?> </div> </div> <?php return; } global $frm_vars; FrmFormsController::maybe_load_css($form, $values['custom_style'], $frm_vars['load_css']); // Get conditionally hidden fields $frm_hide_fields = FrmAppHelper::get_post_param('frm_hide_fields_' . $form->id, '', 'sanitize_text_field'); // Get helpers $frm_helpers = apply_filters('frm_get_parent_child_field_helpers', '', $values['fields'], $form->id); ?> <div class="frm_form_fields <?php echo esc_attr(apply_filters('frm_form_fields_class', '', $values)); ?> "> <fieldset> <?php echo FrmFormsHelper::replace_shortcodes($values['before_html'], $form, $title, $description); ?> <input type="hidden" name="frm_action" value="<?php echo esc_attr($form_action);
public static function form_loaded($form, $this_load, $global_load) { _deprecated_function(__FUNCTION__, '2.0.9', 'FrmFormsController::maybe_load_css'); FrmFormsController::maybe_load_css($form, $this_load, $global_load); }
public static function get_tags_box() { check_ajax_referer('frm_ajax', 'nonce'); FrmFormsController::mb_tags_box((int) $_POST['form_id'], 'frm_doing_ajax'); wp_die(); }
<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>
global $frm_entry_meta; $frmdb = new FrmDb(); $frm_field = new FrmField(); $frm_form = new FrmForm(); $frm_entry = new FrmEntry(); $frm_entry_meta = new FrmEntryMeta(); $obj = new FrmNotification(); // Instansiate Controllers require_once $frm_path . '/classes/controllers/FrmAppController.php'; require_once $frm_path . '/classes/controllers/FrmFieldsController.php'; require_once $frm_path . '/classes/controllers/FrmFormsController.php'; require_once $frm_path . '/classes/controllers/FrmEntriesController.php'; FrmAppController::load_hooks(); FrmEntriesController::load_hooks(); FrmFieldsController::load_hooks(); FrmFormsController::load_hooks(); if (is_admin()) { require_once $frm_path . '/classes/controllers/FrmSettingsController.php'; FrmSettingsController::load_hooks(); require_once $frm_path . '/classes/controllers/FrmStatisticsController.php'; FrmStatisticsController::load_hooks(); require_once $frm_path . '/classes/controllers/FrmXMLController.php'; FrmXMLController::load_hooks(); } // Instansiate Helpers require_once $frm_path . '/classes/helpers/FrmEntriesHelper.php'; require_once $frm_path . '/classes/helpers/FrmFieldsHelper.php'; require_once $frm_path . '/classes/helpers/FrmFormsHelper.php'; if (file_exists($frm_path . '/pro/formidable-pro.php')) { require_once $frm_path . '/pro/formidable-pro.php'; }
public static function get_form_shortcode($atts) { _deprecated_function(__FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()'); return FrmFormsController::get_form_shortcode($atts); }
public static function get_form($filename, $form, $title, $description) { _deprecated_function(__FUNCTION__, '1.07.05', 'FrmFormsController::get_form()'); return FrmFormsController::get_form($form, $title, $description); }
?> </div><!-- .entry-content --> <?php edit_post_link(__('Edit', 'twentyfifteen'), '<footer class="entry-footer"><span class="edit-link">', '</span></footer><!-- .entry-footer -->'); ?> </article><!-- #post-## --> <div id="attendants" class="comments-area"> <h2 class="comments-title">참가신청</h2> <?php if (is_user_logged_in()) { ?> <?php echo FrmFormsController::get_form_shortcode(array('id' => 11)); ?> <?php } else { ?> <p class="info"> 참가신청를 하려면 <a href="<?php echo wp_login_url(get_permalink() . '#attendants'); ?> " title="Login">로그인</a> 하세요! </p> <?php } ?>
<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">×</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">
function import_templates() { if (current_user_can('frm_edit_forms')) { global $frmpro_settings; FrmFormsController::add_default_templates($frmpro_settings->template_path, false); } else { global $frm_settings; wp_die($frm_settings->admin_permission); } }
function test_get_form_shortcode() { $form = FrmFormsController::get_form_shortcode(array('id' => $this->contact_form_key)); $this->assertNotEmpty(strpos($form, '<form '), 'The form is missing'); }
<?php if (have_posts()) { while (have_posts()) { the_post(); ?> <h2><?php the_title(); ?> </h2> <?php the_content(); ?> <?php } } ?> <?php echo FrmFormsController::get_form_shortcode(array('id' => 9, 'title' => false, 'description' => false)); ?> </div> </div> </main><!-- #main --> <?php get_footer();
public static function edit_entry_ajax() { $id = FrmAppHelper::get_param('id'); $entry_id = FrmAppHelper::get_param('entry_id', false); $post_id = FrmAppHelper::get_param('post_id', false); global $frm_vars; $frm_vars['ajax_edit'] = $entry_id ? $entry_id : true; $_GET['entry'] = $entry_id; if ($post_id and is_numeric($post_id)) { global $post; if (!$post) { $post = get_post($post_id); } } FrmAppHelper::load_scripts(array('formidable')); echo "<script type='text/javascript'>\n/*<![CDATA[*/\njQuery(document).ready(function(\$){\n\$('#frm_form_" . $id . "_container .frm-show-form').submit(window.frmOnSubmit);\n});\n/*]]>*/\n</script>"; echo FrmFormsController::get_form_shortcode(compact('id', 'entry_id')); $frm_vars['ajax_edit'] = false; //if(!isset($_POST) or (!isset($_POST['action']) and !isset($_POST['frm_action]))) // echo FrmProEntriesController::footer_js(); die; }
function upgrade($old_db_version = false) { global $wpdb, $frm_db_version; //$frm_db_version is the version of the database we're moving to $old_db_version = (double) $old_db_version; if (!$old_db_version) { $old_db_version = get_option('frm_db_version'); } if ($frm_db_version != $old_db_version) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $charset_collate = ''; if ($wpdb->has_cap('collation')) { if (!empty($wpdb->charset)) { $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}"; } if (!empty($wpdb->collate)) { $charset_collate .= " COLLATE {$wpdb->collate}"; } } /* Create/Upgrade Fields Table */ $sql = "CREATE TABLE {$this->fields} (\n id int(11) NOT NULL auto_increment,\n field_key varchar(255) default NULL,\n name text default NULL,\n description text default NULL,\n type text default NULL,\n default_value longtext default NULL,\n options longtext default NULL,\n field_order int(11) default 0,\n required int(1) default NULL,\n field_options longtext default NULL,\n form_id int(11) default NULL,\n created_at datetime NOT NULL,\n PRIMARY KEY (id),\n KEY form_id (form_id),\n UNIQUE KEY field_key (field_key)\n ) {$charset_collate};"; dbDelta($sql); /* Create/Upgrade Forms Table */ $sql = "CREATE TABLE {$this->forms} (\n id int(11) NOT NULL auto_increment,\n form_key varchar(255) default NULL,\n name varchar(255) default NULL,\n description text default NULL,\n logged_in boolean default NULL,\n editable boolean default NULL,\n is_template boolean default 0,\n default_template boolean default 0,\n status varchar(255) default NULL,\n prli_link_id int(11) default NULL,\n options longtext default NULL,\n created_at datetime NOT NULL,\n PRIMARY KEY (id),\n UNIQUE KEY form_key (form_key)\n ) {$charset_collate};"; dbDelta($sql); /* Create/Upgrade Items Table */ $sql = "CREATE TABLE {$this->entries} (\n id int(11) NOT NULL auto_increment,\n item_key varchar(255) default NULL,\n name varchar(255) default NULL,\n description text default NULL,\n ip text default NULL,\n form_id int(11) default NULL,\n post_id int(11) default NULL,\n user_id int(11) default NULL,\n parent_item_id int(11) default NULL,\n updated_by int(11) default NULL,\n created_at datetime NOT NULL,\n updated_at datetime NOT NULL,\n PRIMARY KEY (id),\n KEY form_id (form_id),\n KEY post_id (post_id),\n KEY user_id (user_id),\n KEY parent_item_id (parent_item_id),\n UNIQUE KEY item_key (item_key)\n ) {$charset_collate};"; dbDelta($sql); /* Create/Upgrade Meta Table */ $sql = "CREATE TABLE {$this->entry_metas} (\n id int(11) NOT NULL auto_increment,\n meta_value longtext default NULL,\n field_id int(11) NOT NULL,\n item_id int(11) NOT NULL,\n created_at datetime NOT NULL,\n PRIMARY KEY (id),\n KEY field_id (field_id),\n KEY item_id (item_id)\n ) {$charset_collate};"; dbDelta($sql); /**** MIGRATE DATA ****/ if ($frm_db_version >= 1.03 and $old_db_version < 1.03) { global $frm_entry; $all_entries = $frm_entry->getAll(); foreach ($all_entries as $ent) { $opts = maybe_unserialize($ent->description); if (is_array($opts)) { $wpdb->update($this->entries, array('ip' => $opts['ip']), array('id' => $ent->id)); } } } if ($frm_db_version >= 4 and $old_db_version < 4) { $user_ids = FrmEntryMeta::getAll("fi.type='user_id'"); foreach ($user_ids as $user_id) { $wpdb->update($this->entries, array('user_id' => $user_id->meta_value), array('id' => $user_id->item_id)); } } if ($frm_db_version >= 6 and $old_db_version < 6) { $fields = $wpdb->get_results("SELECT id, field_options FROM {$this->fields} WHERE type not in ('hidden', 'user_id', 'break', 'divider', 'html', 'captcha', 'form')"); $default_html = <<<DEFAULT_HTML <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]"> <label class="frm_pos_[label_position]">[field_name] <span class="frm_required">[required_label]</span> </label> [input] [if description]<div class="frm_description">[description]</div>[/if description] </div> DEFAULT_HTML; $old_default_html = <<<DEFAULT_HTML <div id="frm_field_[id]_container" class="form-field [required_class] [error_class]"> <label class="frm_pos_[label_position]">[field_name] <span class="frm_required">[required_label]</span> </label> [input] [if description]<p class="frm_description">[description]</p>[/if description] </div> DEFAULT_HTML; $new_default_html = FrmFieldsHelper::get_default_html('text'); foreach ($fields as $field) { $field->field_options = maybe_unserialize($field->field_options); if (!isset($field->field_options['custom_html']) or empty($field->field_options['custom_html']) or stripslashes($field->field_options['custom_html']) == $default_html or stripslashes($field->field_options['custom_html']) == $old_default_html) { $field->field_options['custom_html'] = $new_default_html; $wpdb->update($this->fields, array('field_options' => maybe_serialize($field->field_options)), array('id' => $field->id)); } unset($field); } unset($default_html); } /**** ADD/UPDATE DEFAULT TEMPLATES ****/ FrmFormsController::add_default_templates(FRM_TEMPLATES_PATH); /***** SAVE DB VERSION *****/ update_option('frm_db_version', $frm_db_version); } do_action('frm_after_install'); }
public static function edit_entry_ajax() { //check_ajax_referer( 'frm_ajax', 'nonce' ); $id = FrmAppHelper::get_param('id', '', 'post', 'absint'); $entry_id = FrmAppHelper::get_param('entry_id', 0, 'post', 'absint'); $post_id = FrmAppHelper::get_param('post_id', 0, 'post', 'sanitize_title'); $fields = FrmAppHelper::get_param('fields', array(), 'post', 'sanitize_title'); $exclude_fields = FrmAppHelper::get_param('exclude_fields', array(), 'post', 'sanitize_title'); global $frm_vars; $frm_vars['footer_loaded'] = true; if ($entry_id) { $_GET['entry'] = $entry_id; } if ($post_id && is_numeric($post_id)) { global $post; if (!$post) { $post = get_post($post_id); } } echo "<script type='text/javascript'>\n/*<![CDATA[*/\njQuery(document).ready(function(\$){\n\$('#frm_form_" . esc_attr($id) . "_container .frm-show-form').submit(window.frmFrontForm.submitForm);\n});\n/*]]>*/\n</script>"; echo FrmFormsController::get_form_shortcode(compact('id', 'entry_id', 'fields', 'exclude_fields')); self::print_ajax_scripts('all'); wp_die(); }
public static function enqueue_scripts($params) { _deprecated_function(__FUNCTION__, '2.0.9', 'FrmFormsController::enqueue_scripts'); FrmFormsController::enqueue_scripts($params); }
<?php /** * Template Name: Contact Page */ ?> <div class="contact-page"> <?php while (have_posts()) { the_post(); ?> <?php get_template_part('templates/content', 'page'); ?> <?php } ?> <div class="row"> <div id="contact" class="col-sm-3"> <?php dynamic_sidebar('sidebar'); ?> </div> <div class="col-sm-9"> <?php echo FrmFormsController::get_form_shortcode(array('id' => 6, 'title' => true, 'description' => true)); ?> </div> </div> </div>