Also remove some superfluous newlines.
Change-Id: I904d6ddeb976434708d5a22df9e8abd2e6f60a6c
* @ingroup Content
*/
abstract class AbstractContent implements Content {
-
/**
* Name of the content model this Content object represents.
* Use with CONTENT_MODEL_XXX constants
break;
}
// Redirects to some special pages are not permitted
- if ( $newtitle instanceOf Title && $newtitle->isValidRedirectTarget() ) {
+ if ( $newtitle instanceof Title && $newtitle->isValidRedirectTarget() ) {
// The new title passes the checks, so make that our current
// title so that further recursion can be checked
$title = $newtitle;
}
/**
- * This default implementation always returns false. Subclasses may override this to supply matching logic.
+ * This default implementation always returns false. Subclasses may override
+ * this to supply matching logic.
*
* @see Content::matchMagicWord
*
* @ingroup Content
*/
interface Content {
-
/**
* @since 1.21
*
*
* @param Title $target the new redirect target
*
- * @return Content a new Content object with the updated redirect (or $this if this Content object isn't a redirect)
+ * @return Content a new Content object with the updated redirect (or $this
+ * if this Content object isn't a redirect)
*/
public function updateRedirect( Title $target );
* This may be used to check the content's consistency with global state. This function should
* NOT write any information to the database.
*
- * Note that this method will usually be called inside the same transaction bracket that will be used
- * to save the new revision.
+ * Note that this method will usually be called inside the same transaction
+ * bracket that will be used to save the new revision.
*
- * Note that this method is called before any update to the page table is performed. This means that
- * $page may not yet know a page ID.
+ * Note that this method is called before any update to the page table is
+ * performed. This means that $page may not yet know a page ID.
*
* @since 1.21
*
* @param int $baseRevId the ID of the current revision
* @param User $user
*
- * @return Status A status object indicating whether the content was successfully prepared for saving.
- * If the returned status indicates an error, a rollback will be performed and the
- * transaction aborted.
+ * @return Status A status object indicating whether the content was
+ * successfully prepared for saving. If the returned status indicates
+ * an error, a rollback will be performed and the transaction aborted.
*
* @see see WikiPage::doEditContent()
*/
* @ingroup Content
*/
class MWContentSerializationException extends MWException {
-
}
/**
* @ingroup Content
*/
abstract class ContentHandler {
-
/**
* Switch for enabling deprecation warnings. Used by ContentHandler::deprecated()
* and ContentHandler::runLegacyHooks().
$handler = new $class( $modelId );
if ( !( $handler instanceof ContentHandler ) ) {
- throw new MWException( "$class from \$wgContentHandlers is not compatible with ContentHandler" );
+ throw new MWException( "$class from \$wgContentHandlers is not " .
+ "compatible with ContentHandler" );
}
}
/**
* Get the language in which the content of the given page is written.
*
- * This default implementation just returns $wgContLang (except for pages in the MediaWiki namespace)
+ * This default implementation just returns $wgContLang (except for pages
+ * in the MediaWiki namespace)
*
- * Note that the pages language is not cacheable, since it may in some cases depend on user settings.
+ * Note that the pages language is not cacheable, since it may in some
+ * cases depend on user settings.
*
* Also note that the page language may or may not depend on the actual content of the page,
* that is, this method may load the content in order to determine the language.
wfRestoreWarnings();
- wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " . implode( ', ', $handlerInfo ), 2 );
+ wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " .
+ implode( ', ', $handlerInfo ), 2 );
}
// convert Content objects to text
* @ingroup Content
*/
class CssContentHandler extends TextContentHandler {
-
public function __construct( $modelId = CONTENT_MODEL_CSS ) {
parent::__construct( $modelId, array( CONTENT_FORMAT_CSS ) );
}
/**
* Returns the english language, because CSS is english, and should be handled as such.
*
+ * @param Title $title
+ * @param Content $content
* @return Language wfGetLangObj( 'en' )
*
* @see ContentHandler::getPageLanguage()
/**
* Returns the english language, because CSS is english, and should be handled as such.
*
+ * @param Title $title
+ * @param Content $content
* @return Language wfGetLangObj( 'en' )
*
* @see ContentHandler::getPageViewLanguage()
* @todo make ScriptContentHandler base class, do highlighting stuff there?
*/
class JavaScriptContentHandler extends TextContentHandler {
-
public function __construct( $modelId = CONTENT_MODEL_JAVASCRIPT ) {
parent::__construct( $modelId, array( CONTENT_FORMAT_JAVASCRIPT ) );
}
/**
* Returns the english language, because JS is english, and should be handled as such.
*
+ * @param Title $title
+ * @param Content $content
* @return Language wfGetLangObj( 'en' )
*
* @see ContentHandler::getPageLanguage()
/**
* Returns the english language, because JS is english, and should be handled as such.
*
+ * @param Title $title
+ * @param Content $content
* @return Language wfGetLangObj( 'en' )
*
* @see ContentHandler::getPageViewLanguage()
* @ingroup Content
*/
class MessageContent extends AbstractContent {
-
/**
* @var Message
*/
/**
* @see Content::isCountable
*
+ * @param bool $hasLinks
* @return bool false
*/
public function isCountable( $hasLinks = null ) {
/**
* @see Content::getParserOutput
*
+ * @param Title $title
+ * @param int $revId Optional revision ID
+ * @param ParserOptions $options
+ * @param bool $generateHtml Wether to generate HTML
* @return ParserOutput
*/
public function getParserOutput(
* @ingroup Content
*/
class TextContent extends AbstractContent {
-
public function __construct( $text, $model_id = CONTENT_MODEL_TEXT ) {
parent::__construct( $model_id );
* @ingroup Content
*/
class TextContentHandler extends ContentHandler {
-
- public function __construct( $modelId = CONTENT_MODEL_TEXT, $formats = array( CONTENT_FORMAT_TEXT ) ) {
+ public function __construct( $modelId = CONTENT_MODEL_TEXT,
+ $formats = array( CONTENT_FORMAT_TEXT )
+ ) {
parent::__construct( $modelId, $formats );
}
* @ingroup Content
*/
class WikitextContent extends TextContent {
-
public function __construct( $text ) {
parent::__construct( $text, CONTENT_MODEL_WIKITEXT );
}
}
/**
- * @see Content::updateRedirect()
+ * @see Content::updateRedirect()
*
* This implementation replaces the first link on the page with the given new target
* if this Content object is a redirect. Otherwise, this method returns $this.
*
* @param Title $target
*
- * @return Content a new Content object with the updated redirect (or $this if this Content object isn't a redirect)
+ * @return Content a new Content object with the updated redirect (or $this
+ * if this Content object isn't a redirect)
*/
public function updateRedirect( Title $target ) {
if ( !$this->isRedirect() ) {
* @ingroup Content
*/
class WikitextContentHandler extends TextContentHandler {
-
public function __construct( $modelId = CONTENT_MODEL_WIKITEXT ) {
parent::__construct( $modelId, array( CONTENT_FORMAT_WIKITEXT ) );
}
}
$mwRedir = MagicWord::get( 'redirect' );
- $redirectText = $mwRedir->getSynonym( 0 ) . ' [[' . $optionalColon . $destination->getFullText() . ']]';
+ $redirectText = $mwRedir->getSynonym( 0 ) .
+ ' [[' . $optionalColon . $destination->getFullText() . ']]';
+
if ( $text != '' ) {
$redirectText .= "\n" . $text;
}