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


PHP Wikia::createTitleFromRequest方法代码示例

本文整理汇总了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 );
开发者ID:schwarer2006,项目名称:wikia,代码行数:31,代码来源:wikia.php

示例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__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:50,代码来源:Wiki.php


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