@@ -33,10 +33,10 @@ 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->cache = new Cache_prefix('Comments'); |
|
39 | + $this->cache = new Cache_prefix('Comments'); |
|
40 | 40 | } |
41 | 41 | /** |
42 | 42 | * Returns database index |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return array|false Array of comment data on success or <b>false</b> on failure |
55 | 55 | */ |
56 | 56 | function get ($id) { |
57 | - $id = (int)$id; |
|
57 | + $id = (int)$id; |
|
58 | 58 | return $this->db()->qf( |
59 | 59 | "SELECT |
60 | 60 | `id`, |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | * @return false|int |
84 | 84 | */ |
85 | 85 | function add ($item, $module, $text, $parent = 0) { |
86 | - $L = Language::instance(); |
|
86 | + $L = Language::instance(); |
|
87 | 87 | $User = User::instance(); |
88 | 88 | $text = xap($text, true); |
89 | 89 | if (!$text) { |
90 | 90 | return false; |
91 | 91 | } |
92 | - $item = (int)$item; |
|
93 | - $parent = (int)$parent; |
|
92 | + $item = (int)$item; |
|
93 | + $parent = (int)$parent; |
|
94 | 94 | if ( |
95 | 95 | $parent != 0 && |
96 | 96 | $this->db_prime()->qfs( |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | * @return bool |
150 | 150 | */ |
151 | 151 | function set ($id, $text) { |
152 | - $text = xap($text, true); |
|
152 | + $text = xap($text, true); |
|
153 | 153 | if (!$text) { |
154 | 154 | return false; |
155 | 155 | } |
156 | - $id = (int)$id; |
|
157 | - $comment = $this->get($id); |
|
156 | + $id = (int)$id; |
|
157 | + $comment = $this->get($id); |
|
158 | 158 | if (!$comment) { |
159 | 159 | return false; |
160 | 160 | } |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | * @return bool |
181 | 181 | */ |
182 | 182 | function del ($id) { |
183 | - $id = (int)$id; |
|
184 | - $comment = $this->db_prime()->qf( |
|
183 | + $id = (int)$id; |
|
184 | + $comment = $this->db_prime()->qf( |
|
185 | 185 | "SELECT `p`.*, COUNT(`c`.`id`) AS `count` |
186 | 186 | FROM `[prefix]comments` AS `p` |
187 | 187 | LEFT JOIN `[prefix]comments` AS `c` |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @return bool |
216 | 216 | */ |
217 | 217 | function del_all ($item, $module) { |
218 | - $item = (int)$item; |
|
218 | + $item = (int)$item; |
|
219 | 219 | if ($this->db_prime()->q( |
220 | 220 | "DELETE FROM `[prefix]comments` |
221 | 221 | WHERE |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | if (!is_array($data)) { |
249 | 249 | return 0; |
250 | 250 | } |
251 | - $count = 0; |
|
251 | + $count = 0; |
|
252 | 252 | foreach ($data as &$d) { |
253 | - $count += $this->count_internal($d['comments']) + 1; |
|
253 | + $count += $this->count_internal($d['comments']) + 1; |
|
254 | 254 | } |
255 | 255 | return $count; |
256 | 256 | } |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | * @return false|array |
276 | 276 | */ |
277 | 277 | function tree_data ($item, $module, $parent = 0) { |
278 | - $Cache = $this->cache; |
|
279 | - $L = Language::instance(); |
|
278 | + $Cache = $this->cache; |
|
279 | + $L = Language::instance(); |
|
280 | 280 | if (($comments = $Cache->{"$module/$item/$L->clang"}) === false) { |
281 | - $item = (int)$item; |
|
282 | - $parent = (int)$parent; |
|
283 | - $comments = $this->db()->qfa( |
|
281 | + $item = (int)$item; |
|
282 | + $parent = (int)$parent; |
|
283 | + $comments = $this->db()->qfa( |
|
284 | 284 | "SELECT |
285 | 285 | `id`, |
286 | 286 | `parent`, |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | * Cache only root tree data |
308 | 308 | */ |
309 | 309 | if ($parent == 0) { |
310 | - $Cache->{"$module/$item/$L->clang"} = $comments; |
|
310 | + $Cache->{"$module/$item/$L->clang"} = $comments; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | return $comments; |
@@ -320,15 +320,15 @@ discard block |
||
320 | 320 | * @return string |
321 | 321 | */ |
322 | 322 | function tree_html ($comments) { |
323 | - $L = Language::instance(); |
|
324 | - $User = User::instance(); |
|
323 | + $L = Language::instance(); |
|
324 | + $User = User::instance(); |
|
325 | 325 | if (!is_array($comments) || !$comments) { |
326 | 326 | return ''; |
327 | 327 | } |
328 | - $content = ''; |
|
328 | + $content = ''; |
|
329 | 329 | foreach ($comments as $comment) { |
330 | - $uniqid = uniqid('comment_', true); |
|
331 | - $content .= str_replace($uniqid, $comment['text'], h::{'article.cs-comments-comment'}( |
|
330 | + $uniqid = uniqid('comment_', true); |
|
331 | + $content .= str_replace($uniqid, $comment['text'], h::{'article.cs-comments-comment'}( |
|
332 | 332 | h::{'img.cs-comments-comment-avatar'}([ |
333 | 333 | 'src' => $User->avatar($this->avatar_size, $comment['user']), |
334 | 334 | 'alt' => $User->username($comment['user']), |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | * @return string |
386 | 386 | */ |
387 | 387 | function block ($item, $module) { |
388 | - $L = new Language_prefix('comments_'); |
|
388 | + $L = new Language_prefix('comments_'); |
|
389 | 389 | return h::{'section#comments.cs-comments-comments'}( |
390 | 390 | $L->comments.':'. |
391 | 391 | ( |
@@ -59,7 +59,7 @@ |
||
59 | 59 | throw new ExitException($L->comment_deleting_server_error, 500); |
60 | 60 | } |
61 | 61 | if ($Comments->del($Request->route[0])) { |
62 | - $Page->json('');//TODO: get rid of this |
|
62 | + $Page->json(''); //TODO: get rid of this |
|
63 | 63 | } else { |
64 | 64 | throw new ExitException($L->comment_deleting_server_error, 500); |
65 | 65 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | protected $shortname; |
27 | 27 | |
28 | 28 | protected function construct () { |
29 | - $this->shortname = Config::instance()->module('Disqus')->shortname; |
|
29 | + $this->shortname = Config::instance()->module('Disqus')->shortname; |
|
30 | 30 | } |
31 | 31 | /** |
32 | 32 | * Count of comments for specified item |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | return '<div id="disqus_thread"></div>'; |
66 | 66 | } |
67 | 67 | protected function count_js () { |
68 | - static $added = false; |
|
68 | + static $added = false; |
|
69 | 69 | if ($added) { |
70 | 70 | return; |
71 | 71 | } |
72 | - $added = true; |
|
72 | + $added = true; |
|
73 | 73 | Page::instance()->js( |
74 | 74 | "var disqus_shortname = '$this->shortname'; |
75 | 75 | if (!window.disqus_count_items) { window.disqus_count_items = []; }", |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | ); |
78 | 78 | } |
79 | 79 | protected function block_js ($item, $module) { |
80 | - static $added = false; |
|
80 | + static $added = false; |
|
81 | 81 | if ($added) { |
82 | 82 | return; |
83 | 83 | } |
84 | - $added = true; |
|
84 | + $added = true; |
|
85 | 85 | Page::instance()->js( |
86 | 86 | "var disqus_shortname = '$this->shortname', disqus_identifier = '".str_replace("'", "'", "$module/$item")."';", |
87 | 87 | 'code' |