From 53bbbf9fc2eb4e590660c6d8b2e3c36339102932 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Sun, 10 Jan 2016 17:17:04 +0100 Subject: [PATCH] Docblocks / coding style improvement --- admin.php | 13 ++++++++++++- classes/admin.php | 13 +++++++------ classes/controller.php | 9 ++++++--- classes/gpm.php | 3 ++- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/admin.php b/admin.php index 53b49f16..c48baf37 100644 --- a/admin.php +++ b/admin.php @@ -364,6 +364,9 @@ class AdminPlugin extends Plugin } } + /** + * Handles initializing the assets + */ public function onAssetsInitialized() { // Disable Asset pipelining @@ -433,6 +436,9 @@ class AdminPlugin extends Plugin } } + /** + * Handles the shutdown + */ public function onShutdown() { // Just so we know that we're in this debug mode @@ -594,7 +600,7 @@ class AdminPlugin extends Plugin } /** - * Add Twig Extensions + * Add the Admin Twig Extensions */ public function onTwigExtensions() { @@ -602,6 +608,11 @@ class AdminPlugin extends Plugin $this->grav['twig']->twig->addExtension(new AdminTwigExtension()); } + /** + * Check if the current route is under the admin path + * + * @return bool + */ public function isAdminPath() { if ($this->uri->route() == $this->base || diff --git a/classes/admin.php b/classes/admin.php index 12435808..a037df60 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -522,7 +522,7 @@ class Admin $pages = $this->grav['pages']; $latest = array(); - + if(is_null($pages->routes())){ return; } @@ -724,7 +724,7 @@ class Admin { $configurations = []; $path = Grav::instance()['locator']->findResource('user://config'); - + /** @var \DirectoryIterator $directory */ foreach (new \DirectoryIterator($path) as $file) { if ($file->isDir() || $file->isDot() || !preg_match('/^[^.].*.yaml$/', $file->getFilename())) { @@ -732,7 +732,7 @@ class Admin } $configurations[] = basename($file->getBasename(), '.yaml'); } - + return $configurations; } @@ -824,8 +824,8 @@ class Admin * * @return string The phpinfo() output */ - function phpinfo() { - + function phpinfo() + { if (function_exists('phpinfo')) { ob_start(); phpinfo(); @@ -844,7 +844,8 @@ class Admin * * @param $string the string to translate */ - public function translate($string) { + public function translate($string) + { return $this->_translate($string, [$this->grav['user']->authenticated ? $this->grav['user']->language : 'en']); } diff --git a/classes/controller.php b/classes/controller.php index fb47fa8c..f0dfdc03 100644 --- a/classes/controller.php +++ b/classes/controller.php @@ -194,7 +194,8 @@ class AdminController * * @return bool True if multilang is active */ - protected function isMultilang() { + protected function isMultilang() + { return count($this->grav['config']->get('system.languages.supported', [])) > 1; } @@ -1353,7 +1354,8 @@ class AdminController * * @return bool True if the action was performed. */ - protected function taskSwitchlanguage() { + protected function taskSwitchlanguage() + { $data = $this->post; if (isset($data['lang'])) { @@ -1385,7 +1387,8 @@ class AdminController * * @return bool True if the action was performed. */ - protected function taskSaveas() { + protected function taskSaveas() + { if (!$this->authorizeTask('save', $this->dataPermissions())) { return; } diff --git a/classes/gpm.php b/classes/gpm.php index 85d50691..38b72757 100644 --- a/classes/gpm.php +++ b/classes/gpm.php @@ -167,7 +167,8 @@ class Gpm return $tmp . DS . $package['name']; } - public static function selfupgrade() { + public static function selfupgrade() + { $upgrader = new Upgrader(); if (!Installer::isGravInstance(GRAV_ROOT)) {