Introducing setCopyright/hasCopyright in OutputPage to
make the showing of the copyright message controllable
by pages other than articles.
hasCopyright defaults to isArticle() to preserve the rule
that all article should show the copyright.
This is used by Flow to show the copyright
on various pages that contain user-generated
content.
Bug: T184960
Change-Id: I3a50dbcedc6b119b9262c50cb3a84b0dd230fb3d
/** @var bool Stores "article flag" toggle. */
private $mIsArticleRelated = true;
/** @var bool Stores "article flag" toggle. */
private $mIsArticleRelated = true;
+ /** @var bool Is the content subject to copyright */
+ private $mHasCopyright = false;
+
/**
* @var bool We have to set isPrintable(). Some pages should
* never be printed (ex: redirections).
/**
* @var bool We have to set isPrintable(). Some pages should
* never be printed (ex: redirections).
return $this->mIsArticleRelated;
}
return $this->mIsArticleRelated;
}
+ /**
+ * Set whether the standard copyright should be shown for the current page.
+ *
+ * @param bool $hasCopyright
+ */
+ public function setCopyright( $hasCopyright ) {
+ $this->mHasCopyright = $hasCopyright;
+ }
+
+ /**
+ * Return whether the standard copyright should be shown for the current page.
+ * By default, it is true for all articles but other pages
+ * can signal it by using setCopyright( true ).
+ *
+ * Used by SkinTemplate to decided whether to show the copyright.
+ *
+ * @return bool
+ */
+ public function showsCopyright() {
+ return $this->isArticle() || $this->mHasCopyright;
+ }
+
/**
* Add new language links
*
/**
* Add new language links
*
}
return $this->CSPNonce;
}
}
return $this->CSPNonce;
}
$tpl->set( 'lastmod', false );
$tpl->set( 'credits', false );
$tpl->set( 'numberofwatchingusers', false );
$tpl->set( 'lastmod', false );
$tpl->set( 'credits', false );
$tpl->set( 'numberofwatchingusers', false );
- if ( $out->isArticle() && $title->exists() ) {
- if ( $this->isRevisionCurrent() ) {
- if ( $wgMaxCredits != 0 ) {
- $tpl->set( 'credits', Action::factory( 'credits', $this->getWikiPage(),
- $this->getContext() )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) );
- } else {
- $tpl->set( 'lastmod', $this->lastModified() );
+ if ( $title->exists() ) {
+ if ( $out->isArticle() ) {
+ if ( $this->isRevisionCurrent() ) {
+ if ( $wgMaxCredits != 0 ) {
+ $tpl->set( 'credits', Action::factory( 'credits', $this->getWikiPage(),
+ $this->getContext() )->getCredits( $wgMaxCredits, $wgShowCreditsIfMax ) );
+ } else {
+ $tpl->set( 'lastmod', $this->lastModified() );
+ }
- $tpl->set( 'copyright', $this->getCopyright() );
+ if ( $out->showsCopyright() ) {
+ $tpl->set( 'copyright', $this->getCopyright() );
+ }
}
$tpl->set( 'copyrightico', $this->getCopyrightIcon() );
}
$tpl->set( 'copyrightico', $this->getCopyrightIcon() );