コード例 #1
0
 /**
  * Add another version to this entity
  *
  * @param Float $version Version number
  * @param String $path path to folder
  */
 public function addVersion($version = '', $path)
 {
     $langs = scandir($path);
     $available = array();
     if ($langs) {
         foreach ($langs as $key => $lang) {
             if (!is_dir($path . $lang) || strlen($lang) > 2 || in_array($lang, DocumentationService::get_ignored_files(), true)) {
                 $lang = 'en';
             }
             if (!in_array($lang, $available)) {
                 $available[] = $lang;
             }
         }
     }
     $this->addLanguage($available);
     $this->versions[$version] = $path;
 }
コード例 #2
0
 /**
  * Return the children from a given module. Used for building the tree of the page
  *
  * @param String module name
  *
  * @return DataObjectSet
  */
 public static function get_pages_from_folder($folder)
 {
     $handle = opendir($folder);
     $output = new DataObjectSet();
     if ($handle) {
         $extensions = DocumentationService::get_valid_extensions();
         $ignore = DocumentationService::get_ignored_files();
         while (false !== ($file = readdir($handle))) {
             if (!in_array($file, $ignore)) {
                 $file = strtolower($file);
                 $clean = ($pos = strrpos($file, '.')) ? substr($file, 0, $pos) : $file;
                 $output->push(new ArrayData(array('Title' => self::clean_page_name($file), 'Filename' => $clean, 'Path' => $folder . $file . '/')));
             }
         }
     }
     return $output;
 }