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


PHP ninja_forms_get_current_tab函数代码示例

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


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

示例1: ninja_forms_update_screen_options

function ninja_forms_update_screen_options()
{
    global $ninja_forms_screen_options;
    $current_tab = ninja_forms_get_current_tab();
    if (isset($_POST['_wpnonce'])) {
        $nonce = $_POST['_wpnonce'];
    } else {
        $nonce = '';
    }
    if (!empty($_POST) and $_POST['ninja_forms_save_screen_options'] == 1 and wp_verify_nonce($nonce, 'ninja_forms_update_options') and check_admin_referer('ninja_forms_update_options', '_wpnonce')) {
        if (!empty($ninja_forms_screen_options) and is_array($ninja_forms_screen_options)) {
            //print_r($ninja_forms_screen_options);
            if (isset($ninja_forms_screen_options['_universal_']) and is_array($ninja_forms_screen_options['_universal_'])) {
                foreach ($ninja_forms_screen_options['_universal_'] as $slug => $option) {
                    $save_function = $option['save_function'];
                    $arguments = func_get_args();
                    array_shift($arguments);
                    // We need to remove the first arg ($function_name)
                    call_user_func_array($save_function, $arguments);
                }
            }
            if (isset($ninja_forms_screen_options[$current_tab]) and is_array($ninja_forms_screen_options[$current_tab])) {
                foreach ($ninja_forms_screen_options[$current_tab] as $slug => $option) {
                    $save_function = $option['save_function'];
                    $arguments = func_get_args();
                    array_shift($arguments);
                    // We need to remove the first arg ($function_name)
                    call_user_func_array($save_function, $arguments);
                }
            }
        }
    }
}
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:33,代码来源:display-screen-options.php

示例2: ninja_forms_admin_js

function ninja_forms_admin_js()
{
    global $version_compare, $public_query_vars;
    $form_id = isset($_REQUEST['form_id']) ? absint($_REQUEST['form_id']) : '';
    if (defined('NINJA_FORMS_JS_DEBUG') && NINJA_FORMS_JS_DEBUG) {
        $suffix = '';
        $src = 'dev';
    } else {
        $suffix = '.min';
        $src = 'min';
    }
    $plugin_settings = nf_get_settings();
    if (isset($plugin_settings['date_format'])) {
        $date_format = $plugin_settings['date_format'];
    } else {
        $date_format = 'm/d/Y';
    }
    $date_format = ninja_forms_date_to_datepicker($date_format);
    $datepicker_args = array();
    if (!empty($date_format)) {
        $datepicker_args['dateFormat'] = $date_format;
    }
    wp_enqueue_script('ninja-forms-admin', NINJA_FORMS_URL . 'js/' . $src . '/ninja-forms-admin' . $suffix . '.js?nf_ver=' . NF_PLUGIN_VERSION, array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'nf-admin-modal'));
    wp_localize_script('ninja-forms-admin', 'ninja_forms_settings', array('nf_ajax_nonce' => wp_create_nonce('nf_ajax'), 'form_id' => $form_id, 'datepicker_args' => apply_filters('ninja_forms_admin_forms_datepicker_args', $datepicker_args), 'add_fav_prompt' => __('What would you like to name this favorite?', 'ninja-forms'), 'add_fav_error' => __('You must supply a name for this favorite.', 'ninja-forms'), 'deactivate_all_licenses_confirm' => __('Really deactivate all licenses?', 'ninja-forms')));
    wp_localize_script('ninja-forms-admin', 'nf_conversion_title', __('Reset the form conversion process for v2.9+', 'ninja-forms'));
    wp_localize_script('ninja-forms-admin', 'nf_nuke_title', __('Remove ALL Ninja Forms data upon uninstall?', 'ninja-forms'));
    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ninja-forms' && isset($_REQUEST['tab'])) {
        wp_enqueue_script('nf-builder', NINJA_FORMS_URL . 'assets/js/' . $src . '/builder' . $suffix . '.js?nf_ver=' . NF_PLUGIN_VERSION, array('backbone'));
        if ('' != $form_id) {
            $fields = Ninja_Forms()->form($form_id)->fields;
            $current_tab = ninja_forms_get_current_tab();
            $current_page = isset($_REQUEST['page']) ? esc_html($_REQUEST['page']) : '';
            foreach ($fields as $field_id => $field) {
                $fields[$field_id]['metabox_state'] = 0;
            }
            $form_status = Ninja_Forms()->form($form_id)->get_setting('status');
            $form_title = Ninja_Forms()->form($form_id)->get_setting('form_title');
            wp_localize_script('nf-builder', 'nf_admin', array('edit_form_text' => __('Edit Form', 'ninja-forms'), 'form_title' => $form_title, 'form_status' => $form_status, 'fields' => $fields, 'saved_text' => __('Saved', 'ninja-forms'), 'save_text' => __('Save', 'ninja-forms'), 'saving_text' => __('Saving...', 'ninja-forms'), 'remove_field' => __('Remove this field? It will be removed even if you do not save.', 'ninja-forms')));
            $reserved_terms = array('attachment', 'attachment_id', 'author', 'author_name', 'calendar', 'cat', 'category', 'category__and', 'category__in', 'category__not_in', 'category_name', 'comments_per_page', 'comments_popup', 'customize_messenger_channel', 'customized', 'cpage', 'day', 'debug', 'error', 'exact', 'feed', 'hour', 'link_category', 'm', 'minute', 'monthnum', 'more', 'name', 'nav_menu', 'nonce', 'nopaging', 'offset', 'order', 'orderby', 'p', 'page', 'page_id', 'paged', 'pagename', 'pb', 'perm', 'post', 'post__in', 'post__not_in', 'post_format', 'post_mime_type', 'post_status', 'post_tag', 'post_type', 'posts', 'posts_per_archive_page', 'posts_per_page', 'preview', 'robots', 's', 'search', 'second', 'sentence', 'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id', 'tag_slug__and', 'tag_slug__in', 'taxonomy', 'tb', 'term', 'theme', 'type', 'w', 'withcomments', 'withoutcomments', 'year');
            wp_localize_script('nf-builder', 'wp_reserved_terms', $reserved_terms);
        }
    }
}
开发者ID:RA2WP,项目名称:RA2WP-NEW,代码行数:43,代码来源:scripts.php

示例3: ninja_forms_admin_js

function ninja_forms_admin_js()
{
    global $version_compare;
    $form_id = isset($_REQUEST['form_id']) ? $_REQUEST['form_id'] : '';
    if (defined('NINJA_FORMS_JS_DEBUG') && NINJA_FORMS_JS_DEBUG) {
        $suffix = '';
        $src = 'dev';
    } else {
        $suffix = '.min';
        $src = 'min';
    }
    $plugin_settings = nf_get_settings();
    if (isset($plugin_settings['date_format'])) {
        $date_format = $plugin_settings['date_format'];
    } else {
        $date_format = 'm/d/Y';
    }
    $date_format = ninja_forms_date_to_datepicker($date_format);
    $datepicker_args = array();
    if (!empty($date_format)) {
        $datepicker_args['dateFormat'] = $date_format;
    }
    wp_enqueue_script('ninja-forms-admin', NINJA_FORMS_URL . 'js/' . $src . '/ninja-forms-admin' . $suffix . '.js', array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
    wp_localize_script('ninja-forms-admin', 'ninja_forms_settings', array('nf_ajax_nonce' => wp_create_nonce('nf_ajax'), 'form_id' => $form_id, 'datepicker_args' => apply_filters('ninja_forms_admin_forms_datepicker_args', $datepicker_args), 'add_fav_prompt' => __('What would you like to name this favorite?', 'ninja-forms'), 'add_fav_error' => __('You must supply a name for this favorite.', 'ninja-forms'), 'deactivate_all_licenses_confirm' => __('Really deactivate all licenses?', 'ninja-forms'), 'nuke_warning' => 'This setting will COMPLETELY remove anything Ninja Forms related. This includes SUBMISSIONS and FORMS. It cannot be undone.', 'ninja-forms'));
    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'ninja-forms' && isset($_REQUEST['tab'])) {
        wp_enqueue_script('nf-builder', NINJA_FORMS_URL . 'assets/js/' . $src . '/builder' . $suffix . '.js', array('backbone'));
        if ('' != $form_id) {
            $fields = Ninja_Forms()->form($form_id)->fields;
            $current_tab = ninja_forms_get_current_tab();
            $current_page = isset($_REQUEST['page']) ? esc_html($_REQUEST['page']) : '';
            foreach ($fields as $field_id => $field) {
                $fields[$field_id]['metabox_state'] = 0;
            }
            $form_status = Ninja_Forms()->form($form_id)->get_setting('status');
            $form_title = Ninja_Forms()->form($form_id)->get_setting('form_title');
            wp_localize_script('nf-builder', 'nf_admin', array('edit_form_text' => __('Edit Form', 'ninja-forms'), 'form_title' => $form_title, 'form_status' => $form_status, 'fields' => $fields, 'saved_text' => __('Saved', 'ninja-forms'), 'save_text' => __('Save', 'ninja-forms'), 'saving_text' => __('Saving...', 'ninja-forms'), 'remove_field' => __('Remove this field? It will be removed even if you do not save.', 'ninja-forms')));
        }
    }
}
开发者ID:se7ven214,项目名称:Kungfuphp.local,代码行数:39,代码来源:scripts.php

示例4: ninja_forms_register_sidebar_post_fields

 function ninja_forms_register_sidebar_post_fields()
 {
     $add_field = apply_filters('ninja_forms_use_post_fields', false);
     if (!$add_field) {
         return false;
     }
     if (isset($_REQUEST['form_id'])) {
         $form_id = absint($_REQUEST['form_id']);
     } else {
         $form_id = '';
     }
     if (function_exists('ninja_forms_get_current_tab')) {
         $current_tab = ninja_forms_get_current_tab();
     }
     if ($form_id != '' and $current_tab == 'fields') {
         $form_row = ninja_forms_get_form_by_id($form_id);
         if (is_array($form_row) and !empty($form_row)) {
             $form_data = $form_row['data'];
             if (isset($form_data['create_post'])) {
                 $create_post = $form_data['create_post'];
             } else {
                 $create_post = '';
             }
         } else {
             $create_post = '';
         }
     } else {
         $create_post = '';
     }
     $args = array('name' => 'Post Creation Fields', 'page' => 'ninja-forms', 'tab' => 'builder', 'display_function' => 'ninja_forms_sidebar_display_fields');
     if ($create_post == 1) {
         if (function_exists('ninja_forms_register_sidebar')) {
             ninja_forms_register_sidebar('post_fields', $args);
         }
     }
 }
开发者ID:thehereward,项目名称:ninja-forms,代码行数:36,代码来源:post-fields.php

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

示例6: ninja_forms_save_screen_option_tabs

function ninja_forms_save_screen_option_tabs()
{
    $current_tab = ninja_forms_get_current_tab();
    $current_page = $_REQUEST['page'];
    $opt = nf_get_settings();
    if (is_array($_POST['ninja-forms-tab'])) {
        foreach ($_POST['ninja-forms-tab'] as $slug => $val) {
            $opt['screen_options']['tab'][$slug]['visible'] = $val;
        }
    }
    if (is_array($_POST['ninja-forms-sidebar'])) {
        foreach ($_POST['ninja-forms-sidebar'] as $slug => $val) {
            $opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible'] = $val;
        }
    }
    update_option('ninja_forms_settings', $opt);
}
开发者ID:ramiy,项目名称:ninja-forms,代码行数:17,代码来源:register-screen-options.php

示例7: ninja_forms_display_tabs

function ninja_forms_display_tabs()
{
    global $ninja_forms_tabs;
    $current_tab = ninja_forms_get_current_tab();
    $current_page = esc_html($_REQUEST['page']);
    $opt = nf_get_settings();
    if (isset($_REQUEST['form_id'])) {
        $form_id = absint($_REQUEST['form_id']);
    } else {
        $form_id = '';
    }
    if (isset($ninja_forms_tabs[$current_page]) and is_array($ninja_forms_tabs[$current_page])) {
        foreach ($ninja_forms_tabs[$current_page] as $slug => $tab) {
            if (isset($opt['screen_options']['tab'][$slug]['visible']) and $opt['screen_options']['tab'][$slug]['visible'] == 1 or !isset($opt['screen_options']['tab'][$slug]['visible'])) {
                if ($tab['add_form_id'] == 1) {
                    $link = remove_query_arg('update_message');
                    if ($form_id != '') {
                        $link = esc_url(add_query_arg(array('tab' => $slug, 'form_id' => $form_id), $link));
                    } else {
                        $link = esc_url(add_query_arg(array('tab' => $slug), $link));
                    }
                } else {
                    $link = esc_url(remove_query_arg(array('form_id', 'tab', 'update_message')));
                    $link = esc_url(add_query_arg(array('tab' => $slug), $link));
                }
                if ($tab['disable_no_form_id'] and ($form_id == '' or $form_id == 'new')) {
                    $link = '';
                }
                if (isset($tab['url'])) {
                    $link = $tab['url'];
                }
                if (isset($tab['target'])) {
                    $target = $tab['target'];
                } else {
                    $target = '';
                }
                if ($tab['show_this_tab_link']) {
                    if ($current_tab == $slug) {
                        ?>
							<span class="nav-tab nav-tab-active <?php 
                        echo $tab['active_class'];
                        ?>
"><?php 
                        echo $tab['name'];
                        ?>
</span>
						<?php 
                    } else {
                        ?>
							<a href="<?php 
                        echo $link;
                        ?>
" target="<?php 
                        echo $target;
                        ?>
" class="nav-tab <?php 
                        echo $tab['inactive_class'];
                        ?>
"><?php 
                        echo $tab['name'];
                        ?>
</a>
						<?php 
                    }
                }
            }
        }
    }
}
开发者ID:brunolampada,项目名称:foss4g2014-wordpress,代码行数:69,代码来源:tabs.php

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

示例9: nf_admin_footer_text

function nf_admin_footer_text($footer_text)
{
    global $current_screen, $pagenow, $typenow;
    $current_tab = ninja_forms_get_current_tab();
    // only display custom text on Ninja Admin Pages
    if (isset($current_screen->id) && strpos($current_screen->id, 'ninja') !== false || ($pagenow == 'edit.php' || $pagenow == 'post.php') && $typenow == 'nf_sub') {
        $footer_text = sprintf(__('Please rate %sNinja Forms%s %s on %sWordPress.org%s to help us keep this plugin free.  Thank you from the WP Ninjas team!', 'ninja-forms'), '<strong>', '</strong>', '<a href="http://wordpress.org/support/view/plugin-reviews/ninja-forms?filter=5" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>', '<a href="http://wordpress.org/support/view/plugin-reviews/ninja-forms?filter=5" target="_blank">', '</a>');
    }
    if ('builder' == $current_tab) {
        $footer_text = '';
    }
    return $footer_text;
}
开发者ID:se7ven214,项目名称:Kungfuphp.local,代码行数:13,代码来源:functions.php

示例10: ninja_forms_admin

function ninja_forms_admin()
{
    global $wpdb, $ninja_forms_tabs, $ninja_forms_sidebars, $current_tab, $ninja_forms_tabs_metaboxes, $ninja_forms_admin_update_message;
    $current_tab = ninja_forms_get_current_tab();
    $current_page = esc_html($_REQUEST['page']);
    if (isset($_REQUEST['form_id'])) {
        $form_id = absint($_REQUEST['form_id']);
        $data = Ninja_Forms()->form($form_id)->get_all_settings();
        $form_title = isset($data['form_title']) ? $data['form_title'] : '';
    } else {
        $form_id = '';
        $data = '';
        $form_title = '';
    }
    if (!isset($ninja_forms_admin_update_message) and isset($_REQUEST['update_message'])) {
        $ninja_forms_admin_update_message = esc_html($_REQUEST['update_message']);
    }
    $output_form = isset($ninja_forms_tabs[$current_page][$current_tab]['output_form']) ? $ninja_forms_tabs[$current_page][$current_tab]['output_form'] : true;
    $form_method = isset($ninja_forms_tabs[$current_page][$current_tab]['form_method']) ? $ninja_forms_tabs[$current_page][$current_tab]['form_method'] : 'post';
    $hidden_fields = isset($ninja_forms_tabs[$current_page][$current_tab]['hidden_fields']) ? $ninja_forms_tabs[$current_page][$current_tab]['hidden_fields'] : true;
    if ($output_form) {
        ?>
		<form id="ninja_forms_admin" enctype="multipart/form-data" method="<?php 
        echo $form_method;
        ?>
">
			<input type="hidden" name="_page" id="_page" value="<?php 
        echo $current_page;
        ?>
">
			<input type="hidden" name="_tab" id="_tab" value="<?php 
        echo $current_tab;
        ?>
">
			<input type="hidden" name="_form_id"  id="_form_id" value="<?php 
        echo $form_id;
        ?>
">
			<input type="hidden" name="_fields_order" id="_fields_order" value="same">
			<?php 
        wp_nonce_field('_ninja_forms_save', '_ninja_forms_admin_submit');
    }
    ?>
		<div class="wrap">
			<?php 
    screen_icon('ninja-custom-forms');
    if (isset($ninja_forms_tabs[$current_page][$current_tab]['title'])) {
        echo $ninja_forms_tabs[$current_page][$current_tab]['title'];
    }
    if ('form_list' == $current_tab) {
        $builder_url = esc_url(add_query_arg(array('form_id' => 'new', 'tab' => 'builder')));
        ?>
					<h2><?php 
        _e('Forms', 'ninja-forms');
        ?>
 <a href="<?php 
        echo $builder_url;
        ?>
" class="add-new-h2"><?php 
        _e('Add New', 'ninja-forms');
        ?>
</a></h2>
					<?php 
    } else {
        ?>
					<h2 id="nf-display-form-title"><?php 
        echo $form_title;
        ?>
</h2>
					<?php 
    }
    if ($ninja_forms_tabs[$current_page][$current_tab]['show_tab_links']) {
        ?>
					<h2 class="nav-tab-wrapper">
						<?php 
        ninja_forms_display_tabs();
        if (!empty($form_id)) {
            $preview_link = ninja_forms_preview_link($form_id, false);
            $subs_link = admin_url('edit.php?post_status=all&post_type=nf_sub&action=-1&m=0&form_id=' . $form_id . '&begin_date&end_date&paged=1&mode=list&action2=-1');
            ?>
							<a href="<?php 
            echo $preview_link;
            ?>
" target="_blank" class="nf-preview button-secondary"><span class="dashicons dashicons-welcome-view-site"></span><?php 
            _e('Preview', 'ninja-forms');
            ?>
</a>
							<a href="<?php 
            echo $subs_link;
            ?>
" target="_blank" class="nf-subs button-secondary"><span class="dashicons dashicons-email-alt"></span><?php 
            _e('Submissions', 'ninja-forms');
            ?>
</a>
						<?php 
        }
        ?>
					</h2>
					<?php 
    }
//.........这里部分代码省略.........
开发者ID:baronwatts,项目名称:folio,代码行数:101,代码来源:admin.php

示例11: ninja_forms_admin_save

function ninja_forms_admin_save()
{
    global $ninja_forms_tabs, $ninja_forms_sidebars, $ninja_forms_tabs_metaboxes, $ninja_forms_admin_update_message;
    if (!empty($_POST) and !empty($_POST['_ninja_forms_admin_submit']) and $_POST['_ninja_forms_admin_submit'] != '') {
        if (wp_verify_nonce($_POST['_ninja_forms_admin_submit'], '_ninja_forms_save') and check_admin_referer('_ninja_forms_save', '_ninja_forms_admin_submit')) {
            $current_page = esc_html($_REQUEST['page']);
            $current_tab = ninja_forms_get_current_tab();
            $data_array = array();
            if (isset($_REQUEST['form_id']) and $_REQUEST['form_id'] != 'new') {
                $form_id = absint($_REQUEST['form_id']);
            } else {
                if (isset($_REQUEST['form_id']) and $_REQUEST['form_id'] == 'new') {
                    $form_id = 'new';
                } else {
                    $form_id = '';
                }
            }
            foreach ($_POST as $key => $val) {
                if (substr($key, 0, 1) != '_') {
                    $data_array[$key] = $val;
                }
            }
            $data_array = ninja_forms_stripslashes_deep($data_array);
            //$data_array = ninja_forms_esc_html_deep( $data_array );
            //Call any save functions registered to metaboxes
            if (isset($ninja_forms_tabs_metaboxes[$current_page][$current_tab]) and is_array($ninja_forms_tabs_metaboxes[$current_page][$current_tab]) and !empty($ninja_forms_tabs_metaboxes[$current_page][$current_tab])) {
                foreach ($ninja_forms_tabs_metaboxes[$current_page][$current_tab] as $slug => $opts) {
                    // Get the save function of our options, if set, and call them, passing the data that has been posted.
                    if (isset($opts['settings']) and !empty($opts['settings'])) {
                        foreach ($opts['settings'] as $setting) {
                            if (isset($setting['save_function'])) {
                                if (isset($form_id) and $form_id != '') {
                                    $arguments['form_id'] = $form_id;
                                }
                                $arguments['data'] = $data_array;
                                if ($setting['save_function'] != '') {
                                    if ($ninja_forms_admin_update_message != '') {
                                        $ninja_forms_admin_update_message .= ' ';
                                    }
                                    $ninja_forms_admin_update_message .= call_user_func_array($setting['save_function'], $arguments);
                                    do_action('ninja_forms_save_admin_metabox_option', $setting, $form_id, $data_array);
                                }
                            }
                        }
                    }
                    if (isset($opts['save_function'])) {
                        $save_function = $opts['save_function'];
                        $arguments = func_get_args();
                        array_shift($arguments);
                        // We need to remove the first arg ($function_name)
                        if (isset($form_id) and $form_id != '') {
                            $arguments['form_id'] = $form_id;
                        }
                        $arguments['data'] = $data_array;
                        if ($save_function != '') {
                            if ($ninja_forms_admin_update_message != '') {
                                $ninja_forms_admin_update_message .= ' ';
                            }
                            $ninja_forms_admin_update_message .= call_user_func_array($save_function, $arguments);
                            do_action('ninja_forms_save_admin_metabox', $slug, $form_id, $data_array);
                        }
                    }
                }
            }
            // Get the save function of our current sidebars, if present, and call them, passing the data that has been posted.
            if (isset($ninja_forms_sidebars[$current_page][$current_tab]) and is_array($ninja_forms_sidebars[$current_page][$current_tab])) {
                foreach ($ninja_forms_sidebars[$current_page][$current_tab] as $slug => $sidebar) {
                    if ($sidebar['save_function'] != '') {
                        $save_function = $sidebar['save_function'];
                        $arguments = func_get_args();
                        array_shift($arguments);
                        // We need to remove the first arg ($function_name)
                        if (isset($form_id) and $form_id != '') {
                            $arguments['form_id'] = $form_id;
                        }
                        $arguments['data'] = $data_array;
                        if ($save_function != '') {
                            if ($ninja_forms_admin_update_message != '') {
                                $ninja_forms_admin_update_message .= ' ';
                            }
                            $ninja_forms_admin_update_message .= call_user_func_array($save_function, $arguments);
                            do_action('ninja_forms_save_admin_sidebar', $slug, $form_id, $data_array);
                        }
                    }
                }
            }
            // Get the save function of our current tab and call it, passing the data that has been posted.
            $save_function = $ninja_forms_tabs[$current_page][$current_tab]['save_function'];
            $tab_reload = $ninja_forms_tabs[$current_page][$current_tab]['tab_reload'];
            $arguments = func_get_args();
            array_shift($arguments);
            // We need to remove the first arg ($function_name)
            if (isset($form_id) and $form_id != '') {
                $arguments['form_id'] = $form_id;
            }
            $arguments['data'] = $data_array;
            if ($save_function != '') {
                $ninja_forms_admin_update_message = call_user_func_array($save_function, $arguments);
                do_action('ninja_forms_save_admin_tab', $current_tab, $form_id, $data_array);
            }
//.........这里部分代码省略.........
开发者ID:baronwatts,项目名称:folio,代码行数:101,代码来源:save.php

示例12: ninja_forms_display_sidebars

function ninja_forms_display_sidebars($data)
{
    global $ninja_forms_sidebars;
    $current_tab = ninja_forms_get_current_tab();
    $current_page = esc_html($_REQUEST['page']);
    $opt = nf_get_settings();
    if (isset($opt['sidebars'][$current_page][$current_tab])) {
        $order = $opt['sidebars'][$current_page][$current_tab];
        if (!is_array($order)) {
            $order = array();
        }
        $ninja_forms_sidebars[$current_page][$current_tab] = ninja_forms_sidebar_sorter($ninja_forms_sidebars[$current_page][$current_tab], $order);
    }
    $plugin_settings = nf_get_settings();
    ?>
<div id="menu-settings-column" class="metabox-holder">
	<div id="side-sortables" class="meta-box-sortables ui-sortable">
		<?php 
    if (isset($ninja_forms_sidebars[$current_page][$current_tab]) and is_array($ninja_forms_sidebars[$current_page][$current_tab])) {
        foreach ($ninja_forms_sidebars[$current_page][$current_tab] as $slug => $sidebar) {
            if (isset($opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible']) and $opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible'] == 1 or !isset($opt['screen_options']['tab'][$current_tab]['sidebars'][$slug]['visible'])) {
                if (isset($plugin_settings['metabox_state'][$current_page][$current_tab][$slug])) {
                    $state = $plugin_settings['metabox_state'][$current_page][$current_tab][$slug];
                } else {
                    $state = '';
                }
                ?>
		<div id="ninja_forms_metabox_<?php 
                echo $slug;
                ?>
" class="postbox">
			<h3 class="hndl">
				<span><?php 
                _e($sidebar['name'], 'ninja-forms');
                ?>
</span>
			</h3>
			<span class="item-controls">
				<a class="item-edit metabox-item-edit" id="edit_id" title="<?php 
                _e('Edit Menu Item', 'ninja-forms');
                ?>
" href="#"><?php 
                _e('Edit Menu Item', 'ninja-forms');
                ?>
</a>
			</span>
			<div class="inside" id="ninja_forms_sidebar_<?php 
                echo $slug;
                ?>
" style="<?php 
                echo $state;
                ?>
">
				<?php 
                if (isset($sidebar['display_function']) and !empty($sidebar['display_function'])) {
                    $sidebar_callback = $sidebar['display_function'];
                    $arguments = func_get_args();
                    array_shift($arguments);
                    // We need to remove the first arg ($function_name)
                    $arguments['slug'] = $slug;
                    $arguments['data'] = $data;
                    call_user_func_array($sidebar_callback, $arguments);
                }
                if (isset($sidebar['settings']) and !empty($sidebar['settings'])) {
                    foreach ($sidebar['settings'] as $option) {
                        if (isset($option['p_class'])) {
                            $p_class = $option['p_class'];
                        } else {
                            $p_class = '';
                        }
                        ?>
						<p class="field-controls <?php 
                        echo $p_class;
                        ?>
">
						<?php 
                        if (isset($option['display_function']) and !empty($option['display_function'])) {
                            call_user_func_array($option['display_function'], $arguments);
                        } else {
                            $name = $option['name'];
                            if (isset($option['default_value'])) {
                                $value = $option['default_value'];
                            } else {
                                $value = '';
                            }
                            if (isset($data[$name])) {
                                $value = $data[$name];
                            }
                            if (isset($option['class'])) {
                                $class = $option['class'];
                            } else {
                                $class = '';
                            }
                            switch ($option['type']) {
                                case 'checkbox':
                                    ?>
									<input type="hidden" name="<?php 
                                    echo $name;
                                    ?>
" value="0">
//.........这里部分代码省略.........
开发者ID:serker72,项目名称:T3S,代码行数:101,代码来源:sidebar.php

示例13: ninja_forms_admin

function ninja_forms_admin()
{
    global $wpdb, $ninja_forms_tabs, $ninja_forms_sidebars, $current_tab, $ninja_forms_tabs_metaboxes, $ninja_forms_admin_update_message;
    $current_tab = ninja_forms_get_current_tab();
    $current_page = esc_html($_REQUEST['page']);
    if (isset($_REQUEST['form_id'])) {
        $form_id = absint($_REQUEST['form_id']);
        $form_row = ninja_forms_get_form_by_id($form_id);
        $data = $form_row['data'];
    } else {
        $form_id = '';
        $data = '';
    }
    if (!isset($ninja_forms_admin_update_message) and isset($_REQUEST['update_message'])) {
        $ninja_forms_admin_update_message = $_REQUEST['update_message'];
    }
    ?>
	<form id="ninja_forms_admin" enctype="multipart/form-data" method="post" name="" action="">
		<input type="hidden" name="_page" id="_page" value="<?php 
    echo $current_page;
    ?>
">
		<input type="hidden" name="_tab" id="_tab" value="<?php 
    echo $current_tab;
    ?>
">
		<input type="hidden" name="_form_id"  id="_form_id" value="<?php 
    echo $form_id;
    ?>
">
		<input type="hidden" name="_fields_order" id="_fields_order" value="same">
		<?php 
    wp_nonce_field('_ninja_forms_save', '_ninja_forms_admin_submit');
    ?>
		<div class="wrap">
			<?php 
    screen_icon('ninja-custom-forms');
    if (isset($ninja_forms_tabs[$current_page][$current_tab]['title'])) {
        echo $ninja_forms_tabs[$current_page][$current_tab]['title'];
    }
    if ($ninja_forms_tabs[$current_page][$current_tab]['show_tab_links']) {
        ?>
					<h2 class="nav-tab-wrapper">
						<?php 
        ninja_forms_display_tabs();
        ?>
					</h2>
					<?php 
    }
    if (isset($ninja_forms_admin_update_message) and $ninja_forms_admin_update_message != '') {
        ?>
					<div id="message" class="updated below-h2">
						<p>
							<?php 
        echo $ninja_forms_admin_update_message;
        ?>
						</p>
					</div>
					<?php 
    }
    if (isset($ninja_forms_sidebars[$current_page][$current_tab]) and is_array($ninja_forms_sidebars[$current_page][$current_tab])) {
        ?>
					<div id="nav-menus-frame">
						<?php 
        ninja_forms_display_sidebars($data);
        ?>

					</div><!-- /#menu-settings-column -->
					<?php 
    }
    ?>

			<div id="poststuff">
				<div id="post-body">
					<div id="post-body-content">
						<?php 
    //Check to see if the registered tab has a display function registered.
    if (isset($ninja_forms_tabs[$current_page][$current_tab]['display_function']) and $ninja_forms_tabs[$current_page][$current_tab]['display_function'] != '') {
        $tab_callback = $ninja_forms_tabs[$current_page][$current_tab]['display_function'];
        $arguments = func_get_args();
        array_shift($arguments);
        // We need to remove the first arg ($function_name)
        $arguments['form_id'] = $form_id;
        $arguments['data'] = $data;
        call_user_func_array($tab_callback, $arguments);
    }
    //Check to see if the registered tab has an metaboxes registered to it.
    if (isset($ninja_forms_tabs_metaboxes[$current_page][$current_tab]) and !empty($ninja_forms_tabs_metaboxes[$current_page][$current_tab])) {
        ?>
							<div id="ninja_forms_admin_metaboxes">
							<?php 
        foreach ($ninja_forms_tabs_metaboxes[$current_page][$current_tab] as $slug => $metabox) {
            ninja_forms_output_tab_metabox($form_id, $slug, $metabox);
        }
        ?>
							</div>
							<?php 
    }
    ?>
						<?php 
//.........这里部分代码省略.........
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:101,代码来源:admin.php


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