Initial import of the bdmurphy Bookshelf work: the bd-bookshelf theme, bd-bookshelf-plugin, bd-bookshelfhelper and bd-simpleemail plugins, plus the specification documents, mockups and release archives.
51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Email Installation and Database
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
class BD_SimpleEmail_Install {
|
|
public static function activate() {
|
|
self::create_tables();
|
|
}
|
|
|
|
public static function deactivate() {
|
|
}
|
|
|
|
public static function create_tables() {
|
|
global $wpdb;
|
|
$charset_collate = $wpdb->get_charset_collate();
|
|
|
|
$tables = array(
|
|
"CREATE TABLE IF NOT EXISTS {$wpdb->prefix}bd_subscribers (
|
|
id bigint(20) NOT NULL AUTO_INCREMENT,
|
|
email varchar(255) NOT NULL,
|
|
first_name varchar(100) DEFAULT NULL,
|
|
status varchar(20) DEFAULT 'subscribed',
|
|
subscribed_at datetime DEFAULT CURRENT_TIMESTAMP,
|
|
unsubscribed_at datetime DEFAULT NULL,
|
|
ip_address varchar(45) DEFAULT NULL,
|
|
PRIMARY KEY (id),
|
|
UNIQUE KEY email (email)
|
|
) $charset_collate;",
|
|
|
|
"CREATE TABLE IF NOT EXISTS {$wpdb->prefix}bd_newsletters (
|
|
id bigint(20) NOT NULL AUTO_INCREMENT,
|
|
subject varchar(255) NOT NULL,
|
|
body_html text,
|
|
sent_at datetime DEFAULT CURRENT_TIMESTAMP,
|
|
recipient_count int(11) DEFAULT 0,
|
|
PRIMARY KEY (id)
|
|
) $charset_collate;",
|
|
);
|
|
|
|
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
|
|
|
foreach ($tables as $table) {
|
|
dbDelta($table);
|
|
}
|
|
}
|
|
} |