/** * Add a entity like menu item * * @return void */ function ossn_entity_like_link($callback, $type, $params) { $guid = $params['entity']->guid; ossn_unregister_menu('like', 'entityextra'); if (!empty($guid)) { $likes = new OssnLikes(); if (!$likes->isLiked($guid, ossn_loggedin_user()->guid, 'entity')) { ossn_register_menu_item('entityextra', array('name' => 'like', 'href' => "javascript:;", 'id' => 'ossn-like-' . $guid, 'onclick' => "Ossn.EntityLike({$guid});", 'text' => ossn_print('ossn:like'))); } else { ossn_register_menu_item('entityextra', array('name' => 'like', 'href' => "javascript:;", 'id' => 'ossn-like-' . $guid, 'onclick' => "Ossn.EntityUnlike({$guid});", 'text' => ossn_print('ossn:unlike'))); } } }
} elseif ($comment->type == 'comments:post') { echo ' ' . $comment->getParam('comments:post'); } $image = $comment->getParam('file:comment:photo'); if (!empty($image)) { $image = str_replace('comment/photo/', '', $image); $image = ossn_site_url("comment/image/{$comment->id}/{$image}"); echo "<img src='{$image}' />"; } ?> </p> <div class="comment-metadata"> <?php echo ossn_user_friendly_time($comment->time_created); ?> <?php if (ossn_isLoggedIn()) { if (!$OssnLikes->isLiked($comment->id, ossn_loggedin_user()->guid, $type)) { echo ossn_plugin_view('output/url', array('href' => ossn_site_url("action/annotation/like?annotation={$comment->id}"), 'text' => ossn_print('like'), 'class' => 'ossn-like-comment', 'data-type' => 'Like', 'action' => true)); } else { echo ossn_plugin_view('output/url', array('href' => ossn_site_url("action/annotation/unlike?annotation={$comment->id}"), 'text' => ossn_print('unlike'), 'class' => 'ossn-like-comment', 'data-type' => 'Unlike', 'action' => true)); } } // Likes only for loggedin users end // Show total likes echo ossn_plugin_view('output/url', array('href' => 'javascript::;', 'text' => $likes_total, 'class' => "ossn-total-likes-{$comment->id}", 'data-likes' => $datalikes)); ?> </div> </div> </div>
* @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ $OssnLikes = new OssnLikes(); $OssnComments = new OssnComments(); $object = $params['entity_guid']; $count = $OssnLikes->CountLikes($object, 'entity'); if (ossn_isLoggedIn()) { ?> <div class="like_share comments-like-comment-links"> <div id="ossn-like-<?php echo $object; ?> " class="button-container"> <?php if (!$OssnLikes->isLiked($object, ossn_loggedin_user()->guid, 'entity')) { $link['onclick'] = "Ossn.EntityLike({$object});"; $link['href'] = 'javascript::;'; $link['text'] = ossn_print('ossn:like'); echo ossn_view('system/templates/link', $link); } else { $user_liked = true; $link['onclick'] = "Ossn.EntityUnlike({$object});"; $link['href'] = 'javascript::;'; $link['text'] = ossn_print('ossn:unlike'); echo ossn_view('system/templates/link', $link); } ?> </div> <span class="dot-comments">.</span> <a href="#comment-box-<?php echo $object;
/** * Open Source Social Network * * @packageOpen Source Social Network * @author Open Social Website Core Team <*****@*****.**> * @copyright 2014 iNFORMATIKON TECHNOLOGIES * @license General Public Licence http://www.opensource-socialnetwork.org/licence * @link http://www.opensource-socialnetwork.org/licence */ $OssnLikes = new OssnLikes(); $object = $params->guid; $count = $OssnLikes->CountLikes($object); $user_liked = ''; if (ossn_isLoggedIn()) { if ($OssnLikes->isLiked($object, ossn_loggedin_user()->guid)) { $user_liked = true; } } /* Likes and comments don't show for nonlogged in users */ if ($OssnLikes->CountLikes($object)) { ?> <div class="like_share"> <div class="ossn-like-icon"></div> <?php if ($user_liked == true && $count == 1) { ?> <?php echo ossn_print("ossn:liked:you"); ?> <?php