/** * Renders an individual comment. * * @param WP_Comment $comment * @param array $args * @param int $depth * * @return void */ public static function renderComment($comment, $args, $depth) { $side = get_current_user_id() == $comment->user_id ? 'right' : 'left'; ?> <li id="comment-<?php print esc_attr($comment->comment_ID); ?> " <?php comment_class("media media-on-{$side}", $comment); ?> > <?php switch ($side) { case 'right': // Body first, then media. WP_Buoy_Chat_Room::renderCommentBody($comment, $args, $depth); WP_Buoy_Chat_Room::renderCommentMedia($side, $comment, $args, $depth); break; default: // Media first, then body. WP_Buoy_Chat_Room::renderCommentMedia($side, $comment, $args, $depth); WP_Buoy_Chat_Room::renderCommentBody($comment, $args, $depth); break; } ?> </li> <?php }
<?php /** * Template handler for the built-in WordPress chat functionality. * * @package WordPress\Plugin\WP_Buoy_Plugin\WP_Buoy_Alert\WordPress_Chat * * @copyright Copyright (c) 2015-2016 by Meitar "maymay" Moscovitz * * @license https://www.gnu.org/licenses/gpl-3.0.en.html */ /** Sets up the WordPress Environment. */ require dirname(__FILE__) . '/../../../../wp-load.php'; /** Loads the additional chat room class. */ require plugin_dir_path(dirname(__FILE__)) . 'class-buoy-chat-room.php'; nocache_headers(); if (!empty($_GET['hash']) && get_current_user_id()) { try { $buoy_chat_room = new WP_Buoy_Chat_Room($_GET['hash']); if ($buoy_chat_room->is_alerter(get_current_user_id()) || $buoy_chat_room->is_responder(get_current_user_id())) { $buoy_chat_room->render(); } } catch (Exception $e) { wp_die(__('You do not have sufficient permissions to access this page.', 'buoy')); } } wp_die(__('You do not have sufficient permissions to access this page.', 'buoy'));