本文整理汇总了PHP中OutputPage::isPrintable方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::isPrintable方法的具体用法?PHP OutputPage::isPrintable怎么用?PHP OutputPage::isPrintable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputPage
的用法示例。
在下文中一共展示了OutputPage::isPrintable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBeforePageDisplay
public static function onBeforePageDisplay(\OutputPage &$output, \Skin &$skin)
{
$title = $output->getTitle();
// Disallow commenting on pages without article id
if ($title->getArticleID() == 0) {
return true;
}
if ($title->isSpecialPage()) {
return true;
}
// These could be explicitly allowed in later version
if (!$title->canTalk()) {
return true;
}
if ($title->isTalkPage()) {
return true;
}
if ($title->isMainPage()) {
return true;
}
// Do not display when printing
if ($output->isPrintable()) {
return true;
}
// Disable if not viewing
if ($skin->getRequest()->getVal('action', 'view') != 'view') {
return true;
}
// Blacklist several namespace
if (in_array($title->getNamespace(), array(NS_MEDIAWIKI, NS_TEMPLATE, NS_CATEGORY, NS_FILE, NS_USER))) {
return true;
}
$output->addModules('ext.pagerating');
return true;
}
示例2: onBeforePageDisplay
public static function onBeforePageDisplay(OutputPage &$output, Skin &$skin)
{
$title = $output->getTitle();
// Disallow commenting on pages without article id
if ($title->getArticleID() == 0) {
return true;
}
if ($title->isSpecialPage()) {
return true;
}
// These could be explicitly allowed in later version
if (!$title->canTalk()) {
return true;
}
if ($title->isTalkPage()) {
return true;
}
// No commenting on main page
if ($title->isMainPage()) {
return true;
}
// Do not display when printing
if ($output->isPrintable()) {
return true;
}
// Disable if not viewing
if ($skin->getRequest()->getVal('action', 'view') != 'view') {
return true;
}
// Blacklist several namespace
if (in_array($title->getNamespace(), self::getFilteredNamespace())) {
return true;
}
if ($output->getUser()->isAllowed('commentadmin-restricted')) {
$output->addJsConfigVars(array('commentadmin' => ''));
}
global $wgFlowThreadConfig;
$config = array('Avatar' => $wgFlowThreadConfig['Avatar'], 'AnonymousAvatar' => $wgFlowThreadConfig['AnonymousAvatar']);
if (\FlowThread\Post::canPost($output->getUser())) {
$output->addJsConfigVars(array('canpost' => ''));
} else {
$config['CantPostNotice'] = wfMessage('flowthread-ui-cantpost')->toString();
}
global $wgFlowThreadConfig;
$output->addJsConfigVars(array('wgFlowThreadConfig' => $config));
$output->addModules('ext.flowthread');
return true;
}
示例3: makeCustomURL
/**
* Build a load.php URL using OutputPage instance to get most of the required information
*
* @param OutputPage $out
* @param string|array $modules Module names
* @param string $only
* @param bool|string $user User name (true to get it from OutputPage)
* @param string $version
* @param array $extraQuery
* @return string
*/
public static function makeCustomURL(OutputPage $out, $modules, $only = ResourceLoaderModule::TYPE_COMBINED, $user = null, $version = null, $extraQuery = array())
{
if ($user === true) {
$user = $out->getUser()->getName();
} else {
if ($user === false || $user === null) {
$user = null;
} else {
$user = (string) $user;
}
}
$url = ResourceLoader::makeLoaderURL($modules, $out->getLanguage()->getCode(), $out->getSkin()->getSkinName(), $user, $version, ResourceLoader::inDebugMode(), $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only, $out->isPrintable(), $out->getRequest()->getBool('handheld'), $extraQuery);
return $url;
}
示例4: buildNavUrls
/**
* build array of common navigation links
* @return array
* @private
*/
protected function buildNavUrls(OutputPage $out)
{
global $wgUseTrackbacks, $wgUser, $wgRequest;
global $wgUploadNavigationUrl;
wfProfileIn(__METHOD__);
$action = $wgRequest->getVal('action', 'view');
$nav_urls = array();
$nav_urls['mainpage'] = array('href' => self::makeMainPageUrl());
if ($wgUploadNavigationUrl) {
$nav_urls['upload'] = array('href' => $wgUploadNavigationUrl);
} elseif (UploadBase::isEnabled() && UploadBase::isAllowed($wgUser) === true) {
$nav_urls['upload'] = array('href' => self::makeSpecialUrl('Upload'));
} else {
$nav_urls['upload'] = false;
}
$nav_urls['specialpages'] = array('href' => self::makeSpecialUrl('Specialpages'));
// default permalink to being off, will override it as required below.
$nav_urls['permalink'] = false;
// A print stylesheet is attached to all pages, but nobody ever
// figures that out. :) Add a link...
if ($this->iscontent && ($action == 'view' || $action == 'purge')) {
if (!$out->isPrintable()) {
$nav_urls['print'] = array('text' => wfMsg('printableversion'), 'href' => $this->getTitle()->getLocalURL($wgRequest->appendQueryValue('printable', 'yes', true)));
}
// Also add a "permalink" while we're at it
$revid = $this->getRevisionId();
if ($revid) {
$nav_urls['permalink'] = array('text' => wfMsg('permalink'), 'href' => $out->getTitle()->getLocalURL("oldid={$revid}"));
}
// Use the copy of revision ID in case this undocumented, shady hook tries to mess with internals
wfRunHooks('SkinTemplateBuildNavUrlsNav_urlsAfterPermalink', array(&$this, &$nav_urls, &$revid, &$revid));
}
if ($this->getTitle()->getNamespace() != NS_SPECIAL) {
$wlhTitle = SpecialPage::getTitleFor('Whatlinkshere', $this->thispage);
$nav_urls['whatlinkshere'] = array('href' => $wlhTitle->getLocalUrl());
if ($this->getTitle()->getArticleId()) {
$rclTitle = SpecialPage::getTitleFor('Recentchangeslinked', $this->thispage);
$nav_urls['recentchangeslinked'] = array('href' => $rclTitle->getLocalUrl());
} else {
$nav_urls['recentchangeslinked'] = false;
}
if ($wgUseTrackbacks) {
$nav_urls['trackbacklink'] = array('href' => $out->getTitle()->trackbackURL());
}
}
$user = $this->getRelevantUser();
if ($user) {
$id = $user->getID();
$ip = $user->isAnon();
$rootUser = $user->getName();
} else {
$id = 0;
$ip = false;
$rootUser = null;
}
if ($id || $ip) {
# both anons and non-anons have contribs list
$nav_urls['contributions'] = array('href' => self::makeSpecialUrlSubpage('Contributions', $rootUser));
if ($id) {
$logPage = SpecialPage::getTitleFor('Log');
$nav_urls['log'] = array('href' => $logPage->getLocalUrl(array('user' => $rootUser)));
} else {
$nav_urls['log'] = false;
}
if ($wgUser->isAllowed('block')) {
$nav_urls['blockip'] = array('href' => self::makeSpecialUrlSubpage('Block', $rootUser));
} else {
$nav_urls['blockip'] = false;
}
} else {
$nav_urls['contributions'] = false;
$nav_urls['log'] = false;
$nav_urls['blockip'] = false;
}
$nav_urls['emailuser'] = false;
if ($this->showEmailUser($id)) {
$nav_urls['emailuser'] = array('href' => self::makeSpecialUrlSubpage('Emailuser', $rootUser));
}
wfProfileOut(__METHOD__);
return $nav_urls;
}
示例5: onBeforePageDisplay
/**
*
* @param OutputPage $oOutputPage
* @param SkinTemplate $oSkinTemplate
* @return boolean
*/
public function onBeforePageDisplay($oOutputPage, $oSkinTemplate)
{
if (BsConfig::get('MW::ShoutBox::Show') === false) {
return true;
}
$oTitle = $oOutputPage->getTitle();
if ($oOutputPage->isPrintable()) {
return true;
}
if (is_object($oTitle) && $oTitle->exists() == false) {
return true;
}
if (!$oTitle->userCan('readshoutbox')) {
return true;
}
if ($this->getRequest()->getVal('action', 'view') != 'view') {
return true;
}
if ($oTitle->isSpecialPage()) {
return true;
}
if (!$oTitle->userCan('read')) {
return true;
}
$aNamespacesToDisplayShoutBox = BsConfig::get('MW::ShoutBox::ShowShoutBoxByNamespace');
if (!in_array($oTitle->getNsText(), $aNamespacesToDisplayShoutBox)) {
return true;
}
$vNoShoutbox = BsArticleHelper::getInstance($oTitle)->getPageProp('bs_noshoutbox');
if ($vNoShoutbox === '') {
return true;
}
$oOutputPage->addModuleStyles('ext.bluespice.shoutbox.styles');
$oOutputPage->addModules('ext.bluespice.shoutbox');
$oOutputPage->addModules('ext.bluespice.shoutbox.mention');
BsExtensionManager::setContext('MW::ShoutboxShow');
return true;
}