<p class="meta"> <?php echo JHTML::_('date', $comment->created, JText::_('ZOO_COMMENT_MODULE_DATE_FORMAT')); ?> | <a class="permalink" href="<?php echo JRoute::_(RouteHelper::getItemRoute($item) . '#comment-' . $comment->id); ?> ">#</a> </p> <?php } ?> <p class="content"> <?php echo CommentHelper::filterContentOutput(YString::truncate($comment->content, modZooCommentHelper::MAX_CHARACTERS)); ?> </p> </li> <?php $i++; } ?> </ul> <?php } else { ?> <?php
<?php if ($this->comment->state == Comment::STATE_UNAPPROVED) { ?> <span><?php echo JText::_('Not approved!'); ?> </span> <?php } ?> <?php echo JHTML::_('date', $this->comment->created, JText::_('DATE_FORMAT_LC2')); ?> </div> <p><?php echo CommentHelper::filterContentOutput($this->comment->content); ?> </p> <div class="actions-wrapper"> <span class="actions-links">› <a href="#" class="reply"><?php echo JText::_('Reply'); ?> </a> | <a href="#" class="edit"><?php echo JText::_('Edit'); ?> </a> | <?php if ($this->comment->state == Comment::STATE_UNAPPROVED) { ?>
public function save() { // check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // init vars $post = YRequest::get('post'); $cid = YRequest::getArray('cid.0', '', 'int'); $pid = YRequest::getInt('parent_id', 0); $now = JFactory::getDate(); try { // get content as raw and filter it $post['content'] = YRequest::getVar('content', null, '', 'string', JREQUEST_ALLOWRAW); $post['content'] = CommentHelper::filterContentInput($post['content']); // get comment table $table = YTable::getInstance('comment'); // get comment or create reply if ($cid) { $comment = $table->get($cid); } else { $parent = $table->get($pid); $comment = new Comment(); $comment->item_id = $parent->getItem()->id; $comment->user_id = $this->user->id; $comment->author = $this->user->name; $comment->email = $this->user->email; $comment->ip = CommentHelper::getClientIP(); $comment->created = $now->toMySQL(); $comment->state = Comment::STATE_APPROVED; } // bind post data $comment->bind($post); // save comment $table->save($comment); // get view $view = $this->getView(); // set view vars $view->option = $this->option; $view->comment = $comment; // display view $view->setLayout('_row'); $view->display(); } catch (YException $e) { // raise error on exception echo json_encode(array('group' => 'error', 'title' => JText::_('Error Saving Comment'), 'text' => (string) $e)); } }
public function getAvatar($size = 32) { if ($this->user_id) { $cache = new YCache(ZOO_CACHE_PATH . DS . 'author_cache.txt', true, 604800); $cache_check = $cache ? $cache->check() : false; $url = ''; // try to get avatar url from cache if ($cache_check) { $url = $cache->get($this->user_id); } // if url is empty, try to get avatar url from twitter if (empty($url)) { $info = CommentHelper::getTwitterFields($this->user_id, array('profile_image_url')); if (isset($info['profile_image_url'])) { $url = $info['profile_image_url']; } if ($cache_check) { $cache->set($this->user_id, $url); $cache->save(); } } if (!empty($url)) { return '<img alt="' . $this->name . '" title="' . $this->name . '" src="' . $url . '" height="' . $size . '" width="' . $size . '" />'; } } return parent::getAvatar($size); }
public static function activeAuthor() { if (!isset(self::$_author)) { // get login (joomla users always win) $login = YRequest::getString(self::COOKIE_PREFIX . 'login', '', 'cookie'); // get active user $user = JFactory::getUser(); if ($user->id) { // create author object from user self::$_author = new CommentAuthorJoomla($user->name, $user->email, '', $user->id); } else { if ($login == 'facebook' && ($connection = self::getFacebookClient()) && ($content = $connection->getCurrentUserProfile()) && isset($content->id) && isset($content->name)) { // create author object from facebook user id self::$_author = new CommentAuthorFacebook($content->name, null, null, $content->id); } else { if ($login == 'twitter' && ($connection = self::getTwitterClient()) && ($content = $connection->get('account/verify_credentials')) && isset($content->screen_name) && isset($content->id)) { // create author object from twitter user id self::$_author = new CommentAuthorTwitter($content->screen_name, null, null, $content->id); } else { self::twitterLogout(); self::facebookLogout(); // create author object from cookies $cookie = self::readCookies(); self::$_author = new CommentAuthor($cookie['author'], $cookie['email'], $cookie['url']); } } } } setcookie(CommentHelper::COOKIE_PREFIX . 'login', self::$_author->getUserType(), time() + CommentHelper::COOKIE_LIFETIME, '/'); return self::$_author; }
*/ // no direct access defined('_JEXEC') or die('Restricted access'); // include assets css/js if (strtolower(substr($GLOBALS['mainframe']->getTemplate(), 0, 3)) != 'yoo') { JHTML::stylesheet('reset.css', 'media/zoo/assets/css/'); } JHTML::stylesheet('zoo.css', $this->template->getURI() . '/assets/css/'); $css_class = $this->application->getGroup() . '-' . $this->template->name; ?> <div id="yoo-zoo" class="yoo-zoo <?php echo $css_class; ?> <?php echo $css_class . '-' . $this->item->alias; ?> "> <div class="item"> <?php echo $this->renderer->render('item.full', array('view' => $this, 'item' => $this->item)); ?> <?php echo CommentHelper::renderComments($this, $this->item); ?> </div> </div>
public function twitterLogout() { CommentHelper::twitterLogout(); $this->setRedirect(YRequest::getString('HTTP_REFERER', '', 'server')); }