@@ -30,7 +30,9 @@ |
||
| 30 | 30 | |
| 31 | 31 | protected function processEntity(Template\Block $contents) { |
| 32 | 32 | |
| 33 | - if ($this->create) $contents->getBlock('info')->disable(); else { |
|
| 33 | + if ($this->create) { |
|
| 34 | + $contents->getBlock('info')->disable(); |
|
| 35 | + } else { |
|
| 34 | 36 | |
| 35 | 37 | $contents->getBlock('info')->time_registered = Date::get(DATE_FORMAT_DATETIME, $this->entity->time_registered); |
| 36 | 38 | |
@@ -32,16 +32,18 @@ |
||
| 32 | 32 | |
| 33 | 33 | protected function processEntityParent(Template\Block $parent) { |
| 34 | 34 | |
| 35 | - if ((0 !== $this->parent->id) && $this->parent->active) $parent->getBlock('browse')->link = $this->parent->link; |
|
| 36 | - |
|
| 37 | - else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
| 35 | + if ((0 !== $this->parent->id) && $this->parent->active) { |
|
| 36 | + $parent->getBlock('browse')->link = $this->parent->link; |
|
| 37 | + } else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | # Add additional parent data for specific entity |
| 41 | 41 | |
| 42 | 42 | protected function processEntity(Template\Block $contents) { |
| 43 | 43 | |
| 44 | - if (!$this->create && $this->parent->locked) $contents->getBlock('locked')->enable(); |
|
| 44 | + if (!$this->create && $this->parent->locked) { |
|
| 45 | + $contents->getBlock('locked')->enable(); |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | } |
| 47 | 49 | } |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | |
| 13 | 13 | protected function init() { |
| 14 | 14 | |
| 15 | - $this->addWorker('gravatar', function (array $data) { |
|
| 15 | + $this->addWorker('gravatar', function(array $data) { |
|
| 16 | 16 | |
| 17 | 17 | return md5(strtolower($data['email'])); |
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | - $this->addWorker('full_name', function (array $data) { |
|
| 20 | + $this->addWorker('full_name', function(array $data) { |
|
| 21 | 21 | |
| 22 | - return trim($data['first_name'] . ' ' . $data['last_name']); |
|
| 22 | + return trim($data['first_name'].' '.$data['last_name']); |
|
| 23 | 23 | }); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | protected function addWorker(string $name, callable $worker) { |
| 14 | 14 | |
| 15 | - if (isset($this->params[$name]) || isset($this->workers[$name])) return; |
|
| 15 | + if (isset($this->params[$name]) || isset($this->workers[$name])) { |
|
| 16 | + return; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | $this->workers[$name] = $worker; |
| 18 | 20 | } |
@@ -23,7 +25,9 @@ discard block |
||
| 23 | 25 | |
| 24 | 26 | $this->params = Entitizer::definition(static::$table)->params(); |
| 25 | 27 | |
| 26 | - if (static::$nesting) $this->params['parent_id'] = $this->params['id']; |
|
| 28 | + if (static::$nesting) { |
|
| 29 | + $this->params['parent_id'] = $this->params['id']; |
|
| 30 | + } |
|
| 27 | 31 | |
| 28 | 32 | $this->init(); $this->reset(); |
| 29 | 33 | } |
@@ -34,11 +38,15 @@ discard block |
||
| 34 | 38 | |
| 35 | 39 | # Reset params |
| 36 | 40 | |
| 37 | - foreach ($this->params as $name => $param) $this->data[$name] = $param->cast(null); |
|
| 41 | + foreach ($this->params as $name => $param) { |
|
| 42 | + $this->data[$name] = $param->cast(null); |
|
| 43 | + } |
|
| 38 | 44 | |
| 39 | 45 | # Reset extras |
| 40 | 46 | |
| 41 | - foreach ($this->workers as $name => $worker) $this->data[$name] = $worker($this->data); |
|
| 47 | + foreach ($this->workers as $name => $worker) { |
|
| 48 | + $this->data[$name] = $worker($this->data); |
|
| 49 | + } |
|
| 42 | 50 | |
| 43 | 51 | # ------------------------ |
| 44 | 52 | |
@@ -53,12 +61,16 @@ discard block |
||
| 53 | 61 | |
| 54 | 62 | foreach ($data as $name => $value) { |
| 55 | 63 | |
| 56 | - if (isset($this->params[$name])) $this->data[$name] = $this->params[$name]->cast($value); |
|
| 64 | + if (isset($this->params[$name])) { |
|
| 65 | + $this->data[$name] = $this->params[$name]->cast($value); |
|
| 66 | + } |
|
| 57 | 67 | } |
| 58 | 68 | |
| 59 | 69 | # Update extras |
| 60 | 70 | |
| 61 | - foreach ($this->workers as $name => $worker) $this->data[$name] = $worker($this->data); |
|
| 71 | + foreach ($this->workers as $name => $worker) { |
|
| 72 | + $this->data[$name] = $worker($this->data); |
|
| 73 | + } |
|
| 62 | 74 | |
| 63 | 75 | # ------------------------ |
| 64 | 76 | |
@@ -73,7 +85,9 @@ discard block |
||
| 73 | 85 | |
| 74 | 86 | foreach ($data as $name => $value) { |
| 75 | 87 | |
| 76 | - if (isset($this->params[$name])) $cast[$name] = $this->params[$name]->cast($value); |
|
| 88 | + if (isset($this->params[$name])) { |
|
| 89 | + $cast[$name] = $this->params[$name]->cast($value); |
|
| 90 | + } |
|
| 77 | 91 | } |
| 78 | 92 | |
| 79 | 93 | # ------------------------ |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | |
| 31 | 31 | protected function processEntityParent(Template\Block $parent) { |
| 32 | 32 | |
| 33 | - if (0 !== $this->parent->id) $parent->getBlock('browse')->link = $this->parent->link; |
|
| 34 | - |
|
| 35 | - else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
| 33 | + if (0 !== $this->parent->id) { |
|
| 34 | + $parent->getBlock('browse')->link = $this->parent->link; |
|
| 35 | + } else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | # Add item additional data |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | |
| 31 | 31 | protected function processEntityParent(Template\Block $parent) { |
| 32 | 32 | |
| 33 | - if ((0 !== $this->parent->id) && $this->parent->active) $parent->getBlock('browse')->link = $this->parent->link; |
|
| 34 | - |
|
| 35 | - else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
| 33 | + if ((0 !== $this->parent->id) && $this->parent->active) { |
|
| 34 | + $parent->getBlock('browse')->link = $this->parent->link; |
|
| 35 | + } else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | # Add item additional data |
@@ -40,7 +40,9 @@ |
||
| 40 | 40 | |
| 41 | 41 | # Set remove button |
| 42 | 42 | |
| 43 | - if ($user->id === Auth::user()->id) $view->getBlock('remove')->class = 'disabled'; |
|
| 43 | + if ($user->id === Auth::user()->id) { |
|
| 44 | + $view->getBlock('remove')->class = 'disabled'; |
|
| 45 | + } |
|
| 44 | 46 | } |
| 45 | 47 | } |
| 46 | 48 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function __construct() { |
| 32 | 32 | |
| 33 | - $system_file = (DIR_SYSTEM_DATA . 'System.json'); |
|
| 33 | + $system_file = (DIR_SYSTEM_DATA.'System.json'); |
|
| 34 | 34 | |
| 35 | 35 | if (false !== ($data = Explorer::json($system_file))) $this->parse($data); |
| 36 | 36 | } |
@@ -20,21 +20,19 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | # Connect to DB |
| 22 | 22 | |
| 23 | - try { DB::connect($server, $user, $password, $name); } |
|
| 24 | - |
|
| 25 | - catch (Exception\DBConnect $error) { return 'INSTALL_ERROR_DATABASE_CONNECT'; } |
|
| 26 | - |
|
| 27 | - catch (Exception\DBSelect $error) { return 'INSTALL_ERROR_DATABASE_SELECT'; } |
|
| 28 | - |
|
| 29 | - catch (Exception\DBCharset $error) { return 'INSTALL_ERROR_DATABASE_CHARSET'; } |
|
| 23 | + try { DB::connect($server, $user, $password, $name); } catch (Exception\DBConnect $error) { return 'INSTALL_ERROR_DATABASE_CONNECT'; } catch (Exception\DBSelect $error) { return 'INSTALL_ERROR_DATABASE_SELECT'; } catch (Exception\DBCharset $error) { return 'INSTALL_ERROR_DATABASE_CHARSET'; } |
|
| 30 | 24 | |
| 31 | 25 | # Create tables |
| 32 | 26 | |
| 33 | - if (!Install\Utils\Tables::create()) return 'INSTALL_ERROR_DATABASE_TABLES_CREATE'; |
|
| 27 | + if (!Install\Utils\Tables::create()) { |
|
| 28 | + return 'INSTALL_ERROR_DATABASE_TABLES_CREATE'; |
|
| 29 | + } |
|
| 34 | 30 | |
| 35 | 31 | # Fill tables |
| 36 | 32 | |
| 37 | - if (!Install\Utils\Tables::fill()) return 'INSTALL_ERROR_DATABASE_TABLES_FILL'; |
|
| 33 | + if (!Install\Utils\Tables::fill()) { |
|
| 34 | + return 'INSTALL_ERROR_DATABASE_TABLES_FILL'; |
|
| 35 | + } |
|
| 38 | 36 | |
| 39 | 37 | # Save system file |
| 40 | 38 | |
@@ -49,7 +47,9 @@ discard block |
||
| 49 | 47 | |
| 50 | 48 | $system_file = (DIR_SYSTEM_DATA . 'System.json'); |
| 51 | 49 | |
| 52 | - if (false === JSON::save($system_file, $system)) return 'INSTALL_ERROR_SYSTEM'; |
|
| 50 | + if (false === JSON::save($system_file, $system)) { |
|
| 51 | + return 'INSTALL_ERROR_SYSTEM'; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | # ------------------------ |
| 55 | 55 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | # Customize captcha |
| 26 | 26 | |
| 27 | - $font = (DIR_SYSTEM_DATA . CONFIG_CAPTCHA_FONT); $size = CONFIG_CAPTCHA_FONT_SIZE; |
|
| 27 | + $font = (DIR_SYSTEM_DATA.CONFIG_CAPTCHA_FONT); $size = CONFIG_CAPTCHA_FONT_SIZE; |
|
| 28 | 28 | |
| 29 | 29 | $indent = CONFIG_CAPTCHA_TEXT_INDENT; $step = CONFIG_CAPTCHA_TEXT_STEP; |
| 30 | 30 | |