@@ -58,7 +58,9 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function getRow() { |
| 60 | 60 | |
| 61 | - if (!is_object($this->result)) return null; |
|
| 61 | + if (!is_object($this->result)) { |
|
| 62 | + return null; |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | return mysqli_fetch_assoc($this->result); |
| 64 | 66 | } |
@@ -69,9 +71,13 @@ discard block |
||
| 69 | 71 | |
| 70 | 72 | public function getRows() : array { |
| 71 | 73 | |
| 72 | - if (!is_object($this->result)) return []; |
|
| 74 | + if (!is_object($this->result)) { |
|
| 75 | + return []; |
|
| 76 | + } |
|
| 73 | 77 | |
| 74 | - $rows = []; while (null !== ($row = $this->getRow())) $rows[] = $row; |
|
| 78 | + $rows = []; while (null !== ($row = $this->getRow())) { |
|
| 79 | + $rows[] = $row; |
|
| 80 | + } |
|
| 75 | 81 | |
| 76 | 82 | # ------------------------ |
| 77 | 83 | |
@@ -52,7 +52,9 @@ |
||
| 52 | 52 | |
| 53 | 53 | public function addItems(array $items) : Loop { |
| 54 | 54 | |
| 55 | - foreach ($items as $item) if (is_array($item)) $this->addItem($item); |
|
| 55 | + foreach ($items as $item) { |
|
| 56 | + if (is_array($item)) $this->addItem($item); |
|
| 57 | + } |
|
| 56 | 58 | |
| 57 | 59 | return $this; |
| 58 | 60 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | if (false === ($mime = self::get($extension))) return false; |
| 23 | 23 | |
| 24 | - return (preg_match(('/^' . $type . '\//'), $mime) ? true : false); |
|
| 24 | + return (preg_match(('/^'.$type.'\//'), $mime) ? true : false); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public static function __autoload() { |
| 32 | 32 | |
| 33 | - self::init(DIR_DATA . 'Mime.php'); |
|
| 33 | + self::init(DIR_DATA.'Mime.php'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -19,7 +19,9 @@ |
||
| 19 | 19 | |
| 20 | 20 | private static function checkType(string $extension, string $type) : bool { |
| 21 | 21 | |
| 22 | - if (false === ($mime = self::get($extension))) return false; |
|
| 22 | + if (false === ($mime = self::get($extension))) { |
|
| 23 | + return false; |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | return (preg_match(('/^' . $type . '\//'), $mime) ? true : false); |
| 25 | 27 | } |
@@ -19,7 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | private static function addPhrase(string $name, string $value) { |
| 21 | 21 | |
| 22 | - if (preg_match(REGEX_LANGUAGE_PHRASE_NAME, $name)) self::$phrases[$name] = $value; |
|
| 22 | + if (preg_match(REGEX_LANGUAGE_PHRASE_NAME, $name)) { |
|
| 23 | + self::$phrases[$name] = $value; |
|
| 24 | + } |
|
| 23 | 25 | } |
| 24 | 26 | |
| 25 | 27 | /** |
@@ -30,9 +32,13 @@ discard block |
||
| 30 | 32 | |
| 31 | 33 | public static function load(string $file_name) : bool { |
| 32 | 34 | |
| 33 | - if (!is_array($phrases = Explorer::include($file_name))) return false; |
|
| 35 | + if (!is_array($phrases = Explorer::include($file_name))) { |
|
| 36 | + return false; |
|
| 37 | + } |
|
| 34 | 38 | |
| 35 | - foreach ($phrases as $name => $value) if (is_scalar($value)) self::addPhrase($name, $value); |
|
| 39 | + foreach ($phrases as $name => $value) { |
|
| 40 | + if (is_scalar($value)) self::addPhrase($name, $value); |
|
| 41 | + } |
|
| 36 | 42 | |
| 37 | 43 | # ------------------------ |
| 38 | 44 | |
@@ -19,7 +19,9 @@ |
||
| 19 | 19 | |
| 20 | 20 | private static function output($image, string $mime, callable $outputter, array $params = []) : bool { |
| 21 | 21 | |
| 22 | - if (!is_resource($image)) return false; |
|
| 22 | + if (!is_resource($image)) { |
|
| 23 | + return false; |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | Headers::sendNoCache(); Headers::sendContent($mime); |
| 25 | 27 | |
@@ -23,34 +23,34 @@ |
||
| 23 | 23 | |
| 24 | 24 | protected function init() { |
| 25 | 25 | |
| 26 | - $this->config->addParam('active', '', function (bool $active) { |
|
| 26 | + $this->config->addParam('active', '', function(bool $active) { |
|
| 27 | 27 | |
| 28 | - return ($active ? ("ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.locked = 0") : ''); |
|
| 28 | + return ($active ? ("ent.visibility = ".VISIBILITY_PUBLISHED." AND ent.locked = 0") : ''); |
|
| 29 | 29 | }); |
| 30 | 30 | |
| 31 | - $this->config->addParam('rank', '', function (int $rank = null) { |
|
| 31 | + $this->config->addParam('rank', '', function(int $rank = null) { |
|
| 32 | 32 | |
| 33 | - return ((null !== $rank) ? ("ent.access <= " . $rank) : ''); |
|
| 33 | + return ((null !== $rank) ? ("ent.access <= ".$rank) : ''); |
|
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - $this->config->addParam('time_created >=', '', function (int $time) { |
|
| 36 | + $this->config->addParam('time_created >=', '', function(int $time) { |
|
| 37 | 37 | |
| 38 | - return ((0 < $time) ? ("ent.time_created >= " . $time) : ''); |
|
| 38 | + return ((0 < $time) ? ("ent.time_created >= ".$time) : ''); |
|
| 39 | 39 | }); |
| 40 | 40 | |
| 41 | - $this->config->addParam('time_created <=', '', function (int $time) { |
|
| 41 | + $this->config->addParam('time_created <=', '', function(int $time) { |
|
| 42 | 42 | |
| 43 | - return ((0 < $time) ? ("ent.time_created <= " . $time) : ''); |
|
| 43 | + return ((0 < $time) ? ("ent.time_created <= ".$time) : ''); |
|
| 44 | 44 | }); |
| 45 | 45 | |
| 46 | - $this->config->addParam('time_modified >=', '', function (int $time) { |
|
| 46 | + $this->config->addParam('time_modified >=', '', function(int $time) { |
|
| 47 | 47 | |
| 48 | - return ((0 < $time) ? ("ent.time_modified >= " . $time) : ''); |
|
| 48 | + return ((0 < $time) ? ("ent.time_modified >= ".$time) : ''); |
|
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | - $this->config->addParam('time_modified <=', '', function (int $time) { |
|
| 51 | + $this->config->addParam('time_modified <=', '', function(int $time) { |
|
| 52 | 52 | |
| 53 | - return ((0 < $time) ? ("ent.time_modified <= " . $time) : ''); |
|
| 53 | + return ((0 < $time) ? ("ent.time_modified <= ".$time) : ''); |
|
| 54 | 54 | }); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -23,14 +23,14 @@ |
||
| 23 | 23 | |
| 24 | 24 | # Add params |
| 25 | 25 | |
| 26 | - $this->params->addTextual ('name', true, 255, false, ''); |
|
| 27 | - $this->params->addTextual ('title', true, 255, false, ''); |
|
| 28 | - $this->params->addTextual ('value', true, 255, false, ''); |
|
| 26 | + $this->params->addTextual('name', true, 255, false, ''); |
|
| 27 | + $this->params->addTextual('title', true, 255, false, ''); |
|
| 28 | + $this->params->addTextual('value', true, 255, false, ''); |
|
| 29 | 29 | |
| 30 | 30 | # Add indexes |
| 31 | 31 | |
| 32 | - $this->indexes->add ('name', 'UNIQUE'); |
|
| 33 | - $this->indexes->add ('title'); |
|
| 32 | + $this->indexes->add('name', 'UNIQUE'); |
|
| 33 | + $this->indexes->add('title'); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -23,16 +23,16 @@ |
||
| 23 | 23 | |
| 24 | 24 | # Add params |
| 25 | 25 | |
| 26 | - $this->params->addBoolean ('active', false); |
|
| 27 | - $this->params->addTextual ('name', true, 255, false, ''); |
|
| 28 | - $this->params->addTextual ('title', true, 255, false, ''); |
|
| 29 | - $this->params->addTextual ('contents', false, 0, false, ''); |
|
| 26 | + $this->params->addBoolean('active', false); |
|
| 27 | + $this->params->addTextual('name', true, 255, false, ''); |
|
| 28 | + $this->params->addTextual('title', true, 255, false, ''); |
|
| 29 | + $this->params->addTextual('contents', false, 0, false, ''); |
|
| 30 | 30 | |
| 31 | 31 | # Add indexes |
| 32 | 32 | |
| 33 | - $this->indexes->add ('active'); |
|
| 34 | - $this->indexes->add ('name', 'UNIQUE'); |
|
| 35 | - $this->indexes->add ('title'); |
|
| 33 | + $this->indexes->add('active'); |
|
| 34 | + $this->indexes->add('name', 'UNIQUE'); |
|
| 35 | + $this->indexes->add('title'); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -23,27 +23,27 @@ |
||
| 23 | 23 | |
| 24 | 24 | # Add params |
| 25 | 25 | |
| 26 | - $this->params->addInteger ('rank', true, 1, true, RANK_GUEST); |
|
| 27 | - $this->params->addTextual ('name', true, 16, false, ''); |
|
| 28 | - $this->params->addTextual ('email', true, 128, false, ''); |
|
| 29 | - $this->params->addTextual ('auth_key', true, 40, true, ''); |
|
| 30 | - $this->params->addTextual ('password', true, 40, true, ''); |
|
| 31 | - $this->params->addTextual ('first_name', true, 255, false, ''); |
|
| 32 | - $this->params->addTextual ('last_name', true, 255, false, ''); |
|
| 33 | - $this->params->addInteger ('sex', true, 1, true, SEX_NOT_SELECTED); |
|
| 34 | - $this->params->addTextual ('city', true, 255, false, ''); |
|
| 35 | - $this->params->addTextual ('country', true, 2, false, ''); |
|
| 36 | - $this->params->addTextual ('timezone', true, 40, false, ''); |
|
| 37 | - $this->params->addInteger ('time_registered', false, 10, true, 0); |
|
| 38 | - $this->params->addInteger ('time_logged', false, 10, true, 0); |
|
| 26 | + $this->params->addInteger('rank', true, 1, true, RANK_GUEST); |
|
| 27 | + $this->params->addTextual('name', true, 16, false, ''); |
|
| 28 | + $this->params->addTextual('email', true, 128, false, ''); |
|
| 29 | + $this->params->addTextual('auth_key', true, 40, true, ''); |
|
| 30 | + $this->params->addTextual('password', true, 40, true, ''); |
|
| 31 | + $this->params->addTextual('first_name', true, 255, false, ''); |
|
| 32 | + $this->params->addTextual('last_name', true, 255, false, ''); |
|
| 33 | + $this->params->addInteger('sex', true, 1, true, SEX_NOT_SELECTED); |
|
| 34 | + $this->params->addTextual('city', true, 255, false, ''); |
|
| 35 | + $this->params->addTextual('country', true, 2, false, ''); |
|
| 36 | + $this->params->addTextual('timezone', true, 40, false, ''); |
|
| 37 | + $this->params->addInteger('time_registered', false, 10, true, 0); |
|
| 38 | + $this->params->addInteger('time_logged', false, 10, true, 0); |
|
| 39 | 39 | |
| 40 | 40 | # Add indexes |
| 41 | 41 | |
| 42 | - $this->indexes->add ('rank'); |
|
| 43 | - $this->indexes->add ('name', 'UNIQUE'); |
|
| 44 | - $this->indexes->add ('email', 'UNIQUE'); |
|
| 45 | - $this->indexes->add ('time_registered'); |
|
| 46 | - $this->indexes->add ('time_logged'); |
|
| 42 | + $this->indexes->add('rank'); |
|
| 43 | + $this->indexes->add('name', 'UNIQUE'); |
|
| 44 | + $this->indexes->add('email', 'UNIQUE'); |
|
| 45 | + $this->indexes->add('time_registered'); |
|
| 46 | + $this->indexes->add('time_logged'); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | } |