Exemple #1
0
 public function loadAllFromPath($path, $url)
 {
     $folders = FS::folders($path);
     foreach ($folders as $folder) {
         $config_file = untrailingslashit($path) . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . "config.php";
         if (!FS::exists($config_file)) {
             continue;
         }
         $this->add($config_file, trailingslashit($url) . $folder);
     }
 }
 public function loadAllFromPath($path, $url, $groups = array())
 {
     try {
         if (!FS::exists($path)) {
             $msg = __("You were trying to add blocks from " . $path . " but this path does not exist. Please create this folder.", "onepager");
             throw new \Exception($msg);
         }
         $folders = FS::folders($path);
         foreach ($folders as $folder) {
             $config_file = untrailingslashit($path) . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . "config.php";
             if (!FS::exists($config_file)) {
                 $this->loadAllFromPath($path . DIRECTORY_SEPARATOR . $folder, trailingslashit($url) . $folder, $groups);
                 continue;
             }
             $this->add($config_file, trailingslashit($url) . $folder, $groups);
         }
     } catch (\Exception $e) {
         print 'Caught exception: ' . $e->getMessage() . "\n<br>";
     }
 }