本文整理汇总了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);
示例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;
}