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, ''), '');
+ }
+
/**
* @param string $language
* @param string $version
@@ -194,7 +212,7 @@ protected function getDocument($language, $version, $fileName): string
return $this->cacheData->get($key);
}
- $pageName = app_path(
+ $pageName = app_path(
sprintf(
'docs/%s/%s/%s.md',
$version,
@@ -229,25 +247,6 @@ protected function getDocument($language, $version, $fileName): string
return $data;
}
- /**
- * @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, '
'), '');
- }
-
/**
* Returns the current version string with its prefix if applicable
*
diff --git a/app/controllers/DocsController.php b/app/controllers/DocsController.php
index ac40f5a..081ab8b 100644
--- a/app/controllers/DocsController.php
+++ b/app/controllers/DocsController.php
@@ -2,12 +2,10 @@
namespace Docs\Controllers;
-use Docs\Cli\Tasks\GetLanguagesTask;
use Docs\Exception\HttpException;
use Phalcon\Http\ResponseInterface;
use Phalcon\Text;
use function Docs\Functions\base_url;
-use function str_replace;
/**
* Docs\Controllers\DocsController
@@ -63,13 +61,13 @@ public function mainAction(string $language = null, string $version = null, stri
$contents = $this->viewSimple->render(
$renderFile,
[
- 'page' => $page,
- 'language' => $language,
- 'version' => $version,
- 'sidebar' => $this->getMenu($language, $version, 'sidebar'),
- 'article' => $article,
- 'menu' => $this->getMenu($language, $version, $page . '-menu'),
- 'canonical' => $canonical,
+ 'page' => $page,
+ 'language' => $language,
+ 'version' => $version,
+ 'sidebar' => $this->getMenu($language, $version, 'sidebar'),
+ 'article' => $article,
+ 'menu' => $this->getMenu($language, $version, $page . '-menu'),
+ 'canonical' => $canonical,
]
);
$this->response->setContent($contents);
diff --git a/app/library/Bootstrap.php b/app/library/Bootstrap.php
index 60d4713..ee3d6ad 100644
--- a/app/library/Bootstrap.php
+++ b/app/library/Bootstrap.php
@@ -97,7 +97,8 @@ public function __construct($mode = 'normal')
/**
* Initialize the Service Provider.
*
- * Usually the Service Provider register a service in the Dependency Injector Container.
+ * Usually the Service Provider register a service in the Dependency
+ * Injector Container.
*
* @param ServiceProviderInterface $serviceProvider
*
@@ -117,7 +118,8 @@ protected function initializeServiceProvider(ServiceProviderInterface $servicePr
* If failed the `development` will be used.
*
* After getting `APP_ENV` variable we set the Bootstrap::$environment
- * and the `APPLICATION_ENV` constant which used in other Phalcon related projects eg Incubator.
+ * and the `APPLICATION_ENV` constant which used in other Phalcon related
+ * projects eg Incubator.
*/
protected function setupEnvironment()
{
@@ -228,7 +230,8 @@ public function getApplication()
}
/**
- * Gets current application environment: production, staging, development, testing, etc.
+ * Gets current application environment: production, staging, development,
+ * testing, etc.
*
* @return string
*/
diff --git a/app/library/Exception/Handler/ErrorPageHandler.php b/app/library/Exception/Handler/ErrorPageHandler.php
index 8469da4..d26abb8 100644
--- a/app/library/Exception/Handler/ErrorPageHandler.php
+++ b/app/library/Exception/Handler/ErrorPageHandler.php
@@ -18,7 +18,6 @@
namespace Docs\Exception\Handler;
use Whoops\Handler\Handler;
-use function Docs\Functions\config;
use function Docs\Functions\container;
/**
diff --git a/app/library/Exception/Handler/LoggerHandler.php b/app/library/Exception/Handler/LoggerHandler.php
index 214e4e4..47c07cc 100644
--- a/app/library/Exception/Handler/LoggerHandler.php
+++ b/app/library/Exception/Handler/LoggerHandler.php
@@ -136,7 +136,7 @@ public function addTraceToOutput($addTraceToOutput = null)
return $this->addTraceToOutput;
}
- $this->addTraceToOutput = (bool)$addTraceToOutput;
+ $this->addTraceToOutput = (bool) $addTraceToOutput;
return $this;
}
@@ -193,7 +193,7 @@ public function addTraceFunctionArgsToOutput($args = null)
}
if (!is_integer($args)) {
- $this->addTraceFunctionArgsToOutput = (bool)$args;
+ $this->addTraceFunctionArgsToOutput = (bool) $args;
} else {
$this->addTraceFunctionArgsToOutput = $args;
}
diff --git a/app/providers/Assets/ServiceProvider.php b/app/providers/Assets/ServiceProvider.php
index d1a3337..299f6b9 100644
--- a/app/providers/Assets/ServiceProvider.php
+++ b/app/providers/Assets/ServiceProvider.php
@@ -83,13 +83,15 @@ function ($lang) {
// TODO(o2)
// ->addCss($cssCdn, false)
->addCss(assets_uri('js/highlight/styles/googlecode.css', $version))
- ->addCss(assets_uri('css/style.css', $version));
+ ->addCss(assets_uri('css/style.css', $version))
+ ;
$assets
->collection('footer_js')
// // TODO(o2)
// ->addJs($jsCdn, false);
->addJs(assets_uri('js/main.min.js', $version))
- ->addJs(assets_uri('js/highlight/highlight.pack.js', $version));
+ ->addJs(assets_uri('js/highlight/highlight.pack.js', $version))
+ ;
}
}
diff --git a/app/providers/CacheData/ServiceProvider.php b/app/providers/CacheData/ServiceProvider.php
index d1eac2e..b5afb48 100644
--- a/app/providers/CacheData/ServiceProvider.php
+++ b/app/providers/CacheData/ServiceProvider.php
@@ -17,12 +17,11 @@
namespace Docs\Providers\CacheData;
-use function Docs\Functions\env;
use Phalcon\Cache\Frontend\Data;
use Phalcon\Di\ServiceProviderInterface;
use Phalcon\DiInterface;
use function Docs\Functions\app_path;
-use function Docs\Functions\config;
+use function Docs\Functions\env;
/**
* Docs\Providers\CacheData\ServiceProvider
diff --git a/app/providers/Logger/ServiceProvider.php b/app/providers/Logger/ServiceProvider.php
index 78db5a6..362392a 100644
--- a/app/providers/Logger/ServiceProvider.php
+++ b/app/providers/Logger/ServiceProvider.php
@@ -17,14 +17,13 @@
namespace Docs\Providers\Logger;
-use function Docs\Functions\env;
use Phalcon\Di\ServiceProviderInterface;
use Phalcon\DiInterface;
use Phalcon\Logger;
use Phalcon\Logger\Adapter\File;
use Phalcon\Logger\Formatter\Line;
use function Docs\Functions\app_path;
-use function Docs\Functions\config;
+use function Docs\Functions\env;
/**
* Docs\Providers\Logger\ServiceProvider
diff --git a/app/providers/ViewCache/ServiceProvider.php b/app/providers/ViewCache/ServiceProvider.php
index a8f8175..378d47c 100644
--- a/app/providers/ViewCache/ServiceProvider.php
+++ b/app/providers/ViewCache/ServiceProvider.php
@@ -21,7 +21,6 @@
use Phalcon\Di\ServiceProviderInterface;
use Phalcon\DiInterface;
use function Docs\Functions\app_path;
-use function Docs\Functions\config;
/**
* Docs\Providers\ViewCache\ServiceProvider
@@ -46,7 +45,7 @@ public function register(DiInterface $container)
function () {
$lifetime = env('CACHE_LIFETIME', 3600);
$driver = env('VIEW_CACHE_DRIVER', 'file');
- $adapter = '\Phalcon\Cache\Backend\\' . ucfirst($driver);
+ $adapter = '\Phalcon\Cache\Backend\\' . ucfirst($driver);
return new $adapter(
new Output(['lifetime' => $lifetime]),
diff --git a/app/providers/VoltTemplate/ServiceProvider.php b/app/providers/VoltTemplate/ServiceProvider.php
index 030c57a..1f02c6c 100644
--- a/app/providers/VoltTemplate/ServiceProvider.php
+++ b/app/providers/VoltTemplate/ServiceProvider.php
@@ -66,7 +66,8 @@ public function register(DiInterface $container)
$volt->getCompiler()
- ->addExtension(new VoltFunctions());
+ ->addExtension(new VoltFunctions())
+ ;
return $volt;
};
diff --git a/app/tasks/ClearCacheTask.php b/app/tasks/ClearCacheTask.php
index 7dea05c..fce3ac1 100644
--- a/app/tasks/ClearCacheTask.php
+++ b/app/tasks/ClearCacheTask.php
@@ -61,7 +61,8 @@ private function clearFolder(string $message, string $folder)
$bar = new CliProgressBar($steps);
$bar
->setColorToGreen()
- ->display();
+ ->display()
+ ;
foreach ($iterator as $file) {
if (true !== $file->isDir() &&
('php' === $file->getExtension() || 'cache' === $file->getExtension())
diff --git a/app/tasks/GenerateSitemapTask.php b/app/tasks/GenerateSitemapTask.php
index 23ff4a8..ad2395c 100644
--- a/app/tasks/GenerateSitemapTask.php
+++ b/app/tasks/GenerateSitemapTask.php
@@ -9,7 +9,6 @@
use SplFileInfo;
use function Docs\Functions\app_path;
use function file_put_contents;
-use function implode;
use function substr;
/**
diff --git a/app/tasks/GetLanguagesTask.php b/app/tasks/GetLanguagesTask.php
index 35b8199..2b1ce5b 100644
--- a/app/tasks/GetLanguagesTask.php
+++ b/app/tasks/GetLanguagesTask.php
@@ -17,18 +17,15 @@
namespace Docs\Cli\Tasks;
-use function array_multisort;
use Phalcon\CLI\Task;
-use function asort;
+use function array_multisort;
use function Docs\Functions\app_path;
use function Docs\Functions\env;
use function file_put_contents;
use function json_decode;
-use const SORT_ASC;
-use const SORT_STRING;
use function sprintf;
use const PHP_EOL;
-use function sprintf;
+use const SORT_ASC;
/**
* GetLanguagesTask
@@ -67,7 +64,7 @@ public function mainAction()
'en' => [
'name' => 'English',
'code' => 'en',
- ]
+ ],
];
foreach ($crowdin['languages'] as $language) {
$code = $languageMap[$language['code']] ?? 'en';
diff --git a/app/tasks/UpdateSearchTask.php b/app/tasks/UpdateSearchTask.php
index 525fb41..9926221 100644
--- a/app/tasks/UpdateSearchTask.php
+++ b/app/tasks/UpdateSearchTask.php
@@ -17,16 +17,15 @@
namespace Docs\Cli\Tasks;
-use \AlgoliaSearch\Client;
-use function Docs\Functions\app_path;
-use function Docs\Functions\env;
+use AlgoliaSearch\Client;
+use FilesystemIterator;
use Phalcon\CLI\Task;
use RecursiveDirectoryIterator;
-use FilesystemIterator;
use RecursiveIteratorIterator;
use SplFileInfo;
+use function Docs\Functions\app_path;
+use function Docs\Functions\env;
use function sprintf;
-use function var_dump;
/**
@@ -45,8 +44,8 @@ public function mainAction()
$applicationId = env('ALGOLIA_APPLICATION_ID', '');
$applicationKey = env('ALGOLIA_APPLICATION_KEY', '');
- $client = new Client($applicationId, $applicationKey);
- $index = $client->initIndex('docs-index');
+ $client = new Client($applicationId, $applicationKey);
+ $index = $client->initIndex('docs-index');
$elements = [];
$path = app_path('docs/');
$dirIterator = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
@@ -64,7 +63,7 @@ public function mainAction()
$language = $parts[1];
$version = $parts[0];
if ('old' !== $language) {
- $pageName = $docsPath . '/' . $file->getFilename();
+ $pageName = $docsPath . '/' . $file->getFilename();
if (true === file_exists($pageName)) {
$data = file_get_contents($pageName);
@@ -86,10 +85,10 @@ public function mainAction()
$data = $this->parsedown->text($data);
$elements[] = [
- 'version' => $version,
- 'language' => $language,
- 'filename' => str_replace('.md', '', $file->getFilename()),
- 'contents' => $data,
+ 'version' => $version,
+ 'language' => $language,
+ 'filename' => str_replace('.md', '', $file->getFilename()),
+ 'contents' => $data,
];
}
}
diff --git a/app/views/error/show404.volt b/app/views/error/show404.volt
index e7d9e2c..c0bb351 100644
--- a/app/views/error/show404.volt
+++ b/app/views/error/show404.volt
@@ -2,12 +2,14 @@
{%- block content -%}
- Oops! It seems you made a mistake by typing the wrong address or something like that.
+ Oops! It seems you made a mistake by typing the wrong address or
+ something like that.
In any case, please let us know:
{{ support }}
- Back to main page
+ Back to main
+ page
{{- article -}}
diff --git a/app/views/error/show500.volt b/app/views/error/show500.volt
index 1117090..742f68d 100644
--- a/app/views/error/show500.volt
+++ b/app/views/error/show500.volt
@@ -2,7 +2,8 @@
{%- block content -%}
- Sorry for the inconvenience but something is not quite right at the moment.
+ Sorry for the inconvenience but something is not quite right at the
+ moment.
We hope to solve it shortly. If you need to you can always contact us at
{{ support }},
otherwise please check back in a few minutes!
diff --git a/app/views/inc/google.volt b/app/views/inc/google.volt
index 9872966..2d86cdf 100644
--- a/app/views/inc/google.volt
+++ b/app/views/inc/google.volt
@@ -1,11 +1,14 @@
{%- if (not config.path('app.googleAnalytics', '') is empty) -%}
-
+
diff --git a/app/views/inc/header-languages.volt b/app/views/inc/header-languages.volt
index 159dee5..c89f85a 100644
--- a/app/views/inc/header-languages.volt
+++ b/app/views/inc/header-languages.volt
@@ -1,29 +1,30 @@
{% if page is defined %}
-{% set suffix = '/' ~ page %}
+ {% set suffix = '/' ~ page %}
{% else %}
-{% set suffix = '' %}
+ {% set suffix = '' %}
{% endif %}
{% set languages = config.path('app.languages', []) %}
-
-
-
+
-
+
+
+ {{ languages[language]['name'] }}
+
+
+
diff --git a/app/views/inc/header-versions.volt b/app/views/inc/header-versions.volt
index 605f01d..a5b0d5c 100644
--- a/app/views/inc/header-versions.volt
+++ b/app/views/inc/header-versions.volt
@@ -1,16 +1,17 @@
- -
-
- {{ version }}
-
-
-
+-
+
+ {{ version }}
+
+
+
diff --git a/app/views/inc/header.volt b/app/views/inc/header.volt
index d562516..22c0e7a 100644
--- a/app/views/inc/header.volt
+++ b/app/views/inc/header.volt
@@ -1,4 +1,5 @@
-