本文整理汇总了PHP中Content类的典型用法代码示例。如果您正苦于以下问题:PHP Content类的具体用法?PHP Content怎么用?PHP Content使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Content类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$content = new Content();
$slug = $this->_getParam('slug');
if ($slug == '\\d+') {
$content = new Content();
$this->view->contents = $content->getFrontContent('treports');
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($this->_config->webservice->google->username, $this->_config->webservice->google->password, $service);
$docs = new Zend_Gdata_Docs($client);
$docsQuery = new Zend_Gdata_Docs_Query();
$docsQuery->setQuery('title:Treasure Annual Report');
$feed = $docs->getDocumentListFeed($docsQuery);
$documents = array();
foreach ($feed->entries as $entry) {
$title = $entry->title;
foreach ($entry->link as $link) {
if ($link->getRel() === 'alternate') {
$altlink = $link->getHref();
}
}
$documents[] = array('title' => $title, 'altlink' => $altlink, 'updated' => $entry->updated, 'type' => $entry->content->type, 'published' => $entry->published);
}
$this->view->documents = $documents;
} else {
$this->view->contents = $content->getContent('treports', $this->_getParam('slug'));
}
}
示例2: find
/**
* Tries to find content that matches the input query
* @param string $query
*/
public function find($query)
{
$q = implode('%', explode(' ', $query));
$sql = 'SELECT content.* FROM content JOIN idiom ON content.idiom_id = idiom.id
WHERE idiom.code = ? AND content.publish = 1
AND (
content.keywords like (?)
OR content.alias like (?)
OR content.title like (?)
OR content.description like (?)
OR content.intro like (?)
OR content.html like (?)
)
ORDER BY visits DESC';
// Prepare values and run query
$q = "%{$q}%";
$rows = R::getAll($sql, array(BootWiki::getIdiom(), $q, $q, $q, $q, $q, $q));
$results = R::convertToBeans('content', $rows);
if (!empty($results)) {
foreach ($results as $item) {
$content = new Content($item->alias);
$content->importBean($item);
$this->items[] = $content;
}
}
}
示例3: executeNovaPagina
public function executeNovaPagina(sfWebRequest $request)
{
if ($request->isXmlHttpRequest() || true) {
//apenas por ajax
sfConfig::set('sf_web_debug', false);
sfProjectConfiguration::getActive()->loadHelpers(array('I18N', 'Date'));
$cmspage = new Cmspage();
$content = new Content();
$content->setId(null);
$cmspage->setContent($content);
$cmspage->setId(null);
$cmsGroupcontent = $this->getUser()->getAttribute('contentGroup');
$this->forward404Unless($cmsGroupcontent);
$cmspage->setCmsgroupcontent($cmsGroupcontent);
$this->formContent = new PageContentForm($cmspage);
if ($request->isMethod('post')) {
//return $this->renderPartial('cms/debug',array('values'=>$request->getParameter('pagina')));
$this->formContent->bind($request->getParameter('pagina'));
if ($this->formContent->isValid()) {
$this->logMessage('O formContent foi válido. cms/actions: ' . __FILE__ . __LINE__);
try {
$this->formContent->save();
return $this->renderPartial("cms/viewPage", array('page' => $this->formContent->getCmspageobj(), 'isNew' => true, 'values' => $this->formContent->getValues()));
} catch (Exception $e) {
//TODO: We should to handle the error and render it.
throw $e;
}
//return $this->renderPartial("cms/viewPage",array('page'));
}
}
//parent::executeNew($request);
return $this->renderPartial('cms/content_form', array('formContent' => $this->formContent));
}
}
示例4: indexAction
/** Setup index page
*/
public function indexAction()
{
$content = new Content();
$this->view->contents = $content->getFrontContent('database');
$thumbs = new Slides();
$this->view->thumbs = $thumbs->getLast10Thumbnails(4);
$finds = new Finds();
$this->view->counts = $finds->getCountAllFinds();
$recent = new Logins();
$this->view->logins = $recent->todayVisitors();
$form = new SolrForm();
$form->setMethod('post');
$this->view->form = $form;
$values = $form->getValues();
if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
if ($form->isValid($form->getValues())) {
$params = array_filter($form->getValues());
$params = $this->array_cleanup($params);
$this->_flashMessenger->addMessage('Your search is complete');
$this->_helper->Redirector->gotoSimple('results', 'search', 'database', $params);
} else {
$form->populate($data);
}
}
}
示例5: indexAction
/** Initialise the index pages
* @access public
* @return void
*/
public function indexAction()
{
$content = new Content();
$this->view->contents = $content->getFrontContent('research');
$research = new ResearchProjects();
$this->view->research = $research->getCounts();
}
示例6: replaceSection
/**
* @see Content::replaceSection()
*/
public function replaceSection($section, Content $with, $sectionTitle = '')
{
wfProfileIn(__METHOD__);
$myModelId = $this->getModel();
$sectionModelId = $with->getModel();
if ($sectionModelId != $myModelId) {
wfProfileOut(__METHOD__);
throw new MWException("Incompatible content model for section: " . "document uses {$myModelId} but " . "section uses {$sectionModelId}.");
}
$oldtext = $this->getNativeData();
$text = $with->getNativeData();
if ($section === '') {
wfProfileOut(__METHOD__);
return $with;
# XXX: copy first?
}
if ($section == 'new') {
# Inserting a new section
$subject = $sectionTitle ? wfMessage('newsectionheaderdefaultlevel')->rawParams($sectionTitle)->inContentLanguage()->text() . "\n\n" : '';
if (wfRunHooks('PlaceNewSection', array($this, $oldtext, $subject, &$text))) {
$text = strlen(trim($oldtext)) > 0 ? "{$oldtext}\n\n{$subject}{$text}" : "{$subject}{$text}";
}
} else {
# Replacing an existing section; roll out the big guns
global $wgParser;
$text = $wgParser->replaceSection($oldtext, $section, $text);
}
$newContent = new WikitextContent($text);
wfProfileOut(__METHOD__);
return $newContent;
}
示例7: filterMergedContent
/**
* Hook function for EditFilterMergedContent
*
* @param IContextSource $context
* @param Content $content
* @param Status $status
* @param string $summary
* @param User $user
* @param bool $minoredit
*
* @return bool
*/
static function filterMergedContent(IContextSource $context, Content $content, Status $status, $summary, User $user, $minoredit)
{
$title = $context->getTitle();
if (isset($title->spamBlackListFiltered) && $title->spamBlackListFiltered) {
// already filtered
return true;
}
// get the link from the not-yet-saved page content.
// no need to generate html to get external links
$pout = $content->getParserOutput($title, null, null, false);
$links = array_keys($pout->getExternalLinks());
// HACK: treat the edit summary as a link
if ($summary !== '') {
$links[] = $summary;
}
$spamObj = BaseBlacklist::getInstance('spam');
$matches = $spamObj->filter($links, $title);
if ($matches !== false) {
$status->fatal('spamprotectiontext');
foreach ($matches as $match) {
$status->fatal('spamprotectionmatch', $match);
}
}
// Always return true, EditPage will look at $status->isOk().
return true;
}
示例8: serializeContent
/**
* Serializes the CollaborationHubContent object.
*
* @param $content Content
* @param $format string|null
* @return mixed
*/
public function serializeContent(Content $content, $format = null)
{
if ($format === self::FORMAT_WIKI) {
return $content->convertToHumanEditable();
}
return parent::serializeContent($content, $format);
}
开发者ID:wikimedia,项目名称:mediawiki-extensions-CollaborationKit,代码行数:14,代码来源:CollaborationHubContentHandler.php
示例9: addTitlle
function addTitlle($Category, $Id, $Lang)
{
require_once 'classes/model/Content.php';
$content = new Content();
$value = $content->load($Category, '', $Id, $Lang);
return $value;
}
示例10: executeAttribute
public function executeAttribute(Content &$objContent)
{
$objContent->setAttribute('teste', 'HAHA!!!');
$objContent->setFlush('teste', '12334343430');
//$this->forward('Default','Index');
$this->redirectIndoor('Default', 'Index');
return ViewActions::VIEW_NONE;
}
示例11: OrderedList
public function OrderedList($content, $attr = null)
{
$Items = new Content();
foreach ($content as $item) {
$Items->AddContent($this->ListItem($item));
}
return new Tag('ol', $Items, $attr);
}
示例12: doIt
/**
* @access public
* @param aExtrinsicState
* @ParamType aExtrinsicState
*/
public function doIt($tagRoute, $parameters)
{
$menuEntity = $GLOBALS['sys_menu'];
$menuTemplate = new Content($menuEntity, $menuEntity);
$menuTemplate->setFilter("sys_menu_parent_id", $parameters["parent_id"]);
$menuTemplate->setOrderFields("sys_menu_position", 'sys_menu_parent', "sys_menu0_position");
return $menuTemplate->get();
}
示例13: pageAction
/** Setup an individual page
* @access public
* @return void
*/
public function pageAction()
{
if ($this->getParam('slug', 0)) {
$this->view->contents = $this->_content->getContent('medievalcoins', (string) $this->getParam('slug'));
} else {
throw new Pas_Exception_Param($this->_missingParameter, 500);
}
}
示例14: factory
public static function factory($id = null)
{
$instance = new Content();
if (!empty($id)) {
$instance->where('id', $id)->get();
}
return $instance;
}
示例15: indexAction
/** The default action - show the home page
*/
public function indexAction()
{
if ($this->_getParam('slug', 0)) {
$content = new Content();
$this->view->content = $content->getContent('frg', $this->_getParam('slug'));
} else {
throw new Pas_ParamException($this->_missingParameter);
}
}