本文整理匯總了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;
}
}
}