[ Index ]

MailPress 7.2

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

title

Body

[close]

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


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