| Conditions | 3 |
| Paths | 2 |
| Total Lines | 28 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public static function show_posts_list ($posts, $posts_count, $page, $base_url) { |
||
| 25 | $module_data = Config::instance()->module('Blogs'); |
||
| 26 | $L = new Prefix('blogs_'); |
||
| 27 | $Page = Page::instance(); |
||
| 28 | $Page->content( |
||
| 29 | h::cs_blogs_head_actions() |
||
|
|
|||
| 30 | ); |
||
| 31 | if (!$posts) { |
||
| 32 | $Page->content( |
||
| 33 | h::{'p.cs-text-center'}($L->no_posts_yet) |
||
| 34 | ); |
||
| 35 | return; |
||
| 36 | } |
||
| 37 | $Page->content( |
||
| 38 | h::{'cs-blogs-posts script[type=application/ld+json]'}( |
||
| 39 | json_encode( |
||
| 40 | Posts::instance()->get_as_json_ld($posts), |
||
| 41 | JSON_UNESCAPED_UNICODE |
||
| 42 | ) |
||
| 43 | ). |
||
| 44 | h::{'.cs-block-margin.cs-text-center.cs-margin cs-pagination'}( |
||
| 45 | pages( |
||
| 46 | $page, |
||
| 47 | ceil($posts_count / $module_data->posts_per_page), |
||
| 48 | function ($page) use ($base_url) { |
||
| 49 | return $base_url.($page > 1 ? "/$page" : ''); |
||
| 50 | }, |
||
| 51 | true |
||
| 52 | ) |
||
| 57 |