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


PHP content::createStoryContent方法代碼示例

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


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

示例1: stdClass

// load admin
$q = $db->queryC("SELECT * FROM User,UserInfo WHERE User.userid=UserInfo.userid AND isAdmin=1 LIMIT 1;");
if ($q !== false) {
    $ui = $db->readQ($q);
    $ui->u->name = $ui->name;
    $fData = new stdClass();
    $fData->body = '';
    $fData->tags = '';
    $fData->videoEmbed = '';
    $fData->isFeatureCandidate = 0;
    $fData->mediatype = 'text';
    $fData->url = mysql_real_escape_string('http://www.wired.com/vanish/2009/09/how-evan-ratliff-was-caught/');
    $fData->imageUrl = mysql_real_escape_string('http://www.wired.com/vanish/wp-content/uploads/2009/09/evanbald.jpg');
    $fData->title = mysql_real_escape_string('How Evan Ratliff Was Caught');
    $fData->caption = mysql_real_escape_string('Naked Pizza snagged Evan. But the legwork was done by Jeff Reifman, who was using twitter under @vanishteam. He has just put up an <a href="http://blog.newscloud.com/2009/09/how-we-caught-evan-ratliff.html">amazing post</a> detailing exactly what he did and how he did it. The post should be read in full.');
    $siteContentId = $cObj->createStoryContent($ui, $fData);
    // Add featured story
    $q = $db->delete("FeaturedTemplate");
    $sql = sprintf("REPLACE INTO FeaturedTemplate SET id = 1, template = '%s', story_1_id = %s", 'template_1', $siteContentId);
    $q = $db->query($sql);
    $db->query("UPDATE Content set isFeatured = 0 WHERE isFeatured = 1");
    $db->query("UPDATE Content set isFeatured = 1 WHERE siteContentId = {$siteContentId}");
    // clear out the cache of the home top stories
    require_once PATH_CORE . '/classes/template.class.php';
    $templateObj = new template($db);
    $templateObj->resetCache('home_feature');
    $fData->url = mysql_real_escape_string('http://blog.newscloud.com/2009/09/research-findings-released-engaging-youth-in-social-media-is-facebook-the-new-media-frontier-.html');
    $fData->imageUrl = mysql_real_escape_string('http://farm4.static.flickr.com/3619/3571720938_e30c9d4ab3.jpg');
    $fData->title = mysql_real_escape_string('Research Findings Released: Engaging Youth in Social Media - Is Facebook the New Media Frontier?');
    $fData->caption = mysql_real_escape_string('Counter to the decline in young people’s (print‐based) reading for pleasure and traditional media consumption is a noted increase in out‐of‐school online reading and writing through online fan fiction and social network sites. Yet, according to the Pew research institute, over one third of people under 25 get no news on a daily basis. However, teens spend many hours a week online (a recent British study said 31), particularly on Facebook ‐‐ the most‐trafficked social media site in the world. Facebook has more than 250 million active members.');
    $siteContentId = $cObj->createStoryContent($ui, $fData);
開發者ID:smbale,項目名稱:open-social-media-toolkit,代碼行數:31,代碼來源:populateTestData.php

示例2: addStory

 function addStory($fData)
 {
     $this->setupLibraries();
     $status = array();
     $status['result'] = false;
     // now done through log -- can I assume the bookmarklet is being used on this page or what?
     $this->logObj->update($this->logObj->serialize(0, $this->session->userid, 'addBookmarkTool', 0, 0));
     // Clean up data
     //$fData->title = mysql_real_escape_string(stripslashes($fData->title));
     //$fData->caption = mysql_real_escape_string(stripslashes($fData->caption));
     // Check for duplicate item
     $duplicateStory = false;
     $dups = $this->db->queryC("SELECT siteContentId FROM Content WHERE url = '" . $fData->url . "' AND title = '" . $fData->title . "'");
     if ($dups) {
         $duplicateStory = true;
         $dupResult = $this->db->readQ($dups);
     } else {
         // create temporary content item, temp permalink
         require_once PATH_CORE . '/classes/content.class.php';
         $cObj = new content($this->db);
         $siteContentId = $cObj->createStoryContent($this->session, $fData);
     }
     // add to user's journal
     if ($siteContentId !== false && !$duplicateStory) {
         $status[siteContentId] = $siteContentId;
         // add to journal
         $logItem = $this->logObj->serialize(0, $this->session->userid, 'postStory', $siteContentId);
         $inLog = $this->logObj->update($logItem);
         if ($inLog) {
             $status['result'] = true;
             $status['msg'] = '';
             $logItem = $this->logObj->serialize(0, $this->session->userid, 'vote', $siteContentId);
             $inLog = $this->logObj->update($logItem);
         } else {
             $status['result'] = true;
             $status['msg'] = 'Story previously published';
         }
     } else {
         if ($duplicateStory) {
             $status['result'] = false;
             $status['msg'] = 'That story already exists. You can view it <a href="?p=read&cid=' . $dupResult->siteContentId . '">here</a>';
         } else {
             $status['result'] = false;
             $status['msg'] = 'We encountered a problem adding your story.';
         }
     }
     return $status;
 }
開發者ID:smbale,項目名稱:open-social-media-toolkit,代碼行數:48,代碼來源:pagePostStory.class.php


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