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


PHP Newsletter::instance方法代码示例

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


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

示例1: get_current_theme_options

 function get_current_theme_options()
 {
     $theme_options = $this->themes->get_options($this->get_current_theme());
     // main options merge
     $main_options = Newsletter::instance()->options;
     foreach ($main_options as $key => $value) {
         $theme_options['main_' . $key] = $value;
     }
     return $theme_options;
 }
开发者ID:raminabsari,项目名称:phonicsschool,代码行数:10,代码来源:emails.php

示例2: floor

}
//if (isset($controls->data['search_test'])) {
//    $where .= " and test=1";
//}
if (!empty($controls->data['search_status'])) {
    if ($controls->data['search_status'] == 'T') {
        $where .= " and test=1";
    } else {
        $query_args[] = $controls->data['search_status'];
        $where .= " and status=%s";
    }
}
// Total items, total pages
$items_per_page = 20;
$where = $wpdb->prepare($where, $query_args);
$count = Newsletter::instance()->store->get_count(NEWSLETTER_USERS_TABLE, $where);
$last_page = floor($count / $items_per_page) - ($count % $items_per_page == 0 ? 1 : 0);
if ($last_page < 0) {
    $last_page = 0;
}
if ($controls->is_action('last')) {
    $controls->data['search_page'] = $last_page;
}
if ($controls->is_action('first')) {
    $controls->data['search_page'] = 0;
}
if ($controls->is_action('next')) {
    $controls->data['search_page'] = (int) $controls->data['search_page'] + 1;
}
if ($controls->is_action('prev')) {
    $controls->data['search_page'] = (int) $controls->data['search_page'] - 1;
开发者ID:chicosilva,项目名称:olharambiental,代码行数:31,代码来源:index.php

示例3: mail

 function mail($to, $subject, $message, $headers = null)
 {
     $newsletter = Newsletter::instance();
     if ($this->mandrill == null) {
         require_once dirname(__FILE__) . '/api/Mandrill.php';
         $mandrill = new Mandrill($this->options['smtp_password']);
     }
     $data = array();
     if (!is_array($message)) {
         $data['html'] = $message;
     } else {
         if (!empty($message['html'])) {
             $data['html'] = $message['html'];
         }
         if (!empty($message['text'])) {
             $data['text'] = $message['text'];
         }
     }
     $data['subject'] = $subject;
     $data['to'] = array(array('email' => $to, 'type' => 'to'));
     if (isset($headers['X-Newsletter-Email-Id'])) {
         $data['tags'] = array('Newsletter ' . $headers['X-Newsletter-Email-Id']);
     }
     if (!empty($headers)) {
         $data['headers'] = $headers;
     } else {
         $data['headers'] = array();
     }
     $data['from_email'] = $newsletter->options['sender_email'];
     $data['from_name'] = $newsletter->options['sender_name'];
     if (!empty($newsletter->options['reply_to'])) {
         $data['headers']['Reply-To'] = $newsletter->options['reply_to'];
     }
     try {
         //    $async = false;
         //    $ip_pool = 'Main Pool';
         //    $send_at = 'example send_at';
         //    $result = $mandrill->messages->send($message, $async, $ip_pool, $send_at);
         $this->mandrill_result = $mandrill->messages->send($data);
         //print_r($result);
         return true;
     } catch (Mandrill_Error $e) {
         $this->mandrill_result = $e->getMessage();
         // Mandrill errors are thrown as exceptions
         //echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
         // A mandrill error occurred: Mandrill_Unknown_Subaccount - No subaccount exists with the id 'customer-123'
         //throw $e;
         return false;
     }
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:50,代码来源:mandrill.php

示例4: time

    $email['send_on'] = time();
    $email['type'] = 'message';
    $email['editor'] = $original->editor;
    $email['track'] = $original->track;
    Newsletter::instance()->save_email($email);
    $controls->messages .= __('Message duplicated.', 'newsletter');
}
if ($controls->is_action('delete')) {
    Newsletter::instance()->delete_email($_POST['btn']);
    $controls->messages .= __('Message deleted.', 'newsletter');
}
if ($controls->is_action('delete_selected')) {
    $r = Newsletter::instance()->delete_email($_POST['ids']);
    $controls->messages .= $r . ' message(s) deleted';
}
$emails = Newsletter::instance()->get_emails('message');
?>

<div class="wrap" id="tnp-wrap">

    <?php 
$help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter/newsletters-module';
?>
    
    <?php 
include NEWSLETTER_DIR . '/tnp-header.php';
?>

    <div id="tnp-heading">
    
    <h2><?php 
开发者ID:ilke-zilci,项目名称:newcomers-wp,代码行数:31,代码来源:index.php

示例5: mail

 /**
  * Send emails during the subscription process. Emails are themes with email.php file.
  * @global type $newsletter
  * @return type
  */
 function mail($to, $subject, $message)
 {
     // If the template setup on administrative panel is enabled, use it, if not
     // use the default old templating system.
     if ($this->options['template_enabled'] == 1) {
         $template = $this->options['template'];
         if (strpos($template, '{message}') === false) {
             $template .= '{message}';
         }
         $message = str_replace('{message}', $message, $template);
     } else {
         ob_start();
         include NEWSLETTER_DIR . '/subscription/email.php';
         $message = ob_get_clean();
     }
     return Newsletter::instance()->mail($to, $subject, $message);
 }
开发者ID:hbenbrahim,项目名称:wp-capdema,代码行数:22,代码来源:subscription.php

示例6:

<?php 
if (NEWSLETTER_DEBUG || !isset($dismissed['newsletter-page']) && empty(NewsletterSubscription::instance()->options['url'])) {
    ?>
    <div class="notice">
        <a href="<?php 
    echo $_SERVER['REQUEST_URI'] . '&dismiss=newsletter-page';
    ?>
" class="dismiss">&times;</a>
        <p>
            You should create a blog page to show the subscription form and the subscription messages. Go to the
            <a href="?page=newsletter_subscription_options">subscription panel</a> to
            configure it.
        </p>
    </div>
<?php 
}
?>

<div id="tnp-notification">
    <?php 
Newsletter::instance()->warnings();
?>
    <?php 
if (isset($controls)) {
    $controls->show();
    $controls->messages = '';
    $controls->errors = '';
}
?>
</div>
开发者ID:ilke-zilci,项目名称:newcomers-wp,代码行数:30,代码来源:tnp-header.php

示例7: count

    $email['status'] = 'sending';
}
if ($controls->is_action('abort')) {
    $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set last_id=0, total=0, sent=0, status='new' where id=" . $email_id);
    $email['status'] = 'new';
    $email['total'] = 0;
    $email['sent'] = 0;
    $email['last_id'] = 0;
    $controls->messages = "Sending aborted.";
}
if ($controls->is_action('test')) {
    $users = NewsletterUsers::instance()->get_test_users();
    if (count($users) == 0) {
        $controls->errors = 'There are no test subscribers. Read more about test subscribers <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
    } else {
        Newsletter::instance()->send(Newsletter::instance()->get_email($email_id), $users);
        $controls->messages .= 'Test emails sent to ' . count($users) . ' test subscribers. Read more about test subscribers <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
    }
    $controls->messages .= '<br>If diagnostic emails are delivered but test emails are not, try to change the encoding to "base 64" on main configuration panel';
}
if ($email['editor'] == 0) {
    $x = strpos($controls->data['message'], '<body');
    // Some time the message in $nc->data is already cleaned up, it depends on action called
    if ($x !== false) {
        $x = strpos($controls->data['message'], '>', $x);
        $y = strpos($controls->data['message'], '</body>');
        $controls->data['message'] = substr($controls->data['message'], $x + 1, $y - $x - 1);
    }
}
?>
开发者ID:taeche,项目名称:SoDoEx,代码行数:30,代码来源:edit.php

示例8: str_replace

 }
 if ($controls->is_action('test-template')) {
     $users = NewsletterUsers::instance()->get_test_users();
     if (count($users) == 0) {
         $controls->errors = 'There are no test subscribers. Read more about test subscribers <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
     } else {
         $template = $controls->data['template'];
         if (strpos($template, '{message}') === false) {
             $template .= '{message}';
         }
         $message = '<p>This is a generic example of message embedded inside the template.</p>';
         $message = str_replace('{message}', $message, $template);
         $addresses = array();
         foreach ($users as &$user) {
             $addresses[] = $user->email;
             Newsletter::instance()->mail($user->email, 'Newsletter Messages Template Test', $newsletter->replace($message, $user));
         }
         $controls->messages .= 'Test emails sent to ' . count($users) . ' test subscribers: ' . implode(', ', $addresses) . '. Read more about test subscribers <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
     }
 }
 if ($controls->is_action('test-confirmation')) {
     $users = NewsletterUsers::instance()->get_test_users();
     if (count($users) == 0) {
         $controls->errors = 'There are no test subscribers. Read more about test subscribers <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
     } else {
         $template = $controls->data['template'];
         if (strpos($template, '{message}') === false) {
             $template .= '{message}';
         }
         $message = '<p>This is a generic example of message embedded inside the template.</p>';
         $message = str_replace('{message}', $message, $template);
开发者ID:chicosilva,项目名称:olharambiental,代码行数:31,代码来源:options.php

示例9: NewsletterControls

<?php

require_once '../../../../wordpress/wp-load.php';
$newsletter = Newsletter::instance();
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
// TODO: Check the user capabilities
if (current_user_can('manage_options') || $newsletter->options['editor'] == 1 && current_user_can('manage_categories')) {
    $controls = new NewsletterControls();
    if ($controls->is_action('export')) {
        NewsletterUsers::instance()->export($controls->data);
    }
} else {
    die('Not allowed.');
}
开发者ID:imeuro,项目名称:escapelifestyle,代码行数:14,代码来源:csv.php

示例10: header

<?php

header('Content-Type: text/html;charset=UTF-8');
header('X-Robots-Tag: noindex,nofollow,noarchive');
header('Cache-Control: no-cache,no-store,private');
include '../../../../wp-load.php';
$user = Newsletter::instance()->get_user_from_request(true);
$field = $_REQUEST['nf'];
$value = $_REQUEST['nv'];
$url = $_REQUEST['nu'];
switch ($field) {
    case 'sex':
        if (!in_array($value, array('f', 'm', 'n'))) {
            die('Invalid sex value');
        }
        NewsletterUsers::instance()->set_user_field($user->id, 'sex', $value);
        break;
        // Should be managed by Feed by Mail
    // Should be managed by Feed by Mail
    case 'feed':
        if (isset($value) && ($value === '0' || $value === '1')) {
            NewsletterUsers::instance()->set_user_field($user->id, 'feed', $value);
        } else {
            die('Invalid feed value');
        }
        break;
}
if (strpos($field, 'preference_') === 0) {
    $idx = (int) substr($field, 11);
    $options_profile = get_option('newsletter_profile');
    if ($options_profile['list_' . $idx . '_status'] == 0) {
开发者ID:ilke-zilci,项目名称:newcomers-wp,代码行数:31,代码来源:change.php

示例11: md5

//die($url);
$verified = $parts['host'] == $_SERVER['HTTP_HOST'];
if (!$verified) {
    $options = NewsletterStatistics::instance()->options;
    $verified = $key == md5($email_id . ';' . $user_id . ';' . $url . ';' . $anchor . $options['key']);
}
// For feed by mail tests
if ($verified && empty($email_id) && is_user_logged_in()) {
    header('Location: ' . $url);
    die;
}
$ip = preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']);
if ($verified) {
    $wpdb->insert(NEWSLETTER_STATS_TABLE, array('email_id' => $email_id, 'user_id' => $user_id, 'url' => $url, 'ip' => $ip));
    $wpdb->query($wpdb->prepare("update " . NEWSLETTER_SENT_TABLE . " set open=2, ip=%s where email_id=%d and user_id=%d limit 1", $ip, $email_id, $user_id));
    $user = Newsletter::instance()->get_user($user_id);
    if ($user) {
        setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
    }
    header('Location: ' . $url);
    die;
} else {
    header("HTTP/1.0 404 Not Found");
    //header('Location: ' . home_url());
    //die();
}
?>
<html>
    <head>
        <style>
            body {
开发者ID:radikalportal,项目名称:radikalportal,代码行数:31,代码来源:link.php

示例12: shortcode_newsletter_lock

 function shortcode_newsletter_lock($attrs, $content = null)
 {
     global $hyper_cache_stop, $cache_stop;
     $hyper_cache_stop = true;
     $cache_stop = true;
     $this->found = true;
     $user = $this->check_user();
     if ($user != null && $user->status == 'C') {
         return do_shortcode($content);
     }
     $buffer = $this->options['message'];
     $buffer = str_ireplace('<form', '<form method="post" action="' . plugins_url('newsletter/do/subscribe.php') . '"', $buffer);
     $buffer = Newsletter::instance()->replace($buffer, null, null, 'lock');
     $buffer = do_shortcode($buffer);
     return '<div class="newsletter-lock">' . $buffer . '</div>';
 }
开发者ID:radikalportal,项目名称:radikalportal,代码行数:16,代码来源:lock.php

示例13:

    ?>
" href="<?php 
    echo NewsletterStatistics::instance()->get_statistics_url($email->id);
    ?>
"><i class="fa fa-bar-chart"></i></a>
                                            </td>
                                        </tr>
<?php 
}
?>
                                </table>
                            </div>
                        </div>
                        <!-- END Newsletters -->
<?php 
if (empty(Newsletter::instance()->options['contract_key'])) {
    ?>
                            <!-- START Premium -->
                            <div id="tnp-dash-premium" class="postbox">
                                <h3><?php 
    _e('Premium', 'newsletter');
    ?>
                                    <a href="http://www.thenewsletterplugin.com/extensions" target="_blank">
                                        <i class="fa fa-trophy"></i> <?php 
    _e('Buy', 'newsletter');
    ?>
                                    </a>
                                </h3>
                                <div class="inside">
                                    <div>
                                        <a href="http://www.thenewsletterplugin.com/extensions" target="_blank">
开发者ID:radikalportal,项目名称:radikalportal,代码行数:31,代码来源:index.php

示例14: instance

 /**
  * @return Newsletter
  */
 static function instance()
 {
     if (self::$instance == null) {
         self::$instance = new Newsletter();
     }
     return self::$instance;
 }
开发者ID:manhhung86it,项目名称:builder-site,代码行数:10,代码来源:plugin.php

示例15: hook_site_transient_update_plugins

 function hook_site_transient_update_plugins($value)
 {
     if (!class_exists('Newsletter')) {
         return $value;
     }
     // See the wp_update_plugins function
     if (!is_object($value)) {
         return $value;
     }
     if (!isset($value->response[$this->plugin])) {
         return $value;
     }
     if (defined('NEWSLETTER_LICENSE_KEY')) {
         $value->response[$this->plugin]->package = 'http://www.thenewsletterplugin.com/wp-content/plugins/file-commerce-pro/get.php?f=' . $this->id . '&k=' . NEWSLETTER_LICENSE_KEY;
     } else {
         $value->response[$this->plugin]->package = 'http://www.thenewsletterplugin.com/wp-content/plugins/file-commerce-pro/get.php?f=' . $this->id . '&k=' . Newsletter::instance()->options['contract_key'];
     }
     return $value;
 }
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:19,代码来源:grabber.php


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