* @return null|string
*/
protected function getContent( $title ) {
- if ( !$title->isCssJsSubpage() && !$title->isCssOrJsPage() ) {
+ $handler = ContentHandler::getForTitle( $title );
+ if ( $handler->isSupportedFormat( CONTENT_FORMAT_CSS ) ) {
+ $format = CONTENT_FORMAT_CSS;
+ } elseif ( $handler->isSupportedFormat( CONTENT_FORMAT_JAVASCRIPT ) ) {
+ $format = CONTENT_FORMAT_JAVASCRIPT;
+ } else {
return null;
}
+
$revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
if ( !$revision ) {
return null;
return null;
}
- $model = $content->getModel();
-
- if ( $model !== CONTENT_MODEL_CSS && $model !== CONTENT_MODEL_JAVASCRIPT ) {
- wfDebugLog( 'resourceloader', __METHOD__ . ': bad content model $model for JS/CSS page!' );
- return null;
- }
-
- return $content->getNativeData(); //NOTE: this is safe, we know it's JS or CSS
+ return $content->serialize( $format );
}
/* Methods */
}
if ( $this->getFlip( $context ) ) {
$style = CSSJanus::transform( $style, true, false );
- } else {
- $style = CSSJanus::nullTransform( $style );
}
$style = CSSMin::remap( $style, false, $this->getConfig()->get( 'ScriptPath' ), true );
if ( !isset( $styles[$media] ) ) {
$modifiedTime = 1; // wfTimestamp() interprets 0 as "now"
$titleInfo = $this->getTitleInfo( $context );
if ( count( $titleInfo ) ) {
- $mtimes = array_map( function( $value ) {
+ $mtimes = array_map( function ( $value ) {
return $value['timestamp'];
}, $titleInfo );
$modifiedTime = max( $modifiedTime, max( $mtimes ) );