PluginProbe ʕ •ᴥ•ʔ
Hustle – Email Marketing, Lead Generation, Optins, Popups / 7.8.14
Hustle – Email Marketing, Lead Generation, Optins, Popups v7.8.14
7.8.14 7.8.14.1 7.8.13 7.8.13.1 trunk 3.0 3.1 3.1.1 3.1.2 3.1.3 3.1.4 4.3.2 4.4.4 4.4.5 4.4.5.1 4.4.5.4 4.6 4.6.1.1 4.6.1.4 4.7.0.2 4.7.0.3 4.7.0.7 4.7.0.9 4.7.1.0 4.7.1.1 4.8.0.0 5.0.0 5.0.1 5.0.1.1 5.0.1.2 5.1 5.1.1 5.1.2 5.1.3 5.1.3.1 5.1.3.2 5.1.4 5.1.5 6.0 6.0.1 6.0.2 6.0.3 6.0.4.2 6.0.5 6.0.6.1 6.0.7 6.0.8.1 6.0.9 7.0.0.1 7.0.2 7.0.3 7.0.4 7.1.0 7.1.1 7.2.0 7.2.1 7.3.0 7.3.1 7.3.3 7.3.5 7.3.6 7.3.7 7.4.0 7.4.1 7.4.11 7.4.13 7.4.13.1 7.4.2 7.4.3 7.4.4 7.4.5 7.4.5.1 7.4.5.2 7.4.6 7.4.7 7.5.0 7.6.0 7.6.1 7.6.3 7.6.4 7.6.6 7.7.0 7.7.1 7.8.0 7.8.1 7.8.10 7.8.10.1 7.8.10.2 7.8.11 7.8.12 7.8.12.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.8.9.1 7.8.9.2 7.8.9.3
wordpress-popup / inc / providers / constantcontact / CtCt / SplClassLoader.php
wordpress-popup / inc / providers / constantcontact / CtCt Last commit date
Auth 3 years ago Components 2 years ago Exceptions 6 years ago Services 6 years ago Util 3 years ago WebHooks 6 years ago ConstantContact.php 6 years ago SplClassLoader.php 6 years ago autoload.php 6 years ago
SplClassLoader.php
142 lines
1 <?php
2 namespace Ctct;
3
4 /**
5 * SplClassLoader implementation that implements the technical interoperability
6 * standards for PHP 5.3 namespaces and class names.
7 *
8 * http://groups.google.com/group/php-standards/web/final-proposal
9 *
10 * // Example which loads classes for the Doctrine Common package in the
11 * // Doctrine\Common namespace.
12 * $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
13 * $classLoader->register();
14 *
15 * @author Jonathan H. Wage <jonwage@gmail.com>
16 * @author Roman S. Borschel <roman@code-factory.org>
17 * @author Matthew Weier O'Phinney <matthew@zend.com>
18 * @author Kris Wallsmith <kris.wallsmith@gmail.com>
19 * @author Fabien Potencier <fabien.potencier@symfony-project.org>
20 */
21
22 class SplClassLoader
23 {
24 private $fileExtension = '.php';
25 private $namespace;
26 private $includePath;
27 private $namespaceSeparator = '\\';
28
29 /**
30 * Creates a new <tt>SplClassLoader</tt> that loads classes of the
31 * specified namespace.
32 *
33 * @param string $ns The namespace to use.
34 * @param string $includePath The include path to use.
35 */
36 public function __construct($ns = null, $includePath = null)
37 {
38 $this->namespace = $ns;
39 $this->includePath = $includePath;
40 }
41
42 /**
43 * Sets the namespace separator used by classes in the namespace of this class loader.
44 *
45 * @param string $sep The separator to use.
46 */
47 public function setNamespaceSeparator($sep)
48 {
49 $this->namespaceSeparator = $sep;
50 }
51
52 /**
53 * Gets the namespace separator used by classes in the namespace of this class loader.
54 *
55 * @return string $namespaceSeparator
56 */
57 public function getNamespaceSeparator()
58 {
59 return $this->namespaceSeparator;
60 }
61
62 /**
63 * Sets the base include path for all class files in the namespace of this class loader.
64 *
65 * @param string $includePath
66 */
67 public function setIncludePath($includePath)
68 {
69 $this->includePath = $includePath;
70 }
71
72 /**
73 * Gets the base include path for all class files in the namespace of this class loader.
74 *
75 * @return string $includePath
76 */
77 public function getIncludePath()
78 {
79 return $this->includePath;
80 }
81
82 /**
83 * Sets the file extension of class files in the namespace of this class loader.
84 *
85 * @param string $fileExtension
86 */
87 public function setFileExtension($fileExtension)
88 {
89 $this->fileExtension = $fileExtension;
90 }
91
92 /**
93 * Gets the file extension of class files in the namespace of this class loader.
94 *
95 * @return string $fileExtension
96 */
97 public function getFileExtension()
98 {
99 return $this->fileExtension;
100 }
101
102 /**
103 * Installs this class loader on the SPL autoload stack.
104 */
105 public function register()
106 {
107 spl_autoload_register(array($this, 'loadClass'));
108 }
109
110 /**
111 * Uninstalls this class loader from the SPL autoloader stack.
112 */
113 public function unregister()
114 {
115 spl_autoload_unregister(array($this, 'loadClass'));
116 }
117
118 /**
119 * Loads the given class or interface.
120 *
121 * @param string $className The name of the class to load.
122 * @return void
123 */
124 public function loadClass($className)
125 {
126 if (null === $this->namespace || $this->namespace . $this->namespaceSeparator ===
127 substr($className, 0, strlen($this->namespace . $this->namespaceSeparator))
128 ) {
129 $fileName = '';
130 if (false !== ($lastNsPos = strripos($className, $this->namespaceSeparator))) {
131 $namespace = substr($className, 0, $lastNsPos);
132 $className = substr($className, $lastNsPos + 1);
133 $fileName = str_replace($this->namespaceSeparator, DIRECTORY_SEPARATOR, $namespace)
134 . DIRECTORY_SEPARATOR;
135 }
136 $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->fileExtension;
137
138 require ($this->includePath !== null ? $this->includePath . DIRECTORY_SEPARATOR : '') . $fileName;
139 }
140 }
141 }
142