本文整理汇总了PHP中dmString::unSlugify方法的典型用法代码示例。如果您正苦于以下问题:PHP dmString::unSlugify方法的具体用法?PHP dmString::unSlugify怎么用?PHP dmString::unSlugify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dmString
的用法示例。
在下文中一共展示了dmString::unSlugify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: populate
/**
* Fill the field values with the page
*/
public function populate()
{
$boostValues = $this->getBoostValues();
// store the page id without indexing it
$this->store('page_id', $this->page->get('id'));
// index the page slug
$this->index('slug', dmString::unSlugify($this->page->get('slug')), $boostValues['slug']);
// index the page name
$this->index('name', $this->page->get('name'), $boostValues['name']);
// index the page title
$this->index('title', $this->page->get('title'), $boostValues['title']);
// index the page h1
$this->index('h1', $this->page->get('h1'), $boostValues['h1']);
// index the page description
$this->index('description', $this->page->get('description'), $boostValues['description']);
// index keywords only if the project uses them
if (sfConfig::get('dm_seo_use_keywords')) {
$this->index('keywords', $this->page->get('keywords'), $boostValues['keywords']);
}
// process the page body only if its boost value is not null
if ($boostValues['body']) {
$this->index('content_index', $this->getPageContentForIndex(), $boostValues['body']);
}
// store page content to display it on search results
$this->store('content', $this->getPageContentForStore());
}
示例2: useSearchIndex
protected function useSearchIndex($slug)
{
if (!dmConfig::get('smart_404')) {
return false;
}
try {
$searchIndex = $this->serviceContainer->get('search_engine')->getCurrentIndex();
$queryString = str_replace('/', ' ', dmString::unSlugify($slug));
$query = Zend_Search_Lucene_Search_QueryParser::parse($queryString);
$results = $searchIndex->search($query);
$foundPage = null;
foreach ($results as $result) {
if ($result->getScore() > 0.5) {
if ($foundPage = $result->getPage()) {
break;
}
} else {
break;
}
}
if ($foundPage) {
return $this->serviceContainer->getService('helper')->link($foundPage)->getHref();
}
} catch (Exception $e) {
$this->dispatcher->notify(new sfEvent($this, 'application.log', array('Can not use search index to find redirection for slug ' . $slug, sfLogger::ERR)));
if (sfConfig::get('dm_debug')) {
throw $e;
}
}
}