@@ -31,9 +31,9 @@ |
||
| 31 | 31 | |
| 32 | 32 | if (preg_match(REGEX_FORM_FIELD_KEY, $key)) { |
| 33 | 33 | |
| 34 | - $prefix = (('' !== $this->form->getName()) ? ($this->form->getName() . '_') : ''); |
|
| 34 | + $prefix = (('' !== $this->form->getName()) ? ($this->form->getName().'_') : ''); |
|
| 35 | 35 | |
| 36 | - $this->key = $key; $this->name = ($prefix . $key); $this->id = str_replace('_', '-', $this->name); |
|
| 36 | + $this->key = $key; $this->name = ($prefix.$key); $this->id = str_replace('_', '-', $this->name); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | # Set configuration |
@@ -57,11 +57,17 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | # Set appearance |
| 59 | 59 | |
| 60 | - if ($this->disabled) $data['disabled'] = 'disabled'; |
|
| 60 | + if ($this->disabled) { |
|
| 61 | + $data['disabled'] = 'disabled'; |
|
| 62 | + } |
|
| 61 | 63 | |
| 62 | - if ($this->required) $data['data-required'] = 'required'; |
|
| 64 | + if ($this->required) { |
|
| 65 | + $data['data-required'] = 'required'; |
|
| 66 | + } |
|
| 63 | 67 | |
| 64 | - if ($this->error) $data['data-error'] = 'error'; |
|
| 68 | + if ($this->error) { |
|
| 69 | + $data['data-error'] = 'error'; |
|
| 70 | + } |
|
| 65 | 71 | |
| 66 | 72 | # ------------------------ |
| 67 | 73 | |
@@ -76,7 +82,9 @@ discard block |
||
| 76 | 82 | |
| 77 | 83 | public function post() : bool { |
| 78 | 84 | |
| 79 | - if ($this->posted || $this->disabled || ('' === $this->key)) return false; |
|
| 85 | + if ($this->posted || $this->disabled || ('' === $this->key)) { |
|
| 86 | + return false; |
|
| 87 | + } |
|
| 80 | 88 | |
| 81 | 89 | $this->error = (!$this->setValue(Request::post($this->name)) && $this->required); |
| 82 | 90 | |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public static function load(string $file_name) { |
| 43 | 43 | |
| 44 | - if (false === ($contents = Explorer::getContents($file_name))) return null; |
|
| 44 | + if (false === ($contents = Explorer::getContents($file_name))) { |
|
| 45 | + return null; |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | return self::parse($contents); |
| 47 | 49 | } |
@@ -54,7 +56,9 @@ discard block |
||
| 54 | 56 | |
| 55 | 57 | public static function save(string $file_name, $value) { |
| 56 | 58 | |
| 57 | - if (false === ($value = self::stringify($value))) return false; |
|
| 59 | + if (false === ($value = self::stringify($value))) { |
|
| 60 | + return false; |
|
| 61 | + } |
|
| 58 | 62 | |
| 59 | 63 | return Explorer::putContents($file_name, $value); |
| 60 | 64 | } |
@@ -2,16 +2,16 @@ |
||
| 2 | 2 | |
| 3 | 3 | # Regular expressions |
| 4 | 4 | |
| 5 | -define('REGEX_MAP_ITEM_PATH', '/^[a-zA-Z0-9_\-\+\.\,\'\*\(\)\[\]:;!$%~]+$/'); |
|
| 6 | -define('REGEX_MAP_ITEM_HANDLER', '/^[A-Z][a-zA-Z0-9]*$/'); |
|
| 5 | +define('REGEX_MAP_ITEM_PATH', '/^[a-zA-Z0-9_\-\+\.\,\'\*\(\)\[\]:;!$%~]+$/'); |
|
| 6 | +define('REGEX_MAP_ITEM_HANDLER', '/^[A-Z][a-zA-Z0-9]*$/'); |
|
| 7 | 7 | |
| 8 | -define('REGEX_ADDON_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/'); |
|
| 9 | -define('REGEX_LANGUAGE_NAME', '/^[a-z][a-z]-[A-Z][A-Z]$/'); |
|
| 10 | -define('REGEX_TEMPLATE_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/'); |
|
| 8 | +define('REGEX_ADDON_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/'); |
|
| 9 | +define('REGEX_LANGUAGE_NAME', '/^[a-z][a-z]-[A-Z][A-Z]$/'); |
|
| 10 | +define('REGEX_TEMPLATE_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/'); |
|
| 11 | 11 | |
| 12 | -define('REGEX_USER_AUTH_CODE', '/^[a-zA-Z0-9]{40}$/'); |
|
| 12 | +define('REGEX_USER_AUTH_CODE', '/^[a-zA-Z0-9]{40}$/'); |
|
| 13 | 13 | |
| 14 | -define('REGEX_USER_NAME', '/^(?!_)(?!.*_$)(?!.*_{2,})[a-zA-Z0-9_]+$/'); |
|
| 15 | -define('REGEX_USER_PASSWORD', '/^.+$/'); |
|
| 14 | +define('REGEX_USER_NAME', '/^(?!_)(?!.*_$)(?!.*_{2,})[a-zA-Z0-9_]+$/'); |
|
| 15 | +define('REGEX_USER_PASSWORD', '/^.+$/'); |
|
| 16 | 16 | |
| 17 | -define('REGEX_FILE_NAME', '/^[^\/?%*:|"<>\\\]+$/'); |
|
| 17 | +define('REGEX_FILE_NAME', '/^[^\/?%*:|"<>\\\]+$/'); |
|
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | # Handle form |
| 37 | 37 | |
| 38 | - if ($this->form->handle(new Controller)) Request::redirect(INSTALL_PATH . '/contact?submitted'); |
|
| 38 | + if ($this->form->handle(new Controller)) Request::redirect(INSTALL_PATH.'/contact?submitted'); |
|
| 39 | 39 | |
| 40 | 40 | # Display success message |
| 41 | 41 | |
@@ -35,11 +35,15 @@ |
||
| 35 | 35 | |
| 36 | 36 | # Handle form |
| 37 | 37 | |
| 38 | - if ($this->form->handle(new Controller)) Request::redirect(INSTALL_PATH . '/contact?submitted'); |
|
| 38 | + if ($this->form->handle(new Controller)) { |
|
| 39 | + Request::redirect(INSTALL_PATH . '/contact?submitted'); |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | # Display success message |
| 41 | 43 | |
| 42 | - if (false !== Request::get('submitted')) Messages::set('success', Language::get('CONTACT_SUCCESS_SEND')); |
|
| 44 | + if (false !== Request::get('submitted')) { |
|
| 45 | + Messages::set('success', Language::get('CONTACT_SUCCESS_SEND')); |
|
| 46 | + } |
|
| 43 | 47 | |
| 44 | 48 | # ------------------------ |
| 45 | 49 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | # Send mail |
| 28 | 28 | |
| 29 | - $to = Settings::get('system_email'); $subject = (Settings::get('site_title') . ' | Contact form message'); |
|
| 29 | + $to = Settings::get('system_email'); $subject = (Settings::get('site_title').' | Contact form message'); |
|
| 30 | 30 | |
| 31 | 31 | if (!Mailer::send($to, $name, $email, $email, $subject, $message)) return 'CONTACT_ERROR_SEND'; |
| 32 | 32 | |
@@ -20,15 +20,21 @@ |
||
| 20 | 20 | |
| 21 | 21 | # Validate values |
| 22 | 22 | |
| 23 | - if (false === ($email = Validate::userEmail($email))) return ['email', 'CONTACT_ERROR_EMAIL_INVALID']; |
|
| 23 | + if (false === ($email = Validate::userEmail($email))) { |
|
| 24 | + return ['email', 'CONTACT_ERROR_EMAIL_INVALID']; |
|
| 25 | + } |
|
| 24 | 26 | |
| 25 | - if (false === Security::checkCaptcha($captcha)) return ['captcha', 'CONTACT_ERROR_CAPTCHA_INCORRECT']; |
|
| 27 | + if (false === Security::checkCaptcha($captcha)) { |
|
| 28 | + return ['captcha', 'CONTACT_ERROR_CAPTCHA_INCORRECT']; |
|
| 29 | + } |
|
| 26 | 30 | |
| 27 | 31 | # Send mail |
| 28 | 32 | |
| 29 | 33 | $to = Settings::get('system_email'); $subject = (Settings::get('site_title') . ' | Contact form message'); |
| 30 | 34 | |
| 31 | - if (!Mailer::send($to, $name, $email, $email, $subject, $message)) return 'CONTACT_ERROR_SEND'; |
|
| 35 | + if (!Mailer::send($to, $name, $email, $email, $subject, $message)) { |
|
| 36 | + return 'CONTACT_ERROR_SEND'; |
|
| 37 | + } |
|
| 32 | 38 | |
| 33 | 39 | # ------------------------ |
| 34 | 40 | |
@@ -12,7 +12,9 @@ |
||
| 12 | 12 | |
| 13 | 13 | $class_name = ('Schemas\\' . $name); |
| 14 | 14 | |
| 15 | - if (!isset(self::$cache[$class_name])) self::$cache[$class_name] = new $class_name; |
|
| 15 | + if (!isset(self::$cache[$class_name])) { |
|
| 16 | + self::$cache[$class_name] = new $class_name; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | # ------------------------ |
| 18 | 20 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | public static function get(string $name) : Schema\_Object { |
| 21 | 21 | |
| 22 | - $class_name = ('Schemas\\' . $name); |
|
| 22 | + $class_name = ('Schemas\\'.$name); |
|
| 23 | 23 | |
| 24 | 24 | if (!isset(self::$cache[$class_name])) self::$cache[$class_name] = new $class_name; |
| 25 | 25 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | |
| 59 | 59 | list ($extremum, $index) = $data; $block = $pagination->getBlock($class); |
| 60 | 60 | |
| 61 | - if ($active === $extremum) { $block->disable(); $pagination->getBlock($class . '_disabled')->enable(); } |
|
| 61 | + if ($active === $extremum) { $block->disable(); $pagination->getBlock($class.'_disabled')->enable(); } |
|
| 62 | 62 | |
| 63 | 63 | else $block->link = $url->setAttribute('index', $index)->getString(); |
| 64 | 64 | } |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | for ($index = ($active - 2); $index <= ($active + 2); $index++) { |
| 25 | 25 | |
| 26 | - if (!($index > 0 && $index <= $count)) continue; |
|
| 26 | + if (!($index > 0 && $index <= $count)) { |
|
| 27 | + continue; |
|
| 28 | + } |
|
| 27 | 29 | |
| 28 | 30 | $class = (($index === $active) ? 'active item' : 'item'); |
| 29 | 31 | |
@@ -52,7 +54,9 @@ discard block |
||
| 52 | 54 | |
| 53 | 55 | $block->link = $url->setAttribute('index', $index)->getString(); $block->index = $index; |
| 54 | 56 | |
| 55 | - if ($closest) $block->getBlock('ellipsis')->disable(); |
|
| 57 | + if ($closest) { |
|
| 58 | + $block->getBlock('ellipsis')->disable(); |
|
| 59 | + } |
|
| 56 | 60 | } |
| 57 | 61 | } |
| 58 | 62 | |
@@ -71,9 +75,9 @@ discard block |
||
| 71 | 75 | |
| 72 | 76 | list ($extremum, $index) = $data; $block = $pagination->getBlock($class); |
| 73 | 77 | |
| 74 | - if ($active === $extremum) { $block->disable(); $pagination->getBlock($class . '_disabled')->enable(); } |
|
| 75 | - |
|
| 76 | - else $block->link = $url->setAttribute('index', $index)->getString(); |
|
| 78 | + if ($active === $extremum) { $block->disable(); $pagination->getBlock($class . '_disabled')->enable(); } else { |
|
| 79 | + $block->link = $url->setAttribute('index', $index)->getString(); |
|
| 80 | + } |
|
| 77 | 81 | } |
| 78 | 82 | } |
| 79 | 83 | |
@@ -90,9 +94,13 @@ discard block |
||
| 90 | 94 | |
| 91 | 95 | public static function getBlock(int $index, int $display, int $total, Url $url) { |
| 92 | 96 | |
| 93 | - if (($index <= 0) || ($display <= 0) || ($total <= 0)) return false; |
|
| 97 | + if (($index <= 0) || ($display <= 0) || ($total <= 0)) { |
|
| 98 | + return false; |
|
| 99 | + } |
|
| 94 | 100 | |
| 95 | - if (($display >= $total) || ($index > ($count = ceil($total / $display)))) return false; |
|
| 101 | + if (($display >= $total) || ($index > ($count = ceil($total / $display)))) { |
|
| 102 | + return false; |
|
| 103 | + } |
|
| 96 | 104 | |
| 97 | 105 | # Create block |
| 98 | 106 | |
@@ -8,13 +8,17 @@ |
||
| 8 | 8 | |
| 9 | 9 | public function validate($data) { |
| 10 | 10 | |
| 11 | - if (!is_array($data)) return null; |
|
| 11 | + if (!is_array($data)) { |
|
| 12 | + return null; |
|
| 13 | + } |
|
| 12 | 14 | |
| 13 | 15 | $result = []; |
| 14 | 16 | |
| 15 | 17 | foreach ($data as $item) { |
| 16 | 18 | |
| 17 | - if (!is_array($item) || (null === ($item = parent::validate($item)))) return null; |
|
| 19 | + if (!is_array($item) || (null === ($item = parent::validate($item)))) { |
|
| 20 | + return null; |
|
| 21 | + } |
|
| 18 | 22 | |
| 19 | 23 | $result[] = $item; |
| 20 | 24 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | protected static $loader_class = 'Modules\Extend\Loader\Addons'; |
| 12 | 12 | |
| 13 | - protected static $root_dir = (DIR_SYSTEM_CLASSES . 'Addons/'); |
|
| 13 | + protected static $root_dir = (DIR_SYSTEM_CLASSES.'Addons/'); |
|
| 14 | 14 | |
| 15 | 15 | protected static $schema_prototype = 'Prototype\Addon', $schema = 'Addons', $regex_name = REGEX_ADDON_NAME; |
| 16 | 16 | |