/**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->_nicename = __('Redirect', 'ninja-forms');
     $settings = Ninja_Forms::config('ActionRedirectSettings');
     $this->_settings = array_merge($this->_settings, $settings);
 }
示例#2
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->_nicename = __('Email', 'ninja-forms');
     $settings = Ninja_Forms::config('ActionEmailSettings');
     $this->_settings = array_merge($this->_settings, $settings);
     $this->_backwards_compatibility();
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->_nicename = __('Success Message', 'ninja-forms');
     $settings = Ninja_Forms::config('ActionSuccessMessageSettings');
     $this->_settings = array_merge($this->_settings, $settings);
     add_action('nf_before_import_form', array($this, 'import_form_action_success_message'), 11);
 }
示例#4
0
 public function __construct()
 {
     parent::__construct();
     $this->_blacklist = apply_filters('ninja_forms_uploads_extension_blacklist', Ninja_Forms::config('UploadsExtensionBlacklist'));
     add_action('wp_ajax_nf_async_upload', array($this, 'upload'));
     add_action('wp_ajax_nopriv_nf_async_upload', array($this, 'upload'));
     add_action('nf_uploads_delete_temporary_file', array($this, 'delete_temporary_file'), 10, 1);
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->_nicename = __('Collect Payment', 'ninja-forms');
     $settings = Ninja_Forms::config('ActionCollectPaymentSettings');
     $this->_settings = array_merge($this->_settings, $settings);
     add_action('plugins_loaded', array($this, 'register_payment_gateways'));
     add_filter('ninja_forms_action_type_settings', array($this, 'maybe_remove_action'));
 }
示例#6
0
function _nf_removed_hooks()
{
    global $wp_filter;
    $hooks = array('ninja_forms_insert_sub', 'nf_email_notification_after_settings', 'nf_edit_notification_settings', 'ninja_forms_edit_field_before_li', 'ninja_forms_edit_field_after_li', 'ninja_forms_edit_field_before_closing_li', 'ninja_forms_edit_field_before_registered', 'ninja_forms_edit_field_after_registered', 'ninja_forms_edit_field_before_ul', 'ninja_forms_edit_field_ul', 'ninja_forms_edit_field_after_ul', 'ninja_forms_email_admin', 'ninja_forms_email_user', 'ninja_forms_display_before_field_label', 'ninja_forms_display_field_label', 'ninja_forms_display_after_field_label', 'ninja_forms_display_field_help', 'ninja_forms_display_field_label', 'ninja_forms_display_field_help', 'nf_before_display_loading', 'ninja_forms_display_open_form_wrap', 'ninja_forms_display_form_title', 'ninja_forms_display_open_form_tag', 'ninja_forms_display_fields', 'ninja_forms_display_close_form_tag', 'ninja_forms_display_close_form_wrap', 'nf_notification_before_process', 'nf_save_notification', 'nf_sub_table_after_row_actions_trash', 'nf_sub_table_after_row_actions', 'nf_sub_table_before_row_actions_trash', 'nf_sub_table_before_row_actions', 'ninja_forms_after_import_form', 'ninja_forms_display_after_closing_field_wrap', 'ninja_forms_display_after_field_function', 'ninja_forms_display_after_field_label', 'ninja_forms_display_after_field', 'ninja_forms_display_after_opening_field_wrap', 'ninja_forms_display_before_closing_field_wrap', 'ninja_forms_display_before_field_function', 'ninja_forms_display_before_field_label', 'ninja_forms_display_before_field', 'ninja_forms_display_before_opening_field_wrap', 'ninja_forms_display_css', 'ninja_forms_save_admin_metabox_option', 'ninja_forms_save_admin_metabox', 'ninja_forms_save_admin_sidebar', 'ninja_forms_save_admin_tab', 'ninja_forms_before_pre_process', 'ninja_forms_display_after_fields', 'ninja_forms_display_after_form_title', 'ninja_forms_display_after_form_wrap', 'ninja_forms_display_after_open_form_tag', 'ninja_forms_display_before_fields', 'ninja_forms_display_before_form_title', 'ninja_forms_display_before_form_wrap', 'ninja_forms_display_before_form', 'ninja_forms_post_process', 'ninja_forms_pre_process', 'ninja_forms_process', 'nf_export_form_row', 'nf_notification_admin_js_vars', 'nf_success_message_locations', 'nf_notification_types', 'ninja_forms_admin_submissions_datepicker_args', 'ninja_forms_starter_form_contents', 'ninja_forms_preview_page_title', 'nf_input_limit_types', 'ninja_forms_edit_field_li_label', 'nf_edit_field_settings_sections', 'ninja_forms_use_post_fields', 'nf_general_settings_advanced', 'nf_new_form_defaults', 'ninja_forms_use_post_fields', 'ninja_forms_form_settings_basic', 'ninja_forms_form_settings_restrictions', 'nf_upgrade_handler_register', 'ninja_forms_save_sub', 'ninja_forms_export_subs_csv_file_name', 'ninja_forms_export_sub_label', 'ninja_forms_export_subs_label_array', 'ninja_forms_export_sub_pre_value', 'ninja_forms_export_sub_value', 'ninja_forms_export_subs_value_array', 'ninja_forms_csv_bom', 'ninja_forms_csv_delimiter', 'ninja_forms_csv_enclosure', 'ninja_forms_csv_terminator', 'ninja_forms_sub_table_row_actions', 'ninja_forms_csv_delimiter', 'ninja_forms_csv_enclosure', 'ninja_forms_csv_terminator', 'ninja_forms_admin_menu_capabilities', 'ninja_forms_email_all_fields_array', 'nf_email_user_values_title', 'ninja_forms_email_field_label', 'ninja_forms_email_user_value', 'ninja_forms_email_field_list', 'ninja_forms_admin_email_message_wpautop', 'ninja_forms_admin_email_from', 'ninja_forms_user_email_message_wpautop', 'ninja_forms_submission_csv_name', 'ninja_forms_success_msg', 'nf_delete_form_capabilities', 'ninja_forms_field', 'ninja_forms_display_field_type', 'ninja_forms_use_post_fields', 'ninja_forms_list_terms', 'ninja_forms_display_form_form_data', 'ninja_forms_admin_subject', 'ninja_forms_user_subject', 'ninja_forms_admin_email', 'ninja_forms_user_email', 'ninja_forms_save_msg', 'ninja_forms_display_script_field_data', 'ninja_forms_display_form_form_data', 'ninja_forms_enable_credit_card_field', 'ninja_forms_post_credit_card_field', 'ninja_forms_credit_card_field_desc_pos', 'ninja_forms_hide_cc_field', 'ninja_forms_display_list_options_span_class', 'nf_import_notification_meta', 'ninja_forms_labels/timed_submit_error', 'ninja_forms_form_list_template_function', 'nf_all_fields_field_value', 'nf_all_fields_table', 'nf_before_import_field', 'nf_delete_field_capabilities', 'nf_download_all_filename', 'nf_email_notification_attachment_types', 'nf_email_notification_attachments', 'nf_email_notification_process_setting', 'nf_general_settings_recaptcha', 'nf_new_field_capabilities', 'nf_notification_process_setting', 'nf_step_processing_labels', 'nf_sub_csv_bom', 'nf_sub_edit_status', 'nf_sub_human_time', 'nf_sub_table_row_actions', 'nf_sub_table_status', 'nf_sub_table_user_value_max_items', 'nf_sub_table_user_value_max_len', 'nf_sub_title_time', 'nf_subs_csv_field_label', 'nf_subs_csv_filename', 'nf_subs_csv_label_array_before_fields', 'nf_subs_csv_value_array', 'nf_subs_export_pre_value', 'nf_subs_table_qv', 'nf_success_msg', 'ninja_forms_admin_email_message_wpautop', 'ninja_forms_admin_metabox_rte', 'ninja_forms_ajax_url', 'ninja_forms_before_import_form', 'ninja_forms_cont_class', 'ninja_forms_credit_card_cvc_desc', 'ninja_forms_credit_card_cvc_label', 'ninja_forms_credit_card_exp_month_desc', 'ninja_forms_credit_card_exp_month_label', 'ninja_forms_credit_card_exp_year_desc', 'ninja_forms_credit_card_exp_year_label', 'ninja_forms_credit_card_name_desc', 'ninja_forms_credit_card_name_label', 'ninja_forms_credit_card_number_desc', 'ninja_forms_display_field_class', 'ninja_forms_display_field_desc_class', 'ninja_forms_display_field_processing_error_class', 'ninja_forms_display_fields_wrap_visibility', 'ninja_forms_display_form_visibility', 'ninja_forms_display_required_items_class', 'ninja_forms_display_response_message_class', 'ninja_forms_display_show_form', 'ninja_forms_dropdown_open_tag', 'ninja_forms_dropdown_placeholder', 'ninja_forms_edit_field_rte', 'ninja_forms_field_post_process_user_value', 'ninja_forms_field_pre_process_user_value', 'ninja_forms_field_process_user_value', 'ninja_forms_field_shortcode', 'ninja_forms_field_wrap_class', 'ninja_forms_fields_wrap_class', 'ninja_forms_form_class', 'ninja_forms_form_list_forms', 'ninja_forms_form_wrap_class', 'ninja_forms_label_class', 'ninja_forms_labels/currency_symbol', 'ninja_forms_labels/date_format', 'ninja_forms_labels/honeypot_error', 'ninja_forms_labels/invalid_email', 'ninja_forms_labels/javascript_error', 'ninja_forms_labels/password_mismatch', 'ninja_forms_labels/process_label', 'ninja_forms_labels/req_div_label', 'ninja_forms_labels/req_error_label', 'ninja_forms_labels/req_field_error', 'ninja_forms_labels/req_field_symbol', 'ninja_forms_labels/spam_error', 'ninja_forms_display_fields_array');
    foreach ($hooks as $hook) {
        apply_filters($hook, '');
        // add_action() is just a wrapper for add_filter(), so use add_filter() for both.
        if (!isset($wp_filter[$hook]) || !$wp_filter[$hook]) {
            continue;
        }
        Ninja_Forms::deprecated_notice($hook, '3.0', null);
    }
}
 public function display()
 {
     Ninja_Forms::template('admin-menu-add-field.html.php');
     wp_enqueue_style('nf-builder', Ninja_Forms::$url . 'assets/css/builder.css');
     wp_enqueue_style('qtip2', Ninja_Forms::$url . 'assets/css/jquery.qtip.css');
     wp_enqueue_script('backbone-marionette', Ninja_Forms::$url . 'assets/js/lib/backbone.marionette.min.js', array('jquery', 'backbone'));
     wp_enqueue_script('backbone-radio', Ninja_Forms::$url . 'assets/js/lib/backbone.radio.min.js', array('jquery', 'backbone'));
     wp_enqueue_script('jquery-perfect-scrollbar', Ninja_Forms::$url . 'assets/js/lib/perfect-scrollbar.jquery.min.js', array('jquery'));
     wp_enqueue_script('jquery-hotkeys-new', Ninja_Forms::$url . 'assets/js/lib/jquery.hotkeys.js');
     wp_enqueue_script('jquery-qtip2', Ninja_Forms::$url . 'assets/js/lib/jquery.qtip.js');
     wp_enqueue_script('requirejs', Ninja_Forms::$url . 'assets/js/lib/require.js', array('jquery', 'backbone'));
     wp_enqueue_script('nf-builder', Ninja_Forms::$url . 'assets/js/builder/main.js', array('jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable'));
     wp_localize_script('nf-builder', 'nfAdmin', array('ajaxNonce' => wp_create_nonce('ninja_forms_ajax_nonce'), 'requireBaseUrl' => Ninja_Forms::$url . 'assets/js/'));
 }
示例#8
0
 public function display()
 {
     $tabs = apply_filters('ninja_forms_settings_tabs', array('settings' => __('Settings', 'ninja-forms'), 'licenses' => __('Licenses', 'ninja-forms')));
     $tab_keys = array_keys($tabs);
     $active_tab = isset($_GET['tab']) ? $_GET['tab'] : reset($tab_keys);
     wp_enqueue_style('nf-admin-settings', Ninja_Forms::$url . 'assets/css/admin-settings.css');
     $groups = Ninja_Forms()->config('PluginSettingsGroups');
     $grouped_settings = $this->get_settings();
     $save_button_text = __('Save Settings', 'ninja-forms');
     $setting_defaults = Ninja_Forms()->get_settings();
     $errors = array();
     foreach ($grouped_settings as $group => $settings) {
         foreach ($settings as $id => $setting) {
             $value = isset($setting_defaults[$id]) ? $setting_defaults[$id] : '';
             $grouped_settings[$group][$id]['id'] = $this->prefix($grouped_settings[$group][$id]['id']);
             $grouped_settings[$group][$id]['value'] = $value;
             $grouped_settings[$group][$id] = apply_filters('ninja_forms_check_setting_' . $id, $grouped_settings[$group][$id]);
             if (!isset($grouped_settings[$group][$id]['errors']) || !$grouped_settings[$group][$id]['errors']) {
                 continue;
             }
             if (!is_array($grouped_settings[$group][$id]['errors'])) {
                 $grouped_settings[$group][$id]['errors'] = array($grouped_settings[$group][$id]['errors']);
             }
             foreach ($grouped_settings[$group][$id]['errors'] as $old_key => $error) {
                 $new_key = $grouped_settings[$group][$id]['id'] . "[" . $old_key . "]";
                 $errors[$new_key] = $error;
                 $grouped_settings[$group][$id]['errors'][$new_key] = $error;
                 unset($grouped_settings[$group][$id]['errors'][$old_key]);
             }
         }
     }
     $grouped_settings['general']['version']['value'] = Ninja_Forms::VERSION;
     $saved_fields = Ninja_Forms()->form()->get_fields(array('saved' => 1));
     foreach ($saved_fields as $saved_field) {
         $saved_field_id = $saved_field->get_id();
         $grouped_settings['saved_fields'][] = array('id' => '', 'type' => 'html', 'html' => '<a class="js-delete-saved-field button button-secondary" data-id="' . $saved_field_id . '">' . __('Delete') . '</a>', 'label' => $saved_field->get_setting('label'));
     }
     if ($saved_fields) {
         wp_register_script('ninja_forms_admin_menu_settings', Ninja_Forms::$url . 'assets/js/admin-settings.js', array('jquery'), FALSE, TRUE);
         wp_localize_script('ninja_forms_admin_menu_settings', 'nf_settings', array('ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce("ninja_forms_settings_nonce")));
         wp_enqueue_script('ninja_forms_admin_menu_settings');
     }
     Ninja_Forms::template('admin-menu-settings.html.php', compact('tabs', 'active_tab', 'groups', 'grouped_settings', 'save_button_text', 'errors'));
 }
示例#9
0
 public function display()
 {
     wp_enqueue_style('nf-admin-addons', Ninja_Forms::$url . 'assets/css/admin-addons.css');
     $items = wp_remote_get('https://ninjaforms.com/?extend_feed=jlhrbgf89734go7387o4g3h');
     $items = wp_remote_retrieve_body($items);
     $items = json_decode($items, true);
     //shuffle( $items );
     $notices = array();
     foreach ($items as $item) {
         $plugin_data = array();
         if (!empty($item['plugin']) && file_exists(WP_PLUGIN_DIR . '/' . $item['plugin'])) {
             $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $item['plugin'], false, true);
         }
         $version = isset($plugin_data['Version']) ? $plugin_data['Version'] : '';
         if (!empty($version) && $version < $item['version']) {
             $notices[] = array('title' => $item['title'], 'old_version' => $version, 'new_version' => $item['version']);
         }
     }
     Ninja_Forms::template('admin-menu-addons.html.php', compact('items', 'notices'));
 }
示例#10
0
 public function update_settings()
 {
     if (!current_user_can(apply_filters('ninja_forms_admin_form_settings_capabilities', 'manage_options'))) {
         return;
     }
     if (!isset($_POST[$this->_prefix])) {
         return;
     }
     $settings = $_POST['ninja_forms'];
     if (isset($settings['currency'])) {
         $currency = sanitize_text_field($settings['currency']);
         $currency_symbols = Ninja_Forms::config('CurrencySymbol');
         $settings['currency_symbol'] = isset($currency_symbols[$currency]) ? $currency_symbols[$currency] : '';
     }
     foreach ($settings as $id => $value) {
         $value = sanitize_text_field($value);
         $value = apply_filters('ninja_forms_update_setting_' . $id, $value);
         Ninja_Forms()->update_setting($id, $value);
         do_action('ninja_forms_save_setting_' . $id, $value);
     }
 }
示例#11
0
 /**
  * Refresh our plugin settings if we update the ninja_forms_settings option
  * 
  * @access public
  * @since 2.9
  * @return void
  */
 public function refresh_plugin_settings($old_value, $value)
 {
     self::$instance->plugin_settings = self::$instance->get_plugin_settings();
 }
示例#12
0
 /**
  * Refresh our plugin settings if we update the ninja_forms_settings option
  *
  * @access public
  * @since 2.9
  * @return void
  */
 public function refresh_plugin_settings()
 {
     self::$instance->plugin_settings = self::$instance->get_plugin_settings();
 }
                        <div class="nf-select">
                            <select>
                                <option>Character</option>
                                <option>Words</option>
                            </select>
                        </div>
                    </div>
                    <div class="nf-full">
                        <label>Text to appear after counter</label>
                        <input type="text" value="character(s) left" />
                    </div>
                </fieldset>
            </div>
        </section>
        <section class="nf-settings">
            <h3><span class="dashicons dashicons-arrow-right"></span>Advanced Settings</h3>
        </section>
        <section class="nf-settings">
            <h3><span class="dashicons dashicons-arrow-right"></span>Conditional Settings</h3>
        </section>

        <?php 
Ninja_Forms::template('ui-nf-toggle-drawer.html.php');
?>
        <?php 
Ninja_Forms::template('ui-nf-drawer-buttons.html.php');
?>
    </div>

</div>
    protected function _localize_form_settings()
    {
        $form_settings_types = Ninja_Forms::config('FormSettingsTypes');
        $form_settings['display'] = Ninja_Forms::config('FormDisplaySettings');
        $form_settings['restrictions'] = Ninja_Forms::config('FormRestrictionSettings');
        $form_settings['calculations'] = Ninja_Forms::config('FormCalculationSettings');
        $form_settings = apply_filters('ninja_forms_localize_forms_settings', $form_settings);
        $groups = Ninja_Forms::config('SettingsGroups');
        $master_settings = array();
        foreach ($form_settings_types as $id => $type) {
            $unique_settings = $this->_unique_settings($form_settings[$id]);
            $master_settings = array_merge($master_settings, $unique_settings);
            $form_settings_types[$id]['settingGroups'] = $this->_group_settings($form_settings[$id], $groups);
            $form_settings_types[$id]['settingDefaults'] = $this->_setting_defaults($unique_settings);
        }
        ?>
        <script>
        var formSettingTypeData = <?php 
        echo wp_json_encode($form_settings_types);
        ?>
;
        var formSettings = <?php 
        echo wp_json_encode(array_values($master_settings));
        ?>
;
        </script>
        <?php 
    }
 protected function load_settings($only_settings = array())
 {
     $settings = array();
     // Loads a settings array from the FieldSettings configuration file.
     $all_settings = Ninja_Forms::config('FieldSettings');
     foreach ($only_settings as $setting) {
         if (isset($all_settings[$setting])) {
             $settings[$setting] = $all_settings[$setting];
         }
     }
     return $settings;
 }
示例#16
0
 public function display()
 {
     Ninja_Forms::template('admin-menu-edit-field.html.php');
     wp_enqueue_style('nf-builder', Ninja_Forms::$url . 'assets/css/builder.css');
     wp_enqueue_script('jquery-perfect-scrollbar', Ninja_Forms::$url . 'assets/js/lib/perfect-scrollbar.jquery.min.js', array('jquery'));
 }
示例#17
0
 /**
  * Add Filters
  *
  * @return bool
  */
 public function add_filters()
 {
     global $typenow;
     // Bail if we aren't in our submission custom post type.
     if ($typenow != 'nf_sub') {
         return false;
     }
     $forms = Ninja_Forms()->form()->get_forms();
     $form_options = array();
     foreach ($forms as $form) {
         $form_options[$form->get_id()] = $form->get_setting('title');
     }
     $form_options = apply_filters('ninja_forms_submission_filter_form_options', $form_options);
     if (isset($_GET['form_id'])) {
         $form_selected = $_GET['form_id'];
     } else {
         $form_selected = 0;
     }
     if (isset($_GET['begin_date'])) {
         $begin_date = $_GET['begin_date'];
     } else {
         $begin_date = '';
     }
     if (isset($_GET['end_date'])) {
         $end_date = $_GET['end_date'];
     } else {
         $end_date = '';
     }
     Ninja_Forms::template('admin-menu-subs-filter.html.php', compact('form_options', 'form_selected', 'begin_date', 'end_date'));
     wp_enqueue_script('jquery-ui-datepicker');
     wp_enqueue_style('jquery-ui-datepicker', Ninja_Forms::$url . 'deprecated/assets/css/jquery-ui-fresh.min.css');
 }
<?php

if (!defined('ABSPATH')) {
    exit;
}
return apply_filters('ninja_forms_form_display_settings', array('title' => array('name' => 'title', 'type' => 'textbox', 'label' => __('Form Title', 'ninja-forms'), 'width' => 'full', 'group' => 'primary', 'value' => ''), 'show_title' => array('name' => 'show_title', 'type' => 'toggle', 'label' => __('Display Form Title', 'ninja-forms'), 'width' => 'full', 'group' => 'primary', 'value' => 1), 'clear_complete' => array('name' => 'clear_complete', 'type' => 'toggle', 'label' => __('Clear successfully completed form?', 'ninja-forms'), 'width' => 'full', 'group' => 'primary', 'value' => 1, 'help' => __('If this box is checked, Ninja Forms will clear the form values after it has been successfully submitted.', 'ninja-forms')), 'hide_complete' => array('name' => 'hide_complete', 'type' => 'toggle', 'label' => __('Hide successfully completed form?', 'ninja-forms'), 'width' => 'full', 'group' => 'primary', 'value' => 1, 'help' => __('If this box is checked, Ninja Forms will hide the form after it has been successfully submitted.', 'ninja-forms')), 'default_label_pos' => array('name' => 'default_label_pos', 'type' => 'select', 'label' => __('Default Label Position', 'ninja-forms'), 'width' => 'full', 'group' => 'advanced', 'options' => array(array('label' => __('Above Element', 'ninja-forms'), 'value' => 'above'), array('label' => __('Below Element', 'ninja-forms'), 'value' => 'below'), array('label' => __('Left of Element', 'ninja-forms'), 'value' => 'left'), array('label' => __('Right of Element', 'ninja-forms'), 'value' => 'right'), array('label' => __('Hidden', 'ninja-forms'), 'value' => 'hidden')), 'value' => 'above'), 'classes' => array('name' => 'classes', 'type' => 'fieldset', 'label' => __('Custom Class Names', 'ninja-forms'), 'width' => 'full', 'group' => 'advanced', 'settings' => array(array('name' => 'wrapper_class', 'type' => 'textbox', 'placeholder' => '', 'label' => __('Wrapper', 'ninja-forms'), 'width' => 'one-half', 'value' => '', 'use_merge_tags' => FALSE), array('name' => 'element_class', 'type' => 'textbox', 'label' => __('Element', 'ninja-forms'), 'placeholder' => '', 'width' => 'one-half', 'value' => '', 'use_merge_tags' => FALSE))), 'key' => array('name' => 'key', 'type' => 'textbox', 'label' => __('Form Key', 'ninja-forms'), 'width' => 'full', 'group' => 'administration', 'value' => '', 'help' => __('Programmatic name that can be used to reference this form.', 'ninja-forms')), 'add_submit' => array('name' => 'add_submit', 'type' => 'toggle', 'label' => __('Add Submit Button', 'ninja-forms'), 'width' => 'full', 'group' => '', 'value' => 1, 'help' => __('We\'ve noticed that don\'t have a submit button on your form. We can add one for your automatically.', 'ninja-forms')), 'currency' => array('name' => 'currency', 'type' => 'select', 'options' => array_merge(array(array('label' => __('Plugin Default', 'ninja-forms'), 'value' => '')), Ninja_Forms::config('Currency')), 'label' => __('Currency', 'ninja-forms'), 'width' => 'full', 'group' => 'advanced', 'value' => '')));
示例#19
0
 public function display()
 {
     /** @global wpdb $wpdb */
     global $wpdb;
     wp_enqueue_style('nf-admin-system-status', Ninja_Forms::$url . 'assets/css/admin-system-status.css');
     wp_enqueue_script('nf-admin-system-status-script', Ninja_Forms::$url . 'assets/js/admin-system-status.js', array('jquery'));
     //PHP locale
     $locale = localeconv();
     if (is_multisite()) {
         $multisite = __('Yes', 'ninja-forms');
     } else {
         $multisite = __('No', 'ninja-forms');
     }
     //TODO: Possible refactor
     foreach ($locale as $key => $val) {
         if (is_string($val)) {
             $data = $key . ': ' . $val . '</br>';
         }
     }
     //TODO: Ask if this check is need
     //if ( function_exists( 'phpversion' ) ) echo esc_html( phpversion() );
     //WP_DEBUG
     if (defined('WP_DEBUG') && WP_DEBUG) {
         $debug = __('Yes', 'ninja-forms');
     } else {
         $debug = __('No', 'ninja-forms');
     }
     //WPLANG
     if (defined('WPLANG') && WPLANG) {
         $lang = WPLANG;
     } else {
         $lang = __('Default', 'ninja-forms');
     }
     //TODO: Ask if this long list of ini_get checks are need?
     //  if( function_exists( 'ini_get' ) ){
     //     $get_ini = size_format( ini_get('post_max_size') );
     //  }
     //SUHOSIN
     if (extension_loaded('suhosin')) {
         $suhosin = __('Yes', 'ninja-forms');
     } else {
         $suhosin = __('No', 'ninja-forms');
     }
     //Time Zone Check
     //TODO: May need refactored
     $default_timezone = get_option('timezone_string');
     //Check for active plugins
     $active_plugins = (array) get_option('active_plugins', array());
     if (is_multisite()) {
         $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
     }
     $all_plugins = array();
     foreach ($active_plugins as $plugin) {
         $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
         $dirname = dirname($plugin);
         $version_string = '';
         if (!empty($plugin_data['Name'])) {
             // link the plugin name to the plugin url if available
             $plugin_name = $plugin_data['Name'];
             if (!empty($plugin_data['PluginURI'])) {
                 $plugin_name = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __('Visit plugin homepage', 'ninja-forms') . '">' . $plugin_name . '</a>';
             }
             $all_plugins[] = $plugin_name . ' ' . __('by', 'ninja-forms') . ' ' . $plugin_data['Author'] . ' ' . __('version', 'ninja-forms') . ' ' . $plugin_data['Version'] . $version_string;
         }
     }
     if (sizeof($all_plugins) == 0) {
         $site_wide_plugins = '-';
     } else {
         $site_wide_plugins = implode(', <br/>', $all_plugins);
     }
     $server_ip = $_SERVER['SERVER_ADDR'];
     $host_name = gethostbyaddr($server_ip);
     //Output array
     $environment = array(__('Home URL', 'ninja-forms') => home_url(), __('Site URL', 'ninja-forms') => site_url(), __('Ninja Forms Version', 'ninja-forms') => esc_html(Ninja_Forms::VERSION), __('WP Version', 'ninja-forms') => get_bloginfo('version'), __('WP Multisite Enabled', 'ninja-forms') => $multisite, __('Web Server Info', 'ninja-forms') => esc_html($_SERVER['SERVER_SOFTWARE']), __('PHP Version', 'ninja-forms') => esc_html(phpversion()), __('MySQL Version', 'ninja-forms') => $wpdb->db_version(), __('PHP Locale', 'ninja-forms') => $data, __('WP Memory Limit', 'ninja-forms') => number_format_i18n(WP_MEMORY_LIMIT), __('WP Debug Mode', 'ninja-forms') => $debug, __('WP Language', 'ninja-forms') => $lang, __('WP Max Upload Size', 'ninja-forms') => size_format(wp_max_upload_size()), __('PHP Post Max Size', 'ninja-forms') => number_format_i18n(ini_get('post_max_size')), __('Max Input Nesting Level', 'ninja-forms') => ini_get('max_input_nesting_level'), __('PHP Time Limit', 'ninja-forms') => ini_get('max_execution_time'), __('PHP Max Input Vars', 'ninja-forms') => ini_get('max_input_vars'), __('SUHOSIN Installed', 'ninja-forms') => $suhosin, __('Server IP Address', 'ninja-forms') => $server_ip, __('Host Name', 'ninja-forms') => $host_name, __('SMTP', 'ninja-forms') => ini_get('SMTP'), __('smtp_port', 'ninja-forms') => ini_get('smtp_port'), __('Default Timezone', 'ninja-forms') => $default_timezone);
     Ninja_Forms::template('admin-menu-system-status.html.php', compact('environment', 'site_wide_plugins'));
 }
示例#20
0
文件: forms.php 项目: Teplitsa/giger
<?php

/** NINJA FORMS **/
add_action('after_setup_theme', function () {
    if (class_exists('Ninja_Forms')) {
        //notices in admin from incorrect post message filterng - remove it
        $nf = Ninja_Forms::instance();
        remove_filter('post_updated_messages', array($nf->subs_cpt, 'post_updated_messages'));
        //remove CSS
        remove_action('ninja_forms_display_css', 'ninja_forms_display_css', 10, 2);
        //remove unsupported fields
        remove_action('init', 'ninja_forms_register_field_calc');
        remove_action('init', 'ninja_forms_register_field_credit_card');
        remove_action('init', 'ninja_forms_register_field_number');
        remove_action('init', 'ninja_forms_register_field_hr');
        remove_action('init', 'ninja_forms_register_field_profile_pass');
        remove_action('init', 'ninja_forms_register_field_rating');
        remove_action('init', 'ninja_forms_register_field_tax');
        remove_action('init', 'ninja_forms_register_field_timed_submit');
        remove_action('init', 'ninja_forms_register_field_spam');
        remove_action('admin_init', 'ninja_forms_register_sidebar_payment_fields');
        remove_action('admin_init', 'ninja_forms_register_sidebar_user_info_fields');
        add_action('admin_init', 'tst_nf_register_sidebar_user_info_fields');
    }
});
//to-do deregister unused fields
//wrapper class
add_filter('ninja_forms_display_field_wrap_class', 'tst_nf_field_wrap_class', 2, 3);
function tst_nf_field_wrap_class($field_wrap_class, $field_id, $field_row)
{
    if ($field_row['type'] == '_text') {
示例#21
0
 public function template_export_favorite_fields()
 {
     $fields = Ninja_Forms()->form()->get_fields(array('saved' => 1));
     Ninja_Forms::template('admin-metabox-import-export-favorite-fields-export.html.php', compact('fields'));
 }
 /**
  * Info Meta Box
  *
  * @param $post
  */
 public function info_meta_box($post)
 {
     $sub = Ninja_Forms()->form()->sub($post->ID)->get();
     $seq_num = $sub->get_seq_num();
     $status = ucwords($sub->get_status());
     $user = $sub->get_user()->data->user_nicename;
     $form_title = $sub->get_form_title();
     $sub_date = $sub->get_sub_date('m/d/Y H:i');
     $mod_date = $sub->get_mod_date('m/d/Y H:i');
     Ninja_Forms::template('admin-metabox-sub-info.html.php', compact('seq_num', 'status', 'user', 'form_title', 'sub_date', 'mod_date'));
 }
 public function display()
 {
     Ninja_Forms::template('admin-menu-edit-settings.html.php');
     wp_enqueue_style('nf-builder', Ninja_Forms::$url . 'assets/css/builder.css');
 }
 function column_title($item)
 {
     $title = $item['title'];
     $edit_url = add_query_arg('form_id', $item['id'], admin_url('admin.php?page=ninja-forms'));
     $delete_url = add_query_arg(array('action' => 'delete', 'id' => $item['id'], '_wpnonce' => wp_create_nonce('nf_delete_form')));
     $duplicate_url = add_query_arg(array('action' => 'duplicate', 'id' => $item['id'], '_wpnonce' => wp_create_nonce('nf_duplicate_form')));
     $preview_url = add_query_arg('nf_preview_form', $item['id'], site_url());
     $submissions_url = add_query_arg('form_id', $item['id'], admin_url('edit.php?post_status=all&post_type=nf_sub'));
     $form = Ninja_Forms()->form($item['id'])->get();
     $locked = $form->get_setting('lock');
     Ninja_Forms::template('admin-menu-all-forms-column-title.html.php', compact('title', 'edit_url', 'delete_url', 'duplicate_url', 'preview_url', 'submissions_url', 'locked'));
 }
 /**
  * Run all of our plugin stuff on admin init.
  * 
  * @since 2.7.4
  * @return void
  */
 public function admin_init()
 {
     // Check and update our version number.
     self::$instance->update_version_number();
 }
示例#26
0
 public static function enqueue_scripts($form_id)
 {
     $form = Ninja_Forms()->form($form_id)->get();
     $is_preview = $form->get_tmp_id();
     $ver = Ninja_Forms::VERSION;
     $js_dir = Ninja_Forms::$url . 'assets/js/min/';
     $css_dir = Ninja_Forms::$url . 'assets/css/';
     switch (Ninja_Forms()->get_setting('opinionated_styles')) {
         case 'light':
             wp_enqueue_style('nf-display', $css_dir . 'display-opinions-light.css', array('dashicons'));
             wp_enqueue_style('nf-font-awesome', $css_dir . 'font-awesome.min.css');
             break;
         case 'dark':
             wp_enqueue_style('nf-display', $css_dir . 'display-opinions-dark.css', array('dashicons'));
             wp_enqueue_style('nf-font-awesome', $css_dir . 'font-awesome.min.css');
             break;
         default:
             wp_enqueue_style('nf-display', $css_dir . 'display-structure.css', array('dashicons'));
     }
     if ($is_preview || self::form_uses_recaptcha($form_id)) {
         $recaptcha_lang = Ninja_Forms()->get_setting('recaptcha_lang');
         wp_enqueue_script('google-recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_lang, array('jquery'), $ver);
     }
     if ($is_preview || self::form_uses_datepicker($form_id)) {
         wp_enqueue_style('pikaday-responsive', $css_dir . 'pikaday-package.css', $ver);
         wp_enqueue_script('nf-front-end--datepicker', $js_dir . 'front-end--datepicker.min.js', array('jquery'), $ver);
     }
     if ($is_preview || self::form_uses_inputmask($form_id)) {
         wp_enqueue_script('nf-front-end--inputmask', $js_dir . 'front-end--inputmask.min.js', array('jquery'), $ver);
     }
     if ($is_preview || self::form_uses_rte($form_id)) {
         if ($is_preview || self::form_uses_textarea_media($form_id)) {
             wp_enqueue_media();
         }
         wp_enqueue_style('summernote', $css_dir . 'summernote.css', $ver);
         wp_enqueue_style('codemirror', $css_dir . 'codemirror.css', $ver);
         wp_enqueue_style('codemirror-monokai', $css_dir . 'monokai-theme.css', $ver);
         wp_enqueue_script('nf-front-end--rte', $js_dir . 'front-end--rte.min.js', array('jquery'), $ver);
     }
     if ($is_preview || self::form_uses_helptext($form_id)) {
         wp_enqueue_style('jBox', $css_dir . 'jBox.css', $ver);
         wp_enqueue_script('nf-front-end--helptext', $js_dir . 'front-end--helptext.min.js', array('jquery'), $ver);
     }
     if ($is_preview || self::form_uses_starrating($form_id)) {
         wp_enqueue_style('rating', $css_dir . 'rating.css', Ninja_Forms::VERSION);
         wp_enqueue_script('nf-front-end--starrating', $js_dir . 'front-end--starrating.min.js', array('jquery'), $ver);
     }
     wp_enqueue_script('nf-front-end-deps', $js_dir . 'front-end-deps.js', array('jquery', 'backbone'), $ver);
     wp_enqueue_script('nf-front-end', $js_dir . 'front-end.js', array('nf-front-end-deps'), $ver);
     wp_localize_script('nf-front-end', 'nfi18n', Ninja_Forms::config('i18nFrontEnd'));
     $data = apply_filters('ninja_forms_render_localize_script_data', array('ajaxNonce' => wp_create_nonce('ninja_forms_display_nonce'), 'adminAjax' => admin_url('admin-ajax.php'), 'requireBaseUrl' => Ninja_Forms::$url . 'assets/js/', 'use_merge_tags' => array(), 'opinionated_styles' => Ninja_Forms()->get_setting('opinionated_styles')));
     foreach (Ninja_Forms()->fields as $field) {
         foreach ($field->use_merge_tags() as $merge_tag) {
             $data['use_merge_tags'][$merge_tag][$field->get_type()] = $field->get_type();
         }
     }
     wp_localize_script('nf-front-end', 'nfFrontEnd', $data);
     do_action('ninja_forms_enqueue_scripts', array('form_id' => $form_id));
     do_action('nf_display_enqueue_scripts');
 }
示例#27
0
    public static function localize_preview($form_id)
    {
        $capability = apply_filters('ninja_forms_display_test_values_capabilities', 'read');
        if (isset($_GET['ninja_forms_test_values']) && current_user_can($capability)) {
            self::$use_test_values = TRUE;
        }
        add_action('wp_footer', 'NF_Display_Render::output_templates', 9999);
        $form = get_user_option('nf_form_preview_' . $form_id);
        if (!$form) {
            self::localize($form_id);
            return;
        }
        if (isset($form['settings']['logged_in']) && $form['settings']['logged_in'] && !is_user_logged_in()) {
            echo $form['settings']['not_logged_in_msg'];
            return;
        }
        $form['settings']['is_preview'] = TRUE;
        $before_form = apply_filters('ninja_forms_display_before_form', '', $form_id, TRUE);
        $form['settings']['beforeForm'] = $before_form;
        $before_fields = apply_filters('ninja_forms_display_before_fields', '', $form_id, TRUE);
        $form['settings']['beforeFields'] = $before_fields;
        $after_fields = apply_filters('ninja_forms_display_after_fields', '', $form_id, TRUE);
        $form['settings']['afterFields'] = $after_fields;
        $after_form = apply_filters('ninja_forms_display_after_form', '', $form_id, TRUE);
        $form['settings']['afterForm'] = $after_form;
        $fields = array();
        if (empty($form['fields'])) {
            echo __('No Fields Found.', 'ninja-forms');
        } else {
            foreach ($form['fields'] as $field_id => $field) {
                $field_type = $field['settings']['type'];
                if (!isset(Ninja_Forms()->fields[$field_type])) {
                    continue;
                }
                if (!apply_filters('ninja_forms_preview_display_type_' . $field_type, TRUE)) {
                    continue;
                }
                if (!apply_filters('ninja_forms_preview_display_field', $field)) {
                    continue;
                }
                $field['settings']['id'] = $field_id;
                $field = apply_filters('ninja_forms_localize_fields_preview', $field);
                $field = apply_filters('ninja_forms_localize_field_' . $field_type . '_preview', $field);
                $display_before = apply_filters('ninja_forms_display_before_field_type_' . $field['settings']['type'], '');
                $display_before = apply_filters('ninja_forms_display_before_field_key_' . $field['settings']['key'], $display_before);
                $field['settings']['beforeField'] = $display_before;
                $display_after = apply_filters('ninja_forms_display_after_field_type_' . $field['settings']['type'], '');
                $display_after = apply_filters('ninja_forms_display_after_field_key_' . $field['settings']['key'], $display_after);
                $field['settings']['afterField'] = $display_after;
                foreach ($field['settings'] as $key => $setting) {
                    if (is_numeric($setting)) {
                        $field['settings'][$key] = floatval($setting);
                    }
                }
                if (!isset($field['settings']['label_pos']) || 'default' == $field['settings']['label_pos']) {
                    if (isset($form['settings']['default_label_pos'])) {
                        $field['settings']['label_pos'] = $form['settings']['default_label_pos'];
                    }
                }
                $field_class = Ninja_Forms()->fields[$field_type];
                $templates = $field_class->get_templates();
                if (!array($templates)) {
                    $templates = array($templates);
                }
                foreach ($templates as $template) {
                    self::load_template('fields-' . $template);
                }
                if (self::$use_test_values) {
                    $field['settings']['value'] = $field_class->get_test_value();
                }
                $field['settings']['parentType'] = $field_class->get_parent_type();
                if ('list' == $field['settings']['parentType'] && isset($field['settings']['options']) && is_array($field['settings']['options'])) {
                    $field['settings']['options'] = apply_filters('ninja_forms_render_options', $field['settings']['options'], $field['settings']);
                }
                if (isset($field['settings']['default'])) {
                    $default_value = apply_filters('ninja_forms_render_default_value', $field['settings']['default'], $field_type, $field['settings']);
                    $default_value = preg_replace('/{.*}/', '', $default_value);
                    if ($default_value) {
                        $field['settings']['value'] = $default_value;
                        ob_start();
                        do_shortcode($field['settings']['value']);
                        $ob = ob_get_clean();
                        if ($ob) {
                            $field['settings']['value'] = $ob;
                        }
                    }
                }
                // TODO: Find a better way to do this.
                if ('shipping' == $field['settings']['type']) {
                    $field['settings']['shipping_cost'] = str_replace(array('$', '£', '€'), '', $field['settings']['shipping_cost']);
                    $field['settings']['shipping_cost'] = str_replace(Ninja_Forms()->get_setting('currency_symbol'), '', $field['settings']['shipping_cost']);
                    $field['settings']['shipping_cost'] = number_format($field['settings']['shipping_cost'], 2);
                } elseif ('product' == $field['settings']['type']) {
                    // TODO: Does the currency marker need to stripped here?
                    $field['settings']['product_price'] = str_replace(array('$', '£', '€'), '', $field['settings']['product_price']);
                    $field['settings']['product_price'] = str_replace(Ninja_Forms()->get_setting('currency_symbol'), '', $field['settings']['product_price']);
                    $field['settings']['product_price'] = number_format($field['settings']['product_price'], 2);
                } elseif ('total' == $field['settings']['type']) {
                    if (!isset($field['settings']['value'])) {
                        $field['settings']['value'] = 0;
                    }
                    $field['settings']['value'] = number_format($field['settings']['value'], 2);
                }
                $field['settings']['element_templates'] = $templates;
                $field['settings']['old_classname'] = $field_class->get_old_classname();
                $field['settings']['wrap_template'] = $field_class->get_wrap_template();
                $fields[] = apply_filters('ninja_forms_localize_field_settings_' . $field_type, $field['settings'], $form);
            }
        }
        // Output Form Container
        do_action('ninja_forms_before_container_preview', $form_id, $form['settings'], $fields);
        Ninja_Forms::template('display-form-container.html.php', compact('form_id'));
        ?>
        <!-- TODO: Move to Template File. -->
        <script>
            // Maybe initialize nfForms object
            var nfForms = nfForms || [];

            // Build Form Data
            var form = [];
            form.id = '<?php 
        echo $form['id'];
        ?>
';
            form.settings = JSON.parse( '<?php 
        echo WPN_Helper::addslashes(wp_json_encode($form['settings']));
        ?>
' );

            form.fields = JSON.parse( '<?php 
        echo WPN_Helper::addslashes(wp_json_encode($fields));
        ?>
' );

            // Add Form Data to nfForms object
            nfForms.push( form );
        </script>

        <?php 
        self::enqueue_scripts($form_id);
    }
 /**
  * Main Ninja_Forms Instance
  *
  * Insures that only one instance of Ninja_Forms exists in memory at any one
  * time. Also prevents needing to define globals all over the place.
  *
  * @since 2.7
  * @static
  * @staticvar array $instance
  * @return Ninja_Forms Highlander Instance
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Ninja_Forms) {
         self::$instance = new Ninja_Forms();
         self::$dir = plugin_dir_path(__FILE__);
         if (!defined('NF_PLUGIN_DIR')) {
             define('NF_PLUGIN_DIR', self::$dir);
         }
         self::$url = plugin_dir_url(__FILE__);
         if (!defined('NF_PLUGIN_URL')) {
             define('NF_PLUGIN_URL', self::$url);
         }
         update_option('ninja_forms_version', self::VERSION);
         /*
          * Register our autoloader
          */
         spl_autoload_register(array(self::$instance, 'autoloader'));
         /*
          * Admin Menus
          */
         self::$instance->menus['forms'] = new NF_Admin_Menus_Forms();
         self::$instance->menus['all-forms'] = new NF_Admin_Menus_AllForms();
         self::$instance->menus['add-new'] = new NF_Admin_Menus_AddNew();
         self::$instance->menus['settings'] = new NF_Admin_Menus_Settings();
         self::$instance->menus['add-ons'] = new NF_Admin_Menus_Addons();
         self::$instance->menus['system_status'] = new NF_Admin_Menus_SystemStatus();
         self::$instance->menus['submissions'] = new NF_Admin_Menus_Submissions();
         self::$instance->menus['import-export'] = new NF_Admin_Menus_ImportExport();
         self::$instance->menus['licenses'] = new NF_Admin_Menus_Licenses();
         /*
          * Admin menus used for building out the admin UI
          *
          * TODO: removed once building is complete
          */
         // self::$instance->menus[ 'add-field']        = new NF_Admin_Menus_AddField();
         // self::$instance->menus[ 'edit-field']       = new NF_Admin_Menus_EditField();
         // self::$instance->menus[ 'add-action']       = new NF_Admin_Menus_AddAction();
         // self::$instance->menus[ 'edit-action']      = new NF_Admin_Menus_EditAction();
         // self::$instance->menus[ 'edit-settings']    = new NF_Admin_Menus_EditSettings();
         // self::$instance->menus[ 'fields-layout']    = new NF_Admin_Menus_FieldsLayout();
         self::$instance->menus['mock-data'] = new NF_Admin_Menus_MockData();
         // self::$instance->menus[ 'preview']          = new NF_Admin_Menus_Preview();
         /*
          * AJAX Controllers
          */
         self::$instance->controllers['form'] = new NF_AJAX_Controllers_Form();
         self::$instance->controllers['preview'] = new NF_AJAX_Controllers_Preview();
         self::$instance->controllers['uploads'] = new NF_AJAX_Controllers_Uploads();
         self::$instance->controllers['submission'] = new NF_AJAX_Controllers_Submission();
         self::$instance->controllers['savedfields'] = new NF_AJAX_Controllers_SavedFields();
         /*
          * WP-CLI Commands
          */
         if (class_exists('WP_CLI_Command')) {
             WP_CLI::add_command('ninja-forms', 'NF_WPCLI_NinjaFormsCommand');
         }
         /*
          * Preview Page
          */
         self::$instance->preview = new NF_Display_Preview();
         /*
          * Shortcodes
          */
         self::$instance->shortcodes = new NF_Display_Shortcodes();
         /*
          * Temporary Shortcodes
          *
          * TODO: removed once building is complete
          */
         require_once self::$dir . 'includes/Display/Shortcodes/tmp-frontend.php';
         require_once self::$dir . 'includes/Display/Shortcodes/tmp-preview.php';
         require_once self::$dir . 'includes/Display/Shortcodes/tmp-frontendform.php';
         require_once self::$dir . 'includes/Display/Shortcodes/tmp-file-upload.php';
         /*
          * Submission CPT
          */
         new NF_Admin_CPT_Submission();
         /*
          * Logger
          */
         self::$instance->_logger = new NF_Database_Logger();
         /*
          * Merge Tags
          */
         self::$instance->merge_tags['user'] = new NF_MergeTags_User();
         self::$instance->merge_tags['post'] = new NF_MergeTags_Post();
         self::$instance->merge_tags['system'] = new NF_MergeTags_System();
         self::$instance->merge_tags['fields'] = new NF_MergeTags_Fields();
         self::$instance->merge_tags['calcs'] = new NF_MergeTags_Calcs();
         self::$instance->merge_tags['querystrings'] = new NF_MergeTags_QueryStrings();
         /*
          * Add Form Modal
          */
         self::$instance->add_form_modal = new NF_Admin_AddFormModal();
         /*
          * EOS Parser
          */
         self::$instance->_eos['parser'] = (require_once 'includes/Libraries/EOS/Parser.php');
         self::$instance->session = new NF_Session();
         /*
          * Plugin Settings
          */
         self::$instance->settings = get_option('ninja_forms_settings');
         /*
          * Admin Notices System
          */
         self::$instance->notices = new NF_Admin_Notices();
         /*
          * Activation Hook
          * TODO: Move to a permanent home.
          */
         register_activation_hook(__FILE__, array(self::$instance, 'activation'));
         new NF_Admin_Metaboxes_AppendAForm();
         /*
          * Require EDD auto-update file
          */
         if (!class_exists('EDD_SL_Plugin_Updater')) {
             // Load our custom updater if it doesn't already exist
             require_once self::$dir . 'includes/Integrations/EDD/EDD_SL_Plugin_Updater.php';
         }
         require_once self::$dir . 'includes/Integrations/EDD/class-extension-updater.php';
     }
     add_action('admin_notices', array(self::$instance, 'admin_notices'));
     add_action('plugins_loaded', array(self::$instance, 'plugins_loaded'));
     return self::$instance;
 }
示例#29
0
 protected function load_settings($only_settings = array())
 {
     $settings = array();
     // Loads a settings array from the FieldSettings configuration file.
     $all_settings = Ninja_Forms::config('FieldSettings');
     foreach ($only_settings as $setting) {
         if (isset($all_settings[$setting])) {
             $settings[$setting] = $all_settings[$setting];
         }
     }
     return apply_filters('ninja_forms_field_' . $this->_name . '_settings', $settings);
 }
<?php

if (!defined('ABSPATH')) {
    exit;
}
return apply_filters('ninja_forms_plugin_settings_general', array('version' => array('id' => 'version', 'type' => 'desc', 'label' => __('Version', 'ninja-forms'), 'desc' => ''), 'date_format' => array('id' => 'date_format', 'type' => 'textbox', '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>')), 'currency' => array('id' => 'currency', 'type' => 'select', 'options' => Ninja_Forms::config('Currency'), 'label' => __('Currency', 'ninja-forms'), 'value' => 'USD')));