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


PHP Ninja_Forms::instance方法代码示例

本文整理汇总了PHP中Ninja_Forms::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Ninja_Forms::instance方法的具体用法?PHP Ninja_Forms::instance怎么用?PHP Ninja_Forms::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ninja_Forms的用法示例。


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

示例1: instance

 /**
  * 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 The highlander Ninja_Forms
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Ninja_Forms) {
         self::$instance = new Ninja_Forms();
         self::$instance->setup_constants();
         self::$instance->includes();
         // Start our submissions custom post type class
         self::$instance->subs_cpt = new NF_Subs_CPT();
         // Add our registration class object
         self::$instance->register = new NF_Register();
         // The forms variable won't be interacted with directly.
         // Instead, the forms() methods will act as wrappers for it.
         self::$instance->forms = new NF_Forms();
         // Our session manager wrapper class
         self::$instance->session = new NF_Session();
         register_activation_hook(__FILE__, 'ninja_forms_activation');
         add_action('plugins_loaded', array(self::$instance, 'load_lang'));
         add_action('init', array(self::$instance, 'init'), 5);
         add_action('admin_init', array(self::$instance, 'admin_init'), 5);
         add_action('update_option_ninja_forms_settings', array(self::$instance, 'refresh_plugin_settings'), 10);
         // add_action( 'admin_head', array( self::$instance, 'admin_head' ) );
         add_action('admin_notices', array(self::$instance, 'admin_notice'));
     }
     return self::$instance;
 }
开发者ID:jbs321,项目名称:portfolio,代码行数:36,代码来源:ninja-forms.php

示例2: instance

 /**
  * 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 The highlander Ninja_Forms
  */
 public static function instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Ninja_Forms) {
         self::$instance = new Ninja_Forms();
         self::$instance->setup_constants();
         self::$instance->includes();
         // Start our submissions custom post type class
         self::$instance->subs_cpt = new NF_Subs_CPT();
         register_activation_hook(__FILE__, 'ninja_forms_activation');
         add_action('plugins_loaded', array(self::$instance, 'load_lang'));
         add_action('init', array(self::$instance, 'set_transient_id'), 1);
         add_action('init', array(self::$instance, 'init'), 5);
         add_action('admin_init', array(self::$instance, 'admin_init'), 5);
     }
     return self::$instance;
 }
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:27,代码来源:ninja-forms.php

示例3: add_action

<?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') {
开发者ID:Teplitsa,项目名称:giger,代码行数:31,代码来源:forms.php

示例4: instance

 /**
  * 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();
//.........这里部分代码省略.........
开发者ID:Gerdie,项目名称:dreamy-wedding-company,代码行数:101,代码来源:ninja-forms.php

示例5: instance

 /**
  * 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__);
         // Define old constants for backwards compatibility.
         if (!defined('NF_PLUGIN_DIR')) {
             define('NF_PLUGIN_DIR', self::$dir);
             define('NINJA_FORMS_DIR', self::$dir . 'deprecated');
         }
         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['submissions'] = new NF_Admin_Menus_Submissions();
         self::$instance->menus['import-export'] = new NF_Admin_Menus_ImportExport();
         self::$instance->menus['settings'] = new NF_Admin_Menus_Settings();
         self::$instance->menus['licenses'] = new NF_Admin_Menus_Licenses();
         self::$instance->menus['system_status'] = new NF_Admin_Menus_SystemStatus();
         self::$instance->menus['add-ons'] = new NF_Admin_Menus_Addons();
         self::$instance->menus['divider'] = new NF_Admin_Menus_Divider();
         self::$instance->menus['mock-data'] = new NF_Admin_Menus_MockData();
         /*
          * AJAX Controllers
          */
         self::$instance->controllers['form'] = new NF_AJAX_Controllers_Form();
         self::$instance->controllers['preview'] = new NF_AJAX_Controllers_Preview();
         self::$instance->controllers['submission'] = new NF_AJAX_Controllers_Submission();
         self::$instance->controllers['savedfields'] = new NF_AJAX_Controllers_SavedFields();
         /*
          * Async Requests
          */
         require_once Ninja_Forms::$dir . 'includes/Libraries/BackgroundProcessing/classes/wp-async-request.php';
         self::$instance->requests['delete-field'] = new NF_AJAX_Requests_DeleteField();
         /*
          * 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();
         /*
          * Submission CPT
          */
         new NF_Admin_CPT_Submission();
         new NF_Admin_CPT_DownloadAllSubmissions();
         require_once Ninja_Forms::$dir . 'lib/StepProcessing/menu.php';
         /*
          * 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();
         self::$instance->merge_tags['form'] = new NF_MergeTags_Form();
         /*
          * 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();
         /*
//.........这里部分代码省略.........
开发者ID:JSreactor,项目名称:MarketCrater.com,代码行数:101,代码来源:ninja-forms.php


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