Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 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
//@require 'Swift/DependencyContainer.php';
12
 
13
/**
14
 * Changes some global preference settings in Swift Mailer.
15
 * @package Swift
16
 * @author Chris Corbyn
17
 */
18
class Swift_Preferences
19
{
20
 
21
  /** Singleton instance */
22
  private static $_instance = null;
23
 
24
  /** Constructor not to be used */
25
  private function __construct() { }
26
 
27
  /**
28
   * Get a new instance of Preferences.
29
   * @return Swift_Preferences
30
   */
31
  public static function getInstance()
32
  {
33
    if (!isset(self::$_instance))
34
    {
35
      self::$_instance = new self();
36
    }
37
    return self::$_instance;
38
  }
39
 
40
  /**
41
   * Set the default charset used.
42
   * @param string
43
   * @return Swift_Preferences
44
   */
45
  public function setCharset($charset)
46
  {
47
    Swift_DependencyContainer::getInstance()
48
      ->register('properties.charset')->asValue($charset);
49
    return $this;
50
  }
51
 
52
  /**
53
   * Set the directory where temporary files can be saved.
54
   * @param string $dir
55
   * @return Swift_Preferences
56
   */
57
  public function setTempDir($dir)
58
  {
59
    Swift_DependencyContainer::getInstance()
60
      ->register('tempdir')->asValue($dir);
61
    return $this;
62
  }
63
 
64
  /**
65
   * Set the type of cache to use (i.e. "disk" or "array").
66
   * @param string $type
67
   * @return Swift_Preferences
68
   */
69
  public function setCacheType($type)
70
  {
71
    Swift_DependencyContainer::getInstance()
72
      ->register('cache')->asAliasOf(sprintf('cache.%s', $type));
73
    return $this;
74
  }
75
 
76
}