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


PHP ResourceLoader::respond方法代码示例

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


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

示例1: testResourceLoaderModifyMaxAge

 /**
  * @group Slow
  * @slowExecutionTime 0.01651 ms
  * @dataProvider resourceLoaderModifyMaxAgeDataProvider
  *
  * @param $timestamp int timestamp in URL
  * @param $ttl int expected caching period
  */
 public function testResourceLoaderModifyMaxAge($version, $ttl)
 {
     global $wgHooks;
     $resourceLoader = new ResourceLoader();
     $resourceLoader->register('WikiaTestModule', array('class' => 'TestResourceLoaderModule'));
     $request = new WebRequest();
     $request->setVal('modules', 'WikiaTestModule');
     $request->setVal('version', join('-', $version));
     // set up hooks
     $wgHooks['ResourceLoaderCacheControlHeaders'][] = 'ResourceLoaderTest::onResourceLoaderCacheControlHeaders';
     ob_start();
     $resourceLoader->respond(new ResourceLoaderContext($resourceLoader, $request));
     ob_end_clean();
     // hook ResourceLoaderHooks::onResourceLoaderModifyMaxAge was called
     // check modified caching period with expected one
     $this->assertEquals($ttl, self::$ttl, 'TTL should match expected value');
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:ResourceLoaderTest.php

示例2: ResourceLoader

 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @author Roan Kattouw
 * @author Trevor Parscal
 */
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
// This endpoint is supposed to be independent of request cookies and other
// details of the session. Enforce this constraint with respect to session use.
define('MW_NO_SESSION', 1);
require __DIR__ . '/includes/WebStart.php';
// URL safety checks
if (!$wgRequest->checkUrlExtension()) {
    return;
}
// Don't initialise ChronologyProtector from object cache, and
// don't wait for unrelated MediaWiki writes when querying ResourceLoader.
MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo(['ChronologyProtection' => 'false']);
// Set up ResourceLoader
$resourceLoader = new ResourceLoader(ConfigFactory::getDefaultInstance()->makeConfig('main'), LoggerFactory::getInstance('resourceloader'));
$context = new ResourceLoaderContext($resourceLoader, $wgRequest);
// Respond to ResourceLoader request
$resourceLoader->respond($context);
Profiler::instance()->setTemplated(true);
$mediawiki = new MediaWiki();
$mediawiki->doPostOutputShutdown('fast');
开发者ID:paladox,项目名称:mediawiki,代码行数:31,代码来源:load.php

示例3: dirname

 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @author Roan Kattouw
 * @author Trevor Parscal
 */
use MediaWiki\Logger\LoggerFactory;
// Bail on old versions of PHP, or if composer has not been run yet to install
// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
require_once dirname(__FILE__) . '/includes/PHPVersionCheck.php';
wfEntryPointCheck('load.php');
require __DIR__ . '/includes/WebStart.php';
// URL safety checks
if (!$wgRequest->checkUrlExtension()) {
    return;
}
// Respond to resource loading request.
// foo()->bar() syntax is not supported in PHP4, and this file needs to *parse* in PHP4.
$configFactory = ConfigFactory::getDefaultInstance();
$resourceLoader = new ResourceLoader($configFactory->makeConfig('main'), LoggerFactory::getInstance('resourceloader'));
$resourceLoader->respond(new ResourceLoaderContext($resourceLoader, $wgRequest));
Profiler::instance()->setTemplated(true);
$mediawiki = new MediaWiki();
$mediawiki->doPostOutputShutdown('fast');
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:31,代码来源:load.php


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