Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.39 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.     copyright:      Pro Fusion
  5.     author:         Pro Fusion
  6.     --------------------------
  7.     you can find the licence at pro-fusion.ch
  8. */
  9.  
  10. class ExtensionCall {
  11.    
  12.     /*
  13.         @extensions
  14.     */
  15.     private $extensions = null;
  16.    
  17.     /*
  18.         @init
  19.     */
  20.     private function init() {
  21.         $extensionsFolder = CORE_ROOT.'lib'.DS.'extensions'.DS;
  22.         $extensionFolder = opendir($extensionsFolder);
  23.        
  24.         while ($extension = readdir($extensionFolder)) {
  25.             if (('.' == $extension) || ('..' == $extension)) continue;
  26.            
  27.             $path = $extensionsFolder.$extension.DS.ucfirst($extension).'Extension.class.php';
  28.            
  29.             if ((false == is_file($path))) continue;
  30.            
  31.             require_once($path);
  32.            
  33.             $className = ucfirst($extension).'Extension';
  34.            
  35.             if ((false == class_exists($className))) {
  36.                 Core::doLog('Unable to find class "'.$className.'"', __CLASS__, __METHOD__, __FILE__, __LINE__);
  37.             }
  38.            
  39.             $object = new $className();
  40.            
  41.             $this->extensions->$extension = $object;
  42.         }
  43.     }
  44.    
  45.     /*
  46.         @call
  47.     */
  48.     public function call($args) {
  49.         if ($this->extensions == null) $this->init();
  50.        
  51.         return $this->extensions;
  52.     }
  53.    
  54. }
  55.  
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement