本文整理汇总了PHP中MWDebug::addModules方法的典型用法代码示例。如果您正苦于以下问题:PHP MWDebug::addModules方法的具体用法?PHP MWDebug::addModules怎么用?PHP MWDebug::addModules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWDebug
的用法示例。
在下文中一共展示了MWDebug::addModules方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
/**
* Finally, all the text has been munged and accumulated into
* the object, let's actually output it:
*/
public function output()
{
if ($this->mDoNothing) {
return;
}
$response = $this->getRequest()->response();
$config = $this->getConfig();
if ($this->mRedirect != '') {
# Standards require redirect URLs to be absolute
$this->mRedirect = wfExpandUrl($this->mRedirect, PROTO_CURRENT);
$redirect = $this->mRedirect;
$code = $this->mRedirectCode;
if (Hooks::run("BeforePageRedirect", array($this, &$redirect, &$code))) {
if ($code == '301' || $code == '303') {
if (!$config->get('DebugRedirects')) {
$response->statusHeader($code);
}
$this->mLastModified = wfTimestamp(TS_RFC2822);
}
if ($config->get('VaryOnXFP')) {
$this->addVaryHeader('X-Forwarded-Proto');
}
$this->sendCacheControl();
$response->header("Content-Type: text/html; charset=utf-8");
if ($config->get('DebugRedirects')) {
$url = htmlspecialchars($redirect);
print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
print "<p>Location: <a href=\"{$url}\">{$url}</a></p>\n";
print "</body>\n</html>\n";
} else {
$response->header('Location: ' . $redirect);
}
}
return;
} elseif ($this->mStatusCode) {
$response->statusHeader($this->mStatusCode);
}
# Buffer output; final headers may depend on later processing
ob_start();
$response->header('Content-type: ' . $config->get('MimeType') . '; charset=UTF-8');
$response->header('Content-language: ' . $config->get('LanguageCode'));
// Avoid Internet Explorer "compatibility view" in IE 8-10, so that
// jQuery etc. can work correctly.
$response->header('X-UA-Compatible: IE=Edge');
// Prevent framing, if requested
$frameOptions = $this->getFrameOptions();
if ($frameOptions) {
$response->header("X-Frame-Options: {$frameOptions}");
}
if ($this->mArticleBodyOnly) {
echo $this->mBodytext;
} else {
$sk = $this->getSkin();
// add skin specific modules
$modules = $sk->getDefaultModules();
// enforce various default modules for all skins
$coreModules = array('mediawiki.page.startup', 'mediawiki.user');
// Support for high-density display images if enabled
if ($config->get('ResponsiveImages')) {
$coreModules[] = 'mediawiki.hidpi';
}
$this->addModules($coreModules);
foreach ($modules as $group) {
$this->addModules($group);
}
MWDebug::addModules($this);
// Hook that allows last minute changes to the output page, e.g.
// adding of CSS or Javascript by extensions.
Hooks::run('BeforePageDisplay', array(&$this, &$sk));
$sk->outputPage();
}
// This hook allows last minute changes to final overall output by modifying output buffer
Hooks::run('AfterFinalPageOutput', array($this));
$this->sendCacheControl();
ob_end_flush();
}
示例2: addDefaultModules
/**
* Add the default ResourceLoader modules to this object
*/
private function addDefaultModules()
{
global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax, $wgAjaxWatch, $wgEnableMWSuggest;
// Add base resources
$this->addModules(array('mediawiki.user', 'mediawiki.page.startup', 'mediawiki.page.ready'));
if ($wgIncludeLegacyJavaScript) {
$this->addModules('mediawiki.legacy.wikibits');
}
if ($wgPreloadJavaScriptMwUtil) {
$this->addModules('mediawiki.util');
}
MWDebug::addModules($this);
$skin = $this->getSkin();
// Add various resources if required
if ($wgUseAjax) {
# macbre: following files are part of merged JS for following skins - don't load them from here
$skinName = get_class($skin);
$skipWikiaSkins = array();
if (!in_array($skinName, $skipWikiaSkins)) {
$this->addModules('mediawiki.legacy.ajax');
}
wfRunHooks('AjaxAddScript', array(&$this));
if (!in_array($skinName, $skipWikiaSkins)) {
if ($wgAjaxWatch && $this->getUser()->isLoggedIn()) {
$this->addModules('mediawiki.action.watch.ajax');
}
}
if (!in_array($skinName, $skipWikiaSkins)) {
if ($wgEnableMWSuggest && !$this->getUser()->getOption('disablesuggest', false)) {
$this->addModules('mediawiki.legacy.mwsuggest');
}
}
}
if ($this->getUser()->getBoolOption('editsectiononrightclick')) {
$this->addModules('mediawiki.action.view.rightClickEdit');
}
# Crazy edit-on-double-click stuff
if ($this->isArticle() && $this->getUser()->getOption('editondblclick')) {
$this->addModules('mediawiki.action.view.dblClickEdit');
}
}
示例3: output
/**
* Finally, all the text has been munged and accumulated into
* the object, let's actually output it:
*/
public function output()
{
global $wgLanguageCode, $wgDebugRedirects, $wgMimeType, $wgVaryOnXFP, $wgUseAjax, $wgResponsiveImages;
if ($this->mDoNothing) {
return;
}
wfProfileIn(__METHOD__);
$response = $this->getRequest()->response();
if ($this->mRedirect != '') {
# Standards require redirect URLs to be absolute
$this->mRedirect = wfExpandUrl($this->mRedirect, PROTO_CURRENT);
$redirect = $this->mRedirect;
$code = $this->mRedirectCode;
if (wfRunHooks("BeforePageRedirect", array($this, &$redirect, &$code))) {
if ($code == '301' || $code == '303') {
if (!$wgDebugRedirects) {
$message = HttpStatus::getMessage($code);
$response->header("HTTP/1.1 {$code} {$message}");
}
$this->mLastModified = wfTimestamp(TS_RFC2822);
}
if ($wgVaryOnXFP) {
$this->addVaryHeader('X-Forwarded-Proto');
}
$this->sendCacheControl();
$response->header("Content-Type: text/html; charset=utf-8");
if ($wgDebugRedirects) {
$url = htmlspecialchars($redirect);
print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
print "<p>Location: <a href=\"{$url}\">{$url}</a></p>\n";
print "</body>\n</html>\n";
} else {
$response->header('Location: ' . $redirect);
}
}
wfProfileOut(__METHOD__);
return;
} elseif ($this->mStatusCode) {
$message = HttpStatus::getMessage($this->mStatusCode);
if ($message) {
$response->header('HTTP/1.1 ' . $this->mStatusCode . ' ' . $message);
}
}
# Buffer output; final headers may depend on later processing
ob_start();
$response->header("Content-type: {$wgMimeType}; charset=UTF-8");
$response->header('Content-language: ' . $wgLanguageCode);
// Prevent framing, if requested
$frameOptions = $this->getFrameOptions();
if ($frameOptions) {
$response->header("X-Frame-Options: {$frameOptions}");
}
if ($this->mArticleBodyOnly) {
echo $this->mBodytext;
} else {
$sk = $this->getSkin();
// add skin specific modules
$modules = $sk->getDefaultModules();
// enforce various default modules for all skins
$coreModules = array('mediawiki.page.startup', 'mediawiki.user');
// Support for high-density display images if enabled
if ($wgResponsiveImages) {
$coreModules[] = 'mediawiki.hidpi';
}
$this->addModules($coreModules);
foreach ($modules as $group) {
$this->addModules($group);
}
MWDebug::addModules($this);
if ($wgUseAjax) {
// FIXME: deprecate? - not clear why this is useful
wfRunHooks('AjaxAddScript', array(&$this));
}
// Hook that allows last minute changes to the output page, e.g.
// adding of CSS or Javascript by extensions.
wfRunHooks('BeforePageDisplay', array(&$this, &$sk));
wfProfileIn('Output-skin');
$sk->outputPage();
wfProfileOut('Output-skin');
}
// This hook allows last minute changes to final overall output by modifying output buffer
wfRunHooks('AfterFinalPageOutput', array($this));
$this->sendCacheControl();
ob_end_flush();
wfProfileOut(__METHOD__);
}
示例4: addDefaultModules
/**
* Add the default ResourceLoader modules to this object
*/
private function addDefaultModules()
{
global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil, $wgUseAjax, $wgAjaxWatch, $wgEnableMWSuggest;
// Add base resources
$this->addModules(array('mediawiki.user', 'mediawiki.page.startup', 'mediawiki.page.ready'));
if ($wgIncludeLegacyJavaScript) {
$this->addModules('mediawiki.legacy.wikibits');
}
if ($wgPreloadJavaScriptMwUtil) {
$this->addModules('mediawiki.util');
}
MWDebug::addModules($this);
// Add various resources if required
if ($wgUseAjax) {
$this->addModules('mediawiki.legacy.ajax');
wfRunHooks('AjaxAddScript', array(&$this));
if ($wgAjaxWatch && $this->getUser()->isLoggedIn()) {
$this->addModules('mediawiki.action.watch.ajax');
}
if ($wgEnableMWSuggest && !$this->getUser()->getOption('disablesuggest', false)) {
$this->addModules('mediawiki.legacy.mwsuggest');
}
}
if ($this->getUser()->getBoolOption('editsectiononrightclick')) {
$this->addModules('mediawiki.action.view.rightClickEdit');
}
# Crazy edit-on-double-click stuff
if ($this->isArticle() && $this->getUser()->getOption('editondblclick')) {
$this->addModules('mediawiki.action.view.dblClickEdit');
}
}