@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Controller { |
4 | 4 | |
5 | - use Modules\Entitizer, Utils\Validate; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Utils\Validate; |
|
6 | 7 | |
7 | 8 | class Variable { |
8 | 9 |
@@ -29,13 +29,19 @@ discard block |
||
29 | 29 | |
30 | 30 | # Validate name |
31 | 31 | |
32 | - if (false === ($name = Validate::templateComponentName($name))) return ['name', 'VARIABLE_ERROR_NAME_INVALID']; |
|
32 | + if (false === ($name = Validate::templateComponentName($name))) { |
|
33 | + return ['name', 'VARIABLE_ERROR_NAME_INVALID']; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Check name exists |
35 | 37 | |
36 | - if (false === ($check_name = $this->variable->check($name, 'name'))) return 'VARIABLE_ERROR_MODIFY'; |
|
38 | + if (false === ($check_name = $this->variable->check($name, 'name'))) { |
|
39 | + return 'VARIABLE_ERROR_MODIFY'; |
|
40 | + } |
|
37 | 41 | |
38 | - if ($check_name === 1) return ['name', 'VARIABLE_ERROR_NAME_DUPLICATE']; |
|
42 | + if ($check_name === 1) { |
|
43 | + return ['name', 'VARIABLE_ERROR_NAME_DUPLICATE']; |
|
44 | + } |
|
39 | 45 | |
40 | 46 | # Modify variable |
41 | 47 | |
@@ -47,7 +53,9 @@ discard block |
||
47 | 53 | |
48 | 54 | $modifier = ((0 === $this->variable->id) ? 'create' : 'edit'); |
49 | 55 | |
50 | - if (!$this->variable->$modifier($data)) return 'VARIABLE_ERROR_MODIFY'; |
|
56 | + if (!$this->variable->$modifier($data)) { |
|
57 | + return 'VARIABLE_ERROR_MODIFY'; |
|
58 | + } |
|
51 | 59 | |
52 | 60 | # ------------------------ |
53 | 61 |
@@ -2,7 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Entitizer\Controller { |
4 | 4 | |
5 | - use Modules\Entitizer, Utils\Validate; |
|
5 | + use Modules\Entitizer; |
|
6 | + use Utils\Validate; |
|
6 | 7 | |
7 | 8 | class Widget { |
8 | 9 |
@@ -29,13 +29,19 @@ discard block |
||
29 | 29 | |
30 | 30 | # Validate name |
31 | 31 | |
32 | - if (false === ($name = Validate::templateComponentName($name))) return ['name', 'WIDGET_ERROR_NAME_INVALID']; |
|
32 | + if (false === ($name = Validate::templateComponentName($name))) { |
|
33 | + return ['name', 'WIDGET_ERROR_NAME_INVALID']; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Check name exists |
35 | 37 | |
36 | - if (false === ($check_name = $this->widget->check($name, 'name'))) return 'WIDGET_ERROR_MODIFY'; |
|
38 | + if (false === ($check_name = $this->widget->check($name, 'name'))) { |
|
39 | + return 'WIDGET_ERROR_MODIFY'; |
|
40 | + } |
|
37 | 41 | |
38 | - if ($check_name === 1) return ['name', 'WIDGET_ERROR_NAME_DUPLICATE']; |
|
42 | + if ($check_name === 1) { |
|
43 | + return ['name', 'WIDGET_ERROR_NAME_DUPLICATE']; |
|
44 | + } |
|
39 | 45 | |
40 | 46 | # Modify widget |
41 | 47 | |
@@ -48,7 +54,9 @@ discard block |
||
48 | 54 | |
49 | 55 | $modifier = ((0 === $this->widget->id) ? 'create' : 'edit'); |
50 | 56 | |
51 | - if (!$this->widget->$modifier($data)) return 'WIDGET_ERROR_MODIFY'; |
|
57 | + if (!$this->widget->$modifier($data)) { |
|
58 | + return 'WIDGET_ERROR_MODIFY'; |
|
59 | + } |
|
52 | 60 | |
53 | 61 | # ------------------------ |
54 | 62 |
@@ -2,7 +2,12 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Extend\Utils\Handler { |
4 | 4 | |
5 | - use Modules\Extend, Modules\Settings, Ajax, Arr, Language, Request, Template, JSON; |
|
5 | + use Modules\Extend; |
|
6 | + use Modules\Settings; |
|
7 | + use Ajax; |
|
8 | + use Language; |
|
9 | + use Request; |
|
10 | + use Template; |
|
6 | 11 | |
7 | 12 | abstract class Basic extends Extend\Utils\Handler { |
8 | 13 |
@@ -30,13 +30,19 @@ discard block |
||
30 | 30 | |
31 | 31 | if (Request::post('action') === 'activate') { |
32 | 32 | |
33 | - if (MODE_DEMO) return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION')); |
|
33 | + if (MODE_DEMO) { |
|
34 | + return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION')); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | $param = static::$param[$this->loader->section()]; $name = Request::post('name'); |
36 | 38 | |
37 | - if (false === Settings::set($param, $name)) return $ajax->setError(Language::get(static::$error_activate)); |
|
39 | + if (false === Settings::set($param, $name)) { |
|
40 | + return $ajax->setError(Language::get(static::$error_activate)); |
|
41 | + } |
|
38 | 42 | |
39 | - if (false === Settings::save()) return $ajax->setError(Language::get(static::$error_save)); |
|
43 | + if (false === Settings::save()) { |
|
44 | + return $ajax->setError(Language::get(static::$error_save)); |
|
45 | + } |
|
40 | 46 | |
41 | 47 | } else if (Request::post('action') === 'list') { |
42 | 48 | |
@@ -54,7 +60,9 @@ discard block |
||
54 | 60 | |
55 | 61 | $this->loader = new static::$loader_class(Request::get('list')); |
56 | 62 | |
57 | - if (Request::isAjax()) return $this->handleAjax(); |
|
63 | + if (Request::isAjax()) { |
|
64 | + return $this->handleAjax(); |
|
65 | + } |
|
58 | 66 | |
59 | 67 | # ------------------------ |
60 | 68 |
@@ -2,33 +2,33 @@ |
||
2 | 2 | |
3 | 3 | # Define constants |
4 | 4 | |
5 | -define('DIR_SYSTEM', (dirname(__FILE__) . '/')); |
|
5 | +define('DIR_SYSTEM', (dirname(__FILE__).'/')); |
|
6 | 6 | |
7 | -define('DIR_SYSTEM_CLASSES', (DIR_SYSTEM . 'Classes/')); |
|
8 | -define('DIR_SYSTEM_DATA', (DIR_SYSTEM . 'Data/')); |
|
9 | -define('DIR_SYSTEM_INCLUDES', (DIR_SYSTEM . 'Includes/')); |
|
10 | -define('DIR_SYSTEM_LANGUAGES', (DIR_SYSTEM . 'Languages/')); |
|
11 | -define('DIR_SYSTEM_TEMPLATES', (DIR_SYSTEM . 'Templates/')); |
|
7 | +define('DIR_SYSTEM_CLASSES', (DIR_SYSTEM.'Classes/')); |
|
8 | +define('DIR_SYSTEM_DATA', (DIR_SYSTEM.'Data/')); |
|
9 | +define('DIR_SYSTEM_INCLUDES', (DIR_SYSTEM.'Includes/')); |
|
10 | +define('DIR_SYSTEM_LANGUAGES', (DIR_SYSTEM.'Languages/')); |
|
11 | +define('DIR_SYSTEM_TEMPLATES', (DIR_SYSTEM.'Templates/')); |
|
12 | 12 | |
13 | 13 | # Require classes |
14 | 14 | |
15 | -require_once (DIR_SYSTEM . 'Exception.php'); |
|
15 | +require_once (DIR_SYSTEM.'Exception.php'); |
|
16 | 16 | |
17 | 17 | # Require configuration |
18 | 18 | |
19 | -require_once (DIR_SYSTEM_INCLUDES . 'Config.php'); |
|
20 | -require_once (DIR_SYSTEM_INCLUDES . 'Constants.php'); |
|
21 | -require_once (DIR_SYSTEM_INCLUDES . 'Regex.php'); |
|
22 | -require_once (DIR_SYSTEM_INCLUDES . 'Tables.php'); |
|
19 | +require_once (DIR_SYSTEM_INCLUDES.'Config.php'); |
|
20 | +require_once (DIR_SYSTEM_INCLUDES.'Constants.php'); |
|
21 | +require_once (DIR_SYSTEM_INCLUDES.'Regex.php'); |
|
22 | +require_once (DIR_SYSTEM_INCLUDES.'Tables.php'); |
|
23 | 23 | |
24 | 24 | # Process environment variables |
25 | 25 | |
26 | -define('HTTP_MOD_REWRITE', (getenv('HTTP_MOD_REWRITE') === 'on')); |
|
26 | +define('HTTP_MOD_REWRITE', (getenv('HTTP_MOD_REWRITE') === 'on')); |
|
27 | 27 | |
28 | -define('INSTALL_PATH', rtrim(getenv('INSTALL_PATH'), '/')); |
|
28 | +define('INSTALL_PATH', rtrim(getenv('INSTALL_PATH'), '/')); |
|
29 | 29 | |
30 | -define('MODE_DEBUG', @file_exists(DIR_SYSTEM_DATA . '.debug')); |
|
31 | -define('MODE_DEMO', @file_exists(DIR_SYSTEM_DATA . '.demo')); |
|
30 | +define('MODE_DEBUG', @file_exists(DIR_SYSTEM_DATA.'.debug')); |
|
31 | +define('MODE_DEMO', @file_exists(DIR_SYSTEM_DATA.'.demo')); |
|
32 | 32 | |
33 | 33 | // Add here a check for a debug mode and if enabled then set an error reporting to E_ALL (previously should be set to 0). |
34 | 34 | // Till the CMS is in a beta stage an error reporting should be set to E_ALL by default. |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | # Check for demo mode |
14 | 14 | |
15 | - if (MODE_DEMO) return 'DEMO_MODE_RESTRICTION'; |
|
15 | + if (MODE_DEMO) { |
|
16 | + return 'DEMO_MODE_RESTRICTION'; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Define errors list |
18 | 20 | |
@@ -25,12 +27,16 @@ discard block |
||
25 | 27 | |
26 | 28 | foreach (Settings::setArray($post) as $name => $result) { |
27 | 29 | |
28 | - if (!$result) return (isset($errors[$name]) ? [$name, $errors[$name]] : false); |
|
30 | + if (!$result) { |
|
31 | + return (isset($errors[$name]) ? [$name, $errors[$name]] : false); |
|
32 | + } |
|
29 | 33 | } |
30 | 34 | |
31 | 35 | # Save settings |
32 | 36 | |
33 | - if (!Settings::save()) return 'SETTINGS_ERROR_SAVE'; |
|
37 | + if (!Settings::save()) { |
|
38 | + return 'SETTINGS_ERROR_SAVE'; |
|
39 | + } |
|
34 | 40 | |
35 | 41 | # ------------------------ |
36 | 42 |