@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Blogs |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Blogs |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs; |
| 10 | 10 | Event::instance()->on( |
| 11 | 11 | 'admin/System/components/modules/install/after', |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Blogs |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Blogs |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Blogs; |
| 10 | 10 | use |
| 11 | 11 | cs\Config, |
@@ -25,42 +25,42 @@ discard block |
||
| 25 | 25 | $Posts = Posts::instance(); |
| 26 | 26 | $Route = Route::instance(); |
| 27 | 27 | /** |
| 28 | - * Page title |
|
| 29 | - */ |
|
| 28 | + * Page title |
|
| 29 | + */ |
|
| 30 | 30 | $Page->title($L->latest_posts); |
| 31 | 31 | /** |
| 32 | - * Now add link to Atom feed for latest posts |
|
| 33 | - */ |
|
| 32 | + * Now add link to Atom feed for latest posts |
|
| 33 | + */ |
|
| 34 | 34 | $Page->atom('Blogs/atom.xml', $L->latest_posts); |
| 35 | 35 | /** |
| 36 | - * Set page of blog type (Open Graph protocol) |
|
| 37 | - */ |
|
| 36 | + * Set page of blog type (Open Graph protocol) |
|
| 37 | + */ |
|
| 38 | 38 | $Meta->blog(); |
| 39 | 39 | /** |
| 40 | - * Determine current page |
|
| 41 | - */ |
|
| 40 | + * Determine current page |
|
| 41 | + */ |
|
| 42 | 42 | $page = max( |
| 43 | 43 | isset($Route->ids[0]) ? array_slice($Route->ids, -1)[0] : 1, |
| 44 | 44 | 1 |
| 45 | 45 | ); |
| 46 | 46 | /** |
| 47 | - * If this is not first page - show that in page title |
|
| 48 | - */ |
|
| 47 | + * If this is not first page - show that in page title |
|
| 48 | + */ |
|
| 49 | 49 | if ($page > 1) { |
| 50 | 50 | $Page->title($L->blogs_nav_page($page)); |
| 51 | 51 | } |
| 52 | 52 | /** |
| 53 | - * Get posts for current page in JSON-LD structure format |
|
| 54 | - */ |
|
| 53 | + * Get posts for current page in JSON-LD structure format |
|
| 54 | + */ |
|
| 55 | 55 | $posts_per_page = $Config->module('Blogs')->posts_per_page; |
| 56 | 56 | $posts = $Posts->get_latest_posts($page, $posts_per_page); |
| 57 | 57 | /** |
| 58 | - * Base url (without page number) |
|
| 59 | - */ |
|
| 58 | + * Base url (without page number) |
|
| 59 | + */ |
|
| 60 | 60 | $base_url = $Config->base_url().'/'.path($L->Blogs).'/'.path($L->latest_posts); |
| 61 | 61 | /** |
| 62 | - * Render posts page |
|
| 63 | - */ |
|
| 62 | + * Render posts page |
|
| 63 | + */ |
|
| 64 | 64 | Helpers::show_posts_list( |
| 65 | 65 | $posts, |
| 66 | 66 | $Posts->get_total_count(), |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Blogs |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Blogs |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Blogs; |
| 10 | 10 | use |
| 11 | 11 | h, |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | ] |
| 34 | 34 | ); |
| 35 | 35 | /** |
| 36 | - * @var \cs\modules\Comments\Comments $Comments |
|
| 37 | - */ |
|
| 36 | + * @var \cs\modules\Comments\Comments $Comments |
|
| 37 | + */ |
|
| 38 | 38 | $Posts = Posts::instance(); |
| 39 | 39 | $rc = Route::instance()->route; |
| 40 | 40 | $post_id = (int)mb_substr($rc[1], mb_strrpos($rc[1], ':') + 1); |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Blogs |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Blogs |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Blogs; |
| 10 | 10 | use |
| 11 | 11 | cs\Language; |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Blogs |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Blogs |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Blogs; |
| 10 | 10 | use |
| 11 | 11 | cs\Config, |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | $Route = Route::instance(); |
| 28 | 28 | $Sections = Sections::instance(); |
| 29 | 29 | /** |
| 30 | - * At first - determine part of url and get sections list based on that path |
|
| 31 | - */ |
|
| 30 | + * At first - determine part of url and get sections list based on that path |
|
| 31 | + */ |
|
| 32 | 32 | $sections = $Sections->get_by_path( |
| 33 | 33 | array_slice($Route->path, 1) |
| 34 | 34 | ); |
@@ -37,49 +37,49 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | $sections = $Sections->get($sections); |
| 39 | 39 | /** |
| 40 | - * Now lets set page title using sections names from page path |
|
| 41 | - * We will not remove `$section` variable after, since it will be direct parent of each shown post |
|
| 42 | - */ |
|
| 40 | + * Now lets set page title using sections names from page path |
|
| 41 | + * We will not remove `$section` variable after, since it will be direct parent of each shown post |
|
| 42 | + */ |
|
| 43 | 43 | foreach ($sections as $section) { |
| 44 | 44 | $Page->title($section['title']); |
| 45 | 45 | } |
| 46 | 46 | /** |
| 47 | - * Now add link to Atom feed for posts from current section only |
|
| 48 | - */ |
|
| 47 | + * Now add link to Atom feed for posts from current section only |
|
| 48 | + */ |
|
| 49 | 49 | /** @noinspection PhpUndefinedVariableInspection */ |
| 50 | 50 | $Page->atom( |
| 51 | 51 | "Blogs/atom.xml/?section=$section[id]", |
| 52 | 52 | implode($Config->core['title_delimiter'], [$L->latest_posts, $L->section, $section['title']]) |
| 53 | 53 | ); |
| 54 | 54 | /** |
| 55 | - * Set page of blog type (Open Graph protocol) |
|
| 56 | - */ |
|
| 55 | + * Set page of blog type (Open Graph protocol) |
|
| 56 | + */ |
|
| 57 | 57 | $Meta->blog(); |
| 58 | 58 | /** |
| 59 | - * Determine current page |
|
| 60 | - */ |
|
| 59 | + * Determine current page |
|
| 60 | + */ |
|
| 61 | 61 | $page = max( |
| 62 | 62 | isset($Route->ids[0]) ? array_slice($Route->ids, -1)[0] : 1, |
| 63 | 63 | 1 |
| 64 | 64 | ); |
| 65 | 65 | /** |
| 66 | - * If this is not first page - show that in page title |
|
| 67 | - */ |
|
| 66 | + * If this is not first page - show that in page title |
|
| 67 | + */ |
|
| 68 | 68 | if ($page > 1) { |
| 69 | 69 | $Page->title($L->blogs_nav_page($page)); |
| 70 | 70 | } |
| 71 | 71 | /** |
| 72 | - * Get posts for current page in JSON-LD structure format |
|
| 73 | - */ |
|
| 72 | + * Get posts for current page in JSON-LD structure format |
|
| 73 | + */ |
|
| 74 | 74 | $posts_per_page = $Config->module('Blogs')->posts_per_page; |
| 75 | 75 | $posts = $Posts->get_for_section($section['id'], $page, $posts_per_page); |
| 76 | 76 | /** |
| 77 | - * Base url (without page number) |
|
| 78 | - */ |
|
| 77 | + * Base url (without page number) |
|
| 78 | + */ |
|
| 79 | 79 | $base_url = $Config->base_url().'/'.path($L->Blogs).'/'.path($L->section)."/$section[full_path]"; |
| 80 | 80 | /** |
| 81 | - * Render posts page |
|
| 82 | - */ |
|
| 81 | + * Render posts page |
|
| 82 | + */ |
|
| 83 | 83 | Helpers::show_posts_list( |
| 84 | 84 | $posts, |
| 85 | 85 | $section['posts'], |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Blogs |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Blogs |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Blogs; |
| 10 | 10 | use |
| 11 | 11 | cs\Config, |
@@ -27,61 +27,61 @@ discard block |
||
| 27 | 27 | $Tags = Tags::instance(); |
| 28 | 28 | $Route = Route::instance(); |
| 29 | 29 | /** |
| 30 | - * If no tag specified |
|
| 31 | - */ |
|
| 30 | + * If no tag specified |
|
| 31 | + */ |
|
| 32 | 32 | if (!isset($Route->route[1])) { |
| 33 | 33 | throw new ExitException(404); |
| 34 | 34 | } |
| 35 | 35 | /** |
| 36 | - * Find tag |
|
| 37 | - */ |
|
| 36 | + * Find tag |
|
| 37 | + */ |
|
| 38 | 38 | $tag = $Tags->get_by_text($Route->route[1]); |
| 39 | 39 | if (!$tag) { |
| 40 | 40 | throw new ExitException(404); |
| 41 | 41 | } |
| 42 | 42 | $tag = $Tags->get($tag); |
| 43 | 43 | /** |
| 44 | - * Add tag to page title |
|
| 45 | - */ |
|
| 44 | + * Add tag to page title |
|
| 45 | + */ |
|
| 46 | 46 | $Page |
| 47 | 47 | ->title($tag['text']); |
| 48 | 48 | /** |
| 49 | - * Now add link to Atom feed for posts with current tag only |
|
| 50 | - */ |
|
| 49 | + * Now add link to Atom feed for posts with current tag only |
|
| 50 | + */ |
|
| 51 | 51 | $Page->atom( |
| 52 | 52 | "Blogs/atom.xml/?tag=$tag[id]", |
| 53 | 53 | implode($Config->core['title_delimiter'], [$L->latest_posts, $L->tag, $tag['text']]) |
| 54 | 54 | ); |
| 55 | 55 | /** |
| 56 | - * Set page of blog type (Open Graph protocol) |
|
| 57 | - */ |
|
| 56 | + * Set page of blog type (Open Graph protocol) |
|
| 57 | + */ |
|
| 58 | 58 | $Meta->blog(); |
| 59 | 59 | /** |
| 60 | - * Determine current page |
|
| 61 | - */ |
|
| 60 | + * Determine current page |
|
| 61 | + */ |
|
| 62 | 62 | $page = max( |
| 63 | 63 | isset($Route->route[2]) ? $Route->route[2] : 1, |
| 64 | 64 | 1 |
| 65 | 65 | ); |
| 66 | 66 | /** |
| 67 | - * If this is not first page - show that in page title |
|
| 68 | - */ |
|
| 67 | + * If this is not first page - show that in page title |
|
| 68 | + */ |
|
| 69 | 69 | if ($page > 1) { |
| 70 | 70 | $Page->title($L->blogs_nav_page($page)); |
| 71 | 71 | } |
| 72 | 72 | /** |
| 73 | - * Get posts for current page in JSON-LD structure format |
|
| 74 | - */ |
|
| 73 | + * Get posts for current page in JSON-LD structure format |
|
| 74 | + */ |
|
| 75 | 75 | $posts_per_page = $Config->module('Blogs')->posts_per_page; |
| 76 | 76 | $posts = $Posts->get_for_tag($tag['id'], $L->clang, $page, $posts_per_page); |
| 77 | 77 | $posts_count = $Posts->get_for_tag_count($tag['id'], $L->clang); |
| 78 | 78 | /** |
| 79 | - * Base url (without page number) |
|
| 80 | - */ |
|
| 79 | + * Base url (without page number) |
|
| 80 | + */ |
|
| 81 | 81 | $base_url = $Config->base_url().'/'.path($L->Blogs).'/'.path($L->tag).'/'.$Route->route[1]; |
| 82 | 82 | /** |
| 83 | - * Render posts page |
|
| 84 | - */ |
|
| 83 | + * Render posts page |
|
| 84 | + */ |
|
| 85 | 85 | Helpers::show_posts_list( |
| 86 | 86 | $posts, |
| 87 | 87 | $posts_count, |
@@ -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 | ( |
@@ -264,7 +264,7 @@ |
||
| 264 | 264 | function count ($item) { |
| 265 | 265 | $item = (int)$item; |
| 266 | 266 | $L = Language::instance(); |
| 267 | - return $this->cache->get("$item/count/$L->clang", function () use ($item) { |
|
| 267 | + return $this->cache->get("$item/count/$L->clang", function () use ($item) { |
|
| 268 | 268 | return $this->count_internal($this->tree_data($item)) ?: 0; |
| 269 | 269 | }); |
| 270 | 270 | } |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Comments |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Comments |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Comments; |
| 10 | 10 | use |
| 11 | 11 | cs\Cache, |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Comments |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Comments |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Comments; |
| 10 | 10 | use |
| 11 | 11 | h, |
@@ -17,15 +17,15 @@ discard block |
||
| 17 | 17 | cs\Route, |
| 18 | 18 | cs\User; |
| 19 | 19 | /** |
| 20 | - * Provides next events: |
|
| 21 | - * api/Comments/delete |
|
| 22 | - * [ |
|
| 23 | - * 'Comments' => &$Comments //Comments object should be returned in this parameter (after access checking)<br> |
|
| 24 | - * 'delete_parent' => &$delete_parent //Boolean parameter, should contain boolean true, if parent comment may be deleted by current user<br> |
|
| 25 | - * 'id' => id //Comment id<br> |
|
| 26 | - * 'module' => module //Module<br> |
|
| 27 | - * ] |
|
| 28 | - */ |
|
| 20 | + * Provides next events: |
|
| 21 | + * api/Comments/delete |
|
| 22 | + * [ |
|
| 23 | + * 'Comments' => &$Comments //Comments object should be returned in this parameter (after access checking)<br> |
|
| 24 | + * 'delete_parent' => &$delete_parent //Boolean parameter, should contain boolean true, if parent comment may be deleted by current user<br> |
|
| 25 | + * 'id' => id //Comment id<br> |
|
| 26 | + * 'module' => module //Module<br> |
|
| 27 | + * ] |
|
| 28 | + */ |
|
| 29 | 29 | $Config = Config::instance(); |
| 30 | 30 | if (!$Config->module('Comments')->enabled()) { |
| 31 | 31 | throw new ExitException(404); |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | throw new ExitException($L->comment_deleting_server_error, 500); |
| 55 | 55 | } |
| 56 | 56 | /** |
| 57 | - * @var Comments $Comments |
|
| 58 | - */ |
|
| 57 | + * @var Comments $Comments |
|
| 58 | + */ |
|
| 59 | 59 | if ($result = $Comments->del($Route->route[0])) { |
| 60 | 60 | $Page->json($delete_parent ? h::{'icon.cs-comments-comment-delete.cs-cursor-pointer'}('trash') : ''); |
| 61 | 61 | } else { |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package Comments |
|
| 4 | - * @category modules |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package Comments |
|
| 4 | + * @category modules |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2015, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | namespace cs\modules\Comments; |
| 10 | 10 | use |
| 11 | 11 | cs\Config, |
@@ -15,14 +15,14 @@ discard block |
||
| 15 | 15 | cs\Page, |
| 16 | 16 | cs\User; |
| 17 | 17 | /** |
| 18 | - * Provides next events: |
|
| 19 | - * api/Comments/add |
|
| 20 | - * [ |
|
| 21 | - * 'Comments' => &$Comments //Comments object should be returned in this parameter (after access checking)<br> |
|
| 22 | - * 'item' => item //Item id<br> |
|
| 23 | - * 'module' => module //Module<br> |
|
| 24 | - * ] |
|
| 25 | - */ |
|
| 18 | + * Provides next events: |
|
| 19 | + * api/Comments/add |
|
| 20 | + * [ |
|
| 21 | + * 'Comments' => &$Comments //Comments object should be returned in this parameter (after access checking)<br> |
|
| 22 | + * 'item' => item //Item id<br> |
|
| 23 | + * 'module' => module //Module<br> |
|
| 24 | + * ] |
|
| 25 | + */ |
|
| 26 | 26 | $Config = Config::instance(); |
| 27 | 27 | if (!$Config->module('Comments')->enabled()) { |
| 28 | 28 | throw new ExitException(404); |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | throw new ExitException($L->comment_sending_server_error, 500); |
| 52 | 52 | } |
| 53 | 53 | /** |
| 54 | - * @var Comments $Comments |
|
| 55 | - */ |
|
| 54 | + * @var Comments $Comments |
|
| 55 | + */ |
|
| 56 | 56 | $result = $Comments->add($_POST['item'], $_POST['text'], $_POST['parent']); |
| 57 | 57 | if ($result) { |
| 58 | 58 | $result['comments'] = false; |