/** * Retrieve the url of the author of the current comment. * * @param array|string $comment Comment array or comment id * * @return string */ public function getAuthorUrl($comment = null) { $this->getComment($comment); $url = 'http://' == $this->comment['Comment']['author_url'] ? '' : $this->comment['Comment']['author_url']; $url = HuradSanitize::url($url); return $this->Hook->applyFilters('Helper.Comment.getAuthorUrl', $url); }
function _dashboard_recent_comments_row($comment) { $this->Comment->setComment($comment['Comment']); ?> <div id="comment-<?php $this->Comment->commentID(); ?> " <?php $this->Comment->commentClass(array('comment-item', $this->Comment->getCommentStatus($comment['Comment']['status']))); ?> > <?php echo $this->Gravatar->image($this->Comment->getCommentAuthorEmail(), array('size' => '50')); ?> <div class="dashboard-comment-wrap"> <h4 class="comment-meta"> <?php echo __d('hurad', 'From'); ?> <cite class="comment-author"> <?php echo $this->Html->link($this->Comment->getCommentAuthor(), HuradSanitize::url($this->Comment->getCommentAuthorUrl()), array('class' => 'url', 'rel' => 'external nofollow')); ?> </cite> <?php echo __d('hurad', 'on'); ?> <a href="http://localhost/wp3en/wp-admin/post.php?post=1&action=edit"><?php echo $comment['Post']['title']; ?> </a> <a class="comment-link" href="http://localhost/wp3en/?p=1#comment-3">#</a> <span class="approve" <?php echo $comment['Comment']['status'] ? 'style="display: none;"' : 'style=""'; ?> ><?php echo __('[Pending]'); ?> </span> </h4> <blockquote> <p><?php $this->Comment->commentExcerpt(); ?> </p> </blockquote> <p class="row-actions"> <span class="approve" <?php echo $comment['Comment']['status'] ? 'style="display: none;"' : 'style=""'; ?> > <?php echo $this->Js->link(__d('hurad', 'Approve'), array('controller' => 'comments', 'action' => 'action', 'approved', $this->Comment->getCommentID()), array('success' => 'cApprove(' . $this->Comment->getCommentID() . ')')); ?> </span> <span class="unapprove" <?php echo $comment['Comment']['status'] ? 'style=""' : 'style="display: none;"'; ?> > <?php echo $this->Js->link(__d('hurad', 'Unapprove'), array('controller' => 'comments', 'action' => 'action', 'disapproved', $this->Comment->getCommentID()), array('success' => 'cUnapprove(' . $this->Comment->getCommentID() . ')')); ?> </span> <!-- <span class="reply hide-if-no-js"> | <a class="vim-r hide-if-no-js" href="#" title="Reply to this comment" onclick="commentReply.open('3','1');return false;">Reply</a> </span>--> <span class="edit"> | <?php echo $this->Html->link(__d('hurad', 'Edit'), array('admin' => true, 'controller' => 'comments', 'action' => 'edit', $this->Comment->getCommentID()), array('title' => 'Edit comment')); ?> </span> <span class="spam"> | <?php echo $this->Js->link(__d('hurad', 'Spam'), array('controller' => 'comments', 'action' => 'action', 'spam', $this->Comment->getCommentID()), array('success' => 'cSpam(' . $this->Comment->getCommentID() . ')')); ?> </span> <span class="trash"> | <?php echo $this->Js->link(__d('hurad', 'Trash'), array('controller' => 'comments', 'action' => 'action', 'trash', $this->Comment->getCommentID()), array('success' => 'cTrash(' . $this->Comment->getCommentID() . ')')); ?> </span> </p> </div> </div> <?php }
/** * Add comment */ public function add() { if ($this->request->is('post')) { $this->Comment->create(); if ($this->Auth->loggedIn()) { $user = $this->Comment->User->getUser($this->Auth->user('id')); $this->request->data['Comment']['user_id'] = $user['User']['id']; $this->request->data['Comment']['author'] = $user['UserMeta']['display_name']; $this->request->data['Comment']['author_email'] = $user['User']['email']; $this->request->data['Comment']['author_url'] = $user['User']['url']; } if ($this->Auth->user('role') == 'administrator') { $this->request->data['Comment']['author_url']; } $request = new CakeRequest(); $this->request->data['Comment']['author_ip'] = $request->clientIp(); $this->request->data['Comment']['agent'] = env('HTTP_USER_AGENT'); $this->request->data['Comment']['author_url'] = HuradSanitize::url($this->request->data['Comment']['author_url']); if ($this->Comment->save($this->request->data)) { $this->Hurad->sendEmail($this->request->data['Comment']['author_email'], __d('hurad', 'Comment Submit'), 'add_comment', __d('hurad', 'Your comment submit in blog waiting to approve by admin.')); $this->Session->setFlash(__d('hurad', 'The comment has been saved'), 'flash_message', ['class' => 'success'], 'comment-flash'); $this->redirect($this->referer()); } else { $this->Session->setFlash(__d('hurad', 'The comment could not be saved. Please, try again.'), 'flash_message', ['class' => 'danger'], 'comment-flash'); $this->redirect($this->referer()); } } }