本文整理汇总了PHP中Axis::getSite方法的典型用法代码示例。如果您正苦于以下问题:PHP Axis::getSite方法的具体用法?PHP Axis::getSite怎么用?PHP Axis::getSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::getSite方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct, create index
*
* @param string $indexPath[optional]
* @param string $encoding[optional]
* @throws Axis_Exception
*/
public function __construct(array $params)
{
$encoding = $this->_encoding;
$indexPath = array_shift($params);
if (count($params)) {
$encoding = array_shift($params);
}
if (null === $indexPath) {
$site = Axis::getSite()->id;
$locale = Axis::single('locale/language')->find(Axis_Locale::getLanguageId())->current()->locale;
$indexPath = Axis::config()->system->path . '/var/index/' . $site . '/' . $locale;
}
if (!is_readable($indexPath)) {
throw new Axis_Exception(Axis::translate('search')->__('Please, update search indexes, to enable search functionality'));
}
/*
$mySimilarity = new Axis_Similarity();
Zend_Search_Lucene_Search_Similarity::setDefault($mySimilarity);
*/
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding($encoding);
// add filter by words
$stopWords = array('a', 'an', 'at', 'the', 'and', 'or', 'is', 'am');
$stopWordsFilter = new Zend_Search_Lucene_Analysis_TokenFilter_StopWords($stopWords);
$analyzer = new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive();
$analyzer->addFilter($stopWordsFilter);
Zend_Search_Lucene_Analysis_Analyzer::setDefault($analyzer);
$this->_index = Zend_Search_Lucene::open($indexPath);
$this->_encoding = $encoding;
}
示例2: __construct
/**
*
* @param string $charset
*/
public function __construct($charset = 'UTF-8')
{
parent::__construct($charset);
$this->view = Axis::app()->getBootstrap()->getResource('layout')->getView();
$this->view->addScriptPath(Axis::config('system/path') . '/app/design/mail');
$this->view->site = Axis::getSite()->name;
$this->view->company = Axis::single('core/site')->getCompanyInfo();
}
示例3: _initVars
protected function _initVars()
{
$view = $this->view;
$request = $this->getRequest();
if (Axis_Area::isBackend()) {
$templateId = Axis::config('design/main/adminTemplateId');
} else {
$templateId = Axis::config('design/main/frontTemplateId');
}
$view->templateName = Axis::single('core/template')->getTemplateNameById($templateId);
$view->path = Axis::config('system/path');
$view->area = Axis_Area::getArea();
list($view->namespace, $view->moduleName) = explode('_', $request->getModuleName(), 2);
$currentUrl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getRequestUri();
$site = Axis::getSite();
$view->baseUrl = $site ? $site->base : $this->getFrontController()->getBaseUrl();
$view->secureUrl = $site ? $site->secure : $view->baseUrl;
$view->resourceUrl = 0 === strpos($currentUrl, $view->secureUrl) ? $view->secureUrl : $view->baseUrl;
$view->catalogUrl = Axis::config('catalog/main/route');
}
示例4: setTitle
public function setTitle($title = null, $mode = null, $parentId = null)
{
// if (null !== $mode && in_array($mode, $this->_modes)) {
// $title = $this->_getMeta($title, $mode, 'title');
// }
$titleArray = array();
foreach ($this->_config->titlePattern as $titlePart) {
switch (strtolower($titlePart)) {
case 'page title':
if (null !== $title) {
$titleArray[] = $title;
} else {
$titleArray[] = $this->_config->defaultTitle;
}
break;
case 'parent page titles':
if (null === $mode || !in_array($mode, $this->_modes)) {
break;
}
switch ($mode) {
case 'category':
$path = array_reverse(Axis::single('catalog/category')->find($parentId)->current()->getParentItems());
array_shift($path);
break;
case 'product':
$path = array_reverse(Axis::single('catalog/product')->find($parentId)->current()->getParentItems());
break;
case 'cms_category':
$path = array_reverse(Axis::single('cms/category')->getParentCategory($parentId));
array_shift($path);
break;
case 'cms_page':
$path = array_reverse(Axis::single('cms/category')->getParentCategory($parentId, true));
break;
}
foreach ($path as $item) {
$item['name'] = isset($item['name']) ? $item['name'] : $item['title'];
$titleArray[] = trim($item['meta_title']) == '' ? trim($item['name']) : trim($item['meta_title']);
}
break;
case 'site name':
$row = Axis::getSite();
if ($row) {
$titleArray[] = $row->name;
}
break;
}
}
$this->_meta['title'] = htmlspecialchars($this->_config->titlePrefix . trim(implode($this->_config->titleDivider, $titleArray)) . $this->_config->titleSuffix);
return $this;
}