本文整理汇总了PHP中Wikia::createTitleFromRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Wikia::createTitleFromRequest方法的具体用法?PHP Wikia::createTitleFromRequest怎么用?PHP Wikia::createTitleFromRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wikia
的用法示例。
在下文中一共展示了Wikia::createTitleFromRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
if( function_exists( 'newrelic_name_transaction' ) ) {
if ( function_exists( 'newrelic_disable_autorum') ) {
newrelic_disable_autorum();
}
if (is_object($wgRequest)) {
$controller = $wgRequest->getVal( 'controller' );
$method = $wgRequest->getVal( 'method' );
newrelic_name_transaction( "/nirvana/$controller/$method" );
}
}
if ( !empty( $wgEnableNirvanaAPI ) ){
$app = F::app();
// Ensure that we have a title stub, otherwise parser does not work BugId: 12901
$app->wg->title = Wikia::createTitleFromRequest( $app->wg->Request );
// initialize skin if requested
$app->initSkin( (bool) $app->wg->Request->getVal( "skin", false ) );
$response = $app->sendRequest( null, null, null, false );
// commit any open transactions just in case the controller forgot to
$app->commit();
//if cache policy wasn't explicitly set (e.g. WikiaResponse::setCacheValidity)
//then force no cache to reflect api.php default behavior
$cacheControl = $response->getHeader( 'Cache-Control' );
if ( empty( $cacheControl ) ) {
$response->setHeader( 'Cache-Control', 'private', true );
示例2: main
private function main()
{
global $wgUseFileCache, $wgTitle, $wgUseAjax;
wfProfileIn(__METHOD__);
$request = $this->context->getRequest();
// Send Ajax requests to the Ajax dispatcher.
if ($wgUseAjax && $request->getVal('action', 'view') == 'ajax') {
// Set a dummy title, because $wgTitle == null might break things
// Wikia change - start
// @author macbre, wladek
$title = Wikia::createTitleFromRequest($request);
// Wikia change - end
$this->context->setTitle($title);
$wgTitle = $title;
$dispatcher = new AjaxDispatcher();
$dispatcher->performAction();
wfProfileOut(__METHOD__);
return;
}
// Get title from request parameters,
// is set on the fly by parseTitle the first time.
$title = $this->getTitle();
$action = $this->getAction();
$wgTitle = $title;
if ($wgUseFileCache && $title->getNamespace() >= 0) {
wfProfileIn('main-try-filecache');
if (HTMLFileCache::useFileCache($this->context)) {
// Try low-level file cache hit
$cache = HTMLFileCache::newFromTitle($title, $action);
if ($cache->isCacheGood()) {
// Check incoming headers to see if client has this cached
$timestamp = $cache->cacheTimestamp();
if (!$this->context->getOutput()->checkLastModified($timestamp)) {
$cache->loadFromFileCache($this->context);
}
// Do any stats increment/watchlist stuff
$this->context->getWikiPage()->doViewUpdates($this->context->getUser());
// Tell OutputPage that output is taken care of
$this->context->getOutput()->disable();
wfProfileOut('main-try-filecache');
wfProfileOut(__METHOD__);
return;
}
}
wfProfileOut('main-try-filecache');
}
$this->performRequest();
$this->finalCleanup();
wfProfileOut(__METHOD__);
}