当前位置: 首页>>代码示例>>PHP>>正文


PHP SearchEngine::getOpenSearchTemplate方法代码示例

本文整理汇总了PHP中SearchEngine::getOpenSearchTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchEngine::getOpenSearchTemplate方法的具体用法?PHP SearchEngine::getOpenSearchTemplate怎么用?PHP SearchEngine::getOpenSearchTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchEngine的用法示例。


在下文中一共展示了SearchEngine::getOpenSearchTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wfMessage

// Behavior seems about the same between Firefox and IE 7/8 here.
// 'Description' doesn't appear to be used by either.
$fullName = wfMessage('opensearch-desc')->inContentLanguage()->text();
print Xml::element('ShortName', null, $fullName);
print Xml::element('Description', null, $fullName);
// By default we'll use the site favicon.
// Double-check if IE supports this properly?
print Xml::element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/x-icon'), wfExpandUrl($wgFavicon, PROTO_CURRENT));
$urls = array();
// General search template. Given an input term, this should bring up
// search results or a specific found page.
// At least Firefox and IE 7 support this.
$searchPage = SpecialPage::getTitleFor('Search');
$urls[] = array('type' => 'text/html', 'method' => 'get', 'template' => $searchPage->getCanonicalURL('search={searchTerms}'));
if ($wgEnableAPI) {
    // JSON interface for search suggestions.
    // Supported in Firefox 2 and later.
    $urls[] = array('type' => 'application/x-suggestions+json', 'method' => 'get', 'template' => SearchEngine::getOpenSearchTemplate());
}
// Allow hooks to override the suggestion URL settings in a more
// general way than overriding the whole search engine...
wfRunHooks('OpenSearchUrls', array(&$urls));
foreach ($urls as $attribs) {
    print Xml::element('Url', $attribs);
}
// And for good measure, add a link to the straight search form.
// This is a custom format extension for Firefox, which otherwise
// sends you to the domain root if you hit "enter" with an empty
// search box.
print Xml::element('moz:SearchForm', null, $searchPage->getCanonicalURL());
print '</OpenSearchDescription>';
开发者ID:seedbank,项目名称:old-repo,代码行数:31,代码来源:opensearch_desc.php

示例2: array

// General search template. Given an input term, this should bring up
// search results or a specific found page.
// At least Firefox and IE 7 support this.
$searchPage = SpecialPage::getTitleFor( 'Search' );
$urls[] = array(
	'type' => 'text/html',
	'method' => 'get',
	'template' => $searchPage->getCanonicalURL( 'search={searchTerms}' ) );

if( $wgEnableAPI ) {
	// JSON interface for search suggestions.
	// Supported in Firefox 2 and later.
	$urls[] = array(
		'type' => 'application/x-suggestions+json',
		'method' => 'get',
		'template' => SearchEngine::getOpenSearchTemplate() );
}

// Allow hooks to override the suggestion URL settings in a more
// general way than overriding the whole search engine...
wfRunHooks( 'OpenSearchUrls', array( &$urls ) );

foreach( $urls as $attribs ) {
	print Xml::element( 'Url', $attribs );
}

// And for good measure, add a link to the straight search form.
// This is a custom format extension for Firefox, which otherwise
// sends you to the domain root if you hit "enter" with an empty
// search box.
print Xml::element( 'moz:SearchForm', null,
开发者ID:schwarer2006,项目名称:wikia,代码行数:31,代码来源:opensearch_desc.php


注:本文中的SearchEngine::getOpenSearchTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。