当前位置: 首页>>代码示例>>PHP>>正文


PHP Post::getAuthor方法代码示例

本文整理汇总了PHP中Post::getAuthor方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::getAuthor方法的具体用法?PHP Post::getAuthor怎么用?PHP Post::getAuthor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Post的用法示例。


在下文中一共展示了Post::getAuthor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>';
 }
开发者ID:laiello,项目名称:abbov,代码行数:15,代码来源:xmlvisitor.php

示例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>';
 }
开发者ID:laiello,项目名称:abbov,代码行数:15,代码来源:rssvisitor.php

示例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>';
 }
开发者ID:laiello,项目名称:abbov,代码行数:15,代码来源:pagevisitor.php

示例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>';
 }
开发者ID:laiello,项目名称:abbov,代码行数:18,代码来源:htmlvisitor.php

示例5: 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;
 }
开发者ID:kabircse,项目名称:DesignPatternsPHP,代码行数:12,代码来源:PostRepository.php

示例6: function

                $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]);
        }
    }
});
$app->post('/posts/:id/favorites', function ($id) use($app) {
    if ($uid = $app->environment['testify.user_id']) {
        $post = new Post($id);
        if ($post) {
            $u = new User($uid);
            $u->favoritePost($post, true);
            echo json_encode(array("favorites" => $post->countFavorites(), "status" => true));
        }
    }
开发者ID:sheyooo,项目名称:testify,代码行数:31,代码来源:index.php

示例7: 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);
 }
开发者ID:laiello,项目名称:abbov,代码行数:11,代码来源:database.php

示例8: save

 /**
  * Saves a Post into the database
  * 
  * @param Post $post The post to be saved
  * @throws PDOException if a database error occurs
  * @return void
  */
 public function save(Post $post)
 {
     $stmt = $this->db->prepare("INSERT INTO posts(title, content, author) values (?,?,?)");
     $stmt->execute(array($post->getTitle(), $post->getContent(), $post->getAuthor()->getUsername()));
 }
开发者ID:ragomez,项目名称:abp2015,代码行数:12,代码来源:PostMapper.php


注:本文中的Post::getAuthor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。