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


PHP FrmAppHelper::get_user_id_param方法代码示例

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


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

示例1: update_postmeta

 private static function update_postmeta(&$post, $post_id)
 {
     foreach ($post['postmeta'] as $k => $v) {
         if ('_edit_last' == $k) {
             $v = FrmAppHelper::get_user_id_param($v);
         } else {
             if ('_thumbnail_id' == $k && FrmAppHelper::pro_is_installed()) {
                 //change the attachment ID
                 $v = FrmProXMLHelper::get_file_id($v);
             }
         }
         update_post_meta($post_id, $k, $v);
         unset($k, $v);
     }
 }
开发者ID:EyesX,项目名称:formidable-forms,代码行数:15,代码来源:FrmXMLHelper.php

示例2: get_user_id_param

 public static function get_user_id_param($user_id)
 {
     _deprecated_function(__FUNCTION__, '2.0', 'FrmAppHelper::get_user_id_param');
     return FrmAppHelper::get_user_id_param($user_id);
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:5,代码来源:FrmProAppHelper.php

示例3: add_entry_col_query

 private static function add_entry_col_query($fid, $search_param, &$add_where)
 {
     if (is_numeric($fid)) {
         return;
     }
     $add_where['or'] = 1;
     if (in_array($fid, array('created_at', 'updated_at'))) {
         $add_where['it.' . $fid . ' like'] = $search_param;
     } else {
         if (in_array($fid, array('user_id', 'id'))) {
             if ($fid == 'user_id' && !is_numeric($search_param)) {
                 $search_param = FrmAppHelper::get_user_id_param($search_param);
             }
             $add_where['it.' . $fid . ' like'] = $search_param;
         } else {
             $add_where['it.name like'] = $search_param;
             $add_where['it.item_key like'] = $search_param;
             $add_where['it.description like'] = $search_param;
             $add_where['it.created_at like'] = $search_param;
         }
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:22,代码来源:FrmProEntriesHelper.php

示例4: get_frm_field_value_entry

 /**
  * Get entry object for frm_field_value shortcode
  * Uses user_id, entry, or ip atts to fetch the entry
  *
  * @since 2.0.13
  * @param object $field
  * @param array $atts
  * @return boolean|object $entry
  */
 private static function get_frm_field_value_entry($field, &$atts)
 {
     $query = array('form_id' => $field->form_id);
     if ($atts['user_id']) {
         // make sure we are not getting entries for logged-out users
         $query['user_id'] = (int) FrmAppHelper::get_user_id_param($atts['user_id']);
         $query['user_id !'] = 0;
     }
     if ($atts['entry']) {
         if (!is_numeric($atts['entry'])) {
             $atts['entry'] = FrmAppHelper::simple_get($atts['entry'], 'sanitize_title', $atts['entry']);
         }
         if (empty($atts['entry'])) {
             return;
         }
         if (is_numeric($atts['entry'])) {
             $query[] = array('or' => 1, 'id' => $atts['entry'], 'parent_item_id' => $atts['entry']);
         } else {
             $query[] = array('item_key' => $atts['entry']);
         }
     }
     if ($atts['ip']) {
         $query['ip'] = $atts['ip'] == true ? FrmAppHelper::get_ip_address() : $atts['ip'];
     }
     $entry = FrmDb::get_row('frm_items', $query, 'post_id, id', array('order_by' => 'created_at DESC'));
     return $entry;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:36,代码来源:FrmProEntriesController.php

示例5: validate

 public static function validate($errors, $field, $value, $args)
 {
     $field->temp_id = $args['id'];
     // Keep current value for "Other" fields because it is needed for correct validation
     if (!$args['other']) {
         FrmEntriesHelper::get_posted_value($field, $value, $args);
     }
     if ($field->type == 'form' || FrmField::is_repeating_field($field)) {
         self::validate_embedded_form($errors, $field, $args['exclude']);
     } else {
         if ($field->type == 'user_id') {
             // make sure we have a user ID
             if (!is_numeric($value)) {
                 $value = FrmAppHelper::get_user_id_param($value);
                 FrmEntriesHelper::set_posted_value($field, $value, $args);
             }
             //add user id to post variables to be saved with entry
             $_POST['frm_user_id'] = $value;
         } else {
             if ($field->type == 'time' && is_array($value)) {
                 $value = $value['H'] . ':' . $value['m'] . (isset($value['A']) ? ' ' . $value['A'] : '');
                 FrmEntriesHelper::set_posted_value($field, $value, $args);
             }
         }
     }
     // don't validate if going backwards
     if (FrmProFormsHelper::going_to_prev($field->form_id)) {
         return array();
     }
     // clear any existing errors if draft
     if (FrmProFormsHelper::saving_draft() && isset($errors['field' . $field->temp_id])) {
         unset($errors['field' . $field->temp_id]);
     }
     self::validate_file_upload($errors, $field, $args);
     // if saving draft, only check file type since it won't be checked later
     // and confirmation field since the confirmation field value is not saved
     if (FrmProFormsHelper::saving_draft()) {
         //Check confirmation field if saving a draft
         self::validate_confirmation_field($errors, $field, $value, $args);
         return $errors;
     }
     self::validate_no_input_fields($errors, $field);
     if (empty($args['parent_field_id']) && !isset($_POST['item_meta'][$field->id])) {
         return $errors;
     }
     if (($field->type != 'tag' && $value == 0 || $field->type == 'tag' && $value == '') && isset($field->field_options['post_field']) && $field->field_options['post_field'] == 'post_category' && $field->required == '1') {
         $frm_settings = FrmAppHelper::get_settings();
         $errors['field' . $field->temp_id] = !isset($field->field_options['blank']) || $field->field_options['blank'] == '' || $field->field_options['blank'] == 'Untitled cannot be blank' ? $frm_settings->blank_msg : $field->field_options['blank'];
     }
     //Don't require fields hidden with shortcode fields="25,26,27"
     global $frm_vars;
     if (self::is_field_hidden_by_shortcode($field, $errors)) {
         unset($errors['field' . $field->temp_id]);
         $value = '';
     }
     //Don't require a conditionally hidden field
     self::validate_conditional_field($errors, $field, $value);
     //Don't require a field hidden in a conditional page or section heading
     self::validate_child_conditional_field($errors, $field, $value);
     //make sure the [auto_id] is still unique
     self::validate_auto_id($field, $value);
     //check uniqueness
     self::validate_unique_field($errors, $field, $value);
     self::set_post_fields($field, $value, $errors);
     if (!FrmProFieldsHelper::is_field_visible_to_user($field)) {
         //don't validate admin only fields that can't be seen
         unset($errors['field' . $field->temp_id]);
         FrmEntriesHelper::set_posted_value($field, $value, $args);
         return $errors;
     }
     self::validate_confirmation_field($errors, $field, $value, $args);
     //Don't validate the format if field is blank
     if (FrmAppHelper::is_empty_value($value)) {
         FrmEntriesHelper::set_posted_value($field, $value, $args);
         return $errors;
     }
     if (!is_array($value)) {
         $value = trim($value);
     }
     $validate_fields = array('number', 'phone', 'date');
     if (in_array($field->type, $validate_fields)) {
         $function = 'validate_' . $field->type . '_field';
         self::$function($errors, $field, $value);
     }
     FrmEntriesHelper::set_posted_value($field, $value, $args);
     return $errors;
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:87,代码来源:FrmProEntryMeta.php

示例6: convert_db_cols

 /**
  * Make sure values are in the format they should be saved in
  */
 private static function convert_db_cols(&$values, $data, $entry_key)
 {
     if (!isset($values['item_key']) || empty($values['item_key'])) {
         $values['item_key'] = $data[$entry_key];
     }
     if (isset($values['user_id'])) {
         $values['user_id'] = FrmAppHelper::get_user_id_param($values['user_id']);
     }
     if (isset($values['updated_by'])) {
         $values['updated_by'] = FrmAppHelper::get_user_id_param($values['updated_by']);
     }
     if (isset($values['is_draft'])) {
         $values['is_draft'] = (int) $values['is_draft'];
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:18,代码来源:FrmProXMLHelper.php

示例7: stats_shortcode

 /**
  * Returns stats requested through the [frm-stats] shortcode
  *
  * @param array $atts
  */
 public static function stats_shortcode($atts)
 {
     $defaults = array('id' => false, 'type' => 'total', 'user_id' => false, 'value' => false, 'round' => 100, 'limit' => '', 'drafts' => false);
     $sc_atts = shortcode_atts($defaults, $atts);
     // Combine arrays - DO NOT use array_merge here because numeric keys are renumbered
     $atts = (array) $atts + (array) $sc_atts;
     if (!$atts['id']) {
         return;
     }
     $atts['user_id'] = FrmAppHelper::get_user_id_param($atts['user_id']);
     $new_atts = $atts;
     foreach ($defaults as $unset => $val) {
         unset($new_atts[$unset]);
     }
     return FrmProFieldsHelper::get_field_stats($atts['id'], $atts['type'], $atts['user_id'], $atts['value'], $atts['round'], $atts['limit'], $new_atts, $atts['drafts']);
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:21,代码来源:FrmProStatisticsController.php

示例8: get_display_data


//.........这里部分代码省略.........
     } else {
         $is_draft = 'both';
     }
     if ($entry && $entry->form_id == $display->frm_form_id) {
         $form_query['id'] = $entry->id;
     }
     $form_posts = FrmDb::get_results('frm_items', $form_query, 'id, post_id');
     unset($form_query);
     $getting_entries = !$entry || !$post || empty($extra_atts['auto_id']);
     $check_filter_opts = !empty($display->frm_where) && $getting_entries;
     if ($entry && $entry->form_id == $display->frm_form_id) {
         $entry_ids = array($entry->id);
         // Filter by this entry ID to make query faster
         $use_ids = true;
     } else {
         if ($check_filter_opts || isset($_GET['frm_search'])) {
             //Only get $entry_ids if filters are set or if frm_search parameter is set
             $entry_query = array('form_id' => $display->frm_form_id);
             if ($extra_atts['drafts'] != 'both') {
                 $entry_query['is_draft'] = $is_draft;
             }
             $entry_ids = FrmDb::get_col('frm_items', $entry_query);
             unset($entry_query);
         }
     }
     $empty_msg = isset($display->frm_empty_msg) && !empty($display->frm_empty_msg) ? '<div class="frm_no_entries">' . FrmProFieldsHelper::get_default_value($display->frm_empty_msg, false) . '</div>' : '';
     if (isset($message)) {
         // if an entry was deleted above, show a message
         $empty_msg = $message . $empty_msg;
     }
     $after_where = false;
     $user_id = $extra_atts['user_id'];
     if (!empty($user_id)) {
         $user_id = FrmAppHelper::get_user_id_param($user_id);
         $uid_used = false;
     }
     self::add_group_by_filter($display, $getting_entries);
     unset($getting_entries);
     if ($check_filter_opts) {
         $display->frm_where = apply_filters('frm_custom_where_opt', $display->frm_where, array('display' => $display, 'entry' => $entry));
         $continue = false;
         foreach ($display->frm_where as $where_key => $where_opt) {
             $where_val = isset($display->frm_where_val[$where_key]) ? $display->frm_where_val[$where_key] : '';
             if (preg_match("/\\[(get|get-(.?))\\b(.*?)(?:(\\/))?\\]/s", $where_val)) {
                 $where_val = FrmProFieldsHelper::get_default_value($where_val, false, true, true);
                 //if this param doesn't exist, then don't include it
                 if ($where_val == '') {
                     if (!$after_where) {
                         $continue = true;
                     }
                     continue;
                 }
             } else {
                 $where_val = FrmProFieldsHelper::get_default_value($where_val, false, true, true);
             }
             $continue = false;
             if ($where_val == 'current_user') {
                 if ($user_id && is_numeric($user_id)) {
                     $where_val = $user_id;
                     $uid_used = true;
                 } else {
                     $where_val = get_current_user_id();
                 }
             } else {
                 if (!is_array($where_val)) {
                     $where_val = do_shortcode($where_val);
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:67,代码来源:FrmProDisplaysController.php


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