當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Post::getContent方法代碼示例

本文整理匯總了PHP中Post::getContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Post::getContent方法的具體用法?PHP Post::getContent怎麽用?PHP Post::getContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Post的用法示例。


在下文中一共展示了Post::getContent方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create

    public function create($content, $idAuthor, Topic $Topic, SCategory $SCategory)
    {
        $post = new Post($this->db);
        try {
            $post->setContent($content);
            $post->setIdAuthor($idAuthor);
            $post->setTopic($Topic);
            $post->setSCategory($SCategory);
        } catch (Exception $e) {
            $errors = $e->getMessage();
            echo $errors;
        }
        if (!isset($err)) {
            $content = $this->db->quote($post->getContent());
            $idAuthor = $post->getIdAuthor();
            $idTopic = $post->getIdTopic();
            $idSCategory = $post->getIdSCategory();
            $query = 'INSERT INTO post(content, id_author, id_topic, id_sCategory)
						VALUE (' . $content . ',' . $idAuthor . ', ' . $idTopic . ', ' . $idSCategory . ')';
        }
        $res = $this->db->exec($query);
        if ($res) {
            $id = $this->db->lastInsertId();
            if ($id) {
                return $this->findById($id);
            } else {
                throw new Exception('Database error');
            }
        } else {
            throw new Exception($errors);
        }
    }
開發者ID:Hollux,項目名稱:mvcBase2,代碼行數:32,代碼來源:PostManager.class.php

示例2: testGetContent

 /**
  */
 public function testGetContent()
 {
     $expected = "It's that time in the week when 'A foreign affair' goes to the quiz-night at the Grands. We usually ends up at the bottom half in the results. This might be the result of the lack of knowledge we have in things not categorized in either technology, movies or music.\n\nSometimes we've been lucky enough to hit the second to last place, that given us a whopping \$20 bar tab. Split that money on 4-5 people and we can almost get half a beer each.\n\nUsually it's three europeans and one kiwi, but tonight we're getting some help from the french nation.";
     $this->assertEquals($expected, $this->object->getContent());
     $this->object->setContent('This is the new content');
     $this->assertEquals('This is the new content', $this->object->getContent());
 }
開發者ID:stojg,項目名稱:puny,代碼行數:9,代碼來源:PostTest.php

示例3: insert

 public function insert(Post $post)
 {
     $this->conn->beginTransaction();
     try {
         $stmt = $this->conn->prepare('INSERT INTO posts (title, content) VALUES (:title, :content)');
         $stmt->bindValue(':title', $post->getTitle());
         $stmt->bindValue(':content', $post->getContent());
         $stmt->execute();
         $this->conn->commit();
     } catch (Exception $e) {
         $this->conn->rollback();
     }
 }
開發者ID:j4chal,項目名稱:Example-PDO-PHP,代碼行數:13,代碼來源:PostDAO.php

示例4: view_post

function view_post($post)
{
    require_once ROOT . '/application/models/Post.php';
    $app = \Slim\Slim::getInstance();
    // get the posts directory, and post filename
    $dir = POST::POST_PATH;
    $post = new Post($path, $dir);
    $post->createPostFromFile();
    $post_metadata = $post->getMetadata();
    // parse the markdown portion into HTML
    $post_html = $app->config('md')->text($post->getContent());
    // build the final post object
    $post_result = array('title' => $post_metadata['title'], 'date' => $post_metadata['date'], 'desc' => $post_metadata['desc'], 'html' => $post_html);
    // render the post view
    $app->render('blog_post.php', array('post' => $post_result));
}
開發者ID:sw3dish,項目名稱:plateau,代碼行數:16,代碼來源:view_post.php

示例5: getLastPosts

 public static function getLastPosts()
 {
     $session_id = '1000004';
     $connexion = new PDO(PDO_DSN, USER, PASSWD);
     $connexion->exec("set names utf8");
     $query = "SELECT p.post_id, p.post_user, m.mbr_name, m.mbr_birthdate, m.mbr_inscription, p.post_content, p.post_date, p.post_picture FROM post AS p JOIN member m ON p.post_user = m.mbr_id WHERE p.post_user IN ( SELECT frs_a FROM friendship WHERE frs_b = ? UNION SELECT frs_b FROM friendship WHERE frs_a = ? ) ORDER BY post_date DESC";
     $stmt = $connexion->prepare($query);
     $stmt->bindParam(1, $session_id, PDO::PARAM_INT);
     $stmt->bindParam(2, $session_id, PDO::PARAM_INT);
     $stmt->execute();
     if ($stmt->rowCount()) {
         while ($ligne = $stmt->fetch(PDO::FETCH_OBJ)) {
             $member = new User($ligne->post_user, $ligne->mbr_name, $ligne->mbr_birthdate, $ligne->mbr_inscription);
             $post = new Post($ligne->post_id, $member, $ligne->post_content, $ligne->post_date, $ligne->post_picture);
             echo $member->getName() . ":" . $post->getContent() . "<br>";
             // SHOW POSTS HERE
         }
     } else {
         echo 404;
     }
 }
開發者ID:JNorthen,項目名稱:popoplus,代碼行數:21,代碼來源:DatabaseHandler.php

示例6: Post

/*$client = new IXR_Client('http://localhost/exercises/php_exercises/chapter4/server.php');

if (!$client->query('time.getGMTTime')) {
	die("Something went wrong - " . $client->getErrorCode() . $client->getErrorMessage());
}
echo($client->getResponse());*/
/*----------  Design Patterns: Decorator Pattern  ----------*/
print "<br/><br/>";
$bbcode_enabled = 0;
$emoticon_enabled = 1;
$post = new Post();
$comment = new Comment();
$post->filter("Test Title: A Test", "Lorem Ipsum Amet");
$comment->filter("Dolot avenus persina olatus");
if ($bbcode_enabled == false && $emoticon_enabled == false) {
    $postcontent = $post->getContent();
    $commentcontent = $comment->getContent();
} elseif ($bbcode_enabled == true && $emoticon_enabled == false) {
    $bb = new BBCodeParser($post);
    // Passing the Post() object to BBCodeParser()
    $postcontent = $bb->getContent();
    $bb = new BBCodeParser($comment);
    $commentcontent = $bb->getContent();
} elseif ($bbcode_enabled == false && $emoticon_enabled == true) {
    $em = new EmoticonParser($post);
    $postcontent = $em->getContent();
    $em = new EmoticonParser($comment);
    $commentcontent = $em->getContent();
}
/*----------  Design Patterns: Facade Pattern  ----------*/
$F = new Facade();
開發者ID:wdarking,項目名稱:php_exercises,代碼行數:31,代碼來源:index.php

示例7: create

 public function create($idTopic, $content)
 {
     $post = new Post();
     $set = $post->setContent($content);
     if ($set === true) {
         $manager = new TopicManager($this->db);
         $topic = $manager->findById($idTopic);
         $set = $post->setIdTopic($topic);
         if ($set === true) {
             if (isset($_SESSION['id'])) {
                 $manager = new UserManager($this->db);
                 $user = $manager->getCurrent();
                 $set = $post->setIdAuthor($user);
                 if ($set === true) {
                     $idAuthor = intval($user->getId());
                     $idTopic = intval($post->getIdTopic());
                     $content = mysqli_real_escape_string($this->db, $post->getContent());
                     $query = "INSERT INTO post (id_author, id_topic, content) VALUES (" . $idAuthor . ", " . $idTopic . ", '" . $content . "')";
                     $result = mysqli_query($this->db, $query);
                     if ($result) {
                         $id = mysqli_insert_id($this->db);
                         if ($id) {
                             return $this->findById($id);
                         } else {
                             return "Erreur serveur.";
                         }
                     } else {
                         return mysqli_error();
                     }
                 } else {
                     return $set;
                 }
             } else {
                 return "Utilisateur déconnecté.";
             }
         } else {
             return $set;
         }
     } else {
         return $set;
     }
 }
開發者ID:Hollux,項目名稱:Fennec,代碼行數:42,代碼來源:PostManager.class.php

示例8: update

 /**
  * Updates a Post in the database
  * 
  * @param Post $post The post to be updated
  * @throws PDOException if a database error occurs
  * @return void
  */
 public function update(Post $post)
 {
     $stmt = $this->db->prepare("UPDATE posts set title=?, content=? where id=?");
     $stmt->execute(array($post->getTitle(), $post->getContent(), $post->getId()));
 }
開發者ID:ragomez,項目名稱:abp2015,代碼行數:12,代碼來源:PostMapper.php

示例9: showEditVideoReportageForm

    private static function showEditVideoReportageForm($post, $error, $new = false)
    {
        $name = "Edit";
        $caption = "Modifica";
        if ($new) {
            $post = new Post($post);
            $name = "New";
            $caption = "Nuovo";
        }
        ?>
		<div class="title"><?php 
        echo $caption;
        ?>
 Videoreportage</div>
		<?php 
        if (is_array($error)) {
            ?>
		<div class="error"><?php 
            foreach ($error as $err) {
                ?>
			<p><?php 
                echo $err;
                ?>
</p>
			<?php 
            }
            ?>
</div>
		<?php 
        }
        if (!isset($_GET["phase"]) || count($error) != 0) {
            ?>
		<form name="<?php 
            echo $name;
            ?>
Post" action="?type=videoreportage" method="post">
			<!--<p class="post_headline"><label>Occhiello:</label><br />
				<input class="post_headline" name="headline" value="<?php 
            echo Filter::decodeFilteredText($post->getHeadline());
            ?>
"/></p>-->
			<p class="title"><label>Titolo:</label><br/>
				<input class="post_title" name="title" value="<?php 
            echo Filter::decodeFilteredText($post->getTitle());
            ?>
"/></p>
			<p class="post_subtitle"><label>Sottotilolo:</label><br />
				<input class="post_subtitle" name="subtitle" value="<?php 
            echo Filter::decodeFilteredText($post->getSubtitle());
            ?>
"/></p>
			<p class="content"><?php 
            if ($post->getContent() != "") {
                echo youtubeManager::getVideoPlayer($post->getContent());
            }
            ?>
 <fieldset><legend>Video:</legend>
						<label>Inserisci l'URL del video: </label><input type="text" name="userUrl" value="<?php 
            echo youtubeManager::getUrl($post->getContent());
            ?>
">
				</fieldset>
			</p>
			<p class="tags"><label>Tags:</label> 
				<input class="tags" id="post_tags_input" name="tags" value="<?php 
            echo Filter::decodeFilteredText($post->getTags());
            ?>
"/></p>
			<p class="categories"><label>Categorie:</label><br/><?php 
            $cat = array();
            if (trim($post->getCategories()) != "") {
                $cat = explode(", ", Filter::decodeFilteredText($post->getCategories()));
            }
            self::showCategoryTree($cat);
            ?>
			</p>
			<p class="<?php 
            echo trim($post->getPlace()) == "" ? "hidden" : "";
            ?>
"><label id="place_label">Posizione: <?php 
            echo $post->getPlace();
            ?>
</label></p>
			<input type="hidden" name="phase" value="<?php 
            if (isset($_POST["phase"]) == 2) {
                echo '2';
            } else {
                echo '1';
            }
            ?>
">
			<input id="post_place" name="place" type="hidden" value="<?php 
            echo $post->getPlace();
            ?>
" />
			<input name="visible" type="hidden" value="true" />
			<input name="type" type="hidden" value="videoreportage" />
			<p class="submit"><input type="submit" value="Pubblica" /> 
				<input type="button" onclick="javascript:save();" value="Salva come bozza"/></p>
			<script type="text/javascript">
//.........這裏部分代碼省略.........
開發者ID:Esisto,項目名稱:IoEsisto,代碼行數:101,代碼來源:PostPage.php

示例10: getPost

/**
 * Get post
 *
 * This function retrieves an existing post from the server.
 *
 * @param  array  $args (in appkey string, in blogid string, in postid string,
 *                       in username string, in password string)
 * @return string Upon success this will return the content of the post. Upon
 *                failure, the fault will be returned.
 * @link   http://docs.openlinksw.com/virtuoso/fn_blogger.getPost.html
 */
function getPost($args)
{
    global $server, $site;
    $postid = $args[1] + 0;
    $password = $args[3];
    if ($password === $site->ad_pass) {
        $post = new Post($site);
        $post->fetch_from_db($postid);
        // error occured?
        if ($post->postid <= 0) {
            $server->error(8003, 'No post found.');
        }
        $content = '<title>' . $post->getTitle() . '</title>' . $post->getContent();
        $content .= '<template>' . $post->getAttribute('template') . '</template>';
        $content .= '<allow_comments>' . $post->getAttribute('allow_comments') . '</allow_comments>';
        $content .= '<comment_alert>' . $post->getAttribute('comment_alert') . '</comment_alert>';
        $return = array('dateCreated' => $post->time, 'userid' => 1, 'blogid' => 1, 'content' => $content);
        return $return;
    } else {
        $server->error(8000, 'Wrong password given.');
    }
}
開發者ID:n0nick,項目名稱:n0where,代碼行數:33,代碼來源:rpc2.php

示例11: showEditNewsForm

    private static function showEditNewsForm($post, $error, $new = false)
    {
        $name = "Edit";
        $caption = "Modifica";
        if ($new) {
            $post = new Post($post);
            $name = "New";
            $caption = "Nuova";
        }
        ?>
		<div class="title"><?php 
        echo $caption;
        ?>
 Notizia</div>
		<?php 
        if (is_array($error)) {
            ?>
		<div class="error"><?php 
            foreach ($error as $err) {
                ?>
			<p><?php 
                echo $err;
                ?>
</p>
			<?php 
            }
            ?>
</div>
		<?php 
        }
        ?>
		<form name="<?php 
        echo $name;
        ?>
Post" action="?type=News" method="post">
			<p class="post_headline"><label>Occhiello:</label><br />
				<input class="post_headline" name="headline" value="<?php 
        echo $post->getHeadline();
        ?>
"/></p>
			<p class="title"><label>Titolo:</label><br/>
				<input class="post_title" name="title" value="<?php 
        echo $post->getTitle();
        ?>
"/></p>
			<p class="post_subtitle"><label>Sottotilolo:</label><br />
				<input class="post_subtitle" name="subtitle" value="<?php 
        echo $post->getSubtitle();
        ?>
"/></p>
			<p class="content"><label>Contenuto:</label><br/>
			<textarea name="content" id="post_content"><?php 
        echo $post->getContent();
        ?>
</textarea>
				<!-- sostituisco textarea standard con ckeditor -->
				<script type="text/javascript">
					CKEDITOR.replace( 'post_content', { toolbar : 'edited'});
				</script>
			</p>
			<p class="tags"><label>Tags:</label> 
				<input class="tags" id="post_tags_input" name="tags" value="<?php 
        echo $post->getTags();
        ?>
"/></p>
			<p class="categories"><label>Categorie:</label><br/><?php 
        $cat = array();
        if (trim($post->getCategories()) != "") {
            $cat = explode(", ", Filter::decodeFilteredText($post->getCategories()));
        }
        self::showCategoryTree($cat);
        ?>
			</p>
            <p class="<?php 
        echo trim($post->getPlace()) == "" ? "hidden" : "";
        ?>
"><label id="place_label">Posizione: <?php 
        echo $post->getPlace();
        ?>
</label></p>
            	<input id="post_place" name="place" type="hidden" value="<?php 
        echo $post->getPlace();
        ?>
" />
            <input name="visible" type="hidden" value="true" />
            <input name="type" type="hidden" value="news" />
           	<p class="submit"><input type="submit" value="Pubblica" /> 
            	<input type="button" onclick="javascript:save();" value="Salva come bozza"/></p>
             <script type="text/javascript">
            	function save() {
					document.<?php 
        echo $name;
        ?>
Post.visible.value = false;
					document.<?php 
        echo $name;
        ?>
Post.submit();
            	}
            </script>
//.........這裏部分代碼省略.........
開發者ID:Esisto,項目名稱:IoEsisto,代碼行數:101,代碼來源:PostPage.php

示例12: testPost

 public function testPost()
 {
     $date = new \DateTime();
     $post = new Post(123, 1, 'A post', 'Some content', 2, $date, 1, 0);
     $this->assertEquals(123, $post->getID());
     $this->assertEquals('A post', $post->getTitle());
     $this->assertEquals('Some content', $post->getContent());
     $this->assertEquals(2, $post->getVisibility());
     $this->assertEquals($date, $post->getDate());
 }
開發者ID:picolino0,項目名稱:BreezedCMS,代碼行數:10,代碼來源:coreTest.php


注:本文中的Post::getContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。