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


PHP maybe_create_table函数代码示例

本文整理汇总了PHP中maybe_create_table函数的典型用法代码示例。如果您正苦于以下问题:PHP maybe_create_table函数的具体用法?PHP maybe_create_table怎么用?PHP maybe_create_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: install

 /**
 Install our table
 */
 function install()
 {
     // load our translations and strings
     $this->load_translations();
     // include upgrade-functions for maybe_create_table;
     if (!function_exists('maybe_create_table')) {
         require_once ABSPATH . 'wp-admin/install-helper.php';
     }
     $date = date('Y-m-d');
     $sql = "CREATE TABLE {$this->public} (\n\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\temail varchar(64) NOT NULL default '',\n\t\t\tactive tinyint(1) default 0,\n\t\t\tdate DATE default '{$date}' NOT NULL,\n\t\t\ttime TIME DEFAULT '00:00:00' NOT NULL,\n\t\t\tip char(64) NOT NULL default 'admin',\n\t\t\tconf_date DATE,\n\t\t\tconf_time TIME,\n\t\t\tconf_ip char(64),\n\t\t\tPRIMARY KEY (id) )";
     // create the table, as needed
     maybe_create_table($this->public, $sql);
     // create table entries for registered users
     $users = $this->get_all_registered('ID');
     if (!empty($users)) {
         foreach ($users as $user_ID) {
             $check_format = get_user_meta($user_ID, $this->get_usermeta_keyname('s2_format'), true);
             if (empty($check_format)) {
                 // no prior settings so create them
                 $this->register($user_ID);
             }
         }
     }
     // option to store ReadyGraph API Key
     add_option('readygraph_api', "include your api_key");
     // safety check if options exist and if not create them
     if (!is_array($this->subscribe2_options)) {
         $this->reset();
     }
 }
开发者ID:JunnLearning,项目名称:dk,代码行数:33,代码来源:class-s2-core.php

示例2: install_table_termmeta

/**
 * This function is called when the plugin is activated, it allow to create the SQL table.
 *
 * @return void
 * @author Amaury Balmer
 */
function install_table_termmeta()
{
    global $wpdb;
    if (!empty($wpdb->charset)) {
        $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
    }
    if (!empty($wpdb->collate)) {
        $charset_collate .= " COLLATE {$wpdb->collate}";
    }
    // Add one library admin function for next function
    require_once ABSPATH . 'wp-admin/includes/upgrade.php';
    // Try to create the meta table
    return maybe_create_table($wpdb->term_taxometa, "CREATE TABLE " . $wpdb->term_taxometa . " (\n\t\t\t`meta_id` int(20) NOT NULL auto_increment,\n\t\t\t`term_taxo_id` INT( 20 ) NOT NULL ,\n\t\t\t`meta_key` VARCHAR( 255 ) NOT NULL ,\n\t\t\t`meta_value` LONGTEXT NOT NULL,\n\t\t\tPRIMARY KEY  (`meta_id`),\n\t\t\tKEY `term_taxo_id` (`term_taxo_id`),\n\t\t\tKEY `meta_key` (`meta_key`)\n\t\t) {$charset_collate};");
}
开发者ID:herewithme,项目名称:simple-taxonomy-image,代码行数:20,代码来源:functions.inc.php

示例3: activate

 /**
  * Try to create the table during the installation
  *
  * @return void
  * @author Amaury Balmer
  */
 public static function activate()
 {
     global $wpdb;
     if (!empty($wpdb->charset)) {
         $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     }
     if (!empty($wpdb->collate)) {
         $charset_collate .= " COLLATE {$wpdb->collate}";
     }
     // Add one library admin function for next function
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     // Try to create the meta table
     return maybe_create_table($wpdb->posts_relations, "CREATE TABLE {$wpdb->posts_relations} (\n\t\t\t\t`id` int(20) NOT NULL auto_increment,\n\t\t\t\t`object_id_1` INT( 20 ) NOT NULL,\n\t\t\t\t`object_id_2` INT( 20 ) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tUNIQUE KEY `object_ids` (`object_id_1`,`object_id_2`)\n\t\t\t) {$charset_collate};");
 }
开发者ID:herewithme,项目名称:relation-post-types,代码行数:20,代码来源:class.base.php

示例4: install

 /**
 Install our table
 */
 function install()
 {
     // include upgrade-functions for maybe_create_table;
     if (!function_exists('maybe_create_table')) {
         require_once ABSPATH . 'wp-admin/install-helper.php';
     }
     $date = date('Y-m-d');
     $sql = "CREATE TABLE {$this->public} (\n\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\temail varchar(64) NOT NULL default '',\n\t\t\tactive tinyint(1) default 0,\n\t\t\tdate DATE default '{$date}' NOT NULL,\n\t\t\tip char(64) NOT NULL default 'admin',\n\t\t\tPRIMARY KEY (id) )";
     // create the table, as needed
     maybe_create_table($this->public, $sql);
     // safety check if options exist and if not create them
     if (!is_array($this->subscribe2_options)) {
         $this->reset();
     }
 }
开发者ID:juslee,项目名称:e27,代码行数:18,代码来源:class-s2-core.php

示例5: create_membership_table

function create_membership_table()
{
    global $wpdb;
    include_once ABSPATH . '/wp-admin/includes/upgrade.php';
    $table_charset = '';
    $prefix = $wpdb->prefix;
    $users_table = $prefix . 'um_vip_users';
    if ($wpdb->has_cap('collation')) {
        if (!empty($wpdb->charset)) {
            $table_charset = "DEFAULT CHARACTER SET {$wpdb->charset}";
        }
        if (!empty($wpdb->collate)) {
            $table_charset .= " COLLATE {$wpdb->collate}";
        }
    }
    $create_vip_users_sql = "CREATE TABLE {$users_table} (id int(11) NOT NULL auto_increment,user_id int(11) NOT NULL,user_type tinyint(4) NOT NULL default 0,startTime datetime NOT NULL default '0000-00-00 00:00:00',endTime datetime NOT NULL default '0000-00-00 00:00:00',PRIMARY KEY (id),INDEX uid_index(user_id),INDEX utype_index(user_type)) ENGINE = MyISAM {$table_charset};";
    maybe_create_table($users_table, $create_vip_users_sql);
}
开发者ID:pemiu01,项目名称:UM,代码行数:18,代码来源:membership.php

示例6: create_withdraw_table

function create_withdraw_table()
{
    global $wpdb;
    include_once ABSPATH . '/wp-admin/includes/upgrade.php';
    $table_charset = '';
    $prefix = $wpdb->prefix;
    $withdraw_table = $prefix . 'um_withdraw';
    if ($wpdb->has_cap('collation')) {
        if (!empty($wpdb->charset)) {
            $table_charset = "DEFAULT CHARACTER SET {$wpdb->charset}";
        }
        if (!empty($wpdb->collate)) {
            $table_charset .= " COLLATE {$wpdb->collate}";
        }
    }
    $create_withdraw_sql = "CREATE TABLE {$withdraw_table} (id int(11) NOT NULL auto_increment,user_id int(11) NOT NULL,time datetime NOT NULL default '0000-00-00 00:00:00',money double(10,2) NOT NULL default 0,balance double(10,2) NOT NULL default 0,status int(1) NOT NULL default 0,PRIMARY KEY (id)) ENGINE = MyISAM {$table_charset};";
    maybe_create_table($withdraw_table, $create_withdraw_sql);
}
开发者ID:pemiu01,项目名称:UM,代码行数:18,代码来源:affiliate.php

示例7: activate

 /**
  * Active the plugin action...
  *
  * @return void
  * @author Amaury Balmer
  */
 function activate()
 {
     global $locale, $wpdb;
     // Add option ?
     $new_options = array();
     $new_options['custom-types'] = array('post');
     $new_options['language'] = substr($locale, 0, 2);
     $new_options['region'] = substr($locale, 3, 2);
     $new_options['tooltip'] = SGM_TOOLTIP;
     add_option(SGM_OPTION, $new_options);
     // Create table ?
     if (!empty($wpdb->charset)) {
         $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     }
     if (!empty($wpdb->collate)) {
         $charset_collate .= " COLLATE {$wpdb->collate}";
     }
     // Add one library admin function for next function
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     // Try to create the meta table
     maybe_create_table($wpdb->simple_post_gmaps, "CREATE TABLE " . $wpdb->simple_post_gmaps . " (\n\t\t\t`post_id` INT(20) NOT NULL ,\n\t\t\t`long` DECIMAL( 11,8 ) NOT NULL,\n\t\t\t`lat` DECIMAL( 11,8 ) NOT NULL,\n\t\t\tUNIQUE KEY ( `post_id` )\n\t\t) {$charset_collate};");
 }
开发者ID:herewithme,项目名称:simple-post-gmaps,代码行数:28,代码来源:class.base.php

示例8: create_orders_table

function create_orders_table()
{
    if (ot_get_option('shop_system') == 'on') {
        global $wpdb;
        include_once ABSPATH . '/wp-admin/includes/upgrade.php';
        $table_charset = '';
        $prefix = $wpdb->prefix;
        $orders_table = $prefix . 'tin_orders';
        $promotes_table = $prefix . 'tin_promotes';
        if ($wpdb->has_cap('collation')) {
            if (!empty($wpdb->charset)) {
                $table_charset = "DEFAULT CHARACTER SET {$wpdb->charset}";
            }
            if (!empty($wpdb->collate)) {
                $table_charset .= " COLLATE {$wpdb->collate}";
            }
        }
        $create_orders_sql = "CREATE TABLE {$orders_table} (id int(11) NOT NULL auto_increment,order_id varchar(30) NOT NULL,trade_no varchar(30) NOT NULL,product_id int(20) NOT NULL,product_name varchar(250),order_time datetime NOT NULL default '0000-00-00 00:00:00',order_success_time datetime NOT NULL default '0000-00-00 00:00:00',order_price double(10,2) NOT NULL,order_currency varchar(20) NOT NULL default 'credit',order_quantity int(11) NOT NULL,order_total_price double(10,2) NOT NULL,order_status tinyint(4) NOT NULL default 0,order_note text,user_id int(11) NOT NULL,user_name varchar(60),user_email varchar(100),user_address varchar(250),user_zip varchar(10),user_phone varchar(20),user_cellphone varchar(20),user_message text,user_alipay varchar(100),PRIMARY KEY (id),INDEX orderid_index(order_id),INDEX tradeno_index(trade_no),INDEX productid_index(product_id),INDEX uid_index(user_id)) ENGINE = MyISAM {$table_charset};";
        maybe_create_table($orders_table, $create_orders_sql);
        $create_promotes_sql = "CREATE TABLE {$promotes_table} (id int(11) NOT NULL auto_increment,promote_code varchar(20) NOT NULL,promote_type varchar(20) NOT NULL default 'once',promote_status int(11) NOT NULL default 1,discount_value double(10,2) NOT NULL default 0.90,expire_date datetime NOT NULL default '0000-00-00 00:00:00',PRIMARY KEY (id),INDEX promotecode_index(promote_code)) ENGINE = MyISAM {$table_charset};";
        maybe_create_table($promotes_table, $create_promotes_sql);
    }
}
开发者ID:xiapistudio,项目名称:tinection-fixed,代码行数:23,代码来源:shop.php

示例9: activation

 /**
  * Create the tables if needed
  *
  * @param void
  * @return void
  * @author Nicolas Juen
  */
 public static function activation()
 {
     /* @var $wpdb wpdb */
     global $wpdb;
     // Charset
     if (!empty($wpdb->charset)) {
         $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     }
     if (!empty($wpdb->collate)) {
         $charset_collate .= " COLLATE {$wpdb->collate}";
     }
     // Add one library admin function for next function
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     // Campaign Table
     maybe_create_table($wpdb->bea_s_campaigns, "CREATE TABLE " . $wpdb->bea_s_campaigns . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`add_date` datetime NOT NULL,\n\t\t\t`scheduled_from` datetime NOT NULL,\n\t\t\t`current_status` varchar(10) NOT NULL,\n\t\t\t`from_name` varchar(255) NOT NULL,\n\t\t\t`from` varchar(255) NOT NULL,\n\t\t\t`subject` text NOT NULL\n\t\t) {$charset_collate};");
     add_clean_index($wpdb->bea_s_campaigns, 'id');
     add_clean_index($wpdb->bea_s_campaigns, 'current_status');
     // Receiver Table
     maybe_create_table($wpdb->bea_s_receivers, "CREATE TABLE " . $wpdb->bea_s_receivers . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`email` varchar(255) NOT NULL,\n\t\t\t`current_status` varchar(10) NOT NULL,\n\t\t\t`bounce_cat` varchar(20) NOT NULL,\n\t\t\t`bounce_type` varchar(20) NOT NULL,\n\t\t\t`bounce_no` varchar(10) NOT NULL\n\t\t) {$charset_collate};");
     maybe_add_column($wpdb->bea_s_receivers, 'bounce_cat', "ALTER TABLE {$wpdb->bea_s_receivers} ADD bounce_cat char(20)");
     maybe_add_column($wpdb->bea_s_receivers, 'bounce_type', "ALTER TABLE {$wpdb->bea_s_receivers} ADD bounce_type char(20)");
     maybe_add_column($wpdb->bea_s_receivers, 'bounce_no', "ALTER TABLE {$wpdb->bea_s_receivers} ADD bounce_no char(10)");
     add_clean_index($wpdb->bea_s_receivers, 'email');
     add_clean_index($wpdb->bea_s_receivers, 'current_status');
     // Recesiver/campaign link table
     maybe_create_table($wpdb->bea_s_re_ca, "CREATE TABLE " . $wpdb->bea_s_re_ca . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`id_campaign` int NOT NULL,\n\t\t\t`id_receiver` int NOT NULL,\n\t\t\t`id_content` int NOT NULL,\n\t\t\t`current_status` varchar(10) NOT NULL,\n\t\t\t`response` varchar(10) NOT NULL\n\t\t) {$charset_collate};");
     add_clean_index($wpdb->bea_s_re_ca, 'current_status');
     add_clean_index($wpdb->bea_s_re_ca, 'id_campaign');
     add_clean_index($wpdb->bea_s_re_ca, 'id_receiver');
     // Content Table
     maybe_create_table($wpdb->bea_s_contents, "CREATE TABLE " . $wpdb->bea_s_contents . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`html` longtext NOT NULL,\n\t\t\t`text` longtext NOT NULL\n\t\t) {$charset_collate};");
     add_clean_index($wpdb->bea_s_contents, 'id');
     // Attachment Table
     maybe_create_table($wpdb->bea_s_attachments, "CREATE TABLE " . $wpdb->bea_s_attachments . " (\n\t\t\t`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`campaign_id` int NOT NULL,\n\t\t\t`path` longtext NOT NULL\n\t\t) {$charset_collate};");
     add_clean_index($wpdb->bea_s_attachments, 'id');
     add_clean_index($wpdb->bea_s_attachments, 'campaign_id');
 }
开发者ID:asadowski10,项目名称:bea-sender,代码行数:44,代码来源:class.client.php

示例10: post_notification_install

function post_notification_install()
{
    global $wpdb;
    $t_emails = $wpdb->prefix . 'post_notification_emails';
    $t_posts = $wpdb->prefix . 'post_notification_posts';
    $t_cats = $wpdb->prefix . 'post_notification_cats';
    //******************************************//
    //**  Create WPPRAEFIX_post_notification table   **//
    //******************************************//
    if (!function_exists('maybe_create_table')) {
        require_once ABSPATH . 'wp-admin/install-helper.php';
    }
    $sql = "CREATE TABLE {$t_emails} (\r\n\t\t\t\t  id int( 11 ) NOT NULL auto_increment,\r\n\t\t\t\t  email_addr varchar( 255 ) default NULL,\r\n\t\t\t\t  gets_mail int( 11 ) default NULL,\r\n\t\t\t\t  last_modified timestamp( 14 ) NOT NULL,\r\n\t\t\t\t  date_subscribed datetime default NULL,\r\n\t\t\t\t  act_code varchar( 32 ) default NULL,\r\n\t\t\t\t  PRIMARY KEY  ( id )   \r\n\t\t   )";
    maybe_create_table($t_posts, $sql);
    $sql = "ALTER TABLE {$t_emails} ADD subscribe_ip INT UNSIGNED NOT NULL default 0";
    maybe_add_column($t_emails, 'subscribe_ip', $sql);
    //************************************************//
    //**  Create WPPRAEFIX_post_notification_posts table **//
    //************************************************//
    # Add new table
    $sql = "CREATE TABLE {$t_posts} (\r\n\t\t\t\tpost_id bigint(20) NOT NULL default '0',\r\n\t\t\t\tnotification_sent int NOT NULL default '-1',\r\n\t\t\t\tPRIMARY KEY  (post_ID)\r\n\t\t   )";
    maybe_create_table($t_posts, $sql);
    //Always adding this later keeps the code simple..... (Added in 2.2)
    $sql = "ALTER TABLE {$t_posts} ADD date_saved datetime NOT NULL default  '0000-00-00 00:00:00'";
    maybe_add_column($t_posts, 'date_saved', $sql);
    //This is in an if-statement, because auf the insert-statement.
    if ($wpdb->get_var("SHOW TABLES LIKE '{$t_cats}'") == NULL) {
        $sql = "CREATE TABLE {$t_cats} (\r\n\t\t\t\t\tid int( 11 ) NOT NULL,\r\n\t\t\t\t\tcat_id bigint(20) NOT NULL \r\n\t\t\t   )";
        maybe_create_table($t_cats, $sql);
        // Thanks to Karsten Tinnefeld for this nice query
        $wpdb->query("INSERT\r\n\t\t\t\t\tINTO    {$t_cats} (id, cat_id)\r\n\t\t\t\t\tSELECT  id, 0\r\n\t\t\t\t\tFROM    {$t_emails} e\r\n\t\t\t\t\tWHERE   NOT EXISTS (SELECT 1 \r\n\t\t\t\t\t\t\t\t\t\tFROM   {$t_cats} c \r\n\t\t\t\t\t\t\t\t\t\tWHERE c.id = e.id )");
    }
    //This actually belongs into the create statement but it's easyer to maintain this way
    $index = array();
    $indexlist = $wpdb->get_results("SHOW INDEX FROM {$t_cats}");
    foreach ($indexlist as $indexrow) {
        $index[] = $indexrow->Column_name;
    }
    if (!in_array('id', $index)) {
        $wpdb->query(" ALTER TABLE {$t_cats} ADD INDEX ( id )");
    }
    if (!in_array('cat_id', $index)) {
        $wpdb->query(" ALTER TABLE {$t_cats} ADD INDEX ( cat_id )");
    }
    $index = array();
    $indexlist = $wpdb->get_results("SHOW INDEX FROM {$t_emails}");
    foreach ($indexlist as $indexrow) {
        $index[] = $indexrow->Column_name;
    }
    if (!in_array('gets_mail', $index)) {
        $wpdb->query(" ALTER TABLE {$t_emails} ADD INDEX ( id , gets_mail )");
    }
    if (!in_array('email_addr', $index)) {
        $wpdb->query(" ALTER TABLE {$t_emails} ADD INDEX ( email_addr )");
    }
    $index = array();
    $indexlist = $wpdb->get_results("SHOW INDEX FROM {$t_posts}");
    foreach ($indexlist as $indexrow) {
        $index[] = $indexrow->Column_name;
    }
    if (!in_array('notification_sent', $index)) {
        $wpdb->query(" ALTER TABLE {$t_posts} ADD INDEX ( notification_sent )");
    }
    //}
    //************************************************//
    //**         Add Options
    //************************************************//
    load_plugin_textdomain('post_notification', POST_NOTIFICATION_PATH_REL);
    add_option('post_notification_show_content', 'no', 'Whether to mail the content', 'no');
    add_option('post_notification_read_more', '...', 'What to put in more-tag-text', 'no');
    add_option('post_notification_send_default', 'yes', 'Whether to send normal posts', 'no');
    add_option('post_notification_send_private', 'no', 'Whether to send private posts', 'no');
    add_option('post_notification_send_page', 'no', 'Whether to send private posts', 'no');
    add_option('post_notification_hdr_nl', "n", 'What kind of header', 'no');
    add_option('post_notification_from_email', get_option('admin_email'), 'The adress used as sender', 'no');
    add_option('post_notification_from_name', '@@blogname', 'The name used as sender', 'no');
    add_option('post_notification_subject', '@@blogname: @@title', 'The subject of the mail', 'no');
    add_option('post_notification_url', '', 'The URl to the main page', 'no');
    add_option('post_notification_template', "email_template.txt", 'The Template to use', 'no');
    add_option('post_notification_maxsend', "20", 'Number of Mails to send at once.', 'no');
    add_option('post_notification_pause', "10", 'Time between bursts of Mails', 'no');
    add_option('post_notification_nervous', "360", 'Nervous finger option');
    add_option('post_notification_nextsend', time(), 'When to send the next mail', 'yes');
    add_option('post_notification_lastsend', time(), 'When to send the last mail was sent.', 'no');
    add_option('post_notification_lastpost', time(), 'When the last post was published.', 'no');
    add_option('post_notification_page_meta', 'no', 'Whether to add a link to Meta', 'yes');
    //autoload is set to yes, because meta might need it.
    add_option('post_notification_page_name', __('Subscribe to Posts', 'post_notification'), 'Name of the Post Notification page.', 'yes');
    add_option('post_notification_uninstall', 'no', 'Uninstall on deaktivation', 'no');
    add_option('post_notification_captcha', '0', 'Number of captcha-cahars', 'no');
    add_option('post_notification_lock', 'file', 'Lockingtype', 'yes');
    add_option('post_notification_filter_include', 'yes', 'Include PN via filters', 'yes');
    add_option('post_notification_selected_cats', '0', 'The category preselection list.', 'no');
    add_option('post_notification_debug', 'no', 'Turn debugging on.', 'no');
    add_option('post_notification_the_content_exclude', serialize(array()), 'Include PN via filters', 'no');
    add_option('post_notification_empty_cats', 'no', 'Whether to show empty cats', 'no');
    add_option('post_notification_show_cats', 'yes', 'Whether to show cats', 'no');
    add_option('post_notification_subscribers', '0', 'Number of Subscibers', 'yes');
    add_option('post_notification_auto_subscribe', 'yes', 'Auto Subscribe when regist new user', 'no');
    if (is_dir(POST_NOTIFICATION_PATH . WPLANG)) {
//.........这里部分代码省略.........
开发者ID:jrep20,项目名称:samcozen,代码行数:101,代码来源:install.php

示例11: create_ratinglogs_table

function create_ratinglogs_table()
{
    global $wpdb;
    postratings_textdomain();
    if (@is_file(ABSPATH . '/wp-admin/includes/upgrade.php')) {
        include_once ABSPATH . '/wp-admin/includes/upgrade.php';
    } else {
        die('We have problem finding your \'/wp-admin/upgrade-functions.php\' and \'/wp-admin/includes/upgrade.php\'');
    }
    $charset_collate = '';
    if ($wpdb->has_cap('collation')) {
        if (!empty($wpdb->charset)) {
            $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
        }
        if (!empty($wpdb->collate)) {
            $charset_collate .= " COLLATE {$wpdb->collate}";
        }
    }
    // Create Post Ratings Table
    $create_ratinglogs_sql = "CREATE TABLE {$wpdb->ratings} (" . "rating_id INT(11) NOT NULL auto_increment," . "rating_postid INT(11) NOT NULL ," . "rating_posttitle TEXT NOT NULL," . "rating_rating INT(2) NOT NULL ," . "rating_timestamp VARCHAR(15) NOT NULL ," . "rating_ip VARCHAR(40) NOT NULL ," . "rating_host VARCHAR(200) NOT NULL," . "rating_username VARCHAR(50) NOT NULL," . "rating_userid int(10) NOT NULL default '0'," . "PRIMARY KEY (rating_id)) {$charset_collate};";
    maybe_create_table($wpdb->ratings, $create_ratinglogs_sql);
    // Add In Options (4 Records)
    add_option('postratings_image', 'stars');
    add_option('postratings_max', '5');
    add_option('postratings_template_vote', '%RATINGS_IMAGES_VOTE% (<strong>%RATINGS_USERS%</strong> ' . __('votes', 'wp-postratings') . __(',', 'wp-postratings') . ' ' . __('average', 'wp-postratings') . ': <strong>%RATINGS_AVERAGE%</strong> ' . __('out of', 'wp-postratings') . ' %RATINGS_MAX%)<br />%RATINGS_TEXT%');
    add_option('postratings_template_text', '%RATINGS_IMAGES% (<em><strong>%RATINGS_USERS%</strong> ' . __('votes', 'wp-postratings') . __(',', 'wp-postratings') . ' ' . __('average', 'wp-postratings') . ': <strong>%RATINGS_AVERAGE%</strong> ' . __('out of', 'wp-postratings') . ' %RATINGS_MAX%' . __(',', 'wp-postratings') . ' <strong>' . __('rated', 'wp-postratings') . '</strong></em>)');
    add_option('postratings_template_none', '%RATINGS_IMAGES_VOTE% (' . __('No Ratings Yet', 'wp-postratings') . ')<br />%RATINGS_TEXT%');
    // Database Upgrade For WP-PostRatings 1.02
    add_option('postratings_logging_method', '3');
    add_option('postratings_allowtorate', '2');
    // Database Uprade For WP-PostRatings 1.04
    maybe_add_column($wpdb->ratings, 'rating_userid', "ALTER TABLE {$wpdb->ratings} ADD rating_userid INT( 10 ) NOT NULL DEFAULT '0';");
    // Database Uprade For WP-PostRatings 1.05
    add_option('postratings_ratingstext', array(__('1 Star', 'wp-postratings'), __('2 Stars', 'wp-postratings'), __('3 Stars', 'wp-postratings'), __('4 Stars', 'wp-postratings'), __('5 Stars', 'wp-postratings')));
    add_option('postratings_template_highestrated', '<li><a href="%POST_URL%" title="%POST_TITLE%">%POST_TITLE%</a> %RATINGS_IMAGES% (%RATINGS_AVERAGE% ' . __('out of', 'wp-postratings') . ' %RATINGS_MAX%)</li>');
    // Database Upgrade For WP-PostRatings 1.11
    add_option('postratings_ajax_style', array('loading' => 1, 'fading' => 1));
    // Database Upgrade For WP-PostRatings 1.20
    add_option('postratings_ratingsvalue', array(1, 2, 3, 4, 5));
    add_option('postratings_customrating', 0);
    add_option('postratings_template_permission', '%RATINGS_IMAGES% (<em><strong>%RATINGS_USERS%</strong> ' . __('votes', 'wp-postratings') . __(',', 'wp-postratings') . ' ' . __('average', 'wp-postratings') . ': <strong>%RATINGS_AVERAGE%</strong> ' . __('out of', 'wp-postratings') . ' %RATINGS_MAX%</em>)<br /><em>' . __('You need to be a registered member to rate this post.', 'wp-postratings') . '</em>');
    // Database Upgrade For WP-PostRatings 1.30
    add_option('postratings_template_mostrated', '<li><a href="%POST_URL%"  title="%POST_TITLE%">%POST_TITLE%</a> - %RATINGS_USERS% ' . __('votes', 'wp-postratings') . '</li>');
    // Database Upgrade For WP-PostRatings 1.50
    delete_option('widget_ratings_highest_rated');
    delete_option('widget_ratings_most_rated');
    // Set 'manage_ratings' Capabilities To Administrator
    $role = get_role('administrator');
    if (!$role->has_cap('manage_ratings')) {
        $role->add_cap('manage_ratings');
    }
}
开发者ID:nvvetal,项目名称:water,代码行数:52,代码来源:wp-postratings.php

示例12: eme_create_payments_table

function eme_create_payments_table($charset, $collate)
{
    global $wpdb;
    $db_version = get_option('eme_version');
    $table_name = $wpdb->prefix . PAYMENTS_TBNAME;
    if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") != $table_name) {
        $sql = "CREATE TABLE " . $table_name . " (\n         id int(11) NOT NULL auto_increment,\n         creation_date_gmt datetime NOT NULL DEFAULT '0000-00-00 00:00:00', \n         booking_ids text NOT NULL,\n         random_id tinytext NOT NULL,\n         UNIQUE KEY  (id)\n         ) {$charset} {$collate};";
        maybe_create_table($table_name, $sql);
    } else {
        maybe_add_column($table_name, 'random_id', "alter table {$table_name} add random_id tinytext NOT NULL;");
        if ($db_version < 80) {
            $payment_ids = $wpdb->get_col("SELECT id FROM {$table_name}");
            foreach ($payment_ids as $payment_id) {
                $random_id = eme_payment_random_id();
                $sql = $wpdb->prepare("UPDATE {$table_name} SET random_id = %s WHERE id = %d", $random_id, $payment_id);
                $wpdb->query($sql);
            }
        }
    }
}
开发者ID:johnmanlove,项目名称:Bridgeland,代码行数:20,代码来源:events-manager.php

示例13: create_tables

 function create_tables()
 {
     global $wpdb;
     $dbv = get_option('spec_comment_dbv', 0);
     $comment_log = $this->get_table_names();
     // If the table changes in the future this'll get a little more work
     if (version_compare($dbv, SPEC_COMMENT_DBV, 'ge')) {
         return true;
     }
     // Make sure maybe_create_table is to hand.
     if ((!function_exists('maybe_create_table') || !function_exists('check_column')) && file_exists(ABSPATH . '/wp-admin/install-helper.php')) {
         require_once ABSPATH . '/wp-admin/install-helper.php';
     }
     $table = "CREATE TABLE {$comment_log}  (\r\n\t\t\t\t\t\tid BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT, INDEX USING BTREE ( id ), PRIMARY KEY ( id ),\r\n\t\t\t\t\t\tdate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, INDEX USING BTREE ( date ),\r\n\t\t\t\t\t\tpost_id BIGINT( 20 ) UNSIGNED NOT NULL, INDEX USING BTREE ( post_id ),\r\n\t\t\t\t\t\tcomment_id BIGINT( 20 ) UNSIGNED NOT NULL, INDEX USING BTREE ( comment_id ),\r\n\t\t\t\t\t\taction_taken varchar( 64 )\r\n\t\t\t\t\t  ) ENGINE = MEMORY;";
     // Create the tables if needed.
     if (!maybe_create_table($comment_log, $table)) {
         return false;
     }
     // Drop out if we fail, will mean we keep trying as the toggle won't get set
     if (!update_option('spec_comment_dbv', SPEC_COMMENT_DBV)) {
         add_option('spec_comment_dbv', SPEC_COMMENT_DBV);
     }
 }
开发者ID:gagelafleur,项目名称:thebluemuse,代码行数:23,代码来源:db.php

示例14: SetupConfiguration

/**
 *Handles the creation of the table needed to store all the data
 */
function SetupConfiguration()
{
    if (!function_exists('maybe_create_table')) {
        require_once ABSPATH . DIRECTORY_SEPARATOR . 'wp-admin' . DIRECTORY_SEPARATOR . 'upgrade-functions.php';
    }
    $create_table_sql = "CREATE TABLE " . POSTIE_TABLE . " (\n         label text NOT NULL,\n         value text not NULL\n             );";
    maybe_create_table(POSTIE_TABLE, $create_table_sql);
}
开发者ID:robfelty,项目名称:postie,代码行数:11,代码来源:postie-functions.php

示例15: __invoke

 public function __invoke()
 {
     require_once ABSPATH . 'wp-admin/install-helper.php';
     return maybe_create_table($this->schema->getName(), $this->getSql());
 }
开发者ID:wells5609,项目名称:wp-app,代码行数:5,代码来源:Create.php


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