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


PHP FrmFieldsHelper::get_display_value方法代码示例

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


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

示例1: get_field_value_shortcode

 public static function get_field_value_shortcode($sc_atts)
 {
     $atts = shortcode_atts(array('entry' => false, 'field_id' => false, 'user_id' => false, 'ip' => false, 'show' => '', 'format' => '', 'return_array' => false, 'default' => ''), $sc_atts);
     // Include all user-defined atts as well
     $atts = (array) $atts + (array) $sc_atts;
     // For reverse compatibility
     if (isset($atts['entry_id']) && !$atts['entry']) {
         $atts['entry'] = $atts['entry_id'];
     }
     if (!$atts['field_id']) {
         return __('You are missing options in your shortcode. field_id is required.', 'formidable');
     }
     $field = FrmField::getOne($atts['field_id']);
     if (!$field) {
         return $atts['default'];
     }
     $entry = self::get_frm_field_value_entry($field, $atts);
     if (!$entry) {
         return $atts['default'];
     }
     $value = FrmProEntryMetaHelper::get_post_or_meta_value($entry, $field, $atts);
     $atts['type'] = $field->type;
     $atts['post_id'] = $entry->post_id;
     $atts['entry_id'] = $entry->id;
     if (!isset($atts['show_filename'])) {
         $atts['show_filename'] = false;
     }
     if ($field->type == 'file' && !isset($atts['html'])) {
         // default to show the image instead of the url
         $atts['html'] = 1;
     }
     if (!empty($atts['format']) || isset($atts['show']) && !empty($atts['show'])) {
         $value = FrmFieldsHelper::get_display_value($value, $field, $atts);
     } else {
         $value = FrmEntriesHelper::display_value($value, $field, $atts);
     }
     return $value;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:38,代码来源:FrmProEntriesController.php

示例2: eval_equals_condition

 private static function eval_equals_condition($atts, &$replace_with, $field)
 {
     if ($replace_with != $atts['equals']) {
         if ($field && $field->type == 'data') {
             $replace_with = FrmFieldsHelper::get_display_value($replace_with, $field, $atts);
             if ($replace_with != $atts['equals']) {
                 $replace_with = '';
             }
         } else {
             if (isset($field->field_options['post_field']) && $field->field_options['post_field'] == 'post_category') {
                 $cats = explode(', ', $replace_with);
                 $replace_with = '';
                 foreach ($cats as $cat) {
                     if ($atts['equals'] == strip_tags($cat)) {
                         $replace_with = true;
                         return;
                     }
                 }
             } else {
                 $replace_with = '';
             }
         }
     } else {
         if ($atts['equals'] == '' && $replace_with == '' || $atts['equals'] == '0' && $replace_with == '0') {
             //if the field is blank, give it a value
             $replace_with = true;
         }
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:29,代码来源:FrmProFieldsHelper.php

示例3: ajax_get_data

 public static function ajax_get_data()
 {
     //check_ajax_referer( 'frm_ajax', 'nonce' );
     $entry_id = FrmAppHelper::get_param('entry_id');
     if (is_array($entry_id)) {
         $entry_id = implode(',', $entry_id);
     }
     $entry_id = trim($entry_id, ',');
     $field_id = FrmAppHelper::get_param('field_id', '', 'get', 'sanitize_title');
     $current_field = FrmAppHelper::get_param('current_field', '', 'get', 'absint');
     $hidden_field_id = FrmAppHelper::get_param('hide_id');
     $data_field = FrmField::getOne($field_id);
     $current = FrmField::getOne($current_field);
     if (strpos($entry_id, ',')) {
         $entry_id = explode(',', $entry_id);
         $meta_value = array();
         foreach ($entry_id as $eid) {
             $new_meta = FrmProEntryMetaHelper::get_post_or_meta_value($eid, $data_field);
             if ($new_meta) {
                 foreach ((array) $new_meta as $nm) {
                     array_push($meta_value, $nm);
                     unset($nm);
                 }
             }
             unset($new_meta, $eid);
         }
         $meta_value = array_unique($meta_value);
     } else {
         $meta_value = FrmProEntryMetaHelper::get_post_or_meta_value($entry_id, $data_field);
     }
     $data_display_opts = apply_filters('frm_display_data_opts', array('html' => true));
     $value = FrmFieldsHelper::get_display_value($meta_value, $data_field, $data_display_opts);
     if (is_array($value)) {
         $value = implode(', ', $value);
     }
     if (is_array($meta_value)) {
         $meta_value = implode(', ', $meta_value);
     }
     if ($value && !empty($value)) {
         echo apply_filters('frm_show_it', "<p class='frm_show_it'>" . $value . "</p>\n", $value, array('field' => $data_field, 'value' => $meta_value, 'entry_id' => $entry_id));
     }
     $current_field = (array) $current;
     foreach ($current->field_options as $o => $v) {
         if (!isset($current_field[$o])) {
             $current_field[$o] = $v;
         }
         unset($o, $v);
     }
     // Set up HTML ID and HTML name
     $html_id = '';
     $field_name = 'item_meta';
     FrmProFieldsHelper::get_html_id_from_container($field_name, $html_id, (array) $current, $hidden_field_id);
     echo '<input type="hidden" id="' . esc_attr($html_id) . '" name="' . esc_attr($field_name) . '" value="' . esc_attr($value) . '" ' . do_action('frm_field_input_html', $current_field, false) . '/>';
     wp_die();
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:55,代码来源:FrmProFieldsController.php


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