本文整理汇总了PHP中e107::getComment方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getComment方法的具体用法?PHP e107::getComment怎么用?PHP e107::getComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类e107
的用法示例。
在下文中一共展示了e107::getComment方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderMenu
/**
* Render menu.
*/
function renderMenu()
{
$tpl = e107::getTemplate('nodejs_comment');
$sc = e107::getScBatch('nodejs_comment', true);
$tp = e107::getParser();
$cm = e107::getComment();
$amount = (int) vartrue($this->plugPrefs['comment_display'], 10);
/**
* getCommentData() returns with array, which contains:
* - comment_datestamp
* - comment_author_id
* - comment_author
* - comment_comment
* - comment_subject
* - comment_type
* - comment_title
* - comment_url
*/
$items = $cm->getCommentData($amount);
$text = $tp->parseTemplate($tpl['MENU']['LATEST']['HEADER'], true, $sc);
foreach ($items as $item) {
$sc->setVars($item);
$text .= $tp->parseTemplate($tpl['MENU']['LATEST']['ITEM'], true, $sc);
}
if (empty($items)) {
$text .= '<a href="#" class="list-group-item no-posts text-center">' . LAN_PLUGIN_NODEJS_COMMENT_FRONT_05 . '</a>';
}
$text .= $tp->parseTemplate($tpl['MENU']['LATEST']['FOOTER'], true, $sc);
e107::getRender()->tablerender(LAN_PLUGIN_NODEJS_COMMENT_FRONT_04, $text);
unset($text);
}
示例2: comment_type
function comment_type($curVal, $mode)
{
if ($mode == 'read') {
return e107::getComment()->getTable($curVal);
return $curVal . ' (custom!)';
}
if ($mode == 'filter') {
$sql = e107::getDb();
$sql->db_Select_gen('SELECT * FROM #comments GROUP BY comment_type');
while ($row = $sql->db_Fetch()) {
$id = $row['comment_type'];
$list[$id] = e107::getComment()->getTable($id);
}
return $list;
}
if ($mode == 'batch') {
$types = e107::getComment()->known_types;
asort($types);
return $types;
}
}
示例3: nodejs_comment_event_postcomment_callback
/**
* Event callback after triggering "postcomment".
*
* @param array $comment
* Comment item.
*
* $comment contains:
* - comment_pid
* - comment_item_id
* - comment_subject
* - comment_author_id
* - comment_author_name
* - comment_author_email
* - comment_datestamp
* - comment_comment
* - comment_blocked
* - comment_ip
* - comment_type
* - comment_lock
* - comment_share
* - comment_nick
* - comment_time
* - comment_id
*
* getCommentData() returns with array, which contains:
* - comment_datestamp
* - comment_author_id
* - comment_author
* - comment_comment
* - comment_subject
* - comment_type
* - comment_title
* - comment_url
*/
function nodejs_comment_event_postcomment_callback($comment)
{
e107_require_once(e_PLUGIN . 'nodejs/nodejs.main.php');
$tpl = e107::getTemplate('nodejs_comment');
$sc = e107::getScBatch('nodejs_comment', true);
$tp = e107::getParser();
$cm = e107::getComment();
$cid = (int) vartrue($comment['comment_id'], 0);
$pid = (int) vartrue($comment['comment_pid'], 0);
$uid = (int) vartrue($comment['comment_author_id'], 0);
$commentData = $cm->getCommentData(1, 0, 'comment_id=' . $cid);
if (!isset($commentData[0])) {
return;
}
$authorData = e107::user($uid);
// Send notification to everyone for updating latest comments menu.
$sc->setVars($commentData[0]);
$markup = $tp->parseTemplate($tpl['MENU']['LATEST']['ITEM'], true, $sc);
$message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsCommentMenu', 'type' => 'latestComments', 'markup' => $markup);
nodejs_enqueue_message($message);
// Send notification to everyone for notifying about new comment.
$sc->setVars(array('account' => $authorData, 'comment' => $commentData[0]));
$markup = $tp->parseTemplate($tpl['NOTIFICATION']['POST_ALL'], true, $sc);
$message = (object) array('broadcast' => true, 'channel' => 'nodejs_notify', 'callback' => 'nodejsComments', 'type' => 'newCommentAny', 'markup' => $markup, 'exclude' => $authorData['user_id']);
nodejs_enqueue_message($message);
// Reply on comment.
if ($pid > 0) {
$commentParentData = $cm->getCommentData(1, 0, 'comment_id=' . $pid);
array_pop($commentParentData);
$authorParentData = e107::user();
// Send notification to author of parent comment for notifying about new reply.
$sc->setVars(array('account' => $authorData, 'comment' => $commentData[0]));
$markup = $tp->parseTemplate($tpl['NOTIFICATION']['POST_OWN'], true, $sc);
$message = (object) array('channel' => 'nodejs_user_' . $authorParentData['user_id'], 'callback' => 'nodejsComments', 'type' => 'newCommentOwn', 'markup' => $markup, 'exclude' => $authorData['user_id']);
nodejs_enqueue_message($message);
}
}
示例4: pageComment
function pageComment($page_comment_flag)
{
if ($page_comment_flag) {
$cobj = e107::getComment();
if (isset($_POST['commentsubmit'])) {
$cobj->enter_comment($_POST['author_name'], $_POST['comment'], "page", $this->pageID, $pid, $_POST['subject']);
$e107cache = e107::getCache();
$e107cache->clear("comment.page." . $this->pageID);
$e107cache->clear($this->cacheString);
}
return $cobj->compose_comment("page", "comment", $this->pageID, 0, $this->title, false, true);
}
}
示例5: form
}
if (!e107::isInstalled('links_page')) {
e107::redirect();
exit;
}
$link_shortcodes = e107::getScBatch('links_page', TRUE);
require_once e_PLUGIN . 'links_page/link_defines.php';
require_once e_HANDLER . "userclass_class.php";
$eArrayStorage = e107::getArrayStorage();
$db = e107::getDb();
$mes = e107::getMessage();
require_once e_HANDLER . "form_handler.php";
$rs = new form();
require_once e_HANDLER . "file_class.php";
$fl = new e_file();
$cobj = e107::getComment();
require_once e_PLUGIN . 'links_page/link_class.php';
$lc = new linkclass();
global $tp;
$linkspage_pref = e107::pref('links_page');
$deltest = array_flip($_POST);
$from = "0";
if (e_QUERY) {
$qs = explode(".", e_QUERY);
// needed to have less regex
$qs = array_filter($qs, 'strlen');
if (is_numeric($qs[0])) {
$from = array_shift($qs);
} else {
$from = "0";
}
示例6: time
$row['comment_comment'] = $tp->toDB($_POST['comment']);
$row['user_image'] = USERIMAGE;
$row['user_id'] = USERID ? USERID : 0;
$row['user_name'] = USERNAME;
$row['comment_author_name'] = $tp->toDB($clean_authorname);
$row['comment_author_id'] = USERID ? USERID : 0;
$row['comment_datestamp'] = time();
$row['comment_blocked'] = check_class($pref['comments_moderate']) ? 2 : 0;
$row['comment_share'] = $_POST['comment_share'];
$newid = e107::getComment()->enter_comment($row);
// $newid = e107::getComment()->enter_comment($clean_authorname, $clean_comment, $_POST['table'], intval($_POST['itemid']), $pid, $clean_subject);
if (is_numeric($newid) && $_GET['mode'] == 'submit') {
$row['comment_id'] = $newid;
$width = $pid ? 1 : 0;
$ret['html'] = "\n<!-- Appended -->\n<li>";
$ret['html'] .= e107::getComment()->render_comment($row, 'comments', 'comment', intval($_POST['itemid']), $width);
$ret['html'] .= "</li>\n<!-- end Appended -->\n";
$ret['error'] = false;
} else {
$ret['error'] = true;
$ret['msg'] = $newid;
}
echo json_encode($ret);
}
exit;
}
require_once e_HANDLER . "news_class.php";
// FIXME shouldn't be here.
require_once e_HANDLER . "comment_class.php";
define("PAGE_NAME", LAN_COMMENTS);
if (!e_QUERY) {
示例7: sc_profile_comments
function sc_profile_comments($parm)
{
if (e107::getPref('profile_comments')) {
$ret = e107::getComment()->compose_comment('profile', 'comment', $this->var['user_id'], null, $this->var['user_name'], FALSE, true);
return e107::getRender()->tablerender($ret['caption'], $ret['comment_form'] . $ret['comment'], 'profile_comments', TRUE);
}
return "";
}
示例8: define
if (deftrue('BOOTSTRAP')) {
define("IMAGE_DOWNLOAD", file_exists(THEME . "images/download.png") ? THEME . "images/download.png" : e_IMAGE . "generic/download.png");
define("IMAGE_NEW", file_exists(THEME . "images/new.png") ? THEME . "images/new.png" : 'icon-star.glyph');
} else {
define("IMAGE_DOWNLOAD", file_exists(THEME . "images/download.png") ? THEME . "images/download.png" : e_IMAGE . "generic/download.png");
define("IMAGE_NEW", file_exists(THEME . "images/new.png") ? THEME . "images/new.png" : e_IMAGE . "generic/new.png");
}
$dl->init();
// Legacy Comment Save.
if (isset($_POST['commentsubmit'])) {
if (!$sql->select("download", "download_comment", "download_id = '{$id}' ")) {
header("location:" . e_BASE . "index.php");
exit;
} else {
$dlrow = $sql->fetch();
if ($dlrow['download_comment'] && (ANON === TRUE || USER === TRUE)) {
$clean_authorname = $_POST['author_name'];
$clean_comment = $_POST['comment'];
$clean_subject = $_POST['subject'];
e107::getComment()->enter_comment($clean_authorname, $clean_comment, "download", $id, $pid, $clean_subject);
// $e107cache->clear("comment.download.{$sub_action}"); $sub_action not used here
e107::getCache()->clear("comment.download");
}
}
}
$texts = $dl->render();
// Load before header.
require_once HEADERF;
echo $texts;
require_once FOOTERF;
exit;
示例9: header
*
* Copyright (C) 2008-2014 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* Exists only for BC.
*/
require_once "../class2.php";
if (!getperms("B")) {
header("location:" . e_BASE . "index.php");
exit;
}
$tmp = explode(".", e_QUERY);
$table = $tmp[0];
$id = intval($tmp[1]);
$editid = intval($tmp[2]);
$url = e_ADMIN_ABS . "comment.php?searchquery=" . $id . "&filter_options=comment_type__" . e107::getComment()->getCommentType($table);
e107::getRedirect()->go($url);
exit;
/*
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
require_once("auth.php");
require_once(e_HANDLER."comment_class.php");
$cobj = new comment;
$tp = e107::getParser();
$tmp = explode(".", e_QUERY);
$table = $tmp[0];
$id = intval($tmp[1]);
$editid = intval($tmp[2]);
示例10: renderView
/**
* Render a single download
* @todo cache
*/
private function renderView()
{
if (deftrue('BOOTSTRAP')) {
$template = e107::getTemplate('download', 'download', 'view');
$DOWNLOAD_VIEW_TABLE_START = varset($template['start']);
$DOWNLOAD_VIEW_TABLE = $template['item'];
$DOWNLOAD_VIEW_TABLE_END = varset($template['end']);
$DL_VIEW_NEXTPREV = varset($template['nextprev']);
// $DL_VIEW_PAGETITLE = varset($template['pagetitle']);
$DL_VIEW_CAPTION = varset($template['caption'], "{DOWNLOAD_VIEW_CAPTION}");
} else {
$template_name = 'download_template.php';
if (is_readable(THEME . "templates/" . $template_name)) {
require_once THEME . "templates/" . $template_name;
} elseif (is_readable(THEME . $template_name)) {
require_once THEME . $template_name;
} else {
require_once e_PLUGIN . "download/templates/" . $template_name;
}
}
$sql = e107::getDb();
$tp = e107::getParser();
$ns = e107::getRender();
$gen = new convert();
$sc = e107::getScBatch('download', true);
$sc->wrapper('download/view');
$sc->qry = $this->qry;
$highlight_search = FALSE;
if (isset($_POST['highlight_search'])) {
$highlight_search = TRUE;
}
$query = "\n\t\t\tSELECT d.*, dc.* FROM #download AS d\n\t\t\tLEFT JOIN #download_category AS dc ON d.download_category = dc.download_category_id\n\t\t\tWHERE d.download_id = {$this->qry['id']} AND d.download_active > 0\n\t\t\tAND d.download_visible IN (" . USERCLASS_LIST . ")\n\t\t\tAND dc.download_category_class IN (" . USERCLASS_LIST . ")\n\t\t\tLIMIT 1";
if (!$sql->gen($query)) {
//require_once(HEADERF);
return $ns->tablerender(LAN_PLUGIN_DOWNLOAD_NAME, "<div style='text-align:center'>" . LAN_NO_RECORDS_FOUND . "</div>", 'download-view', true);
//require_once(FOOTERF);
//exit;
}
$dlrow = $sql->fetch();
$sc->setVars($dlrow);
// $comment_edit_query = 'comment.download.'.$id;
if (!defined("DL_IMAGESTYLE")) {
define("DL_IMAGESTYLE", "border:0px");
}
if (!isset($DL_VIEW_PAGETITLE)) {
$DL_VIEW_PAGETITLE = LAN_PLUGIN_DOWNLOAD_NAME . " / {DOWNLOAD_CATEGORY} / {DOWNLOAD_VIEW_NAME}";
}
$DL_TITLE = $tp->parseTemplate($DL_VIEW_PAGETITLE, TRUE, $sc);
define("e_PAGETITLE", $DL_TITLE);
$DL_TEMPLATE = $DOWNLOAD_VIEW_TABLE_START . $DOWNLOAD_VIEW_TABLE . $DOWNLOAD_VIEW_TABLE_END;
$text = $tp->parseTemplate($this->templateHeader, TRUE, $sc);
$text .= $tp->parseTemplate($DL_TEMPLATE, TRUE, $sc);
if (!isset($DL_VIEW_NEXTPREV)) {
$DL_VIEW_NEXTPREV = "\n\t\t\t<div style='text-align:center'>\n\t\t\t\t<table style='" . USER_WIDTH . "'>\n\t\t\t\t<tr>\n\t\t\t\t<td style='width:40%;'>{DOWNLOAD_VIEW_PREV}</td>\n\t\t\t\t<td style='width:20%; text-align: center;'>{DOWNLOAD_BACK_TO_LIST}</td>\n\t\t\t\t<td style='width:40%; text-align: right;'>{DOWNLOAD_VIEW_NEXT}</td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t";
}
// ------- Next/Prev -----------
$text .= $tp->parseTemplate($DL_VIEW_NEXTPREV, TRUE, $sc);
$caption = $tp->parseTemplate($DL_VIEW_CAPTION, TRUE, $sc);
$text .= $tp->parseTemplate($this->templateFooter, TRUE, $sc);
$ret = $ns->tablerender($caption, $text, 'download-view', true);
unset($text);
if ($dlrow['download_comment']) {
$comments = e107::getComment()->compose_comment("download", "comment", $dlrow['download_id'], null, $dlrow['download_name'], FALSE, true);
$ret .= $ns->tablerender($comments['caption'], $comments['comment'] . $comments['comment_form'], 'download-comments', true);
}
// print_a($comments);
return $ret;
}