[ Index ]

MailPress 544

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/Swiftmailer/classes/Swift/ -> Preferences.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of SwiftMailer.
   5   * (c) 2004-2009 Chris Corbyn
   6   *
   7   * For the full copyright and license information, please view the LICENSE
   8   * file that was distributed with this source code.
   9   */
  10  
  11  /**
  12   * Changes some global preference settings in Swift Mailer.
  13   *
  14   * @author Chris Corbyn
  15   */
  16  class Swift_Preferences
  17  {
  18      /** Singleton instance */
  19      private static $_instance = null;
  20  
  21      /** Constructor not to be used */
  22      private function __construct()
  23      {
  24      }
  25  
  26      /**
  27       * Gets the instance of Preferences.
  28       *
  29       * @return Swift_Preferences
  30       */
  31      public static function getInstance()
  32      {
  33          if (!isset(self::$_instance)) {
  34              self::$_instance = new self();
  35          }
  36  
  37          return self::$_instance;
  38      }
  39  
  40      /**
  41       * Set the default charset used.
  42       *
  43       * @param string $charset
  44       *
  45       * @return Swift_Preferences
  46       */
  47      public function setCharset($charset)
  48      {
  49          Swift_DependencyContainer::getInstance()
  50              ->register('properties.charset')->asValue($charset);
  51  
  52          return $this;
  53      }
  54  
  55      /**
  56       * Set the directory where temporary files can be saved.
  57       *
  58       * @param string $dir
  59       *
  60       * @return Swift_Preferences
  61       */
  62      public function setTempDir($dir)
  63      {
  64          Swift_DependencyContainer::getInstance()
  65              ->register('tempdir')->asValue($dir);
  66  
  67          return $this;
  68      }
  69  
  70      /**
  71       * Set the type of cache to use (i.e. "disk" or "array").
  72       *
  73       * @param string $type
  74       *
  75       * @return Swift_Preferences
  76       */
  77      public function setCacheType($type)
  78      {
  79          Swift_DependencyContainer::getInstance()
  80              ->register('cache')->asAliasOf(sprintf('cache.%s', $type));
  81  
  82          return $this;
  83      }
  84  
  85      /**
  86       * Set the QuotedPrintable dot escaper preference.
  87       *
  88       * @param bool $dotEscape
  89       *
  90       * @return Swift_Preferences
  91       */
  92      public function setQPDotEscape($dotEscape)
  93      {
  94          $dotEscape = !empty($dotEscape);
  95          Swift_DependencyContainer::getInstance()
  96              ->register('mime.qpcontentencoder')
  97              ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
  98              ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))
  99              ->addConstructorValue($dotEscape);
 100  
 101          return $this;
 102      }
 103  }


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1