当前位置: 首页>>代码示例>>PHP>>正文


PHP FrmField::getOne方法代码示例

本文整理汇总了PHP中FrmField::getOne方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmField::getOne方法的具体用法?PHP FrmField::getOne怎么用?PHP FrmField::getOne使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrmField的用法示例。


在下文中一共展示了FrmField::getOne方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _get_dynamic_entry_ids

 function _get_dynamic_entry_ids($form_key, $where_field_key, $args)
 {
     // Get where_field
     $where_field = FrmField::getOne($where_field_key);
     // Get all entry IDs for form
     $form_id = $this->factory->form->get_id_by_key($form_key);
     $entry_ids = FrmEntry::getAll(array('it.form_id' => $form_id), '', '', false, false);
     // Prepare the args
     self::_do_prepare_where_args($args, $where_field, $entry_ids);
     // Set new where_val
     self::_do_prepare_dfe_text($args, $where_field);
     return $args['where_val'];
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:13,代码来源:test_FrmProAppHelper.php

示例2: _set_up_field_object

 function _set_up_field_object($test, &$expected_cats, $key)
 {
     // Parent categories
     $args = array('hide_empty' => false, 'taxonomy' => 'category', 'parent' => 0);
     $parent_cats = get_categories($args);
     // Get the correct parent ID(s) for the current test
     $parent_cat_id = self::_get_parent_cat_id($test, $parent_cats, $expected_cats);
     $this->assertNotFalse($parent_cat_id, 'Check if there are at least two parent categories with children and two with no children. Needed for the ' . $test . ' test.');
     // Child field
     $field_id = $this->factory->field->get_id_by_key('child-dynamic-taxonomy');
     $field = FrmField::getOne($field_id);
     $field->field_options['hide_opt'][$key] = $parent_cat_id;
     return $field;
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:14,代码来源:test_FrmProFieldsHelper.php

示例3: test_stats_shortcode

 function test_stats_shortcode()
 {
     $forms_to_test = array($this->all_fields_form_key => array('493ito', 'p3eiuk', 'uc580i', '4t3qo4', '54tffk', 'endbcl', 'repeating-text'));
     foreach ($forms_to_test as $form_key => $fields) {
         foreach ($fields as $field_key) {
             $field = FrmField::getOne($field_key);
             $value = do_shortcode('[frm-stats id=' . $field->id . ' type=count]');
             $this->assertNotEmpty($value, 'Field ' . $field_key . ' has no saved values');
             if (!empty($field->options)) {
                 $first_option = array_filter($field->options);
                 $first_option = reset($first_option);
                 $filter_by_value = do_shortcode('[frm-stats id=' . $field->id . ' type=count value="' . $first_option . '"]');
                 $this->assertNotEmpty($filter_by_value, 'Field ' . $field_key . ' has no saved values for "' . $first_option . '"');
             }
         }
     }
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:17,代码来源:test_FrmProStatisticsController.php

示例4: test_create

 /**
  * @covers FrmFieldsController::create
  */
 public function test_create()
 {
     wp_set_current_user($this->user_id);
     $this->assertTrue(is_numeric($this->form_id));
     $_POST = array('action' => 'frm_insert_field', 'nonce' => wp_create_nonce('frm_ajax'), 'form_id' => $this->form_id, 'field' => 'text');
     try {
         $this->_handleAjax('frm_insert_field');
     } catch (WPAjaxDieContinueException $e) {
         unset($e);
     }
     global $wpdb;
     $this->field_id = $wpdb->insert_id;
     $this->assertTrue(is_numeric($this->field_id));
     $this->assertNotEmpty($this->field_id);
     // make sure the field exists
     $field = FrmField::getOne($this->field_id);
     $this->assertTrue(is_object($field));
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:21,代码来源:test_FrmFieldsAjax.php

示例5: update_entry_metas

 public static function update_entry_metas($entry_id, $values)
 {
     global $wpdb;
     $prev_values = FrmDb::get_col($wpdb->prefix . 'frm_item_metas', array('item_id' => $entry_id, 'field_id !' => 0), 'field_id');
     foreach ($values as $field_id => $meta_value) {
         $field = false;
         if (!empty($field_id)) {
             $field = FrmField::getOne($field_id);
         }
         // set the value for the file upload field and add new tags (in Pro version)
         $meta_value = apply_filters('frm_prepare_data_before_db', $meta_value, $field_id, $entry_id, compact('field'));
         if ($prev_values && in_array($field_id, $prev_values)) {
             if (is_array($meta_value) && empty($meta_value) || !is_array($meta_value) && trim($meta_value) == '') {
                 // remove blank fields
                 unset($values[$field_id]);
             } else {
                 // if value exists, then update it
                 self::update_entry_meta($entry_id, $field_id, '', $meta_value);
             }
         } else {
             // if value does not exist, then create it
             self::add_entry_meta($entry_id, $field_id, '', $meta_value);
         }
     }
     if (empty($prev_values)) {
         return;
     }
     $prev_values = array_diff($prev_values, array_keys($values));
     if (empty($prev_values)) {
         return;
     }
     // prepare the query
     $where = array('item_id' => $entry_id, 'field_id' => $prev_values);
     FrmDb::get_where_clause_and_values($where);
     // Delete any leftovers
     $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'frm_item_metas ' . $where['where'], $where['values']));
     self::clear_cache();
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:38,代码来源:FrmEntryMeta.php

示例6: _get_the_join_field

 function _get_the_join_field(&$args)
 {
     $linked_field = FrmField::getOne($args['field']->field_options['form_select']);
     $join_fields = FrmField::get_all_types_in_form($linked_field->form_id, 'data');
     foreach ($join_fields as $j) {
         if ($j->field_options['form_select'] == $args['parent_field']->field_options['form_select']) {
             $args['join_field'] = $j;
             break;
         }
     }
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:11,代码来源:test_FrmProFieldsControllerAjax.php

示例7: replace_content_shortcodes

 public static function replace_content_shortcodes($content, $entry, $shortcodes)
 {
     $shortcode_values = array('id' => $entry->id, 'key' => $entry->item_key, 'ip' => $entry->ip);
     foreach ($shortcodes[0] as $short_key => $tag) {
         $atts = shortcode_parse_atts($shortcodes[3][$short_key]);
         if (!empty($shortcodes[3][$short_key])) {
             $tag = str_replace(array('[', ']'), '', $shortcodes[0][$short_key]);
             $tags = explode(' ', $tag);
             if (is_array($tags)) {
                 $tag = $tags[0];
             }
         } else {
             $tag = $shortcodes[2][$short_key];
         }
         switch ($tag) {
             case 'id':
             case 'key':
             case 'ip':
                 $replace_with = $shortcode_values[$tag];
                 break;
             case 'user_agent':
             case 'user-agent':
                 $entry->description = maybe_unserialize($entry->description);
                 $replace_with = FrmEntryFormat::get_browser($entry->description['browser']);
                 break;
             case 'created_at':
             case 'created-at':
             case 'updated_at':
             case 'updated-at':
                 if (isset($atts['format'])) {
                     $time_format = ' ';
                 } else {
                     $atts['format'] = get_option('date_format');
                     $time_format = '';
                 }
                 $this_tag = str_replace('-', '_', $tag);
                 $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
                 unset($this_tag);
                 break;
             case 'created_by':
             case 'created-by':
             case 'updated_by':
             case 'updated-by':
                 $this_tag = str_replace('-', '_', $tag);
                 $replace_with = self::get_display_value($entry->{$this_tag}, (object) array('type' => 'user_id'), $atts);
                 unset($this_tag);
                 break;
             case 'admin_email':
             case 'siteurl':
             case 'frmurl':
             case 'sitename':
             case 'get':
                 $replace_with = self::dynamic_default_values($tag, $atts);
                 break;
             default:
                 $field = FrmField::getOne($tag);
                 if (!$field) {
                     break;
                 }
                 $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
                 $replace_with = FrmEntryMeta::get_meta_value($entry, $field->id);
                 $atts['entry_id'] = $entry->id;
                 $atts['entry_key'] = $entry->item_key;
                 //$replace_with = apply_filters('frmpro_fields_replace_shortcodes', $replace_with, $tag, $atts, $field);
                 if (is_array($replace_with)) {
                     $replace_with = implode($sep, $replace_with);
                 }
                 if (isset($atts['show']) && $atts['show'] == 'field_label') {
                     $replace_with = $field->name;
                 } else {
                     if (isset($atts['show']) && $atts['show'] == 'description') {
                         $replace_with = $field->description;
                     } else {
                         if (empty($replace_with) && $replace_with != '0') {
                             $replace_with = '';
                         } else {
                             $replace_with = self::get_display_value($replace_with, $field, $atts);
                         }
                     }
                 }
                 unset($field);
                 break;
         }
         if (isset($replace_with)) {
             $content = str_replace($shortcodes[0][$short_key], $replace_with, $content);
         }
         unset($atts, $conditional, $replace_with);
     }
     return $content;
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:90,代码来源:FrmFieldsHelper.php

示例8: import_options

 public static function import_options()
 {
     check_ajax_referer('frm_ajax', 'nonce');
     if (!is_admin() || !current_user_can('frm_edit_forms')) {
         return;
     }
     $field_id = absint($_POST['field_id']);
     $field = FrmField::getOne($field_id);
     if (!in_array($field->type, array('radio', 'checkbox', 'select'))) {
         return;
     }
     $field = FrmFieldsHelper::setup_edit_vars($field);
     $opts = stripslashes_deep($_POST['opts']);
     $opts = explode("\n", rtrim($opts, "\n"));
     if ($field['separate_value']) {
         foreach ($opts as $opt_key => $opt) {
             if (strpos($opt, '|') !== false) {
                 $vals = explode('|', $opt);
                 if ($vals[0] != $vals[1]) {
                     $opts[$opt_key] = array('label' => trim($vals[0]), 'value' => trim($vals[1]));
                 }
                 unset($vals);
             }
             unset($opt_key, $opt);
         }
     }
     //Keep other options after bulk update
     if (isset($field['field_options']['other']) && $field['field_options']['other'] == true) {
         $other_array = array();
         foreach ($field['options'] as $opt_key => $opt) {
             if ($opt_key && strpos($opt_key, 'other') !== false) {
                 $other_array[$opt_key] = $opt;
             }
             unset($opt_key, $opt);
         }
         if (!empty($other_array)) {
             $opts = array_merge($opts, $other_array);
         }
     }
     FrmField::update($field_id, array('options' => maybe_serialize($opts)));
     $field['options'] = $opts;
     $field_name = $field['name'];
     // Get html_id which will be used in single-option.php
     $html_id = FrmFieldsHelper::get_html_id($field);
     if ($field['type'] == 'radio' || $field['type'] == 'checkbox') {
         require FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php';
     } else {
         FrmFieldsHelper::show_single_option($field);
     }
     wp_die();
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:51,代码来源:FrmFieldsController.php

示例9: selected

    <option value="not LIKE" <?php 
selected($condition['hide_field_cond'], 'not LIKE');
?>
><?php 
_e('not like', 'formidable');
?>
 &nbsp;</option>
</select>

<span id="frm_show_selected_values_<?php 
echo esc_attr($key . '_' . $meta_name);
?>
">
<?php 
if ($condition['hide_field'] && is_numeric($condition['hide_field'])) {
    $new_field = FrmField::getOne($condition['hide_field']);
}
$val = isset($condition['hide_opt']) ? $condition['hide_opt'] : '';
if (!isset($field)) {
    $field = array('hide_opt' => array($meta_name => $val));
}
$field_name = $names['hide_opt'];
require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/field-values.php';
?>
</span>
<a href="javascript:void(0)" class="frm_remove_tag frm_icon_font" data-removeid="<?php 
echo esc_attr($id);
?>
" <?php 
echo !empty($showlast) ? 'data-showlast="' . esc_attr($showlast) . '"' : '';
?>
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:31,代码来源:_logic_row.php

示例10: _check_repeat_options_updated

 /**
  * @covers update_for_repeat
  */
 function _check_repeat_options_updated($repeating_section, $expected_repeat, $expected_form_select, $msg)
 {
     $new_repeat = FrmField::getOne($repeating_section->id);
     // Check repeat option
     $this->assertEquals($expected_repeat, $new_repeat->field_options['repeat'], 'The repeat option is not updated when a divider is switched to ' . $msg);
     // Check form_select
     $this->assertEmpty($expected_form_select, $new_repeat->field_options['form_select'], 'Form_select not updated when divider is switched to ' . $msg);
 }
开发者ID:amando96,项目名称:formidable-forms,代码行数:11,代码来源:test_FrmProFieldsControllerAjax.php

示例11: array

 public static function &filter_email_value($value, $meta, $entry, $atts = array())
 {
     $frm_field = new FrmField();
     $field = $frm_field->getOne($meta->field_id);
     if (!$field) {
         return $value;
     }
     $value = self::filter_display_value($value, $field, $atts);
     return $value;
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:10,代码来源:FrmEntriesController.php

示例12: _get_xml_update_args

 function _get_xml_update_args()
 {
     $repeating_section_id = FrmField::get_id_by_key('repeating-section');
     $repeating_section_values = self::_get_repeating_section_values($repeating_section_id);
     $repeating_section = FrmField::getOne($repeating_section_id);
     $repeating_fields = FrmField::get_all_for_form($repeating_section->field_options['form_select']);
     $parent_form_id = FrmForm::getIdByKey($this->all_fields_form_key);
     $parent_entries = FrmEntry::getAll(array('form_id' => $parent_form_id));
     $child_entries = FrmEntry::getAll(array('form_id' => $repeating_section->field_options['form_select']));
     $embed_form_id = FrmForm::getIdByKey($this->contact_form_key);
     $embedded_entries = FrmEntry::getAll(array('form_id' => $embed_form_id, 'parent_item_id !' => 0));
     $args = array('repeating_section' => $repeating_section, 'repeating_section_values' => $repeating_section_values, 'repeating_fields' => $repeating_fields, 'parent_form_id' => $parent_form_id, 'parent_entries' => $parent_entries, 'child_entries' => $child_entries, 'embedded_entries' => $embedded_entries);
     return $args;
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:14,代码来源:test_FrmProXMLHelper.php

示例13: get_value_from_entry

 /**
  * Get the value from a specific field and entry
  *
  * @since 2.01.02
  * @param object $entry
  * @param int $field_id
  * @return array|bool|mixed|string
  */
 private static function get_value_from_entry($entry, $field_id)
 {
     $observed_value = '';
     if (isset($entry->metas[$field_id])) {
         $observed_value = $entry->metas[$field_id];
     } else {
         if ($entry->post_id && FrmAppHelper::pro_is_installed()) {
             $field = FrmField::getOne($field_id);
             $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value($entry, $field, array('links' => false, 'truncate' => false));
         }
     }
     return $observed_value;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:21,代码来源:FrmFormAction.php

示例14: field_on_current_page

 public static function field_on_current_page($field)
 {
     global $frm_vars;
     $current = true;
     $prev = 0;
     $next = 9999;
     if (!is_object($field)) {
         $field = FrmField::getOne($field);
     }
     if ($frm_vars['prev_page'] && is_array($frm_vars['prev_page']) && isset($frm_vars['prev_page'][$field->form_id])) {
         $prev = $frm_vars['prev_page'][$field->form_id];
     }
     if ($frm_vars['next_page'] && is_array($frm_vars['next_page']) && isset($frm_vars['next_page'][$field->form_id])) {
         $next = $frm_vars['next_page'][$field->form_id];
         if (is_object($next)) {
             $next = $next->field_order;
         }
     }
     if ($field->field_order < $prev || $field->field_order > $next) {
         $current = false;
     }
     $current = apply_filters('frm_show_field_on_page', $current, $field);
     return $current;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:24,代码来源:FrmProFieldsHelper.php

示例15: update_fields

 /**
  * @return array
  */
 public static function update_fields($id, $values)
 {
     if (!isset($values['options']) && !isset($values['item_meta']) && !isset($values['field_options'])) {
         return $values;
     }
     $all_fields = FrmField::get_all_for_form($id);
     if (empty($all_fields)) {
         return $values;
     }
     if (!isset($values['item_meta'])) {
         $values['item_meta'] = array();
     }
     $field_array = array();
     $existing_keys = array_keys($values['item_meta']);
     foreach ($all_fields as $fid) {
         if (!in_array($fid->id, $existing_keys) && (isset($values['frm_fields_submitted']) && in_array($fid->id, $values['frm_fields_submitted'])) || isset($values['options'])) {
             $values['item_meta'][$fid->id] = '';
         }
         $field_array[$fid->id] = $fid;
     }
     unset($all_fields);
     foreach ($values['item_meta'] as $field_id => $default_value) {
         if (isset($field_array[$field_id])) {
             $field = $field_array[$field_id];
         } else {
             $field = FrmField::getOne($field_id);
         }
         if (!$field) {
             continue;
         }
         if (isset($values['options']) || isset($values['field_options']['custom_html_' . $field_id])) {
             //updating the settings page
             if (isset($values['field_options']['custom_html_' . $field_id])) {
                 $field->field_options['custom_html'] = isset($values['field_options']['custom_html_' . $field_id]) ? $values['field_options']['custom_html_' . $field_id] : (isset($field->field_options['custom_html']) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html($field->type));
                 $field->field_options = apply_filters('frm_update_form_field_options', $field->field_options, $field, $values);
                 FrmField::update($field_id, array('field_options' => $field->field_options));
             } else {
                 if ($field->type == 'hidden' || $field->type == 'user_id') {
                     $prev_opts = $field->field_options;
                     $field->field_options = apply_filters('frm_update_form_field_options', $field->field_options, $field, $values);
                     if ($prev_opts != $field->field_options) {
                         FrmField::update($field_id, array('field_options' => $field->field_options));
                     }
                     unset($prev_opts);
                 }
             }
         }
         if ((isset($values['options']) || isset($values['field_options']['custom_html_' . $field_id])) && !defined('WP_IMPORTING')) {
             continue;
         }
         //updating the form
         foreach (array('size', 'max', 'label', 'invalid', 'blank', 'classes', 'captcha_size') as $opt) {
             $field->field_options[$opt] = isset($values['field_options'][$opt . '_' . $field_id]) ? trim($values['field_options'][$opt . '_' . $field_id]) : '';
         }
         $field->field_options['required_indicator'] = isset($values['field_options']['required_indicator_' . $field_id]) ? trim($values['field_options']['required_indicator_' . $field_id]) : '*';
         $field->field_options['separate_value'] = isset($values['field_options']['separate_value_' . $field_id]) ? trim($values['field_options']['separate_value_' . $field_id]) : 0;
         $field->field_options = apply_filters('frm_update_field_options', $field->field_options, $field, $values);
         $default_value = maybe_serialize($values['item_meta'][$field_id]);
         $field_key = isset($values['field_options']['field_key_' . $field_id]) ? $values['field_options']['field_key_' . $field_id] : $field->field_key;
         $required = isset($values['field_options']['required_' . $field_id]) ? $values['field_options']['required_' . $field_id] : false;
         $field_type = isset($values['field_options']['type_' . $field_id]) ? $values['field_options']['type_' . $field_id] : $field->type;
         $field_description = isset($values['field_options']['description_' . $field_id]) ? $values['field_options']['description_' . $field_id] : $field->description;
         FrmField::update($field_id, array('field_key' => $field_key, 'type' => $field_type, 'default_value' => $default_value, 'field_options' => $field->field_options, 'description' => $field_description, 'required' => $required));
         FrmField::delete_form_transient($field->form_id);
     }
     return $values;
 }
开发者ID:mazykin46,项目名称:portfolio,代码行数:70,代码来源:FrmForm.php


注:本文中的FrmField::getOne方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。