* @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;
}
- if ( $content->isSupportedFormat( CONTENT_FORMAT_JAVASCRIPT ) ) {
- return $content->serialize( CONTENT_FORMAT_JAVASCRIPT );
- } elseif ( $content->isSupportedFormat( CONTENT_FORMAT_CSS ) ) {
- return $content->serialize( CONTENT_FORMAT_CSS );
- } else {
- wfDebugLog( 'resourceloader', __METHOD__ . ": bad content model {$content->getModel()} for JS/CSS page!" );
- return null;
- }
+ 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 ) );