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


PHP Newsletter类代码示例

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


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

示例1: testGetSubscriptionObject

 /**
  * @magentoDataFixture Magento/Customer/_files/customer.php
  */
 public function testGetSubscriptionObject()
 {
     $this->customerSession->setCustomerId(1);
     $subscriber = $this->block->getSubscriptionObject();
     $this->assertInstanceOf('Magento\\Newsletter\\Model\\Subscriber', $subscriber);
     $this->assertFalse($subscriber->isSubscribed());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:10,代码来源:NewsletterTest.php

示例2: add

 public function add($data)
 {
     $model = new Newsletter();
     $email = $data['email'];
     // verificam daca e email
     return $model->add($email);
 }
开发者ID:indra1,项目名称:php_advanced_mvc_no_fw_example,代码行数:7,代码来源:NewsletterAjaxController.php

示例3: testDeveriaRetornarGruposVaziosSeRecebeuNenhumEmail

 public function testDeveriaRetornarGruposVaziosSeRecebeuNenhumEmail()
 {
     $expected = ['tecnologia' => [], 'filosofia' => []];
     $emails = array();
     $service = new Newsletter();
     $groups = $service->sendAll($emails);
     $this->assertEquals($expected, $groups);
 }
开发者ID:rogeriopradoj,项目名称:tuto-cloudson-tdd-phpunit,代码行数:8,代码来源:news.php

示例4: Create

 public function Create(Newsletter &$newsletter)
 {
     $subject = $newsletter->getSubject();
     $content = $newsletter->getContent();
     $statement = $this->instance->prepare("INSERT INTO Newsletters (Subject, Content) VALUES (:subject, :content)");
     $statement->bindParam(':subject', $subject);
     $statement->bindParam(':content', $content);
     return $statement->execute();
 }
开发者ID:Loneska,项目名称:dwm-php-mailinglist,代码行数:9,代码来源:NewsletterManager.class.php

示例5: __construct

 /**
  * @param Newsletter $newsletter
  * @param NewsletterType $type
  */
 function __construct($newsletter, $type = null)
 {
     $this->newsletter = $newsletter;
     $this->nlType = $type ? $type : $newsletter->getNewsletterType();
     parent::__construct();
     $this->body = $newsletter->getContentBody();
     $this->populateTemplate(new ArrayData(array('Newsletter' => $this->Newsletter, 'UnsubscribeLink' => $this->UnsubscribeLink())));
     $this->extend('updateNewsletterEmail', $this);
 }
开发者ID:roed,项目名称:silverstripe-newsletter,代码行数:13,代码来源:NewsletterEmail.php

示例6: actionCheck

 public function actionCheck($key)
 {
     $executionTime = KeyValue::model()->findByPk('newsletter_execution_time');
     $frequency = KeyValue::model()->findByPk('newsletter_frequency');
     $newsletter = new Newsletter();
     if (time() >= strtotime($executionTime->value) + $frequency->value && $frequency->value != '1' && $newsletter->make() !== false) {
         $this->render('check', array('send' => 'true'));
     } else {
         $this->render('check', array('send' => 'false'));
     }
     Yii::app()->end();
 }
开发者ID:kostya1017,项目名称:our,代码行数:12,代码来源:ApiController.php

示例7: __construct

 /**
  * @param Newsletter $newsletter
  * @param Mailinglists $recipient
  * @param Boolean $fakeRecipient
  */
 function __construct($newsletter, $recipient, $fakeRecipient = false)
 {
     $this->newsletter = $newsletter;
     $this->mailinglists = $newsletter->MailingLists();
     $this->recipient = $recipient;
     $this->fakeRecipient = $fakeRecipient;
     parent::__construct($this->newsletter->SendFrom, $this->recipient->Email);
     $this->populateTemplate(new ArrayData(array('UnsubscribeLink' => $this->UnsubscribeLink(), 'SiteConfig' => DataObject::get_one('SiteConfig'), 'AbsoluteBaseURL' => Director::absoluteBaseURLWithAuth())));
     $this->body = $newsletter->getContentBody();
     $this->subject = $newsletter->Subject;
     $this->ss_template = $newsletter->RenderTemplate;
     if ($this->body && $this->newsletter) {
         $text = $this->body->forTemplate();
         //Recipient Fields ShortCode parsing
         $bodyViewer = new SSViewer_FromString($text);
         $text = $bodyViewer->process($this->templateData());
         // Install link tracking by replacing existing links with "newsletterlink" and hash-based reference.
         if ($this->config()->link_tracking_enabled && !$this->fakeRecipient && preg_match_all("/<a\\s[^>]*href=\"([^\"]*)\"[^>]*>(.*)<\\/a>/siU", $text, $matches)) {
             if (isset($matches[1]) && ($links = $matches[1])) {
                 $titles = isset($matches[2]) ? $matches[2] : array();
                 $id = (int) $this->newsletter->ID;
                 $replacements = array();
                 $current = array();
                 // workaround as we want to match the longest urls (/foo/bar/baz) before /foo/
                 array_unique($links);
                 $sorted = array_combine($links, array_map('strlen', $links));
                 arsort($sorted);
                 foreach ($sorted as $link => $length) {
                     $SQL_link = Convert::raw2sql($link);
                     $tracked = DataObject::get_one('Newsletter_TrackedLink', "\"NewsletterID\" = '" . $id . "' AND \"Original\" = '" . $SQL_link . "'");
                     if (!$tracked) {
                         // make one.
                         $tracked = new Newsletter_TrackedLink();
                         $tracked->Original = $link;
                         $tracked->NewsletterID = $id;
                         $tracked->write();
                     }
                     // replace the link
                     $replacements[$link] = $tracked->Link();
                     // track that this link is still active
                     $current[] = $tracked->ID;
                 }
                 // replace the strings
                 $text = str_ireplace(array_keys($replacements), array_values($replacements), $text);
             }
         }
         // replace the body
         $output = new HTMLText();
         $output->setValue($text);
         $this->body = $output;
     }
 }
开发者ID:tractorcow,项目名称:silverstripe-newsletter,代码行数:57,代码来源:NewsletterEmail.php

示例8: actionNewsletter

 public function actionNewsletter()
 {
     $news = new Newsletter();
     if (isset($_POST['email'])) {
         $news->email = $_POST['email'];
         $news->active = 1;
         if ($news->save()) {
             $this->render('newletter-thankyou');
         }
         Yii::app()->end();
     }
     $news->validate();
     $this->render('newletter-error', array('model' => $news));
 }
开发者ID:Rudianasaja,项目名称:cycommerce,代码行数:14,代码来源:SiteController.php

示例9: _newsletters

 /**
  * Sends newsletter to User groups
  */
 protected function _newsletters()
 {
     $now = date('Y-m-d');
     $emails = array();
     $newsletters = Newsletter::all(array("scheduled = ?" => $now), array("template_id", "group_id"));
     foreach ($newsletters as $n) {
         $template = Template::first(array("id = ?" => $n->template_id));
         $group = Group::first(array("id = ?" => $n->group_id), array("users"));
         $results = json_decode($group->users);
         if (count($results) == 1 && $results[0] == "*") {
             $users = User::all(array(), array("email"));
             foreach ($users as $user) {
                 array_push($emails, $user->email);
             }
         } else {
             foreach ($results as $r) {
                 array_push($emails, $r->email);
             }
         }
         $batches = array_chunk($emails, 100);
         foreach ($batches as $batch) {
             $e = implode(",", $batch);
             $this->notify(array("template" => "newsletter", "subject" => $template->subject, "message" => $template->body, "track" => true, "emails" => $e));
         }
     }
 }
开发者ID:SwiftDeal,项目名称:detectr,代码行数:29,代码来源:cron.php

示例10: PrivateNewsletter

 function PrivateNewsletter($news_id, $subs_retriever = null)
 {
     if (is_null($subs_retriever)) {
         $subs_retriever = new JUserInfoRetriever($news_id);
     }
     parent::Newsletter($news_id, $subs_retriever);
 }
开发者ID:madseller,项目名称:coperio,代码行数:7,代码来源:privatenewsletter.php

示例11: __construct

 protected final function __construct()
 {
     //If there is a login attempt
     if (isset($_POST['username']) && isset($_POST['password']) && !empty($_POST['username']) && !empty($_POST['password'])) {
         //Did they check the remember me box
         $remember = isset($_POST['remember']) && !empty($_POST['remember']) ? true : false;
         $this->authenticate($_POST['username'], $_POST['password'], $remember);
     } else {
         //If there is a cookie for the username and they are not logged in
         if (isset($_COOKIE['username']) && !empty($_COOKIE['username']) && !$this->is()) {
             //If we haven't pushed the user to the login
             if (!$GLOBALS['session']->get('login_push')) {
                 $GLOBALS['session']->set('login_push', true);
                 //Try to have them login
                 if (!isset($_GET['_a']) || $_GET['_a'] != 'login') {
                     httpredir('index.php?_a=login');
                 }
             }
         }
         $this->_load();
         //IS_USER defines if a the user is a valid user on the template
         $GLOBALS['smarty']->assign('IS_USER', $this->is());
         if ($this->is() && isset($_POST['mailing_list'])) {
             Newsletter::getInstance()->subscribe($this->get('email'), $this->getId());
         }
         $this->isBot();
     }
 }
开发者ID:Dirty-Butter,项目名称:v6,代码行数:28,代码来源:user.class.php

示例12: PublicNewsletter

 /**
  * The PublicNewsletter constructor.
  *
  * @access	public
  * @param   integer news_id The newsletter identifier.
  * @param   SubsRetriever $subs_retriever The subscribers info retriever
  * @return	PublicNewsletter
  * @since	0.6
  * @see     Newsletter, NewsletterFactory
  */
 function PublicNewsletter($news_id, $subs_retriever = null)
 {
     if (is_null($subs_retriever)) {
         $subs_retriever = new PublicRetriever($news_id);
     }
     parent::Newsletter($news_id, $subs_retriever);
 }
开发者ID:madseller,项目名称:coperio,代码行数:17,代码来源:publicnewsletter.php

示例13: getInstance

 /**
  * Setup the instance (singleton)
  *
  * @return Newsletter
  */
 public static function getInstance()
 {
     if (!self::$_instance instanceof self) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
开发者ID:briansandall,项目名称:v6,代码行数:12,代码来源:newsletter.class.php

示例14: check_configuration

function check_configuration($port, $security)
{
    flush();
    try {
        $mail = Newsletter::initMailer($port, $security);
        $mail->Timeout = 3;
        // seconds
        $mail->SMTPDebug = 2;
        $mail->clearAddresses();
        $mail->addAddress(SENDER_ADDRESS, SENDER_NAME);
        $mail->addReplyTo(SENDER_ADDRESS, SENDER_NAME);
        $mail->setFrom(SENDER_ADDRESS, SENDER_NAME);
        $mail->Subject = "Open-Letters NewsletterSoftware => Test-Email";
        $mail->Body = "Dear Newsletter owner,\n\nThis mail was sent to You by file " . __FILE__ . " on Your Webspace. That You can read this mail means the" . " email configuration in Your config/config.inc.php is right.\n\n" . "best regards\nOpen-Letters";
        $mail->smtpConnect();
        if (!$mail->send()) {
            throw new Exception("ERROR sending an Email: " . $mail->ErrorInfo, "666");
        } else {
            echo "This configuration DID work: Port=" . $port . " and Security=" . $security . "!!!<br>" . "The inbox of " . SENDER_ADDRESS . " should " . "have a new email right now. If this email was not received, " . "please check Your spam folder and configuration.<br>" . "<span class='success'>Success, test mail was sent!</span><br>";
            return true;
        }
    } catch (Exception $e) {
        echo "Your configuration did NOT work: Port=" . $port . " and Security=" . $security . "<br>";
        echo $e->getMessage();
        echo "<span class='error'>Sorry, this try did not work.</span><br><br>";
        return false;
    }
}
开发者ID:ReichardtIT,项目名称:open-letters-newsletter,代码行数:28,代码来源:phpMailerSmtpTest.php

示例15: actionindex

 /**
  * Index action
  */
 public function actionindex()
 {
     $model = new Newsletter();
     $sent = false;
     if (isset($_POST['Newsletter'])) {
         $model->attributes = $_POST['Newsletter'];
         if ($model->save()) {
             $sent = true;
             Yii::app()->user->setFlash('success', Yii::t('index', 'Thank you. You are now subscribed to our newsletter.'));
         }
     }
     // Load facebook
     Yii::import('ext.facebook.facebookLib');
     $facebook = new facebookLib(array('appId' => Yii::app()->params['facebookappid'], 'secret' => Yii::app()->params['facebookapisecret'], 'cookie' => true, 'disableSSLCheck' => false));
     facebookLib::$CURL_OPTS[CURLOPT_CAINFO] = Yii::getPathOfAlias('ext.facebook') . '/ca-bundle.crt';
     $this->render('index', array('model' => $model, 'facebook' => $facebook, 'sent' => $sent));
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:20,代码来源:IndexController.php


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