當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SearchForm::getRedirTitle方法代碼示例

本文整理匯總了PHP中SearchForm::getRedirTitle方法的典型用法代碼示例。如果您正苦於以下問題:PHP SearchForm::getRedirTitle方法的具體用法?PHP SearchForm::getRedirTitle怎麽用?PHP SearchForm::getRedirTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SearchForm的用法示例。


在下文中一共展示了SearchForm::getRedirTitle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wfSpecialSearch

/**
 * Called to display the Special:Search page
 *
 * @param unknown_type $par
 * @param unknown_type $specialPage
 */
function wfSpecialSearch($par = NULL, $specialPage)
{
    global $wgOut, $wgRequest, $wgScriptPath, $wrSidebarHtml;
    $searchForm = new SearchForm();
    // read query parameters into variables
    $searchForm->readQueryParms($par);
    // check if we should redirect to a specific page
    $redirTitle = $searchForm->getRedirTitle();
    if ($redirTitle) {
        $wgOut->redirect($redirTitle->getFullURL());
        return;
    }
    $wgOut->setPageTitle($searchForm->target ? 'Search for possible matches' : 'Search WeRelate');
    $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/search.31.js\"></script>");
    $wgOut->addScript("<script type=\"text/javascript\" src=\"{$wgScriptPath}/autocomplete.10.js\"></script>");
    // construct query to send to server
    $errMsg = $searchForm->validateQuery();
    $searchServerQuery = '';
    if (!$errMsg) {
        $searchServerQuery = $searchForm->getSearchServerQuery($par);
    }
    $formHtml = $searchForm->getFormHtml();
    if ($searchServerQuery || $errMsg) {
        if ($errMsg) {
            $sideText = '';
            $errMsg = htmlspecialchars($errMsg);
            $results = "<p><font color=\"red\">{$errMsg}</font></p>";
        } else {
            list($sideText, $results) = $searchForm->getSearchResultsHtml($searchServerQuery);
        }
        $wrSidebarHtml = "<div id=\"wr-search-sidebar\">{$sideText}</div>";
        $wgOut->addHTML(<<<END
<p>{$formHtml}</p>
{$results}
END
);
    } else {
        $sideText = $searchForm->getStatsHtml();
        $endText = wfMsgWikiHtml('searchend');
        $wrSidebarHtml = "<div id=\"wr-search-sidebar\">{$sideText}</div>";
        $wgOut->addHTML(<<<END
<p>{$formHtml}</p><p> </p>
{$endText}
END
);
    }
}
開發者ID:k-hasan-19,項目名稱:wiki,代碼行數:53,代碼來源:SpecialSearch.php


注:本文中的SearchForm::getRedirTitle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。