diff --git a/app/config/config.php b/app/config/config.php index a43322b..58c1d5e 100644 --- a/app/config/config.php +++ b/app/config/config.php @@ -15,16 +15,16 @@ +------------------------------------------------------------------------+ */ +use Docs\Controllers\DocsController; use function Docs\Functions\app_path; use function Docs\Functions\env; -use Docs\Controllers\DocsController; /** * Get the versions and languages */ -$version = '0.1'; -$languages = []; -$versions = []; +$version = '0.1'; +$languages = []; +$versions = []; $crowdinFile = app_path('/storage/crowdin/crowdin.json'); if (true === file_exists($crowdinFile)) { $crowdin = file_get_contents($crowdinFile); @@ -55,6 +55,7 @@ 'staticUrl' => env('APP_STATIC_URL'), 'lang' => env('APP_LANG'), 'supportEmail' => env('APP_SUPPORT_EMAIL'), + 'assetTag' => 'development' !== env('APP_ENV') ? env('ASSET_TAG') : time(), 'googleAnalytics' => env('GOOGLE_ANALYTICS'), 'algoliaSearchKey' => env('ALGOLIA_SEARCH_KEY'), ], @@ -64,16 +65,16 @@ ], 'highlight' => [ 'version' => '9.11.0', - 'js' => [ - 'cpp', - 'css', - 'json', - 'php', - 'shell', - 'twig', - 'yaml', - 'zephir', - ], + 'js' => [ + 'cpp', + 'css', + 'json', + 'php', + 'shell', + 'twig', + 'yaml', + 'zephir', + ], ], 'providers' => [ // Application Service Providers @@ -91,7 +92,7 @@ Docs\Providers\Dispatcher\ServiceProvider::class, Docs\Providers\Tags\ServiceProvider::class, ], - 'routes' => [ + 'routes' => [ DocsController::class => [ 'methods' => [ 'get' => [ diff --git a/app/controllers/BaseController.php b/app/controllers/BaseController.php index bf5c19b..67bcd7d 100644 --- a/app/controllers/BaseController.php +++ b/app/controllers/BaseController.php @@ -17,16 +17,15 @@ namespace Docs\Controllers; -use function array_search; use Phalcon\Cache\BackendInterface; use Phalcon\Config; use Phalcon\Mvc\Controller as PhController; use Phalcon\Mvc\View\Simple; +use function array_search; use function Docs\Functions\app_path; use function Docs\Functions\config; use function Docs\Functions\environment; use function file_exists; -use function var_dump; /** * Docs\Controllers\BaseController @@ -70,7 +69,7 @@ public function getSidebar($language, $version): array if (true === file_exists($pageName)) { $data = file_get_contents($pageName); - } elseif (true === file_exists($apiFileName)) { + } else if (true === file_exists($apiFileName)) { $data = file_get_contents($apiFileName); } else { // The article does not exist @@ -179,6 +178,25 @@ protected function getSeoTitle(string $language, string $version, string $page): return $title; } + /** + * @param string $language + * @param string $version + * @param string $fileName + * + * @return string + */ + protected function getMenu($language, $version, $fileName): string + { + $document = $this->getDocument($language, $version, $fileName); + $document = str_replace( + '
  • ', + '
  • ', + $document + ); + + return ltrim(rtrim($document, ''), ''), '