Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • Email
  • Email_BounceHandler
  • Email_BounceRecord
  • Mailer
  • NewsletterEmailBlacklist
  • QueuedEmail
  • QueuedEmailDispatchTask
  • SimpleOrderPage_SubmittedFormEmail
  • TestMailer
 1 <?php
 2 /**
 3  * This class is responsible for ensuring that members who are on it receive NO email
 4  * communication at all. any correspondance is caught before the email is sent.
 5  * @package sapphire
 6  * @subpackage email
 7  */
 8 class NewsletterEmailBlacklist extends DataObject{
 9     static $db = array(
10         'BlockedEmail' => 'Varchar',
11     );
12 
13     static $has_one = array(
14         'Member' => 'Member'
15     );
16 
17     /**
18      * Helper function to see if the email being
19      * sent has specifically been blocked.
20      */
21     static function isBlocked($email) {
22         $blockedEmails = DataObject::get("NewsletterEmailBlacklist")->toDropDownMap("ID","BlockedEmail");
23         if($blockedEmails) {
24             if(in_array($email, $blockedEmails)) {
25                 return true;
26             }
27         }
28 
29         return false;
30     }
31 
32     /**
33      * Migrate data from Email_BlackList (the obsolete table)
34      * to NewsletterEmailBlacklist.
35      */
36     function requireDefaultRecords() {
37         parent::requireDefaultRecords();
38 
39         if(in_array('Email_BlackList', DB::getConn()->tableList())) {
40             DB::query("INSERT INTO \"NewsletterEmailBlacklist\" SELECT * FROM \"Email_BlackList\"");
41             DB::query("RENAME TABLE \"Email_BlackList\" TO \"_obsolete_Email_BlackList\"");
42             echo("<div style=\"padding:5px; color:white; background-color:blue;\">Data in Email_BlackList has been moved to the new NewsletterEmailBlacklist table. To drop the obsolete table, issue this SQL command: \"DROP TABLE '_obsolete_Email_BlackList'\".</div>");
43         }
44     }
45 
46 }
47 ?>
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0