@@ -262,7 +262,7 @@ |
||
262 | 262 | "$this->root/license.txt", |
263 | 263 | "$this->root/Storage.php" |
264 | 264 | ]; |
265 | - $files = []; |
|
265 | + $files = []; |
|
266 | 266 | foreach ($files_to_include as $s) { |
267 | 267 | if (is_file($s)) { |
268 | 268 | $files[] = $s; |
@@ -22,7 +22,7 @@ |
||
22 | 22 | use |
23 | 23 | Singleton; |
24 | 24 | |
25 | - protected $data_model = [ |
|
25 | + protected $data_model = [ |
|
26 | 26 | 'id' => 'int', |
27 | 27 | 'amount' => 'float:0', |
28 | 28 | 'currency' => 'text', |
@@ -106,7 +106,7 @@ |
||
106 | 106 | ] |
107 | 107 | ); |
108 | 108 | } |
109 | - $sections = $this->db()->qfa( |
|
109 | + $sections = $this->db()->qfa( |
|
110 | 110 | [ |
111 | 111 | "SELECT |
112 | 112 | `id`, |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | cs\Language, |
15 | 15 | cs\User; |
16 | 16 | function get_sections_rows ($structure = null, $level = 0) { |
17 | - $L = Language::instance(); |
|
18 | - $root = false; |
|
19 | - $module = path($L->Blogs); |
|
17 | + $L = Language::instance(); |
|
18 | + $root = false; |
|
19 | + $module = path($L->Blogs); |
|
20 | 20 | if ($structure === null) { |
21 | - $structure = Sections::instance()->get_structure(); |
|
22 | - $structure['title'] = $L->root_section; |
|
23 | - $root = true; |
|
21 | + $structure = Sections::instance()->get_structure(); |
|
22 | + $structure['title'] = $L->root_section; |
|
23 | + $root = true; |
|
24 | 24 | } |
25 | - $content = []; |
|
26 | - $content[] = [ |
|
25 | + $content = []; |
|
26 | + $content[] = [ |
|
27 | 27 | [ |
28 | 28 | h::a( |
29 | 29 | $structure['title']. |
@@ -71,35 +71,35 @@ discard block |
||
71 | 71 | return $content; |
72 | 72 | } |
73 | 73 | function get_sections_select_section ($current = null, $structure = null, $level = 0) { |
74 | - $list = [ |
|
74 | + $list = [ |
|
75 | 75 | 'in' => [], |
76 | 76 | 'value' => [] |
77 | 77 | ]; |
78 | 78 | if ($structure === null) { |
79 | - $structure = Sections::instance()->get_structure(); |
|
80 | - $list['in'][] = Language::instance()->root_section; |
|
81 | - $list['value'][] = 0; |
|
79 | + $structure = Sections::instance()->get_structure(); |
|
80 | + $list['in'][] = Language::instance()->root_section; |
|
81 | + $list['value'][] = 0; |
|
82 | 82 | } else { |
83 | 83 | if ($structure['id'] == $current) { |
84 | 84 | return $list; |
85 | 85 | } |
86 | - $list['in'][] = str_repeat(' ', $level).$structure['title']; |
|
87 | - $list['value'][] = $structure['id']; |
|
86 | + $list['in'][] = str_repeat(' ', $level).$structure['title']; |
|
87 | + $list['value'][] = $structure['id']; |
|
88 | 88 | } |
89 | 89 | if (!empty($structure['sections'])) { |
90 | 90 | foreach ($structure['sections'] as $section) { |
91 | - $tmp = get_sections_select_section($current, $section, $level+1); |
|
92 | - $list['in'] = array_merge($list['in'], $tmp['in']); |
|
93 | - $list['value'] = array_merge($list['value'], $tmp['value']); |
|
91 | + $tmp = get_sections_select_section($current, $section, $level + 1); |
|
92 | + $list['in'] = array_merge($list['in'], $tmp['in']); |
|
93 | + $list['value'] = array_merge($list['value'], $tmp['value']); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | return $list; |
97 | 97 | } |
98 | 98 | function get_posts_rows ($page = 1) { |
99 | - $Posts = Posts::instance(); |
|
100 | - $Sections = Sections::instance(); |
|
99 | + $Posts = Posts::instance(); |
|
100 | + $Sections = Sections::instance(); |
|
101 | 101 | $Config = Config::instance(); |
102 | - $L = Language::instance(); |
|
102 | + $L = Language::instance(); |
|
103 | 103 | $User = User::instance(); |
104 | 104 | $module = path($L->Blogs); |
105 | 105 | $page = (int)$page ?: 1; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $num = $Config->module('Blogs')->posts_per_page; |
108 | 108 | $from = ($page - 1) * $num; |
109 | 109 | $cdb = DB::instance()->{$Config->module('Blogs')->db('posts')}; |
110 | - $posts = $cdb->qfas( |
|
110 | + $posts = $cdb->qfas( |
|
111 | 111 | "SELECT `id` |
112 | 112 | FROM `[prefix]blogs_posts` |
113 | 113 | ORDER BY `id` DESC |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | ); |
130 | 130 | } |
131 | 131 | unset($section); |
132 | - $content[] = [ |
|
132 | + $content[] = [ |
|
133 | 133 | h::a( |
134 | 134 | $post['title'], |
135 | 135 | [ |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var int Avatar size in px, can be redefined |
35 | 35 | */ |
36 | - public $avatar_size = 36; |
|
36 | + public $avatar_size = 36; |
|
37 | 37 | |
38 | 38 | protected function construct () { |
39 | - $this->module = current_module(); |
|
40 | - $this->cache = new Prefix("Comments/$this->module"); |
|
39 | + $this->module = current_module(); |
|
40 | + $this->cache = new Prefix("Comments/$this->module"); |
|
41 | 41 | } |
42 | 42 | /** |
43 | 43 | * Set module (current module assumed by default) |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @param string $module Module name |
46 | 46 | */ |
47 | 47 | function set_module ($module) { |
48 | - $this->module = $module; |
|
49 | - $this->cache = new Prefix("Comments/$this->module"); |
|
48 | + $this->module = $module; |
|
49 | + $this->cache = new Prefix("Comments/$this->module"); |
|
50 | 50 | } |
51 | 51 | /** |
52 | 52 | * Returns database index |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return array|false Array of comment data on success or <b>false</b> on failure |
65 | 65 | */ |
66 | 66 | function get ($id) { |
67 | - $id = (int)$id; |
|
67 | + $id = (int)$id; |
|
68 | 68 | return $this->db()->qf([ |
69 | 69 | "SELECT |
70 | 70 | `id`, |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * @return array|bool Array of comment data on success or <b>false</b> on failure |
94 | 94 | */ |
95 | 95 | function add ($item, $text, $parent = 0) { |
96 | - $L = Language::instance(); |
|
96 | + $L = Language::instance(); |
|
97 | 97 | $User = User::instance(); |
98 | 98 | $text = xap($text, true); |
99 | 99 | if (!$text) { |
100 | 100 | return false; |
101 | 101 | } |
102 | - $item = (int)$item; |
|
103 | - $parent = (int)$parent; |
|
102 | + $item = (int)$item; |
|
103 | + $parent = (int)$parent; |
|
104 | 104 | if ( |
105 | 105 | $parent != 0 && |
106 | 106 | $this->db_prime()->qfs([ |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | * @return array|false Array of comment data on success or <b>false</b> on failure |
169 | 169 | */ |
170 | 170 | function set ($id, $text) { |
171 | - $text = xap($text, true); |
|
171 | + $text = xap($text, true); |
|
172 | 172 | if (!$text) { |
173 | 173 | return false; |
174 | 174 | } |
175 | - $id = (int)$id; |
|
176 | - $comment = $this->get($id); |
|
175 | + $id = (int)$id; |
|
176 | + $comment = $this->get($id); |
|
177 | 177 | if (!$comment) { |
178 | 178 | return false; |
179 | 179 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $this->module |
190 | 190 | )) { |
191 | 191 | unset($this->cache->{$comment['item']}); |
192 | - $comment['text'] = $text; |
|
192 | + $comment['text'] = $text; |
|
193 | 193 | return $comment; |
194 | 194 | } |
195 | 195 | return false; |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | * @return bool |
203 | 203 | */ |
204 | 204 | function del ($id) { |
205 | - $id = (int)$id; |
|
206 | - $comment = $this->db_prime()->qf([ |
|
205 | + $id = (int)$id; |
|
206 | + $comment = $this->db_prime()->qf([ |
|
207 | 207 | "SELECT `p`.`item`, COUNT(`c`.`id`) AS `count` |
208 | 208 | FROM `[prefix]comments` AS `p` |
209 | 209 | LEFT JOIN `[prefix]comments` AS `c` |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @return bool |
241 | 241 | */ |
242 | 242 | function del_all ($item) { |
243 | - $item = (int)$item; |
|
243 | + $item = (int)$item; |
|
244 | 244 | if ($this->db_prime()->q( |
245 | 245 | "DELETE FROM `[prefix]comments` |
246 | 246 | WHERE |
@@ -272,9 +272,9 @@ discard block |
||
272 | 272 | if (!is_array($data)) { |
273 | 273 | return 0; |
274 | 274 | } |
275 | - $count = 0; |
|
275 | + $count = 0; |
|
276 | 276 | foreach ($data as &$d) { |
277 | - $count += $this->count_internal($d['comments']) + 1; |
|
277 | + $count += $this->count_internal($d['comments']) + 1; |
|
278 | 278 | } |
279 | 279 | return $count; |
280 | 280 | } |
@@ -297,12 +297,12 @@ discard block |
||
297 | 297 | * @return false|array |
298 | 298 | */ |
299 | 299 | function tree_data ($item, $parent = 0) { |
300 | - $Cache = $this->cache; |
|
301 | - $L = Language::instance(); |
|
300 | + $Cache = $this->cache; |
|
301 | + $L = Language::instance(); |
|
302 | 302 | if (($comments = $Cache->{"$item/$L->clang"}) === false) { |
303 | - $item = (int)$item; |
|
304 | - $parent = (int)$parent; |
|
305 | - $comments = $this->db()->qfa([ |
|
303 | + $item = (int)$item; |
|
304 | + $parent = (int)$parent; |
|
305 | + $comments = $this->db()->qfa([ |
|
306 | 306 | "SELECT |
307 | 307 | `id`, |
308 | 308 | `parent`, |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * Cache only root tree data |
328 | 328 | */ |
329 | 329 | if ($parent == 0) { |
330 | - $Cache->{"$item/$L->clang"} = $comments; |
|
330 | + $Cache->{"$item/$L->clang"} = $comments; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | return $comments; |
@@ -340,15 +340,15 @@ discard block |
||
340 | 340 | * @return string |
341 | 341 | */ |
342 | 342 | function tree_html ($comments) { |
343 | - $L = Language::instance(); |
|
344 | - $User = User::instance(); |
|
343 | + $L = Language::instance(); |
|
344 | + $User = User::instance(); |
|
345 | 345 | if (!is_array($comments) || !$comments) { |
346 | 346 | return ''; |
347 | 347 | } |
348 | - $content = ''; |
|
348 | + $content = ''; |
|
349 | 349 | foreach ($comments as $comment) { |
350 | - $uniqid = uniqid('comment_', true); |
|
351 | - $content .= str_replace($uniqid, $comment['text'], h::{'article.cs-comments-comment'}( |
|
350 | + $uniqid = uniqid('comment_', true); |
|
351 | + $content .= str_replace($uniqid, $comment['text'], h::{'article.cs-comments-comment'}( |
|
352 | 352 | h::{'img.cs-comments-comment-avatar'}([ |
353 | 353 | 'src' => $User->avatar($this->avatar_size, $comment['user']), |
354 | 354 | 'alt' => $User->username($comment['user']), |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @return string |
405 | 405 | */ |
406 | 406 | function block ($item) { |
407 | - $L = Language::instance(); |
|
407 | + $L = Language::instance(); |
|
408 | 408 | return h::{'section#comments.cs-comments-comments'}( |
409 | 409 | $L->comments.':'. |
410 | 410 | ( |
@@ -19,7 +19,7 @@ |
||
19 | 19 | Event::instance()->on( |
20 | 20 | 'Comments/instance', |
21 | 21 | function ($data) { |
22 | - $data['Comments'] = Comments::instance(); |
|
22 | + $data['Comments'] = Comments::instance(); |
|
23 | 23 | return false; |
24 | 24 | } |
25 | 25 | ); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | 'content' => null, //Is set in constructor |
32 | 32 | 'type' => 'set:text,html' |
33 | 33 | ]; |
34 | - protected $table = '[prefix]content'; |
|
34 | + protected $table = '[prefix]content'; |
|
35 | 35 | /** |
36 | 36 | * @var Prefix |
37 | 37 | */ |
@@ -31,7 +31,7 @@ |
||
31 | 31 | 'module' => 'text', |
32 | 32 | 'data' => null //Is set in constructor |
33 | 33 | ]; |
34 | - protected $table = '[prefix]deferred_tasks_tasks'; |
|
34 | + protected $table = '[prefix]deferred_tasks_tasks'; |
|
35 | 35 | /** |
36 | 36 | * @var int |
37 | 37 | */ |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | protected $shortname; |
29 | 29 | |
30 | 30 | protected function construct () { |
31 | - $this->module = current_module(); |
|
32 | - $this->shortname = Config::instance()->module('Disqus')->shortname; |
|
31 | + $this->module = current_module(); |
|
32 | + $this->shortname = Config::instance()->module('Disqus')->shortname; |
|
33 | 33 | } |
34 | 34 | /** |
35 | 35 | * Set module (current module assumed by default) |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param string $module Module name |
38 | 38 | */ |
39 | 39 | function set_module ($module) { |
40 | - $this->module = $module; |
|
40 | + $this->module = $module; |
|
41 | 41 | } |
42 | 42 | /** |
43 | 43 | * Count of comments for specified item |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | return '<div id="disqus_thread"></div>'; |
75 | 75 | } |
76 | 76 | protected function count_js () { |
77 | - static $added = false; |
|
77 | + static $added = false; |
|
78 | 78 | if ($added) { |
79 | 79 | return; |
80 | 80 | } |
81 | - $added = true; |
|
81 | + $added = true; |
|
82 | 82 | Page::instance()->js( |
83 | 83 | "var disqus_shortname = '$this->shortname'; |
84 | 84 | if (!window.disqus_count_items) { window.disqus_count_items = []; }", |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | ); |
87 | 87 | } |
88 | 88 | protected function block_js ($item) { |
89 | - static $added = false; |
|
89 | + static $added = false; |
|
90 | 90 | if ($added) { |
91 | 91 | return; |
92 | 92 | } |
93 | - $added = true; |
|
93 | + $added = true; |
|
94 | 94 | Page::instance()->js( |
95 | 95 | "var disqus_shortname = '$this->shortname', disqus_identifier = '".str_replace("'", "\'", "$this->module/$item")."';", |
96 | 96 | 'code' |