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


PHP NewsletterModule类代码示例

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


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


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