本文整理汇总了PHP中getComments函数的典型用法代码示例。如果您正苦于以下问题:PHP getComments函数的具体用法?PHP getComments怎么用?PHP getComments使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getComments函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_files
/**
* Prints out a list of files and their comments
*
* @param unknown_type $rootDirs
* @param unknown_type $relPath
* @param unknown_type $title
*/
function print_files($rootDirs, $relPath, $title, $comments)
{
if ($comments) {
echo "<div><h2>{$title}</h2>";
} else {
echo "<div class='api-list' style='float: left;'><h2>{$title}</h2>";
}
foreach ($rootDirs as $dir) {
if (!file_exists($dir . $relPath)) {
continue;
}
$files = scandir($dir . $relPath);
echo '<ul>';
foreach ($files as $file) {
if (!is_dir($file)) {
echo '<li><STRONG>' . get_file_name($file) . '</STRONG></li>';
if ($comments) {
echo '<li><STRONG>File Path:</STRONG> ' . $dir . DIRECTORY_SEPARATOR . $relPath . DIRECTORY_SEPARATOR . $file . '</li>';
echo '<li>' . getComments($dir . DIRECTORY_SEPARATOR . $relPath . DIRECTORY_SEPARATOR . $file) . '</li>';
}
}
}
echo '</ul>';
}
echo '</div>';
}
示例2: getVar
function getVar($url, $url_comment, $url_changes, $id, $con)
{
$content = file_get_contents($url);
$json = json_decode($content, true);
$creator_email = $json['bugs'][0]['creator_detail']['email'];
$component = $json['bugs'][0]['component'];
$assigned_email = $json['bugs'][0]['assigned_to_detail']['email'];
$priority = $json['bugs'][0]['priority'];
$severity = $json['bugs'][0]['severity'];
$platform = $json['bugs'][0]['platform'];
$op_sys = $json['bugs'][0]['op_sys'];
$resolution = $json['bugs'][0]['resolution'];
$status = $json['bugs'][0]['status'];
$creation_time = $json['bugs'][0]['creation_time'];
$last_change_time = $json['bugs'][0]['last_change_time'];
$target_milestone = $json['bugs'][0]['target_milestone'];
$nr_cc_detail = count($json['bugs'][0]['cc_detail']);
$json_c = getComments($url_comment);
$nr_comments = count($json_c['bugs'][$id]['comments']);
$json_ch = getChanges($url_changes);
$nr_history = count($json_ch['bugs'][0]['history']);
//insert into mysql table
$sql = "INSERT INTO bug\n VALUES('{$id}', '{$creator_email}', '{$component}', '{$assigned_email}', '{$priority}', '{$severity}', '{$platform}', '{$op_sys}', '{$resolution}', '{$status}', '{$creation_time}', '{$last_change_time}', '{$target_milestone}', '{$nr_cc_detail}','{$nr_comments}','{$nr_history}')";
if (!mysql_query($sql, $con)) {
die('Error : ' . mysql_error());
} else {
echo 'inserito';
echo '<br>';
}
/* (id, creator_email, component, assigned_email, priority, platform, op_sys, resolution, status, creation_time, last_change_time, target_milestone, nr_cc_detail, nr_comments, nr_history)*/
}
示例3: CommentsBlock
function CommentsBlock($ThisID, $Thiskey)
{
global $DBConn;
if ($Thiskey == 's') {
$q = "SELECT * FROM comment WHERE Story_AID = " . $ThisID . " and Parent_ID=0 ORDER by ID";
}
if ($Thiskey == 'i') {
$q = "SELECT * FROM comment WHERE Comment_Object_ID = " . $ThisID . " and Comment_Object_ID <> 0 and Parent_ID=0 ORDER by ID";
}
// comments must be wrapped in a div like this
// echo '<div class="commentsdialog" id="commentspop'.$Thiskey.'_'.$ThisID.'"><ul id=commentlist'.$Thiskey.'_'.$ThisID.'> ';
echo '<ul id=commentlist' . $Thiskey . '_' . $ThisID . '> ';
$r = mysqli_query($DBConn, $q);
while ($row = mysqli_fetch_assoc($r)) {
getComments($row, $ThisID, $Thiskey);
}
echo '</ul>';
echo '<br><div class="smaller" id="replyto_' . $Thiskey . '_' . $ThisID . '"></div>';
echo '<a href="" onclick="javascript: return false;" title="Add Comment"><img class="submit_button" id="submit_button' . $Thiskey . '_' . $ThisID . '" src="images/add.png"></a>';
echo ' <textarea class="w80 commenth" name="comment_text_' . $ThisID . '" rows="3" cols="80" id="comment_text_' . $ThisID . '"></textarea> ';
echo ' <input type="hidden" name="User_Name" id="User_Name_' . $ThisID . '' . '" value="' . $_SESSION['Name'] . '"/> ';
echo ' <input type="hidden" name="Parent_ID" id="Parent_ID_' . $Thiskey . '_' . $ThisID . '" value="0"/> ';
echo ' <input type="hidden" name="Iteration_ID" id="CIteration_ID" value="' . $_REQUEST['IID'] . '"/> ';
// remember that this is not the Story_AID for iterations it is the Comment_Object_ID
// being a lazy beggar it this is just easier
echo ' <input type="hidden" name="Story_AID" id="Story_AID_' . $ThisID . '' . '" value="' . $ThisID . '"/> ';
// echo ' <input type="hidden" name="PID" id="Story_PID_'.$ThisID.''.'" value="'.$_REQUEST['PID'].'"/> ';
// echo '</div> ';
}
示例4: getVar
function getVar($url, $url_comment, $url_changes, $id, $con, $collection)
{
$json = acquisisci($url);
//richiama la curl
$creator_email = $json['bugs'][0]['creator_detail']['email'];
$component = $json['bugs'][0]['component'];
$assigned_email = $json['bugs'][0]['assigned_to_detail']['email'];
$priority = $json['bugs'][0]['priority'];
$severity = $json['bugs'][0]['severity'];
$platform = $json['bugs'][0]['platform'];
$op_sys = $json['bugs'][0]['op_sys'];
$resolution = $json['bugs'][0]['resolution'];
$status = $json['bugs'][0]['status'];
$creation_time = $json['bugs'][0]['creation_time'];
$last_change_time = $json['bugs'][0]['last_change_time'];
$target_milestone = $json['bugs'][0]['target_milestone'];
$nr_cc_detail = count($json['bugs'][0]['cc_detail']);
$json_c = getComments($url_comment);
$nr_comments = count($json_c['bugs'][$id]['comments']);
$json_ch = getChanges($url_changes);
$nr_history = count($json_ch['bugs'][0]['history']);
/*insert into mysql table
$sql = "INSERT INTO bug
VALUES('$id', '$creator_email', '$creator_email', '$assigned_email', '$priority', '$severity', '$platform', '$op_sys', '$resolution', '$status', '$creation_time', '$last_change_time', '$target_milestone', '$nr_cc_detail','$nr_comments','$nr_history')";
if(!mysql_query($sql,$con))
{
die('Error : ' . mysql_error());
}
else
{
echo 'inserito';
echo '<br>';
}
*/
$collection->insert($json);
/*
//inserisco un documento nella collection appena selezionata
$document = array(
"id" => $id,
"creator_email" => $creator_email,
"assigned_email" => $assigned_email,
"priority" => $priority,
"severity", $severity,
"platform" => $platform,
"op_sys" => $op_sys,
"resolution" => $resolution,
"status" => $status,
"creation_time" => $creation_time,
"last_change_time" => $last_change_time,
"target_milestone" => $target_milestone,
"nr_cc_detail" => $nr_cc_detail,
"nr_comments" => $nr_comments,
"nr_history" => $nr_history
);
$collection->insert($document);
echo "<br>Document inserted successfully";
*/
}
示例5: showComments
function showComments($option = '')
{
$pageComments = $_POST['commentPage'];
if (empty($pageComments)) {
$pageComments = 1;
}
$comments = getComments($option, $pageComments);
return $comments;
}
示例6: interpretRequest
function interpretRequest($method, $data)
{
if ($method == 'getsubreddit') {
sendJsonObject(getSubreddit($data));
}
if ($method == 'getcomments') {
sendJsonObject(getComments($data));
}
}
示例7: OnOutput
protected function OnOutput()
{
if (isClosed($this->id) && $_SESSION['role'] == '2') {
$vars = array('claim' => $this->claiminfo, 'comment' => getComments($this->id));
$this->content = $this->Template('application/views/claims/close.php', $vars);
} else {
$com = getComments($this->id);
$vars = array('claim' => $this->claiminfo, 'comment' => $com);
$this->content = $this->Template('application/views/claims/editclaim.php', $vars);
}
parent::OnOutput();
}
示例8: getMain
public function getMain()
{
global $config;
$output = "";
$output .= "<h2>Recent comments</h2>";
$output .= "<p>There are currently " . $this->commentsCount . " comments. ";
$output .= "You are now displaying comments " . ($this->page - 1) * $config["comments per page"] . " to " . min($this->page * $config["comments per page"], $this->commentsCount) . " in reverse chronological order.</p>";
$comments = getComments($this->db, ($this->page - 1) * $config["comments per page"], $config["comments per page"]);
$output .= "<ul>";
foreach ($comments as $comment) {
$output .= printComment($comment);
}
$output .= "</ul>";
return $output;
}
示例9: displayComments
/**
* displayComments
*
* Valid params:
*
* currentUserId - The current user's id.
* id - The id of the thing we are commenting on.
* header - The header for the entire comments block. Defaults to ''.
* label - The label for the text area. Defaults to 'Add Comment'.
* submit - The value for the submit button. Defaults to 'Comment'.
* submitClass - The class for the style of the submit button. Defaults to 'sub1'.
* hidden - An array of hidden inputs for the add form. Key is name, value is value.
*
* @param string $url
* @param string $type
* @param array $params
*
* @return void
*/
function displayComments($url, $type, $params = null)
{
$addForm = getAddCommentsForm($url, $params);
$comments = getComments($url, $type, $params);
$header = '';
if (isset($params['header'])) {
$header = '<h2>' . $params['header'] . '</h2>';
}
echo '
<div id="comments">
' . $header . '
' . $comments . '
' . $addForm . '
</div>';
}
示例10: getComments
function getComments($row)
{
echo "<div class='media'>";
echo "<div class='media-body'>\n\t\t\t<h4 class='media-heading'>" . $row['author'] . "</h4>";
echo $row['comment'];
echo "<div class='col-md-12 commeta-option'>\n\t\t\t<span class='pull-left commeta-reply'>\n\t\t\t<a class='reply' href='#comment_form' id='" . $row['id'] . "'> Reply </a>\n\t\t\t</span>\n\t\t\t<span class='pull-right'>\n\t\t\t\t" . $row['created_at'] . "\n\t\t\t</span>\n\t\t\t";
echo "</div>";
$q = "SELECT * FROM comment WHERE parent_id = " . $row['id'] . "";
$r = mysql_query($q);
if (mysql_num_rows($r) > 0) {
while ($row = mysql_fetch_assoc($r)) {
getComments($row);
}
}
echo "</div></div>";
}
示例11: postComment
function postComment($comment)
{
session_start();
global $con;
try {
$sql = "INSERT INTO `sports_comments` (`ID`, `USER`, `COMMENT`) VALUES (NULL, :user, :comment)";
$sql = $con->prepare($sql);
$sql->bindParam(':user', $_SESSION['username']);
$sql->bindParam(':comment', $comment);
$sql->execute();
} catch (PDOException $e) {
echo $e;
return;
}
buildCommentSection(getComments());
}
示例12: getComments
function getComments(&$reply, $conn)
{
$stmnt = $conn->prepare("select id, created, name, username, content, reply_to from threads where reply_to = :id");
$stmnt->bindParam(":id", $reply["id"], PDO::PARAM_INT);
$stmnt->execute();
$results = $stmnt->fetchAll(PDO::FETCH_ASSOC);
if (sizeof($results) > 0) {
// foreach ($results as $new) {
// getComments($new, $conn);
// }
for ($i = 0; $i < sizeof($results); $i++) {
getComments($results[$i], $conn);
}
$reply["replies"] = $results;
}
}
示例13: postComment
function postComment($comment)
{
session_start();
global $con;
try {
$sql = "INSERT INTO `comments` (`id`, `title_id`, `title`, `username`, `comment`) VALUES (NULL, :title_id, :title, :name, :comment)";
$sql = $con->prepare($sql);
$sql->bindParam(':title_id', $_SESSION['title_id']);
$sql->bindParam(':title', $_SESSION['title']);
$sql->bindParam(':name', $_SESSION['username']);
$sql->bindParam(':comment', $comment);
$sql->execute();
} catch (PDOException $e) {
echo $e;
return;
}
buildCommentSection(getComments());
}
示例14: rmComment
if (isset($username) && isset($_GET["commentid"])) {
$commentid = $_GET["commentid"];
rmComment($commentid);
}
if (isset($username) && $_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($_POST["playlist"])) {
foreach ($_POST["playlist"] as $playlistid) {
addPlaylistMedia($playlistid, $mediaid);
}
}
if (!empty($_POST["comment"])) {
$content = $_POST["comment"];
addComment($username, $mediaid, $content);
}
if (!empty($_POST["rate"])) {
$score = $_POST["rate"];
rateMedia($mediaid, $username, $score);
}
}
$recommend = recommend($mediaid, 8);
$media = viewMedia($mediaid);
$comments = getComments($mediaid);
if (isset($username) && isset($_GET["subscribe"])) {
$subscriber_id = $username;
$channel_id = $media['username'];
if ($subscriber_id != $channel_id) {
addChannel($subscriber_id, $channel_id);
}
}
render("video_template.php", ["media" => $media, "comments" => $comments, "mediaid" => $mediaid, "recommend" => $recommend, "playlists" => $playlists, "Category" => $Category, "Keywords" => $Keywords]);
$db->sql_close();
示例15: editGoal
case "PATCH":
$data["goalID"] = $path[1];
$results = editGoal($data);
break;
case "DELETE":
$data["goalID"] = $path[1];
$results = deleteGoal($data);
break;
default:
$results["meta"] = methodNotAllowed($method, $path);
}
break;
case "comments":
switch ($method) {
case "GET":
$results = getComments($data);
break;
case "POST":
$results = addComment($data);
break;
case "PATCH":
$data["commentID"] = $path[1];
$results = editComment($data);
break;
case "DELETE":
$data["commentID"] = $path[1];
$results = deleteComment($data);
break;
default:
$results["meta"] = methodNotAllowed($method, $path);
}