bp_profile_search_escaped_form_data (美元的形式=假)
逃离BuddyBoss Profile搜索表单数据。
描述
源
文件:bp-core /概要搜索/ bps-form.php
函数bp_profile_search_escaped_form_data($ form = false){if(空($ form)){$ form = bp_profile_search_main_form();$ location ='目录';$ meta = bp_ps_meta($表格);$字段= bp_ps_parse_request(bp_ps_get_request('form',$ form));wp_register_script('bp-ps-templic-form',buddypress() - > plugin_url。'bp-core / profile-search / bp-ps-template.js',array(),bp_get_version());wp_enqueue_script('bp-ps-templic-form');$ f = new stdclass;$ f-> id = $表格;$ f-> title = get_the_title($表格);$ f->位置= $ location; $F->unique_id = bp_ps_unique_id ('form_'. $form); $F->page = parse_url ($_SERVER['REQUEST_URI'], PHP_URL_PATH); $F->action = parse_url ( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); if (defined ('DOING_AJAX')) $F->action = parse_url ($_SERVER['HTTP_REFERER'], PHP_URL_PATH); $F->method = 'POST'; $F->fields = array (); foreach ( $meta['field_code'] as $k => $code ) { if (empty ($fields[$code])) continue; $f = $fields[$code]; $mode = $meta['field_mode'][$k]; if ( !bp_ps_Fields::set_display ($f, $mode)) continue; $f->label = $f->name; $custom_label = $meta['field_label'][$k]; if (!empty ($custom_label)) { $f->label = $custom_label; $F->fields[] = bp_ps_set_hidden_field ($f->code. '_label', $f->label); } $custom_desc = $meta['field_desc'][$k]; if ($custom_desc == '-') $f->description = ''; else if (!empty ($custom_desc)) $f->description = $custom_desc; else $f->description = ''; switch ($f->display) { case 'range': case 'range-select': if (!isset ($f->value['min'])) $f->value['min'] = ''; if (!isset ($f->value['max'])) $f->value['max'] = ''; $f->min = $f->value['min']; $f->max = $f->value['max']; break; case 'date_range': if (!isset ($f->value['min'])) $f->value['min'] = array( 'day' => '', 'month' => '', 'year' => '' ); if (!isset ($f->value['max'])) $f->value['max'] = array( 'day' => '', 'month' => '', 'year' => '' ); $f->min = $f->value['min']; $f->max = $f->value['max']; break; case 'textbox': case 'number': if (!isset ($f->value)) $f->value = ''; break; case 'distance': if (!isset ($f->value['location'])) $f->value['distance'] = $f->value['units'] = $f->value['location'] = $f->value['lat'] = $f->value['lng'] = ''; wp_enqueue_script ($f->script_handle); wp_enqueue_script ('bp-ps-template'); break; case 'selectbox': if (!isset ($f->value)) $f->value = ''; $f->options = array ('' => '') + $f->options; break; case 'radio': if (!isset ($f->value)) $f->value = ''; wp_enqueue_script ('bp-ps-template'); break; case 'multiselectbox': case 'checkbox': if (!isset ($f->value)) $f->value = ''; break; } $f->values = (array)$f->value; $f->html_name = ($mode == '')? $f->code: $f->code. '_'. $mode; $f->unique_id = bp_ps_unique_id ($f->html_name); $f->mode = $mode; $f->full_label = bp_ps_full_label ($f); /** * @todo add title/description * * @since BuddyBoss 1.0.0 */ do_action ('bp_ps_field_before_search_form', $f); $f->code = ($mode == '')? $f->code: $f->code. '_'. $mode; // to be removed $F->fields[] = $f; } $F->fields[] = bp_ps_set_hidden_field ( BP_PS_FORM, $form); /** * @todo add title/description * * @since BuddyBoss 1.0.0 */ do_action ('bp_ps_before_search_form', $F); foreach ($F->fields as $f) { if (!is_array ($f->value)) $f->value = esc_attr (stripslashes ($f->value)); if ($f->display == 'hidden') continue; $f->label = esc_attr ($f->label); $f->description = esc_attr ($f->description); foreach ( $f->values as $k => $value ) { if ( is_array( $value ) ) { foreach( $value as $sub_k => $sub_value ) { $f->values[ $k ][ $sub_k ] = esc_attr( stripslashes( $sub_value ) ); } } else { $f->values[ $k ] = esc_attr( stripslashes( $value ) ); } } $options = array (); foreach ($f->options as $key => $label) $options[esc_attr ($key)] = esc_attr ($label); $f->options = $options; } return $F; }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.0.0 | 介绍了。 |