*/
private $mEnableSectionEditLinks = true;
+ /**
+ * @var string|null The URL to send in a <link> element with rel=copyright
+ */
+ private $copyrightUrl;
+
/**
* Constructor for OutputPage. This should not be called directly.
* Instead a new RequestContext should be created and it will implicitly create
return $this->mRedirect;
}
+ /**
+ * Set the copyright URL to send with the output.
+ * Empty string to omit, null to reset.
+ *
+ * @since 1.26
+ *
+ * @param string|null $url
+ */
+ public function setCopyrightUrl( $url ) {
+ $this->copyrightUrl = $url;
+ }
+
/**
* Set the HTTP status code to send with the output.
*
}
# Copyright
- $copyright = '';
- if ( $config->get( 'RightsPage' ) ) {
- $copy = Title::newFromText( $config->get( 'RightsPage' ) );
+ if ( $this->copyrightUrl !== null ) {
+ $copyright = $this->copyrightUrl;
+ } else {
+ $copyright = '';
+ if ( $config->get( 'RightsPage' ) ) {
+ $copy = Title::newFromText( $config->get( 'RightsPage' ) );
- if ( $copy ) {
- $copyright = $copy->getLocalURL();
+ if ( $copy ) {
+ $copyright = $copy->getLocalURL();
+ }
}
- }
- if ( !$copyright && $config->get( 'RightsUrl' ) ) {
- $copyright = $config->get( 'RightsUrl' );
+ if ( !$copyright && $config->get( 'RightsUrl' ) ) {
+ $copyright = $config->get( 'RightsUrl' );
+ }
}
if ( $copyright ) {
$context->setLanguage( $this->getMain()->getLanguage() );
$context->setTitle( SpecialPage::getTitleFor( 'ApiHelp' ) );
$out = new OutputPage( $context );
+ $out->setCopyrightUrl( 'https://www.mediawiki.org/wiki/Special:MyLanguage/Copyright' );
$context->setOutput( $out );
self::getHelp( $context, $modules, $params );