Advertisement
nlozovan

Untitled

Mar 17th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.02 KB | None | 0 0
  1. static function list_view($post, $template = 'blog_page') {
  2. ?>
  3. <div id="post-<?php echo $post->ID; ?>" <?php post_class('post row' . tools::nsfw_class($post), $post->ID); ?>>
  4. <div <?php tools::list_content_class(0, $template, 'entry-header'); ?>>
  5. <?php
  6. $classes = tools::login_attr($post->ID, 'nsfw');
  7. $attr = tools::login_attr($post->ID, 'nsfw mosaic-overlay', get_permalink($post->ID));
  8. $size = 'tmedium';
  9. $s = image::asize( image::size( $post->ID , $template , $size ) );
  10.  
  11. if (options::logic('general', 'time')) {
  12. ?><div class="entry-date"><time><?php echo human_time_diff(get_the_time('U', $post->ID), current_time('timestamp')) . ' ' . __('ago', 'cosmotheme'); ?></time></div><?php
  13. } else {
  14. ?><div class="entry-date"><time><?php echo date_i18n(get_option('date_format'), get_the_time('U', $post->ID)); ?></time></div><?php
  15. }
  16.  
  17. if( get_post_format( $post -> ID ) == 'video' ){
  18. $format = meta::get_meta( $post -> ID , 'format' );
  19.  
  20. if( isset( $format['feat_id'] ) && !empty( $format['feat_id'] ) )
  21. {
  22. $video_id = $format['feat_id'];
  23. $video_type = 'self_hosted';
  24. if(isset($format['feat_url']) && post::isValidURL($format['feat_url']))
  25. {
  26. $vimeo_id = post::get_vimeo_video_id( $format['feat_url'] );
  27. $youtube_id = post::get_youtube_video_id( $format['feat_url'] );
  28.  
  29. if( $vimeo_id != '0' ){
  30. $video_type = 'vimeo';
  31. $video_id = $vimeo_id;
  32. }
  33.  
  34. if( $youtube_id != '0' ){
  35. $video_type = 'youtube';
  36. $video_id = $youtube_id;
  37. }
  38. }
  39.  
  40. if(isset($video_type) && isset($video_id) && is_user_logged_in () ){
  41. if($video_type == 'self_hosted'){
  42. $onclick = 'playVideo("'.urlencode(wp_get_attachment_url($video_id)).'","'.$video_type.'",jQuery(this))';
  43. }else{
  44. $onclick = 'playVideo("'.$video_id.'","'.$video_type.'",jQuery(this))';
  45. }
  46.  
  47. }else{
  48. $meta = meta::get_meta( $post -> ID , 'settings' );
  49. if( isset( $meta['safe'] ) ){
  50. if( !meta::logic( $post , 'settings' , 'safe' ) ){
  51. $onclick = 'playVideo("'.$video_id.'","'.$video_type.'",jQuery(this))';
  52. }
  53. }else{
  54. if($video_type == 'self_hosted'){
  55. $onclick = 'playVideo("'.urlencode(wp_get_attachment_url($video_id)).'","'.$video_type.'",jQuery(this))';
  56. }else{
  57. $onclick = 'playVideo("'.$video_id.'","'.$video_type.'",jQuery(this))';
  58. }
  59. }
  60. }
  61. }
  62. }
  63. ?>
  64. <?php if( has_post_thumbnail ( $post -> ID ) && get_post_type( $post -> ID ) != "text"){ ?>
  65. <div class="featimg readmore" <?php if(isset($onclick)){ echo "onclick=".$onclick; }?> >
  66. <div class="img">
  67. <?php
  68. if (has_post_thumbnail($post->ID)) {
  69. $src = image::thumbnail($post->ID, $template, $size);
  70. $caption = image::caption($post->ID);
  71.  
  72.  
  73. if (strlen($classes)) {
  74. ?>
  75. <a <?php echo $attr; ?>>
  76. <?php
  77. if ( get_post_format($post->ID) != 'video' ) {
  78. ?><div class="details"><?php _e('Read more', 'cosmotheme'); ?> <i class="cosmo-arrow">→</i></div><?php
  79. }
  80. ?>
  81. </a>
  82. <div class="format">&nbsp;</div>
  83. <?php echo image::mis($post->ID, $template, $size, 'safe image', 'nsfw'); ?>
  84. <?php
  85. if (options::logic('styling', 'stripes')) {
  86. ?><div class="stripes" >&nbsp;</div><?php
  87. }
  88. ?>
  89. <?php
  90. if (get_post_format($post->ID) == 'video') {
  91. echo '<div class="play">&nbsp;</div>';
  92. }
  93. ?>
  94. <?php
  95. } else {
  96. ?>
  97. <a href="<?php if(!isset($onclick)){ echo get_permalink( $post -> ID ); }else{ echo 'javascript:void(0)'; } ?>" title="<?php echo $caption ?>" class="mosaic-overlay" >
  98. <?php
  99. if ( get_post_format($post->ID) != 'video' ) {
  100. ?><div class="details"><?php _e('Read more', 'cosmotheme'); ?> <i class="cosmo-arrow">→</i></div><?php
  101. }
  102. ?>
  103. </a>
  104. <div class="format">&nbsp;</div>
  105. <img src="<?php echo $src[0]; ?>" alt="<?php echo $caption; ?>" >
  106. <?php
  107. if (options::logic('styling', 'stripes')) {
  108. ?><div class="stripes">&nbsp;</div><?php
  109. }
  110. ?>
  111. <?php
  112. if (get_post_format($post->ID) == 'video') {
  113. echo '<div class="play">&nbsp;</div>';
  114. }
  115. ?>
  116. <?php
  117. }
  118. } else{
  119. if (strlen($classes)) {
  120. ?>
  121. <a <?php echo $attr; ?> >
  122. <?php
  123. if ( get_post_format($post->ID) != 'video' ) {
  124. ?><div class="details"><?php _e('Read more', 'cosmotheme'); ?> <i class="cosmo-arrow">→</i></div><?php
  125. }
  126. ?>
  127. </a>
  128. <div class="format">&nbsp;</div>
  129. <?php echo image::mis($post->ID, $template, $size, 'safe image', 'nsfw'); ?>
  130. <?php
  131. if (options::logic('styling', 'stripes')) {
  132. ?><div class="stripes">&nbsp;</div><?php
  133. }
  134. ?>
  135. <?php
  136. if (get_post_format($post->ID) == 'video') {
  137. echo '<div class="play">&nbsp;</div>';
  138. }
  139. ?>
  140. <?php
  141. } else {
  142. ?>
  143. <a class="<?php echo $classes; ?> mosaic-overlay" href="<?php if(!isset($onclick)){ echo get_permalink( $post -> ID ); }else{ echo 'javascript:void(0)'; } ?>" >
  144. <?php
  145. if ( get_post_format($post->ID) != 'video' ) {
  146. ?><div class="details"><?php _e('Read more', 'cosmotheme'); ?> <i class="cosmo-arrow">→</i></div><?php
  147. }
  148. ?>
  149. </a>
  150. <div class="format">&nbsp;</div>
  151. <?php echo image::mis($post->ID, $template, $size, 'safe image', 'no.image'); ?>
  152. <?php
  153. if (options::logic('styling', 'stripes')) {
  154. ?><div class="stripes">&nbsp;</div><?php
  155. }
  156. ?>
  157. <?php
  158. if (get_post_format($post->ID) == 'video') {
  159. echo '<div class="play">&nbsp;</div>';
  160. }
  161. ?>
  162. <?php
  163. }
  164. }
  165. ?>
  166. </div>
  167. </div>
  168. <?php };?>
  169. </div>
  170. <div <?php tools::entry_class(0, $template, 'entry-content'); ?>>
  171. <h2 class="entry-title">
  172. <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>
  173. </h2>
  174. <?php
  175. if ( options::logic('general', 'meta') ) {
  176. self::shmeta($post);
  177. }
  178. ?>
  179. <div class="excerpt">
  180. <?php
  181. if ( is_user_logged_in() ) {
  182. $ln = 300; /*show first 300 characters*/
  183. post::get_excerpt($post, $ln = $ln);
  184. } else {
  185. if ( !tools::is_nsfw( $post -> ID ) ) {
  186. the_excerpt();
  187. }else{
  188. echo '<p>' . options::get_value( 'general' , 'nsfw_content' ) . '</p>';
  189. }
  190. }
  191. ?>
  192. </div>
  193. </div>
  194. </div>
  195. <?php
  196. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement