本文整理汇总了PHP中getComment函数的典型用法代码示例。如果您正苦于以下问题:PHP getComment函数的具体用法?PHP getComment怎么用?PHP getComment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getComment函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getComment
/**
*递归获取评论列表
*/
function getComment($parent_id = 0, &$result = array())
{
$sql = "select * from tuhao_comm where parent_id={$parent_id} order by reg_time desc";
$rows = fetchAll($sql);
if (empty($rows)) {
return array();
}
foreach ($rows as $row) {
$arr =& $result[];
$row["children"] = getComment($row["id"], $thisArr);
$arr = $row;
}
return $result;
}
开发者ID:JimmyVV,项目名称:TuhaoWeb,代码行数:17,代码来源:comment.inc.php
示例2: about_media_detail
function about_media_detail()
{
global $_MooClass, $dbTablePre, $user_arr, $name;
include "./module/{$name}/function.php";
//通过ID查找一条新闻的详细内容
$id = $_GET['id'];
$arr = explode("_", $id);
$src = "module/about/templates/default/baodao/" . $arr[0] . "/" . $arr[1] . ".jpg";
if (!file_exists($src)) {
MooMessage('没有这个页面', 'index.php?n=about&h=media', '01');
}
$id = (isset($arr[0][3]) ? $arr[0] : '20' . $arr[0]) * 100 + $arr[1];
$comment = getComment(1, $id);
$left_menu = 'media';
require MooTemplate('public/about_media_detail', 'module');
}
开发者ID:noikiy,项目名称:zays,代码行数:16,代码来源:index.php
示例3: deletePost
function deletePost()
{
$sess_user = $_SESSION['user_id'];
if (isset($_POST['del_post'])) {
$post_id = (int) $_POST['post_id'];
dbAdd("DELETE FROM litter_posts\n\t\t\tWHERE post_id = '{$post_id}' AND user_id = '{$sess_user}'");
$comments = getComment($post_id);
if (!empty($comments)) {
foreach ($comments as $comments) {
$user_id = $comments['user_id'];
dbAdd("DELETE FROM litter_posts\n\t\t\t\t\tWHERE reply = '{$post_id}' AND user_id = '{$user_id}'");
}
}
return "Your post was successfully trashed!";
}
}
开发者ID:nilvisa,项目名称:litter,代码行数:16,代码来源:post_funcs.php
示例4: viewBlog
function viewBlog()
{
if (!isset($_GET["blogId"]) || !$_GET["blogId"]) {
homepage();
return;
}
$data = Page::getPageByTitle($_GET['action']);
//body content
echo "<div id='output'>";
if ($data) {
if ($data->page_protection == '1' && !isset($_SESSION['name'])) {
echo "Please log-in to view this page.";
} else {
if ($data->page_status == 'draft') {
echo "This page is not yet published. Contact the site admin.";
} else {
//show body and blog
echo "<p>" . $data->page_body . "</p>";
$results = array();
$results['blog'] = Blog::getBlogById($_GET["blogId"]);
$results['pageTitle'] = $results['blog']->title . " | Widget News";
$row = $results['blog'];
echo "<input type='hidden' value='" . $row->id . "' id='hBlogId'/>";
echo '<h1 class="headSection">' . $row->title . '</h1><p class="smallText">' . $row->publicationDate . '</p><p>' . $row->content . '</p>';
echo '<p style="font-weight:bold;">Share this!</p><a href="#"><img src="include/images/fb.png"/></a><a href="#"><img src="include/images/twit.png"/></a><a href="#"><img src="include/images/rss2.png"/></a><a href="#"><img src="include/images/google.png"/></a><a href="#"><img src="include/images/delicious.png"/></a><a href="#"><img src="include/images/stumbleupon.png"/></a><a href="#"><img src="include/images/digg.png"/></a><hr/>';
echo '<div id="commentSection"><p class="smallText">Leave a comment...</p><textarea id="comment" placeholder="Put your comment here" required maxlength="1000" style="height: 3em; width:90%; display: block;margin-left: auto;margin-right: auto;"></textarea><input type="button" id="submitComment" value="Post!" title="' . $_GET["blogId"] . '"/></div>';
//existing comments
getComment();
//end of comment
}
}
}
echo "</div>";
//end of body content
//sidebar
echo "<div id='sidebar'>";
if ($data) {
echo "<p>" . $data->page_sidebar . "</p>";
}
echo "</div>";
//end of sidebar
}
开发者ID:neequole,项目名称:sp2,代码行数:42,代码来源:index.php
示例5: story_content
function story_content()
{
global $_MooClass, $dbTablePre, $userid;
global $user_arr;
$sid = MooGetGPC('sid', 'integer');
if ($sid) {
//增加点击次数
$_MooClass['MooMySQL']->query("update {$dbTablePre}story set hot=hot+1 where sid={$sid} and syscheck = 1");
} else {
$sid = 1;
}
$love_story = $_MooClass['MooMySQL']->getOne("SELECT * FROM {$dbTablePre}story WHERE sid = '{$sid}' and syscheck = 1");
if (!$love_story) {
MooMessage('没有对应故事', 'index.php?n=story');
exit;
}
$comment = getComment(2, $sid);
$show_pic = showPic($sid);
include MooTemplate('public/story_content', 'module');
}
开发者ID:noikiy,项目名称:zays,代码行数:20,代码来源:index.php
示例6: addSql
/**
* 新增歷史語法
*
* @param string $returnResult pay2go 回傳資料
* @param string $add_status 新增狀態
* @param int $today 更新時間
* @param string $prefix DB 前置
*/
function addSql($returnResult, $add_status, $today, $prefix)
{
$sql = "INSERT INTO " . $prefix . "hikashop_history SET";
$sql .= " history_order_id = " . $returnResult['MerchantOrderNo'];
$sql .= ", history_created = " . $today;
$sql .= ", history_ip = 'pay2go'";
$sql .= ", history_new_status = '" . $add_status . "'";
$sql .= ", history_reason = '" . getComment($returnResult);
$sql .= $returnResult['Status'] != 'SUCCESS' ? "錯誤訊息: " . $returnResult['Message'] . "'" : "'";
$sql .= ", history_type = 'callback'";
return $sql;
}
开发者ID:q0821,项目名称:esportshop,代码行数:20,代码来源:callback.php
示例7: UpdateInf
//echo $id." ".$pw." ".$Des." ".$BDes." ".$Loc." ".$Icon." ".$oid;
UpdateInf($oid, $id, $pw, $Des, $BDes, $Loc, $Icon);
});
$app->get('/Comment/id/:mid/fid/:fid/Des/:Des/Rating/:rat', function () {
$uri = $_SERVER['REQUEST_URI'];
$arr_items = split('/', $uri);
$Rat = $arr_items[count($arr_items) - 1];
$Des = $arr_items[count($arr_items) - 3];
$fid = $arr_items[count($arr_items) - 5];
$id = $arr_items[count($arr_items) - 7];
echo $id . " " . $fid . " " . $Des . " " . $Rat;
Commend($id, $fid, $Des, $Rat);
});
$app->get('/Comment/id/:mid', function ($mid) {
//echo $mid;
getComment($mid);
});
$app->get('/Login/id/:mid/pw/:pw', function () {
$uri = $_SERVER['REQUEST_URI'];
$arr_items = split('/', $uri);
$pw = $arr_items[count($arr_items) - 1];
$id = $arr_items[count($arr_items) - 3];
//echo $id." ".$pw;
Login($id, $pw);
});
$app->get('/Check/id/:mid', function () {
$uri = $_SERVER['REQUEST_URI'];
$arr_items = split('/', $uri);
$id = $arr_items[count($arr_items) - 1];
//$id = $arr_items[count($arr_items) - 3];
//echo $id;
开发者ID:DavidNingGithub,项目名称:Android-School-Shuttle-Mobile-Application,代码行数:31,代码来源:index.php
示例8: deleteUser
function deleteUser()
{
if (isset($_POST['del_user'])) {
$sess_id = $_SESSION['user_id'];
$sess_username = $_SESSION['username'];
/* DEL POSTS */
$posts = getUserPosts($_SESSION['username']);
foreach ($posts as $post) {
$post_id = $post['post_id'];
dbAdd("DELETE FROM litter_posts\n\t\t\tWHERE post_id = '{$post_id}' AND user_id = '{$sess_id}'");
$comments = getComment($post_id);
if (!empty($comments)) {
foreach ($comments as $comments) {
$user_id = $comments['user_id'];
dbAdd("DELETE FROM litter_posts\n\t\t\t\t\t\tWHERE reply = '{$post_id}' AND user_id = '{$user_id}'");
}
}
}
/* CLEAN FOLLOWING */
dbAdd("DELETE FROM litter_following\n\t\t\tWHERE user_id = '{$sess_id}'");
/* CLEAN FOLLOWERS */
dbAdd("DELETE FROM litter_following\n\t\t\tWHERE following = '{$sess_id}'");
/* CLEAN FOLDER */
$dir = 'userIMG/' . $sess_id . '/';
// Open the directory
$dirHandle = opendir($dir);
// Loop over all of the files in the folder
while ($file = readdir($dirHandle)) {
// If $file is NOT a directory remove it
if (!is_dir($file)) {
unlink("{$dir}" . "{$file}");
// unlink() deletes the files
}
}
// Close the directory
closedir($dirHandle);
/* REMOVE FOLDER */
rmdir($dir);
/* DEL USER */
dbAdd("DELETE FROM litter_users\n\t\tWHERE user_id = '{$sess_id}' AND username = '{$sess_username}'");
session_destroy();
session_start();
$_SESSION['error'] = 'Your account has been deleted...';
header('Location: form.php');
}
}
开发者ID:nilvisa,项目名称:litter,代码行数:46,代码来源:profile_funcs.php
示例9: comments_preview
function comments_preview($atts)
{
global $has_comments_preview;
if (!ps('preview')) {
return;
}
extract(lAtts(array('form' => 'comments', 'wraptag' => '', 'class' => __FUNCTION__), $atts));
assert_article();
$preview = psa(array('name', 'email', 'web', 'message', 'parentid', 'remember'));
$preview['time'] = time();
$preview['discussid'] = 0;
$preview['name'] = strip_tags($preview['name']);
$preview['email'] = clean_url($preview['email']);
if ($preview['message'] == '') {
$in = getComment();
$preview['message'] = $in['message'];
}
$preview['message'] = markup_comment(substr(trim($preview['message']), 0, 65535));
// it is called 'message', not 'novel'
$preview['web'] = clean_url($preview['web']);
$GLOBALS['thiscomment'] = $preview;
$comments = parse_form($form) . n;
unset($GLOBALS['thiscomment']);
$out = doTag($comments, $wraptag, $class);
# set a flag, to tell the comments_form tag that it doesn't have to show a preview
$has_comments_preview = true;
return $out;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:28,代码来源:taghandlers.php
示例10: sampleDetail
//.........这里部分代码省略.........
<div class="col-md-1">:</div>
<div class="col-md-3">
<label class="field prepend-icon">
<input type="text" name="txt_assign" id="txt_assign" class="gui-input">
<label for="txt_assign" class="field-icon">
<i class="fa fa-calculator"></i>
</label>
</label>
</div>
<div class="col-md-5">
<button class="btn btn-alert" onclick="balance('<?php
echo $row['kp_id'];
?>
')"><i class="fa fa-plus"></i> Balance</button>
<button class="btn btn-alert" onclick="assignSample('<?php
echo $sampleID;
?>
')"><i class="fa fa-pencil"></i> Assign Sample</button>
</div>
<div class="col-md-12"> </div>
<div class="col-md-12" id="sampleAssign"><?php
showTask($sampleID);
?>
</div>
<div class="col-md-12"> </div>
<?php
} elseif ($id == 21 || $id == 23 || $id == 25 || $id == 27) {
assignedTask($id, $sampleID, $_SESSION['ru_kod']);
}
if ($id != 27) {
?>
<div class="col-md-12"> </div>
<div class="col-md-3"><?php
echo getComment($id);
?>
</div>
<div class="col-md-1">:</div>
<div class="col-md-6">
<label class="field prepend-icon">
<textarea class="gui-textarea" id="txt_comment" placeholder="Enter Comment..."><?php
echo getComments($id, $sampleID, $_SESSION['us_id']);
?>
</textarea>
<label for="comment" class="field-icon">
<i class="fa fa-comments"></i>
</label>
<span class="input-footer"><?php
echo getComment($id);
?>
</span>
</label>
</div>
<div class="col-md-12"><font color="red">*</font> required field</div>
<?php
}
?>
</div>
<div class="row">
<div class="col-md-12"> </div>
<div class="col-md-12">
<button class="btn btn-alert" onclick="content('<?php
echo $code;
?>
')"><i class="fa fa-arrow-left"></i> Back</button>
<button class="btn btn-alert" onclick="showProduct('<?php
echo $code;
开发者ID:syafiqazwan,项目名称:pharmaco,代码行数:67,代码来源:pkk-bkp.php
示例11: cleanit
$uname = cleanit($_REQUEST['uname']);
if ($uname != "") {
STemplate::assign('uname', $uname);
$queryp = "select USERID, username, country, description, color1, color2, website from members where username='" . mysql_real_escape_string($uname) . "' AND status='1'";
$resultsp = $conn->execute($queryp);
$p = $resultsp->getrows();
STemplate::assign('p', $p[0]);
$USERID = intval($p[0]['USERID']);
$qry = "SELECT A.*, B.story, B.nsfw, B.pic\r\n\t\t\t\tFROM posts_comments A, posts B\r\n\t\t\t\t\tWHERE A.USERID = " . $USERID . " AND A.PID = B.PID\r\n\t\t\t\t\t\tGROUP BY A.CID\r\n\t\t\t\t\t\t\tORDER BY A.CID desc\r\n\t\t\t\t\t\t\t\tLIMIT {$pagingstart}, {$config['items_per_page']}";
$qry_result = $conn->execute($qry);
$data = $qry_result->getrows();
if (!$data) {
$t = 'empty.tpl';
//STemplate::assign('tc',0);
} else {
$data = getComment($data);
$data = getHash($data);
STemplate::assign('data', $data);
//STemplate::assign('tc',count($data));
}
if ($USERID > 0) {
STemplate::assign('pagetitle', $uname . " " . $lang['194']);
$eurl = base64_encode("/user/" . $uname . "/messages");
STemplate::assign('eurl', $eurl);
$query = "select count(*) as total from posts where USERID='" . mysql_real_escape_string($USERID) . "' AND active='1' limit 1";
$executequery = $conn->execute($query);
$tl = $executequery->fields['total'];
STemplate::assign('tl', $tl);
$query = "select count(*) as total from posts_favorited where USERID='" . mysql_real_escape_string($USERID) . "' limit 1";
$executequery = $conn->execute($query);
$tf = $executequery->fields['total'];
开发者ID:jd5688,项目名称:image-sharing-site,代码行数:31,代码来源:messages.php
示例12: atLink
print '<p class="post_post">' . atLink($post['post']) . '</p>';
if ($post['post_pic']) {
print '<img src="userIMG/' . $post['user_id'] . '/' . $post['post_pic'] . '" class="post_img">';
}
print '<div class="time_stamp"><p>' . printTime($post['time_stamp']) . '</p></div>';
/*REPLY_FORM*/
print '<div class="reply">
<form method="POST" action="#' . $post['post_id'] . '">
<input type="hidden" name="post_id" value="' . $post['post_id'] . '">
<input type="text" name="comment" value="' . $post['username'] . '">
<input type="submit" name="postComment" value="Reply" class="button">
</form>
</div>';
/*END REPLY_FORM*/
print '<br></div>';
$comments = getComment($post['post_id']);
if (!empty($comments)) {
print '<div class="postit"><ul>';
foreach ($comments as $comments) {
print '<li>';
/*DELETE_BUTTON*/
if ($sess['user_id'] == $comments['user_id']) {
print '<div class="del_post">';
print '<form method="POST" action="#' . $post['post_id'] . '">
<input type="hidden" name="post_id" value="' . $comments['post_id'] . '">
<button type="submit" name="del_comment"><img src="img/trashicon.png"></button>
</form>';
print '</div>';
}
/*END DELETE_BUTTON*/
/*COMMENT*/
开发者ID:nilvisa,项目名称:litter,代码行数:31,代码来源:atpost.php
示例13: comment_evaluation
function comment_evaluation()
{
global $prefs;
extract(getComment());
$this->status = array(SPAM => array(), MODERATE => array(), VISIBLE => array(), RELOAD => array());
$this->status_text = array(SPAM => gTxt('spam'), MODERATE => gTxt('unmoderated'), VISIBLE => gTxt('visible'), RELOAD => gTxt('reload'));
$this->message = $this->status;
$this->txpspamtrace[] = "Comment on {$parentid} by {$name} (" . safe_strftime($prefs['archive_dateformat'], time()) . ")";
if ($prefs['comments_moderate']) {
$this->status[MODERATE][] = 0.5;
} else {
$this->status[VISIBLE][] = 0.5;
}
}
开发者ID:evanfarrar,项目名称:opensprints.org,代码行数:14,代码来源:comment.php
示例14: handleCreateTable
function handleCreateTable(&$schema, &$input, &$line)
{
if (preg_match('/^CREATE\\ TABLE\\ ([a-z]*\\.)?([a-z_]+)$/', $line, $match) == 1) {
$tabName = $match[2];
// eat (
getNextLine($input);
$lastcolumn = false;
while ($line = getNextLine($input)) {
$comment = false;
while ($commentLine = getComment($line)) {
$comment = $comment . "\n" . $commentLine;
$line = getNextLine($input);
}
$column = getColumnName($line);
if ($column) {
$lastcolumn = $column;
}
if (!isset($schema[$tabName]['fields'][$lastcolumn])) {
$schema[$tabName]['fields'][$lastcolumn] = array('description' => "No description for column {$lastcolumn} available, please fix");
}
if ($comment) {
$schema[$tabName]['fields'][$lastcolumn]['description'] = $comment;
}
if (getColumnType($schema[$tabName], $lastcolumn, $line)) {
continue;
}
if (preg_match('/^\\) WITHOUT OIDS;/', $line)) {
continue;
}
if ($uniqueconstraints = getUniqueConstraints($line)) {
$keyname = $uniqueconstraints['name'];
$schema[$tabName]['unique keys'][$keyname] = $uniqueconstraints['keys'];
continue;
}
if ($primaryKey = getPrimaryKey($line)) {
$schema[$tabName]['primary key'] = $primaryKey;
continue;
}
fwrite(STDERR, "Unknown statements within CREATE TABLE: {$line}\n");
}
return true;
}
return false;
}
开发者ID:rettichschnidi,项目名称:naturvielfalt,代码行数:44,代码来源:SchemaGenerator.php
示例15: checkLogin
<?php
include "functions.php";
checkLogin();
$id = (int) $_GET['id'];
include_once 'modele/news/getComments.php';
$commentArray = getComment($id);
foreach ($commentArray as $com) {
$pseudo = $com['pseudo'];
$id_user = $com['ID_membre'];
$id_news = $com['ID_news'];
}
if (!isset($pseudo)) {
$js = false;
$redirect[0] = 'javascript:history.go(-1)';
$redirect[1] = '1';
$page = 'accueil';
$titreErreur = 'news - erreur';
$erreur = 'Ce commentaire n\'existe pas !';
include_once 'vue/erreur.php';
die;
}
$admin = areYouAdmin();
if (!$admin and (!$_SESSION['login'] or $id_user != $_SESSION['ID'])) {
$js = false;
$redirect[0] = 'javascript:history.go(-1)';
$redirect[1] = '1';
$page = 'accueil';
$titreErreur = 'news - erreur';
$erreur = 'Vous n\'êtes pas autorisé à supprimer un commentaire qui ne vous appartient pas!';
include_once 'vue/erreur.php';
开发者ID:Rbeuque74,项目名称:boutiqueMvc,代码行数:31,代码来源:delete-comment.php
示例16: json_encode
<?php
require 'get.php';
$post = $_GET['post'];
echo json_encode(array('comment' => getComment($post)));
开发者ID:bdbai,项目名称:wawall-sae,代码行数:5,代码来源:getcomment.php
示例17: deleteComment
function deleteComment($data)
{
$results = [];
//checks if requests needed are present and not empty
$dataNeeded = array("commentID");
if (checkData($data, $dataNeeded)) {
//check if comment provided exists
$comment = getComment($data["commentID"]);
if ($comment["count"] > 0) {
$db = new pdodb();
$query = "DELETE FROM Comment WHERE ID = :commentID;";
$bindings = array(":commentID" => $data["commentID"]);
$row = $db->query($query, $bindings);
//if deletion was ok
if ($row["count"] > 0) {
$results["meta"]["ok"] = true;
$results["rows"]["commentID"] = $data["commentID"];
} else {
//check if database provided any meta data if so problem with executing query
if (isset($row["meta"])) {
$results = $row;
} else {
$results["meta"]["ok"] = false;
}
}
} else {
//check if database provided any meta data if so problem with executing query
if (isset($comment["meta"])) {
$results = $comment;
} else {
$results["meta"] = noCommentFound($data["commentID"]);
}
}
} else {
$results["meta"] = dataNotProvided($dataNeeded);
}
return $results;
}
开发者ID:jahidulpabelislam,项目名称:Lials,代码行数:38,代码来源:functions.php
示例18: getLicensePicture
$alert .= "<div class=\"new_content_license\">";
$alert .= " <p><convert>#label=482<convert></p>";
$alert .= " <p><convert>#label=483<convert></p>";
$alert .= " <p><convert>#label=484<convert></p>";
$alert .= " <p><convert>#label=509<convert> : " . getLicensePicture(1) . "</p>";
$alert .= "</div>";
return $alert;
}
//Get the values to display :
$locations = getLocation($category, $id);
$topographies = getTopography($category, $id);
$descriptions = getDescription($category, $id);
$riggings = getRigging($category, $id);
$histories = getHistory($category, $id);
$bibliographies = getBibliography($category, $id);
$comments = getComment($category, $id);
//Printing options setup :
$disabledOnlyAttribute = "disabled=\\\"disabled\\\" ";
$checkedAttribute = "checked=\\\"checked\\\" ";
$printLocations = $locations['Count'] > 0 ? "" : $disabledOnlyAttribute;
$printDescriptions = $descriptions['Count'] > 0 ? "" : $disabledOnlyAttribute;
$printRiggings = $riggings['Count'] > 0 ? "" : $disabledOnlyAttribute;
$printTopographies = $topographies['Count'] > 0 ? "" : $disabledOnlyAttribute;
$printHistories = $histories['Count'] > 0 ? "" : $disabledOnlyAttribute;
$printBibliographies = $bibliographies['Count'] > 0 ? "" : $disabledOnlyAttribute;
$printComments = $comments['Count'] > 0 ? "" : $disabledOnlyAttribute;
$defaultProperties = "";
$defaultInput_area = "";
$defaultMap = "checked=\\\"checked\\\" ";
$defaultTable_of_content = "";
$defaultLocation = $locations['Count'] > 0 ? $checkedAttribute : "";
开发者ID:GrottoCenter,项目名称:GrottoCenter,代码行数:31,代码来源:file.php
示例19: recentVideo
<?php
require 'header.php';
$recent = recentVideo();
$cat = catList();
if (isset($_GET['v'])) {
$data = videoDetail($_GET['v'])->result[0];
$comment = getComment($_GET['v']);
?>
<div class="clear"></div>
<div class="inner shadow"></div>
<div class="container row">
<div class="two-thirds column left">
<h1 class="heading"><?= $data->title ?></h1>
<!-- Album Detail Start -->
<div class="in-sec">
<div class="album-detail">
<a href="" class="thumb">
<iframe height="300px" width="550px" scrolling="no" src="http://182.18.165.43/multitvfinal/index.php/details?id=<?php echo $data->id ?>&device=3g" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
</a>
<div class="clear"></div>
</div>
<div class="desc">
<p class="musicby"><?= $data->title ?></p>
<h4>Album Discription</h4>
<p class="txt"><?= $data->description ?> </p>
</div>
</div>
<div class="in-sec">
<div class="album-opts">
开发者ID:anandcyberlinks,项目名称:cyberlinks-demo,代码行数:31,代码来源:detail.php
示例20: getComment
function getComment($comment, &$total_comment, &$total_reply, $isReply, &$cur_level, $max_reply)
{
$comment->normalize();
$time = $comment->getAttribute("timestamp");
$author = $comment->getAttribute("author");
$ip = $comment->getAttribute("ip");
$id = $comment->getAttribute("id");
$subject = trim($comment->childNodes->item(0)->nodeValue);
$msg = trim($comment->childNodes->item(1)->nodeValue);
$msg = str_replace(array("\r", "\n"), "<br />", $msg);
$msg = str_replace(array("[[", "]]"), array("<", ">"), $msg);
$time = ago(time() - $time * 1);
$html = '<li class="ec-comment" id="' . $id . '">' . ' <div class="avatar"></div>' . ' <span class="user-name author">' . $author . '</span> <br />' . ' <span class="comment-html">' . (empty($subject) ? "" : ' <strong>' . $subject . '</strong><br /><br />') . $msg . ' </span><br>' . ' <span class="comment-time">' . $time . '</span><br />';
if ($cur_level < $max_reply) {
$html .= ' <button name="reply" id="reply_' . $id . '">Reply</button>';
}
if ($isReply) {
$total_reply++;
} else {
$total_comment++;
}
if ($comment->childNodes->length == 3) {
$cur_level++;
$root = $comment->childNodes->item(2);
$last_child = $root->lastChild;
if ($last_child) {
//$html .= '<ul class="ec-comment-list">';
$temp_html = null;
while ($last_child) {
$moderate = $last_child->getAttribute("moderate");
$ip = $last_child->getAttribute("ip");
if ($moderate === "0" || $moderate === "4" || $moderate === "1" && $ip === $_SERVER["REMOTE_ADDR"]) {
if (is_null($temp_html)) {
$temp_html = '<ul class="ec-comment-list">';
}
$temp_html .= getComment($last_child, $total_comment, $total_reply, true, &$cur_level, $max_reply);
}
$last_child = $last_child->previousSibling;
}
if (!is_null($temp_html)) {
$temp_html .= '</ul>';
$html .= $temp_html;
}
}
}
$html .= '</li>';
return $html;
}
开发者ID:rahul1205,项目名称:summerproject,代码行数:48,代码来源:ec-comment.php
注:本文中的getComment函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论