@@ -190,15 +190,15 @@ discard block |
||
190 | 190 | $newValue = ''; |
191 | 191 | foreach ($value as $item) { |
192 | 192 | if ($newValue) { |
193 | - $newValue.=','; |
|
193 | + $newValue .= ','; |
|
194 | 194 | } |
195 | 195 | if (is_string($item)) { |
196 | - $newValue .='"' . $item . '"'; |
|
196 | + $newValue .= '"'.$item.'"'; |
|
197 | 197 | } else { |
198 | - $newValue .=$item; |
|
198 | + $newValue .= $item; |
|
199 | 199 | } |
200 | 200 | } |
201 | - $value = '(' . $newValue . ')'; |
|
201 | + $value = '('.$newValue.')'; |
|
202 | 202 | } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) |
203 | 203 | $value = "({$value})"; |
204 | 204 | elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | |
263 | 263 | switch ($this->operation) { |
264 | 264 | case 'SELECT': |
265 | - $query .= ' ' . ($this->distinct ? 'DISTINCT' : ''); |
|
266 | - $query .= ' ' . (!$this->cols ? '*' : ((is_array($this->cols) ? implode(',', $this->cols) : $this->cols))); |
|
265 | + $query .= ' '.($this->distinct ? 'DISTINCT' : ''); |
|
266 | + $query .= ' '.(!$this->cols ? '*' : ((is_array($this->cols) ? implode(',', $this->cols) : $this->cols))); |
|
267 | 267 | case 'DELETE': |
268 | 268 | $query .= ' FROM'; |
269 | 269 | break; |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | $this->params = array_merge($this->params, array_values($this->cols)); |
281 | 281 | $colsStr = ''; |
282 | 282 | if ($this->cols) { |
283 | - $colsStr = '`' . implode('`,`', array_keys($this->cols)) . '`'; |
|
283 | + $colsStr = '`'.implode('`,`', array_keys($this->cols)).'`'; |
|
284 | 284 | } |
285 | - $query .= ' (' . $colsStr . ') VALUES (' . rtrim(str_repeat('?,', count($this->cols)), ',') . ')'; |
|
285 | + $query .= ' ('.$colsStr.') VALUES ('.rtrim(str_repeat('?,', count($this->cols)), ',').')'; |
|
286 | 286 | break; |
287 | 287 | case 'CREATE TABLE': |
288 | 288 | $query .= " ("; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | $query = rtrim($query, ','); |
296 | 296 | if ($this->indexes) { |
297 | - $query .= ', ' . implode(',', $this->indexes); |
|
297 | + $query .= ', '.implode(',', $this->indexes); |
|
298 | 298 | } |
299 | 299 | $query .= ") ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci"; |
300 | 300 | break; |
@@ -309,23 +309,23 @@ discard block |
||
309 | 309 | } |
310 | 310 | } |
311 | 311 | $update = implode(',', $updates); |
312 | - $query .=" SET {$update}"; |
|
312 | + $query .= " SET {$update}"; |
|
313 | 313 | case 'SELECT': |
314 | 314 | case 'DELETE': |
315 | 315 | $this->buildWhere($this->where); |
316 | 316 | if ($this->whereString) { |
317 | - $query .= ' ' . $this->whereString; |
|
317 | + $query .= ' '.$this->whereString; |
|
318 | 318 | } |
319 | 319 | break; |
320 | 320 | } |
321 | 321 | if ($this->group) { |
322 | - $query .= ' GROUP BY ' . implode(',', $this->group); |
|
322 | + $query .= ' GROUP BY '.implode(',', $this->group); |
|
323 | 323 | } |
324 | 324 | if ($this->order) { |
325 | - $query .= ' ORDER BY ' . implode(',', $this->order); |
|
325 | + $query .= ' ORDER BY '.implode(',', $this->order); |
|
326 | 326 | } |
327 | 327 | if ($this->limit) { |
328 | - $query .= ' ' . $this->limit; |
|
328 | + $query .= ' '.$this->limit; |
|
329 | 329 | } |
330 | 330 | return ['query' => $query, 'params' => $this->params]; |
331 | 331 | } |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | } else { |
24 | 24 | $db = $param; |
25 | 25 | } |
26 | - $className = 'Db\\' . $db['driver']; |
|
26 | + $className = 'Db\\'.$db['driver']; |
|
27 | 27 | $this->connection = new $className(); |
28 | 28 | $this->connection->init($db); |
29 | 29 | $this->connection->dbInstance = $this; |
30 | 30 | $this->connect = $this->connection->connect; |
31 | 31 | $this->dbConfig = $db; |
32 | 32 | |
33 | - $this->className = 'Db\\' . $this->dbConfig['driver']; |
|
34 | - $this->QueryClassName = 'Db\\' . $this->dbConfig['driver'] . '\\Query'; |
|
35 | - $this->ResultClassName = 'Db\\' . $this->dbConfig['driver'] . '\\Result'; |
|
33 | + $this->className = 'Db\\'.$this->dbConfig['driver']; |
|
34 | + $this->QueryClassName = 'Db\\'.$this->dbConfig['driver'].'\\Query'; |
|
35 | + $this->ResultClassName = 'Db\\'.$this->dbConfig['driver'].'\\Result'; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function __call($name, $params) |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function newQuery() |
57 | 57 | { |
58 | - if($this->QueryClassName) { |
|
58 | + if ($this->QueryClassName) { |
|
59 | 59 | return new $this->QueryClassName($this->connection); |
60 | 60 | } |
61 | 61 | return false; |
@@ -102,10 +102,10 @@ |
||
102 | 102 | if ($treePath) { |
103 | 103 | $categorys = Category::getList(['where' => ['id', implode(',', $treePath), 'IN']]); |
104 | 104 | foreach ($categorys as $category) { |
105 | - $href .="/{$category->alias}"; |
|
105 | + $href .= "/{$category->alias}"; |
|
106 | 106 | } |
107 | 107 | } |
108 | - return $href . "/" . ($this->alias ? $this->alias : $this->pk()); |
|
108 | + return $href."/".($this->alias ? $this->alias : $this->pk()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | public static function relations() |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | } else { |
98 | 98 | $this->view->setTitle($category->name); |
99 | 99 | |
100 | - $pages = new Ui\Pages($_GET, ['count' => Materials\Material::getCount(['where' => ['tree_path', $category->tree_path . $category->id . '/%', 'LIKE']]), 'limit' => 10]); |
|
101 | - $materials = Materials\Material::getList(['where' => ['tree_path', $category->tree_path . $category->id . '/%', 'LIKE'], 'order' => ['date_create', 'desc'], 'start' => $pages->params['start'], 'limit' => $pages->params['limit']]); |
|
100 | + $pages = new Ui\Pages($_GET, ['count' => Materials\Material::getCount(['where' => ['tree_path', $category->tree_path.$category->id.'/%', 'LIKE']]), 'limit' => 10]); |
|
101 | + $materials = Materials\Material::getList(['where' => ['tree_path', $category->tree_path.$category->id.'/%', 'LIKE'], 'order' => ['date_create', 'desc'], 'start' => $pages->params['start'], 'limit' => $pages->params['limit']]); |
|
102 | 102 | |
103 | 103 | $this->view->page(['page' => $category->resolveTemplate(), 'content' => $category->resolveViewer(), 'data' => compact('materials', 'pages', 'category')]); |
104 | 104 | } |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | $this->view->addMetaTag(['name' => 'description', 'content' => $material->description]); |
133 | 133 | } |
134 | 134 | $this->view->addMetaTag(['property' => 'og:title', 'content' => $material->name]); |
135 | - $this->view->addMetaTag(['property' => 'og:url', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/' . $material->alias]); |
|
135 | + $this->view->addMetaTag(['property' => 'og:url', 'content' => 'http://'.idn_to_utf8(INJI_DOMAIN_NAME).'/'.$material->alias]); |
|
136 | 136 | if ($material->description) { |
137 | - $this->view->addMetaTag(['property' => 'og:description', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/' . $material->description]); |
|
137 | + $this->view->addMetaTag(['property' => 'og:description', 'content' => 'http://'.idn_to_utf8(INJI_DOMAIN_NAME).'/'.$material->description]); |
|
138 | 138 | } |
139 | 139 | if ($material->image) { |
140 | - $this->view->addMetaTag(['property' => 'og:image', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . $material->image->path]); |
|
140 | + $this->view->addMetaTag(['property' => 'og:image', 'content' => 'http://'.idn_to_utf8(INJI_DOMAIN_NAME).$material->image->path]); |
|
141 | 141 | } elseif ($logo = Files\File::get('site_logo', 'code')) { |
142 | - $this->view->addMetaTag(['property' => 'og:image', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . $logo->path]); |
|
142 | + $this->view->addMetaTag(['property' => 'og:image', 'content' => 'http://'.idn_to_utf8(INJI_DOMAIN_NAME).$logo->path]); |
|
143 | 143 | } |
144 | 144 | $this->view->setTitle($material->name); |
145 | - $bread[] = ['text' => $material->name, 'href' => '/' . $material->alias]; |
|
145 | + $bread[] = ['text' => $material->name, 'href' => '/'.$material->alias]; |
|
146 | 146 | $this->view->page([ |
147 | 147 | 'page' => $material->resolveTemplate(), |
148 | 148 | 'content' => $material->resolveViewer(), |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | if (!empty($conf['files']['aditionTemplateFiels'])) { |
42 | 42 | foreach ($conf['files']['aditionTemplateFiels'] as $file) { |
43 | - $return[$file['file']] = '- ' . $file['name']; |
|
43 | + $return[$file['file']] = '- '.$file['name']; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | return $return; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | if (!empty($conf['files']['aditionTemplateFiels'])) { |
78 | 78 | foreach ($conf['files']['aditionTemplateFiels'] as $file) { |
79 | - $return[$file['file']] = '- ' . $file['name']; |
|
79 | + $return[$file['file']] = '- '.$file['name']; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | return $return; |
@@ -20,13 +20,13 @@ |
||
20 | 20 | |
21 | 21 | public function generate() |
22 | 22 | { |
23 | - $code = $this->security . ' '; |
|
23 | + $code = $this->security.' '; |
|
24 | 24 | $code .= $this->static ? 'static ' : ''; |
25 | - $code .= '$' . $this->name . ' = '; |
|
25 | + $code .= '$'.$this->name.' = '; |
|
26 | 26 | if (is_array($this->value)) { |
27 | 27 | $code .= \CodeGenerator::genArray($this->value); |
28 | 28 | } else { |
29 | - $code .= '"' . str_replace('"', '\"', $this->value) . '";'; |
|
29 | + $code .= '"'.str_replace('"', '\"', $this->value).'";'; |
|
30 | 30 | } |
31 | 31 | return $code; |
32 | 32 | } |
@@ -21,16 +21,16 @@ |
||
21 | 21 | |
22 | 22 | public function generate() |
23 | 23 | { |
24 | - $code = $this->security . ' '; |
|
24 | + $code = $this->security.' '; |
|
25 | 25 | $code .= $this->static ? 'static ' : ''; |
26 | - $code .= 'function ' . $this->name . '('; |
|
26 | + $code .= 'function '.$this->name.'('; |
|
27 | 27 | foreach ($this->propertys as $param) { |
28 | - $code .= '$' . $param . ','; |
|
28 | + $code .= '$'.$param.','; |
|
29 | 29 | } |
30 | 30 | $code = rtrim($code, ','); |
31 | - $code.= ") {\n"; |
|
32 | - $code.= ' ' . str_replace("\n", "\n ", $this->body); |
|
33 | - $code .="\n}"; |
|
31 | + $code .= ") {\n"; |
|
32 | + $code .= ' '.str_replace("\n", "\n ", $this->body); |
|
33 | + $code .= "\n}"; |
|
34 | 34 | return $code; |
35 | 35 | } |
36 | 36 |
@@ -39,16 +39,16 @@ |
||
39 | 39 | |
40 | 40 | public function generate() |
41 | 41 | { |
42 | - $code = 'class ' . $this->name . ' '; |
|
42 | + $code = 'class '.$this->name.' '; |
|
43 | 43 | if ($this->extends) { |
44 | - $code .= 'extends ' . $this->extends . ' '; |
|
44 | + $code .= 'extends '.$this->extends.' '; |
|
45 | 45 | } |
46 | 46 | $code .= "{\n"; |
47 | 47 | foreach ($this->propertys as $property) { |
48 | - $code .= ' ' . str_replace("\n", "\n ", $property->generate()) . "\n"; |
|
48 | + $code .= ' '.str_replace("\n", "\n ", $property->generate())."\n"; |
|
49 | 49 | } |
50 | 50 | foreach ($this->methods as $method) { |
51 | - $code .= ' ' . str_replace("\n", "\n ", $method->generate()) . "\n"; |
|
51 | + $code .= ' '.str_replace("\n", "\n ", $method->generate())."\n"; |
|
52 | 52 | } |
53 | 53 | $code .= "}\n"; |
54 | 54 | return $code; |
@@ -16,17 +16,17 @@ |
||
16 | 16 | if ($level == 0) |
17 | 17 | $return = "["; |
18 | 18 | foreach ($data as $key => $item) { |
19 | - $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "'{$key}' => "; |
|
19 | + $return .= "\n".str_repeat(' ', ($level * 4 + 4))."'{$key}' => "; |
|
20 | 20 | if (!is_array($item)) |
21 | 21 | $return .= "'{$item}',"; |
22 | 22 | else { |
23 | 23 | $return .= "["; |
24 | 24 | $return .= rtrim(self::genArray($item, $level + 1), ','); |
25 | - $return .= "\n" . str_repeat(' ', ( $level * 4 + 4)) . "],"; |
|
25 | + $return .= "\n".str_repeat(' ', ($level * 4 + 4))."],"; |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | if ($level == 0) |
29 | - $return = rtrim($return, ',') . "\n];"; |
|
29 | + $return = rtrim($return, ',')."\n];"; |
|
30 | 30 | |
31 | 31 | return $return; |
32 | 32 | } |