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


PHP GFExport::import_file方法代码示例

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


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

示例1: setUp

 /** Activate the plugin, mock all the things */
 public function setUp()
 {
     parent::setUp();
     /* Activate GravityForms */
     require_once WP_PLUGIN_DIR . '/gravityforms/gravityforms.php';
     require_once WP_PLUGIN_DIR . '/gravityforms/export.php';
     /* Something happened in newer versions, and we can't get the lead cache to initialize
     			properly, we need to do this manually */
     global $_gform_lead_meta;
     if ($_gform_lead_meta === null) {
         $_gform_lead_meta = array();
     }
     GFForms::setup();
     GFCache::flush();
     /* Import some ready-made forms */
     $this->assertEquals(GFExport::import_file(dirname(__FILE__) . '/forms.xml'), 2);
     /* Add a faster turnaround schedule */
     add_filter('cron_schedules', function ($s) {
         $s['minute'] = array('interval' => 60, 'display' => 'Minutely');
         return $s;
     });
     /* Get an instance of our plugin */
     $this->digest = new GFDigestNotifications();
 }
开发者ID:acesmf,项目名称:Gravity-Forms-Digest-Bulk-Reports,代码行数:25,代码来源:main.php

示例2: maybe_import_theme_forms

 private static function maybe_import_theme_forms()
 {
     //Import theme specific forms if configured. Will only import forms once per theme.
     if (defined('GF_THEME_IMPORT_FILE')) {
         $themes = get_option('gf_imported_theme_file');
         if (!is_array($themes)) {
             $themes = array();
         }
         //if current theme has already imported it's forms, don't import again
         $theme = get_template();
         if (!isset($themes[$theme])) {
             require_once GFCommon::get_base_path() . '/export.php';
             //importing forms
             GFExport::import_file(get_stylesheet_directory() . '/' . GF_THEME_IMPORT_FILE);
             //adding current theme to the list of imported themes. So that forms are not imported again for it.
             $themes[$theme] = true;
             update_option('gf_imported_theme_file', $themes);
         }
     }
 }
开发者ID:kidaak,项目名称:gravityforms,代码行数:20,代码来源:gravityforms.php

示例3: setup

    public static function setup($force_setup = false)
    {
        global $wpdb;
        $version = GFCommon::$version;
        if (get_option("rg_form_version") != $version || $force_setup) {
            $error = "";
            if (!self::has_database_permission($error)) {
                ?>
                <div class='error' style="padding:15px;"><?php 
                echo $error;
                ?>
</div>
                <?php 
            }
            require_once ABSPATH . '/wp-admin/includes/upgrade.php';
            if (!empty($wpdb->charset)) {
                $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
            }
            if (!empty($wpdb->collate)) {
                $charset_collate .= " COLLATE {$wpdb->collate}";
            }
            //------ FORM -----------------------------------------------
            $form_table_name = RGFormsModel::get_form_table_name();
            $sql = "CREATE TABLE " . $form_table_name . " (\r\n                  id mediumint(8) unsigned not null auto_increment,\r\n                  title varchar(150) not null,\r\n                  date_created datetime not null,\r\n                  is_active tinyint(1) not null default 1,\r\n                  PRIMARY KEY  (id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ META -----------------------------------------------
            $meta_table_name = RGFormsModel::get_meta_table_name();
            $sql = "CREATE TABLE " . $meta_table_name . " (\r\n                  form_id mediumint(8) unsigned not null,\r\n                  display_meta longtext,\r\n                  entries_grid_meta longtext,\r\n                  PRIMARY KEY  (form_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //droping outdated form_id index (if one exists)
            self::drop_index($meta_table_name, 'form_id');
            //------ FORM VIEW -----------------------------------------------
            $form_view_table_name = RGFormsModel::get_form_view_table_name();
            $sql = "CREATE TABLE " . $form_view_table_name . " (\r\n                  id bigint(20) unsigned not null auto_increment,\r\n                  form_id mediumint(8) unsigned not null,\r\n                  date_created datetime not null,\r\n                  ip char(15),\r\n                  count mediumint(8) unsigned not null default 1,\r\n                  PRIMARY KEY  (id),\r\n                  KEY form_id (form_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ LEAD -----------------------------------------------
            $lead_table_name = RGFormsModel::get_lead_table_name();
            $sql = "CREATE TABLE " . $lead_table_name . " (\r\n                  id int(10) unsigned not null auto_increment,\r\n                  form_id mediumint(8) unsigned not null,\r\n                  post_id bigint(20) unsigned,\r\n                  date_created datetime not null,\r\n                  is_starred tinyint(1) not null default 0,\r\n                  is_read tinyint(1) not null default 0,\r\n                  ip varchar(39) not null,\r\n                  source_url varchar(200) not null default '',\r\n                  user_agent varchar(250) not null default '',\r\n                  currency varchar(5),\r\n                  payment_status varchar(15),\r\n                  payment_date datetime,\r\n                  payment_amount decimal(19,2),\r\n                  transaction_id varchar(50),\r\n                  is_fulfilled tinyint(1),\r\n                  created_by bigint(20) unsigned,\r\n                  transaction_type tinyint(1),\r\n                  status varchar(20) not null default 'active',\r\n                  PRIMARY KEY  (id),\r\n                  KEY form_id (form_id),\r\n                  KEY status (status)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ LEAD NOTES ------------------------------------------
            $lead_notes_table_name = RGFormsModel::get_lead_notes_table_name();
            $sql = "CREATE TABLE " . $lead_notes_table_name . " (\r\n                  id int(10) unsigned not null auto_increment,\r\n                  lead_id int(10) unsigned not null,\r\n                  user_name varchar(250),\r\n                  user_id bigint(20),\r\n                  date_created datetime not null,\r\n                  value longtext,\r\n                  PRIMARY KEY  (id),\r\n                  KEY lead_id (lead_id),\r\n                  KEY lead_user_key (lead_id,user_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ LEAD DETAIL -----------------------------------------
            $lead_detail_table_name = RGFormsModel::get_lead_details_table_name();
            $sql = "CREATE TABLE " . $lead_detail_table_name . " (\r\n                  id bigint(20) unsigned not null auto_increment,\r\n                  lead_id int(10) unsigned not null,\r\n                  form_id mediumint(8) unsigned not null,\r\n                  field_number float not null,\r\n                  value varchar(" . GFORMS_MAX_FIELD_LENGTH . "),\r\n                  PRIMARY KEY  (id),\r\n                  KEY form_id (form_id),\r\n                  KEY lead_id (lead_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //------ LEAD DETAIL LONG -----------------------------------
            $lead_detail_long_table_name = RGFormsModel::get_lead_details_long_table_name();
            $sql = "CREATE TABLE " . $lead_detail_long_table_name . " (\r\n                  lead_detail_id bigint(20) unsigned not null,\r\n                  value longtext,\r\n                  PRIMARY KEY  (lead_detail_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //droping outdated form_id index (if one exists)
            self::drop_index($lead_detail_long_table_name, 'lead_detail_key');
            //------ LEAD META -----------------------------------
            $lead_meta_table_name = RGFormsModel::get_lead_meta_table_name();
            $sql = "CREATE TABLE " . $lead_meta_table_name . " (\r\n                  id bigint(20) unsigned not null auto_increment,\r\n                  lead_id bigint(20) unsigned not null,\r\n                  meta_key varchar(255),\r\n                  meta_value longtext,\r\n                  PRIMARY KEY  (id),\r\n                  KEY meta_key (meta_key),\r\n                  KEY lead_id (lead_id)\r\n                ) {$charset_collate};";
            dbDelta($sql);
            //fix checkbox value. needed for version 1.0 and below but won't hurt for higher versions
            self::fix_checkbox_value();
            //auto-setting license key based on value configured via the GF_LICENSE_KEY constant or the gf_license_key variable
            global $gf_license_key;
            $license_key = defined("GF_LICENSE_KEY") && empty($gf_license_key) ? GF_LICENSE_KEY : $gf_license_key;
            if (!empty($license_key)) {
                update_option("rg_gforms_key", md5($license_key));
            }
            //auto-setting recaptcha keys based on value configured via the constant or global variable
            global $gf_recaptcha_public_key, $gf_recaptcha_private_key;
            $private_key = defined("GF_RECAPTCHA_PRIVATE_KEY") && empty($gf_recaptcha_private_key) ? GF_RECAPTCHA_PRIVATE_KEY : $gf_recaptcha_private_key;
            if (!empty($private_key)) {
                update_option("rg_gforms_captcha_private_key", $private_key);
            }
            $public_key = defined("GF_RECAPTCHA_PUBLIC_KEY") && empty($gf_recaptcha_public_key) ? GF_RECAPTCHA_PUBLIC_KEY : $gf_recaptcha_public_key;
            if (!empty($public_key)) {
                update_option("rg_gforms_captcha_public_key", $public_key);
            }
            //Auto-importing forms based on GF_IMPORT_FILE AND GF_THEME_IMPORT_FILE
            if (defined("GF_IMPORT_FILE") && !get_option("gf_imported_file")) {
                GFExport::import_file(GF_IMPORT_FILE);
                update_option("gf_imported_file", true);
            }
            //adds empty index.php files to upload folders. only for v1.5.2 and below
            if (version_compare(get_option("rg_form_version"), "1.6", "<")) {
                self::add_empty_index_files();
            }
            update_option("rg_form_version", $version);
        }
        //Import theme specific forms if configured. Will only import forms once per theme.
        if (defined("GF_THEME_IMPORT_FILE")) {
            $themes = get_option("gf_imported_theme_file");
            if (!is_array($themes)) {
                $themes = array();
            }
            //if current theme has already imported it's forms, don't import again
            $theme = get_template();
            if (!isset($themes[$theme])) {
                //importing forms
                GFExport::import_file(get_stylesheet_directory() . "/" . GF_THEME_IMPORT_FILE);
                //adding current theme to the list of imported themes. So that forms are not imported again for it.
                $themes[$theme] = true;
                update_option("gf_imported_theme_file", $themes);
//.........这里部分代码省略.........
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:101,代码来源:gravityforms.php

示例4: import_form

 /**
  * Import Gravity Form XML
  * @param  string $xml_path Path to form xml file
  * @return int | bool       Imported form ID or false
  */
 function import_form($xml_path = '')
 {
     do_action('gravityview_log_debug', '[import_form] Import Preset Form. (File)', $xml_path);
     if (empty($xml_path) || !class_exists('GFExport') || !file_exists($xml_path)) {
         do_action('gravityview_log_error', '[import_form] Class GFExport or file not found. file: ', $xml_path);
         return false;
     }
     // import form
     $forms = '';
     $count = GFExport::import_file($xml_path, $forms);
     do_action('gravityview_log_debug', '[import_form] Importing form (Result)', $count);
     do_action('gravityview_log_debug', '[import_form] Importing form (Form) ', $forms);
     if ($count != 1 || empty($forms[0]['id'])) {
         do_action('gravityview_log_error', '[import_form] Form Import Failed!');
         return false;
     }
     // import success - return form id
     return $forms[0];
 }
开发者ID:robinsutherland223,项目名称:gravity,代码行数:24,代码来源:class-ajax.php

示例5: setup_site

    public static function setup_site($blog_id = null)
    {
        if (empty($blog_id)) {
            $blog_id = get_current_blog_id();
        }
        //if a blog id is specified, switch to it
        if (MULTISITE && !switch_to_blog($blog_id)) {
            return;
        }
        global $wpdb;
        $error = "";
        if (!self::has_database_permission($error)) {
            ?>

            <div class='error' style="padding:15px;"><?php 
            echo $error;
            ?>
</div>

            <?php 
        }
        require_once ABSPATH . '/wp-admin/includes/upgrade.php';
        if (!empty($wpdb->charset)) {
            $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
        }
        if (!empty($wpdb->collate)) {
            $charset_collate .= " COLLATE {$wpdb->collate}";
        }
        //Fixes issue with dbDelta lower-casing table names, which cause problems on case sensitive DB servers.
        add_filter('dbdelta_create_queries', array("RGForms", "dbdelta_fix_case"));
        //------ FORM -----------------------------------------------
        $form_table_name = RGFormsModel::get_form_table_name();
        $sql = "CREATE TABLE " . $form_table_name . " (\n\n              id mediumint(8) unsigned not null auto_increment,\n\n              title varchar(150) not null,\n\n              date_created datetime not null,\n\n              is_active tinyint(1) not null default 1,\n\n              PRIMARY KEY  (id)\n\n            ) {$charset_collate};";
        dbDelta($sql);
        //droping table that was created by mistake in version 1.6.3.2
        $wpdb->query("DROP TABLE IF EXISTS A" . $form_table_name);
        //------ META -----------------------------------------------
        $meta_table_name = RGFormsModel::get_meta_table_name();
        $sql = "CREATE TABLE " . $meta_table_name . " (\n\n              form_id mediumint(8) unsigned not null,\n\n              display_meta longtext,\n\n              entries_grid_meta longtext,\n\n              confirmations longtext,\n\n              notifications longtext,\n\n              PRIMARY KEY  (form_id)\n\n            ) {$charset_collate};";
        dbDelta($sql);
        //droping outdated form_id index (if one exists)
        self::drop_index($meta_table_name, 'form_id');
        //------ FORM VIEW -----------------------------------------------
        $form_view_table_name = RGFormsModel::get_form_view_table_name();
        $sql = "CREATE TABLE " . $form_view_table_name . " (\n\n              id bigint(20) unsigned not null auto_increment,\n\n              form_id mediumint(8) unsigned not null,\n\n              date_created datetime not null,\n\n              ip char(15),\n\n              count mediumint(8) unsigned not null default 1,\n\n              PRIMARY KEY  (id),\n\n              KEY form_id (form_id)\n\n            ) {$charset_collate};";
        dbDelta($sql);
        //------ LEAD -----------------------------------------------
        $lead_table_name = RGFormsModel::get_lead_table_name();
        $sql = "CREATE TABLE " . $lead_table_name . " (\n\n              id int(10) unsigned not null auto_increment,\n\n              form_id mediumint(8) unsigned not null,\n\n              post_id bigint(20) unsigned,\n\n              date_created datetime not null,\n\n              is_starred tinyint(1) not null default 0,\n\n              is_read tinyint(1) not null default 0,\n\n              ip varchar(39) not null,\n\n              source_url varchar(200) not null default '',\n\n              user_agent varchar(250) not null default '',\n\n              currency varchar(5),\n\n              payment_status varchar(15),\n\n              payment_date datetime,\n\n              payment_amount decimal(19,2),\n\n              transaction_id varchar(50),\n\n              is_fulfilled tinyint(1),\n\n              created_by bigint(20) unsigned,\n\n              transaction_type tinyint(1),\n\n              status varchar(20) not null default 'active',\n\n              PRIMARY KEY  (id),\n\n              KEY form_id (form_id),\n\n              KEY status (status)\n\n            ) {$charset_collate};";
        dbDelta($sql);
        //------ LEAD NOTES ------------------------------------------
        $lead_notes_table_name = RGFormsModel::get_lead_notes_table_name();
        $sql = "CREATE TABLE " . $lead_notes_table_name . " (\n\n              id int(10) unsigned not null auto_increment,\n\n              lead_id int(10) unsigned not null,\n\n              user_name varchar(250),\n\n              user_id bigint(20),\n\n              date_created datetime not null,\n\n              value longtext,\n\n              PRIMARY KEY  (id),\n\n              KEY lead_id (lead_id),\n\n              KEY lead_user_key (lead_id,user_id)\n\n            ) {$charset_collate};";
        dbDelta($sql);
        //------ LEAD DETAIL -----------------------------------------
        $lead_detail_table_name = RGFormsModel::get_lead_details_table_name();
        $sql = "CREATE TABLE " . $lead_detail_table_name . " (\n\n              id bigint(20) unsigned not null auto_increment,\n\n              lead_id int(10) unsigned not null,\n\n              form_id mediumint(8) unsigned not null,\n\n              field_number float not null,\n\n              value varchar(" . GFORMS_MAX_FIELD_LENGTH . "),\n\n              PRIMARY KEY  (id),\n\n              KEY form_id (form_id),\n\n              KEY lead_id (lead_id),\n\n              KEY lead_field_number (lead_id,field_number)\n\n            ) {$charset_collate};";
        dbDelta($sql);
        //------ LEAD DETAIL LONG -----------------------------------
        $lead_detail_long_table_name = RGFormsModel::get_lead_details_long_table_name();
        $sql = "CREATE TABLE " . $lead_detail_long_table_name . " (\n\n              lead_detail_id bigint(20) unsigned not null,\n\n              value longtext,\n\n              PRIMARY KEY  (lead_detail_id)\n\n            ) {$charset_collate};";
        dbDelta($sql);
        //droping outdated form_id index (if one exists)
        self::drop_index($lead_detail_long_table_name, 'lead_detail_key');
        //------ LEAD META -----------------------------------
        $lead_meta_table_name = RGFormsModel::get_lead_meta_table_name();
        $sql = "CREATE TABLE " . $lead_meta_table_name . " (\n\n              id bigint(20) unsigned not null auto_increment,\n\n              form_id mediumint(8) unsigned not null default 0,\n\n              lead_id bigint(20) unsigned not null,\n\n              meta_key varchar(255),\n\n              meta_value longtext,\n\n              PRIMARY KEY  (id),\n\n              KEY meta_key (meta_key),\n\n              KEY lead_id (lead_id),\n\n              KEY form_id_meta_key (form_id,meta_key)\n\n            ) {$charset_collate};";
        dbDelta($sql);
        remove_filter('dbdelta_create_queries', array("RGForms", "dbdelta_fix_case"));
        //fix form_id value needed to update from version 1.6.11
        self::fix_lead_meta_form_id_values();
        //fix checkbox value. needed for version 1.0 and below but won't hurt for higher versions
        self::fix_checkbox_value();
        //auto-setting license key based on value configured via the GF_LICENSE_KEY constant or the gf_license_key variable
        global $gf_license_key;
        $license_key = defined("GF_LICENSE_KEY") && empty($gf_license_key) ? GF_LICENSE_KEY : $gf_license_key;
        if (!empty($license_key)) {
            update_option("rg_gforms_key", md5($license_key));
        }
        //auto-setting recaptcha keys based on value configured via the constant or global variable
        global $gf_recaptcha_public_key, $gf_recaptcha_private_key;
        $private_key = defined("GF_RECAPTCHA_PRIVATE_KEY") && empty($gf_recaptcha_private_key) ? GF_RECAPTCHA_PRIVATE_KEY : $gf_recaptcha_private_key;
        if (!empty($private_key)) {
            update_option("rg_gforms_captcha_private_key", $private_key);
        }
        $public_key = defined("GF_RECAPTCHA_PUBLIC_KEY") && empty($gf_recaptcha_public_key) ? GF_RECAPTCHA_PUBLIC_KEY : $gf_recaptcha_public_key;
        if (!empty($public_key)) {
            update_option("rg_gforms_captcha_public_key", $public_key);
        }
        //Auto-importing forms based on GF_IMPORT_FILE AND GF_THEME_IMPORT_FILE
        if (defined("GF_IMPORT_FILE") && !get_option("gf_imported_file")) {
            GFExport::import_file(GF_IMPORT_FILE);
            update_option("gf_imported_file", true);
        }
        //adds empty index.php files to upload folders. only for v1.5.2 and below
        if (version_compare(get_option("rg_form_version"), "1.6", "<")) {
            self::add_empty_index_files();
        }
        update_option("rg_form_version", GFCommon::$version);
        //going back to current blog
//.........这里部分代码省略.........
开发者ID:kmzdn,项目名称:bootstrap,代码行数:101,代码来源:gravityforms.php

示例6: import

 /**
  * Import
  *
  * @since      0.0.15
  * @return     void
  */
 public function import()
 {
     global $wpdb;
     if (class_exists('GFForms')) {
         $table_name = $wpdb->prefix . 'rg_form_meta';
         if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
             GFForms::setup_database();
         }
         if (!$this->if_form_exists($this->form_name)) {
             $form = GFExport::import_file($this->filepath);
             do_action('gform_forms_post_import', $form);
         }
     }
 }
开发者ID:Fulcrum-Creatives,项目名称:clients,代码行数:20,代码来源:functions.php


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