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);
                }
            }
        }
    }
}
Ejemplo n.º 2
0
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);
        }
    }
}
Ejemplo n.º 3
0
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')));
        }
    }
}
Ejemplo n.º 4
0
 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);
         }
     }
 }
Ejemplo n.º 5
0
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);
    }
    /**
     * We need to get a list of all of our RTEs. 
     * If we're submitting via ajax, we'll need to use this list.
     */
    if (!isset($nf_rte_editors)) {
        $nf_rte_editors = array();
    }
    $editors = new NF_WP_Editor_Ajax();
    if (is_array($edit_options) and !empty($edit_options)) {
        foreach ($edit_options as $opt) {
            $type = $opt['type'];
            $label_class = '';
            if (isset($opt['label'])) {
                $label = $opt['label'];
            } else {
                $label = '';
            }
            if (isset($opt['name'])) {
                $name = $opt['name'];
            } else {
                $name = '';
            }
            if (isset($opt['width'])) {
                $width = $opt['width'];
            } else {
                $width = '';
            }
            if (isset($opt['options'])) {
                $options = $opt['options'];
            } else {
                $options = '';
            }
            if (isset($opt['class'])) {
                $class = $opt['class'];
            } else {
                $class = '';
            }
            if (isset($opt['default'])) {
                $default = $opt['default'];
            } else {
                $default = '';
            }
            if (isset($opt['desc'])) {
                $desc = $opt['desc'];
            } else {
                $desc = '';
            }
            if (isset($field_data[$name])) {
                $value = $field_data[$name];
            } else {
                $value = $default;
            }
            ninja_forms_edit_field_el_output($field_id, $type, $label, $name, $value, $width, $options, $class, $desc, $label_class);
        }
    }
    add_action('nf_edit_field_advanced', 'nf_test', 10, 2);
    $settings_sections = apply_filters('nf_edit_field_settings_sections', array('restrictions' => __('Restriction Settings', 'ninja-forms'), 'calculations' => __('Calculation Settings', 'ninja-forms'), 'advanced' => __('Advanced Settings', 'ninja-forms')));
    foreach ($settings_sections as $key => $name) {
        ?>
		<div class="nf-field-settings description-wide description">
			<div class="title">
				<?php 
        echo $name;
        ?>
<span class="dashicons dashicons-arrow-down nf-field-sub-section-toggle"></span>
			</div>
			<div class="inside" style="display:none;">
				<?php 
        if (!empty($edit_settings[$key])) {
            foreach ($edit_settings[$key] as $opt) {
                $type = $opt['type'];
                $label_class = '';
                if (isset($opt['label'])) {
                    $label = $opt['label'];
                } else {
                    $label = '';
                }
                if (isset($opt['name'])) {
                    $name = $opt['name'];
                } else {
                    $name = '';
                }
                if (isset($opt['width'])) {
                    $width = $opt['width'];
                } else {
                    $width = '';
                }
                if (isset($opt['options'])) {
                    $options = $opt['options'];
                } else {
                    $options = '';
                }
                if (isset($opt['class'])) {
                    $class = $opt['class'];
                } else {
                    $class = '';
                }
                if (isset($opt['default'])) {
                    $default = $opt['default'];
                } else {
                    $default = '';
                }
                if (isset($opt['desc'])) {
                    $desc = $opt['desc'];
                } else {
                    $desc = '';
                }
                if (isset($field_data[$name])) {
                    $value = $field_data[$name];
                } else {
                    $value = $default;
                }
                ninja_forms_edit_field_el_output($field_id, $type, $label, $name, $value, $width, $options, $class, $desc, $label_class);
            }
        }
        do_action('nf_edit_field_' . $key, $field_id, $field_data);
        ?>
			</div>
		</div>
		<?php 
    }
    ?>
	<div class="menu-item-actions description-wide submitbox">
		<a class="submitdelete deletion nf-remove-field" id="ninja_forms_field_<?php 
    echo $field_id;
    ?>
_remove" data-field="<?php 
    echo $field_id;
    ?>
" href="#"><?php 
    _e('Remove', 'ninja-forms');
    ?>
</a>
	</div>
	<?php 
    if (!empty($nf_rte_editors) && isset($editors) && is_object($editors)) {
        $editors->output_js($field_id, $nf_rte_editors);
    }
}
Ejemplo n.º 6
0
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);
}
Ejemplo n.º 7
0
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 
                    }
                }
            }
        }
    }
}
Ejemplo n.º 8
0
Archivo: li.php Proyecto: serker72/T3S
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;
            ?>
" >
						<span class="item-title ninja-forms-field-title" id="ninja_forms_field_<?php 
            echo $field_id;
            ?>
_title"><?php 
            echo $li_label;
            ?>
</span>
						<span class="item-controls">
							<span class="item-type"><?php 
            echo $type_name;
            ?>
</span>
							<a class="item-edit metabox-item-edit" id="ninja_forms_field_<?php 
            echo $field_id;
            ?>
_toggle" title="<?php 
            _e('Edit Menu Item', 'ninja-forms');
            ?>
" href="#"><?php 
            _e('Edit Menu Item', 'ninja-forms');
            ?>
</a>
						</span>
					</dt>
				</dl>
				<?php 
            $slug = 'field_' . $field_id;
            if (isset($plugin_settings['metabox_state'][$current_page][$current_tab][$slug])) {
                $state = $plugin_settings['metabox_state'][$current_page][$current_tab][$slug];
            } else {
                $state = 'display:none;';
            }
            ?>
				<div class="menu-item-settings type-class inside" id="ninja_forms_field_<?php 
            echo $field_id;
            ?>
_inside" style="<?php 
            echo $state;
            ?>
">
					<table id="field-info"><tr><td width="65%"><?php 
            _e('Field ID', 'ninja-forms');
            ?>
: <strong><?php 
            echo $field_id;
            ?>
</strong></td><!-- <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> --> <td width="5%"><a href="#" class="<?php 
            echo $fav_class;
            ?>
" id="ninja_forms_field_<?php 
            echo $field_id;
            ?>
_fav">Star</a></td></tr></table>
			<?php 
            do_action('ninja_forms_edit_field_before_registered', $field_id);
            $arguments = func_get_args();
            array_shift($arguments);
            // We need to remove the first arg ($function_name)
            $arguments['field_id'] = $field_id;
            $arguments['data'] = $field_data;
            if ($edit_function != '') {
                call_user_func_array($edit_function, $arguments);
            }
            /**
             * We need to get a list of all of our RTEs. 
             * If we're submitting via ajax, we'll need to use this list.
             */
            if (!isset($nf_rte_editors)) {
                $nf_rte_editors = array();
            }
            $editors = new NF_WP_Editor_Ajax();
            if (is_array($edit_options) and !empty($edit_options)) {
                foreach ($edit_options as $opt) {
                    $type = $opt['type'];
                    $label_class = '';
                    if (isset($opt['label'])) {
                        $label = $opt['label'];
                    } else {
                        $label = '';
                    }
                    if (isset($opt['name'])) {
                        $name = $opt['name'];
                    } else {
                        $name = '';
                    }
                    if (isset($opt['width'])) {
                        $width = $opt['width'];
                    } else {
                        $width = '';
                    }
                    if (isset($opt['options'])) {
                        $options = $opt['options'];
                    } else {
                        $options = '';
                    }
                    if (isset($opt['class'])) {
                        $class = $opt['class'];
                    } else {
                        $class = '';
                    }
                    if (isset($opt['default'])) {
                        $default = $opt['default'];
                    } else {
                        $default = '';
                    }
                    if (isset($opt['desc'])) {
                        $desc = $opt['desc'];
                    } else {
                        $desc = '';
                    }
                    if (isset($field_data[$name])) {
                        $value = $field_data[$name];
                    } else {
                        $value = $default;
                    }
                    ninja_forms_edit_field_el_output($field_id, $type, $label, $name, $value, $width, $options, $class, $desc, $label_class);
                }
            }
            do_action('ninja_forms_edit_field_after_registered', $field_id);
        }
    } else {
        if (isset($ninja_forms_fields[$field_type])) {
            $reg_field = $ninja_forms_fields[$field_type];
            $edit_function = $reg_field['edit_function'];
            $arguments = func_get_args();
            array_shift($arguments);
            // We need to remove the first arg ($function_name)
            $arguments['field_id'] = $field_id;
            $arguments['data'] = $field_data;
            if ($edit_function != '') {
                call_user_func_array($edit_function, $arguments);
            }
        }
    }
    /**
     * We need to get a list of all of our RTEs. 
     * If we're submitting via ajax, we'll need to use this list.
     */
    if (isset($_POST['action']) && $_POST['action'] == 'ninja_forms_new_field') {
        if (!empty($nf_rte_editors) && isset($editors) && is_object($editors)) {
            $editors->output_js($field_id, $nf_rte_editors);
        }
    }
}
Ejemplo n.º 9
0
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;
}
Ejemplo n.º 10
0
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 
    }
    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 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 
    }
    //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);
    }
    if (isset($ninja_forms_tabs[$current_page][$current_tab]['show_save']) and $ninja_forms_tabs[$current_page][$current_tab]['show_save'] === true) {
        ?>
							<br />
							<input class="button-primary menu-save ninja-forms-save-data" id="ninja_forms_save_data_top" type="submit" value="<?php 
        _e('Save', 'ninja-forms');
        ?>
" />
						<?php 
    }
    ?>

					</div><!-- /#post-body-content -->
				</div><!-- /#post-body -->
			</div>
		</div>
	<!-- </div>/.wrap-->
	<?php 
    if ($output_form) {
        ?>
		</form>
		<?php 
    }
    ?>
	<div id="nf-admin-modal-backdrop" style="display: none;"></div>
	<div id="nf-admin-modal-wrap" class="wp-core-ui" style="display: none;">
		<div id="nf-admin-modal" tabindex="-1">
			<div id="admin-modal-title">
				<span id="nf-modal-title"></span>
				<button type="button" id="nf-admin-modal-close" class="modal-close"><span class="screen-reader-text modal-close">Close</span></button>
		 	</div>
		 	<div id="modal-contents-wrapper" style="padding:20px;">
				<div id="nf-admin-modal-content" class="admin-modal-inside">
					
				</div>
				<div class="submitbox" style="display:block;">
					
				</div>
			</div>
		</div>
	</div>

	<?php 
}
Ejemplo n.º 11
0
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);
            }
            if ($tab_reload) {
                $redirect_array = array('update_message' => urlencode($ninja_forms_admin_update_message));
                $url = esc_url_raw(add_query_arg($redirect_array));
                wp_redirect($url);
            }
        }
    }
}
Ejemplo n.º 12
0
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">
									<input type="checkbox" name="<?php 
                                    echo $name;
                                    ?>
" id="<?php 
                                    echo $name;
                                    ?>
" value="1" <?php 
                                    checked(1, $value);
                                    ?>
>
									<label for="<?php 
                                    echo $name;
                                    ?>
"><?php 
                                    _e($option['label'], 'ninja-forms');
                                    ?>
</label>
									<?php 
                                    break;
                                case 'radio':
                                    ?>
									<label for="<?php 
                                    echo $name;
                                    ?>
"><?php 
                                    _e($option['label'], 'ninja-forms');
                                    ?>
</label>
									<?php 
                                    if (isset($option['options'])) {
                                        $x = 0;
                                        foreach ($option['options'] as $option) {
                                            ?>
												<input type="radio" id="<?php 
                                            echo $name . '_' . $x;
                                            ?>
" value="<?php 
                                            echo $option['value'];
                                            ?>
" <?php 
                                            checked($option['value'], $value);
                                            ?>
 name="<?php 
                                            echo $name;
                                            ?>
">
												<label for="<?php 
                                            echo $name . '_' . $x;
                                            ?>
"><?php 
                                            echo $option['name'];
                                            ?>
</label>
												<?php 
                                            $x++;
                                        }
                                    }
                                    break;
                                case 'select':
                                    ?>
									<label for="<?php 
                                    echo $name;
                                    ?>
"><?php 
                                    _e($option['label'], 'ninja-forms');
                                    ?>
</label>
									<select name="<?php 
                                    echo $name;
                                    ?>
" id="<?php 
                                    echo $name;
                                    ?>
">
										<?php 
                                    if (isset($option['options'])) {
                                        foreach ($option['options'] as $option) {
                                            ?>
												<option value="<?php 
                                            echo $option['value'];
                                            ?>
" <?php 
                                            selected($option['value'], $value);
                                            ?>
><?php 
                                            echo $option['name'];
                                            ?>
</option>
												<?php 
                                        }
                                    }
                                    ?>
									</select>
									<?php 
                                    break;
                                case 'text':
                                    ?>
									<label for="<?php 
                                    echo $name;
                                    ?>
"><?php 
                                    _e($option['label'], 'ninja-forms');
                                    ?>
</label>
									<input type="text" name="<?php 
                                    echo $name;
                                    ?>
" id="<?php 
                                    echo $name;
                                    ?>
" value="<?php 
                                    echo $value;
                                    ?>
">
									<?php 
                                    break;
                                case 'textarea':
                                    ?>
									<label for="<?php 
                                    echo $name;
                                    ?>
"><?php 
                                    _e($option['label'], 'ninja-forms');
                                    ?>
</label>
									<textarea name="<?php 
                                    echo $name;
                                    ?>
" id="<?php 
                                    echo $name;
                                    ?>
"><?php 
                                    echo $value;
                                    ?>
</textarea>
									<?php 
                                    break;
                                case 'submit':
                                    ?>
									<input type="submit" name="submit" id="" class="<?php 
                                    echo $class;
                                    ?>
" value="<?php 
                                    _e('View Submissions', 'ninja-forms');
                                    ?>
">
									<?php 
                                    break;
                            }
                            if (isset($option['help']) and !empty($option['help'])) {
                                ?>
								<a href="#" class="tooltip">
								    <img id="" class='ninja-forms-help-text' src="<?php 
                                echo NINJA_FORMS_URL;
                                ?>
images/question-ico.gif" title="">
								    <span>
								        <img class="callout" src="<?php 
                                echo NINJA_FORMS_URL;
                                ?>
/images/callout.gif" />
								        <?php 
                                _e($option['help'], 'ninja-forms');
                                ?>
								    </span>
								</a>

								<?php 
                            }
                            if (isset($option['desc']) and !empty($option['desc'])) {
                                ?>
								<span class="howto"><?php 
                                echo $option['desc'];
                                ?>
</span>
								<?php 
                            }
                        }
                        ?>
						</p>
						<?php 
                    }
                }
                ?>
			</div>

		</div>
		<?php 
            }
        }
    }
    ?>
	</div>
<?php 
}
Ejemplo n.º 13
0
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 
    if (isset($ninja_forms_tabs[$current_page][$current_tab]['show_save']) and $ninja_forms_tabs[$current_page][$current_tab]['show_save'] === true) {
        ?>
							<br />
							<input class="button-primary menu-save ninja-forms-save-data" id="ninja_forms_save_data_top" type="submit" value="<?php 
        _e('Save Form Settings', 'ninja-forms');
        ?>
" />
						<?php 
    }
    ?>

					</div><!-- /#post-body-content -->
				</div><!-- /#post-body -->
			</div>
		</div>
	<!-- </div>/.wrap-->
</form>
<?php 
}