@@ -25,24 +25,24 @@ class Components {
2525 /**
2626 * Genereic card post and its variants
2727 *
28- * @param int $post_id : post or entry id.
29- * @param boolean $use_post_data : whether to use data from a post ID
30- * @param boolean $show_image : whether to show or not the image.
31- * @param boolean $is_stretch : Should the top image be stretched to fit container.
32- * @param boolean $is_video : is the post a video.
33- * @param boolean $has_button : should we show the action button?.
34- * @param boolean $has_border : should we show the border of the card?.
35- * @param boolean $has_content : should we show the except of the entry?.
36- * @param string $pre_title : string showed before the title.
37- * @param string $description : content of the card if it's not using post data.
38- * @param string $url : url of card if it's not using post data.
39- * @param string $title : title of the card if it's not using post data.
40- * @param string $date : date format of the card if it's not using post data.
41- * @param int $image_id : image id of the card if it's not using post data.
42- * @param string $direction : direction of the card `horizontal` or `vertical`.
43- * @param string $button_text : text of the button.
44- * @param string $button_size : size of the button big|small|tiny
45- * @param string $button_color : color of the button is_primary|donate|is-success|is-info|.is-warning|.is-danger
28+ * @param int $post_id : post or entry id.
29+ * @param boolean $use_post_data : whether to use data from a post ID
30+ * @param boolean $show_image : whether to show or not the image.
31+ * @param boolean $is_stretch : Should the top image be stretched to fit container.
32+ * @param boolean $is_video : is the post a video.
33+ * @param boolean $has_button : should we show the action button?.
34+ * @param boolean $has_border : should we show the border of the card?.
35+ * @param boolean $has_content : should we show the except of the entry?.
36+ * @param string $pre_title : string showed before the title.
37+ * @param string $description : content of the card if it's not using post data.
38+ * @param string $url : url of card if it's not using post data.
39+ * @param string $title : title of the card if it's not using post data.
40+ * @param string $date : date format of the card if it's not using post data.
41+ * @param int $image_id : image id of the card if it's not using post data.
42+ * @param string $direction : direction of the card `horizontal` or `vertical`.
43+ * @param string $button_text : text of the button.
44+ * @param string $button_size : size of the button big|small|tiny
45+ * @param string $button_color : color of the button is_primary|donate|is-success|is-info|.is-warning|.is-danger
4646 * @return string component layout
4747 */
4848 public static function card_post (
@@ -94,12 +94,12 @@ public static function card_post(
9494 $ out .= '<span class="subtitle"> ' . $ card_date . ' </span> ' ;
9595 }
9696 if ( $ has_content ) {
97- $ the_post = ( $ use_post_data ) ? get_post ( $ post_id ) : false ;
98- $ the_description = ( $ use_post_data ) ? do_excerpt ( $ the_post , array ( 'length ' => 110 ) ) : $ description ;
97+ $ the_post = ( $ use_post_data ) ? get_post ( $ post_id ) : false ;
98+ $ the_description = ( $ use_post_data ) ? do_excerpt ( $ the_post , array ( 'length ' => 110 ) ) : $ description ;
9999 $ filtered_content = apply_filters ( 'cc_theme_base_filter_card_content ' , $ the_description , $ post_id );
100- $ out .= '<div class="content"> ' ;
101- $ out .= $ filtered_content ;
102- $ out .= '</div> ' ;
100+ $ out .= '<div class="content"> ' ;
101+ $ out .= $ filtered_content ;
102+ $ out .= '</div> ' ;
103103 }
104104 if ( $ has_button ) {
105105 $ out .= self ::button ( $ button_text , $ card_url , $ button_size , $ button_color );
@@ -128,12 +128,12 @@ public static function card_post_event( $post_id, $has_content = true ) {
128128 $ out .= '<div class="card-content"> ' ;
129129 $ out .= '<h4 class="card-title"><a href=" ' . get_permalink ( $ post_id ) . '"> ' . get_the_title ( $ post_id ) . '</a></h4> ' ;
130130 if ( $ has_content ) {
131- $ the_post = get_post ( $ post_id );
132- $ entry_content = do_excerpt ( $ the_post );
131+ $ the_post = get_post ( $ post_id );
132+ $ entry_content = do_excerpt ( $ the_post );
133133 $ filtered_content = apply_filters ( 'cc_theme_base_filter_card_event_content ' , $ entry_content , $ post_id );
134- $ out .= '<div class="content"> ' ;
135- $ out .= $ filtered_content ;
136- $ out .= '</div> ' ;
134+ $ out .= '<div class="content"> ' ;
135+ $ out .= $ filtered_content ;
136+ $ out .= '</div> ' ;
137137 }
138138 $ out .= '<a href=" ' . get_permalink ( $ post_id ) . '" class="read-more">Read more <i class="icon chevron-right"></i></a> ' ;
139139 $ out .= '</div> ' ;
@@ -163,12 +163,12 @@ public static function card_statistic( $post_id, $number, $caption, $caption_is_
163163 $ out .= '</header> ' ;
164164 $ out .= '<div class="card-content"> ' ;
165165 if ( $ has_content ) {
166- $ the_post = get_post ( $ post_id );
167- $ entry_content = do_excerpt ( $ the_post );
166+ $ the_post = get_post ( $ post_id );
167+ $ entry_content = do_excerpt ( $ the_post );
168168 $ filtered_content = apply_filters ( 'cc_theme_base_filter_card_event_content ' , $ entry_content , $ post_id );
169- $ out .= '<div class="content"> ' ;
170- $ out .= $ filtered_content ;
171- $ out .= '</div> ' ;
169+ $ out .= '<div class="content"> ' ;
170+ $ out .= $ filtered_content ;
171+ $ out .= '</div> ' ;
172172 }
173173 if ( $ has_link ) {
174174 $ out .= '<a href=" ' . get_permalink ( $ post_id ) . '" class="read-more">Read more</a> ' ;
@@ -196,20 +196,20 @@ public static function card_quote( $post_id, $show_image = true, $author_name, $
196196 $ out .= '</figure> ' ;
197197 $ out .= '</header> ' ;
198198 }
199- $ out .= '<div class="card-content"> ' ;
200- $ out .= '<span class="quote"></span> ' ;
201- $ the_post = get_post ( $ post_id );
202- $ entry_content = apply_filters ( 'the_content ' , $ the_post ->post_content );
199+ $ out .= '<div class="card-content"> ' ;
200+ $ out .= '<span class="quote"></span> ' ;
201+ $ the_post = get_post ( $ post_id );
202+ $ entry_content = apply_filters ( 'the_content ' , $ the_post ->post_content );
203203 $ filtered_content = apply_filters ( 'cc_theme_base_filter_card_quote_content ' , $ entry_content , $ post_id );
204- $ out .= '<div class="content"> ' ;
205- $ out .= $ filtered_content ;
206- $ out .= '<div class="quote-author"> ' ;
207- $ out .= '<strong class="title"> ' . $ author_name . '</strong> ' ;
208- $ out .= '<p class="description"> ' . $ author_description . '</p> ' ;
209- $ out .= '</div> ' ;
210- $ out .= '</div> ' ;
211- $ out .= '</div> ' ;
212- $ out .= '</article> ' ;
204+ $ out .= '<div class="content"> ' ;
205+ $ out .= $ filtered_content ;
206+ $ out .= '<div class="quote-author"> ' ;
207+ $ out .= '<strong class="title"> ' . $ author_name . '</strong> ' ;
208+ $ out .= '<p class="description"> ' . $ author_description . '</p> ' ;
209+ $ out .= '</div> ' ;
210+ $ out .= '</div> ' ;
211+ $ out .= '</div> ' ;
212+ $ out .= '</article> ' ;
213213
214214 return $ out ;
215215 }
@@ -268,19 +268,19 @@ public static function card_link( $post_id = null, $use_post_data = false, $back
268268 $ color_class = ( ! $ has_border ) ? 'class="has-background- ' . $ background_color . '" ' : '' ;
269269 $ class = ( ! empty ( $ extra_class ) ) ? ' ' . $ extra_class : '' ;
270270
271- $ out = '<article class="card entry-post link ' . $ border_class . $ class . '"> ' ;
271+ $ out = '<article class="card entry-post link ' . $ border_class . $ class . '"> ' ;
272272 $ out .= '<a href=" ' . $ the_url . '" ' . $ color_class . '> ' ;
273273 $ out .= '<span class="card-content has-bottom-link"> ' ;
274274 $ out .= '<h2 class="card-title"> ' . $ the_title . '</h2> ' ;
275275 if ( $ has_content ) {
276276 if ( $ use_post_data ) {
277- $ the_post = get_post ( $ post_id );
278- $ get_content = do_excerpt ( $ the_post );
277+ $ the_post = get_post ( $ post_id );
278+ $ get_content = do_excerpt ( $ the_post );
279279 $ filtered_content = apply_filters ( 'cc_theme_base_filter_card_link_content ' , $ get_content , $ post_id );
280- $ the_content = $ filtered_content ;
280+ $ the_content = $ filtered_content ;
281281 } else {
282282 $ filtered_content = apply_filters ( 'cc_theme_base_filter_card_link_content ' , $ description , $ post_id );
283- $ the_content = $ filtered_content ;
283+ $ the_content = $ filtered_content ;
284284 }
285285 $ out .= '<span class="content"> ' . esc_attr ( $ description ) . '</span> ' ;
286286 }
@@ -348,44 +348,44 @@ public static function notification( $type = 'warning', $url, $title, $content,
348348
349349 return $ out ;
350350 }
351- /**
351+ /**
352352 * Simple entry
353353 *
354354 * @param int $post_id : post or entry ID.
355355 * @param boolean $has_content : whether to show or not the content excerpt.
356356 * @param boolean $has_image : whether to show or not the entry thumbnail.
357357 * @param boolean $use_remote_data : whether to use or not remote data providing each element separatedly
358- * @param string $title : the title of the entry
359- * @param string $image_url : the url of the entry featured image
360- * @param string $date : the date of the entry
361- * @param string $permalink : the permalink of the entry
362- * @param string $excerpt : the excerpt of the entry
358+ * @param string $title : the title of the entry
359+ * @param string $image_url : the url of the entry featured image
360+ * @param string $date : the date of the entry
361+ * @param string $permalink : the permalink of the entry
362+ * @param string $excerpt : the excerpt of the entry
363363 * @return string component layout
364364 */
365- public static function simple_entry ( $ post_id , $ has_content = true , $ has_image = true , $ use_remote_data = null , $ title = null , $ image_url = null , $ date = null , $ permalink = null , $ excerpt = null ) {
366- $ has_thumb = ( !$ use_remote_data ) ? has_post_thumbnail ( $ post_id ) : !empty ( $ image_url );
367- $ has_thumb_class = ( !empty ( $ has_thumb ) ) ? ' has-image ' : '' ;
368- $ external = ( $ use_remote_data ) ? ' target="_blank" ' : '' ;
365+ public static function simple_entry ( $ post_id , $ has_content = true , $ has_image = true , $ use_remote_data = null , $ title = null , $ image_url = null , $ date = null , $ permalink = null , $ excerpt = null ) {
366+ $ has_thumb = ( ! $ use_remote_data ) ? has_post_thumbnail ( $ post_id ) : ! empty ( $ image_url );
367+ $ has_thumb_class = ( ! empty ( $ has_thumb ) ) ? ' has-image ' : '' ;
368+ $ external = ( $ use_remote_data ) ? ' target="_blank" ' : '' ;
369369 $ out = '<article class="entry-simple-post ' . $ has_thumb_class . '"> ' ;
370370 $ out .= '<div class="columns is-gapless"> ' ;
371371 if ( $ has_thumb && $ has_image ) {
372- $ thumb_image = ( !$ use_remote_data ) ? get_the_post_thumbnail ( $ post_id , 'landscape-small ' ) : '<img src=" ' . $ image_url. '" alt=" ' . $ title. '" /> ' ;
373- $ out .= '<figure class="entry-image column is-4"> ' ;
374- $ out .= $ thumb_image ;
375- $ out .= '</figure> ' ;
372+ $ thumb_image = ( ! $ use_remote_data ) ? get_the_post_thumbnail ( $ post_id , 'landscape-small ' ) : '<img src=" ' . $ image_url . '" alt=" ' . $ title . '" /> ' ;
373+ $ out .= '<figure class="entry-image column is-4"> ' ;
374+ $ out .= $ thumb_image ;
375+ $ out .= '</figure> ' ;
376376 }
377- $ the_title = ( !$ use_remote_data ) ? get_the_title ( $ post_id ) : $ title ;
378- $ the_permalink = ( !$ use_remote_data ) ? get_permalink ( $ post_id ) : $ permalink ;
379- $ the_date = ( !$ use_remote_data ) ? get_the_date ( 'd F Y ' ) : mysql2date ( 'd F Y ' , $ date );
380- $ out .= '<div class="entry-content column"> ' ;
381- $ out .= '<h4 class="b-header"><a href=" ' . $ the_permalink . '" ' . $ external. '> ' . $ the_title . '</a></h4> ' ;
382- $ out .= '<span class="entry-date"> ' . $ the_date . '</span> ' ;
377+ $ the_title = ( ! $ use_remote_data ) ? get_the_title ( $ post_id ) : $ title ;
378+ $ the_permalink = ( ! $ use_remote_data ) ? get_permalink ( $ post_id ) : $ permalink ;
379+ $ the_date = ( ! $ use_remote_data ) ? get_the_date ( 'd F Y ' ) : mysql2date ( 'd F Y ' , $ date );
380+ $ out .= '<div class="entry-content column"> ' ;
381+ $ out .= '<h4 class="b-header"><a href=" ' . $ the_permalink . '" ' . $ external . '> ' . $ the_title . '</a></h4> ' ;
382+ $ out .= '<span class="entry-date"> ' . $ the_date . '</span> ' ;
383383 if ( $ has_content ) {
384- $ the_post = get_post ( $ post_id );
385- $ the_excerpt = ( !$ use_remote_data ) ? do_excerpt ( $ the_post ) : $ excerpt ;
386- $ out .= '<div class="entry-description"> ' ;
387- $ out .= $ the_excerpt ;
388- $ out .= '</div> ' ;
384+ $ the_post = get_post ( $ post_id );
385+ $ the_excerpt = ( ! $ use_remote_data ) ? do_excerpt ( $ the_post ) : $ excerpt ;
386+ $ out .= '<div class="entry-description"> ' ;
387+ $ out .= $ the_excerpt ;
388+ $ out .= '</div> ' ;
389389 }
390390 $ out .= '</div> ' ;
391391 $ out .= '</div> ' ;
@@ -395,24 +395,24 @@ public static function simple_entry( $post_id, $has_content = true, $has_image =
395395 /**
396396 * cc_logos
397397 *
398- * @param string $logo_name lettermark|letterheart
398+ * @param string $logo_name lettermark|letterheart
399399 * @param boolean $has_dark_background
400400 * @return void
401401 */
402- public static function cc_logos ($ logo_name = 'cc/logomark.svg#logomark ' , $ has_dark_background = false ) {
402+ public static function cc_logos ( $ logo_name = 'cc/logomark.svg#logomark ' , $ has_dark_background = false ) {
403403 $ out = '' ;
404404 if ( $ has_dark_background ) {
405405 $ out .= '<div class="has-text-white"> ' ;
406406 }
407407 $ default_image_size = '304 73 ' ;
408- $ image_size = apply_filters ('cc_theme_base_set_default_size_logo ' , $ default_image_size );
409- $ out .= '<svg ' ;
410- $ out .= ' class="logo" ' ;
411- $ out .= ' xmlns="http://www.w3.org/2000/svg" ' ;
412- $ out .= ' preserveAspectRatio="xMidyMid meet" ' ;
413- $ out .= ' viewBox="0 0 ' . $ image_size. '"> ' ;
414- $ out .= ' <use href=" ' . get_bloginfo ( 'template_directory ' ) . '/assets/img/logos/ ' . $ logo_name. '"></use> ' ;
415- $ out .= '</svg> ' ;
408+ $ image_size = apply_filters ( 'cc_theme_base_set_default_size_logo ' , $ default_image_size );
409+ $ out .= '<svg ' ;
410+ $ out .= ' class="logo" ' ;
411+ $ out .= ' xmlns="http://www.w3.org/2000/svg" ' ;
412+ $ out .= ' preserveAspectRatio="xMidyMid meet" ' ;
413+ $ out .= ' viewBox="0 0 ' . $ image_size . '"> ' ;
414+ $ out .= ' <use href=" ' . get_bloginfo ( 'template_directory ' ) . '/assets/img/logos/ ' . $ logo_name . '"></use> ' ;
415+ $ out .= '</svg> ' ;
416416 if ( $ has_dark_background ) {
417417 $ out .= '</div> ' ;
418418 }
0 commit comments