function test_create_form() { FrmAppController::install(); $frm_form = new FrmForm(); $values = FrmFormsHelper::setup_new_vars(false); $id = $frm_form->create($values); $this->assertGreaterThan(0, $id); }
/** * @covers FrmAppController::install() */ function frm_install() { if (!defined('WP_IMPORTING')) { // set this to false so all our tests won't be done with this active define('WP_IMPORTING', false); } FrmHooksController::trigger_load_hook('load_admin_hooks'); FrmAppController::install(); $this->do_tables_exist(); $this->import_xml(); }
function setUp() { parent::setUp(); FrmAppController::install(); $this->import_xml(); $this->factory->form = new Form_Factory($this); $this->factory->field = new Field_Factory($this); $this->factory->entry = new Entry_Factory($this); $this->is_pro_active = FrmAppHelper::pro_is_installed(); $current_class_name = get_class($this); if (strpos($current_class_name, 'FrmPro') && !$this->is_pro_active) { $this->markTestSkipped('Pro is not active'); } }
/** * @covers FrmDb::migrate_to_17 */ function test_migrate_from_12_to_17() { $this->frm_install(); update_option('frm_db_version', 12); $form = FrmForm::getOne('contact-db12'); $this->assertNotEmpty($form); $this->assertTrue(is_numeric($form->id)); $notification = array(0 => array('email_to' => '*****@*****.**', 'also_email_to' => array(1, 2), 'reply_to' => '*****@*****.**', 'reply_to_name' => 'Reply to me', 'cust_reply_to' => '', 'cust_reply_to_name' => '', 'plain_text' => 1, 'email_message' => 'This is my email message. [default-message]', 'email_subject' => 'The subject', 'update_email' => 2, 'inc_user_info' => 1)); $form->options['notification'] = $notification; global $wpdb; $updated = $wpdb->update($wpdb->prefix . 'frm_forms', array('options' => maybe_serialize($form->options)), array('id' => $form->id)); FrmForm::clear_form_cache(); $this->assertEquals($updated, 1); $form = FrmForm::getOne('contact-db12'); $this->assertNotEmpty($form->options, 'The form settings are empty'); $this->assertTrue(isset($form->options['notification']), 'The old notification settings are missing'); $this->assertEquals($form->options['notification'][0]['email_to'], '*****@*****.**'); // migrate data FrmAppController::install(); $form_actions = FrmFormAction::get_action_for_form($form->id, 'email'); foreach ($form_actions as $action) { $this->assertTrue(strpos($action->post_content['email_to'], '*****@*****.**') !== false); } }
public static function admin_bar_css() { FrmAppController::load_wp_admin_style(); }
global $frm_field; global $frm_form; global $frm_entry; 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';
<div id="postbox-container-1" class="<?php echo FrmAppController::get_postbox_class(); ?> "> <div id="submitdiv" class="postbox"> <h3 class="hndle"><span><?php _e('Entry Actions', 'formidable'); ?> </span></h3> <div class="inside"> <div class="submitbox"> <div id="minor-publishing" style="border:none;"> <div class="misc-pub-section"> <?php if (current_user_can('frm_create_entries')) { ?> <a href="?page=formidable-entries&frm_action=duplicate&form=<?php echo $entry->form_id; ?> &id=<?php echo $id; ?> " class="button-secondary alignright"><?php _e('Duplicate', 'formidable'); ?> </a> <?php } ?> <p class="howto"><?php
<div id="poststuff"> <?php } ?> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <?php $form_action = 'create'; ?> <?php wp_nonce_field('update-options'); ?> <?php if ($form) { FrmAppController::get_form_nav($form->id, true); } ?> <?php require FRM_VIEWS_PATH . '/frm-entries/form.php'; ?> <p> <input class="button-primary" type="submit" value="<?php echo esc_attr($submit); ?> " /> <?php _e('or', 'formidable'); ?> <a class="button-secondary cancel" href="?page=formidable-entries"><?php
?> <?php do_action('frm_entry_inside_h2', $form); ?> </h2> <?php require FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; ?> <form id="posts-filter" method="get"> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <?php FrmAppController::get_form_nav($form, true, 'hide'); ?> </div> <div id="postbox-container-1" class="postbox-container"> <input type="hidden" name="page" value="formidable-entries" /> <input type="hidden" name="form" value="<?php echo esc_attr($form ? $form->id : ''); ?> " /> <input type="hidden" name="frm_action" value="list" /> <?php $wp_list_table->search_box(__('Search', 'formidable'), 'entry'); ?> </div> <div class="clear"></div> </div>
<p><label class="frm_primary_label"><?php _e('After Fields', 'formidable'); ?> </label> <textarea name="options[after_html]" rows="3" class="frm_long_input"><?php echo FrmAppHelper::esc_textarea($values['after_html']); ?> </textarea></p> </div> </div> <div id="post_settings" class="post_settings tabs-panel" style="display:none;"> <?php if ($frmpro_is_installed) { FrmProFormsController::post_options($values); } else { FrmAppController::update_message('create and edit posts, pages, and custom post types through your forms'); } ?> </div> <?php foreach ($sections as $sec_name => $section) { if (isset($section['class'])) { call_user_func(array($section['class'], $section['function']), $values); } else { call_user_func(isset($section['function']) ? $section['function'] : $section, $values); } } ?> <?php
?> <p class="alignright"><a href="http://formidablepro.com/display-your-form-data/" target="blank" title="Get Help"><img src="<?php echo FRM_IMAGES_URL; ?> /tooltip.png" alt="?" width="14px"/></a> <a href="http://formidablepro.com/display-your-form-data/" target="blank" title="Get Help"><?php _e('Get Help with This Page', 'formidable'); ?> </a></p> <?php include FRM_VIEWS_PATH . '/shared/nav.php'; ?> <form method="post"> <input type="hidden" name="frm_action" value="update" /> <input type="hidden" name="id" value="<?php echo $id; ?> " /> <?php if (is_numeric($values['form_id'])) { FrmAppController::get_form_nav($values['form_id'], true); } wp_nonce_field('update-options'); require FRMPRO_VIEWS_PATH . '/displays/form.php'; ?> </form> </div>
<div id="form_views_page" class="wrap"> <div class="frmicon icon32"><br/></div> <h2> <?php _e('Views', 'formidable'); ?> <a href="#" class="add-new-h2 frm_invisible"><?php _e('Add New', 'formidable'); ?> </a> </h2> <?php if ($form) { FrmAppController::get_form_nav($form); } require FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; FrmAppHelper::update_message(__('display collected data in lists, calendars, and other formats', 'formidable')); ?> <img class="frm_no_views" src="http://fp.strategy11.com/images/custom-display-settings.png" alt="Display"/> </div>
public static function mb_excerpt($post) { include FrmAppHelper::plugin_path() . '/pro/classes/views/displays/mb_excerpt.php'; //add form nav via javascript $form = get_post_meta($post->ID, 'frm_form_id', true); if ($form) { echo '<div id="frm_nav_container" style="display:none;">'; FrmAppController::get_form_nav($form, true); echo '<div class="clear"></div>'; echo '</div>'; echo '<script type="text/javascript">jQuery(document).ready(function($){ $(".wrap h2:first").after( $("#frm_nav_container").show());})</script>'; } }
FrmProDisplaysController::mb_tags_box($id); } else { ?> <div id="taxonomy-linkcategory" class="categorydiv"> <ul id="category-tabs" class="category-tabs frm-category-tabs"> <li class="tabs" ><a href="#frm-insert-fields-box" id="frm_insert_fields_tab" ><?php _e('Insert Fields', 'formidable'); ?> </a></li> <li class="hide-if-no-js"><a href="#frm-html-tags" id="frm_html_tags_tab" ><?php _e('HTML Tags', 'formidable'); ?> </a></li> </ul> <div id="frm-insert-fields-box" class="tabs-panel" style="max-height:none;padding-right:0;"> <br/><br/> <?php FrmAppController::update_message('insert field values into your messages'); ?> </div> <?php include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php'; ?> </div> <?php } ?> </div> </div>
// 1.07.02 define('FRM_PATH', dirname(__FILE__)); global $frm_siteurl; //deprecated: use FrmAppHelper::site_url() $frm_siteurl = site_url(); if (is_ssl() and (!preg_match('/^https:\\/\\/.*\\..*$/', $frm_siteurl) or !preg_match('/^https:\\/\\/.*\\..*$/', WP_PLUGIN_URL))) { $frm_siteurl = str_replace('http://', 'https://', $frm_siteurl); define('FRM_URL', str_replace('http://', 'https://', WP_PLUGIN_URL . '/formidable')); } else { define('FRM_URL', WP_PLUGIN_URL . '/formidable'); //deprecated: use FrmAppHelper::plugin_url() } global $frm_version, $frm_ajax_url; $frm_version = FrmAppHelper::plugin_version(); //deprecated: use FrmAppHelper::plugin_version() $frm_ajax_url = admin_url('admin-ajax.php'); global $frmpro_is_installed; $frmpro_is_installed = FrmAppController::pro_is_installed(); // 1.07.05 if (class_exists('FrmProEntry')) { global $frmpro_entry; global $frmpro_entry_meta; global $frmpro_field; global $frmpro_form; $frmpro_entry = new FrmProEntry(); $frmpro_entry_meta = new FrmProEntryMeta(); $frmpro_field = new FrmProField(); $frmpro_form = new FrmProForm(); new FrmProDb(); }
function edit_entry_ajax($id, $entry_id = false, $post_id = false) { global $frm_ajax_edit; $frm_ajax_edit = $entry_id ? $entry_id : true; if ($post_id and is_numeric($post_id)) { global $post; if (!$post) { $post = get_post($post_id); } } global $wp_scripts; $wp_scripts->do_items(array('formidable')); echo "<script type='text/javascript'>\n//<![CDATA[\njQuery(document).ready(function(\$){\n\$('#frm_form_" . $id . "_container .frm-show-form').submit(function(e){e.preventDefault();window.frmGetFormErrors(this,'" . FRM_SCRIPT_URL . "');});\n});\n//]]>\n</script>"; echo FrmAppController::get_form_shortcode(compact('id', 'entry_id')); $frm_ajax_edit = false; //if(!isset($_POST) or (!isset($_POST['action']) and !isset($_POST['frm_action]))) // echo FrmProEntriesController::footer_js(); die; }
?> /> <?php _e('Append IP Address, Browser, and Referring URL to message', 'formidable'); ?> </label> <p><label for="plain_text_<?php echo $email_key; ?> "><input type="checkbox" name="notification[<?php echo $email_key; ?> ][plain_text]" id="plain_text_<?php echo $email_key; ?> " value="1" <?php checked($notification['plain_text'], 1); ?> /> <?php _e('Send Emails in Plain Text', 'formidable'); ?> </label></p> <?php if (!$frm_vars['pro_is_installed']) { FrmAppController::update_message('send autoresponders or conditionally send email notifications'); } do_action('frm_additional_form_notification_options', $values, compact('notification', 'email_key')); ?> </td></tr> </table> </div>
$values = FrmEntriesHelper::setup_new_vars($fields, $form, true); $created = isset($frm_vars['created_entries']) && isset($frm_vars['created_entries'][$form->id]) ? $frm_vars['created_entries'][$form->id]['entry_id'] : 0; $conf_method = apply_filters('frm_success_filter', 'message', $form, $form->options, 'create'); if (!$created || !is_numeric($created) || $conf_method == 'message') { $saved_message = apply_filters('frm_content', $saved_message, $form, $created); $message = $created && is_numeric($created) ? '<div class="frm_message" id="message">' . wpautop(do_shortcode($saved_message)) . '</div>' : '<div class="frm_error_style">' . $frm_settings->failed_msg . '</div>'; if (!isset($form->options['show_form']) || $form->options['show_form']) { require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/new.php'; } else { global $frm_vars; FrmFormsHelper::form_loaded($form); if ($values['custom_style']) { $frm_vars['load_css'] = true; } if ((!isset($frm_vars['css_loaded']) || !$frm_vars['css_loaded']) && $frm_vars['load_css']) { echo FrmAppController::footer_js('header'); $frm_vars['css_loaded'] = true; } ?> <div class="frm_forms<?php echo $values['custom_style'] ? ' with_frm_style' : ''; ?> " id="frm_form_<?php echo $form->id; ?> _container"><?php require FrmAppHelper::plugin_path() . '/classes/views/frm-entries/errors.php'; ?> </div> <?php }
if (current_user_can('frm_create_entries')) { ?> <a href="?page=formidable-entries&frm_action=new" class="add-new-h2"><?php _e('Add New', 'formidable'); ?> </a> <?php } ?> </h2> <div> <div class="frm_forms"> <?php FrmAppController::get_form_nav($entry->form_id, true); if (version_compare($GLOBALS['wp_version'], '3.3.3', '<')) { ?> <div id="poststuff" class="metabox-holder has-right-sidebar"> <?php require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-entries/sidebar-show.php'; } else { ?> <div id="poststuff"> <?php } ?> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <div class="postbox">
</h2> <?php require FRM_VIEWS_PATH . '/shared/errors.php'; ?> <?php require FRM_VIEWS_PATH . '/shared/nav.php'; ?> <?php if ($form) { FrmAppController::get_form_nav($form->id, true); } ?> <?php FrmAppController::update_message('view, search, export, and bulk delete your saved entries'); ?> <?php if (!$form or $entry_count) { ?> <img src="<?php echo FRM_URL; ?> /screenshot-3.png" alt="Entries List" style="max-width:100%"/> <?php } else { ?> <table class="wp-list-table widefat post fixed" cellspacing="0"> <thead> <tr><th class="manage-column" scope="col"> </th></tr>
<div class="wrap"> <div class="frm_report_icon icon32"><br/></div> <h2><?php _e('Form Statistics', 'formidable'); ?> </h2> <?php require FRM_VIEWS_PATH . '/shared/errors.php'; ?> <?php require FRM_VIEWS_PATH . '/shared/nav.php'; ?> <?php if ($form) { FrmAppController::get_form_nav($form, true); } ?> <?php FrmAppController::update_message('view reports and statistics on your saved entries'); ?> <img src="http://fp.strategy11.com/wp-content/themes/formidablepro/images/reports1.png" alt="Reports" style="max-width:100%"/> </div>
<div id="form_views_page" class="wrap"> <div class="frmicon icon32"><br/></div> <h2> <?php _e('Views', 'formidable'); ?> <a href="#" class="add-new-h2" style="visibility:hidden;"><?php _e('Add New', 'formidable'); ?> </a> </h2> <?php if ($form) { FrmAppController::get_form_nav($form); } require FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; FrmAppController::update_message('display collected data in lists, calendars, and other formats'); ?> <img src="http://fp.strategy11.com/images/custom-display-settings.png" alt="Display" style="max-width:100%"/> </div>
public static function mb_excerpt($post) { include FrmAppHelper::plugin_path() . '/pro/classes/views/displays/mb_excerpt.php'; //add form nav via javascript $form = get_post_meta($post->ID, 'frm_form_id', true); if ($form) { echo '<div id="frm_nav_container" style="display:none;margin-top:-10px">'; FrmAppController::get_form_nav($form, true, 'hide'); echo '<div class="clear"></div>'; echo '</div>'; } }