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


PHP Post::setTitle方法代码示例

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


在下文中一共展示了Post::setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testLockedFields

 public function testLockedFields()
 {
     $post = new Post();
     $post->activateLocker();
     $post->activateLockCheck();
     $post->setTitle('A super book');
     $post->save();
     $this->assertTrue($post->getTitleLock());
     $this->assertEquals('A super book', $post->getTitle());
     $post->setTitle('New Title');
     $this->assertEquals('New Title', $post->getTitle());
     $post->save();
     $this->assertEquals('A super book', $post->getTitle());
 }
开发者ID:donkeycode,项目名称:propel-lockable-behavior,代码行数:14,代码来源:LockableBehaviorTest.php

示例2: createPost

 public function createPost($data)
 {
     $currentUser = parent::authenticateUser();
     $post = new Post();
     if (isset($data->title) && isset($data->content)) {
         $post->setTitle($data->title);
         $post->setContent($data->content);
         $post->setAuthor($currentUser);
     }
     try {
         // validate Post object
         $post->checkIsValidForCreate();
         // if it fails, ValidationException
         // save the Post object into the database
         $postId = $this->postMapper->save($post);
         // response OK. Also send post in content
         header($_SERVER['SERVER_PROTOCOL'] . ' 201 Created');
         header('Location: ' . $_SERVER['REQUEST_URI'] . "/" . $postId);
         header('Content-Type: application/json');
         echo json_encode(array("id" => $postId, "title" => $post->getTitle(), "content" => $post->getContent()));
     } catch (ValidationException $e) {
         header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad request');
         echo json_encode($e->getErrors());
     }
 }
开发者ID:xrlopez,项目名称:TSW,代码行数:25,代码来源:PostRest.php

示例3: parseItem

function parseItem($blog, $item, $ts)
{
    if ($ts != 0 && $item->pubdate <= $ts) {
        logmsg('Zatrzymanie na wpisie: %s', StringUtils::removeAccents($item->title));
        return false;
    }
    logmsg('  - Parsowanie wpisu: %s', StringUtils::removeAccents($item->title));
    $post = new Post();
    $post->setBlog($blog);
    foreach ($item->tags as $name) {
        $tag = TagPeer::retriveByName($name, true);
        if ($post->addTag($tag)) {
            logmsg('    - Znaleziono tag: %s', $name);
        }
    }
    if ($post->hasTags()) {
        $shortened = $post->setFullContent($item->content);
        $post->setLink(htmlspecialchars($item->link));
        $post->setTitle($item->title);
        $post->setCreatedAt($item->pubdate);
        $post->setShortened($shortened);
        $post->save();
    } else {
        logmsg('    - Nie znaleziono tagow');
    }
    return true;
}
开发者ID:noose,项目名称:Planeta,代码行数:27,代码来源:refresh.php

示例4: controlerJob

 public function controlerJob($maincont)
 {
     if ($maincont->isLoggued()) {
         if (isset($_POST["title"])) {
             $p = new Post();
             $p->setTitle($_POST["title"]);
             $p->setBody($_POST["body"]);
             $p->setHour(date("h:i:s"));
             $p->setDate(date("Y-m-d"));
             // gestion des tags
             $tags = explode(" ", $_POST["tags"]);
             foreach ($tags as $t) {
                 if ($t == "") {
                     continue;
                 }
                 $ta = Tag::getByTag($t);
                 //echo "Tag : $t<br />";
                 if (count($ta) == 0) {
                     $mytag = new Tag();
                     $mytag->setTag($t);
                 } else {
                     $mytag = $ta[0];
                 }
                 // création du posttag liant le tag et le post
                 $pt = new Posttag();
                 $pt->setPostid($p->id);
                 $pt->setTagid($mytag->id);
             }
         }
         $maincont->goModule("post", "admin");
     } else {
         $maincont->goModule("home", "display");
     }
 }
开发者ID:rogerwilko,项目名称:Yet-Another-Blog,代码行数:34,代码来源:controler.php

示例5: getPostFromJSON

 private static function getPostFromJSON($id, $json)
 {
     $post = new Post($id);
     $post->setText($json['text']);
     $post->setTitle($json['title']);
     return $post;
 }
开发者ID:scarlettkuro,项目名称:xii,代码行数:7,代码来源:PostStorage.php

示例6: save

 static function save($id)
 {
     $post = new Post($id);
     $post->setText($_POST['post_text']);
     $post->setTitle($_POST['post_title']);
     $newid = PostStorage::savePost($post);
     redirect_to('/' . $newid);
 }
开发者ID:scarlettkuro,项目名称:xii,代码行数:8,代码来源:PostController.php

示例7: findPost

 /**
  * {@inheritDoc}
  */
 public function findPost($id)
 {
     $postData = $this->data[$id];
     $model = new Post();
     $model->setId($postData['id']);
     $model->setTitle($postData['title']);
     $model->setText($postData['text']);
     return $model;
 }
开发者ID:rachelleannmorales,项目名称:aboitiz,代码行数:12,代码来源:PostService.php

示例8: getById

 /**
  * Returns Post object by specified id
  *
  * @param int $id
  * @return Post|null
  */
 public function getById($id)
 {
     $arrayData = $this->persistence->retrieve($id);
     if (is_null($arrayData)) {
         return null;
     }
     $post = new Post();
     $post->setId($arrayData['id']);
     $post->setAuthor($arrayData['author']);
     $post->setCreated($arrayData['created']);
     $post->setText($arrayData['text']);
     $post->setTitle($arrayData['title']);
     return $post;
 }
开发者ID:kabircse,项目名称:DesignPatternsPHP,代码行数:20,代码来源:PostRepository.php

示例9: processResults

 private function processResults($statement)
 {
     $results = array();
     if ($statement) {
         while ($row = $statement->fetch(PDO::FETCH_OBJ)) {
             $post = new Post();
             $post->setId($row->post_id);
             $post->setTitle($row->title);
             $post->setContent($row->content);
             $results[] = $post;
         }
     }
     return $results;
 }
开发者ID:j4chal,项目名称:Example-PDO-PHP,代码行数:14,代码来源:PostDAO.php

示例10: user_update_post

 public function user_update_post()
 {
     $db = new PDO("mysql:dbname=xuthulu", 'root', 'password');
     $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $post = new Post($db, $_SESSION['user_id'], $_POST['prod_id']);
     $post->setTitle($_POST['title']);
     $post->setDescription($_POST['description']);
     $post->setCondition($_POST['condition']);
     $post->setPrice($_POST['price']);
     if ($post->update_post()) {
         header('Location: userpage.php');
         exit;
     } else {
         throw new Exception("An error has occured. Please try again.");
     }
 }
开发者ID:ireydiak,项目名称:xuthulu,代码行数:16,代码来源:user_controler.php

示例11: fixturesAction

 /**
  * Console-only route to generate fixtures.
  */
 public function fixturesAction()
 {
     $em = $this->getEntityManager();
     for ($i = 0; $i < 100; $i++) {
         $post = new Post();
         $post->setTitle('Post ' . uniqid());
         $post->setIntro(str_repeat('intro ', rand(1, 100)));
         $content = '';
         for ($j = mt_rand(1, 100); $j > 0; $j--) {
             $content .= str_repeat('lorem ipsum ', rand(1, 20));
         }
         $post->setContent($content);
         $em->persist($post);
     }
     $em->flush();
 }
开发者ID:joacub,项目名称:jc-blog,代码行数:19,代码来源:PostController.php

示例12: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $p1 = new Post();
     $p1->setTitle("1 Lorem Impsum post");
     $p1->setBody("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
     $p1->setAuthor($this->getAuthor($manager, 'Vlad'));
     $p2 = new Post();
     $p2->setTitle("2 Lorem Impsum post");
     $p2->setBody("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
     $p2->setAuthor($this->getAuthor($manager, 'Nikolay'));
     $p3 = new Post();
     $p3->setTitle("3 Lorem Impsum post");
     $p3->setBody("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.");
     $p3->setAuthor($this->getAuthor($manager, 'Edgar'));
     $manager->persist($p1);
     $manager->persist($p2);
     $manager->persist($p3);
     $manager->flush();
 }
开发者ID:HokageSymfony,项目名称:master,代码行数:22,代码来源:15-Authors.php

示例13: process

 public function process($ctrl)
 {
     OW::getCacheManager()->clean(array(PostDao::CACHE_TAG_POST_COUNT));
     $service = PostService::getInstance();
     /* @var $postDao PostService */
     $data = $this->getValues();
     $data['title'] = UTIL_HtmlTag::stripJs($data['title']);
     $postIsNotPublished = $this->post->getStatus() == 2;
     $text = UTIL_HtmlTag::sanitize($data['post']);
     /* @var $post Post */
     $this->post->setTitle($data['title']);
     $this->post->setPost($text);
     $this->post->setIsDraft($_POST['command'] == 'draft');
     $isCreate = empty($this->post->id);
     if ($isCreate) {
         $this->post->setTimestamp(time());
         //Required to make #698 and #822 work together
         if ($_POST['command'] == 'draft') {
             $this->post->setIsDraft(2);
         }
         BOL_AuthorizationService::getInstance()->trackAction('blogs', 'add_blog');
     } else {
         //If post is not new and saved as draft, remove their item from newsfeed
         if ($_POST['command'] == 'draft') {
             OW::getEventManager()->trigger(new OW_Event('feed.delete_item', array('entityType' => 'blog-post', 'entityId' => $this->post->id)));
         } else {
             if ($postIsNotPublished) {
                 // Update timestamp if post was published for the first time
                 $this->post->setTimestamp(time());
             }
         }
     }
     $service->save($this->post);
     $tags = array();
     if (intval($this->post->getId()) > 0) {
         $tags = $data['tf'];
         foreach ($tags as $id => $tag) {
             $tags[$id] = UTIL_HtmlTag::stripTags($tag);
         }
     }
     $tagService = BOL_TagService::getInstance();
     $tagService->updateEntityTags($this->post->getId(), 'blog-post', $tags);
     if ($this->post->isDraft()) {
         $tagService->setEntityStatus('blog-post', $this->post->getId(), false);
         if ($isCreate) {
             OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'create_draft_success_msg'));
         } else {
             OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'edit_draft_success_msg'));
         }
     } else {
         $tagService->setEntityStatus('blog-post', $this->post->getId(), true);
         //Newsfeed
         $event = new OW_Event('feed.action', array('pluginKey' => 'blogs', 'entityType' => 'blog-post', 'entityId' => $this->post->getId(), 'userId' => $this->post->getAuthorId()));
         OW::getEventManager()->trigger($event);
         if ($isCreate) {
             OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'create_success_msg'));
             OW::getEventManager()->trigger(new OW_Event(PostService::EVENT_AFTER_ADD, array('postId' => $this->post->getId())));
         } else {
             OW::getFeedback()->info(OW::getLanguage()->text('blogs', 'edit_success_msg'));
             OW::getEventManager()->trigger(new OW_Event(PostService::EVENT_AFTER_EDIT, array('postId' => $this->post->getId())));
         }
         $ctrl->redirect(OW::getRouter()->urlForRoute('post', array('id' => $this->post->getId())));
     }
 }
开发者ID:jorgemunoz8807,项目名称:havanabook,代码行数:64,代码来源:save.php

示例14: PDO

<?php

include_once 'Registry.php';
include_once 'dao/PostDAO.php';
include_once 'model/Post.php';
// Instanciar uma conexão com PDO
$conn = new PDO('mysql:host=localhost;port=3306;dbname=example-pdo', 'user', 'password');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Armazenar essa instância no Registry
$registry = Registry::getInstance();
$registry->set('Connection', $conn);
// Instanciar um novo Post e setar informações
$primeiroPost = new Post();
$primeiroPost->setTitle('Primeiro post');
$primeiroPost->setContent('Conteudo!');
// Instanciar um novo Post e setar informações
$segundoPost = new Post();
$segundoPost->setTitle('Segundo post');
$segundoPost->setContent('Conteudo!');
// Instanciar o DAO e trabalhar com os métodos
$postDAO = new PostDAO();
$postDAO->insert($primeiroPost);
$postDAO->insert($segundoPost);
// Resgatar todos os registros e iterar
$results = $postDAO->getAll();
foreach ($results as $post) {
    echo $post->getTitle() . '<br />';
    echo $post->getContent() . '<br />';
    echo '<br />';
}
开发者ID:j4chal,项目名称:Example-PDO-PHP,代码行数:30,代码来源:index.php

示例15: Create

<?php

require_once 'autoloader.php';
echo "ok";
$query = new Create();
$query->createDatabase();
$user = new Post();
$user->setTitle('Etiam posuere');
$user->setPhotos('pics02.jpg');
$user->setContent('Pellentesque viverra vulputate enim. Aliquam erat volutpat. Pellentesque tristique ante. Sed vel tellus.');
$user->save();
开发者ID:medrupaloscil,项目名称:frameSup,代码行数:11,代码来源:index.php


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