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


PHP RGFormsModel::get_form_table_name方法代码示例

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


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

示例1: get_feeds

 public static function get_feeds($form_id = false, $is_active = false)
 {
     global $wpdb;
     $table_name = self::get_user_registration_table_name();
     $has_table = $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $table_name));
     if (!$has_table) {
         self::update_table();
         return array();
     }
     $form_table_name = RGFormsModel::get_form_table_name();
     $where = 'WHERE 1 = 1';
     if ($form_id) {
         $where .= " AND s.form_id = {$form_id}";
     }
     if ($is_active) {
         $where .= " AND s.is_active = {$is_active}";
     }
     $sql = "SELECT s.id, s.is_active, s.form_id, s.meta, f.title as form_title\r\n                FROM {$table_name} s\r\n                INNER JOIN {$form_table_name} f ON s.form_id = f.id\r\n                {$where}";
     $results = $wpdb->get_results($sql, ARRAY_A);
     $count = sizeof($results);
     for ($i = 0; $i < $count; $i++) {
         $results[$i]["meta"] = maybe_unserialize($results[$i]["meta"]);
     }
     return $results;
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:25,代码来源:data.php

示例2: get_feeds

 public static function get_feeds()
 {
     global $wpdb;
     $table_name = self::get_paytm_form_table_name();
     $form_table_name = RGFormsModel::get_form_table_name();
     $sql = "SELECT s.id, s.is_active, s.form_id, s.meta, f.title as form_title\n                FROM {$table_name} s\n                INNER JOIN {$form_table_name} f ON s.form_id = f.id";
     $results = $wpdb->get_results($sql, ARRAY_A);
     $count = sizeof($results);
     for ($i = 0; $i < $count; $i++) {
         $results[$i]["meta"] = maybe_unserialize($results[$i]["meta"]);
     }
     return $results;
 }
开发者ID:Paytm-Payments,项目名称:Paytm_GravityForm_v3.5.x_Kit,代码行数:13,代码来源:data.php

示例3: get_pronamic_pay_gf_form_title

function get_pronamic_pay_gf_form_title($form_id)
{
    $title = null;
    global $pronamic_pay_gf_form_titles;
    if (!isset($pronamic_pay_gf_form_titles)) {
        global $wpdb;
        $form_table_name = RGFormsModel::get_form_table_name();
        $query = "SELECT id, title FROM {$form_table_name} WHERE is_active;";
        $pronamic_pay_gf_form_titles = $wpdb->get_results($query, OBJECT_K);
        // WPCS: unprepared SQL OK
    }
    if (isset($pronamic_pay_gf_form_titles[$form_id])) {
        $title = $pronamic_pay_gf_form_titles[$form_id]->title;
    }
    return $title;
}
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:16,代码来源:functions.php

示例4: setup_database

 public static function setup_database()
 {
     global $wpdb;
     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'));
     /*
      * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
      * As of 4.2, however, WP core moved to utf8mb4, which uses 4 bytes per character. This means that an index which
      * used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.
      */
     $max_index_length = 191;
     //------ FORM -----------------------------------------------
     $form_table_name = RGFormsModel::get_form_table_name();
     $sql = 'CREATE TABLE ' . $form_table_name . " (\n              id mediumint(8) unsigned not null auto_increment,\n              title varchar(150) not null,\n              date_created datetime not null,\n              is_active tinyint(1) not null default 1,\n              is_trash tinyint(1) not null default 0,\n              PRIMARY KEY  (id)\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              form_id mediumint(8) unsigned not null,\n              display_meta longtext,\n              entries_grid_meta longtext,\n              confirmations longtext,\n              notifications longtext,\n              PRIMARY KEY  (form_id)\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              id bigint(20) unsigned not null auto_increment,\n              form_id mediumint(8) unsigned not null,\n              date_created datetime not null,\n              ip char(15),\n              count mediumint(8) unsigned not null default 1,\n              PRIMARY KEY  (id),\n              KEY form_id (form_id)\n            ) {$charset_collate};";
     dbDelta($sql);
     //------ LEAD -----------------------------------------------
     $lead_table_name = RGFormsModel::get_lead_table_name();
     $sql = 'CREATE TABLE ' . $lead_table_name . " (\n              id int(10) unsigned not null auto_increment,\n              form_id mediumint(8) unsigned not null,\n              post_id bigint(20) unsigned,\n              date_created datetime not null,\n              is_starred tinyint(1) not null default 0,\n              is_read tinyint(1) not null default 0,\n              ip varchar(39) not null,\n              source_url varchar(200) not null default '',\n              user_agent varchar(250) not null default '',\n              currency varchar(5),\n              payment_status varchar(15),\n              payment_date datetime,\n              payment_amount decimal(19,2),\n              payment_method varchar(30),\n              transaction_id varchar(50),\n              is_fulfilled tinyint(1),\n              created_by bigint(20) unsigned,\n              transaction_type tinyint(1),\n              status varchar(20) not null default 'active',\n              PRIMARY KEY  (id),\n              KEY form_id (form_id),\n              KEY status (status)\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              id int(10) unsigned not null auto_increment,\n              lead_id int(10) unsigned not null,\n              user_name varchar(250),\n              user_id bigint(20),\n              date_created datetime not null,\n              value longtext,\n              note_type varchar(50),\n              PRIMARY KEY  (id),\n              KEY lead_id (lead_id),\n              KEY lead_user_key (lead_id,user_id)\n            ) {$charset_collate};";
     dbDelta($sql);
     //------ LEAD DETAIL -----------------------------------------
     $lead_detail_table_name = RGFormsModel::get_lead_details_table_name();
     $sql = 'CREATE TABLE ' . $lead_detail_table_name . ' (
           id bigint(20) unsigned not null auto_increment,
           lead_id int(10) unsigned not null,
           form_id mediumint(8) unsigned not null,
           field_number float not null,
           value varchar(' . GFORMS_MAX_FIELD_LENGTH . "),\n              PRIMARY KEY  (id),\n              KEY form_id (form_id),\n              KEY lead_id (lead_id),\n              KEY lead_field_number (lead_id,field_number)\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              lead_detail_id bigint(20) unsigned not null,\n              value longtext,\n              PRIMARY KEY  (lead_detail_id)\n            ) {$charset_collate};";
     dbDelta($sql);
     // dropping 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();
     // dropping meta_key and form_id_meta_key (if they exist) to prevent duplicate keys error on upgrade
     if (version_compare(get_option('rg_form_version'), '1.9.8.12', '<')) {
         self::drop_index($lead_meta_table_name, 'meta_key');
         self::drop_index($lead_meta_table_name, 'form_id_meta_key');
     }
     $sql = 'CREATE TABLE ' . $lead_meta_table_name . " (\n              id bigint(20) unsigned not null auto_increment,\n              form_id mediumint(8) unsigned not null default 0,\n              lead_id bigint(20) unsigned not null,\n              meta_key varchar(255),\n              meta_value longtext,\n              PRIMARY KEY  (id),\n              KEY meta_key (meta_key({$max_index_length})),\n              KEY lead_id (lead_id),\n              KEY form_id_meta_key (form_id,meta_key({$max_index_length}))\n            ) {$charset_collate};";
     dbDelta($sql);
     //------ INCOMPLETE SUBMISSIONS -------------------------------
     $incomplete_submissions_table_name = RGFormsModel::get_incomplete_submissions_table_name();
     $sql = 'CREATE TABLE ' . $incomplete_submissions_table_name . " (\n              uuid char(32) not null,\n              email varchar(255),\n              form_id mediumint(8) unsigned not null,\n              date_created datetime not null,\n              ip varchar(39) not null,\n              source_url longtext not null,\n              submission longtext not null,\n              PRIMARY KEY  (uuid),\n              KEY form_id (form_id)\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();
     //fix leading and trailing spaces in Form objects and entry values
     if (version_compare(get_option('rg_form_version'), '1.8.3.1', '<')) {
         self::fix_leading_and_trailing_spaces();
     }
 }
开发者ID:kidaak,项目名称:gravityforms,代码行数:80,代码来源:gravityforms.php

示例5: 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

示例6: setup_database

 public static function setup_database()
 {
     global $wpdb;
     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              id mediumint(8) unsigned not null auto_increment,\n              title varchar(150) not null,\n              date_created datetime not null,\n              is_active tinyint(1) not null default 1,\n              is_trash tinyint(1) not null default 0,\n              PRIMARY KEY  (id)\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              form_id mediumint(8) unsigned not null,\n              display_meta longtext,\n              entries_grid_meta longtext,\n              confirmations longtext,\n              notifications longtext,\n              PRIMARY KEY  (form_id)\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              id bigint(20) unsigned not null auto_increment,\n              form_id mediumint(8) unsigned not null,\n              date_created datetime not null,\n              ip char(15),\n              count mediumint(8) unsigned not null default 1,\n              PRIMARY KEY  (id),\n              KEY form_id (form_id)\n            ) {$charset_collate};";
     dbDelta($sql);
     //------ LEAD -----------------------------------------------
     $lead_table_name = RGFormsModel::get_lead_table_name();
     $sql = "CREATE TABLE " . $lead_table_name . " (\n              id int(10) unsigned not null auto_increment,\n              form_id mediumint(8) unsigned not null,\n              post_id bigint(20) unsigned,\n              date_created datetime not null,\n              is_starred tinyint(1) not null default 0,\n              is_read tinyint(1) not null default 0,\n              ip varchar(39) not null,\n              source_url varchar(200) not null default '',\n              user_agent varchar(250) not null default '',\n              currency varchar(5),\n              payment_status varchar(15),\n              payment_date datetime,\n              payment_amount decimal(19,2),\n              payment_method varchar(30),\n              transaction_id varchar(50),\n              is_fulfilled tinyint(1),\n              created_by bigint(20) unsigned,\n              transaction_type tinyint(1),\n              status varchar(20) not null default 'active',\n              PRIMARY KEY  (id),\n              KEY form_id (form_id),\n              KEY status (status)\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              id int(10) unsigned not null auto_increment,\n              lead_id int(10) unsigned not null,\n              user_name varchar(250),\n              user_id bigint(20),\n              date_created datetime not null,\n              value longtext,\n              PRIMARY KEY  (id),\n              KEY lead_id (lead_id),\n              KEY lead_user_key (lead_id,user_id)\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              id bigint(20) unsigned not null auto_increment,\n              lead_id int(10) unsigned not null,\n              form_id mediumint(8) unsigned not null,\n              field_number float not null,\n              value varchar(" . GFORMS_MAX_FIELD_LENGTH . "),\n              PRIMARY KEY  (id),\n              KEY form_id (form_id),\n              KEY lead_id (lead_id),\n              KEY lead_field_number (lead_id,field_number)\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              lead_detail_id bigint(20) unsigned not null,\n              value longtext,\n              PRIMARY KEY  (lead_detail_id)\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              id bigint(20) unsigned not null auto_increment,\n              form_id mediumint(8) unsigned not null default 0,\n              lead_id bigint(20) unsigned not null,\n              meta_key varchar(255),\n              meta_value longtext,\n              PRIMARY KEY  (id),\n              KEY meta_key (meta_key),\n              KEY lead_id (lead_id),\n              KEY form_id_meta_key (form_id,meta_key)\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();
     //fix leading and trailing spaces in Form objects and entry values from versions prior to 1.8.2
     if (version_compare(get_option("rg_form_version"), "1.8.2", "<=")) {
         //uncomment to test
         //self::fix_leading_and_trailing_spaces();
     }
 }
开发者ID:danaiser,项目名称:hollandLawns,代码行数:61,代码来源:gravityforms.php

示例7: 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

示例8: get_old_feeds

 /**
  * Retrieve any old feeds which need migrating to the framework,
  *
  * @return bool|array
  */
 public function get_old_feeds()
 {
     global $wpdb;
     $table_name = $wpdb->prefix . 'rg_campaignmonitor';
     if (!$this->table_exists($table_name)) {
         return false;
     }
     $form_table_name = RGFormsModel::get_form_table_name();
     $sql = "SELECT s.id, s.is_active, s.form_id, s.meta, f.title as form_title\r\n\t\t\t\tFROM {$table_name} s\r\n\t\t\t\tINNER JOIN {$form_table_name} f ON s.form_id = f.id";
     $results = $wpdb->get_results($sql, ARRAY_A);
     $count = sizeof($results);
     for ($i = 0; $i < $count; $i++) {
         $results[$i]['meta'] = maybe_unserialize($results[$i]['meta']);
     }
     return $results;
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:21,代码来源:class-gf-campaignmonitor.php

示例9: setup

 public static function setup()
 {
     global $wpdb;
     $version = GFCommon::$version;
     if (get_option("rg_form_version") != $version) {
         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 . " (\n                  id mediumint(8) unsigned not null auto_increment,\n                  title varchar(150) not null,\n                  date_created datetime not null,\n                  is_active tinyint(1) not null default 1,\n                  PRIMARY KEY  (id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ META -----------------------------------------------
         $meta_table_name = RGFormsModel::get_meta_table_name();
         $sql = "CREATE TABLE " . $meta_table_name . " (\n                  form_id mediumint(8) unsigned not null,\n                  display_meta longtext,\n                  entries_grid_meta longtext,\n                  KEY form_id (form_id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ FORM VIEW -----------------------------------------------
         $form_view_table_name = RGFormsModel::get_form_view_table_name();
         $sql = "CREATE TABLE " . $form_view_table_name . " (\n                  id bigint(20) unsigned not null auto_increment,\n                  form_id mediumint(8) unsigned not null,\n                  date_created datetime not null,\n                  ip char(15),\n                  count mediumint(8) unsigned not null default 1,\n                  PRIMARY KEY  (id),\n                  KEY form_id (form_id)\n                ) {$charset_collate};";
         dbDelta($sql);
         //------ LEAD -----------------------------------------------
         $lead_table_name = RGFormsModel::get_lead_table_name();
         $sql = "CREATE TABLE " . $lead_table_name . " (\n                  id int(10) unsigned not null auto_increment,\n                  form_id mediumint(8) unsigned not null,\n                  post_id bigint(20) unsigned,\n                  date_created datetime not null,\n                  is_starred tinyint(1) not null default 0,\n                  is_read tinyint(1) not null default 0,\n                  ip char(15) not null,\n                  source_url varchar(200) not null default '',\n                  user_agent varchar(250) not null default '',\n                  PRIMARY KEY  (id),\n                  KEY form_id (form_id)\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                  id int(10) unsigned not null auto_increment,\n                  lead_id int(10) unsigned not null,\n                  user_name varchar(250),\n                  user_id bigint(20),\n                  date_created datetime not null,\n                  value longtext,\n                  PRIMARY KEY  (id),\n                  KEY lead_id (lead_id),\n                  KEY lead_user_key (lead_id,user_id)\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                  id bigint(20) unsigned not null auto_increment,\n                  lead_id int(10) unsigned not null,\n                  form_id mediumint(8) unsigned not null,\n                  field_number float not null,\n                  value varchar(" . GFORMS_MAX_FIELD_LENGTH . "),\n                  PRIMARY KEY  (id),\n                  KEY form_id (form_id),\n                  KEY lead_id (lead_id)\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                  lead_detail_id bigint(20) unsigned not null,\n                  value longtext,\n                  KEY lead_detail_key (lead_detail_id)\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();
     }
     update_option("rg_form_version", $version);
 }
开发者ID:812studio,项目名称:812studio,代码行数:45,代码来源:gravityforms.php

示例10: get_old_feeds

 /**
  * Retrieve any old feeds which need migrating to the framework,
  *
  * @return bool|array
  */
 public function get_old_feeds()
 {
     $this->log_debug(__METHOD__ . '(): Getting old feeds to migrate.');
     global $wpdb;
     $table_name = $wpdb->prefix . 'rg_coupons';
     if (!$this->table_exists($table_name)) {
         return false;
     }
     $form_table_name = RGFormsModel::get_form_table_name();
     //do not copy over the coupons that are associated with a form in the trash, include is_trash is null to get the coupons not associated with a form
     $sql = "SELECT c.* FROM {$table_name} c LEFT JOIN {$form_table_name} f ON c.form_id = f.id\r\n\t\t\t\tWHERE is_trash = 0 OR is_trash is null";
     $wpdb->hide_errors();
     //in case the user did not have the previous version of coupons and the table does not exist
     $results = $wpdb->get_results($sql, ARRAY_A);
     $count = sizeof($results);
     $this->log_debug(__METHOD__ . '(): ' . $count . ' records found.');
     for ($i = 0; $i < $count; $i++) {
         $results[$i]['meta'] = maybe_unserialize($results[$i]['meta']);
     }
     return $results;
 }
开发者ID:wp-premium,项目名称:gravityformscoupons,代码行数:26,代码来源:class-gf-coupons.php


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