Example #1
0
 /**
  * startAutoloader enable the autoloader
  *
  * @param string $path path of the library directory where composer managed
  *                     vendor directory can be found.
  * @return void
  */
 public static function startAutoloader($path)
 {
     static $libPath = null;
     if ($libPath === null) {
         $loaderPath = $path . '/vendor/autoload.php';
         if (self::fileExists($loaderPath)) {
             $libPath = $path;
             include $loaderPath;
         }
         XoopsLoad::addMap(XoopsLoad::loadCoreConfig());
         spl_autoload_register(array('XoopsLoad', 'load'));
     }
 }
Example #2
0
 function loadConfig($data = null)
 {
     if (is_array($data)) {
         $configs = $data;
     } else {
         if (!empty($data)) {
             $dirname = $data;
         } elseif (is_object($GLOBALS['xoopsModule'])) {
             $dirname = $GLOBALS['xoopsModule']->getVar('dirname', 'n');
         } else {
             return false;
         }
         if (!($configs = @(include XOOPS_ROOT_PATH . "/modules/" . $dirname . "/include/autoload.php"))) {
             return false;
         }
     }
     return $configs = array_merge(XoopsLoad::loadCoreConfig(), $configs);
 }
Example #3
0
 /**
  * XoopsLoad::loadConfig()
  *
  * @param mixed $data
  *
  * @return array|bool
  */
 public function loadConfig($data = null)
 {
     if (is_array($data)) {
         $configs = $data;
     } else {
         if (!empty($data)) {
             $dirname = $data;
         } elseif (is_object($GLOBALS['xoopsModule'])) {
             $dirname = $GLOBALS['xoopsModule']->getVar('dirname', 'n');
         } else {
             return false;
         }
         if (file_exists($file = XOOPS_ROOT_PATH . '/modules/' . $dirname . '/include/autoload.php')) {
             if (!($configs = (include $file))) {
                 return false;
             }
         }
     }
     return $configs = array_merge(XoopsLoad::loadCoreConfig(), $configs);
 }