本文整理汇总了PHP中content类的典型用法代码示例。如果您正苦于以下问题:PHP content类的具体用法?PHP content怎么用?PHP content使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了content类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: httpResponseContentIs
function httpResponseContentIs(content $content)
{
$response = clone $this;
$response->content = $content;
$content->recipientOfStringLengthIs($response);
return self::blackholeContentLengthHttpHeaderShouldBeUsedBy($response->httpHeaderIs($response->contentLength));
}
示例2: addaction
public function addaction()
{
$c = new content();
if ($this->input->post("id") !== FALSE) {
$c->get_by_id($this->input->post("id"));
} else {
if ($this->input->post("id") === FALSE) {
$c->user = $this->ion_auth->get_user();
$c->user = $c->user->id;
}
}
$c->parent_section = $this->input->post("parent_section");
$c->parent_content = $this->input->post("parent_content");
$c->title = $this->input->post("title");
$c->cell = $this->input->post("cell");
$c->sort = $this->input->post("sort");
$c->path = $this->input->post("path");
$c->type = $this->input->post("type");
$c->subsection = $this->input->post("subsection") == FALSE ? FALSE : TRUE;
$c->view = $this->input->post("view");
$c->info = $this->input->post("info");
$c->filter = $this->input->post("filter");
// this is a workaround, cuz it makes 2 newline characters
// and i don't know what the hell is wrong with it.
$c->filter = str_replace("\n\n", "\n", $c->filter);
$p = new Content($c->parent_content);
if ($this->input->post("id") === FALSE) {
$this->add_info(lang('system_content_added'));
} else {
$this->ajax = TRUE;
$this->print_text(lang('system_content_edited'));
}
$c->save();
}
示例3: get_rss
function get_rss()
{
global $aa;
require_once e_PLUGIN . "content/handlers/content_class.php";
$aa = new content();
$rss = array();
$array = $aa->getCategoryTree('', '', FALSE);
foreach ($array as $k => $v) {
$name = '';
for ($i = 0; $i < count($array[$k]); $i++) {
$name .= $array[$k][$i + 1] . " > ";
$i++;
}
$name = substr($name, 0, -3);
$feed['name'] = $name;
$feed['url'] = 'content';
//the identifier for the rss feed url
$feed['topic_id'] = $k;
//the topic_id, empty on default (to select a certain category)
$feed['path'] = 'content';
//this is the plugin path location
$feed['text'] = 'this is the rss feed for content category : ' . $name;
$feed['class'] = '0';
$feed['limit'] = '9';
$rss[] = $feed;
}
return $rss;
}
示例4: build
function build($action = 'TopStories', $mode = 'rss')
{
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($this->db);
// if $mode is rss, then echo the output
// if $mode is api, then return the query
switch ($action) {
default:
// do nothing
break;
case 'TopStories':
$this->feedTitle = SITE_TITLE . ' Top Stories';
$this->feedDescription = ' Top rated stories from ' . SITE_TITLE;
$this->feedUrl = $this->baseUrl;
$this->feedRssUrl = $this->baseUrl . '?p=rss&action=TopStories';
$query = $cObj->fetchUpcomingStories('', RSS_NUMBER_STORIES);
break;
}
// output the xml feed
if ($mode == 'rss') {
$code = $this->createXML($this->feedTitle, $this->feedUrl, $this->feedRssUrl, $this->feedDescription, $query);
return $code;
} else {
return $query;
}
}
示例5: postNextTopStory
function postNextTopStory()
{
// only post one story every three hours
$tstamp = $this->statusObj->getState('lastTwitterPost');
if (!isset($_GET['test']) and time() - $tstamp < 60 * TWITTER_INTERVAL_MINUTES) {
return;
}
//echo 'continuing';
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($this->db);
require_once PATH_CORE . '/classes/log.class.php';
$logObj = new log($this->db);
$topStories = $cObj->fetchUpcomingStories();
$uid = 1;
while ($data = $this->db->readQ($topStories)) {
if (!$this->checkLog($uid, $data->siteContentId) and $data->score >= TWITTER_SCORE_THRESHOLD) {
// post to twitter
$result = $this->update($data->siteContentId, $data->title);
if ($result) {
$logItem = $logObj->serialize(0, $uid, 'postTwitter', $data->siteContentId);
$logObj->add($logItem);
$this->statusObj->setState('lastTwitterPost', time());
}
// only do one at a time
return;
}
}
}
示例6: create
function create()
{
$avatar = $this->attachlib->get_avatar($this->user['user_id']);
$content = $this->input['thread'];
$topic_id = $this->input['tid'];
$pcd = intval($this->input['pcd']);
$aid = urldecode($this->input['aid']);
if ($aid) {
$aid_array = array_filter(explode(',', $aid));
$aid = $this->attachlib->tmp2att($aid_array);
}
if ($pcd) {
$c = new content();
$article = $c->get_published_content_byid($pcd);
if ($article) {
$extend_arc = array('title' => $article['title'], 'brief' => $article['brief'], 'href' => $article['content_url'], 'bundle_id' => $article['bundle_id'], 'module_id' => $article['module_id']);
$article = is_array($article['indexpic']) ? array('host' => $article['indexpic']['host'], 'dir' => $article['indexpic']['dir'], 'filepath' => $article['indexpic']['filepath'], 'filename' => $article['indexpic']['filename']) : array();
$aid .= ',' . $this->attachlib->attach($article, 'publish', 'attach', $extend_arc);
}
}
if (!$topic_id) {
$this->errorOutput("请选择一个话题");
}
$short_link = $this->attachlib->outlink(urldecode($this->input['outlink']));
if ($short_link) {
$aid .= ',' . $short_link;
}
$location = array('lat' => $this->input['lat'], 'lon' => $this->input['lon'], 'address' => urldecode($this->input['address']), 'gpsx' => $this->input['gpsx'], 'gpsy' => $this->input['gpsy']);
if ($location['lat'] && $location['lon']) {
$loc = FromBaiduToGpsXY($location['lon'], $location['lat']);
$location['gpsx'] = $loc['x'];
$location['gpsy'] = $loc['y'];
} elseif ($location['gpsx'] && $location['gpsy']) {
$loc = FromGpsToBaiduXY($location['gpsx'], $location['gpsy']);
$location['lon'] = $loc['x'];
$location['lat'] = $loc['y'];
}
if ($map = $this->attachlib->map($location)) {
$aid .= ',' . $map;
}
if (!$content && !$aid) {
$this->errorOutput("内容不能为空");
}
$aid = $aid ? trim($aid, ',') : '';
$data = array('tid' => $topic_id, 'content' => $content, 'aid' => $aid, 'client' => $this->input['client'] ? $this->input['client'] : $this->user['user_name'], 'status' => 0, 'create_time' => TIMENOW, 'user_id' => $this->user['user_id'], 'avatar' => $avatar ? addslashes(serialize($avatar)) : '', 'user_name' => $this->user['user_name'], 'pcd' => $pcd, 'ip' => hg_getip());
$sql = 'INSERT INTO ' . DB_PREFIX . 'thread SET ';
foreach ($data as $key => $val) {
$sql .= "`{$key}` = \"{$val}\",";
}
$sql = trim($sql, ',');
$this->db->query($sql);
$data['id'] = $this->db->insert_id();
$data['format_create_time'] = hg_tran_time($data['create_time']);
$data['materail'] = $this->attachlib->get_attach_by_aid($aid);
$this->attachlib->delete_attach(urldecode($this->input['aid']));
$this->addItem($data);
$this->output();
}
示例7: site
function site()
{
$c = new content();
$data = $c->get_site();
if ($data) {
foreach ($data as $val) {
$this->addItem($val);
}
}
$this->output();
}
示例8: submitAction
/**
* @param Request $request
* @param Request $securekey
* @param Request $redirect
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public function submitAction(Request $request, $securekey, $redirect)
{
$locale = $request->getLocale();
$mode = "module-submission";
$em = $this->getDoctrine()->getManager();
$cs = $this->get('ssone.cms.content');
$fieldsRepository = $this->getFieldsRepository();
$blockService = $this->get('ssone.cms.block');
$contentType = $this->getDoctrine()->getRepository('SSoneCMSBundle:ContentType')->findBySecurekey($securekey);
$content = new content();
$content->setContentType($contentType);
$blockService->contentBlockManager($content);
$form = $this->createForm(new ContentTYPE($mode, $fieldsRepository, $cs, $locale), $content);
$form->handleRequest($request);
print $contentType->getName();
print $form->isValid();
if ($form->isValid()) {
$auditor = $this->get('ssone.cms.recordauditor');
$auditor->auditRecord($content);
//Audit blocks and fields
foreach ($content->getBlocks() as $block) {
$auditor->auditRecord($block);
foreach ($block->getBlockFields() as $blockField) {
$auditor->auditRecord($blockField);
}
}
//handle file uploads
$uploader = $this->get('ssone.cms.fileuploader');
foreach ($form['blocks'] as $block) {
foreach ($block['blockFields'] as $blockField) {
foreach ($blockField['fieldContent'] as $input) {
if (strpos($input->getName(), '_fileupload') !== false) {
$params = explode("_", $input->getName());
$fieldSettings = $fieldsRepository->findBySecurekey($params[2])->getFieldTypeSettings();
if ($fp = $uploader->contentFileUpload($input->getData(), $fieldSettings['fileupload']['fileuploadfolder'])) {
//Get current field content
$blockFieldObj = $blockField->getData();
$blockFieldContents = $blockFieldObj->getFieldContent();
$blockFieldContents[$params[0]] = $fp;
unset($blockFieldContents[$input->getName()]);
$blockFieldObj->setFieldContent($blockFieldContents);
}
}
}
}
}
$em->persist($content);
$em->flush();
$storedContent = $cs->findSecureKeyById($content->getId());
$this->cacheContent($content->getId(), $cs, $em);
return $this->redirect($this->generateUrl('ssone_cms_frontend', array('uri' => $redirect)));
}
return $this->render('SSoneCMSBundle:Content:crud.html.twig', array('form' => $form->createView(), 'contentTitle' => $content->getName(), 'mode' => $mode, 'locale' => $locale));
}
示例9: get_campaigns
function get_campaigns()
{
$campaigns = content::get_all_campaigns();
foreach ($campaigns as $campaign) {
if ($campaign['force_deactivated'] == 'no' && strtotime($campaign['end']) > time()) {
$get = content::fetch_tweets_from_twitter($campaign['campaign_hash']);
}
}
}
示例10: loadFile
static function loadFile($file, $vars = array(), $return = false)
{
if (!file_exists($file)) {
return false;
}
@extract(self::$vars);
@extract($vars);
content::start();
require $file;
return content::end($return);
}
示例11: status
function status()
{
$sql = e107::getDb();
$aa = new content();
if ($maincat = $sql->retrieve("pcontent", "content_id, content_heading", " WHERE content_parent = '0' ORDER BY content_heading", true)) {
$i = 0;
foreach ($maincat as $row) {
$count = 0;
$array = $aa->getCategoryTree("", $row['content_id'], TRUE);
$validparent = implode(",", array_keys($array));
$qrycat = " content_parent REGEXP '" . $aa->CONTENTREGEXP($validparent) . "' ";
$count = $sql->count("pcontent", "(*)", "WHERE " . $qrycat . " AND content_refer != 'sa' ");
$var[$i]['icon'] = "<img src='" . e_PLUGIN_ABS . "content/images/content_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ";
$var[$i]['title'] = $row['content_heading'];
$var[$i]['url'] = e_PLUGIN . "content/admin_content_config.php?content." . $row['content_id'];
$var[$i]['total'] = $count;
$i = $i + 1;
}
}
return $var;
}
示例12: load
function load($template = 'default', $vars = array(), $return = false)
{
$file = c::get('tpl.root') . '/' . $template . '.php';
if (!file_exists($file)) {
return false;
}
@extract(self::$vars);
@extract($vars);
content::start();
require $file;
return content::end($return);
}
示例13: createTempContent
function createTempContent($userinfo = NULL, $wireid = 0)
{
require_once PATH_CORE . '/classes/content.class.php';
$cObj = new content($this->db);
$info = $this->getWireStory($wireid);
require_once PATH_CORE . '/classes/parseStory.class.php';
$psObj = new parseStory();
require_once PATH_CORE . '/classes/utilities.class.php';
$this->utilObj = new utilities($this->db);
$info->title = stripslashes($info->title);
$info->caption = stripslashes($this->utilObj->shorten($info->caption));
// to do - replace proxy feed urls with final redirect
$info->title = $psObj->cleanTitle($info->title);
// create permalink
$info->permalink = $cObj->buildPermalink($info->title);
// serialize the content
$info->title = mysql_real_escape_string($info->title);
$info->caption = mysql_real_escape_string($info->caption);
$story = $cObj->serialize(0, $info->title, $info->caption, $info->source, $info->url, $info->permalink, $userinfo->ncUid, $userinfo->name, $userinfo->userid, '', $userinfo->votePower, 0, 0);
// post wire story to content
$siteContentId = $cObj->add($story);
return $siteContentId;
}
示例14: home
function home()
{
$out = "there is actually no content. enable content module to manage this page";
if (module_manager::is_enabled("content")) {
$out = "";
$nodes = content_database::node_load_all();
$b = false;
if (count($nodes) > 0) {
page::title("Home");
foreach ($nodes as $node) {
if (content::node_access_read($node->nid)) {
$b = true;
$out .= "<div class='post'>";
if ($node->title != null) {
$out .= "<div class='title'>";
$out .= page::link("node/" . $node->nid, $node->title);
$out .= "</div>";
}
if ($node->description != null) {
$out .= "<div class='content'>";
$node->description = utf8_decode($node->description);
if (strlen($node->description) > 200) {
$out .= substr($node->description, 0, 200) . "... " . page::link("node/" . $node->nid, t("+ read more"));
} else {
$out .= $node->description;
}
$out .= "</div>";
}
$out .= "<div class='author'>";
$out .= "<hr/>";
$out .= content_page::post_author_date($node->uid, $node->author, $node->date);
$out .= "<hr/>";
$out .= "</div>";
$out .= "</div>";
}
}
} else {
$out .= "there is no content, please add a content first.";
}
}
return $b ? $out : "there is no content.";
}
示例15:
if (!empty($_GET['delete']) && $_GET['delete'] == 1) {
$content_id = $_GET['header_id'];
$result = content::delete($content_id);
if ($result == 1) {
echo 'Comment is deleted!';
} else {
return false;
}
}
?>
</div></div>
<div id="json_drop_column">
<?php
if (!empty($_GET['delete']) && $_GET['delete'] == 1) {
$content_name = $_GET['content_name'];
$field_name = $_GET['field_name'];
$result = content::drop_column($content_name, $field_name);
if ($result == 1) {
echo 'Comment is deleted!';
} else {
return false;
}
}
?>
</div>
<?php
include_template('footer.inc');