[ Index ]

MailPress 7.2

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

title

Body

[close]

/mp-includes/composer/vendor/swiftmailer/swiftmailer/lib/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 self
  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 $this
  46       */
  47      public function setCharset($charset)
  48      {
  49          Swift_DependencyContainer::getInstance()->register('properties.charset')->asValue($charset);
  50  
  51          return $this;
  52      }
  53  
  54      /**
  55       * Set the directory where temporary files can be saved.
  56       *
  57       * @param string $dir
  58       *
  59       * @return $this
  60       */
  61      public function setTempDir($dir)
  62      {
  63          Swift_DependencyContainer::getInstance()->register('tempdir')->asValue($dir);
  64  
  65          return $this;
  66      }
  67  
  68      /**
  69       * Set the type of cache to use (i.e. "disk" or "array").
  70       *
  71       * @param string $type
  72       *
  73       * @return $this
  74       */
  75      public function setCacheType($type)
  76      {
  77          Swift_DependencyContainer::getInstance()->register('cache')->asAliasOf(sprintf('cache.%s', $type));
  78  
  79          return $this;
  80      }
  81  
  82      /**
  83       * Set the QuotedPrintable dot escaper preference.
  84       *
  85       * @param bool $dotEscape
  86       *
  87       * @return $this
  88       */
  89      public function setQPDotEscape($dotEscape)
  90      {
  91          $dotEscape = !empty($dotEscape);
  92          Swift_DependencyContainer::getInstance()
  93              ->register('mime.qpcontentencoder')
  94              ->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
  95              ->withDependencies(['mime.charstream', 'mime.bytecanonicalizer'])
  96              ->addConstructorValue($dotEscape);
  97  
  98          return $this;
  99      }
 100  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1