本文整理汇总了PHP中FrmField::get_all_for_form方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmField::get_all_for_form方法的具体用法?PHP FrmField::get_all_for_form怎么用?PHP FrmField::get_all_for_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmField
的用法示例。
在下文中一共展示了FrmField::get_all_for_form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_all_fields_for_form_key
function get_all_fields_for_form_key($form_key)
{
$field_totals = array($this->all_fields_form_key => 44, $this->create_post_form_key => 10, $this->contact_form_key => 8, $this->repeat_sec_form_key => 3);
$expected_field_num = isset($field_totals[$form_key]) ? $field_totals[$form_key] : 0;
$form_id = $this->factory->form->get_id_by_key($form_key);
$fields = FrmField::get_all_for_form($form_id, '', 'include');
$actual_field_num = count($fields);
$this->assertEquals($actual_field_num, $expected_field_num, $actual_field_num . ' fields were retrieved for ' . $form_key . ' form, but ' . $expected_field_num . ' were expected. This could mean that certain fields were not imported correctly.');
return $fields;
}
示例2: _check_if_child_fields_duplicate
function _check_if_child_fields_duplicate($old_child_forms, $new_child_forms)
{
// Just check the first form
$old_child_form = reset($old_child_forms);
$new_child_form = reset($new_child_forms);
// Get all fields in each form
$old_child_form_fields = FrmField::get_all_for_form($old_child_form->id);
$new_child_form_fields = FrmField::get_all_for_form($new_child_form->id);
// Check if there are the same number of child form fields in the duplicated child form
$this->assertEquals(count($old_child_form_fields), count($new_child_form_fields), 'When a form is duplicated, the fields in the repeating section are not duplicated correctly.');
}
示例3: show_entry
public static function show_entry($atts)
{
$atts = shortcode_atts(array('id' => false, 'entry' => false, 'fields' => false, 'plain_text' => false, 'user_info' => false, 'include_blank' => false, 'default_email' => false, 'form_id' => false, 'format' => 'text', 'direction' => 'ltr', 'font_size' => '', 'text_color' => '', 'border_width' => '', 'border_color' => '', 'bg_color' => '', 'alt_bg_color' => '', 'clickable' => false), $atts);
if ($atts['format'] != 'text') {
//format options are text, array, or json
$atts['plain_text'] = true;
}
if (is_object($atts['entry']) && !isset($atts['entry']->metas)) {
// if the entry does not include metas, force it again
$atts['entry'] = false;
}
if (!$atts['entry'] || !is_object($atts['entry'])) {
if (!$atts['id'] && !$atts['default_email']) {
return '';
}
if ($atts['id']) {
$atts['entry'] = FrmEntry::getOne($atts['id'], true);
}
}
if ($atts['entry']) {
$atts['form_id'] = $atts['entry']->form_id;
$atts['id'] = $atts['entry']->id;
}
if (!$atts['fields'] || !is_array($atts['fields'])) {
$atts['fields'] = FrmField::get_all_for_form($atts['form_id'], '', 'include');
}
$values = array();
foreach ($atts['fields'] as $f) {
if ($f->type != 'password' && $f->type != 'credit_card') {
self::fill_entry_values($atts, $f, $values);
}
unset($f);
}
self::fill_entry_user_info($atts, $values);
if ($atts['format'] == 'json') {
return json_encode($values);
} else {
if ($atts['format'] == 'array') {
return $values;
}
}
$content = array();
self::convert_entry_to_content($values, $atts, $content);
if ('text' == $atts['format']) {
$content = implode('', $content);
}
if ($atts['clickable']) {
$content = make_clickable($content);
}
return $content;
}
示例4: wpfg_lookup_formidable
function wpfg_lookup_formidable($form_id)
{
if (!class_exists('FrmField')) {
return false;
}
$form = FrmField::get_all_for_form($form_id);
if (is_array($form)) {
$form = reset($form);
}
if (isset($form->form_name) && $form->form_name) {
return $form->form_name;
}
return false;
}
示例5: _check_updated_values
function _check_updated_values($form_id)
{
$fields = FrmField::get_all_for_form($form_id);
// Compare to posted values
foreach ($fields as $field) {
// Check default value
$posted_val = $_POST['item_meta'][$field->id];
$actual_val = $field->default_value;
$this->assertEquals($posted_val, $actual_val, 'The default value was not updated correctly for field ' . $field->field_key . '.');
// Check calculations
$posted_val = $_POST['field_options']['use_calc_' . $field->id];
$actual_val = $field->field_options['use_calc'];
$this->assertEquals($posted_val, $actual_val, 'The calculation was not updated correctly for field ' . $field->field_key . '.');
}
}
示例6: test_get_all_for_form
/**
* @covers FrmField::get_all_for_form
*/
function test_get_all_for_form()
{
$forms = array('basic_test' => array('form_key' => $this->contact_form_key, 'count' => 8), 'repeat' => array('form_key' => $this->all_fields_form_key, 'count' => 33 + 3), 'no_repeat_or_embed' => array('form_key' => $this->all_fields_form_key, 'count' => 33), 'repeat_and_embed' => array('form_key' => $this->all_fields_form_key, 'count' => 33 + 3 + 8));
foreach ($forms as $test => $args) {
$form_id = FrmForm::getIdByKey($args['form_key']);
if ($test == 'no_repeat_or_embed') {
$fields = FrmField::get_all_for_form($form_id, '', 'exclude', 'exclude');
} else {
if ($test == 'repeat_and_embed') {
$fields = FrmField::get_all_for_form($form_id, '', 'include', 'include');
} else {
$fields = FrmField::get_all_for_form($form_id);
}
}
$this->assertNotEmpty($fields);
$this->assertEquals($args['count'], count($fields), 'An incorrect number of fields are retrieved with FrmField::get_all_for_form.');
}
}
示例7: test_toggle_repeat
/**
* @covers FrmProFieldsController::toggle_repeat
*/
function test_toggle_repeat()
{
/*
1. Start with repeating, switch to regular
- move child fields to parent form √
- move child entries to parent form √
- child entries deleted √
- child form deleted √
- form_select and repeat updated √
- check if correct form_id is echoed √
2. Switch to repeating
- child form created w/correct parent_form_id √
- move child fields to child form √
- child entries created from parent data √
- form_select updated and repeat updated √
- check if correct form_id is echoed
*/
$form_id = $this->factory->form->get_id_by_key('all_field_types');
$section_fields = FrmField::get_all_types_in_form($form_id, 'divider');
foreach ($section_fields as $section) {
if (FrmField::is_repeating_field($section)) {
$repeating_section = $section;
break;
}
}
$child_form_id = $repeating_section->field_options['form_select'];
$children = FrmField::get_all_for_form($child_form_id, '', 'include');
$child_ids = array();
foreach ($children as $child) {
$child_ids[] = $child->id;
}
$this->assertNotEmpty($child_ids, 'There were no fields retrieved for the repeating section form');
self::_switch_to_not_repeating($repeating_section, $child_ids);
self::_switch_to_repeating($repeating_section, $child_ids);
// TODO: Again, but update the form this time
// Update form
/*self::_switch_to_not_repeating( $repeating_section, $child_ids );
// Update form
self::_switch_to_repeating( $repeating_section, $child_ids );
// Update form*/
}
示例8: get_form_fields
public static function get_form_fields($form_id, $error = false)
{
$fields = FrmField::get_all_for_form($form_id);
$fields = apply_filters('frm_get_paged_fields', $fields, $form_id, $error);
return $fields;
}
示例9: while
<?php
if (!$item_ids) {
return;
}
$item_form_id = 0;
// fetch 20 posts at a time rather than loading the entire table into memory
while ($next_set = array_splice($item_ids, 0, 20)) {
$entries = FrmDb::get_results('frm_items', array('or' => 1, 'id' => $next_set, 'parent_item_id' => $next_set));
// Begin Loop
foreach ($entries as $entry) {
if ($item_form_id != $entry->form_id) {
$fields = FrmField::get_all_for_form($entry->form_id);
$item_form_id = $entry->form_id;
}
?>
<item>
<id><?php
echo absint($entry->id);
?>
</id>
<item_key><?php
echo FrmXMLHelper::cdata($entry->item_key);
?>
</item_key>
<name><?php
echo FrmXMLHelper::cdata($entry->name);
?>
</name>
<description><?php
echo FrmXMLHelper::cdata($entry->description);
示例10: mb_tags_box
public static function mb_tags_box($form_id, $class = '')
{
$fields = FrmField::get_all_for_form($form_id, '', 'include');
$linked_forms = array();
$col = 'one';
$settings_tab = FrmAppHelper::is_admin_page('formidable') ? true : false;
$cond_shortcodes = apply_filters('frm_conditional_shortcodes', array());
$adv_shortcodes = self::get_advanced_shortcodes();
$user_fields = apply_filters('frm_user_shortcodes', array());
$entry_shortcodes = self::get_shortcode_helpers($settings_tab);
include FrmAppHelper::plugin_path() . '/classes/views/shared/mb_adv_info.php';
}
示例11: get_shortcodes
public static function get_shortcodes($content, $form_id)
{
if (empty($form_id) || strpos($content, '[') === false) {
// don't continue if there are no shortcodes to check
return array(array());
}
$tagregexp = array('deletelink', 'detaillink', 'evenodd', 'get', 'entry_count', 'event_date');
$form_id = (int) $form_id;
$form_ids = array($form_id);
//get linked form ids
$fields = FrmProFormsHelper::has_repeat_field($form_id, false);
foreach ($fields as $field) {
if (FrmField::is_option_true($field, 'form_select')) {
$form_ids[] = $field->field_options['form_select'];
$tagregexp[] = $field->id;
$tagregexp[] = $field->field_key;
}
unset($field);
}
foreach ($form_ids as $form_id) {
$fields = FrmField::get_all_for_form($form_id, '', 'include');
foreach ($fields as $field) {
$tagregexp[] = $field->id;
$tagregexp[] = $field->field_key;
}
}
$tagregexp = implode('|', $tagregexp) . '|';
$tagregexp .= FrmFieldsHelper::allowed_shortcodes();
if (!ini_get('safe_mode')) {
// make sure the backtrack limit is as least at the default
$backtrack_limit = ini_get('pcre.backtrack_limit');
if ($backtrack_limit < 1000000) {
ini_set('pcre.backtrack_limit', 1000000);
}
}
preg_match_all("/\\[(if |foreach )?({$tagregexp})\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/\\])?/s", $content, $matches, PREG_PATTERN_ORDER);
// run conditional and foreach first
$new_order = $matches[0];
$move_up = array();
foreach ($new_order as $short_key => $tag) {
$conditional = preg_match('/^\\[if/s', $matches[0][$short_key]) ? true : false;
$foreach = preg_match('/^\\[foreach/s', $matches[0][$short_key]) ? true : false;
if ($conditional || $foreach) {
$move_up[$short_key] = $tag;
}
}
if (!empty($move_up)) {
$matches[0] = $move_up + $matches[0];
}
return $matches;
}
示例12: include_logic_row
public static function include_logic_row($atts)
{
$defaults = array('meta_name' => '', 'condition' => array('hide_field' => '', 'hide_field_cond' => '==', 'hide_opt' => ''), 'key' => '', 'type' => 'form', 'form_id' => 0, 'id' => '', 'name' => '', 'names' => array(), 'showlast' => '', 'onchange' => '', 'exclude_fields' => array_merge(FrmField::no_save_fields(), array('file', 'rte', 'date')));
$atts = wp_parse_args($atts, $defaults);
if (empty($atts['id'])) {
$atts['id'] = 'frm_logic_' . $atts['key'] . '_' . $atts['meta_name'];
}
if (empty($atts['name'])) {
$atts['name'] = 'frm_form_action[' . $atts['key'] . '][post_content][conditions][' . $atts['meta_name'] . ']';
}
if (empty($atts['names'])) {
$atts['names'] = array('hide_field' => $atts['name'] . '[hide_field]', 'hide_field_cond' => $atts['name'] . '[hide_field_cond]', 'hide_opt' => $atts['name'] . '[hide_opt]');
}
if ($atts['onchange'] == '') {
$atts['onchange'] = "frmGetFieldValues(this.value,'" . $atts['key'] . "','" . $atts['meta_name'] . "','" . (isset($atts['field']['type']) ? $atts['field']['type'] : '') . "','" . $atts['names']['hide_opt'] . "')";
}
$form_fields = FrmField::get_all_for_form($atts['form_id']);
extract($atts);
include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-forms/_logic_row.php';
}
示例13: get_fields_for_csv_export
/**
* Get the fields that should be included in the CSV export
*
* @since 2.0.19
*
* @param int $form_id
* @param object $form
* @return array $csv_fields
*/
private static function get_fields_for_csv_export($form_id, $form)
{
// Phase frm_csv_field_ids out by 2.01.05
$csv_field_ids = apply_filters('frm_csv_field_ids', '', $form_id, array('form' => $form));
if ($csv_field_ids) {
_deprecated_function('The frm_csv_field_ids filter', '2.0.19', 'the frm_csv_columns filter');
$where = array('fi.type not' => FrmField::no_save_fields());
$where[] = array('or' => 1, 'fi.form_id' => $form->id, 'fr.parent_form_id' => $form->id);
if (!is_array($csv_field_ids)) {
$csv_field_ids = explode(',', $csv_field_ids);
}
if (!empty($csv_field_ids)) {
$where['fi.id'] = $csv_field_ids;
}
$csv_fields = FrmField::getAll($where, 'field_order');
} else {
$csv_fields = FrmField::get_all_for_form($form_id, '', 'include', 'include');
$no_export_fields = FrmField::no_save_fields();
foreach ($csv_fields as $k => $f) {
if (in_array($f->type, $no_export_fields)) {
unset($csv_fields[$k]);
}
}
}
return $csv_fields;
}
示例14: fields_to_values
private static function fields_to_values($form_id, array &$values)
{
$form = FrmForm::getOne($form_id);
$values = array('fields' => array(), 'id' => $form->id);
$fields = FrmField::get_all_for_form($form->id);
foreach ($fields as $k => $f) {
$f = (array) $f;
$opts = (array) $f['field_options'];
$f = array_merge($opts, $f);
if (!isset($f['post_field'])) {
$f['post_field'] = '';
}
$values['fields'][] = $f;
unset($k, $f);
}
return $form;
}
示例15: _check_xml_updated_repeating_fields
function _check_xml_updated_repeating_fields($args)
{
$fields = FrmField::get_all_for_form($args['repeating_section']->field_options['form_select']);
// Check if the number of fields in repeating form is correct
$this->assertEquals(count($args['repeating_fields']), count($fields), 'Fields in repeating section were either added or deleted when they should have been updated.');
// Make sure the same fields are still in the section
$repeating_field_keys = array('repeating-text', 'repeating-checkbox', 'repeating-date');
foreach ($fields as $field) {
$this->assertTrue(in_array($field->field_key, $repeating_field_keys), 'A field with the key ' . $field->field_key . ' was created when it should have been upated.');
}
}