<?php 
$post_shared_from = array();
$current_post = $wo['current_post'] = $wo['story'];
 ?>
<div class="post-container">
  <div class="post<?php echo (!empty($wo['story']['post_is_promoted'])) ? ' boosted': '';?>" id="post-<?php echo $wo['story']['id']; ?>" data-post-id="<?php echo $wo['story']['id'];?>" <?php if( isset( $wo['story']['LastTotal'] ) ) { echo 'data-post-total="'.$wo['story']['LastTotal'].'"'; }?> <?php if( isset( $wo['story']['ids'] ) ) { echo 'data-post-ids="'.$wo['story']['ids'].'"'; }?> <?php if( isset( $wo['story']['dt'] ) ) { echo 'data-post-dt="'.$wo['story']['dt'].'"'; }?> data-post-type="<?php if (!empty($wo['story']['parent_id'])) { echo('share'); } ?>">
    <?php
      if (empty($wo['page'])) {
        $wo['page'] = 'home';
      }
     if ($wo['story']['is_post_pinned'] === true && ($wo['page'] == 'timeline' || $wo['page'] == 'events' || $wo['page'] == 'page' || $wo['page'] == 'group' )) {?>
    <div class="pin-icon" data-toggle="tooltip" title="<?php echo $wo['lang']['pinned_post'];?>">
      <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bookmark"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path></svg>
    </div>
    <?php } ?>
    <div class="panel panel-white panel-shadow">
      <!-- header -->
      <?php include 'header.phtml'; ?>
      <!-- header -->

      <div class="post-description" id="post-description-<?php echo $wo['story']['id']; ?>">
        <?php if (!empty($wo['story']['parent_id'])) { ?>
        <div><p class="edited_text"><?php echo $wo['story']['postText']; ?></p></div>
        <?php } ?>

        <!-- shared_post -->
         <?php include 'shared_post.phtml'; ?>
        <!-- shared_post -->
		
		<?php  if (empty($current_post['parent_id'])) { ?>
      <!-- product -->
       <?php include 'product.phtml'; ?>
      <!-- product -->

      <!-- feeling -->
      <?php include 'feeling.phtml'; ?>
      <!-- feeling -->

      <!-- colored post -->
      <?php include 'colored.phtml'; ?>
      <!-- colored post -->
       
      <!-- embed -->
      <?php include 'embed.phtml'; ?>
      <!-- embed -->
        
        <!-- postMap -->
        <?php if(!empty($wo['story']['postMap']) && empty($wo['story']['postVine']) && empty($wo['story']['postSoundCloud']) && empty($wo['story']['postVimeo']) && empty($wo['story']['postDailymotion']) && empty($wo['story']['postYoutube']) && empty($wo['story']['postPlaytube']) && empty($wo['story']['postDeepsound']) && empty($wo['story']['postFile']) && $wo['config']['google_map'] == 1) { ?>
        <div class="post-map">
          <img src="https://maps.googleapis.com/maps/api/staticmap?center=<?php echo $wo['story']['postMap'];?>&zoom=13&size=600x250&maptype=roadmap&markers=color:red%7C<?php echo $wo['story']['postMap'];?>&key=<?php echo $wo['config']['google_map_api'];?>" width="100%">
        </div>
        <?php } ?>
        <!-- postMap -->

        <!-- fetched_url -->
         <?php include 'fetched_url.phtml'; ?>
        <!-- fetched_url -->

        <!-- event -->
         <?php include 'event.phtml'; ?>
        <!-- event -->

        <!-- blog -->
         <?php include 'blog.phtml'; ?>
        <!-- blog -->
        
        <!-- postFile -->
        <?php if(!empty($wo['story']['postFile'])) { ?>

        <div class="post-file wo_shared_doc_file">
          <!-- <div style="width: 100%;height: 100%;position: absolute;background-color: rgba(0,0,0,0.3);filter: blur(5px);"></div> -->
            <?php
            $media = array(
                'type' => 'post',
                'storyId' => $wo['story']['id'],
                'filename' => $wo['story']['postFile'],
                'name' => $wo['story']['postFileName'],
                'postFileThumb' => $wo['story']['postFileThumb'],
            );
            echo Wo_DisplaySharedFile($media, '', $wo['story']['cache']);
            ?>
        </div>

        <?php } ?>
        <!-- postFile -->

        <!-- postSticker -->
        <?php if (Wo_IsUrl($wo['story']['postSticker'])): ?>
          <div class="post-file wo_video_post">
            <?php if (strpos('.mp4', $wo['story']['postSticker'])) { ?>
            <video autoplay loop><source src="<?php echo $wo['story']['postSticker']; ?>" type="video/mp4"></video>
            <?php } else { ?>
            <img src="<?php echo $wo['story']['postSticker']; ?>" alt="GIF">
            <?php } ?>
          </div>
        <?php endif; ?>
        <!-- postSticker -->

        <!-- postPhoto -->
        <?php if (Wo_IsUrl($wo['story']['postPhoto'])): ?>
          <div class="post-file" id="fullsizeimg">
            <img src="<?php echo $wo['story']['postPhoto']; ?>" alt="Picture">
          </div>
        <?php endif; ?>
        <!-- postPhoto -->

        <!-- postRecord -->
        <?php if(!empty($wo['story']['postRecord'])) { ?>
        <div class="post-file">
            <?php  
              $media = array(
                'type' => 'post',
                'storyId' => $wo['story']['id'],
                'filename' => $wo['story']['postRecord'],
                'name' => ''
              );
              echo  Wo_DisplaySharedFile($media,'record');
            ?>
        </div>
        <?php } ?>
        <!-- postRecord -->

        
        <div id="fullsizeimg" style="position: relative;">
          <!-- photo_album -->
            <?php include 'photo_album.phtml'; ?>
          <!-- photo_album -->


          <!-- multi_image -->
            <?php include 'photo_multi.phtml'; ?>
          <!-- multi_image -->
        
        <div class="clear"></div>
        </div>
        <!-- poll -->
        <?php
        if ($wo['story']['poll_id'] == 1) {
           echo Wo_LoadPage('story/entries/options');
        }
        ?>
        <!-- poll -->
         <?php } ?>
        <div class="clear"></div>
        <!-- footer -->
         <?php include 'footer.phtml'; ?>
        <!-- footer -->
        
      <?php 
        if ($wo['loggedin'] == true) {
            echo Wo_LoadPage('modals/edit-post');
            echo Wo_LoadPage('modals/delete-post');
        }
        ?>
    </div>
  </div>
</div>

<script type="text/javascript">
$(function () {
	$("#post-<?php echo $wo['story']['id']; ?> .post-description p, .product-description").readmore({
      speed: 75,
      moreLink: '<a href="#" class="hash"><?php echo $wo["lang"]["read_more"];?></a>',
      lessLink: '<a href="#" class="hash"><?php echo $wo["lang"]["read_less"];?></a>'
    });

    <?php if (!empty($wo['story']['product_id'])): ?>
       $(".product-description-<?php echo $wo['story']['product_id']; ?>").readmore({
        speed: 75,
        moreLink: '<a href="#" class="hash"><?php echo $wo["lang"]["read_more"];?></a>',
        lessLink: '<a href="#" class="hash"><?php echo $wo["lang"]["read_less"];?></a>'
      });
    <?php endif; ?>
    $("#post-<?php echo $wo['story']['id']; ?> .textarea").triggeredAutocomplete({
       hidden: '#hidden_inputbox_comment',
       source: Wo_Ajax_Requests_File() + "?f=mention",
       trigger: "@" 
    });
    $('[data-toggle="tooltip"]').tooltip();
    $('.dropdown-menu.post-recipient, .dropdown-menu.post-options, .wo_emoji_post').click(function (e) {
      e.stopPropagation();
    });
});

jQuery(document).click(function(event){
    if (!(jQuery(event.target).closest(".remove_combo_on_click").length)) {
        jQuery('.remove_combo_on_click').removeClass('comment-toggle');
    }
});


</script>