Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static function list_view($post, $template = 'blog_page') {
- ?>
- <div id="post-<?php echo $post->ID; ?>" <?php post_class('post row' . tools::nsfw_class($post), $post->ID); ?>>
- <div <?php tools::list_content_class(0, $template, 'entry-header'); ?>>
- <?php
- $classes = tools::login_attr($post->ID, 'nsfw');
- $attr = tools::login_attr($post->ID, 'nsfw mosaic-overlay', get_permalink($post->ID));
- $size = 'tmedium';
- $s = image::asize( image::size( $post->ID , $template , $size ) );
- if (options::logic('general', 'time')) {
- ?><div class="entry-date"><time><?php echo human_time_diff(get_the_time('U', $post->ID), current_time('timestamp')) . ' ' . __('ago', 'cosmotheme'); ?></time></div><?php
- } else {
- ?><div class="entry-date"><time><?php echo date_i18n(get_option('date_format'), get_the_time('U', $post->ID)); ?></time></div><?php
- }
- if( get_post_format( $post -> ID ) == 'video' ){
- $format = meta::get_meta( $post -> ID , 'format' );
- if( isset( $format['feat_id'] ) && !empty( $format['feat_id'] ) )
- {
- $video_id = $format['feat_id'];
- $video_type = 'self_hosted';
- if(isset($format['feat_url']) && post::isValidURL($format['feat_url']))
- {
- $vimeo_id = post::get_vimeo_video_id( $format['feat_url'] );
- $youtube_id = post::get_youtube_video_id( $format['feat_url'] );
- if( $vimeo_id != '0' ){
- $video_type = 'vimeo';
- $video_id = $vimeo_id;
- }
- if( $youtube_id != '0' ){
- $video_type = 'youtube';
- $video_id = $youtube_id;
- }
- }
- if(isset($video_type) && isset($video_id) && is_user_logged_in () ){
- if($video_type == 'self_hosted'){
- $onclick = 'playVideo("'.urlencode(wp_get_attachment_url($video_id)).'","'.$video_type.'",jQuery(this))';
- }else{
- $onclick = 'playVideo("'.$video_id.'","'.$video_type.'",jQuery(this))';
- }
- }else{
- $meta = meta::get_meta( $post -> ID , 'settings' );
- if( isset( $meta['safe'] ) ){
- if( !meta::logic( $post , 'settings' , 'safe' ) ){
- $onclick = 'playVideo("'.$video_id.'","'.$video_type.'",jQuery(this))';
- }
- }else{
- if($video_type == 'self_hosted'){
- $onclick = 'playVideo("'.urlencode(wp_get_attachment_url($video_id)).'","'.$video_type.'",jQuery(this))';
- }else{
- $onclick = 'playVideo("'.$video_id.'","'.$video_type.'",jQuery(this))';
- }
- }
- }
- }
- }
- ?>
- <?php if( has_post_thumbnail ( $post -> ID ) && get_post_type( $post -> ID ) != "text"){ ?>
- <div class="featimg readmore" <?php if(isset($onclick)){ echo "onclick=".$onclick; }?> >
- <div class="img">
- <?php
- if (has_post_thumbnail($post->ID)) {
- $src = image::thumbnail($post->ID, $template, $size);
- $caption = image::caption($post->ID);
- if (strlen($classes)) {
- ?>
- <a <?php echo $attr; ?>>
- <?php
- if ( get_post_format($post->ID) != 'video' ) {
- ?><div class="details"><?php _e('Read more', 'cosmotheme'); ?> <i class="cosmo-arrow">→</i></div><?php
- }
- ?>
- </a>
- <div class="format"> </div>
- <?php echo image::mis($post->ID, $template, $size, 'safe image', 'nsfw'); ?>
- <?php
- if (options::logic('styling', 'stripes')) {
- ?><div class="stripes" > </div><?php
- }
- ?>
- <?php
- if (get_post_format($post->ID) == 'video') {
- echo '<div class="play"> </div>';
- }
- ?>
- <?php
- } else {
- ?>
- <a href="<?php if(!isset($onclick)){ echo get_permalink( $post -> ID ); }else{ echo 'javascript:void(0)'; } ?>" title="<?php echo $caption ?>" class="mosaic-overlay" >
- <?php
- if ( get_post_format($post->ID) != 'video' ) {
- ?><div class="details"><?php _e('Read more', 'cosmotheme'); ?> <i class="cosmo-arrow">→</i></div><?php
- }
- ?>
- </a>
- <div class="format"> </div>
- <img src="<?php echo $src[0]; ?>" alt="<?php echo $caption; ?>" >
- <?php
- if (options::logic('styling', 'stripes')) {
- ?><div class="stripes"> </div><?php
- }
- ?>
- <?php
- if (get_post_format($post->ID) == 'video') {
- echo '<div class="play"> </div>';
- }
- ?>
- <?php
- }
- } else{
- if (strlen($classes)) {
- ?>
- <a <?php echo $attr; ?> >
- <?php
- if ( get_post_format($post->ID) != 'video' ) {
- ?><div class="details"><?php _e('Read more', 'cosmotheme'); ?> <i class="cosmo-arrow">→</i></div><?php
- }
- ?>
- </a>
- <div class="format"> </div>
- <?php echo image::mis($post->ID, $template, $size, 'safe image', 'nsfw'); ?>
- <?php
- if (options::logic('styling', 'stripes')) {
- ?><div class="stripes"> </div><?php
- }
- ?>
- <?php
- if (get_post_format($post->ID) == 'video') {
- echo '<div class="play"> </div>';
- }
- ?>
- <?php
- } else {
- ?>
- <a class="<?php echo $classes; ?> mosaic-overlay" href="<?php if(!isset($onclick)){ echo get_permalink( $post -> ID ); }else{ echo 'javascript:void(0)'; } ?>" >
- <?php
- if ( get_post_format($post->ID) != 'video' ) {
- ?><div class="details"><?php _e('Read more', 'cosmotheme'); ?> <i class="cosmo-arrow">→</i></div><?php
- }
- ?>
- </a>
- <div class="format"> </div>
- <?php echo image::mis($post->ID, $template, $size, 'safe image', 'no.image'); ?>
- <?php
- if (options::logic('styling', 'stripes')) {
- ?><div class="stripes"> </div><?php
- }
- ?>
- <?php
- if (get_post_format($post->ID) == 'video') {
- echo '<div class="play"> </div>';
- }
- ?>
- <?php
- }
- }
- ?>
- </div>
- </div>
- <?php };?>
- </div>
- <div <?php tools::entry_class(0, $template, 'entry-content'); ?>>
- <h2 class="entry-title">
- <a <?php echo tools::login_attr($post->ID, 'nsfw', get_permalink($post->ID)) ?> title="<?php _e('Permalink to', 'cosmotheme'); ?> <?php echo $post->post_title; ?>" rel="bookmark"><?php echo $post->post_title; ?></a>
- </h2>
- <?php
- if ( options::logic('general', 'meta') ) {
- self::shmeta($post);
- }
- ?>
- <div class="excerpt">
- <?php
- if ( is_user_logged_in() ) {
- $ln = 300; /*show first 300 characters*/
- post::get_excerpt($post, $ln = $ln);
- } else {
- if ( !tools::is_nsfw( $post -> ID ) ) {
- the_excerpt();
- }else{
- echo '<p>' . options::get_value( 'general' , 'nsfw_content' ) . '</p>';
- }
- }
- ?>
- </div>
- </div>
- </div>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement