Exemplo n.º 1
0
 /**
  * List defined Blocks
  */
 public function classlistAction()
 {
     $blocksPath = $this->_configMain['blocks'];
     $classesPath = $this->_configMain['application_path'];
     $files = File::scanFiles($blocksPath, array('.php'), true, File::Files_Only);
     foreach ($files as $k => $file) {
         $class = Utils::classFromPath(str_replace($classesPath, '', $file));
         if ($class != 'Block_Abstract') {
             $data[] = array('id' => $class, 'title' => $class);
         }
     }
     if ($this->_configMain->get('allow_externals')) {
         $config = Config::factory(Config::File_Array, $this->_configMain->get('configs') . 'externals.php');
         $eExpert = new Externals_Expert($this->_configMain, $config);
         $extBlocks = $eExpert->getBlocks();
         if (!empty($extBlocks)) {
             foreach ($extBlocks as $class => $path) {
                 $data[] = array('id' => $class, 'title' => $class);
             }
         }
     }
     Response::jsonSuccess($data);
 }