Exemplo n.º 1
0
 /**
  * Gets list of available editors
  *
  * @param   bool    $noHtml   is this an editor with no html options?
  * @return  array   $_list    list of available editors that are allowed (through admin config)
  */
 public function &getList($noHtml = FALSE)
 {
     $list = @(include_once ICMS_CACHE_PATH . $this->_type . 'editor_list.php');
     if (empty($list)) {
         $list = array();
         $order = array();
         $_list = icms_core_Filesystem::getDirList($this->root_path . '/');
         foreach ($_list as $item) {
             if (@(include $this->root_path . '/' . $item . '/editor_registry.php')) {
                 if (empty($config['order'])) {
                     continue;
                 }
                 $order[] = $config['order'];
                 $list[$item] = array("title" => $config["title"], "nohtml" => @$config["nohtml"]);
             }
         }
         array_multisort($order, $list);
         $contents = "<?php\n return " . var_export($list, TRUE) . "\n?>";
         icms_core_Filesystem::writeFile($contents, $this->_type . 'editor_list', 'php', ICMS_CACHE_PATH);
     }
     $editors = array_keys($list);
     if (!empty($this->allowed_editors)) {
         $editors = array_intersect($editors, $this->allowed_editors);
     }
     $_list = array();
     foreach ($editors as $name) {
         if (!empty($noHtml) && empty($list[$name]['nohtml'])) {
             continue;
         }
         $_list[$name] = $list[$name]['title'];
     }
     return $_list;
 }