$content = $this->fetchContentObject();
$this->mContent = ContentHandler::getContentText( $content ); #@todo: get rid of mContent everywhere!
- wfRunHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) ); #BC cruft! #XXX: can we deprecate that hook?
+ wfRunHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) ); #BC cruft, deprecated!
wfProfileOut( __METHOD__ );
}
/**
- * Returns a Content object with pre-save transformations applied (or this object if no transformations apply).
+ * Returns a Content object with pre-save transformations applied using Parser::preSaveTransform().
*
* @param Title $title
* @param User $user
* @param ParserOptions $popts
* @return Content
*/
- public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) { #FIXME: also needed for JS/CSS!
- global $wgParser, $wgConteLang;
+ public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
+ global $wgParser;
$text = $this->getNativeData();
$pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
* @return Content
*/
public function preloadTransform( Title $title, ParserOptions $popts ) {
- global $wgParser, $wgConteLang;
+ global $wgParser;
$text = $this->getNativeData();
$plt = $wgParser->getPreloadText( $text, $title, $popts );
parent::__construct($text, CONTENT_MODEL_JAVASCRIPT);
}
+ /**
+ * Returns a Content object with pre-save transformations applied using Parser::preSaveTransform().
+ *
+ * @param Title $title
+ * @param User $user
+ * @param ParserOptions $popts
+ * @return Content
+ */
+ public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
+ global $wgParser;
+ // @todo: make pre-save transformation optional for script pages
+
+ $text = $this->getNativeData();
+ $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
+
+ return new JavaScriptContent( $pst );
+ }
+
}
/**
public function __construct( $text ) {
parent::__construct($text, CONTENT_MODEL_CSS);
}
+
+ /**
+ * Returns a Content object with pre-save transformations applied using Parser::preSaveTransform().
+ *
+ * @param Title $title
+ * @param User $user
+ * @param ParserOptions $popts
+ * @return Content
+ */
+ public function preSaveTransform( Title $title, User $user, ParserOptions $popts ) {
+ global $wgParser;
+ // @todo: make pre-save transformation optional for script pages
+
+ $text = $this->getNativeData();
+ $pst = $wgParser->preSaveTransform( $text, $title, $user, $popts );
+
+ return new CssContent( $pst );
+ }
+
}