/** * Return book page URL * * @param string $book_name * @param string $page_slug * @return string */ private static function getBookPageUrl($book_name, $page_slug) { return self::pageLevelToPrefix(self::$current_element->getPageLevel()) . 'books/' . $book_name . '/' . $page_slug . '.html'; }
/** * @param string|null $locale * @return WhatsNewArticle[]|NamedList */ function getWhatsNewArticles($locale = null) { if (empty($locale)) { $locale = $this->project->getDefaultLocale(); } $files = call_user_func($this->finders['findWhatsNewFiles'], $this->getWhatsNewArticlesPath($locale), $locale); $result = new NamedList(); foreach ($files as $version_num => $version_files) { foreach ($version_files as $file) { $article = new WhatsNewArticle($this->project, $version_num, $file); if ($article->isLoaded()) { $result->add($article->getShortName(), $article); } } } return $result; }
/** * @param Project $project * @param WhatsNewArticle $article * @param string $target_path * @param string $locale * @param OutputInterface $output */ private function copyVersionImages(Project $project, WhatsNewArticle $article, $target_path, $locale, OutputInterface $output) { $version_num = $article->getVersionNumber(); $version_dir_path = $locale === $project->getDefaultLocale() ? "{$target_path}/assets/images/whats-new/{$version_num}" : "{$target_path}/assets/images/{$locale}/whats-new/{$version_num}"; if (is_dir($version_dir_path)) { return; } $version_path = dirname($article->getIndexFilePath()); if (is_dir("{$version_path}/images")) { Shade::copyDir("{$version_path}/images", $version_dir_path, null, function ($path) use(&$output) { $output->writeln("{$path} copied"); }); } }