本文整理汇总了PHP中Post::getText方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::getText方法的具体用法?PHP Post::getText怎么用?PHP Post::getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post::getText方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visitPost
function visitPost(Post $p)
{
$text = $p->getText();
$title = $p->getTitle();
$author = $p->getAuthor();
$time = $p->getTime();
$tags = $this->tagsToString($p->getTags());
echo '<post>';
echo '<title>' . utf8_encode($title) . '</title>';
echo '<author>' . utf8_encode($author) . '</author>';
echo '<time>' . utf8_encode(date("H:i:s - d/m/Y", $time)) . '</time>';
echo '<tags>' . utf8_encode($tags) . '</tags>';
echo '<text>' . utf8_encode($text) . '</text>';
echo '</post>';
}
示例2: visitPost
function visitPost(Post $p)
{
$text = $p->getText();
$title = $p->getTitle();
$author = $p->getAuthor();
$time = $p->getTime();
$id = $p->getID();
echo '<item>';
echo '<guid isPermaLink="false">' . utf8_encode("ABBOV_ID_" . $id) . '</guid>';
echo '<title>' . utf8_encode($title) . '</title>';
echo '<description>' . utf8_encode($text) . '</description>';
echo '<pubDate>' . date("D, d M Y G:i:s O", $time) . '</pubDate>';
echo '<dc:creator>' . $author . '</dc:creator>';
echo '</item>';
}
示例3: visitPost
function visitPost(Post $p)
{
$text = $p->getText();
$title = $p->getTitle();
$author = $p->getAuthor();
$time = $p->getTime();
$tags = $this->tagsToString($p->getTags());
echo '<div id="post">';
echo '<b>' . $title . "</b><br>";
echo $author . ' @ ' . date("H:i:s - d/m/Y", $time) . '<br>';
echo 'Tags: ' . $tags . '<br><br>';
echo $text;
echo "<br><br>";
echo '</div>';
}
示例4: visitPost
function visitPost(Post $p)
{
$text = $p->getText();
$title = $p->getTitle();
$author = $p->getAuthor();
$time = $p->getTime();
$tags = $this->tagsToString($p->getTags());
$id = $p->getID();
echo '<div class="post">';
echo '<b>' . $title . "</b><br>";
echo $author . ' @ ' . date("H:i:s - d/m/Y", $time) . '<br>';
echo 'Tags: ' . $tags . '<br><br>';
echo $text;
echo "<br><br>";
echo '<a href="deletepost.php?id=' . $id . '">Delete post</a>';
echo "<br><br>";
echo '</div>';
}
示例5: save
public function save(Post $post)
{
$id = $this->persistence->persist(['text' => $post->getText(), 'title' => $post->getTitle()]);
$post->setId($id);
}
示例6: getAllImagesWithSelect
?>
</select></div><div class="col-md-2">
<input class="form-control" type="hidden" name="action" id="action" value="add_get"><input type="submit" class="btn btn-warning" value="Select Post"></div>
</form>
<br><br><br>
<form action="../controller/post_controller.php" method="POST">
<textarea class="form-control" type="text" name="title" id="title" ><?php
echo $postOnGet->getTitle();
?>
</textarea><br>
<textarea class="form-control" type="text" name="subtitle" id="subtitle" ><?php
echo $postOnGet->getSubTitle();
?>
</textarea><br>
<textarea class="form-control" type="text" name="text" id="text"><?php
echo $postOnGet->getText();
?>
</textarea><br>
<input class="form-control" type="date" name="date" id="date" <?php
echo 'value=' . $postOnGet->getDate();
?>
><br>
<select class="form-control editAvatar" name="image" id="avatar">
<option value="null">Select image...</option>
<?php
$optionList = getAllImagesWithSelect($postOnGet->getImage());
echo $optionList;
?>
</select>
示例7: save
/**
* Save post object and populate it with id
*
* @param Post $post
* @return Post
*/
public function save(Post $post)
{
$id = $this->persistence->persist(array('author' => $post->getAuthor(), 'created' => $post->getCreated(), 'text' => $post->getText(), 'title' => $post->getTitle()));
$post->setId($id);
return $post;
}
示例8: Post
}
if ($id) {
$p = new Post($id);
$app->response->status(201);
if ($u = $p->getAuthor()) {
$user = ["user_id" => $u->getID(), "avatar" => $u->getProfilePictureURL(), "name" => $u->getFullname()];
} else {
$user = ["user_id" => null, "avatar" => "img/favicon.png", "name" => "Anonymous"];
}
$ijson = [];
if ($imgs = $p->getImages()) {
foreach ($imgs as $i) {
$ijson[] = ["url" => $i->getUrl(), "alt" => $i->getFileName()];
}
}
$j = ["post_id" => $p->getID(), "liked" => false, "tapped_into" => false, "likes_count" => 0, "comments_count" => 0, "taps_count" => 0, "text" => $p->getText(), "time" => $p->getTime(), "category" => $p->getCategory()->getName(), "user" => $user, "images" => $ijson, "comments" => []];
echo json_encode($j);
} else {
echo json_encode(["status" => false]);
}
});
$app->get('/posts', function () use($app) {
$posts = App::getPosts(["limit" => 25, "user_id" => 13]);
echo json_encode(Utility::formatActivitiesToPosts($posts, $app));
});
$app->delete('/posts/:id', function ($id) use($app) {
$p = new Post($id);
if ($p->getID() && $app->environment()['testify.user_id'] == $p->getAuthor()->getID()) {
$p->delete();
if ($p) {
echo json_encode(['status' => true]);
示例9: addPost
function addPost(Post $p)
{
$query = "INSERT INTO `" . $this->_database . "`.`Posts` ";
$query .= "(`ID`, `Title`, `Text`, `Author`, `Time`, `Tags`) ";
$query .= "VALUES (NULL, '" . $p->getTitle() . "', ";
$query .= "'" . $p->getText() . "', ";
$query .= "'" . $p->getAuthor() . "', ";
$query .= "'" . $p->getTime() . "', ";
$query .= "'" . serialize($p->getTags()) . "');";
$added = mysql_query($query, $this->_connection);
}
示例10: update
public function update(Post $post)
{
$this->updateObject('Post', 'p_id', $post->getId(), ['p_text' => $post->getText()]);
}