本文整理汇总了PHP中Linker::makeKnownLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::makeKnownLink方法的具体用法?PHP Linker::makeKnownLink怎么用?PHP Linker::makeKnownLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::makeKnownLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfSajaxSearch
function wfSajaxSearch($term)
{
global $wgContLang, $wgUser, $wgRequest, $wgAjaxCachePolicy;
$limit = 16;
$l = new Linker();
$term = str_replace(' ', '_', $wgContLang->ucfirst($wgContLang->checkTitleEncoding($wgContLang->recodeInput(js_unescape($term)))));
if (strlen(str_replace('_', '', $term)) < 3) {
return;
}
$wgAjaxCachePolicy->setPolicy(30 * 60);
$db =& wfGetDB(DB_SLAVE);
$res = $db->select('page', 'page_title', array('page_namespace' => 0, "page_title LIKE '" . $db->strencode($term) . "%'"), "wfSajaxSearch", array('LIMIT' => $limit + 1));
$r = "";
$i = 0;
while (($row = $db->fetchObject($res)) && ++$i <= $limit) {
$nt = Title::newFromDBkey($row->page_title);
$r .= '<li>' . $l->makeKnownLinkObj($nt) . "</li>\n";
}
if ($i > $limit) {
$more = '<i>' . $l->makeKnownLink($wgContLang->specialPage("Allpages"), wfMsg('moredotdotdot'), "namespace=0&from=" . wfUrlEncode($term)) . '</i>';
} else {
$more = '';
}
$term = htmlspecialchars($term);
return '<div style="float:right; border:solid 1px black;background:gainsboro;padding:2px;"><a onclick="Searching_Hide_Results();">' . wfMsg('hideresults') . '</a></div>' . '<h1 class="firstHeading">' . wfMsg('search') . '</h1><div id="contentSub">' . wfMsg('searchquery', $term) . '</div><ul><li>' . $l->makeKnownLink($wgContLang->specialPage('Search'), wfMsg('searchcontaining', $term), "search={$term}&fulltext=Search") . '</li><li>' . $l->makeKnownLink($wgContLang->specialPage('Search'), wfMsg('searchnamed', $term), "search={$term}&go=Go") . "</li></ul><h2>" . wfMsg('articletitles', $term) . "</h2>" . '<ul>' . $r . '</ul>' . $more;
}