-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_catdir.disp.php
More file actions
252 lines (231 loc) · 11.2 KB
/
Copy path_catdir.disp.php
File metadata and controls
252 lines (231 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?php
/**
* This is the template that displays the category directory for a blog
*
* This file is not meant to be called directly.
* It is meant to be called by an include in the main.page.php template.
* To display the archive directory, you should call a stub AND pass the right parameters
* For example: /blogs/index.php?disp=catdir
*
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/gnu-gpl-license}
* @copyright (c)2003-2016 by Francois Planque - {@link http://fplanque.com/}
*
* @package evoskins
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
global $Blog, $Item;
// Default params:
$params = array_merge( array(
'item_class' => 'evo_post evo_content_block three_column',
'item_type_class' => 'evo_post__ptyp_',
'item_status_class' => 'evo_post__',
), $params );
// Column Class
$column = $Skin->Change_class( 'gallery_show' );
$cat_post_style = $Skin->get_setting('cat_post_style');
$cp_bg_img = '';
if( $cat_post_style == 'bg_img' ) {
$cp_bg_img = 'post_bg_image';
}
// --------------------------------- START OF POSTS -------------------------------------
// Display message if no post:
$params_no_content = array(
'before' => '<div class="msg_nothing">',
'after' => '</div>',
'msg_empty_logged_in' => T_('Sorry, there is nothing to display...'),
// This will display if the collection has not been made private. Otherwise we will be redirected to a login screen anyways
'msg_empty_not_logged_in' => T_('This site has no public contents.')
);
// Get only root categories of this blog
$ChapterCache = & get_ChapterCache();
$chapters = $ChapterCache->get_chapters( $Blog->ID, 0, true );
// Boolean var to know when at least one post is displayed
$no_content_to_display = true;
?>
<div class="categories_list">
<?php
if( ! empty( $chapters ) ) { // Display the posts with chapters
foreach( $chapters as $Chapter ){
// Get the posts of current category
$ItemList = new ItemList2( $Blog, $Blog->get_timestamp_min(), $Blog->get_timestamp_max() );
$ItemList->set_filters( array(
'cat_array' => array( $Chapter->ID ), // Limit only by selected cat (exclude posts from child categories)
'cat_modifier' => NULL,
'unit' => 'all', // Display all items of this category, Don't limit by page
) );
?>
<div class="cat_content">
<?php
$ItemList->query();
if( $ItemList->result_num_rows > 0 ) {
$no_content_to_display = false;
?>
<div class="category_title clear">
<h2><a href="<?php echo $Chapter->get_permanent_url(); ?>"><?php echo $Chapter->get( 'name' ); ?></a></h2>
</div>
<div id="cats_list_<?php echo $Chapter->ID; ?>" class="cats_list">
<?php
while( $Item = & $ItemList->get_item() ){
// For each blog post, do everything below up to the closing curly brace "}"
// Temporarily switch to post locale (useful for multilingual blogs)
$Item->locale_temp_switch();
?>
<div id="<?php $Item->anchor_id() ?>" class="<?php $Item->div_classes( $params ); echo ' '.$column; ?> " lang="<?php $Item->lang() ?>">
<section class="evo_post_content <?php echo $cp_bg_img; ?>">
<?php
$hover = $Skin->Change_class( 'gallery_hover_style' );
// Display images that are linked to this post:
$item_first_image = $Item->get_images( array(
'before' => '<div class="evo_post_images '.$hover.'">',
'before_image' => '<figure class="evo_image_block ">',
'before_image_legend' => '<figcaption class="evo_image_legend">',
'after_image_legend' => '</figcaption>',
'after_image' => '</figure>',
'after' => '</div>',
'image_class' => 'img-responsive',
'image_size' => $Skin->get_setting( 'gallery_thumb_size' ),
'image_link_to' => 'single',
'image_desc' => '',
'gallery_image_limit' => 0, // Don't use images from attached folders.
'limit' => 1, // Get only first attached image depending on position priority, see param below:
'restrict_to_image_position' => 'teaser,aftermore,inline',
'get_rendered_attachments' => false,
// Sort the attachments to get firstly "Cover", then "Teaser", and "After more" as last order
'links_sql_select' => ', CASE '
.'WHEN link_position = "teaser" THEN "1" '
.'WHEN link_position = "aftermore" THEN "2" '
.'WHEN link_position = "inline" THEN "3" '
// .'ELSE "99999999"' // Use this line only if you want to put the other position types at the end
.'END AS position_order',
'links_sql_orderby' => 'position_order, link_order',
) );
if( empty( $item_first_image ) )
{ // No images in this post, Display an empty block
$item_first_image = '<div class="no_image '.$hover.'"><a href="'.$Item->get_permanent_url( 'album_nopic' ).'"><img src="'.$Skin->get_url().'assets/images/blank_image.png"></a></div>';
}
else if( $item_first_image == 'plugin_render_attachments' )
{ // No images, but some attachments(e.g. videos) are rendered by plugins
$item_first_image = $Item->get_permanent_link( '<b>'.T_('Click to see contents').'</b>', '#', 'album_nopic' );
}
// Print first image
// if ( $cat_post_style !== 'bg_img' ) {
echo $item_first_image;
// }
echo '<div class="avatar_post">';
// Author Avatar
$Item->author( array(
'before_user' => '',
'after_user' => '',
'link_text' => 'only_avatar', // avatar_name | avatar_login | only_avatar | name | login | nickname | firstname | lastname | fullname | preferredname
'link_class' => 'author_avatar',
'thumb_size' => 'crop-64x64',
'thumb_class' => '',
) );
// Author Name
$Item->author( array(
// 'before' => T_('By '),
'after' => '',
'before_user' => '',
'after_user' => '',
'link_text' => 'fullname', // avatar_name | avatar_login | only_avatar | name | login | nickname | firstname | lastname | fullname | preferredname
'link_class' => 'author_avatar',
'thumb_size' => 'crop-48x48',
'thumb_class' => '',
) );
echo '</div>';
echo '<div class="evo_post_title">';
// Display a title
echo $Item->get_title( array(
'before' => '<h3>',
'after' => '</h3>',
) );
// We want to display the post time:
$Item->issue_time( array(
'before' => '<time class="date">',
'after' => '</time>',
'time_format' => 'F j, Y',
) );
// Link for editing
$Item->edit_link( array(
'before' => '<span class="edit_post">',
'after' => '</span>',
) );
echo '</div>';
// Restore previous locale (Blog locale)
locale_restore_previous();
if( $Item->status != 'published' )
{
$Item->format_status( array(
'template' => '<div class="evo_status evo_status__$status$ badge">$status_title$</div>',
) );
}
if( $Skin->get_setting( 'cat_post_excerpt' ) ) :
echo '<div class="evo_post__text">';
// We want excerpt here - shrinked post
echo $Item->excerpt( array(
'before' => '',
'after' => '',
'excerpt_more_text' => T_('Read More').'<span class="fa fa-angle-right"></span>',
) );
echo '</div> <!-- evo_post_text -->';
endif;
?>
<footer>
<?php // FOOTER OF THE POST
if( ! $Item->is_intro() ) // Do NOT apply tags, comments and feedback on intro posts
{ // List all tags attached to this post:
if ( $Skin->get_setting( 'cat_post_tags' ) == 1 ) :
$Item->tags( array(
'before' => '<nav class="post_tags">',
'after' => '</nav>',
'separator' => ' ',
) );
endif;
?>
<?php
if ( $Skin->get_setting( 'cat_post_comment' ) == 1 ) :
echo '<nav class="comment_info">';
// Link to comments, trackbacks, etc.:
$Item->feedback_link( array(
'type' => 'comments',
'link_before' => '',
'link_after' => '',
'link_text_zero' => '#',
'link_text_one' => '#',
'link_text_more' => '#',
'link_title' => '#',
'link_class' => 'comment_cat'
// fp> WARNING: creates problem on home page: 'link_class' => 'btn btn-default btn-sm',
// But why do we even have a comment link on the home page ? (only when logged in)
) );
// Link to comments, trackbacks, etc.:
$Item->feedback_link( array(
'type' => 'trackbacks',
'link_before' => ' • ',
'link_after' => '',
'link_text_zero' => '#',
'link_text_one' => '#',
'link_text_more' => '#',
'link_title' => '#',
) );
echo '</nav>';
endif;
?>
<?php } ?>
</footer>
</section> <!-- ../content_end_full -->
</div> <!-- .evo_post -->
<?php }
echo '</div>';
}
echo '</div><!-- end main_evo_post -->';
}
} // ---------------------------------- END OF POSTS ------------------------------------
if( $no_content_to_display )
{ // No category and no post in this blog
echo $params_no_content['before']
.( is_logged_in() ? $params_no_content['msg_empty_logged_in'] : $params_no_content['msg_empty_not_logged_in'] )
.$params_no_content['after'];
}
?>