本文整理汇总了PHP中ninja_forms_get_field_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP ninja_forms_get_field_by_id函数的具体用法?PHP ninja_forms_get_field_by_id怎么用?PHP ninja_forms_get_field_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ninja_forms_get_field_by_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ninja_forms_filter_restore_progress
function ninja_forms_filter_restore_progress($data, $field_id)
{
global $ninja_forms_processing, $ninja_forms_fields;
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
if (isset($ninja_forms_fields[$field_type]['esc_html'])) {
$esc_html = $ninja_forms_fields[$field_type]['esc_html'];
} else {
$esc_html = true;
}
if (is_object($ninja_forms_processing)) {
$clear_form = $ninja_forms_processing->get_form_setting('clear_complete');
$process_complete = $ninja_forms_processing->get_form_setting('processing_complete');
if ($process_complete != 1 or $process_complete == 1 and $clear_form != 1) {
if ($ninja_forms_processing->get_field_value($field_id) !== false) {
if ($esc_html) {
if (is_array($ninja_forms_processing->get_field_value($field_id))) {
$default_value = ninja_forms_esc_html_deep($ninja_forms_processing->get_field_value($field_id));
} else {
$default_value = esc_html($ninja_forms_processing->get_field_value($field_id));
}
} else {
$default_value = $ninja_forms_processing->get_field_value($field_id);
}
$data['default_value'] = $default_value;
}
}
}
return $data;
}
示例2: ninja_forms_display_field_type
function ninja_forms_display_field_type($field_id, $data)
{
global $ninja_forms_loading, $ninja_forms_processing;
$field = ninja_forms_get_field_by_id($field_id);
$form_id = $field['form_id'];
if (isset($ninja_forms_loading) && $ninja_forms_loading->get_form_ID() == $form_id) {
$field_row = $ninja_forms_loading->get_field_settings($field_id);
} else {
if (isset($ninja_forms_processing) && $ninja_forms_processing->get_form_ID() == $form_id) {
$field_row = $ninja_forms_processing->get_field_settings($field_id);
}
}
$field_type = $field_row['type'];
if (strpos($field_type, '_') === 0) {
$field_type = substr($field_type, 1);
}
$field_type = apply_filters('ninja_forms_display_field_type', $field_type, $field_id);
?>
<input type="hidden" id="ninja_forms_field_<?php
echo $field_id;
?>
_type" value="<?php
echo $field_type;
?>
">
<?php
}
示例3: ninja_forms_display_label_inside
function ninja_forms_display_label_inside($data, $field_id)
{
global $ninja_forms_processing;
if (is_object($ninja_forms_processing)) {
$field_row = $ninja_forms_processing->get_field_settings($field_id);
} else {
$field_row = ninja_forms_get_field_by_id($field_id);
}
$field_data = $field_row['data'];
if (isset($field_data['label_pos'])) {
$label_pos = $field_data['label_pos'];
} else {
$label_pos = '';
}
if (isset($field_data['label'])) {
$label = $field_data['label'];
} else {
$label = '';
}
if ($field_row['type'] != '_list') {
if ($label_pos == 'inside') {
$data['default_value'] = $label;
}
}
return $data;
}
示例4: ninja_forms_user_info_fields_groups
function ninja_forms_user_info_fields_groups($field_id, $field_data)
{
global $ninja_forms_fields;
$field = ninja_forms_get_field_by_id($field_id);
$field_type = $field['type'];
$default_user_info = 0;
if (isset($ninja_forms_fields[$field_type]['edit_options']) and is_array($ninja_forms_fields[$field_type]['edit_options'])) {
foreach ($ninja_forms_fields[$field_type]['edit_options'] as $option) {
if (isset($option['name']) and $option['name'] == 'user_info_field_group' and isset($option['default'])) {
$default_user_info = $option['default'];
break;
}
}
}
if (isset($field_data['user_info_field_group']) and $field_data['user_info_field_group'] == 1 or (!isset($field_data['user_info_field_group']) or $field_data['user_info_field_group'] !== 0) and $default_user_info == 1) {
$options = array(array('name' => '- ' . __('None', 'ninja-forms'), 'value' => ''), array('name' => __('Billing', 'ninja-forms'), 'value' => 'billing'), array('name' => __('Shipping', 'ninja-forms'), 'value' => 'shipping'), array('name' => __('Custom', 'ninja-forms') . ' ->', 'value' => 'custom'));
if (isset($field_data['user_info_field_group_name'])) {
$group_name = $field_data['user_info_field_group_name'];
} else {
$group_name = '';
}
if (isset($field_data['user_info_field_group_custom'])) {
$group_custom = $field_data['user_info_field_group_custom'];
} else {
$group_custom = '';
}
if ($group_name == 'custom') {
$custom_class = '';
} else {
$custom_class = 'hidden';
}
ninja_forms_edit_field_el_output($field_id, 'select', __('User Info Field Group', 'ninja-forms'), 'user_info_field_group_name', $group_name, 'thin', $options, 'user-info-group-name widefat');
ninja_forms_edit_field_el_output($field_id, 'text', __('Custom Field Group', 'ninja-forms'), 'user_info_field_group_custom', $group_custom, 'thin', '', 'user-info-custom-group widefat ' . $custom_class, '', $custom_class);
}
}
示例5: ninja_forms_post_excerpt_pre_process
function ninja_forms_post_excerpt_pre_process()
{
global $ninja_forms_processing;
$post_excerpt = $ninja_forms_processing->get_form_setting('post_excerpt');
if ($post_excerpt != '') {
//Loop through each submitted form field and replace any instances of [label].
if ($ninja_forms_processing->get_all_fields()) {
foreach ($ninja_forms_processing->get_all_fields() as $key => $val) {
$field_row = ninja_forms_get_field_by_id($key);
$data = $field_row['data'];
$label = $data['label'];
$value = '';
if (is_array($val) and !empty($val)) {
$x = 0;
foreach ($val as $v) {
if (!is_array($v)) {
$value .= $v;
if ($x != count($val)) {
$value .= ',';
}
}
$x++;
}
} else {
$value = $val;
}
$post_excerpt = str_replace('[' . $label . ']', $value, $post_excerpt);
}
}
}
$ninja_forms_processing->update_form_setting('post_excerpt', $post_excerpt);
}
示例6: nf_edit_field_sub_settings
function nf_edit_field_sub_settings($field_id)
{
global $ninja_forms_fields;
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
if ($ninja_forms_fields[$field_type]['process_field']) {
if (isset($field_row['data']['admin_label'])) {
$admin_label = $field_row['data']['admin_label'];
} else {
$admin_label = '';
}
if (isset($field_row['data']['num_sort'])) {
$num_sort = $field_row['data']['num_sort'];
} else {
$num_sort = '';
}
?>
<div class="description description-wide">
<hr>
<h5><?php
_e('Submission Settings', 'ninja-forms');
?>
</h5>
<?php
ninja_forms_edit_field_el_output($field_id, 'text', __('Admin Label', 'ninja-forms'), 'admin_label', $admin_label, 'wide', '', 'widefat code', __('This is the label used when viewing/editing/exporting submissions.', 'ninja-forms'));
ninja_forms_edit_field_el_output($field_id, 'checkbox', __('Sort as numeric', 'ninja-forms'), 'num_sort', $num_sort, 'wide', '', '', __('If this box is checked, this column in the submissions table will sort by number.', 'ninja-forms'));
}
}
示例7: ninja_forms_edit_field_input_limit
/**
* Function that adds a character and word limit option to textboxes and textareas.
*
* @since 2.4.3
* @return void
*/
function ninja_forms_edit_field_input_limit($field_id, $field_data)
{
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$allowed_types = apply_filters('nf_input_limit_types', array('_text', '_textarea'));
if (!in_array($field_type, $allowed_types)) {
return false;
}
if (isset($field_data['input_limit'])) {
$input_limit = $field_data['input_limit'];
} else {
$input_limit = '';
}
if (isset($field_data['input_limit_type'])) {
$input_limit_type = $field_data['input_limit_type'];
} else {
$input_limit_type = '';
}
if (isset($field_data['input_limit_msg'])) {
$input_limit_msg = $field_data['input_limit_msg'];
} else {
$input_limit_msg = '';
}
$desc = '<em>' . __('If you leave the box empty, no limit will be used', 'ninja-forms') . '</em>';
ninja_forms_edit_field_el_output($field_id, 'text', __('Limit input to this number', 'ninja-forms'), 'input_limit', $input_limit, 'thin', '', 'widefat', $desc);
ninja_forms_edit_field_el_output($field_id, 'select', __('of', 'ninja-forms'), 'input_limit_type', $input_limit_type, 'thin', array(array('name' => __('Characters', 'ninja-forms'), 'value' => 'char'), array('name' => __('Words', 'ninja-forms'), 'value' => 'word')), 'widefat');
echo '<p class="description description-wide"> </p>';
ninja_forms_edit_field_el_output($field_id, 'text', __('Text to appear after character/word counter', 'ninja-forms'), 'input_limit_msg', $input_limit_msg, 'wide', '', 'widefat');
}
示例8: ninja_forms_edit_field_input_limit
/**
* Function that adds a character and word limit option to textboxes and textareas.
*
* @since 2.4.3
* @return void
*/
function ninja_forms_edit_field_input_limit($field_id)
{
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$allowed_types = apply_filters('nf_input_limit_types', array('_text', '_textarea'));
if (!in_array($field_type, $allowed_types)) {
return false;
}
$field_data = $field_row['data'];
if (isset($field_data['input_limit'])) {
$input_limit = $field_data['input_limit'];
} else {
$input_limit = '';
}
if (isset($field_data['input_limit_type'])) {
$input_limit_type = $field_data['input_limit_type'];
} else {
$input_limit_type = '';
}
if (isset($field_data['input_limit_msg'])) {
$input_limit_msg = $field_data['input_limit_msg'];
} else {
$input_limit_msg = '';
}
$desc = __('If you want to limit the number of characters or words that your user can input, set the number and type of limit you want to enforce below.', 'ninja-forms');
ninja_forms_edit_field_el_output($field_id, 'desc', $desc);
$desc = '<em>' . __('If you leave the box empty, no limit will be used', 'ninja-forms') . '</em>';
ninja_forms_edit_field_el_output($field_id, 'desc', $desc);
ninja_forms_edit_field_el_output($field_id, 'text', __('Limit input to this number', 'ninja-forms'), 'input_limit', $input_limit, 'thin', '', 'widefat', '');
ninja_forms_edit_field_el_output($field_id, 'select', __('of', 'ninja-forms'), 'input_limit_type', $input_limit_type, 'thin', array(array('name' => __('Characters', 'ninja-forms'), 'value' => 'char'), array('name' => __('Words', 'ninja-forms'), 'value' => 'word')), 'widefat');
ninja_forms_edit_field_el_output($field_id, 'text', __('Text to appear after character/word counter', 'ninja-forms'), 'input_limit_msg', $input_limit_msg, 'wide', '', 'widefat');
}
示例9: ninja_forms_field_desc_pre_process
function ninja_forms_field_desc_pre_process($field_id, $user_value)
{
global $ninja_forms_processing;
$field = ninja_forms_get_field_by_id($field_id);
$default_value = $field['data']['default_value'];
$ninja_forms_processing->update_field_value($field_id, $default_value);
}
示例10: nf_edit_field_admin_label
function nf_edit_field_admin_label($field_id, $field_data)
{
global $ninja_forms_fields;
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
if ($ninja_forms_fields[$field_type]['process_field']) {
if (isset($field_data['admin_label'])) {
$admin_label = $field_data['admin_label'];
} else {
$admin_label = '';
}
if (isset($field_data['num_sort'])) {
$num_sort = $field_data['num_sort'];
} else {
$num_sort = '';
}
?>
<div class="description description-wide">
<?php
ninja_forms_edit_field_el_output($field_id, 'text', __('Admin Label', 'ninja-forms'), 'admin_label', $admin_label, 'wide', '', 'widefat code', __('This is the label used when viewing/editing/exporting submissions.', 'ninja-forms'));
?>
</div>
<?php
}
}
示例11: ninja_forms_edit_field_list_term
function ninja_forms_edit_field_list_term($field_id)
{
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$field_data = $field_row['data'];
if (isset($field_data['populate_term'])) {
$populate_term = $field_data['populate_term'];
} else {
$populate_term = '';
}
$form_row = ninja_forms_get_form_by_field_id($field_id);
if (isset($form_row['data']['post_type'])) {
$post_type = $form_row['data']['post_type'];
} else {
$post_type = '';
}
if ($field_type == '_list' and $post_type != '') {
?>
<div>
<label>
<?php
_e('Populate this with the term: ', 'ninja-forms-post-creation');
?>
<select name="ninja_forms_field_<?php
echo $field_id;
?>
[populate_term]">
<option value=""><?php
_e('- None', 'ninja-forms-post-creation');
?>
</option>
<?php
// Get a list of terms registered to the post type set above and loop through them.
foreach (get_object_taxonomies($post_type) as $tax_name) {
if ($tax_name != 'post_tag' and $tax_name != 'post_status') {
$tax = get_taxonomy($tax_name);
?>
<option value="<?php
echo $tax_name;
?>
" <?php
selected($populate_term, $tax_name);
?>
><?php
echo $tax->labels->name;
?>
</option>
<?php
}
}
?>
</select>
</div>
<?php
}
}
示例12: nf_edit_field_req
function nf_edit_field_req($field_id, $field_data)
{
global $ninja_forms_fields;
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$reg_field = $ninja_forms_fields[$field_type];
$field_req = $reg_field['req'];
if ($field_req) {
ninja_forms_edit_field_el_output($field_id, 'hidden', '', 'req', 1);
}
}
示例13: ninja_forms_edit_field_hr
function ninja_forms_edit_field_hr($field_id)
{
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$field_data = $field_row['data'];
?>
<p class="description-wide">
<hr>
</p>
<?php
}
示例14: nf_field_autocomplete_off
function nf_field_autocomplete_off($field_id, $field_data)
{
global $ninja_forms_fields;
$field_row = ninja_forms_get_field_by_id($field_id);
$field_type = $field_row['type'];
$reg_field = $ninja_forms_fields[$field_type];
$edit_autocomplete_off = $reg_field['edit_autocomplete_off'];
if ($edit_autocomplete_off) {
$autocomplete_off = isset($field_data['autocomplete_off']) ? $field_data['autocomplete_off'] : 0;
ninja_forms_edit_field_el_output($field_id, 'checkbox', __('Disable Browser Autocomplete', 'ninja-forms'), 'autocomplete_off', $autocomplete_off, 'wide');
}
}
示例15: __construct
/**
* Get things started
*
* @access public
* @since 2.7
* @return void/
*/
public function __construct($sub_id)
{
global $ninja_forms_fields;
// Bail if the sub doesn't exist.
$sub = get_post($sub_id);
if (!is_object($sub)) {
return false;
}
// Set our sub id
$this->sub_id = $sub_id;
// Setup our fields and meta vars.
$post_meta = get_post_custom($this->sub_id);
$this->fields = array();
foreach ($post_meta as $key => $array) {
if (is_serialized($array[0])) {
$meta_value = unserialize($array[0]);
} else {
$meta_value = $array[0];
}
if (strpos($key, '_field_') !== false) {
$field_id = str_replace('_field_', '', $key);
$field = ninja_forms_get_field_by_id($field_id);
$field_type = $field['type'];
// Check to see if our field type has been set as a "process_field".
if (isset($ninja_forms_fields[$field_type])) {
$reg_field = $ninja_forms_fields[$field_type];
$process_field = $reg_field['process_field'];
} else {
$process_field = false;
}
if ($process_field) {
$this->fields[$field_id] = $meta_value;
}
} else {
if ($key != '_form_id' && $key != '_action') {
$this->meta[$key] = $meta_value;
}
}
}
// Setup our form id var
$this->form_id = $this->get_meta('_form_id');
// Setup our action var
$this->action = $this->get_meta('_action');
// Setup our sequential id
$this->seq_num = $this->get_meta('_seq_num');
// Setup our user_id var
$this->user_id = $sub->post_author;
// Setup our date submitted var
$this->date_submitted = get_the_time('Y-m-d G:i:s', $sub_id);
// Setup our date modified var
$this->date_modified = get_post_modified_time('Y-m-d G:i:s', false, $sub_id);
}