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


PHP ninja_forms_update_field函数代码示例

本文整理汇总了PHP中ninja_forms_update_field函数的典型用法代码示例。如果您正苦于以下问题:PHP ninja_forms_update_field函数的具体用法?PHP ninja_forms_update_field怎么用?PHP ninja_forms_update_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ninja_forms_replyto_change

function ninja_forms_replyto_change()
{
    $plugin_settings = nf_get_settings();
    if (!isset($plugin_settings['fix_field_reply_to']) or $plugin_settings['fix_field_reply_to'] != 1) {
        $fields = ninja_forms_get_all_fields();
        foreach ($fields as $field) {
            if ($field['type'] = '_text') {
                $change_required = false;
                if (isset($field['data']['from_email']) and $field['data']['from_email'] == 1) {
                    $field['data']['replyto_email'] = 1;
                    unset($field['data']['from_email']);
                    $change_required = true;
                } elseif (isset($field['data']['from_email']) and $field['data']['from_email'] == 0) {
                    $field['data']['replyto_email'] = 0;
                    unset($field['data']['from_email']);
                    $change_required = true;
                }
                if ($change_required) {
                    $data = serialize($field['data']);
                    $args = array('update_array' => array('data' => $data), 'where' => array('id' => $field['id']));
                    ninja_forms_update_field($args);
                }
            }
        }
        $plugin_settings['fix_field_reply_to'] = 1;
        update_option('ninja_forms_settings', $plugin_settings);
    }
}
开发者ID:serker72,项目名称:T3S,代码行数:28,代码来源:reply-to-check.php

示例2: ninja_forms_conditionals_after_import_form

function ninja_forms_conditionals_after_import_form($form)
{
    global $wpdb;
    if (is_array($form['field']) and !empty($form['field'])) {
        $field_rows = ninja_forms_get_fields_by_form_id($form['id']);
        if (is_array($field_rows) and !empty($field_rows)) {
            for ($y = 0; $y < count($field_rows); $y++) {
                if (isset($field_rows[$y]['data']['conditional']) and is_array($field_rows[$y]['data']['conditional'])) {
                    for ($i = 0; $i < count($field_rows[$y]['data']['conditional']); $i++) {
                        if (isset($field_rows[$y]['data']['conditional'][$i]['cr']) and is_array($field_rows[$y]['data']['conditional'][$i]['cr'])) {
                            for ($n = 0; $n < count($field_rows[$y]['data']['conditional'][$i]['cr']); $n++) {
                                foreach ($form['field'] as $inserted_field) {
                                    if ($inserted_field['old_id'] == $field_rows[$y]['data']['conditional'][$i]['cr'][$n]['field']) {
                                        $field_rows[$y]['data']['conditional'][$i]['cr'][$n]['field'] = $inserted_field['id'];
                                    }
                                }
                            }
                        }
                    }
                }
                $field_rows[$y]['data'] = serialize($field_rows[$y]['data']);
                $args = array('update_array' => array('data' => $field_rows[$y]['data']), 'where' => array('id' => $field_rows[$y]['id']));
                ninja_forms_update_field($args);
            }
        }
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:27,代码来源:after-import.php

示例3: nf_cl_mp_copy_page

/**
 * Hook into our copy page multi-part form action.
 * Change any old ids to their new ones.
 *
 */
function nf_cl_mp_copy_page($new_fields)
{
    foreach ($new_fields as $old_field => $new_field) {
        $field = ninja_forms_get_field_by_id($new_field);
        if (isset($field['data']['conditional'])) {
            for ($x = 0; $x < count($field['data']['conditional']); $x++) {
                if (isset($field['data']['conditional'][$x]['cr'])) {
                    for ($y = 0; $y < count($field['data']['conditional'][$x]['cr']); $y++) {
                        if (isset($field['data']['conditional'][$x]['cr'][$y]['field'])) {
                            $current_id = $field['data']['conditional'][$x]['cr'][$y]['field'];
                            if (isset($new_fields[$current_id])) {
                                $field['data']['conditional'][$x]['cr'][$y]['field'] = $new_fields[$current_id];
                            }
                        }
                    }
                }
            }
        }
        $field['data'] = serialize($field['data']);
        $args = array('update_array' => array('data' => $field['data']), 'where' => array('id' => $new_field));
        ninja_forms_update_field($args);
    }
}
开发者ID:seancho0420,项目名称:globalink,代码行数:28,代码来源:mp-copy-page.php

示例4: nf_output_registered_field_settings

function nf_output_registered_field_settings($field_id, $data = array())
{
    global $ninja_forms_fields, $nf_rte_editors;
    $field_row = ninja_forms_get_field_by_id($field_id);
    $field_type = $field_row['type'];
    $field_data = empty($data) ? $field_row['data'] : $data;
    $current_tab = ninja_forms_get_current_tab();
    if (isset($_REQUEST['page'])) {
        $current_page = esc_html($_REQUEST['page']);
    } else {
        $current_page = '';
    }
    $reg_field = $ninja_forms_fields[$field_type];
    $type_name = $reg_field['name'];
    $edit_function = $reg_field['edit_function'];
    $edit_options = $reg_field['edit_options'];
    $edit_settings = $reg_field['edit_settings'];
    if ($reg_field['nesting']) {
        $nesting_class = 'ninja-forms-nest';
    } else {
        $nesting_class = 'ninja-forms-no-nest';
    }
    $conditional = $reg_field['conditional'];
    if (isset($field_row['fav_id']) && $field_row['fav_id'] != 0) {
        $fav_id = $field_row['fav_id'];
        $fav_row = ninja_forms_get_fav_by_id($fav_id);
        if (empty($fav_row['name'])) {
            $args = array('update_array' => array('fav_id' => ''), 'where' => array('id' => $field_id));
            ninja_forms_update_field($args);
            $fav_id = '';
        }
    } else {
        $fav_id = '';
    }
    if (isset($field_row['def_id']) && $field_row['def_id'] != 0) {
        $def_id = $field_row['def_id'];
    } else {
        $def_id = '';
    }
    if ($fav_id != 0 && $fav_id != '') {
        $fav_row = ninja_forms_get_fav_by_id($fav_id);
        if (!empty($fav_row['name'])) {
            $fav_class = 'ninja-forms-field-remove-fav';
            $type_name = $fav_row['name'];
            $icon_class = 'filled';
        }
    } else {
        $fav_class = 'ninja-forms-field-add-fav';
        $icon_class = 'empty';
    }
    if ($reg_field['show_field_id'] || $reg_field['show_fav']) {
        ?>
		<table id="field-info">
			<tr>
				<?php 
        if ($reg_field['show_field_id']) {
            ?>
					<td width="65%"><?php 
            _e('Field ID', 'ninja-forms');
            ?>
: <strong><?php 
            echo $field_id;
            ?>
</strong></td>
					<?php 
        }
        ?>
				<!-- <td width="15%"><a href="#" class="ninja-forms-field-add-def" id="ninja_forms_field_<?php 
        echo $field_id;
        ?>
_def" class="ninja-forms-field-add-def">Add Defined</a></td><td width="15%"><a href="#" class="ninja-forms-field-remove-def" id="ninja_forms_field_<?php 
        echo $field_id;
        ?>
_def">Remove Defined</a></td> -->
				<?php 
        if ($reg_field['show_fav']) {
            ?>
					<td width="5%"><a href="#" class="<?php 
            echo $fav_class;
            ?>
" id="ninja_forms_field_<?php 
            echo $field_id;
            ?>
_fav"><span class="dashicons dashicons-star-<?php 
            echo $icon_class;
            ?>
"></span></a></td>
					<?php 
        }
        ?>
			</tr>
		</table>
		<?php 
    }
    do_action('ninja_forms_edit_field_before_registered', $field_id, $field_data);
    $arguments = array('field_id' => $field_id, 'data' => $field_data);
    if ($edit_function != '') {
        call_user_func_array($edit_function, $arguments);
    }
    /**
//.........这里部分代码省略.........
开发者ID:ramiy,项目名称:ninja-forms,代码行数:101,代码来源:li.php

示例5: step

 public function step($step)
 {
     global $ninja_forms_fields;
     // Get our form ID
     $form_id = $this->args['forms'][$step];
     // Bail if we've already converted the notifications for this form.
     if (in_array($form_id, $this->completed_forms)) {
         return false;
     }
     // Grab our form from the database
     $form_settings = Ninja_Forms()->form($form_id)->settings;
     $fields = Ninja_Forms()->form($form_id)->fields;
     $process_fields = array();
     foreach ($fields as $field_id => $field) {
         $label = strip_tags(nf_get_field_admin_label($field_id));
         if (strlen($label) > 30) {
             $tmp_label = substr($label, 0, 30);
         } else {
             $tmp_label = $label;
         }
         $tmp_array = array('value' => $field_id, 'label' => $tmp_label . ' - ID: ' . $field_id);
         $admin_label = $label;
         $label = isset($field['data']['label']) ? $field['data']['label'] : '';
         // Check to see if this field is supposed to be "processed"
         $type = $field['type'];
         if (isset($ninja_forms_fields[$type]['process_field']) && $ninja_forms_fields[$type]['process_field']) {
             $process_fields[$field_id] = array('field_id' => $field_id, 'label' => $label, 'admin_label' => $admin_label);
         }
     }
     // Create a notification for our admin email
     if (isset($form_settings['admin_email_msg']) && !empty($form_settings['admin_email_msg']) || isset($form_settings['admin_email_fields']) && 1 == $form_settings['admin_email_fields']) {
         // Create a notification
         $n_id = nf_insert_notification($form_id);
         // Update our notification type
         nf_update_object_meta($n_id, 'type', 'email');
         // Activate our notification
         Ninja_Forms()->notification($n_id)->activate();
         // Update our notification name
         Ninja_Forms()->notification($n_id)->update_setting('name', __('Admin Email', 'ninja-forms'));
         $admin_mailto = isset($form_settings['admin_mailto']) ? $form_settings['admin_mailto'] : array();
         // Implode our admin email addresses
         $to = implode('`', $admin_mailto);
         // Update our to setting
         Ninja_Forms()->notification($n_id)->update_setting('to', $to);
         // Update our Format Setting
         Ninja_Forms()->notification($n_id)->update_setting('email_format', $form_settings['email_type']);
         // Update our attach csv option
         Ninja_Forms()->notification($n_id)->update_setting('attach_csv', $form_settings['admin_attach_csv']);
         // Update our subject
         $subject = $this->replace_shortcodes($form_settings['admin_subject']);
         Ninja_Forms()->notification($n_id)->update_setting('email_subject', $subject);
         // Update our From Name
         if (isset($form_settings['email_from_name'])) {
             Ninja_Forms()->notification($n_id)->update_setting('from_name', $form_settings['email_from_name']);
         }
         foreach ($fields as $field) {
             if (isset($field['data']['from_name']) && $field['data']['from_name'] == 1) {
                 // Update our From Name
                 Ninja_Forms()->notification($n_id)->update_setting('from_name', 'field_' . $field['id']);
                 break;
             }
         }
         // Update our From Address
         Ninja_Forms()->notification($n_id)->update_setting('from_address', $form_settings['email_from']);
         // Get our reply-to address
         foreach ($fields as $field) {
             if (isset($field['data']['replyto_email']) && $field['data']['replyto_email'] == 1) {
                 Ninja_Forms()->notification($n_id)->update_setting('reply_to', 'field_' . $field['id']);
                 break;
             }
         }
         $email_message = $form_settings['admin_email_msg'];
         // Check to see if the "include list of fields" checkbox was checked.
         if (isset($form_settings['admin_email_fields']) && $form_settings['admin_email_fields'] == 1) {
             $email_message .= '<br />[ninja_forms_all_fields]';
         }
         // Update our email message
         Ninja_Forms()->notification($n_id)->update_setting('email_message', $email_message);
         Ninja_Forms()->notification($n_id)->update_setting('admin_email', true);
     }
     // Create a notification for our user email
     if (!empty($fields)) {
         $addresses = array();
         foreach ($fields as $field_id => $field) {
             if (isset($field['data']['send_email']) && $field['data']['send_email'] == 1) {
                 // Add this field to our $addresses variable.
                 $addresses[] = 'field_' . $field_id;
                 unset($field['data']['send_email']);
                 unset($field['data']['replyto_email']);
                 unset($field['data']['from_name']);
                 $args = array('update_array' => array('data' => serialize($field['data'])), 'where' => array('id' => $field_id));
                 ninja_forms_update_field($args);
             }
         }
         if (!empty($addresses)) {
             // We have a user email, so create a notification
             $n_id = nf_insert_notification($form_id);
             // Update our notification type
             nf_update_object_meta($n_id, 'type', 'email');
             // Activate our notification
//.........这里部分代码省略.........
开发者ID:ramiy,项目名称:ninja-forms,代码行数:101,代码来源:convert-notifications.php

示例6: nf_remove_old_email_send_to

/**
 * Removes old email settings form a single form.
 *
 * @since 2.8.4
 * @return void
 */
function nf_remove_old_email_send_to( $form_id ) {
	if ( empty ( $form_id ) )
		return false;

	// Remove any "Admin mailto" settings we might have.
	$form_row = ninja_forms_get_form_by_id( $form_id );

	if ( isset ( $form_row['data']['admin_mailto'] ) ) {
		unset ( $form_row['data']['admin_mailto'] );

		$args = array(
			'update_array'	=> array(
				'data'		=> serialize( $form_row['data'] ),
			),
			'where'			=> array(
				'id' 		=> $form_id,
			),
		);

		ninja_forms_update_form( $args );

	}

	// Update any old email settings we have.
	$fields = Ninja_Forms()->form( $form_id )->fields;

	// Create a notification for our user email
	if ( ! empty ( $fields ) ) {
		foreach ( $fields as $field_id => $field ) {
			if ( isset ( $field['data']['send_email'] ) && $field['data']['send_email'] == 1 ) {
				// Add this field to our $addresses variable.
				unset( $field['data']['send_email'] );
				unset( $field['data']['replyto_email'] );
				unset( $field['data']['from_name'] );

				$args = array(
					'update_array'	=> array(
						'data'		=> serialize( $field['data'] ),
					),
					'where'			=> array(
						'id' 		=> $field_id,
					),
				);

				ninja_forms_update_field( $args );
			}
		}
	}
}
开发者ID:akagisho,项目名称:php-malware-scanner,代码行数:55,代码来源:upgrade-functions.php

示例7: ninja_forms_edit_field_output_li

function ninja_forms_edit_field_output_li($field_id)
{
    global $wpdb, $ninja_forms_fields, $nf_rte_editors;
    $field_row = ninja_forms_get_field_by_id($field_id);
    $current_tab = ninja_forms_get_current_tab();
    if (isset($_REQUEST['page'])) {
        $current_page = esc_html($_REQUEST['page']);
    } else {
        $current_page = '';
    }
    $field_type = $field_row['type'];
    $field_data = $field_row['data'];
    $plugin_settings = nf_get_settings();
    if (isset($ninja_forms_fields[$field_type]['use_li']) and $ninja_forms_fields[$field_type]['use_li']) {
        if (isset($field_row['fav_id']) and $field_row['fav_id'] != 0) {
            $fav_id = $field_row['fav_id'];
            $fav_row = ninja_forms_get_fav_by_id($fav_id);
            if (empty($fav_row['name'])) {
                $args = array('update_array' => array('fav_id' => ''), 'where' => array('id' => $field_id));
                ninja_forms_update_field($args);
                $fav_id = '';
            }
        } else {
            $fav_id = '';
        }
        if (isset($field_row['def_id']) and $field_row['def_id'] != 0) {
            $def_id = $field_row['def_id'];
        } else {
            $def_id = '';
        }
        $form_id = $field_row['form_id'];
        $field_results = ninja_forms_get_fields_by_form_id($form_id);
        if (isset($ninja_forms_fields[$field_type])) {
            $reg_field = $ninja_forms_fields[$field_type];
            $type_name = $reg_field['name'];
            $edit_function = $reg_field['edit_function'];
            $edit_options = $reg_field['edit_options'];
            if ($reg_field['nesting']) {
                $nesting_class = 'ninja-forms-nest';
            } else {
                $nesting_class = 'ninja-forms-no-nest';
            }
            $conditional = $reg_field['conditional'];
            $type_class = $field_type . '-li';
            if ($def_id != 0 and $def_id != '') {
                $def_row = ninja_forms_get_def_by_id($def_id);
                if (!empty($def_row['name'])) {
                    $type_name = $def_row['name'];
                }
            }
            if ($fav_id != 0 and $fav_id != '') {
                $fav_row = ninja_forms_get_fav_by_id($fav_id);
                if (!empty($fav_row['name'])) {
                    $fav_class = 'ninja-forms-field-remove-fav';
                    $type_name = $fav_row['name'];
                }
            } else {
                $fav_class = 'ninja-forms-field-add-fav';
            }
            if (isset($field_data['label']) and $field_data['label'] != '') {
                $li_label = $field_data['label'];
            } else {
                $li_label = $type_name;
            }
            $li_label = apply_filters('ninja_forms_edit_field_li_label', $li_label, $field_id);
            $li_label = stripslashes($li_label);
            $li_label = ninja_forms_esc_html_deep($li_label);
            if (isset($reg_field) && isset($reg_field['conditional']) && isset($reg_field['conditional']['value']) && isset($reg_field['conditional']['value']['type'])) {
                $conditional_value_type = $reg_field['conditional']['value']['type'];
            } else {
                $conditional_value_type = '';
            }
            ?>
			<li id="ninja_forms_field_<?php 
            echo $field_id;
            ?>
" class="<?php 
            echo $nesting_class;
            ?>
 <?php 
            echo $type_class;
            ?>
">
				<input type="hidden" id="ninja_forms_field_<?php 
            echo $field_id;
            ?>
_conditional_value_type" value="<?php 
            echo $conditional_value_type;
            ?>
">
				<input type="hidden" id="ninja_forms_field_<?php 
            echo $field_id;
            ?>
_fav_id" name="" class="ninja-forms-field-fav-id" value="<?php 
            echo $fav_id;
            ?>
">
				<dl class="menu-item-bar">
					<dt class="menu-item-handle" id="ninja_forms_metabox_field_<?php 
            echo $field_id;
//.........这里部分代码省略.........
开发者ID:serker72,项目名称:T3S,代码行数:101,代码来源:li.php

示例8: ninja_forms_calc_after_import_form

function ninja_forms_calc_after_import_form($form)
{
    global $wpdb;
    if (is_array($form['field']) and !empty($form['field'])) {
        $field_rows = ninja_forms_get_fields_by_form_id($form['id']);
        if (is_array($field_rows) and !empty($field_rows)) {
            for ($y = 0; $y < count($field_rows); $y++) {
                if (isset($field_rows[$y]['data']['calc']) and is_array($field_rows[$y]['data']['calc'])) {
                    for ($i = 0; $i < count($field_rows[$y]['data']['calc']); $i++) {
                        foreach ($form['field'] as $inserted_field) {
                            if (isset($field_rows[$y]['data']['calc'][$i]['field']) and $inserted_field['old_id'] == $field_rows[$y]['data']['calc'][$i]['field']) {
                                $field_rows[$y]['data']['calc'][$i]['field'] = $inserted_field['id'];
                            }
                        }
                    }
                }
                if (isset($field_rows[$y]['data']['calc_eq']) and $field_rows[$y]['data']['calc_eq'] != '') {
                    $calc_eq = $field_rows[$y]['data']['calc_eq'];
                    foreach ($form['field'] as $inserted_field) {
                        $calc_eq = str_replace('field_' . $inserted_field['old_id'], 'field_' . $inserted_field['id'], $calc_eq);
                    }
                    $field_rows[$y]['data']['calc_eq'] = $calc_eq;
                }
                $field_rows[$y]['data'] = serialize($field_rows[$y]['data']);
                $args = array('update_array' => array('data' => $field_rows[$y]['data']), 'where' => array('id' => $field_rows[$y]['id']));
                ninja_forms_update_field($args);
            }
            if (isset($form['data']['success_msg']) and $form['data']['success_msg'] != '') {
                $success_msg = $form['data']['success_msg'];
                foreach ($form['field'] as $inserted_field) {
                    $success_msg = str_replace('[ninja_forms_field id=' . $inserted_field['old_id'] . ']', '[ninja_forms_field id=' . $inserted_field['id'] . ']', $success_msg);
                }
                $form['data']['success_msg'] = $success_msg;
            }
            if (isset($form['data']['user_subject']) and $form['data']['user_subject'] != '') {
                $user_subject = $form['data']['user_subject'];
                foreach ($form['field'] as $inserted_field) {
                    $user_subject = str_replace('[ninja_forms_field id=' . $inserted_field['old_id'] . ']', '[ninja_forms_field id=' . $inserted_field['id'] . ']', $user_subject);
                }
                $form['data']['user_subject'] = $user_subject;
            }
            if (isset($form['data']['user_email_msg']) and $form['data']['user_email_msg'] != '') {
                $user_email_msg = $form['data']['user_email_msg'];
                foreach ($form['field'] as $inserted_field) {
                    $user_email_msg = str_replace('[ninja_forms_field id=' . $inserted_field['old_id'] . ']', '[ninja_forms_field id=' . $inserted_field['id'] . ']', $user_email_msg);
                }
                $form['data']['user_email_msg'] = $user_email_msg;
            }
            if (isset($form['data']['admin_subject']) and $form['data']['admin_subject'] != '') {
                $admin_subject = $form['data']['admin_subject'];
                foreach ($form['field'] as $inserted_field) {
                    $admin_subject = str_replace('[ninja_forms_field id=' . $inserted_field['old_id'] . ']', '[ninja_forms_field id=' . $inserted_field['id'] . ']', $admin_subject);
                }
                $form['data']['admin_subject'] = $admin_subject;
            }
            if (isset($form['data']['admin_email_msg']) and $form['data']['admin_email_msg'] != '') {
                $admin_email_msg = $form['data']['admin_email_msg'];
                foreach ($form['field'] as $inserted_field) {
                    $admin_email_msg = str_replace('[ninja_forms_field id=' . $inserted_field['old_id'] . ']', '[ninja_forms_field id=' . $inserted_field['id'] . ']', $admin_email_msg);
                }
                $form['data']['admin_email_msg'] = $admin_email_msg;
            }
            if (isset($form['data']['mp_confirm_msg']) and $form['data']['mp_confirm_msg'] != '') {
                $mp_confirm_msg = $form['data']['mp_confirm_msg'];
                foreach ($form['field'] as $inserted_field) {
                    $mp_confirm_msg = str_replace('[ninja_forms_field id=' . $inserted_field['old_id'] . ']', '[ninja_forms_field id=' . $inserted_field['id'] . ']', $mp_confirm_msg);
                }
                $form['data']['mp_confirm_msg'] = $mp_confirm_msg;
            }
            if (isset($form['data']['save_msg']) and $form['data']['save_msg'] != '') {
                $save_msg = $form['data']['save_msg'];
                foreach ($form['field'] as $inserted_field) {
                    $save_msg = str_replace('[ninja_forms_field id=' . $inserted_field['old_id'] . ']', '[ninja_forms_field id=' . $inserted_field['id'] . ']', $save_msg);
                }
                $form['data']['save_msg'] = $save_msg;
            }
            if (isset($form['data']['save_email_msg']) and $form['data']['save_email_msg'] != '') {
                $save_email_msg = $form['data']['save_email_msg'];
                foreach ($form['field'] as $inserted_field) {
                    $save_email_msg = str_replace('[ninja_forms_field id=' . $inserted_field['old_id'] . ']', '[ninja_forms_field id=' . $inserted_field['id'] . ']', $save_email_msg);
                }
                $form['data']['save_email_msg'] = $save_email_msg;
            }
            $args = array('update_array' => array('data' => serialize($form['data'])), 'where' => array('id' => $form['id']));
            ninja_forms_update_form($args);
        }
    }
}
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:88,代码来源:impexp-forms.php


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