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


PHP ninja_forms_get_fields_by_form_id函数代码示例

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


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

示例1: ninja_forms_mp_get_pages

function ninja_forms_mp_get_pages($form_id = '')
{
    global $ninja_forms_loading, $ninja_forms_processing;
    $field_results = ninja_forms_get_fields_by_form_id($form_id);
    $pages = array();
    $x = 0;
    $y = 0;
    $last_field = '';
    foreach ($field_results as $field) {
        if ($field['type'] == '_page_divider') {
            $x++;
            $y = 0;
            $pages[$x]['id'] = $field['id'];
            $pages[$x]['page_title'] = $field['data']['page_name'];
        } else {
            if ($y == 0) {
                $pages[$x]['first_field'] = $field['id'];
                $y++;
            }
        }
        $pages[$x]['fields'][] = $field['id'];
        if (isset($ninja_forms_loading)) {
            $ninja_forms_loading->update_field_setting($field['id'], 'page', $x);
        } else {
            $ninja_forms_processing->update_field_setting($field['id'], 'page', $x);
        }
    }
    foreach ($pages as $num => $vars) {
        $last_field = end($vars['fields']);
        $pages[$num]['last_field'] = $last_field;
    }
    return $pages;
}
开发者ID:emtv,项目名称:hackmsi,代码行数:33,代码来源:functions.php

示例2: ninja_forms_register_feditor_sub_settings_metabox

function ninja_forms_register_feditor_sub_settings_metabox()
{
    $all_roles = get_editable_roles();
    $tmp_array = array();
    if (is_array($all_roles) and !empty($all_roles)) {
        foreach ($all_roles as $key => $role) {
            $tmp_array[] = array('name' => $role['name'], 'value' => $key);
        }
    }
    $all_roles = $tmp_array;
    $edit_table_cols = array();
    if (isset($_REQUEST['form_id'])) {
        $form_id = $_REQUEST['form_id'];
        $fields = ninja_forms_get_fields_by_form_id($form_id);
        foreach ($fields as $field) {
            if (isset($field['data']['label'])) {
                $edit_table_cols[] = array('name' => $field['data']['label'], 'value' => $field['id']);
            } else {
                $edit_table_cols[] = array('name' => 'Field ID: ' . $field['id'], 'value' => $field['id']);
            }
        }
    } else {
    }
    $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'sub_settings', 'title' => __('Submission management settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'manage_sub', 'type' => 'checkbox', 'label' => __('Enable front-end submission management', 'ninja-forms-feditor'), 'default_value' => 1), array('name' => 'manage_sub_table', 'type' => 'checkbox', 'label' => __('Show submission management table above this form?', 'ninja-forms-feditor'), 'default_value' => 1), array('name' => 'manage_sub_table_cols', 'type' => 'multi_select', 'label' => __('Use these fields as table columns', 'ninja-forms-feditor'), 'options' => $edit_table_cols, 'size' => 10, 'desc' => __('Use CTRL + click to select multiple fields (COMMAND + click for Mac users). The number of field columns you want will depend upon the size of your field labels and values. Three is a good, standard value.', 'ninja-forms-feditor')), array('name' => 'manage_sub_hide_form', 'type' => 'checkbox', 'label' => __('Hide this form when a user has submissions to manage', 'ninja-forms-feditor')), array('name' => 'override_sub_rules', 'type' => 'checkbox', 'label' => __('Override rules settings', 'ninja-forms-feditor')), array('name' => '', 'type' => '', 'label' => '', 'display_function' => 'ninja_forms_feditor_sub_settings_user_list'), array('name' => 'manage_sub_roles', 'type' => 'checkbox_list', 'select_all' => false, 'options' => $all_roles, 'label' => __('Allow these roles', 'ninja-forms')), array('name' => 'edit_sub', 'type' => 'checkbox', 'label' => __('To Edit Submissions', 'ninja-forms-feditor')), array('name' => 'delete_sub', 'type' => 'checkbox', 'label' => __('To Delete Submissions', 'ninja-forms-feditor'))));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:28,代码来源:sub-settings-metabox.php

示例3: ninja_forms_upload_display_js

function ninja_forms_upload_display_js($form_id)
{
    if (!is_admin()) {
        $fields = ninja_forms_get_fields_by_form_id($form_id);
        $output = false;
        $multi = false;
        foreach ($fields as $field) {
            if ($field['type'] == '_upload') {
                if (!$output) {
                    $output = true;
                }
                if (!$multi && isset($field['data']['upload_multi']) && $field['data']['upload_multi'] == 1) {
                    $multi = true;
                }
            }
        }
        if ($output) {
            if (defined('NINJA_FORMS_JS_DEBUG') && NINJA_FORMS_JS_DEBUG) {
                $suffix = '';
                $src = 'dev';
            } else {
                $suffix = '.min';
                $src = 'min';
            }
            wp_enqueue_script('ninja-forms-uploads-display', NINJA_FORMS_UPLOADS_URL . '/js/' . $src . '/ninja-forms-uploads-display' . $suffix . '.js', array('jquery', 'ninja-forms-display'));
            if ($multi) {
                wp_enqueue_script('jquery-multi-file', NINJA_FORMS_UPLOADS_URL . '/js/min/jquery.MultiFile.pack.js', array('jquery'));
                wp_localize_script('ninja-forms-uploads-display', 'ninja_forms_uploads_settings', array('delete' => __('Really delete this item?', 'ninja-forms-uploads')));
            }
        }
    }
}
开发者ID:pjsinco,项目名称:doctorsthatdo-wp-content,代码行数:32,代码来源:scripts.php

示例4: ninja_forms_conditionals_field_class_filter

function ninja_forms_conditionals_field_class_filter($form_id)
{
    global $ninja_forms_loading, $ninja_forms_processing;
    $field_results = ninja_forms_get_fields_by_form_id($form_id);
    foreach ($field_results as $field) {
        if (isset($field['data']['conditional'])) {
            $conditional = $field['data']['conditional'];
        } else {
            $conditional = '';
        }
        if (isset($conditional) and is_array($conditional)) {
            foreach ($conditional as $conditional) {
                if (isset($conditional['cr']) and is_array($conditional['cr'])) {
                    foreach ($conditional['cr'] as $cr) {
                        if (isset($ninja_forms_loading)) {
                            $cr_field_class = $ninja_forms_loading->get_field_setting($cr['field'], 'field_class');
                        } else {
                            $cr_field_class = $ninja_forms_processing->get_field_setting($cr['field'], 'field_class');
                        }
                        if (strpos($cr_field_class, 'ninja-forms-field-conditional-listen') === false) {
                            $cr_field_class .= ' ninja-forms-field-conditional-listen ';
                        }
                        if (isset($ninja_forms_loading)) {
                            $ninja_forms_loading->update_field_setting($cr['field'], 'field_class', $cr_field_class);
                        } else {
                            $ninja_forms_processing->update_field_setting($cr['field'], 'field_class', $cr_field_class);
                        }
                    }
                }
            }
        }
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:33,代码来源:field-class-filter.php

示例5: ninja_forms_mp_save_form

function ninja_forms_mp_save_form($form_id, $data)
{
    $form_row = ninja_forms_get_form_by_id($form_id);
    $form_data = $form_row['data'];
    if (isset($form_data['multi_part'])) {
        $multi_part = $form_data['multi_part'];
    } else {
        $multi_part = 0;
    }
    if ($data['multi_part'] == 0 and $multi_part == 1) {
        $all_fields = ninja_forms_get_fields_by_form_id($form_id);
        if (is_array($all_fields) and !empty($all_fields)) {
            foreach ($all_fields as $field) {
                if ($field['type'] == '_page_divider') {
                    ninja_forms_delete_field($field['id']);
                }
            }
        }
    } else {
        if ($data['multi_part'] == 1 and $multi_part == 0) {
            $args = array('type' => '_page_divider', 'order' => -1);
            ninja_forms_insert_field($form_id, $args);
        }
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:25,代码来源:form-settings-metabox.php

示例6: ninja_forms_display_req_items

function ninja_forms_display_req_items($form_id)
{
    $plugin_settings = get_option('ninja_forms_settings');
    if (isset($plugin_settings['req_div_label'])) {
        $req_div_label = __($plugin_settings['req_div_label'], 'ninja-forms');
    } else {
        $req_div_label = __('Fields marked with a * are required.', 'ninja-forms');
    }
    $all_fields = ninja_forms_get_fields_by_form_id($form_id);
    $output = false;
    if (is_array($all_fields) and !empty($all_fields)) {
        foreach ($all_fields as $field) {
            if (isset($field['data']['req']) and $field['data']['req'] == 1) {
                $output = true;
            }
        }
    }
    if ($output) {
        ?>
		<div class="ninja-forms-required-items"><?php 
        echo $req_div_label;
        ?>
</div>
		<?php 
    }
}
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:26,代码来源:required-label.php

示例7: process

    /**
     * Process
     *
     * @param string $id
     * @return void
     */
    public function process($id)
    {
        global $ninja_forms_processing;
        $form_id = $ninja_forms_processing->get_form_ID();
        $form_title = $ninja_forms_processing->get_form_setting('form_title');
        $all_fields = ninja_forms_get_fields_by_form_id($form_id);
        $total = '';
        // Get IDs of fields that are to be sent to PayPal
        $accepted_fields = $PayPalEmail = Ninja_Forms()->notification($id)->get_setting('accepted_fields');
        $accepted_ary = explode(',', $accepted_fields);
        if (is_array($all_fields)) {
            foreach ($all_fields as $field) {
                $value = $ninja_forms_processing->get_field_value($field['id']);
                if (in_array($field['id'], $accepted_ary)) {
                    $total += $value;
                }
            }
        }
        // Grab PayPal email from NF setting
        $paypal_email = Ninja_Forms()->notification($id)->get_setting('paypal_email');
        // Format PayPal URL
        $url = 'https://www.paypal.com/us/cgi-bin/webscr?cmd=_xclick
		&business=' . urlencode($paypal_email) . '
		&item_name=' . urlencode($form_title) . '
		&item_number=
		&amount=' . $total . '
		&no_shipping=1
		&return=' . site_url() . '
		&currency_code=USD&lc=US&bn=PP-BuyNowBF';
        // Do the redirection to PayPal
        wp_redirect($url);
        exit;
    }
开发者ID:trevanhetzel,项目名称:ninja-forms-paypal-redirect,代码行数:39,代码来源:paypal-redirect.php

示例8: ninja_forms_fields_post_process

function ninja_forms_fields_post_process()
{
    global $ninja_forms_fields, $ninja_forms_processing;
    //Loop through the submitted form data and call each field's post_processing function, if one exists.
    $form_id = $ninja_forms_processing->get_form_ID();
    $field_results = ninja_forms_get_fields_by_form_id($form_id);
    if (is_array($field_results) and !empty($field_results)) {
        foreach ($field_results as $field) {
            $field_id = $field['id'];
            $field_type = $field['type'];
            $field_data = $field['data'];
            if (isset($ninja_forms_fields[$field_type])) {
                $reg_field = $ninja_forms_fields[$field_type];
                //if( $reg_field['process_field'] ){
                $post_process_function = $reg_field['post_process'];
                if ($post_process_function != '') {
                    $arguments = array();
                    $arguments['field_id'] = $field_id;
                    $user_value = $ninja_forms_processing->get_field_value($field_id);
                    $user_value = apply_filters('ninja_forms_field_post_process_user_value', $user_value, $field_id);
                    $arguments['user_value'] = $user_value;
                    call_user_func_array($post_process_function, $arguments);
                }
                //}
            }
        }
    }
}
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:28,代码来源:fields-post-process.php

示例9: ninja_forms_fields_edit_sub_post_process

function ninja_forms_fields_edit_sub_post_process()
{
    global $ninja_forms_fields, $ninja_forms_processing;
    $form_id = $ninja_forms_processing->get_form_ID();
    $field_results = ninja_forms_get_fields_by_form_id($form_id);
    if (is_array($field_results) and !empty($field_results)) {
        foreach ($field_results as $field) {
            $field_id = $field['id'];
            $field_type = $field['type'];
            $field_data = $field['data'];
            if (isset($ninja_forms_fields[$field_type])) {
                $reg_field = $ninja_forms_fields[$field_type];
                if ($reg_field['process_field']) {
                    $post_process_function = $reg_field['edit_sub_post_process'];
                    if ($post_process_function != '') {
                        $arguments = array();
                        $arguments['field_id'] = $field_id;
                        $user_value = $ninja_forms_processing->get_field_value($field_id);
                        $user_value = apply_filters('ninja_forms_field_edit_sub_post_process_user_value', $user_value, $field_id);
                        $arguments['user_value'] = $user_value;
                        call_user_func_array($post_process_function, $arguments);
                    }
                }
            }
        }
    }
}
开发者ID:brunolampada,项目名称:foss4g2014-wordpress,代码行数:27,代码来源:fields-post-process.php

示例10: 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

示例11: ninja_forms_upload_display_js

function ninja_forms_upload_display_js($form_id)
{
    if (!is_admin()) {
        $fields = ninja_forms_get_fields_by_form_id($form_id);
        $output = false;
        $multi = false;
        foreach ($fields as $field) {
            if ($field['type'] == '_upload') {
                if (!$output) {
                    $output = true;
                }
                if (!$multi and $field['data']['upload_multi'] == 1) {
                    $multi = true;
                }
            }
        }
        if ($output) {
            wp_enqueue_script('ninja-forms-uploads-display', NINJA_FORMS_UPLOADS_URL . '/js/min/ninja-forms-uploads-display.min.js', array('jquery', 'ninja-forms-display'));
            if ($multi) {
                wp_enqueue_script('jquery-multi-file', NINJA_FORMS_UPLOADS_URL . '/js/min/jquery.MultiFile.pack.js', array('jquery'));
                wp_localize_script('ninja-forms-uploads-display', 'ninja_forms_uploads_settings', array('delete' => __('Really delete this item?', 'ninja-forms-uploads')));
            }
        }
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:25,代码来源:scripts.php

示例12: ninja_forms_edit_field_output_ul

function ninja_forms_edit_field_output_ul($form_id)
{
    $fields = ninja_forms_get_fields_by_form_id($form_id);
    ?>
	<div id="ninja-forms-viewport">
		<input class="button-primary menu-save nf-save-admin-fields" id="ninja_forms_save_data_top" type="button" value="<?php 
    _e('Save', 'ninja-forms');
    ?>
" />
		<a href="#" class="button-secondary nf-save-spinner" style="display:none;" disabled><span class="spinner nf-save-spinner" style="float:left;"></span></a>
		<ul class="menu ninja-forms-field-list" id="ninja_forms_field_list">
	  		<?php 
    if (is_array($fields) and !empty($fields)) {
        foreach ($fields as $field) {
            ninja_forms_edit_field($field['id']);
        }
    }
    ?>
		</ul>

		<input class="button-primary menu-save nf-save-admin-fields" id="ninja_forms_save_data_bot" type="button" value="<?php 
    _e('Save', 'ninja-forms');
    ?>
" />
		<a href="#" class="button-secondary nf-save-spinner" style="display:none;" disabled><span class="spinner nf-save-spinner" style="float:left;"></span></a>
	</div>
		<?php 
}
开发者ID:se7ven214,项目名称:Kungfuphp.local,代码行数:28,代码来源:edit-field-ul.php

示例13: ld_ninja_form_get_fields_by_form_id

function ld_ninja_form_get_fields_by_form_id($form_id)
{
    $return = array();
    if (function_exists('ninja_forms_get_fields_by_form_id')) {
        $all_fields = ninja_forms_get_fields_by_form_id($form_id);
        if (!empty($all_fields)) {
            foreach ($all_fields as $field) {
                if ($field['type'] !== '_submit') {
                    $return[] = array('label' => $field['data']['label'] . ' (' . $field['id'] . ')', 'value' => $field['id']);
                }
            }
        }
    }
    return $return;
}
开发者ID:julianomoreira,项目名称:euescolhivoce,代码行数:15,代码来源:data-sources.php

示例14: load_scripts

 /**
  * Load our scripts
  */
 function load_scripts($form_id)
 {
     // first let's get all of the fields on the page
     $all_fields = ninja_forms_get_fields_by_form_id($form_id);
     // determine if one this plugin's fields are present
     $nfuaFields = array("ip_address", "browser", "browser_version", "os", "country", "region", "postal_code", "city", "latitude", "longitude");
     $nfuaFieldPresent = false;
     foreach ($all_fields as $key => $value) {
         if (isset($value['type']) && in_array($value['type'], $nfuaFields)) {
             $nfuaFieldPresent = true;
         }
     }
     // if one of our fields is present in the form then print out the scripts
     if ($nfuaFieldPresent) {
         // load geolocation script
         wp_enqueue_script('maxmind_geoip', "http://j.maxmind.com/app/geoip.js");
         // load main script
         wp_enqueue_script('nf-user-analytics', plugins_url('assets/scripts/script.js', __FILE__), array('jquery'), "0.1.0", true);
     }
 }
开发者ID:emtv,项目名称:hackmsi,代码行数:23,代码来源:ninja-forms-user-analytics.php

示例15: ninja_forms_edit_field_output_mp_ul

function ninja_forms_edit_field_output_mp_ul($form_id)
{
    $all_fields = ninja_forms_get_fields_by_form_id($form_id);
    if (is_array($all_fields) and !empty($all_fields)) {
        $pages = array();
        $this_page = array();
        $x = 0;
        foreach ($all_fields as $field) {
            if ($field['type'] == '_page_divider') {
                $x++;
            }
            $pages[$x][] = $field['id'];
        }
        if (isset($_REQUEST['current_page'])) {
            $current_page = $_REQUEST['current_page'];
        } else {
            $current_page = 1;
        }
        if (is_array($pages) and !empty($pages)) {
            foreach ($pages as $page => $fields) {
                ?>
				<ul class="menu ninja-forms-field-list" id="ninja_forms_field_list_<?php 
                echo $page;
                ?>
" data-order="<?php 
                echo $page;
                ?>
">
			  		<?php 
                if (is_array($fields) and !empty($fields)) {
                    foreach ($fields as $field_id) {
                        ninja_forms_edit_field($field_id);
                    }
                }
                ?>
				</ul>
				<?php 
            }
        }
    }
}
开发者ID:emtv,项目名称:hackmsi,代码行数:41,代码来源:edit-field-ul.php


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