• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP NewsletterModule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 function __construct($module)
 {
     $this->module = $module;
     if (defined('NEWSLETTER_LOG_LEVEL')) {
         $this->level = NEWSLETTER_LOG_LEVEL;
     } else {
         $this->level = get_option('newsletter_log_level', self::ERROR);
     }
     $secret = get_option('newsletter_logger_secret');
     if (strlen($secret) < 8) {
         $secret = NewsletterModule::get_token(8);
         update_option('newsletter_logger_secret', $secret);
     }
     if (!wp_mkdir_p(NEWSLETTER_LOG_DIR)) {
         $this->level = self::NONE;
     }
     $this->file = NEWSLETTER_LOG_DIR . '/' . $module . '-' . $secret . '.txt';
 }
开发者ID:lenguyenitc,项目名称:donations,代码行数:18,代码来源:logger.php


示例2: array

        $query .= ")";
    }
    $email['query'] = $query;
    if ($controls->is_action('test')) {
        $email['total'] = 0;
    } else {
        $email['total'] = $wpdb->get_var(str_replace('*', 'count(*)', $query));
    }
    $email['sent'] = 0;
    $email['last_id'] = 0;
    $email['send_on'] = $controls->data['send_on'];
    if ($controls->is_action('editor')) {
        $email['editor'] = $email['editor'] == 0 ? 1 : 0;
    }
    // Cleans up of tag
    $email['message'] = NewsletterModule::clean_url_tags($email['message']);
    $res = Newsletter::instance()->save_email($email);
    if ($res === false) {
        $controls->errors = 'Unable to save. Try to deactivate and reactivate the plugin may be the database is out of sync.';
    }
    $controls->data['message'] = $email['message'];
    $controls->messages .= 'Saved.<br>';
}
if ($controls->is_action('send')) {
    $wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' => 'sending'), array('id' => $email_id));
    $email['status'] = 'sending';
    $controls->messages .= "Email added to the queue.";
}
if ($controls->is_action('pause')) {
    $wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' => 'paused'), array('id' => $email_id));
    $email['status'] = 'paused';
开发者ID:taeche,项目名称:SoDoEx,代码行数:31,代码来源:edit.php


示例3: trim

     if (empty($controls->data['confirmed_subject'])) {
         $controls->data['confirmed_subject'] = $defaults['confirmed_subject'];
     }
     if (empty($controls->data['confirmed_message'])) {
         $controls->data['confirmed_message'] = $defaults['confirmed_message'];
     }
     if (empty($controls->data['unsubscribed_text'])) {
         $controls->data['unsubscribed_text'] = $defaults['unsubscribed_text'];
     }
     $controls->data['confirmed_message'] = NewsletterModule::clean_url_tags($controls->data['confirmed_message']);
     $controls->data['confirmed_text'] = NewsletterModule::clean_url_tags($controls->data['confirmed_text']);
     $controls->data['confirmation_text'] = NewsletterModule::clean_url_tags($controls->data['confirmation_text']);
     $controls->data['confirmation_message'] = NewsletterModule::clean_url_tags($controls->data['confirmation_message']);
     $controls->data['unsubscription_text'] = NewsletterModule::clean_url_tags($controls->data['unsubscription_text']);
     $controls->data['unsubscribed_text'] = NewsletterModule::clean_url_tags($controls->data['unsubscribed_text']);
     $controls->data['unsubscribed_message'] = NewsletterModule::clean_url_tags($controls->data['unsubscribed_message']);
     $controls->data['confirmed_url'] = trim($controls->data['confirmed_url']);
     $controls->data['confirmation_url'] = trim($controls->data['confirmation_url']);
     $module->save_options($controls->data);
     $controls->messages = 'Saved.';
 }
 if ($controls->is_action('create')) {
     $page = array();
     $page['post_title'] = 'Newsletter';
     $page['post_content'] = '[newsletter]';
     $page['post_status'] = 'publish';
     $page['post_type'] = 'page';
     $page['comment_status'] = 'closed';
     $page['ping_status'] = 'closed';
     $page['post_category'] = array(1);
     // Insert the post into the database
开发者ID:chicosilva,项目名称:olharambiental,代码行数:31,代码来源:options.php


示例4: explode

}
if ($controls->is_action('bounces')) {
    $lines = explode("\n", $controls->data['bounced_emails']);
    $total = 0;
    $marked = 0;
    $error = 0;
    $not_found = 0;
    $already_bounced = 0;
    $results = '';
    foreach ($lines as &$email) {
        $email = trim($email);
        if (empty($email)) {
            continue;
        }
        $total++;
        $email = NewsletterModule::normalize_email($email);
        if (empty($email)) {
            $results .= '[INVALID] ' . $email . "\n";
            $error++;
            continue;
        }
        $user = NewsletterUsers::instance()->get_user($email);
        if ($user == null) {
            $results .= '[NOT FOUND] ' . $email . "\n";
            $not_found++;
            continue;
        }
        if ($user->status == 'B') {
            $results .= '[ALREADY BOUNCED] ' . $email . "\n";
            $already_bounced++;
            continue;
开发者ID:radikalportal,项目名称:radikalportal,代码行数:31,代码来源:massive.php


示例5: record

 function record()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         return;
     }
     if (is_admin() && strpos($_SERVER['REQUEST_URI'], 'admin.php') !== false) {
         return;
     }
     if (!isset($this->options['record'])) {
         return;
     }
     if (!current_user_can('manage_options')) {
         return;
     }
     // Check if there is an email
     foreach ($_POST as $key => $value) {
         if (!NewsletterModule::is_email($value)) {
             continue;
         }
         add_option($this->prefix . '_record', '', null, 'no');
         update_option($this->prefix . '_record', stripslashes_deep($_POST));
         return;
     }
 }
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:24,代码来源:grabber.php


示例6: trim

     if (empty($controls->data['confirmation_message'])) {
         $controls->data['confirmation_message'] = $defaults['confirmation_message'];
     }
     if (empty($controls->data['confirmed_text'])) {
         $controls->data['confirmed_text'] = $defaults['confirmed_text'];
     }
     if (empty($controls->data['confirmed_subject'])) {
         $controls->data['confirmed_subject'] = $defaults['confirmed_subject'];
     }
     if (empty($controls->data['confirmed_message'])) {
         $controls->data['confirmed_message'] = $defaults['confirmed_message'];
     }
     $controls->data['confirmed_message'] = NewsletterModule::clean_url_tags($controls->data['confirmed_message']);
     $controls->data['confirmed_text'] = NewsletterModule::clean_url_tags($controls->data['confirmed_text']);
     $controls->data['confirmation_text'] = NewsletterModule::clean_url_tags($controls->data['confirmation_text']);
     $controls->data['confirmation_message'] = NewsletterModule::clean_url_tags($controls->data['confirmation_message']);
     $controls->data['confirmed_url'] = trim($controls->data['confirmed_url']);
     $controls->data['confirmation_url'] = trim($controls->data['confirmation_url']);
     // Checkboxes patch
     $options = get_option('newsletter', array());
     for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
         unset($options['preferences_' . $i]);
     }
     update_option('newsletter', $options);
     $module->merge_options($controls->data);
     $controls->messages = 'Saved.';
 }
 if ($controls->is_action('create')) {
     $page = array();
     $page['post_title'] = 'Newsletter';
     $page['post_content'] = '[newsletter]';
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:31,代码来源:options.php


示例7: save_user

 /**
  * NEVER CHANGE THIS METHOD SIGNATURE, USER BY THIRD PARTY PLUGINS.
  *
  * Saves a new user on the database. Return false if the email (that must be unique) is already
  * there. For a new users set the token and creation time if not passed.
  *
  * @param array|object $user
  */
 function save_user($user, $return_format = OBJECT)
 {
     if (is_object($user)) {
         $user = (array) $user;
     }
     if (empty($user['id'])) {
         $existing = $this->get_user($user['email']);
         if ($existing != null) {
             return false;
         }
         if (empty($user['token'])) {
             $user['token'] = NewsletterModule::get_token();
         }
         //if (empty($user['created'])) $user['created'] = time();
         // Database default
         //if (empty($user['status'])) $user['status'] = 'S';
     }
     // Due to the unique index on email field, this can fail.
     return $this->store->save(NEWSLETTER_USERS_TABLE, $user, $return_format);
 }
开发者ID:taeche,项目名称:SoDoEx,代码行数:28,代码来源:module.php


示例8: count

    }
    if (!$found) {
        echo 'The "newsletter" schedule was not found, email delivery won\'t work.';
    }
}
?>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                Delivery Engine
                            </td>
                            <td>
                                <?php 
echo NewsletterModule::format_scheduler_time('newsletter');
?>
                                <?php 
$controls->button('trigger', 'Trigger now');
?>
                                <p class="description">
                                    If inactive or always in "running now" status your blog has a problem: <a href="http://www.thenewsletterplugin.com/how-to-make-the-wordpress-cron-work" target="_blank">read more here</a>.
                                </p>
                            </td>
                        </tr>
                        <tr>
                            <td>Collected samples</td>
                            <td>
                                <?php 
echo count($calls);
?>
开发者ID:ilke-zilci,项目名称:newcomers-wp,代码行数:31,代码来源:diagnostic.php


示例9: upgrade

 function upgrade()
 {
     parent::upgrade();
     if ($this->old_version < '1.0.2') {
         // Locked content configuration migration
         $old_options = Newsletter::instance()->get_options();
         if (isset($old_options['lock_message']) || isset($old_options['lock_ids']) || isset($old_options['lock_url'])) {
             $this->options['ids'] = $old_options['lock_ids'];
             $this->options['url'] = $old_options['lock_url'];
             $this->options['message'] = $old_options['lock_message'];
             $this->options['enabled'] = 1;
             $this->save_options($this->options);
             unset($old_options['lock_ids']);
             unset($old_options['lock_url']);
             unset($old_options['lock_message']);
             Newsletter::instance()->save_options($old_options);
         }
         $old_options = NewsletterSubscription::instance()->get_options('lock');
         if (!empty($old_options)) {
             $this->options['ids'] = $old_options['ids'];
             $this->options['url'] = $old_options['url'];
             $this->options['message'] = $old_options['message'];
             $this->options['enabled'] = 1;
             $this->save_options($this->options);
             NewsletterSubscription::instance()->delete_options('lock');
         }
     }
 }
开发者ID:radikalportal,项目名称:radikalportal,代码行数:28,代码来源:lock.php


示例10: upgrade

 function upgrade()
 {
     global $wpdb, $charset_collate;
     parent::upgrade();
     // This before table creation or update for compatibility
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column newsletter_id user_id int not null default 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column newsletter_id user_id int not null default 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column date created timestamp not null default current_timestamp");
     // Just for test since it will be part of statistics module
     // This table stores clicks and email opens. An open is registered with a empty url.
     $this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_stats (id int auto_increment, primary key (id)) {$charset_collate}");
     // References
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column user_id int not null default 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column email_id int not null default 0");
     // Future... see the links table
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column link_id int not null default 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column created timestamp not null default current_timestamp");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column url varchar(255) not null default ''");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column anchor varchar(200) not null default ''");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column ip varchar(20) not null default ''");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column country varchar(4) not null default ''");
     $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_stats` ADD INDEX `email_id` (`email_id`)");
     $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_stats` ADD INDEX `user_id` (`user_id`)");
     // Stores the link of every email to create short links
     //        $this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_links (id int auto_increment, primary key (id)) $charset_collate");
     //        $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column email_id int not null default 0");
     //        $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column token varchar(10) not null default ''");
     //        $this->upgrade_query("alter table {$wpdb->prefix}newsletter_links add column text varchar(255) not null default ''");
     //$this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_stats (id int auto_increment, primary key (id)) $charset_collate");
 }
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:30,代码来源:statistics.php


示例11: upgrade

 function upgrade()
 {
     parent::upgrade();
     if ($this->old_version < '1.0.0') {
         // Locked content configuration migration
         $old_options = $old_options = NewsletterSubscription::instance()->get_options();
         if (isset($old_options['wp_welcome'])) {
             $this->options['welcome'] = $old_options['wp_welcome'];
         }
         if (isset($old_options['wp_delete'])) {
             $this->options['delete'] = $old_options['wp_delete'];
         }
         if (isset($old_options['subscribe_wp_users_label'])) {
             $this->options['subscribe_label'] = $old_options['subscribe_wp_users_label'];
         }
         if (isset($old_options['subscribe_wp_users'])) {
             $this->options['subscribe'] = $old_options['subscribe_wp_users'];
         }
         if (isset($old_options['wp_send_confirmation'])) {
             $this->options['confirmation'] = $old_options['wp_send_confirmation'];
         }
         $this->save_options($this->options);
         unset($old_options['wp_welcome']);
         unset($old_options['wp_delete']);
         unset($old_options['subscribe_wp_users_label']);
         unset($old_options['subscribe_wp_users']);
         unset($old_options['wp_send_confirmation']);
         NewsletterSubscription::instance()->save_options($old_options);
     }
 }
开发者ID:radikalportal,项目名称:radikalportal,代码行数:30,代码来源:wp.php


示例12: upgrade

 function upgrade()
 {
     global $wpdb, $charset_collate;
     parent::upgrade();
     // This before table creation or update for compatibility
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column newsletter_id user_id int not null default 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column newsletter_id user_id int not null default 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column date created timestamp not null default current_timestamp");
     // Just for test since it will be part of statistics module
     // This table stores clicks and email opens. An open is registered with a empty url.
     $this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_stats (id int auto_increment, primary key (id)) {$charset_collate}");
     // References
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column user_id int not null default 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column email_id int not null default 0");
     // Future... see the links table
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column link_id int not null default 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column created timestamp not null default current_timestamp");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column url varchar(255) not null default ''");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column anchor varchar(200) not null default ''");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column ip varchar(20) not null default ''");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column country varchar(4) not null default ''");
     $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_stats` ADD INDEX `email_id` (`email_id`)");
     $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_stats` ADD INDEX `user_id` (`user_id`)");
     if (empty($this->options['key'])) {
         $this->options['key'] = md5($_SERVER['REMOTE_ADDR'] . rand(100000, 999999) . time());
         $this->save_options($this->options);
     }
     $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_emails` ADD COLUMN `open_count` int UNSIGNED NOT NULL DEFAULT 0");
     $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_emails` ADD COLUMN `click_count`  int UNSIGNED NOT NULL DEFAULT 0");
     $this->upgrade_query("alter table {$wpdb->prefix}newsletter_emails change column read_count open_count int not null default 0");
 }
开发者ID:radikalportal,项目名称:radikalportal,代码行数:31,代码来源:statistics.php


示例13: tinyint

 function upgrade()
 {
     global $wpdb, $charset_collate;
     parent::upgrade();
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " change column `type` `type` varchar(50) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column token varchar(10) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " drop column visibility");
     $this->upgrade_query("update " . NEWSLETTER_EMAILS_TABLE . " set type='message' where type=''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column private tinyint(1) not null default 0");
     // Force a token to email without one already set.
     $token = self::get_token();
     $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set token='" . $token . "' where token=''");
     return true;
 }
开发者ID:jrialland,项目名称:site-plr,代码行数:14,代码来源:emails.php


示例14: upgrade

 function upgrade()
 {
     global $wpdb, $charset_collate;
     parent::upgrade();
     $this->upgrade_query("create table if not exists " . NEWSLETTER_USERS_TABLE . " (id int auto_increment, `email` varchar(100) not null default '', primary key (id), unique key email (email)) {$charset_collate}");
     // User personal data
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column name varchar(100) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column surname varchar(100) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column sex char(1) not null default 'n'");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " change column sex sex char(1) not null default 'n'");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column status char(1) not null default 'S'");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column created timestamp not null default current_timestamp");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column token varchar(50) not null default ''");
     // Feed by mail
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column feed tinyint(4) not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column feed_time bigint(20) not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column country varchar(4) not null default ''");
     // List/Preferences
     for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
         $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column list_{$i} tinyint(4) not null default 0");
     }
     // Profiles
     for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) {
         $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column profile_{$i} varchar(255) not null default ''");
     }
     // TODO: Still makes sense the referrer?
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column referrer varchar(50) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column http_referer varchar(255) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column wp_user_id int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column ip varchar(50) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column test tinyint(4) not null default 0");
     // TODO: Flow module should add that it self (?)
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column flow tinyint(4) not null default 0");
     // Old problems...
     $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " convert to character set utf8");
     $this->upgrade_query("update " . NEWSLETTER_USERS_TABLE . " set sex='n' where sex='' or sex=' '");
     if ($this->old_version < '1.0.5') {
         $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column unsub_email_id int not null default 0");
         $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column unsub_time int not null default 0");
     }
 }
开发者ID:radikalportal,项目名称:radikalportal,代码行数:41,代码来源:users.php


示例15: array

 function get_options($sub = '')
 {
     if ($sub == '') {
         // For compatibility the options are wrongly named
         return get_option('newsletter', array());
     }
     if ($sub == 'profile') {
         // For compatibility the options are wrongly named
         return get_option('newsletter_profile', array());
     }
     return parent::get_options($sub);
 }
开发者ID:hbenbrahim,项目名称:wp-capdema,代码行数:12,代码来源:subscription.php


示例16: upgrade

 function upgrade()
 {
     global $wpdb, $charset_collate;
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     parent::upgrade();
     $this->upgrade_query("create table if not exists " . NEWSLETTER_EMAILS_TABLE . " (id int auto_increment, primary key (id)) {$charset_collate}");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column message longtext");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column message_text longtext");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column subject varchar(255) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column type varchar(50) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column created timestamp not null default current_timestamp");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column status enum('new','sending','sent','paused') not null default 'new'");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column total int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column last_id int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column sent int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column send_on int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column track tinyint not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column editor tinyint not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column sex char(1) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " change column sex sex char(1) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column query text");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column preferences text");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column options longtext");
     // Cleans up old installations
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " drop column name");
     $this->upgrade_query("drop table if exists " . $wpdb->prefix . "newsletter_work");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " convert to character set utf8");
     // WP does not manage composite primary key when it tries to upgrade a table...
     $suppress_errors = $wpdb->suppress_errors(true);
     dbDelta("CREATE TABLE " . $wpdb->prefix . "newsletter_sent (\n            email_id int(10) unsigned NOT NULL DEFAULT '0',\n            user_id int(10) unsigned NOT NULL DEFAULT '0',\n            status tinyint(1) unsigned NOT NULL DEFAULT '0',\n            open tinyint(1) unsigned NOT NULL DEFAULT '0',\n            time int(10) unsigned NOT NULL DEFAULT '0',\n            error varchar(100) NOT NULL DEFAULT '',\n\t    ip varchar(100) NOT NULL DEFAULT '',\n            PRIMARY KEY (email_id,user_id),\n            KEY user_id (user_id),\n            KEY email_id (email_id)\n          ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
     $wpdb->suppress_errors($suppress_errors);
     if ('utf8mb4' === $wpdb->charset) {
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         if (function_exists('maybe_convert_table_to_utf8mb4')) {
             maybe_convert_table_to_utf8mb4(NEWSLETTER_EMAILS_TABLE);
         }
     }
     // Some setting check to avoid the common support request for mis-configurations
     $options = $this->get_options();
     if (empty($options['sender_email'])) {
         // That code was taken from WordPress
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         // WordPress build an address in the same way using wordpress@...
         $options['sender_email'] = 'newsletter@' . $sitename;
         $this->save_options($options);
     }
     if (empty($options['scheduler_max']) || !is_numeric($options['scheduler_max'])) {
         $options['scheduler_max'] = 100;
         $this->save_options($options);
     }
     if (empty($options['api_key'])) {
         $options['api_key'] = self::get_token();
         $this->save_options($options);
     }
     if (empty($options['scheduler_max'])) {
         $options['scheduler_max'] = 100;
         $this->save_options($options);
     }
     wp_clear_scheduled_hook('newsletter');
     wp_schedule_event(time() + 30, 'newsletter', 'newsletter');
     wp_clear_scheduled_hook('newsletter_extension_versions');
     wp_schedule_event(time() + 30, 'newsletter_extension_versions', 'newsletter_weekly');
     add_option('newsletter_extension_versions', array(), null, 'no');
     wp_clear_scheduled_hook('newsletter_update');
     wp_clear_scheduled_hook('newsletter_check_versions');
     //wp_mkdir_p(WP_CONTENT_DIR . '/extensions/newsletter');
     //wp_mkdir_p(WP_CONTENT_DIR . '/cache/newsletter');
     //wp_clear_scheduled_hook('newsletter_updates_run');
     wp_clear_scheduled_hook('newsletter_statistics_version_check');
     wp_clear_scheduled_hook('newsletter_reports_version_check');
     wp_clear_scheduled_hook('newsletter_feed_version_check');
     wp_clear_scheduled_hook('newsletter_popup_version_check');
     // If the original options has already saved once
     if (isset($options['smtp_host'])) {
         $smtp_options['enabled'] = $options['smtp_enabled'];
         $smtp_options['test_email'] = $options['smtp_test_email'];
         $smtp_options['host'] = $options['smtp_host'];
         $smtp_options['pass'] = $options['smtp_pass'];
         $smtp_options['port'] = $options['smtp_port'];
         $smtp_options['user'] = $options['smtp_user'];
         $smtp_options['secure'] = $options['smtp_secure'];
         $this->save_options($smtp_options, 'smtp');
         unset($options['smtp_enabled']);
         unset($options['smtp_test_email']);
         unset($options['smtp_pass']);
         unset($options['smtp_port']);
         unset($options['smtp_user']);
         unset($options['smtp_secure']);
         unset($options['smtp_host']);
         $this->save_options($options);
     }
     $this->init_options('smtp');
     return true;
 }
开发者ID:radikalportal,项目名称:radikalportal,代码行数:97,代码来源:plugin.php


示例17:

 function __construct()
 {
     parent::__construct('feed', '1.0.0');
 }
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:4,代码来源:feed.php


示例18: upgrade

 function upgrade()
 {
     global $wpdb, $charset_collate;
     parent::upgrade();
     $this->upgrade_query("create table if not exists " . NEWSLETTER_EMAILS_TABLE . " (id int auto_increment, primary key (id)) {$charset_collate}");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column message longtext");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column message_text longtext");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column subject varchar(255) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column type varchar(50) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column created timestamp not null default current_timestamp");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column status enum('new','sending','sent','paused') not null default 'new'");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column total int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column last_id int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column sent int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column send_on int not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column track tinyint not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column editor tinyint not null default 0");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column sex char(1) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " change column sex sex char(1) not null default ''");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column query text");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column preferences text");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column options longtext");
     // Cleans up old installations
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " drop column name");
     $this->upgrade_query("drop table if exists " . $wpdb->prefix . "newsletter_work");
     $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " convert to character set utf8");
     if ($charset_collate != 'utf8mb4') {
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         if (function_exists('maybe_convert_table_to_utf8mb4')) {
             maybe_convert_table_to_utf8mb4(NEWSLETTER_EMAILS_TABLE);
         }
     }
     // Some setting check to avoid the common support request for mis-configurations
     $options = $this->get_options();
     if (empty($options['sender_email'])) {
         // That code was taken from WordPress
         $sitename = strtolower($_SERVER['SERVER_NAME']);
         if (substr($sitename, 0, 4) == 'www.') {
             $sitename = substr($sitename, 4);
         }
         // WordPress build an address in the same way using wordpress@...
         $options['sender_email'] = 'newsletter@' . $sitename;
         $this->save_options($options);
     }
     if (empty($options['scheduler_max']) || !is_numeric($options['scheduler_max'])) {
         $options['scheduler_max'] = 100;
         $this->save_options($options);
     }
     if (empty($options['api_key'])) {
         $options['api_key'] = self::get_token();
         $this->save_options($options);
     }
     if (empty($options['scheduler_max'])) {
         $options['scheduler_max'] = 100;
         $this->save_options($options);
     }
     wp_clear_scheduled_hook('newsletter');
     wp_schedule_event(time() + 30, 'newsletter', 'newsletter');
     wp_clear_scheduled_hook('newsletter_extension_versions');
     wp_schedule_event(time() + 30, 'newsletter_extension_versions', 'newsletter_weekly');
     add_option('newsletter_extension_versions', array(), null, 'no');
     wp_clear_scheduled_hook('newsletter_update');
     wp_clear_scheduled_hook('newsletter_check_versions');
     wp_mkdir_p(WP_CONTENT_DIR . '/extensions/newsletter');
     wp_mkdir_p(WP_CONTENT_DIR . '/cache/newsletter');
     //wp_clear_scheduled_hook('newsletter_updates_run');
     wp_clear_scheduled_hook('newsletter_statistics_version_check');
     wp_clear_scheduled_hook('newsletter_reports_version_check');
     wp_clear_scheduled_hook('newsletter_feed_version_check');
     wp_clear_scheduled_hook('newsletter_popup_version_check');
     return true;
 }
开发者ID:blocher,项目名称:oneholyname,代码行数:72,代码来源:plugin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP NewsletterSubscription类代码示例发布时间:2022-05-23
下一篇:
PHP NewsletterControls类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap