@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function __toString() |
30 | 30 | { |
31 | - return $this->iso_name() . ' (' . $this->get(self::ISO_3) . ')'; |
|
31 | + return $this->iso_name().' ('.$this->get(self::ISO_3).')'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function traceable(): bool |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | if (isset($filter['types'])) { |
77 | - $wc = sprintf("AND " . self::ISO_TYPE . " IN ('%s') ", implode('\', \'', array_keys(self::ISO_TYPES))); |
|
77 | + $wc = sprintf("AND ".self::ISO_TYPE." IN ('%s') ", implode('\', \'', array_keys(self::ISO_TYPES))); |
|
78 | 78 | $Query->and_where($wc); |
79 | 79 | } |
80 | 80 | if (isset($filter['scopes'])) { |
81 | - $wc = sprintf("AND " . self::ISO_SCOPE . " IN ('%s') ", implode('\', \'', array_keys(self::ISO_SCOPES))); |
|
81 | + $wc = sprintf("AND ".self::ISO_SCOPE." IN ('%s') ", implode('\', \'', array_keys(self::ISO_SCOPES))); |
|
82 | 82 | $Query->and_where($wc); |
83 | 83 | } |
84 | 84 |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | { |
9 | 9 | |
10 | 10 | /** |
11 | - * An associative array where the key is a namespace prefix and the value |
|
12 | - * is an array of base directories for classes in that namespace. |
|
13 | - * |
|
14 | - * @var array |
|
15 | - */ |
|
11 | + * An associative array where the key is a namespace prefix and the value |
|
12 | + * is an array of base directories for classes in that namespace. |
|
13 | + * |
|
14 | + * @var array |
|
15 | + */ |
|
16 | 16 | protected $prefixes = []; |
17 | 17 | |
18 | 18 | /** |
19 | - * Register loader with SPL autoloader stack. |
|
20 | - * |
|
21 | - * @return void |
|
22 | - */ |
|
19 | + * Register loader with SPL autoloader stack. |
|
20 | + * |
|
21 | + * @return void |
|
22 | + */ |
|
23 | 23 | |
24 | 24 | public function register() |
25 | 25 | { |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | - * Adds a base directory for a namespace prefix. |
|
31 | - * |
|
32 | - * @param string $prefix The namespace prefix. |
|
33 | - * @param string $base_dir A base directory for class files in the |
|
34 | - * namespace. |
|
35 | - * @param bool $prepend If true, prepend the base directory to the stack |
|
36 | - * instead of appending it; this causes it to be searched first rather |
|
37 | - * than last. |
|
38 | - * @return void |
|
39 | - */ |
|
30 | + * Adds a base directory for a namespace prefix. |
|
31 | + * |
|
32 | + * @param string $prefix The namespace prefix. |
|
33 | + * @param string $base_dir A base directory for class files in the |
|
34 | + * namespace. |
|
35 | + * @param bool $prepend If true, prepend the base directory to the stack |
|
36 | + * instead of appending it; this causes it to be searched first rather |
|
37 | + * than last. |
|
38 | + * @return void |
|
39 | + */ |
|
40 | 40 | public function addNamespaceTree($base_dir, $prepend = false) |
41 | 41 | { |
42 | 42 | $dir_content = FileSystem::preg_scandir($base_dir, '/^[A-Z]{1}[A-Za-z]+(?!\.class.\.php)$/'); |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
75 | - * Loads the class file for a given class name. |
|
76 | - * |
|
77 | - * @param string $class The fully-qualified class name. |
|
78 | - * @return mixed The mapped file name on success, or boolean false on |
|
79 | - * failure. |
|
80 | - */ |
|
75 | + * Loads the class file for a given class name. |
|
76 | + * |
|
77 | + * @param string $class The fully-qualified class name. |
|
78 | + * @return mixed The mapped file name on success, or boolean false on |
|
79 | + * failure. |
|
80 | + */ |
|
81 | 81 | public function loadClass($class) |
82 | 82 | { |
83 | 83 | // var_dump(__FUNCTION__."($class)"); |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | - * Load the mapped file for a namespace prefix and relative class. |
|
112 | - * |
|
113 | - * @param string $prefix The namespace prefix. |
|
114 | - * @param string $relative_class The relative class name. |
|
115 | - * @return mixed Boolean false if no mapped file can be loaded, or the |
|
116 | - * name of the mapped file that was loaded. |
|
117 | - */ |
|
111 | + * Load the mapped file for a namespace prefix and relative class. |
|
112 | + * |
|
113 | + * @param string $prefix The namespace prefix. |
|
114 | + * @param string $relative_class The relative class name. |
|
115 | + * @return mixed Boolean false if no mapped file can be loaded, or the |
|
116 | + * name of the mapped file that was loaded. |
|
117 | + */ |
|
118 | 118 | protected function loadMappedFile($prefix, $relative_class) |
119 | 119 | { |
120 | 120 | // are there any base directories for this namespace prefix? |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
146 | - * If a file exists, require it from the file system. |
|
147 | - * |
|
148 | - * @param string $file The file to require. |
|
149 | - * @return bool True if the file exists, false if not. |
|
150 | - */ |
|
146 | + * If a file exists, require it from the file system. |
|
147 | + * |
|
148 | + * @param string $file The file to require. |
|
149 | + * @return bool True if the file exists, false if not. |
|
150 | + */ |
|
151 | 151 | protected function requireFile($file) |
152 | 152 | { |
153 | 153 | // var_dump(__FUNCTION__."($file)"); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $dir_content = FileSystem::preg_scandir($base_dir, '/^[A-Z]{1}[A-Za-z]+(?!\.class.\.php)$/'); |
43 | 43 | |
44 | 44 | foreach ($dir_content as $res) { |
45 | - if (is_dir($fullpath = $base_dir . '/' . $res)) { |
|
46 | - $this->addNamespace('HexMakina\kadro\\' . $res, $fullpath, $prepend); |
|
45 | + if (is_dir($fullpath = $base_dir.'/'.$res)) { |
|
46 | + $this->addNamespace('HexMakina\kadro\\'.$res, $fullpath, $prepend); |
|
47 | 47 | $this->addNamespaceTree($fullpath); |
48 | 48 | } |
49 | 49 | } |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | { |
54 | 54 | |
55 | 55 | // normalize namespace prefix |
56 | - $prefix = trim($prefix, '\\') . '\\'; |
|
56 | + $prefix = trim($prefix, '\\').'\\'; |
|
57 | 57 | |
58 | 58 | // normalize the base directory with a trailing separator |
59 | - $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/'; |
|
59 | + $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/'; |
|
60 | 60 | |
61 | 61 | // initialize the namespace prefix array |
62 | 62 | if (isset($this->prefixes[$prefix]) === false) { |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | // class name to find a mapped file name |
89 | 89 | while (false !== $pos = strrpos($prefix, '\\')) { |
90 | 90 | // retain the trailing namespace separator in the prefix |
91 | - $prefix = substr($class, 0, $pos + 1); |
|
91 | + $prefix = substr($class, 0, $pos+1); |
|
92 | 92 | // var_dump("prefix: $prefix"); |
93 | 93 | // the rest is the relative class name |
94 | - $relative_class = substr($class, $pos + 1); |
|
94 | + $relative_class = substr($class, $pos+1); |
|
95 | 95 | // try to load a mapped file for the prefix and relative class |
96 | 96 | |
97 | 97 | $mapped_file = $this->loadMappedFile($prefix, $relative_class); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | interface DisplayControllerInterface extends BaseControllerInterface |
6 | 6 | { |
7 | 7 | |
8 | - /* |
|
8 | + /* |
|
9 | 9 | The viewport is an associative array of values to be exported as variables in the view |
10 | 10 | the assoc keys will be the variable names |
11 | 11 |
@@ -58,15 +58,15 @@ |
||
58 | 58 | |
59 | 59 | private function trim_request_data() |
60 | 60 | { |
61 | - array_walk_recursive($_GET, function (&$value) { |
|
61 | + array_walk_recursive($_GET, function(&$value) { |
|
62 | 62 | $value = trim($value); |
63 | 63 | }); |
64 | - array_walk_recursive($_REQUEST, function (&$value) { |
|
64 | + array_walk_recursive($_REQUEST, function(&$value) { |
|
65 | 65 | $value = trim($value); |
66 | 66 | }); |
67 | 67 | |
68 | 68 | if ($this->router()->submits()) { |
69 | - array_walk_recursive($_POST, function (&$value) { |
|
69 | + array_walk_recursive($_POST, function(&$value) { |
|
70 | 70 | $value = trim($value); |
71 | 71 | }); |
72 | 72 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | public function event_label() |
24 | 24 | { |
25 | - return '' . $this; |
|
25 | + return ''.$this; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public static function today($format = Dato::FORMAT) |
@@ -49,12 +49,12 @@ |
||
49 | 49 | |
50 | 50 | public static function enhance_query_retrieve($Query, $filters, $options) |
51 | 51 | { |
52 | - $Query->auto_join([ACL::table(),'ACL'], null, 'LEFT OUTER'); |
|
52 | + $Query->auto_join([ACL::table(), 'ACL'], null, 'LEFT OUTER'); |
|
53 | 53 | $permission_alias = $Query->auto_join([Permission::table(), 'permission'], null, 'LEFT OUTER'); |
54 | 54 | |
55 | 55 | $permission_ids_and_names = []; |
56 | - $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'id', $permission_alias . '_ids'); |
|
57 | - $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'name', $permission_alias . '_names'); |
|
56 | + $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'id', $permission_alias.'_ids'); |
|
57 | + $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $permission_alias, 'name', $permission_alias.'_names'); |
|
58 | 58 | $Query->select_also($permission_ids_and_names); |
59 | 59 | |
60 | 60 | $Query->select_also(['operator.name as operator_name', 'operator.active as operator_active']); |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | $file_name = self::$box->get('settings.locale.file_name'); |
41 | 41 | $fallback_lang = self::$box->get('settings.locale.fallback_lang'); |
42 | 42 | |
43 | - $lezer = new Lezer($locale_path . '/' . $file_name, $locale_path . '/cache', $fallback_lang); |
|
43 | + $lezer = new Lezer($locale_path.'/'.$file_name, $locale_path.'/cache', $fallback_lang); |
|
44 | 44 | $language = $lezer->availableLanguage(); |
45 | 45 | $lezer->init(); |
46 | 46 | |
47 | 47 | self::$box->get('template_engine')->assign('lezer', $lezer); |
48 | 48 | self::$box->get('template_engine')->assign('language', $language); |
49 | 49 | |
50 | - setcookie('lang', $language, time() + (365 * 24 * 60 * 60), "/", ""); |
|
50 | + setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", ""); |
|
51 | 51 | |
52 | 52 | return self::$box; |
53 | 53 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $setting = 'settings.default.charset'; |
129 | 129 | if (is_string(self::$box->get($setting))) { |
130 | 130 | ini_set('default_charset', self::$box->get($setting)); |
131 | - header('Content-type: text/html; charset=' . strtolower(self::$box->get($setting))); |
|
131 | + header('Content-type: text/html; charset='.strtolower(self::$box->get($setting))); |
|
132 | 132 | } else { |
133 | 133 | throw new \UnexpectedValueException($setting); |
134 | 134 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | // ---- parametroj:linguo |
137 | 137 | $setting = 'settings.default.language'; |
138 | 138 | if (is_string(self::$box->get($setting))) { |
139 | - putenv('LANG=' . self::$box->get($setting)); |
|
139 | + putenv('LANG='.self::$box->get($setting)); |
|
140 | 140 | setlocale(LC_ALL, self::$box->get($setting)); |
141 | 141 | } else { |
142 | 142 | throw new \UnexpectedValueException($setting); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | foreach (self::$box->get('settings.smarty.template_extra_directories') as $i => $template_dir) { |
163 | 163 | $smarty->addTemplateDir($template_dir); |
164 | 164 | } |
165 | - $smarty->addTemplateDir(__DIR__ . '/Views/'); //kadro templates |
|
165 | + $smarty->addTemplateDir(__DIR__.'/Views/'); //kadro templates |
|
166 | 166 | |
167 | 167 | $setting = 'settings.smarty.compiled_path'; |
168 | 168 | if (is_string(self::$box->get($setting))) { |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | $this->viewport('file_root', $this->router()->file_root()); |
53 | - $this->viewport('view_path', $this->router()->file_root() . $this->get('settings.smarty.template_path') . 'app/'); |
|
53 | + $this->viewport('view_path', $this->router()->file_root().$this->get('settings.smarty.template_path').'app/'); |
|
54 | 54 | $this->viewport('web_root', $this->router()->web_root()); |
55 | - $this->viewport('view_url', $this->router()->web_root() . $this->get('settings.smarty.template_path')); |
|
56 | - $this->viewport('images_url', $this->router()->web_root() . $this->get('settings.smarty.template_path') . 'images/'); |
|
55 | + $this->viewport('view_url', $this->router()->web_root().$this->get('settings.smarty.template_path')); |
|
56 | + $this->viewport('images_url', $this->router()->web_root().$this->get('settings.smarty.template_path').'images/'); |
|
57 | 57 | |
58 | 58 | foreach ($this->viewport() as $template_var_name => $value) { |
59 | 59 | $smarty->assign($template_var_name, $value); |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | // 1. check for custom template in the current controller directory |
84 | 84 | $templates ['custom_3'] = sprintf('%s/%s.html', $controller_template_path, $custom_template); |
85 | 85 | // 2. check for custom template formatted as controller/view |
86 | - $templates ['custom_2'] = $custom_template . '.html'; |
|
87 | - $templates ['custom_1'] = '_layouts/' . $custom_template . '.html'; |
|
86 | + $templates ['custom_2'] = $custom_template.'.html'; |
|
87 | + $templates ['custom_1'] = '_layouts/'.$custom_template.'.html'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | if (!empty($this->router()->target_method())) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $ret = $this->modelType(); |
58 | 58 | |
59 | 59 | if (!is_null($suffix)) { |
60 | - $ret .= '_' . $suffix; |
|
60 | + $ret .= '_'.$suffix; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $ret; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | if (is_null($this->model_class_name)) { |
109 | 109 | preg_match(LeMarchand::RX_CLASS_NAME, get_called_class(), $m); |
110 | - $this->model_class_name = $this->get($m[1] . 'Class'); |
|
110 | + $this->model_class_name = $this->get($m[1].'Class'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $this->model_class_name; |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | $this->viewport('listing_fields', $listing_fields); |
176 | 176 | $this->viewport('listing_template', $listing_template); |
177 | 177 | |
178 | - $this->viewport('route_new', $this->router()->prehop($class_name::model_type() . '_new')); |
|
179 | - $this->viewport('route_export', $this->router()->prehop($class_name::model_type() . '_export')); |
|
178 | + $this->viewport('route_new', $this->router()->prehop($class_name::model_type().'_new')); |
|
179 | + $this->viewport('route_export', $this->router()->prehop($class_name::model_type().'_export')); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | public function copy() |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | { |
208 | 208 | $this->errors = $model->save($this->operator()->operator_id()); // returns [errors] |
209 | 209 | if (empty($this->errors())) { |
210 | - $this->logger()->nice($this->l('CRUDITES_INSTANCE_ALTERED', [$this->l('MODEL_' . get_class($model)::model_type() . '_INSTANCE')])); |
|
210 | + $this->logger()->nice($this->l('CRUDITES_INSTANCE_ALTERED', [$this->l('MODEL_'.get_class($model)::model_type().'_INSTANCE')])); |
|
211 | 211 | return $model; |
212 | 212 | } |
213 | 213 | foreach ($this->errors() as $field => $error_msg) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | public function before_edit() |
221 | 221 | { |
222 | 222 | if (!is_null($this->router()->params('id')) && is_null($this->load_model)) { |
223 | - $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->modelClassName()::model_type() . '_INSTANCE')])); |
|
223 | + $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->modelClassName()::model_type().'_INSTANCE')])); |
|
224 | 224 | $this->router()->hop($this->modelClassName()::model_type()); |
225 | 225 | } |
226 | 226 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | public function destroy_confirm() |
240 | 240 | { |
241 | 241 | if (is_null($this->load_model)) { |
242 | - $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')])); |
|
242 | + $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')])); |
|
243 | 243 | $this->router()->hop($this->model_type); |
244 | 244 | } |
245 | 245 | |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | public function before_destroy() // default: checks for load_model and immortality, hops back to object on failure |
252 | 252 | { |
253 | 253 | if (is_null($this->load_model)) { |
254 | - $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')])); |
|
254 | + $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_NOT_FOUND', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')])); |
|
255 | 255 | $this->router()->hop($this->model_type); |
256 | 256 | } elseif ($this->load_model->immortal()) { |
257 | - $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')])); |
|
257 | + $this->logger()->warning($this->l('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')])); |
|
258 | 258 | $this->router()->hop($this->route_model($this->load_model)); |
259 | 259 | } |
260 | 260 | } |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | } |
267 | 267 | |
268 | 268 | if ($this->load_model->destroy($this->operator()->operator_id()) === false) { |
269 | - $this->logger()->info($this->l('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', ['' . $this->load_model])); |
|
269 | + $this->logger()->info($this->l('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', [''.$this->load_model])); |
|
270 | 270 | $this->route_back($this->load_model); |
271 | 271 | } else { |
272 | - $this->logger()->nice($this->l('CRUDITES_INSTANCE_DESTROYED', [$this->l('MODEL_' . $this->model_type . '_INSTANCE')])); |
|
272 | + $this->logger()->nice($this->l('CRUDITES_INSTANCE_DESTROYED', [$this->l('MODEL_'.$this->model_type.'_INSTANCE')])); |
|
273 | 273 | $this->route_back($this->model_type); |
274 | 274 | } |
275 | 275 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | public function collection_to_csv($collection, $filename) |
294 | 294 | { |
295 | 295 | // TODO use Format/File/CSV class to generate file |
296 | - $file_path = $this->get('settings.export.directory') . $filename . '.csv'; |
|
296 | + $file_path = $this->get('settings.export.directory').$filename.'.csv'; |
|
297 | 297 | $fp = fopen($file_path, 'w'); |
298 | 298 | |
299 | 299 | $header = false; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | public function route_new(ModelInterface $model): string |
332 | 332 | { |
333 | - return $this->router()->prehop(get_class($model)::model_type() . '_new'); |
|
333 | + return $this->router()->prehop(get_class($model)::model_type().'_new'); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | public function route_list(ModelInterface $model): string |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | { |
343 | 343 | $route_params = []; |
344 | 344 | |
345 | - $route_name = get_class($model)::model_type() . '_'; |
|
345 | + $route_name = get_class($model)::model_type().'_'; |
|
346 | 346 | if ($model->is_new()) { |
347 | 347 | $route_name .= 'new'; |
348 | 348 | } else { |