Example #1
0
function ninja_forms_register_feditor_post_settings_metabox()
{
    //Get an array of post types for our post type option.
    $post_types = get_post_types();
    //Remove the built-in post types that we aren't using.
    unset($post_types['nav_menu_item']);
    unset($post_types['mediapage']);
    unset($post_types['attachment']);
    unset($post_types['revision']);
    //Loop through the remaining post types and put the array in ['name'] and ['value'] format.
    $tmp_array = array();
    $x = 0;
    foreach ($post_types as $type) {
        $type_obj = get_post_type_object($type);
        $tmp_array[$x]['name'] = $type_obj->labels->singular_name;
        $tmp_array[$x]['value'] = $type_obj->name;
        $x++;
    }
    $post_types = $tmp_array;
    //Get a list of user roles
    $all_roles = get_editable_roles();
    //Reset the tmp_array variable to store our user roles array
    $tmp_array = array();
    $tmp_array[] = array('name' => __('Non-logged in user', 'ninja-forms-feditor'), 'value' => '_none');
    foreach ($all_roles as $key => $role) {
        $tmp_array[] = array('name' => $role['name'], 'value' => $key);
    }
    $all_roles = $tmp_array;
    $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'create_post', 'title' => __('Post creation settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'create_post', 'type' => 'checkbox', 'desc' => '', 'label' => __('Create Post From Input?', 'ninja-forms-feditor'), 'display_function' => '', 'help' => __('If this box is checked, Ninja Forms will create a post from user input.', 'ninja-forms-feditor'), 'default' => 0), array('name' => 'post_as', 'type' => '', 'desc' => '', 'label' => __('Users must be logged in to create post?', 'ninja-forms-feditor'), 'display_function' => 'ninja_forms_metabox_post_as', 'help' => ''), array('name' => 'post_status', 'type' => 'select', 'options' => array(array('name' => 'Draft', 'value' => 'draft'), array('name' => 'Pending', 'value' => 'pending'), array('name' => 'Publish', 'value' => 'publish')), 'desc' => '', 'label' => __('Select a post status', 'ninja-forms-feditor'), 'display_function' => '', 'help' => ''), array('name' => 'post_type', 'type' => 'select', 'desc' => '', 'options' => $post_types, 'label' => __('Select a post type', 'ninja-forms-feditor'), 'display_function' => '', 'help' => '', 'class' => 'ninja-forms-post-type'), array('name' => 'comment_status', 'type' => 'checkbox', 'label' => __('Allow Comments', 'ninja-forms-feditor')), array('name' => 'before_post_terms', 'type' => '', 'label' => '', 'display_function' => 'ninja_forms_metabox_before_post_terms'), array('name' => 'post_terms', 'type' => '', 'desc' => '', 'label' => __('Default post terms', 'ninja-forms-feditor'), 'display_function' => 'ninja_forms_metabox_post_terms', 'help' => ''), array('name' => 'post_tags', 'type' => 'text', 'label' => __('Default post tags', 'ninja-forms-feditor'), 'display_function' => '', 'help' => '', 'desc' => __('Comma separated list', 'ninja-forms-feditor')), array('name' => 'post_title', 'type' => 'text', 'label' => __('Default post title', 'ninja-forms-feditor')), array('name' => 'post_content', 'type' => 'rte', 'label' => __('Default Post Content', 'ninja-forms-feditor'), 'display_function' => ''), array('name' => 'post_content_location', 'type' => 'radio', 'label' => __('Where should the default content be placed?', 'ninja-forms-feditor'), 'options' => array(array('name' => 'Before user submitted content', 'value' => 'prepend'), array('name' => 'After user submitted content', 'value' => 'append')), 'desc' => __('If you do not have a "Post Content" field in your form, the default content will be used instead of the main content.', 'ninja-forms-feditor')), array('name' => 'post_excerpt', 'type' => 'rte', 'label' => __('Default Post Excerpt', 'ninja-forms-feditor'), 'display_function' => ''), array('name' => '', 'type' => '', 'display_function' => 'ninja_forms_feditor_metabox_hr'), array('name' => 'enable_post_edit', 'type' => 'checkbox', 'label' => __('Enable Front-End Post Editing', 'ninja-forms-feditor'), 'desc' => __('If this box is unchecked, users will NOT be able to edit this post, regardless of rules settings.', 'ninja-forms-feditor'), 'default_value' => 1), array('name' => 'override_post_edit', 'type' => 'checkbox', 'label' => __('Override Editing Rules Settings', 'ninja-forms-feditor'), 'desc' => __('If this box is checked, the settings below will override any rules settings that may apply.', 'ninja-forms-feditor')), array('name' => 'enable_post_delete', 'type' => 'checkbox', 'label' => __('Allow Users To Delete This Post', 'ninja-forms-feditor'), 'desc' => __('This setting will only be used if the "Override" option above is set.', 'ninja-forms-feditor')), array('name' => 'post_edit_author', 'type' => 'checkbox', 'label' => __('Allow the author to edit this post', 'ninja-forms-feditor'), 'desc' => __('This setting will only be used if the "Override" option above is set.', 'ninja-forms-feditor')), array('name' => '', 'type' => '', 'label' => '', 'display_function' => 'ninja_forms_feditor_metabox_post_edit_users', 'desc' => __('This setting will only be used if the "Override" option above is set.', 'ninja-forms-feditor')), array('name' => 'post_edit_roles', 'type' => 'checkbox_list', 'label' => __('Allow these roles to edit', 'ninja-forms-feditor'), 'options' => $all_roles, 'desc' => __('This setting will only be used if the "Override" option above is set.', 'ninja-forms-feditor'))));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
Example #2
0
 public function register_settings()
 {
     $args = array('page' => 'ninja-forms-uploads', 'tab' => 'external_settings', 'slug' => $this->slug . '_settings', 'title' => sprintf(__('%s Settings', 'ninja-forms-uploads'), $this->title), 'settings' => $this->settings);
     if (function_exists('ninja_forms_register_tab_metabox')) {
         ninja_forms_register_tab_metabox($args);
     }
 }
Example #3
0
function ninja_forms_register_upload_settings_metabox()
{
    $args = array('page' => 'ninja-forms-uploads', 'tab' => 'upload_settings', 'slug' => 'upload_settings', 'title' => __('Upload Settings', 'ninja-forms'), 'settings' => array(array('name' => 'max_file_size', 'type' => 'text', 'label' => __('Max File Size (in MB)', 'ninja-forms'), 'desc' => ''), array('name' => 'upload_error', 'type' => 'text', 'label' => __('File upload error message', 'ninja-forms'), 'desc' => ''), array('name' => 'adv_settings', 'type' => '', 'display_function' => 'ninja_forms_upload_settings_adv')));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
Example #4
0
function ninja_forms_register_feditor_sub_settings_metabox()
{
    $all_roles = get_editable_roles();
    $tmp_array = array();
    if (is_array($all_roles) and !empty($all_roles)) {
        foreach ($all_roles as $key => $role) {
            $tmp_array[] = array('name' => $role['name'], 'value' => $key);
        }
    }
    $all_roles = $tmp_array;
    $edit_table_cols = array();
    if (isset($_REQUEST['form_id'])) {
        $form_id = $_REQUEST['form_id'];
        $fields = ninja_forms_get_fields_by_form_id($form_id);
        foreach ($fields as $field) {
            if (isset($field['data']['label'])) {
                $edit_table_cols[] = array('name' => $field['data']['label'], 'value' => $field['id']);
            } else {
                $edit_table_cols[] = array('name' => 'Field ID: ' . $field['id'], 'value' => $field['id']);
            }
        }
    } else {
    }
    $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'sub_settings', 'title' => __('Submission management settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'manage_sub', 'type' => 'checkbox', 'label' => __('Enable front-end submission management', 'ninja-forms-feditor'), 'default_value' => 1), array('name' => 'manage_sub_table', 'type' => 'checkbox', 'label' => __('Show submission management table above this form?', 'ninja-forms-feditor'), 'default_value' => 1), array('name' => 'manage_sub_table_cols', 'type' => 'multi_select', 'label' => __('Use these fields as table columns', 'ninja-forms-feditor'), 'options' => $edit_table_cols, 'size' => 10, 'desc' => __('Use CTRL + click to select multiple fields (COMMAND + click for Mac users). The number of field columns you want will depend upon the size of your field labels and values. Three is a good, standard value.', 'ninja-forms-feditor')), array('name' => 'manage_sub_hide_form', 'type' => 'checkbox', 'label' => __('Hide this form when a user has submissions to manage', 'ninja-forms-feditor')), array('name' => 'override_sub_rules', 'type' => 'checkbox', 'label' => __('Override rules settings', 'ninja-forms-feditor')), array('name' => '', 'type' => '', 'label' => '', 'display_function' => 'ninja_forms_feditor_sub_settings_user_list'), array('name' => 'manage_sub_roles', 'type' => 'checkbox_list', 'select_all' => false, 'options' => $all_roles, 'label' => __('Allow these roles', 'ninja-forms')), array('name' => 'edit_sub', 'type' => 'checkbox', 'label' => __('To Edit Submissions', 'ninja-forms-feditor')), array('name' => 'delete_sub', 'type' => 'checkbox', 'label' => __('To Delete Submissions', 'ninja-forms-feditor'))));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
Example #5
0
function ninja_forms_register_form_settings_basic_metabox()
{
    if (isset($_REQUEST['form_id'])) {
        $form_id = absint($_REQUEST['form_id']);
        $form_data = Ninja_Forms()->form($form_id)->get_all_settings();
    } else {
        $form_id = '';
        $form_row = '';
        $form_data = '';
    }
    $pages = get_pages();
    $pages_array = array();
    $append_array = array();
    array_push($pages_array, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
    array_push($append_array, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
    foreach ($pages as $pagg) {
        array_push($pages_array, array('name' => $pagg->post_title, 'value' => get_page_link($pagg->ID)));
        array_push($append_array, array('name' => $pagg->post_title, 'value' => $pagg->ID));
    }
    if (isset($form_data['ajax'])) {
        $ajax = $form_data['ajax'];
    } else {
        $ajax = 0;
    }
    $args = apply_filters('ninja_forms_form_settings_basic', array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'basic_settings', 'title' => __('Display', 'ninja-forms'), 'state' => 'closed', 'settings' => array(array('name' => 'form_title', 'type' => 'text', 'label' => __('Form Title', 'ninja-forms')), array('name' => 'show_title', 'type' => 'checkbox', 'label' => __('Display Form Title', 'ninja-forms')), array('name' => 'append_page', 'type' => 'select', 'desc' => '', 'label' => __('Add form to this page', 'ninja-forms'), 'display_function' => '', 'help' => '', 'options' => $append_array), array('name' => 'ajax', 'type' => 'checkbox', 'desc' => '', 'label' => __('Submit via AJAX (without page reload)?', 'ninja-forms'), 'display_function' => '', 'help' => ''), array('name' => 'clear_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Clear successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will clear the form values after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1), array('name' => 'hide_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Hide successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will hide the form after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1))));
    ninja_forms_register_tab_metabox($args);
    $args = apply_filters('ninja_forms_form_settings_restrictions', array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'restrictions', 'title' => __('Restrictions', 'ninja-forms'), 'state' => 'closed', 'settings' => array(array('name' => 'logged_in', 'type' => 'checkbox', 'desc' => '', 'label' => __('Require user to be logged in to view form?', 'ninja-forms'), 'display_function' => '', 'help' => ''), array('name' => 'not_logged_in_msg', 'type' => 'rte', 'label' => __('Not Logged-In Message', 'ninja-forms'), 'desc' => __('Message shown to users if the "logged in" checkbox above is checked and they are not logged-in.', 'ninja-forms'), 'tr_class' => ''), array('name' => 'sub_limit_number', 'type' => 'number', 'desc' => '', 'label' => __('Limit Submissions', 'ninja-forms'), 'display_function' => '', 'desc' => __('Select the number of submissions that this form will accept. Leave empty for no limit.', 'ninja-forms'), 'default_value' => '', 'tr_class' => '', 'min' => 0), array('name' => 'sub_limit_msg', 'type' => 'rte', 'label' => __('Limit Reached Message', 'ninja-forms'), 'desc' => __('Please enter a message that you want displayed when this form has reached its submission limit and will not accept new submissions.', 'ninja-forms'), 'tr_class' => ''))));
    ninja_forms_register_tab_metabox($args);
}
function ninja_forms_register_upload_settings_metabox()
{
    $max_filesize = nf_return_mb(ini_get('upload_max_filesize'));
    $args = array('page' => 'ninja-forms-uploads', 'tab' => 'upload_settings', 'slug' => 'upload_settings', 'title' => __('Upload Settings', 'ninja-forms-uploads'), 'settings' => array(array('name' => 'max_filesize', 'type' => 'text', 'label' => __('Max File Size (in MB)', 'ninja-forms-uploads'), 'desc' => sprintf(__('Your server\'s maximum file size is set to %s. This setting cannot be increased beyond this value. To increase your server file size limit, please contact your host.', 'ninja-forms-uploads'), $max_filesize)), array('name' => 'upload_error', 'type' => 'text', 'label' => __('File upload error message', 'ninja-forms-uploads'), 'desc' => ''), array('name' => 'adv_settings', 'type' => '', 'display_function' => 'ninja_forms_upload_settings_adv')));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
Example #7
0
function ninja_forms_register_feditor_sub_edit_tab()
{
    $args = array('name' => __('Submission Editing', 'ninja-forms-feditor'), 'page' => 'ninja-forms-feditor', 'display_function' => '', 'save_function' => 'ninja_forms_save_feditor_sub_edit', 'show_save' => false);
    if (function_exists('ninja_forms_register_tab')) {
        ninja_forms_register_tab('sub_editing', $args);
    }
    $args = array('page' => 'ninja-forms-feditor', 'tab' => 'sub_editing', 'slug' => 'rules', 'title' => __('Submission Editing Rules', 'ninja-forms-feditor'), 'display_function' => 'ninja_forms_feditor_sub_edit_rules', 'state' => 'closed', 'display_container' => false);
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
Example #8
0
function ninja_forms_register_register_settings_tab()
{
    $args = array('name' => __('Register', 'ninja-forms-feditor'), 'page' => 'ninja-forms-feditor', 'display_function' => '', 'save_function' => 'ninja_forms_save_register_settings', 'tab_reload' => true);
    if (function_exists('ninja_forms_register_tab')) {
        ninja_forms_register_tab('register_settings', $args);
    }
    $args = array('page' => 'ninja-forms-feditor', 'tab' => 'register_settings', 'slug' => 'settings', 'title' => __('Registration Settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'open');
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
Example #9
0
function ninja_forms_register_general_settings_metabox()
{
    $plugin_settings = nf_get_settings();
    if (isset($plugin_settings['version'])) {
        $current_version = $plugin_settings['version'];
    } else {
        $current_version = NF_PLUGIN_VERSION;
    }
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'general_settings', 'slug' => 'general_settings', 'title' => __('General Settings', 'ninja-forms'), 'settings' => array(array('name' => 'version', 'type' => 'desc', 'label' => __('Version', 'ninja-forms'), 'desc' => $current_version), array('name' => 'date_format', 'type' => 'text', 'label' => __('Date Format', 'ninja-forms'), 'desc' => __('e.g. m/d/Y, d/m/Y - Tries to follow the <a href="http://www.php.net/manual/en/function.date.php" target="_blank">PHP date() function</a> specifications, but not every format is supported.', 'ninja-forms')), array('name' => 'currency_symbol', 'type' => 'text', 'label' => __('Currency Symbol', 'ninja-forms'), 'desc' => __('e.g. $, &pound;, &euro;', 'ninja-forms'))));
    ninja_forms_register_tab_metabox($args);
}
Example #10
0
function ninja_forms_register_mp_settings_metabox()
{
    $effects = array(array('name' => 'Blind', 'value' => 'blind'), array('name' => 'Fade', 'value' => 'fade'), array('name' => 'Fold', 'value' => 'fold'), array('name' => 'Slide', 'value' => 'slide'));
    $effects = apply_filters('ninja_forms_mp_ajax_effects_array', $effects);
    $direction = array(array('name' => 'Left to Right', 'value' => 'ltr'), array('name' => 'Right to Left', 'value' => 'rtl'), array('name' => 'Top to Bottom', 'value' => 'ttb'), array('name' => 'Bottom to Top', 'value' => 'btt'));
    $direction = apply_filters('ninja_forms_mp_ajax_directions_array', $direction);
    $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'multi_part', 'title' => __('Multi-Part settings', 'ninja-forms-mp'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'multi_part', 'type' => 'checkbox', 'desc' => '', 'label' => __('Enable Multi-Part Form?', 'ninja-forms-mp'), 'display_function' => '', 'help' => __('If this box is checked Ninja Forms will allow multi-part form pages to be created.', 'ninja-forms-mp'), 'default' => 0), array('name' => 'mp_progress_bar', 'type' => 'checkbox', 'desc' => '', 'label' => __('Display Progress Bar?', 'ninja-forms-mp'), 'display_function' => '', 'help' => '', 'default' => 0), array('name' => 'mp_breadcrumb', 'type' => 'checkbox', 'desc' => '', 'label' => __('Display Breadcrumb Navigation?', 'ninja-forms-mp'), 'display_function' => '', 'help' => '', 'default' => 0), array('name' => 'mp_display_titles', 'type' => 'checkbox', 'desc' => '', 'label' => __('Display Page Titles?', 'ninja-forms-mp'), 'display_function' => '', 'help' => '', 'default' => 0), array('name' => 'mp_ajax_effect', 'type' => 'select', 'options' => $effects, 'desc' => '', 'label' => __('Ajax Page Transition Effect', 'ninja-forms-mp'), 'display_function' => '', 'help' => '', 'default_value' => 'slide'), array('name' => 'mp_ajax_direction', 'type' => 'select', 'options' => $direction, 'label' => __('Ajax Page Transition Direction', 'ninja-forms-mp')), array('name' => 'mp_confirm', 'type' => 'checkbox', 'label' => __('Show Review Page', 'ninja-forms-mp'), 'desc' => __('This page will allow your users to review and modify their fields on one page before they submit the form.', 'ninja-forms')), array('name' => 'mp_confirm_msg', 'type' => 'rte', 'label' => __('Review Page Message', 'ninja-forms-mp'), 'desc' => __('This message will be shown to users at the top of the review page.', 'ninja-forms'))), 'save_function' => 'ninja_forms_mp_save_form');
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
function ninja_forms_register_feditor_registration_settings_metabox($form_id)
{
    $roles_array = array();
    $all_roles = get_editable_roles();
    $roles_array[] = array('name' => __('- None', 'ninja-forms-feditor'), 'value' => '');
    foreach ($all_roles as $key => $role) {
        $roles_array[] = array('name' => $role['name'], 'value' => $key);
    }
    $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'registration_settings', 'title' => __('Registration settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'register_user_role', 'type' => 'select', 'options' => $roles_array, 'label' => __('Users register as', 'ninja-forms-feditor'))));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
function ninja_forms_register_general_settings_metabox()
{
    $plugin_settings = nf_get_settings();
    if (isset($plugin_settings['version'])) {
        $current_version = $plugin_settings['version'];
    } else {
        $current_version = NF_PLUGIN_VERSION;
    }
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'general_settings', 'slug' => 'general_settings', 'title' => __('General Settings', 'ninja-forms'), 'settings' => array(array('name' => 'version', 'type' => 'desc', 'label' => __('Version', 'ninja-forms'), 'desc' => $current_version), array('name' => 'date_format', 'type' => 'text', 'label' => __('Date Format', 'ninja-forms'), 'desc' => 'e.g. m/d/Y, d/m/Y - ' . sprintf(__('Tries to follow the %sPHP date() function%s specifications, but not every format is supported.', 'ninja-forms'), '<a href="http://www.php.net/manual/en/function.date.php" target="_blank">', '</a>')), array('name' => 'currency_symbol', 'type' => 'text', 'label' => __('Currency Symbol', 'ninja-forms'), 'desc' => 'e.g. $, &pound;, &euro;')));
    ninja_forms_register_tab_metabox($args);
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'general_settings', 'slug' => 'advanced_settings', 'title' => __('Advanced Settings', 'ninja-forms'), 'settings' => array(array('name' => 'delete_on_uninstall', 'type' => 'checkbox', 'label' => __('Remove ALL Ninja Forms data upon uninstall?', 'ninja-forms'), 'desc' => sprintf(__('If this box is checked, ALL Ninja Forms data will be removed from the database upon deletion. %sAll form and submission data will be unrecoverable.%s', 'ninja-forms'), '<span class="nf-nuke-warning">', '</span>'))), 'state' => 'closed');
    ninja_forms_register_tab_metabox($args);
}
Example #13
0
function ninja_forms_register_feditor_style_settings_metaboxes()
{
    $plugin_settings = get_option('ninja_forms_settings');
    if (isset($plugin_settings['feditor'])) {
        $feditor_settings = $plugin_settings['feditor'];
    } else {
        $feditor_settings = '';
    }
    if (isset($feditor_settings['_post_editor'])) {
        $post_editor = $feditor_settings['_post_editor'];
    } else {
        $post_editor = '';
    }
    if (isset($feditor_settings['_page_editor'])) {
        $page_editor = $feditor_settings['_page_editor'];
    } else {
        $page_editor = '';
    }
    if (isset($feditor_settings['_profile_editor'])) {
        $profile_editor = $feditor_settings['_profile_editor'];
    } else {
        $profile_editor = '';
    }
    if (isset($feditor_settings['_registration_form'])) {
        $registration_form = $feditor_settings['_registration_form'];
    } else {
        $registration_form = '';
    }
    if (isset($feditor_settings['_login_form'])) {
        $login_form = $feditor_settings['_login_form'];
    } else {
        $login_form = '';
    }
    if (isset($feditor_settings['_lost_password'])) {
        $lost_password = $feditor_settings['_lost_password'];
    } else {
        $lost_password = '';
    }
    if (isset($feditor_settings['_reset_password'])) {
        $reset_password = $feditor_settings['_reset_password'];
    } else {
        $reset_password = '';
    }
    $args = array('page' => 'ninja-forms-feditor', 'tab' => 'style_settings', 'slug' => 'style_settings', 'title' => __('Style Settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => '', 'type' => 'desc', 'label' => '<a href="admin.php?page=ninja-forms&tab=form_layout&edit_style=true&form_id=' . $post_editor . '">' . __('Default Post Editor Styling', 'ninja-forms-feditor') . '</a>'), array('name' => '', 'type' => 'desc', 'label' => '<a href="admin.php?page=ninja-forms&tab=form_layout&edit_style=true&form_id=' . $page_editor . '">' . __('Default Page Editor Styling', 'ninja-forms-feditor')), array('name' => '', 'type' => 'desc', 'label' => '<a href="admin.php?page=ninja-forms&tab=form_layout&edit_style=true&form_id=' . $profile_editor . '">' . __('Default Profile Editor Styling', 'ninja-forms-feditor')), array('name' => '', 'type' => 'desc', 'label' => '<a href="admin.php?page=ninja-forms&tab=form_layout&edit_style=true&form_id=' . $registration_form . '">' . __('Default Registration Form Styling', 'ninja-forms-feditor')), array('name' => '', 'type' => 'desc', 'label' => '<a href="admin.php?page=ninja-forms&tab=form_layout&edit_style=true&form_id=' . $login_form . '">' . __('Default Login Form Styling', 'ninja-forms-feditor')), array('name' => '', 'type' => 'desc', 'label' => '<a href="admin.php?page=ninja-forms&tab=form_layout&edit_style=true&form_id=' . $lost_password . '">' . __('Default Lost Password Form Styling', 'ninja-forms-feditor')), array('name' => '', 'type' => 'desc', 'label' => '<a href="admin.php?page=ninja-forms&tab=form_layout&edit_style=true&form_id=' . $reset_password . '">' . __('Default Reset Password Form Styling', 'ninja-forms-feditor'))));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
Example #14
0
function ninja_forms_register_exp_forms_metabox()
{
    $form_results = ninja_forms_get_all_forms();
    $form_select = array();
    if (is_array($form_results) and !empty($form_results)) {
        foreach ($form_results as $form) {
            if (isset($form['data'])) {
                $data = $form['data'];
                $form_title = $data['form_title'];
                array_push($form_select, array('name' => $form_title, 'value' => $form['id']));
            }
        }
    }
    $args = array('page' => 'ninja-forms-impexp', 'tab' => 'impexp_forms', 'slug' => 'exp_form', 'title' => __('Export a form', 'ninja-forms'), 'settings' => array(array('name' => 'form_id', 'type' => 'select', 'label' => __('Select a form', 'ninja-forms'), 'desc' => '', 'options' => $form_select, 'help_text' => ''), array('name' => 'submit', 'type' => 'submit', 'label' => __('Export Form', 'ninja-forms'), 'class' => 'button-secondary')));
    ninja_forms_register_tab_metabox($args);
}
function ninja_forms_register_general_settings_metabox()
{
    $plugin_settings = nf_get_settings();
    if (isset($plugin_settings['version'])) {
        $current_version = $plugin_settings['version'];
    } else {
        $current_version = NF_PLUGIN_VERSION;
    }
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'general_settings', 'slug' => 'general_settings', 'title' => __('General Settings', 'ninja-forms'), 'settings' => array(array('name' => 'version', 'type' => 'desc', 'label' => __('Version', 'ninja-forms'), 'desc' => $current_version), array('name' => 'date_format', 'type' => 'text', 'label' => __('Date Format', 'ninja-forms'), 'desc' => 'e.g. m/d/Y, d/m/Y - ' . sprintf(__('Tries to follow the %sPHP date() function%s specifications, but not every format is supported.', 'ninja-forms'), '<a href="http://www.php.net/manual/en/function.date.php" target="_blank">', '</a>')), array('name' => 'currency_symbol', 'type' => 'text', 'label' => __('Currency Symbol', 'ninja-forms'), 'desc' => 'e.g. $, &pound;, &euro;')));
    ninja_forms_register_tab_metabox($args);
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'general_settings', 'slug' => 'recaptcha_settings', 'title' => __('reCAPTCHA Settings', 'ninja-forms'), 'settings' => array(array('name' => 'recaptcha_site_key', 'type' => 'text', 'label' => __('reCAPTCHA Site Key', 'ninja-forms'), 'desc' => sprintf(__('Get a site key for your domain by registering  %shere%s', 'ninja-forms'), '<a href="https://www.google.com/recaptcha/intro/index.html" target="_blank">', '</a>')), array('name' => 'recaptcha_secret_key', 'type' => 'text', 'label' => __('reCAPTCHA Secret Key', 'ninja-forms'), 'desc' => ''), array('name' => 'recaptcha_lang', 'type' => 'text', 'label' => __('reCAPTCHA Language', 'ninja-forms'), 'desc' => 'e.g. en, da - ' . sprintf(__('Language used by reCAPTCHA. To get the code for your language click %shere%s', 'ninja-forms'), '<a href="https://developers.google.com/recaptcha/docs/language" target="_blank">', '</a>'))), 'state' => 'closed');
    $args['settings'] = apply_filters('nf_general_settings_recaptcha', $args['settings']);
    ninja_forms_register_tab_metabox($args);
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'general_settings', 'slug' => 'advanced_settings', 'title' => __('Advanced Settings', 'ninja-forms'), 'settings' => array(array('name' => 'delete_on_uninstall', 'type' => 'checkbox', 'label' => __('Remove ALL Ninja Forms data upon uninstall?', 'ninja-forms'), 'desc' => sprintf(__('If this box is checked, ALL Ninja Forms data will be removed from the database upon deletion. %sAll form and submission data will be unrecoverable.%s', 'ninja-forms'), '<span class="nf-nuke-warning">', '</span>')), array('name' => 'delete_prompt', 'type' => '', 'display_function' => 'nf_delete_on_uninstall_prompt')), 'state' => 'closed');
    $args['settings'] = apply_filters('nf_general_settings_advanced', $args['settings']);
    ninja_forms_register_tab_metabox($args);
}
Example #16
0
function ninja_forms_register_exp_fav_fields_metabox()
{
    $fav_results = ninja_forms_get_all_favs();
    $fav_options = array();
    if (is_array($fav_results) and !empty($fav_results)) {
        foreach ($fav_results as $fav) {
            $data = $fav['data'];
            $label = $data['label'];
            array_push($fav_options, array('name' => $label, 'value' => $fav['id']));
        }
        $empty = '';
    } else {
        $empty = __('No Favorite Fields Found', 'ninja-forms');
    }
    $args = array('page' => 'ninja-forms-impexp', 'tab' => 'impexp_fields', 'slug' => 'exp_fields', 'title' => __('Export Favorite Fields', 'ninja-forms'), 'settings' => array(array('name' => 'ninja_forms_fav', 'type' => 'checkbox_list', 'label' => '', 'desc' => '', 'options' => $fav_options, 'help_text' => ''), array('name' => '', 'type' => 'desc', 'label' => $empty), array('name' => 'submit', 'type' => 'submit', 'label' => __('Export Fields', 'ninja-forms'), 'class' => 'button-secondary')));
    ninja_forms_register_tab_metabox($args);
}
Example #17
0
 /**
  * Add form notification settings
  *
  * @return void
  */
 function pushover_notifications_metabox()
 {
     $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'pushover', 'title' => __('Pushover', 'nf-pushover'), 'display_function' => '', 'state' => 'closed', 'settings' => array());
     if (isset($this->settings['nf-pushover']['api-key']) && !empty($this->settings['nf-pushover']['api-key'])) {
         $args['settings'][] = array('name' => 'pushover', 'type' => 'checkbox', 'label' => __('Enable Pushover', 'nf-pushover'), 'desc' => __('Send push notifications using Pushover', 'nf-pushover'));
         $args['settings'][] = array('name' => 'pushover_device', 'type' => 'text', 'label' => __('Device', 'nf-pushover'), 'desc' => __('The device name, if you would like to limit notifications to one device.', 'nf-pushover'));
         $args['settings'][] = array('name' => 'pushover_title', 'type' => 'text', 'label' => __('Message Title', 'nf-pushover'), 'desc' => __('The title of the push notification to be sent to your device.', 'nf-pushover'), 'default_value' => __('New Form Submission', 'nf-pushover'));
         $args['settings'][] = array('name' => 'pushover_message', 'type' => 'textarea', 'label' => __('Message (512 Character Limit)', 'nf-pushover'), 'desc' => __('If you want to include field data entered by the user, for instance a name, you can use the following shortcode: [ninja_forms_field id=23] where 23 is the ID of the field you want to insert. This will tell Ninja Forms to replace the bracketed text with whatever input the user placed in that field. You can find the field ID when you expand the field for editing.', 'nf-pushover'), 'default_value' => __('You have a new form submission', 'nf-pushover'));
         $args['settings'][] = array('name' => 'pushover_priority', 'type' => 'select', 'label' => __('Priority', 'nf-pushover'), 'desc' => __('The priority of the push notifications. If you select "Emergency" then the retry and expire options are available.', 'nf-pushover'), 'default_value' => 0, 'options' => array(array('value' => 2, 'name' => 'Emergency'), array('value' => 1, 'name' => 'High'), array('value' => 0, 'name' => 'Normal'), array('value' => -1, 'name' => 'Low')));
         $args['settings'][] = array('name' => 'pushover_retry', 'type' => 'text', 'label' => __('Retry', 'nf-pushover'), 'desc' => __('If the push notification is not acknowledged by the recipient, the notificatoin will retry sending every X seconds. If you enter 60 Pushover will retry sending the message every 60 seconds. Minimum 30 seconds.', 'nf-pushover'));
         $args['settings'][] = array('name' => 'pushover_expire', 'type' => 'text', 'label' => __('Retry Expire', 'nf-pushover'), 'desc' => __('Pushover will retrying every X seconds until the expire limit is reached. For example, sending a retry parameter of 60 and an expire parameter of 3600 will cause your notification to be retried every 60 seconds for 1 hour.', 'nf-pushover'));
         $type = 'select';
         $desc = __('The sound your push notifications will make.', 'nf-pushover');
         if (false === ($sounds = get_transient($this->transient_keys['sounds']))) {
             $response = wp_remote_get(add_query_arg('token', $this->settings['nf-pushover']['api-key'], $this->api_url . 'sounds.json'), array('sslverify' => false));
             $sounds = array();
             switch (wp_remote_retrieve_response_code($response)) {
                 case '200':
                     $sounds[] = array('value' => '', 'name' => '-- None Selected --');
                     $response = json_decode(wp_remote_retrieve_body($response));
                     foreach ($response->sounds as $key => $name) {
                         $sounds[] = array('value' => $key, 'name' => $name);
                     }
                     set_transient($this->transient_keys['sounds'], $sounds, 60 * 60 * 24 * 7);
                     // cache sounds for 1 week
                     break;
                 case '500':
                     $type = 'desc';
                     $desc = __('There seems to be issues connecting to the Pushover API.', 'nf-pushover');
                     break;
                 default:
                     $type = 'desc';
                     $desc = __('There was an invalid API call, if you continue you see this error please contact support.', 'nf-pushover');
             }
         }
         $args['settings'][] = array('name' => 'pushover_sound', 'type' => $type, 'label' => __('Sound', 'nf-pushover'), 'desc' => $desc, 'options' => $sounds);
         $args['settings'][] = array('name' => 'pushover_url', 'type' => 'checkbox', 'label' => __('Include Form Submissions Link', 'nf-pushover'), 'desc' => __('Include a link to the form submissions page in your WordPress dashboard.', 'nf-pushover'));
     } else {
         $args['settings'][] = array('name' => 'pushover', 'type' => 'desc', 'label' => __('Pushover Error', 'nf-pushover'), 'desc' => __('You must enter your API details in the settings before you can add Pushover notifications to forms.', 'nf-pushover'));
     }
     // make sure the function exists before calling it!
     // https://bitbucket.org/BFTrick/ninja-forms-pushover/issue/13/undefined-function
     if (function_exists('ninja_forms_register_tab_metabox')) {
         ninja_forms_register_tab_metabox($args);
     }
 }
Example #18
0
function ninja_forms_register_label_settings_metabox()
{
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'label_settings', 'slug' => 'label_labels', 'title' => __('Message Labels', 'ninja-forms'), 'settings' => array(array('name' => 'req_div_label', 'type' => 'text', 'label' => __('Required Field Label', 'ninja-forms'), 'desc' => '', 'help_text' => ''), array('name' => 'req_field_symbol', 'type' => 'text', 'label' => __('Required field symbol', 'ninja-forms')), array('name' => 'req_error_label', 'type' => 'text', 'label' => __('Error message given if all required fields are not completed', 'ninja-forms')), array('name' => 'req_field_error', 'type' => 'text', 'label' => __('Required Field Error', 'ninja-forms'), 'desc' => ''), array('name' => 'spam_error', 'type' => 'text', 'label' => __('Anti-spam error message', 'ninja-forms'), 'desc' => ''), array('name' => 'honeypot_error', 'type' => 'text', 'label' => __('Honeypot error message', 'ninja-forms'), 'desc' => ''), array('name' => 'timed_submit_error', 'type' => 'text', 'label' => __('Timer error message', 'ninja-forms'), 'desc' => ''), array('name' => 'javascript_error', 'type' => 'text', 'label' => __('JavaScript disabled error message', 'ninja-forms'), 'desc' => ''), array('name' => 'invalid_email', 'type' => 'text', 'label' => __('Please enter a valid email address', 'ninja-forms'), 'desc' => ''), array('name' => 'process_label', 'type' => 'text', 'label' => __('Processing Submission Label', 'ninja-forms'), 'desc' => __('This message is shown inside the submit button whenever a user clicks "submit" to let them know it is processing.', 'ninja-forms'))));
    ninja_forms_register_tab_metabox($args);
}
function ninja_forms_register_license_settings_metabox()
{
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'license_settings', 'slug' => 'license_settings', 'title' => __('Licenses', 'ninja-forms'), 'display_function' => 'nf_license_settings_no_licenses_notice');
    ninja_forms_register_tab_metabox($args);
}
Example #20
0
function ninja_forms_register_form_settings_basic_metabox()
{
    if (isset($_REQUEST['form_id'])) {
        $form_id = absint($_REQUEST['form_id']);
        $form_row = ninja_forms_get_form_by_id($form_id);
        $form_data = $form_row['data'];
    } else {
        $form_id = '';
        $form_row = '';
        $form_data = '';
    }
    $pages = get_pages();
    $pages_array = array();
    $append_array = array();
    array_push($pages_array, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
    //array_push($pages_array, array('name' => '- Custom', 'value' => ''));
    array_push($append_array, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
    foreach ($pages as $pagg) {
        array_push($pages_array, array('name' => $pagg->post_title, 'value' => get_page_link($pagg->ID)));
        array_push($append_array, array('name' => $pagg->post_title, 'value' => $pagg->ID));
    }
    if (isset($form_data['ajax'])) {
        $ajax = $form_data['ajax'];
    } else {
        $ajax = 0;
    }
    if (isset($form_data['landing_page']) and $form_data['landing_page'] != '') {
        $clear_complete_style = 'hidden';
        $hide_complete_style = 'hidden';
        $success_msg_style = 'hidden';
        $ajax_style = 'hidden';
        $landing_page_style = '';
    } else {
        $clear_complete_style = '';
        $hide_complete_style = '';
        $landing_page_style = '';
        $success_msg_style = '';
        $ajax_style = '';
    }
    if ($ajax == 1) {
        $landing_page_style = 'hidden';
        $clear_complete_style = '';
        $hide_complete_style = '';
        $success_msg_style = '';
        $ajax_style = '';
    }
    $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'basic_settings', 'title' => __('Basic Form Behavior Settings', 'ninja-forms'), 'state' => 'closed', 'settings' => array(array('name' => 'show_title', 'type' => 'checkbox', 'label' => __('Display Form Title', 'ninja-forms')), array('name' => 'logged_in', 'type' => 'checkbox', 'desc' => '', 'label' => __('Require user to be logged in to view form?', 'ninja-forms'), 'display_function' => '', 'help' => __('', 'ninja-forms')), array('name' => 'append_page', 'type' => 'select', 'desc' => '', 'label' => __('Add form to this page', 'ninja-forms'), 'display_function' => '', 'help' => __('', 'ninja-forms'), 'options' => $append_array), array('name' => 'ajax', 'type' => 'checkbox', 'desc' => '', 'label' => __('Submit via AJAX (without page reload)?', 'ninja-forms'), 'display_function' => '', 'help' => __('', 'ninja-forms'), 'tr_class' => 'landing-page-hide ' . $ajax_style), array('name' => 'landing_page', 'type' => 'select', 'desc' => '', 'label' => __('Success Page', 'ninja-forms'), 'display_function' => '', 'help' => __('', 'ninja-forms'), 'options' => $pages_array, 'tr_class' => 'ajax-hide ' . $landing_page_style, 'class' => 'landing-page-select'), array('name' => 'clear_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Clear successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will clear the form values after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1, 'tr_class' => 'landing-page-hide ' . $clear_complete_style), array('name' => 'hide_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Hide successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will hide the form after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1, 'tr_class' => 'landing-page-hide ' . $hide_complete_style), array('name' => 'success_msg', 'type' => 'rte', 'label' => __('Success Message', 'ninja-forms'), 'desc' => __('If you want to include field data entered by the user, for instance a name, you can use the following shortcode: [ninja_forms_field id=23] where 23 is the ID of the field you want to insert. This will tell Ninja Forms to replace the bracketed text with whatever input the user placed in that field. You can find the field ID when you expand the field for editing.', 'ninja-forms'), 'default_value' => __('Thanks for submitting this form. We&#39;ll get back to you soon.', 'ninja-forms'), 'tr_class' => 'landing-page-hide ' . $success_msg_style)));
    ninja_forms_register_tab_metabox($args);
}
 /**
  * Add Paypal Settings metabox on Form setting Page
  *
  * @author Aman Saini
  * @since  1.1
  * @param unknown
  */
 function paypal_settings_metabox()
 {
     if (!isset($_GET['page']) || !isset($_GET['tab'])) {
         return;
     }
     if ($_GET['page'] != 'ninja-forms' || $_GET['tab'] != 'form_settings') {
         return;
     }
     if ($_GET['form_id'] != 'new') {
         //Get all the fields that are in form .
         $all_fields = ninja_forms_get_fields_by_form_id($_GET['form_id']);
         $fields_list = array(array('name' => '', 'value' => ''));
         foreach ($all_fields as $field) {
             array_push($fields_list, array('name' => $field['data']['label'], 'value' => $field['id']));
         }
     } else {
         $fields_list = array();
         array_push($fields_list, array('name' => 'Please add fields', 'value' => ''));
     }
     $pages = get_pages();
     $pages_list = array();
     array_push($pages_list, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
     foreach ($pages as $pagg) {
         array_push($pages_list, array('name' => $pagg->post_title, 'value' => get_page_link($pagg->ID)));
     }
     $fields = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'paypal_standard_settings', 'title' => __('Paypal Standard Settings', 'ninja-paypal1'), 'state' => 'closed', 'settings' => array(array('name' => 'enable_paypal_standard', 'type' => 'checkbox', 'label' => __('Enable Paypal Standard', 'ninja-paypal'), 'desc' => __('Enable Paypal standard gateway on this form', 'ninja-paypal')), array('name' => 'paypal_standard_mode', 'type' => 'radio', 'default_value' => 'live', 'label' => __('Gateway Mode', 'ninja-paypal'), 'options' => array(array('name' => 'Live', 'value' => 'live'), array('name' => 'Test', 'value' => 'sandbox')), 'desc' => ''), array('name' => 'paypal_standard_business_email', 'type' => 'text', 'label' => __('Business Email', 'ninja-paypal'), 'desc' => ''), array('name' => 'paypal_standard_currency_type', 'type' => 'text', 'label' => __('Currency Type', 'ninja-paypal'), 'default_value' => 'USD', 'desc' => __('e.g. USD, EUR, visit <a href="https://developer.paypal.com/docs/classic/api/currency_codes/">paypal</a> to see supported currency codes', 'ninja-forms')), array('name' => 'paypal_standard_recurring', 'type' => 'checkbox', 'label' => __('Enable Recurring Payments', 'ninja-paypal'), 'desc' => __('Enable Recurring Payments ', 'ninja-paypal')), array('name' => 'paypal_standard_billing_cycle_number_and_type', 'type' => '', 'display_function' => array($this, 'paypal_standard_billing_cycle_fields'), 'label' => __('Billing Cycle', 'ninja-paypal'), 'desc' => __('Select how often you want recurring payments to occur', 'ninja-paypal')), array('name' => 'paypal_standard_recurring_time', 'type' => '', 'display_function' => array($this, 'paypal_standard_recurring_time_field'), 'label' => __('Recurring Times', 'ninja-paypal'), 'desc' => __('Set how many times recurring payments should be made, default is infinite', 'ninja-paypal')), array('name' => 'paypal_standard_product_name', 'type' => 'select', 'label' => __('Product/Service Name', 'ninja-paypal'), 'options' => $fields_list, 'desc' => 'This will show in Paypal as the item name for which you are taking payment.You can use hidden field in form and set that field here'), array('name' => 'paypal_standard_first_name', 'type' => 'select', 'label' => __('First Name', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_last_name', 'type' => 'select', 'label' => __('Last Name', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_email', 'type' => 'select', 'label' => __('Email', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_address1', 'type' => 'select', 'label' => __('Address 1', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_address2', 'type' => 'select', 'label' => __('Address 2', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_city', 'type' => 'select', 'label' => __('City', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_state', 'type' => 'select', 'label' => __('State', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_zip', 'type' => 'select', 'label' => __('Zip', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_country', 'type' => 'select', 'label' => __('Country', 'ninja-paypal'), 'options' => $fields_list), array('name' => 'paypal_standard_success_page', 'type' => 'select', 'label' => __('Payment Success Page', 'ninja-paypal'), 'options' => $pages_list, 'desc' => __('Select the page user will return after making successful payment.', 'ninja-forms')), array('name' => 'paypal_standard_cancel_page', 'type' => 'select', 'options' => $pages_list, 'label' => __('Payment Cancel Page', 'ninja-paypal'), 'desc' => __('Select the page user will return if payment is canceled.', 'ninja-forms'))));
     ninja_forms_register_tab_metabox($fields);
 }
Example #22
0
function ninja_forms_register_login_settings_metaboxes()
{
    // Get our saved settings.
    $plugin_settings = get_option('ninja_forms_settings');
    if (isset($plugin_settings['feditor'])) {
        $feditor_settings = $plugin_settings['feditor'];
    } else {
        $feditor_settings = '';
    }
    if (isset($feditor_settings['login_redirect_action'])) {
        $login_action = $feditor_settings['login_redirect_action'];
    } else {
        $login_action = '';
    }
    if (isset($feditor_settings['login_redirect_page'])) {
        $login_redirect_page = $feditor_settings['login_redirect_page'];
    } else {
        $login_redirect_page = '';
    }
    if (isset($feditor_settings['login_redirect_url'])) {
        $login_redirect_url = $feditor_settings['login_redirect_url'];
    } else {
        $login_redirect_url = '';
    }
    if (isset($feditor_settings['logout_redirect_action'])) {
        $logout_action = $feditor_settings['logout_redirect_action'];
    } else {
        $logout_action = '';
    }
    if (isset($feditor_settings['logout_redirect_page'])) {
        $logout_redirect_page = $feditor_settings['logout_redirect_page'];
    } else {
        $logout_redirect_page = '';
    }
    if (isset($feditor_settings['logout_redirect_url'])) {
        $logout_redirect_url = $feditor_settings['logout_redirect_url'];
    } else {
        $logout_redirect_url = '';
    }
    $login_page_class = 'login-redirect-page hidden';
    $login_url_class = 'login-redirect-url hidden';
    $logout_page_class = 'logout-redirect-page hidden';
    $logout_url_class = 'logout-redirect-url hidden';
    // Use a switch-case to set the visibility of the page and url settings.
    switch ($login_action) {
        case 'page':
            $login_page_class = 'login-redirect-page';
            break;
        case 'custom':
            $login_url_class = 'login-redirect-url';
            break;
    }
    switch ($logout_action) {
        case 'page':
            $logout_page_class = 'logout-redirect-page';
            break;
        case 'custom':
            $logout_url_class = 'logout-redirect-url';
            break;
    }
    // Get an array of pages for the pages dropdown
    $pages = get_pages();
    $pages_array = array();
    foreach ($pages as $pagg) {
        array_push($pages_array, array('name' => $pagg->post_title, 'value' => get_page_link($pagg->ID)));
    }
    $args = array('page' => 'ninja-forms-feditor', 'tab' => 'login_settings', 'slug' => 'login_settings', 'title' => __('Login Settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'login_redirect_action', 'type' => 'select', 'options' => array(array('name' => __('Return to the home page', 'ninja-forms-feditor'), 'value' => 'home'), array('name' => __('Reload on the same page', 'ninja-forms-feditor'), 'value' => 'current_url'), array('name' => __('Load another page', 'ninja-forms-feditor'), 'value' => 'page'), array('name' => __('Load a specific URL', 'ninja-forms-feditor'), 'value' => 'custom')), 'label' => __('When a user logs in', 'ninja-forms-feditor'), 'default_value' => $login_action), array('name' => 'login_redirect_page', 'type' => 'select', 'options' => $pages_array, 'label' => '', 'default_value' => $login_redirect_page, 'tr_class' => $login_page_class), array('name' => 'login_redirect_url', 'type' => 'text', 'label' => '', 'default_value' => $login_redirect_url, 'tr_class' => $login_url_class)));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
    $args = array('page' => 'ninja-forms-feditor', 'tab' => 'login_settings', 'slug' => 'logout_settings', 'title' => __('Logout Settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'logout_redirect_action', 'type' => 'select', 'options' => array(array('name' => __('Use the default WordPress action', 'ninja-forms-feditor'), 'value' => ''), array('name' => __('Reload on the same page', 'ninja-forms-feditor'), 'value' => 'current_url'), array('name' => __('Return to the home page', 'ninja-forms-feditor'), 'value' => 'home'), array('name' => __('Load another page', 'ninja-forms-feditor'), 'value' => 'page'), array('name' => __('Load a specific URL', 'ninja-forms-feditor'), 'value' => 'custom')), 'label' => __('When a user logs out', 'ninja-forms-feditor'), 'default_value' => $logout_action), array('name' => 'logout_redirect_page', 'type' => 'select', 'options' => $pages_array, 'label' => '', 'default_value' => $logout_redirect_page, 'tr_class' => $logout_page_class), array('name' => 'logout_redirect_url', 'type' => 'text', 'label' => '', 'default_value' => $logout_redirect_url, 'tr_class' => $logout_url_class)));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
    if (isset($feditor_settings['lost_password_error'])) {
        $username_error = $feditor_settings['lost_password_error'];
    } else {
        $username_error = __('Invalid username or email', 'ninja-forms-feditor');
    }
    if (isset($feditor_settings['lost_password_success_msg'])) {
        $success_msg = $feditor_settings['lost_password_success_msg'];
    } else {
        $success_msg = __('A password reset request has been sent. Please check your email.', 'ninja-forms-feditor');
    }
    if (isset($feditor_settings['lost_password_email_from'])) {
        $email_from = $feditor_settings['lost_password_email_from'];
    } else {
        $email_from = '';
    }
    if (isset($feditor_settings['lost_password__user_subject'])) {
        $user_subject = $feditor_settings['lost_password__user_subject'];
    } else {
        $user_subject = __('Password Reset', 'ninja-forms-feditor');
    }
    if (isset($feditor_settings['lost_password_user_email_msg'])) {
        $user_email_msg = $feditor_settings['lost_password_user_email_msg'];
    } else {
        $user_email_msg = __('Someone has requested a password reset. Please click on the link below to reset your password.', 'ninja-forms-feditor');
    }
    $args = array('page' => 'ninja-forms-feditor', 'tab' => 'login_settings', 'slug' => 'lost_password_settings', 'title' => __('Lost Password Settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'lost_password_error', 'type' => 'text', 'label' => __('Invalid username / email error', 'ninja-forms-feditor'), 'default_value' => $username_error), array('name' => 'lost_password_success_msg', 'type' => 'rte', 'label' => __('Success Message', 'ninja-forms-feditor'), 'default_value' => $success_msg), array('name' => 'lost_password_email_from', 'type' => 'text', 'label' => __('Email From Address', 'ninja-forms'), 'desc' => htmlspecialchars(__('Steve Jones <*****@*****.**>', 'ninja-forms')), 'default_value' => $email_from), array('name' => 'lost_password_user_subject', 'type' => 'text', 'label' => __('Subject for the user email', 'ninja-forms'), 'default_value' => $user_subject), array('name' => 'lost_password_user_email_msg', 'type' => 'rte', 'label' => __('Email message sent to the user', 'ninja-forms'), 'default_value' => $user_email_msg, 'desc' => __('The confirmation link will be placed at the end of this email. The [ninja_forms_user_name] shortcode will be replaced with the login name of the user requesting a reset.', 'ninja-forms-feditor'))));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
    if (isset($feditor_settings['reset_password_invalid_key'])) {
        $invalid_key = $feditor_settings['reset_password_invalid_key'];
    } else {
        $invalid_key = __('Invalid Username or Email', 'ninja-forms-feditor');
    }
    if (isset($feditor_settings['reset_password_success_msg'])) {
        $reset_success_msg = $feditor_settings['reset_password_success_msg'];
    } else {
        $reset_success_msg = __('Password Reset Successfully', 'ninja-forms-feditor');
    }
    $args = array('page' => 'ninja-forms-feditor', 'tab' => 'login_settings', 'slug' => 'reset_password_settings', 'title' => __('Password Reset Settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'reset_password_invalid_key', 'type' => 'text', 'label' => __('Invalid key error', 'ninja-forms-feditor'), 'default_value' => $invalid_key), array('name' => 'reset_password_success_msg', 'type' => 'text', 'label' => __('Success Message', 'ninja-forms-feditor'), 'default_value' => $reset_success_msg)));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
    $all_roles = get_editable_roles();
    $tmp_array = array();
    if (is_array($all_roles) and !empty($all_roles)) {
        foreach ($all_roles as $key => $role) {
            if ($key != 'administrator' and $key != 'editor') {
                $tmp_array[] = array('name' => $role['name'], 'value' => $key);
            }
        }
    }
    $all_roles = $tmp_array;
    if (isset($feditor_settings['prevent_admin'])) {
        $selected_roles = $feditor_settings['prevent_admin'];
    } else {
        $selected_roles = '';
    }
    $args = array('page' => 'ninja-forms-feditor', 'tab' => 'login_settings', 'slug' => 'admin_settings', 'title' => __('WP-Admin Settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'prevent_admin', 'type' => 'checkbox_list', 'options' => $all_roles, 'label' => __('Prevent these roles from accessing the WP-Admin', 'ninja-forms-feditor'), 'default_value' => $selected_roles)));
    if (function_exists('ninja_forms_register_tab_metabox')) {
        ninja_forms_register_tab_metabox($args);
    }
}
Example #23
0
function ninja_forms_register_ajax_settings_metabox()
{
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'ajax_settings', 'slug' => 'msg_format', 'title' => __('Ajax Message Settings', 'ninja-forms'), 'settings' => array(array('name' => 'msg_format', 'type' => 'radio', 'label' => __('Ajax Message Format', 'ninja-forms'), 'desc' => __('(Advanced setting: Ninja Forms will require you to create two javascript functions: one to handle the beforeSubmit call and one to handle the server response. These should be named ninja_forms_custom_ajax_before_submit and ninja_forms_custom_ajax_response.)', 'ninja-forms'), 'options' => array(array('name' => __('Inline Messages (Default)', 'ninja-forms'), 'value' => 'inline'), array('name' => __('Custom Message Display (Advanced)', 'ninja-forms'), 'value' => 'custom')), 'help_text' => __('Ninja Forms Test', 'ninja-forms'), 'default' => 'inline')));
    ninja_forms_register_tab_metabox($args);
}
function ninja_forms_register_license_settings_metabox()
{
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'license_settings', 'slug' => 'license_settings', 'title' => __('Licenses', 'ninja-forms'), 'settings' => array(array('name' => 'license_key', 'type' => 'desc', 'desc' => __('To activate licenses for Ninja Forms extensions you must first <a target="_blank" href="http://ninjaforms.com/documentation/extension-docs/installing-extensions/">install and activate</a> the chosen extension. License settings will then appear below.', 'ninja-forms'))));
    ninja_forms_register_tab_metabox($args);
}
Example #25
0
function ninja_forms_register_label_settings_metabox()
{
    $args = array('page' => 'ninja-forms-settings', 'tab' => 'label_settings', 'slug' => 'label_labels', 'title' => __('Message Labels', 'ninja-forms'), 'settings' => array(array('name' => 'req_div_label', 'type' => 'text', 'label' => __('Required Field Label', 'ninja-forms'), 'desc' => '', 'help_text' => ''), array('name' => 'req_field_symbol', 'type' => 'text', 'label' => __('Required field symbol', 'ninja-forms')), array('name' => 'req_error_label', 'type' => 'text', 'label' => __('Error message given if all required fields are not completed', 'ninja-forms')), array('name' => 'req_field_error', 'type' => 'text', 'label' => __('Required Field Error', 'ninja-forms'), 'desc' => ''), array('name' => 'spam_error', 'type' => 'text', 'label' => __('Anti-spam error message', 'ninja-forms'), 'desc' => ''), array('name' => 'honeypot_error', 'type' => 'text', 'label' => __('Honeypot error message', 'ninja-forms'), 'desc' => ''), array('name' => 'timed_submit_error', 'type' => 'text', 'label' => __('Timer error message', 'ninja-forms'), 'desc' => ''), array('name' => 'javascript_error', 'type' => 'text', 'label' => __('JavaScript disabled error message', 'ninja-forms'), 'desc' => ''), array('name' => 'invalid_email', 'type' => 'text', 'label' => __('Please enter a valid email address', 'ninja-forms'), 'desc' => ''), array('name' => 'process_label', 'type' => 'text', 'label' => __('Ajax submitting message', 'ninja-forms'), 'desc' => __('If your form is submitted via ajax, what message should appear to let users know it is being processed?', 'ninja-forms'))));
    ninja_forms_register_tab_metabox($args);
}
Example #26
0
function ninja_forms_register_form_settings_basic_metabox()
{
    if (isset($_REQUEST['form_id'])) {
        $form_id = absint($_REQUEST['form_id']);
        $form_row = ninja_forms_get_form_by_id($form_id);
        $form_data = $form_row['data'];
    } else {
        $form_id = '';
        $form_row = '';
        $form_data = '';
    }
    $pages = get_pages();
    $pages_array = array();
    $append_array = array();
    array_push($pages_array, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
    //array_push($pages_array, array('name' => '- Custom', 'value' => ''));
    array_push($append_array, array('name' => __('- None', 'ninja-forms'), 'value' => ''));
    foreach ($pages as $pagg) {
        array_push($pages_array, array('name' => $pagg->post_title, 'value' => get_page_link($pagg->ID)));
        array_push($append_array, array('name' => $pagg->post_title, 'value' => $pagg->ID));
    }
    if (isset($form_data['ajax'])) {
        $ajax = $form_data['ajax'];
    } else {
        $ajax = 0;
    }
    if (isset($form_data['landing_page']) and $form_data['landing_page'] != '') {
        $clear_complete_style = 'hidden';
        $hide_complete_style = 'hidden';
        $success_msg_style = 'hidden';
        $ajax_style = 'hidden';
        $landing_page_style = '';
    } else {
        $clear_complete_style = '';
        $hide_complete_style = '';
        $landing_page_style = '';
        $success_msg_style = '';
        $ajax_style = '';
    }
    if ($ajax == 1) {
        $landing_page_style = 'hidden';
        $clear_complete_style = '';
        $hide_complete_style = '';
        $success_msg_style = '';
        $ajax_style = '';
    }
    $args = apply_filters('ninja_forms_form_settings_basic', array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'basic_settings', 'title' => __('Basic Form Behavior Settings', 'ninja-forms'), 'state' => 'closed', 'settings' => array(array('name' => 'show_title', 'type' => 'checkbox', 'label' => __('Display Form Title', 'ninja-forms')), array('name' => 'logged_in', 'type' => 'checkbox', 'desc' => '', 'label' => __('Require user to be logged in to view form?', 'ninja-forms'), 'display_function' => '', 'help' => __('', 'ninja-forms')), array('name' => 'append_page', 'type' => 'select', 'desc' => '', 'label' => __('Add form to this page', 'ninja-forms'), 'display_function' => '', 'help' => __('', 'ninja-forms'), 'options' => $append_array), array('name' => 'ajax', 'type' => 'checkbox', 'desc' => '', 'label' => __('Submit via AJAX (without page reload)?', 'ninja-forms'), 'display_function' => '', 'help' => __('', 'ninja-forms'), 'tr_class' => 'landing-page-hide ' . $ajax_style), array('name' => 'clear_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Clear successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will clear the form values after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1, 'tr_class' => 'landing-page-hide ' . $clear_complete_style), array('name' => 'hide_complete', 'type' => 'checkbox', 'desc' => '', 'label' => __('Hide successfully completed form?', 'ninja-forms'), 'display_function' => '', 'desc' => __('If this box is checked, Ninja Forms will hide the form after it has been successfully submitted.', 'ninja-forms'), 'default_value' => 1, 'tr_class' => 'landing-page-hide ' . $hide_complete_style), array('name' => 'sub_limit_number', 'type' => 'number', 'desc' => '', 'label' => __('Limit Submissions', 'ninja-forms'), 'display_function' => '', 'desc' => __('Select the number of submissions that this form will accept. Leave empty for no limit.', 'ninja-forms'), 'default_value' => '', 'tr_class' => '', 'min' => 0), array('name' => 'sub_limit_msg', 'type' => 'rte', 'label' => __('Limit Reached Message', 'ninja-forms'), 'desc' => __('Please enter a message that you want displayed when this form has reached its submission limit and will not accept new submissions.', 'ninja-forms'), 'tr_class' => ''))));
    ninja_forms_register_tab_metabox($args);
}