本文整理汇总了PHP中aTools::getOptionI18n方法的典型用法代码示例。如果您正苦于以下问题:PHP aTools::getOptionI18n方法的具体用法?PHP aTools::getOptionI18n怎么用?PHP aTools::getOptionI18n使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aTools
的用法示例。
在下文中一共展示了aTools::getOptionI18n方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeShow
public function executeShow(sfWebRequest $request)
{
$this->buildParams();
$this->dateRange = '';
$this->aEvent = $this->getRoute()->getObject();
$this->categories = aCategoryTable::getCategoriesForPage($this->page);
$this->forward404Unless($this->aEvent);
$this->forward404Unless($this->aEvent['status'] == 'published' || $this->getUser()->isAuthenticated());
$this->preview = $this->getRequestParameter('preview');
aBlogItemTable::populatePages(array($this->aEvent));
// Thanks to Giles Smith for catching that we had no titles on our blog post permalink pages!
// Too much Chrome will do that to you (:
// Title is pre-escaped as valid HTML
$prefix = aTools::getOptionI18n('title_prefix');
$suffix = aTools::getOptionI18n('title_suffix');
$this->getResponse()->setTitle($prefix . $this->aEvent->Page->getTitle() . $suffix, false);
$this->calendar = $this->buildCalendar($request);
return $this->pageTemplate;
}
示例2: executeReorganize
/**
* DOCUMENT ME
* @param sfWebRequest $request
*/
public function executeReorganize(sfWebRequest $request)
{
// Reorganizing the tree = escaping your page-specific security limitations.
// So only full CMS admins can do it.
$this->flunkUnless($this->getUser()->hasCredential('cms_admin'));
$root = aPageTable::retrieveBySlug('/');
$this->forward404Unless($root);
$this->treeData = $root->getTreeJSONReady(false);
// setTitle takes care of escaping things
$this->getResponse()->setTitle(aTools::getOptionI18n('title_prefix') . 'Reorganize' . aTools::getOptionI18n('title_suffix'));
}
示例3: setPageEnvironment
public static function setPageEnvironment(sfAction $action, aPage $page)
{
// Title is pre-escaped as valid HTML
$prefix = aTools::getOptionI18n('title_prefix');
$action->getResponse()->setTitle($prefix . $page->getTitle(), false);
// Necessary to allow the use of
// aTools::getCurrentPage() in the layout.
// In Symfony 1.1+, you can't see $action->page from
// the layout.
aTools::setCurrentPage($page);
// Borrowed from sfSimpleCMS
if (sfConfig::get('app_a_use_bundled_layout', true)) {
$action->setLayout(sfContext::getInstance()->getConfiguration()->getTemplateDir('a', 'layout.php') . '/layout');
}
// Loading the a helper at this point guarantees not only
// helper functions but also necessary JavaScript and CSS
sfContext::getInstance()->getConfiguration()->loadHelpers('a');
}
示例4: searchBody
//.........这里部分代码省略.........
if ($request->hasParameter('tag') && !count(Doctrine::getTable('Tagging')->createQuery('ta')->innerJoin('ta.Tag t WITH t.name = ?', $request->getParameter('tag'))->where('ta.taggable_model = ? AND ta.taggable_id = ?', array('aPage', $info['id']))->execute(array(), Doctrine::HYDRATE_NONE))) {
continue;
}
// Filter search results chronologically. How to do this depends on whether
// we're dealing with blog or events
$year = sprintf("%04d", $request->getParameter('year'));
$month = sprintf("%02d", $request->getParameter('month'));
$day = sprintf("%02d", $request->getParameter('day'));
// This if is gross and ought to be refactored by calling a method on
// the actions class which is differently implemented by the two classes
if (get_class($action) === 'aEventActions') {
if ($day > 0) {
if (!aBlogToolkit::between("{$year}-{$month}-{$day}", $value->start_date, $value->end_date)) {
continue;
}
} elseif ($month > 0) {
if (!aBlogToolkit::between("{$year}-{$month}", substr($value->start_date, 0, 7), substr($value->end_date, 0, 7))) {
continue;
}
} elseif ($year > 0) {
if (!aBlogToolkit::between("{$year}", substr($value->start_date, 0, 4), substr($value->end_date, 0, 4))) {
continue;
}
}
} else {
// We store this one real picky in a keyword so it's searchable at the lucene level
if (preg_match('/^(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)/', $value->published_at, $matches)) {
list($dummy, $pyear, $pmonth, $pday) = $matches;
if ($year > 0) {
if ($pyear != $year) {
continue;
}
}
if ($month > 0) {
if ($pmonth != $month) {
continue;
}
}
if ($day > 0) {
if ($pday != $day) {
continue;
}
}
}
}
// Regardless of the above if it ain't published yet we can't see it
if ($value->published_at > $now) {
continue;
}
if (!aPageTable::checkPrivilege('view', $info)) {
continue;
}
$nvalue = $value;
$nvalue->page_id = $info['id'];
$nvalue->slug = $nvalue->slug_stored;
$nvalue->title = $nvalue->title_stored;
$nvalue->summary = $nvalue->summary_stored;
// Virtual page slug is a named Symfony route, it wants search results to go there
$nvalue->url = $action->getController()->genUrl($nvalue->slug, true);
$nvalue->class = $modelClass;
$nvalues[] = $nvalue;
}
$values = $nvalues;
if ($ajax) {
// We need the IDs of the blog posts, not their virtual pages
$pageIds = array();
foreach ($values as $value) {
$pageIds[] = $value->page_id;
}
$action->results = array();
if (count($pageIds)) {
$infos = Doctrine::getTable($modelClass)->createQuery('p')->select('p.id, p.page_id, p.status')->whereIn('p.page_id', $pageIds)->fetchArray();
// At this point, if we're an admin, we have some posts on our list that are not actually
// useful to return as AJAX results because we only care about posts that are published when
// we're building up a posts slot
foreach ($infos as $info) {
if ($info['status'] !== 'published') {
continue;
}
$pageIdToPostId[$info['page_id']] = $info['id'];
}
foreach ($values as $value) {
if (isset($pageIdToPostId[$value->page_id])) {
// Titles are stored as entity-escaped HTML text, so decode to meet
// the expectations of autocomplete
$action->results[] = array('label' => html_entity_decode($value->title, ENT_COMPAT, 'UTF-8'), 'value' => $pageIdToPostId[$value->page_id]);
}
}
}
return 'Autocomplete';
}
$action->pager = new aArrayPager(null, sfConfig::get('app_a_search_results_per_page', 10));
$action->pager->setResultArray($values);
$action->pager->setPage($request->getParameter('page', 1));
$action->pager->init();
$action->pagerUrl = "aBlog/search?" . http_build_query(array("q" => $q));
// setTitle takes care of escaping things
$action->getResponse()->setTitle(aTools::getOptionI18n('title_prefix') . 'Search for ' . $q . aTools::getOptionI18n('title_suffix'));
$action->results = $action->pager->getResults();
}