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')); } }
/** * 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; } } }
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)); } }
/** 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); } } }
/** 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(); }
/** * @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; }
/** * 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; }
/** * 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); }
function addTitlle($Category, $Id, $Lang) { require_once 'classes/model/Content.php'; $content = new Content(); $value = $content->load($Category, '', $Id, $Lang); return $value; }
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; }
public function OrderedList($content, $attr = null) { $Items = new Content(); foreach ($content as $item) { $Items->AddContent($this->ListItem($item)); } return new Tag('ol', $Items, $attr); }
/** * @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(); }
/** 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); } }
public static function factory($id = null) { $instance = new Content(); if (!empty($id)) { $instance->where('id', $id)->get(); } return $instance; }
/** 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); } }
/** Set up each page * @access public * @return void * @throws Pas_Exception_Param */ public function indexAction() { if ($this->getParam('slug', false)) { $content = new Content(); $this->view->contents = $content->getContent('conservation', $this->getParam('slug')); } else { throw new Pas_Exception_Param('That page is not found.', 404); } }
public function show() { $_SESSION["apps"] = $_GET["id"]; include_once "views/content.php"; $content = new Content(); $result = $content->show(); $this->vars["result"] = $result; ContentView::render($this->vars, "showContent"); }
public function executeCulture(Content &$objContent) { $objCulture = new Culture(); $culture = $objCulture->checkCulture($this->getRequestParameter('isolang')); $objContent->getObjCulture()->setCulture($culture); $module = $this->getRequestParameter('module'); $action = $this->getRequestParameter('action'); $this->redirectIndoor($module, $action); }
public function setAnalysisEmail(Analyse $analysis, $emailTo, $toName) { $content = new Content(); $message = $content->getAnalysisContent($analysis, Session::getLoggedUser()->getFirstName()); $email = new Email(); $email->setSubject("Olá " . $toName . "! Você recebeu uma análise do Bureau Inteligencia!"); $email->setMessage($message); return $email->send(null, $emailTo); }
private function toModel($dto) { // Convert DTO into model object $content = new Content(); $content->setName($dto['name']['S']); $content->setType($dto['type']['S']); $content->setEmailOwner($dto['owner']['S']); $content->setUrl($dto['url']['S']); return $content; }
function addFile($fileName, $child, $dateStart, $dateEnd, $type, $adultEmail) { $content = new Content(); $content->setName($fileName); $content->setEmailOwner($adultEmail); $content->setType($type); $child->addContent($content, $dateStart, $dateEnd); $childDao = new ChildDAO(DynamoDbClientBuilder::get()); $childDao->update($child); }
public function delete(Content $image) { $filename = self::PHOTOS_DIRECTORY . $image->getFilename(); if (file_exists($filename)) { unlink($filename); //delete the file } $query = "DELETE FROM images WHERE id={$image->getId()} LIMIT 1"; self::$mysqli->query($query); }
function after_content_create($content) { $s = new Setting(); $s->where('name', 'uploading_publish_on_captured_date')->get(); if ($s->exists() && $s->value === 'true') { $fresh = new Content(); $fresh->get_by_id($content['id']); $fresh->published_on = $content['captured_on']['utc'] ? $content['captured_on']['timestamp'] : 'captured_on'; $fresh->save(); } }
function siteIndex() { if (isset($_POST['siteIndex'])) { $content = new Content(); $content->storeFormValues($_POST); $content->siteIndex(); header("Location: index.php?action=listContent&success=siteIndexUpdated&categoryId=" . $_GET['categoryId']); } else { header("Location: index.php?action=listContent&error=siteIndexNotUpdated&categoryId=" . $_GET['categoryId']); } }
function copyContent() { if (isset($_POST['saveChanges'])) { $_POST['categoryId'] = $_POST['copyId']; $_POST['id'] = $_POST['contentId']; $content = new Content(); $content->storeFormValues($_POST); $content->copyContent(); header("Location: index.php?action=listContent&categoryId=" . $_POST['categoryId'] . "&success=contentCopied"); } }
/** * 批量删除 */ public function batchDel() { $aid = Q('aid', '', ''); if (empty($aid)) { $this->error('请选择文章'); } $ContentModel = new Content(); foreach ($aid as $id) { $ContentModel->del($id); } $this->success('删除成功'); }
function news() { include "config/site.php"; require_once 'model/Content.php'; require_once 'model/Block.php'; $content = new Content(); $block = new Block(); $contentsRecommend = $content->getFirstBatchRecommend($newmaxnum); //$contentsVisitsTop = $content->getFirstBatchByVisits($topmaxnum); $blocks = $block->getBlocksWithContentNum(); require "{$tpl_root}/_news.php"; }
/** Build the menu * @access public * @return string */ public function staffsMenu() { $staffs = new Content(); $staff = $staffs->buildMenu('staffs'); foreach ($staff as $t) { echo '<li><a href="'; echo $this->view->url(array('module' => 'staffshoardsymposium', 'controller' => 'papers', 'action' => 'index', 'slug' => $t['slug']), 'staffs', true); echo '" title="Read more">'; echo $t['menuTitle']; echo '</a></li>'; } }
/** * Check whether $content contains a link to $filterEntry * * @param Content $content Content to check * @param string $filterEntry Domainparts, see makeRegex() for more details * @return int 0 if no match or 1 if there's at least one match */ static function matchEntry(Content $content, $filterEntry) { if (!$content instanceof TextContent) { // TODO: handle other types of content too. // Maybe create ContentHandler::matchFilter( LinkFilter ). // Think about a common base class for LinkFilter and MagicWord. return 0; } $text = $content->getNativeData(); $regex = LinkFilter::makeRegex($filterEntry); return preg_match($regex, $text); }
/** * returns the full path to teh page */ public function realPath($pageId) { $c = new Content(); $page = $c->find($pageId)->current(); if ($page) { $parents = $c->getParents($pageId); if (is_array($parents) && count($parents) > 0) { $path = implode('/', $parents) . '/'; } $fullpath = $path . $page->title; return strtolower($fullpath); } }