/** * Méthode de parsing récursif des valeurs d'un tableau dans leur format encodé numériquement (é ==> é) * @param Array $pArray * @return Array */ public static function parseToNumericEntities(array $pArray) { $return = array(); foreach ($pArray as $key => $value) { $key = Encoding::toNumericEntities($key); $value = Encoding::toNumericEntities($value); $return[$key] = $value; } return $return; }
/** * @param string $pUrl * @param string $pTitle * @param string $pDescription * @param null $pFirst */ private function log($pUrl, $pTitle, $pDescription, $pFirst = null) { if (!$this->logFile) { return; } if (!$pFirst) { $pFirst = gmdate("D, d M Y H:i:s", time()); } $pTitle = str_replace('"', '""', $pTitle); $pTitle = Encoding::fromHTMLEntities($pTitle); $pDescription = str_replace('"', '""', $pDescription); $pDescription = Encoding::fromHTMLEntities($pDescription); File::append($this->logFile, '"' . $pFirst . '";"' . $pUrl . '";"' . $pTitle . '";"' . $pDescription . '"' . PHP_EOL); }
public function output($pFolder) { Folder::deleteRecursive($pFolder); Folder::create($pFolder); Folder::create($pFolder . '/classes'); $smarty = new \Smarty(); $smarty->clear_all_assign(); $smartyDir = "includes/libs/core/tools/docs/templates/_cache/"; $smarty->template_dir = "includes/libs/core/tools/docs/templates"; $smarty->cache_dir = $smartyDir; $smarty->compile_dir = $smartyDir; $classIndex = array(); foreach ($this->packages as $className => $details) { $parts = explode("\\", $className); $class = array_pop($parts); while (in_array($class, $classIndex) && !empty($parts)) { $class = $class . '\\' . array_pop($parts); } $file = 'classes/' . str_replace('\\', '_', $class) . '.html'; $classIndex[] = array('name' => $class, 'href' => $file); $smarty->clear_all_assign(); $details['name'] = $class; $smarty->assign('details', $details); file_put_contents($pFolder . $file, Encoding::BOM() . $smarty->fetch("template.class_details.tpl")); } $this->sortName($classIndex); $prefixed_ndx = array(); foreach ($classIndex as $class) { $firstLetter = strtoupper(substr($class['name'], 0, 1)); if (!array_key_exists($firstLetter, $prefixed_ndx)) { $prefixed_ndx[$firstLetter] = array(); } $prefixed_ndx[$firstLetter][] = $class; } $classIndex = $prefixed_ndx; $smarty->clear_all_assign(); $smarty->assign('classIndex', $classIndex); file_put_contents($pFolder . '/classes.html', Encoding::BOM() . $smarty->fetch("template.classes.tpl")); $smarty->clear_all_assign(); file_put_contents($pFolder . '/index.html', Encoding::BOM() . $smarty->fetch("template.index.tpl")); }