[ Index ]

MailPress 544

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

title

Body

[close]

/mp-includes/Swiftmailer/classes/ -> Swift.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   * General utility class in Swift Mailer, not to be instantiated.
  13   *
  14   *
  15   * @author Chris Corbyn
  16   */
  17  abstract class Swift
  18  {
  19      /** Swift Mailer Version number generated during dist release process */
  20      const VERSION = '@SWIFT_VERSION_NUMBER@';
  21  
  22      public static $initialized = false;
  23      public static $inits = array();
  24  
  25      /**
  26       * Registers an initializer callable that will be called the first time
  27       * a SwiftMailer class is autoloaded.
  28       *
  29       * This enables you to tweak the default configuration in a lazy way.
  30       *
  31       * @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class
  32       */
  33      public static function init($callable)
  34      {
  35          self::$inits[] = $callable;
  36      }
  37  
  38      /**
  39       * Internal autoloader for spl_autoload_register().
  40       *
  41       * @param string $class
  42       */
  43      public static function autoload($class)
  44      {
  45          // Don't interfere with other autoloaders
  46          if (0 !== strpos($class, 'Swift_')) {
  47              return;
  48          }
  49  
  50          $path = dirname(__FILE__).'/'.str_replace('_', '/', $class).'.php';
  51  
  52          if (!file_exists($path)) {
  53              return;
  54          }
  55  
  56          require $path;
  57  
  58          if (self::$inits && !self::$initialized) {
  59              self::$initialized = true;
  60              foreach (self::$inits as $init) {
  61                  call_user_func($init);
  62              }
  63          }
  64      }
  65  
  66      /**
  67       * Configure autoloading using Swift Mailer.
  68       *
  69       * This is designed to play nicely with other autoloaders.
  70       *
  71       * @param mixed $callable A valid PHP callable that will be called when autoloading the first Swift class
  72       */
  73      public static function registerAutoload($callable = null)
  74      {
  75          if (null !== $callable) {
  76              self::$inits[] = $callable;
  77          }
  78          spl_autoload_register(array('Swift', 'autoload'));
  79      }
  80  }


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