@@ -100,10 +100,10 @@ |
||
| 100 | 100 | protected function createComponentFilterForm() |
| 101 | 101 | { |
| 102 | 102 | $form = $this->driver->formManager()->filterForm($this->translator, $this->columns, $this->filter, $this->sorting, $this->onPage); |
| 103 | - $form->doRedirect[] = function ($onPage, $filter, $sorting) { |
|
| 103 | + $form->doRedirect[] = function($onPage, $filter, $sorting) { |
|
| 104 | 104 | $this->redirect('Item:default', $this->driver->type(), $this->database, $this->type, $this->table, 1, $onPage, $filter, $sorting); |
| 105 | 105 | }; |
| 106 | - $form->doReset[] = function () { |
|
| 106 | + $form->doReset[] = function() { |
|
| 107 | 107 | $this->redirect('Item:default', $this->driver->type(), $this->database, $this->type, $this->table); |
| 108 | 108 | }; |
| 109 | 109 | return $form; |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | 'svg' => 'image/svg+xml', |
| 45 | 45 | 'otf' => 'application/x-font-opentype', |
| 46 | 46 | ]; |
| 47 | - $path = __DIR__ . '/../../www/' . $file; |
|
| 47 | + $path = __DIR__.'/../../www/'.$file; |
|
| 48 | 48 | $extension = pathinfo($path, PATHINFO_EXTENSION); |
| 49 | 49 | $contentType = isset($contentTypes[$extension]) ? $contentTypes[$extension] : 'text/plain'; |
| 50 | 50 | $httpResponse->setContentType($contentType); |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | return $message; |
| 51 | 51 | } |
| 52 | 52 | foreach ($params as $key => $value) { |
| 53 | - $message = str_replace('%' . $key . '%', $value, $message); |
|
| 53 | + $message = str_replace('%'.$key.'%', $value, $message); |
|
| 54 | 54 | } |
| 55 | 55 | return $message; |
| 56 | 56 | } |
@@ -48,6 +48,9 @@ |
||
| 48 | 48 | return $value ? $this->replaceTokens($value, $params) : $message; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param string $message |
|
| 53 | + */ |
|
| 51 | 54 | private function replaceTokens($message, $params = null) |
| 52 | 55 | { |
| 53 | 56 | if (!$params) { |
@@ -21,28 +21,28 @@ |
||
| 21 | 21 | public function formatSize($number) |
| 22 | 22 | { |
| 23 | 23 | if ($number < 1024) { |
| 24 | - return $this->formatNumber($number) . ' B'; |
|
| 24 | + return $this->formatNumber($number).' B'; |
|
| 25 | 25 | } |
| 26 | 26 | if ($number < 1024 * 1024) { |
| 27 | - return $this->formatNumber($number / 1024, 1) . ' kB'; |
|
| 27 | + return $this->formatNumber($number / 1024, 1).' kB'; |
|
| 28 | 28 | } |
| 29 | 29 | if ($number < 1024 * 1024 * 1024) { |
| 30 | - return $this->formatNumber($number / 1024 / 1024, 1) . ' MB'; |
|
| 30 | + return $this->formatNumber($number / 1024 / 1024, 1).' MB'; |
|
| 31 | 31 | } |
| 32 | 32 | if ($number < 1024 * 1024 * 1024 * 1024) { |
| 33 | - return $this->formatNumber($number / 1024 / 1024 / 1024, 1) . ' GB'; |
|
| 33 | + return $this->formatNumber($number / 1024 / 1024 / 1024, 1).' GB'; |
|
| 34 | 34 | } |
| 35 | - return $this->formatNumber($number / 1024 / 1024 / 1024 / 1024, 1) . ' TB'; |
|
| 35 | + return $this->formatNumber($number / 1024 / 1024 / 1024 / 1024, 1).' TB'; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function formatTime($number) |
| 39 | 39 | { |
| 40 | 40 | if ($number < 60) { |
| 41 | - return $number . ' s'; |
|
| 41 | + return $number.' s'; |
|
| 42 | 42 | } |
| 43 | 43 | if ($number < 2600) { |
| 44 | 44 | return date('i:s', $number); |
| 45 | 45 | } |
| 46 | - return ceil($number / 3600) . date('\h i\m s\s', $number); |
|
| 46 | + return ceil($number / 3600).date('\h i\m s\s', $number); |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | $tableForm->addFieldsToForm($form); |
| 50 | 50 | $form->addSubmit('save', 'Save'); |
| 51 | 51 | $form->onSuccess[] = [$tableForm, 'submit']; |
| 52 | - $form->onSuccess[] = function () { |
|
| 52 | + $form->onSuccess[] = function() { |
|
| 53 | 53 | $this->presenter->redirect('Table:default', $this->driver->type(), $this->database); |
| 54 | 54 | }; |
| 55 | 55 | return $form; |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | public function name() |
| 36 | 36 | { |
| 37 | - return $this->type() . '.name'; |
|
| 37 | + return $this->type().'.name'; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | return $count; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $stats = $this->connection->getExtendedStats('cachedump', (int)$table); |
|
| 67 | + $stats = $this->connection->getExtendedStats('cachedump', (int) $table); |
|
| 68 | 68 | $keys = isset($stats[$this->database]) ? $stats[$this->database] : []; |
| 69 | 69 | return count($keys); |
| 70 | 70 | } |
@@ -69,29 +69,29 @@ |
||
| 69 | 69 | |
| 70 | 70 | public function submit(Form $form, ArrayHash $values) |
| 71 | 71 | { |
| 72 | - $values = (array)$values; |
|
| 73 | - $keys = array_map(function ($key) { |
|
| 74 | - return '`' . $key . '`'; |
|
| 72 | + $values = (array) $values; |
|
| 73 | + $keys = array_map(function($key) { |
|
| 74 | + return '`'.$key.'`'; |
|
| 75 | 75 | }, array_keys($values)); |
| 76 | - $vals = array_map(function ($key) { |
|
| 77 | - return ':' . $key; |
|
| 76 | + $vals = array_map(function($key) { |
|
| 77 | + return ':'.$key; |
|
| 78 | 78 | }, array_keys($values)); |
| 79 | 79 | if ($this->item) { |
| 80 | - $query = 'UPDATE `' . $this->table . '` SET '; |
|
| 80 | + $query = 'UPDATE `'.$this->table.'` SET '; |
|
| 81 | 81 | $set = []; |
| 82 | 82 | foreach ($values as $key => $value) { |
| 83 | - $set[] = '`' . $key . '` = :' . $key; |
|
| 83 | + $set[] = '`'.$key.'` = :'.$key; |
|
| 84 | 84 | } |
| 85 | 85 | $query .= implode(', ', $set); |
| 86 | 86 | $primaryColumns = $this->dataManager->getPrimaryColumns($this->type, $this->table); |
| 87 | - $query .= ' WHERE md5(concat(' . implode(', "|", ', $primaryColumns) . ')) = "' . $this->item . '"'; |
|
| 87 | + $query .= ' WHERE md5(concat('.implode(', "|", ', $primaryColumns).')) = "'.$this->item.'"'; |
|
| 88 | 88 | } else { |
| 89 | - $query = sprintf('INSERT INTO `' . $this->table . '` %s VALUES %s', '(' . implode(', ', $keys) . ')', '(' . implode(', ', $vals) . ')'); |
|
| 89 | + $query = sprintf('INSERT INTO `'.$this->table.'` %s VALUES %s', '('.implode(', ', $keys).')', '('.implode(', ', $vals).')'); |
|
| 90 | 90 | } |
| 91 | 91 | $statement = $this->pdo->prepare($query); |
| 92 | 92 | foreach ($values as $key => $value) { |
| 93 | 93 | $value = $value === '' && $this->columns[$key]['Null'] ? null : $value; |
| 94 | - $statement->bindValue(':' . $key, $value); |
|
| 94 | + $statement->bindValue(':'.$key, $value); |
|
| 95 | 95 | } |
| 96 | 96 | $ret = $statement->execute(); |
| 97 | 97 | if (!$ret) { |
@@ -47,14 +47,14 @@ |
||
| 47 | 47 | public function submit(Form $form, ArrayHash $values) |
| 48 | 48 | { |
| 49 | 49 | if ($this->database) { |
| 50 | - $query = 'ALTER DATABASE ' . $this->database; |
|
| 50 | + $query = 'ALTER DATABASE '.$this->database; |
|
| 51 | 51 | } else { |
| 52 | - $query = 'CREATE DATABASE ' . $values['name']; |
|
| 52 | + $query = 'CREATE DATABASE '.$values['name']; |
|
| 53 | 53 | } |
| 54 | 54 | if ($values['charset']) { |
| 55 | - $query .= ' CHARACTER SET ' . $values['charset']; |
|
| 55 | + $query .= ' CHARACTER SET '.$values['charset']; |
|
| 56 | 56 | if ($values['collation']) { |
| 57 | - $query .= ' COLLATE ' . $values['collation']; |
|
| 57 | + $query .= ' COLLATE '.$values['collation']; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |