Example #1
0
/**
 * Check if file exists
 * @param string $filename Path to file
 * @return boolean
 */
function zbase_file_exists($filename)
{
    return file_exists(zbase_directory_separator_fix($filename));
}
Example #2
0
 /**
  * Add a module
  * 	Module will be created only f they are called.
  * @param string $path Path to module folder with a module.php returning an array
  * @retur Zbase
  */
 public function addModule($name, $path)
 {
     if (zbase_file_exists($path . '/module.php')) {
         $config = (require zbase_directory_separator_fix($path . '/module.php'));
         $name = !empty($config['id']) ? $config['id'] : null;
         if (empty($name)) {
             throw new Exceptions\ConfigNotFoundException('Module configuration ID not found.');
         }
         if (!empty($name)) {
             $enable = zbase_data_get($config, 'enable');
             if (empty($this->modules[$name]) && $enable) {
                 $config['path'] = $path;
                 $this->modules[$name] = $config;
             }
             return $this;
         }
     }
     // throw new Exceptions\ConfigNotFoundException('Module ' . $path . ' folder or ' . zbase_directory_separator_fix($path . '/module.ph') . ' not found.');
 }