@@ -12,19 +12,33 @@ |
||
| 12 | 12 | |
| 13 | 13 | $extension = strtolower(Explorer::extension($file_name, false)); |
| 14 | 14 | |
| 15 | - if (self::isImage($extension)) return 'image'; |
|
| 15 | + if (self::isImage($extension)) { |
|
| 16 | + return 'image'; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | - if (self::isAudio($extension)) return 'audio'; |
|
| 19 | + if (self::isAudio($extension)) { |
|
| 20 | + return 'audio'; |
|
| 21 | + } |
|
| 18 | 22 | |
| 19 | - if (self::isVideo($extension)) return 'video'; |
|
| 23 | + if (self::isVideo($extension)) { |
|
| 24 | + return 'video'; |
|
| 25 | + } |
|
| 20 | 26 | |
| 21 | - if (in_array($extension, ['doc', 'docx'], true)) return 'word'; |
|
| 27 | + if (in_array($extension, ['doc', 'docx'], true)) { |
|
| 28 | + return 'word'; |
|
| 29 | + } |
|
| 22 | 30 | |
| 23 | - if (in_array($extension, ['xls', 'xlsx'], true)) return 'excel'; |
|
| 31 | + if (in_array($extension, ['xls', 'xlsx'], true)) { |
|
| 32 | + return 'excel'; |
|
| 33 | + } |
|
| 24 | 34 | |
| 25 | - if (in_array($extension, ['ppt', 'pptx'], true)) return 'powerpoint'; |
|
| 35 | + if (in_array($extension, ['ppt', 'pptx'], true)) { |
|
| 36 | + return 'powerpoint'; |
|
| 37 | + } |
|
| 26 | 38 | |
| 27 | - if ($extension === 'pdf') return 'pdf'; |
|
| 39 | + if ($extension === 'pdf') { |
|
| 40 | + return 'pdf'; |
|
| 41 | + } |
|
| 28 | 42 | |
| 29 | 43 | # ------------------------ |
| 30 | 44 | |
@@ -45,7 +45,9 @@ |
||
| 45 | 45 | |
| 46 | 46 | public static function mysqlVersion() { |
| 47 | 47 | |
| 48 | - if (!(DB::send("SELECT VERSION() as version") && DB::last()->status)) return false; |
|
| 48 | + if (!(DB::send("SELECT VERSION() as version") && DB::last()->status)) { |
|
| 49 | + return false; |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | return strval(DB::last()->row()['version']); |
| 51 | 53 | } |
@@ -24,21 +24,21 @@ |
||
| 24 | 24 | |
| 25 | 25 | public static function checkInstallFile() { |
| 26 | 26 | |
| 27 | - return Explorer::isFile(DIR_WWW . 'install.php'); |
|
| 27 | + return Explorer::isFile(DIR_WWW.'install.php'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | # Check if debug mode forced |
| 31 | 31 | |
| 32 | 32 | public static function isDebugMode() { |
| 33 | 33 | |
| 34 | - return Explorer::isFile(DIR_SYSTEM_DATA . '.debug'); |
|
| 34 | + return Explorer::isFile(DIR_SYSTEM_DATA.'.debug'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | # Check if demo mode forced |
| 38 | 38 | |
| 39 | 39 | public static function isDemoMode() { |
| 40 | 40 | |
| 41 | - return Explorer::isFile(DIR_SYSTEM_DATA . '.demo'); |
|
| 41 | + return Explorer::isFile(DIR_SYSTEM_DATA.'.demo'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | # Get MySQL version |
@@ -39,7 +39,9 @@ |
||
| 39 | 39 | |
| 40 | 40 | $modifier = ((0 === $this->menuitem->id) ? 'create' : 'edit'); |
| 41 | 41 | |
| 42 | - if (!$this->menuitem->$modifier($data)) return 'MENUITEM_ERROR_MODIFY'; |
|
| 42 | + if (!$this->menuitem->$modifier($data)) { |
|
| 43 | + return 'MENUITEM_ERROR_MODIFY'; |
|
| 44 | + } |
|
| 43 | 45 | |
| 44 | 46 | # ------------------------ |
| 45 | 47 | |
@@ -12,9 +12,13 @@ |
||
| 12 | 12 | |
| 13 | 13 | private function getLink() { |
| 14 | 14 | |
| 15 | - if ('' === $this->data['slug']) return ''; |
|
| 15 | + if ('' === $this->data['slug']) { |
|
| 16 | + return ''; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | - if (false !== Validate::url($this->data['slug'])) return $this->data['slug']; |
|
| 19 | + if (false !== Validate::url($this->data['slug'])) { |
|
| 20 | + return $this->data['slug']; |
|
| 21 | + } |
|
| 18 | 22 | |
| 19 | 23 | # ------------------------ |
| 20 | 24 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | # ------------------------ |
| 20 | 20 | |
| 21 | - return (INSTALL_PATH . '/' . $this->data['slug']); |
|
| 21 | + return (INSTALL_PATH.'/'.$this->data['slug']); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | # Implement entity |
@@ -23,11 +23,15 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $name = Settings::get(self::$param[$this->section]); $primary = self::$default[$this->section]; |
| 25 | 25 | |
| 26 | - if (self::valid($name) && isset($items[$name])) $active = $name; |
|
| 27 | - |
|
| 28 | - else if (self::valid($primary) && isset($items[$primary])) $active = $primary; |
|
| 26 | + if (self::valid($name) && isset($items[$name])) { |
|
| 27 | + $active = $name; |
|
| 28 | + } else if (self::valid($primary) && isset($items[$primary])) { |
|
| 29 | + $active = $primary; |
|
| 30 | + } |
|
| 29 | 31 | |
| 30 | - foreach (array_keys($items) as $name) $items[$name]['active'] = ($name === $active); |
|
| 32 | + foreach (array_keys($items) as $name) { |
|
| 33 | + $items[$name]['active'] = ($name === $active); |
|
| 34 | + } |
|
| 31 | 35 | |
| 32 | 36 | # ------------------------ |
| 33 | 37 | |
@@ -73,12 +77,16 @@ discard block |
||
| 73 | 77 | |
| 74 | 78 | $items->add($item = View::get(self::$view_item)); |
| 75 | 79 | |
| 76 | - foreach (self::$data as $name) $item->$name = $extension[$name]; |
|
| 80 | + foreach (self::$data as $name) { |
|
| 81 | + $item->$name = $extension[$name]; |
|
| 82 | + } |
|
| 77 | 83 | |
| 78 | 84 | $item->class = ($extension['active'] ? 'positive' : 'grey'); |
| 79 | 85 | } |
| 80 | 86 | |
| 81 | - if ($items->count()) $contents->block('items', $items); |
|
| 87 | + if ($items->count()) { |
|
| 88 | + $contents->block('items', $items); |
|
| 89 | + } |
|
| 82 | 90 | |
| 83 | 91 | # ------------------------ |
| 84 | 92 | |
@@ -93,15 +101,21 @@ discard block |
||
| 93 | 101 | |
| 94 | 102 | # Check for demo mode |
| 95 | 103 | |
| 96 | - if (Informer::isDemoMode()) return $ajax->error(Language::get('DEMO_MODE_RESTRICTION')); |
|
| 104 | + if (Informer::isDemoMode()) { |
|
| 105 | + return $ajax->error(Language::get('DEMO_MODE_RESTRICTION')); |
|
| 106 | + } |
|
| 97 | 107 | |
| 98 | 108 | # Save configuration |
| 99 | 109 | |
| 100 | 110 | $param = self::$param[$this->section]; $name = Request::post('name'); |
| 101 | 111 | |
| 102 | - if (false === Settings::set($param, $name)) return $ajax->error(Language::get(self::$error_name)); |
|
| 112 | + if (false === Settings::set($param, $name)) { |
|
| 113 | + return $ajax->error(Language::get(self::$error_name)); |
|
| 114 | + } |
|
| 103 | 115 | |
| 104 | - if (false === Settings::save()) return $ajax->error(Language::get(self::$error_save)); |
|
| 116 | + if (false === Settings::save()) { |
|
| 117 | + return $ajax->error(Language::get(self::$error_save)); |
|
| 118 | + } |
|
| 105 | 119 | |
| 106 | 120 | # ------------------------ |
| 107 | 121 | |
@@ -116,7 +130,9 @@ discard block |
||
| 116 | 130 | |
| 117 | 131 | $this->items = $this->getHandlerItems(); |
| 118 | 132 | |
| 119 | - if (Request::isAjax()) return $this->handleAjax(); |
|
| 133 | + if (Request::isAjax()) { |
|
| 134 | + return $this->handleAjax(); |
|
| 135 | + } |
|
| 120 | 136 | |
| 121 | 137 | # ------------------------ |
| 122 | 138 | |
@@ -32,10 +32,12 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $languages = [Extend\Languages::pathPrimary(), Extend\Languages::path()]; |
| 34 | 34 | |
| 35 | - foreach (array_unique($languages) as $path) foreach (static::PHRASES as $name) { |
|
| 35 | + foreach (array_unique($languages) as $path) { |
|
| 36 | + foreach (static::PHRASES as $name) { |
|
| 36 | 37 | |
| 37 | 38 | Language::load($path . 'Phrases/' . $name . '.php'); |
| 38 | 39 | } |
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | # Set template globals |
| 41 | 43 | |
@@ -57,7 +59,9 @@ discard block |
||
| 57 | 59 | |
| 58 | 60 | # Set timezone |
| 59 | 61 | |
| 60 | - if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) date_default_timezone_set($timezone); |
|
| 62 | + if (Auth::check() && ('' !== ($timezone = Auth::user()->timezone))) { |
|
| 63 | + date_default_timezone_set($timezone); |
|
| 64 | + } |
|
| 61 | 65 | |
| 62 | 66 | # ------------------------ |
| 63 | 67 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | foreach (array_unique($languages) as $path) foreach (static::PHRASES as $name) { |
| 36 | 36 | |
| 37 | - Language::load($path . 'Phrases/' . $name . '.php'); |
|
| 37 | + Language::load($path.'Phrases/'.$name.'.php'); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | # Set template globals |
@@ -147,20 +147,29 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | if ($this instanceof Component\Install) { |
| 149 | 149 | |
| 150 | - if (Template::isBlock($result = $this->handle())) return $this->displayForm($result, STATUS_CODE_200); |
|
| 150 | + if (Template::isBlock($result = $this->handle())) { |
|
| 151 | + return $this->displayForm($result, STATUS_CODE_200); |
|
| 152 | + } |
|
| 151 | 153 | } |
| 152 | 154 | |
| 153 | 155 | # Handle auth component request |
| 154 | 156 | |
| 155 | 157 | else if ($this instanceof Component\Auth) { |
| 156 | 158 | |
| 157 | - if (Auth::check()) Request::redirect(INSTALL_PATH . '/admin'); |
|
| 158 | - |
|
| 159 | - if ($this instanceof Component\Auth\Initial) { if (!Auth::initial()) Request::redirect(INSTALL_PATH . '/admin/login'); } |
|
| 159 | + if (Auth::check()) { |
|
| 160 | + Request::redirect(INSTALL_PATH . '/admin'); |
|
| 161 | + } |
|
| 160 | 162 | |
| 161 | - else if (Auth::initial()) Request::redirect(INSTALL_PATH . '/admin/register'); |
|
| 163 | + if ($this instanceof Component\Auth\Initial) { if (!Auth::initial()) { |
|
| 164 | + Request::redirect(INSTALL_PATH . '/admin/login'); |
|
| 165 | + } |
|
| 166 | + } else if (Auth::initial()) { |
|
| 167 | + Request::redirect(INSTALL_PATH . '/admin/register'); |
|
| 168 | + } |
|
| 162 | 169 | |
| 163 | - if (Template::isBlock($result = $this->handle())) return $this->displayForm($result, STATUS_CODE_401); |
|
| 170 | + if (Template::isBlock($result = $this->handle())) { |
|
| 171 | + return $this->displayForm($result, STATUS_CODE_401); |
|
| 172 | + } |
|
| 164 | 173 | } |
| 165 | 174 | |
| 166 | 175 | # Handle panel component request |
@@ -172,9 +181,13 @@ discard block |
||
| 172 | 181 | Request::redirect(INSTALL_PATH . '/admin/login'); |
| 173 | 182 | } |
| 174 | 183 | |
| 175 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result); |
|
| 184 | + if (Template::isBlock($result = $this->handle())) { |
|
| 185 | + return $this->displayPage($result); |
|
| 186 | + } |
|
| 176 | 187 | |
| 177 | - if (Ajax::isResponse($result)) return Ajax::output($result); |
|
| 188 | + if (Ajax::isResponse($result)) { |
|
| 189 | + return Ajax::output($result); |
|
| 190 | + } |
|
| 178 | 191 | } |
| 179 | 192 | } |
| 180 | 193 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | # Set title |
| 33 | 33 | |
| 34 | - $form->title = ((('' !== $this->title) ? ($this->title . ' | ') : '') . CADMIUM_NAME); |
|
| 34 | + $form->title = ((('' !== $this->title) ? ($this->title.' | ') : '').CADMIUM_NAME); |
|
| 35 | 35 | |
| 36 | 36 | # Create layout |
| 37 | 37 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | # Set title |
| 74 | 74 | |
| 75 | - $page->title = ((('' !== $this->title) ? ($this->title . ' | ') : '') . CADMIUM_NAME); |
|
| 75 | + $page->title = ((('' !== $this->title) ? ($this->title.' | ') : '').CADMIUM_NAME); |
|
| 76 | 76 | |
| 77 | 77 | # Create layout |
| 78 | 78 | |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | else if ($this instanceof Component\Auth) { |
| 155 | 155 | |
| 156 | - if (Auth::check()) Request::redirect(INSTALL_PATH . '/admin'); |
|
| 156 | + if (Auth::check()) Request::redirect(INSTALL_PATH.'/admin'); |
|
| 157 | 157 | |
| 158 | - if ($this instanceof Component\Auth\Initial) { if (!Auth::initial()) Request::redirect(INSTALL_PATH . '/admin/login'); } |
|
| 158 | + if ($this instanceof Component\Auth\Initial) { if (!Auth::initial()) Request::redirect(INSTALL_PATH.'/admin/login'); } |
|
| 159 | 159 | |
| 160 | - else if (Auth::initial()) Request::redirect(INSTALL_PATH . '/admin/register'); |
|
| 160 | + else if (Auth::initial()) Request::redirect(INSTALL_PATH.'/admin/register'); |
|
| 161 | 161 | |
| 162 | 162 | if (Template::isBlock($result = $this->handle())) return $this->displayForm($result, STATUS_CODE_401); |
| 163 | 163 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | if (!Auth::check() || ((false !== Request::get('logout')) && Auth::logout())) { |
| 170 | 170 | |
| 171 | - Request::redirect(INSTALL_PATH . '/admin/login'); |
|
| 171 | + Request::redirect(INSTALL_PATH.'/admin/login'); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | if (Template::isBlock($result = $this->handle())) return $this->displayPage($result); |
@@ -19,13 +19,17 @@ |
||
| 19 | 19 | |
| 20 | 20 | public static function get(string $name) { |
| 21 | 21 | |
| 22 | - if ('' === self::$section) throw new Exception\View(); |
|
| 22 | + if ('' === self::$section) { |
|
| 23 | + throw new Exception\View(); |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | $class_name = ('System\Views\\' . self::$section . '\\' . $name); |
| 25 | 27 | |
| 26 | - if (isset(self::$cache[$class_name])) $view = clone self::$cache[$class_name]; |
|
| 27 | - |
|
| 28 | - else $view = (self::$cache[$class_name] = new $class_name()); |
|
| 28 | + if (isset(self::$cache[$class_name])) { |
|
| 29 | + $view = clone self::$cache[$class_name]; |
|
| 30 | + } else { |
|
| 31 | + $view = (self::$cache[$class_name] = new $class_name()); |
|
| 32 | + } |
|
| 29 | 33 | |
| 30 | 34 | # ------------------------ |
| 31 | 35 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | |
| 22 | 22 | if ('' === self::$section) throw new Exception\View(); |
| 23 | 23 | |
| 24 | - $class_name = ('Views\\' . self::$section . '\\' . $name); |
|
| 24 | + $class_name = ('Views\\'.self::$section.'\\'.$name); |
|
| 25 | 25 | |
| 26 | 26 | if (isset(self::$cache[$class_name])) $view = clone self::$cache[$class_name]; |
| 27 | 27 | |
@@ -18,7 +18,9 @@ |
||
| 18 | 18 | |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - if (static::$section !== Extend\Templates::section()) return; |
|
| 21 | + if (static::$section !== Extend\Templates::section()) { |
|
| 22 | + return; |
|
| 23 | + } |
|
| 22 | 24 | |
| 23 | 25 | $file_name = (Extend\Templates::path() . static::$file_name); |
| 24 | 26 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | |
| 21 | 21 | if (static::$section !== Extend\Templates::section()) return; |
| 22 | 22 | |
| 23 | - $file_name = (Extend\Templates::path() . static::$file_name); |
|
| 23 | + $file_name = (Extend\Templates::path().static::$file_name); |
|
| 24 | 24 | |
| 25 | 25 | parent::__construct(Explorer::contents($file_name)); |
| 26 | 26 | } |