MediaWiki  REL1_22
ResourceLoaderLESSFunctions.php
Go to the documentation of this file.
00001 <?php
00023 class ResourceLoaderLESSFunctions {
00038     public static function embeddable( $frame, $less ) {
00039         $base = pathinfo( $less->parser->sourceName, PATHINFO_DIRNAME );
00040         $url = $frame[2][0];
00041         $file = realpath( $base . '/' . $url );
00042         return $less->toBool( $file
00043             && strpos( $url, '//' ) === false
00044             && filesize( $file ) < CSSMin::EMBED_SIZE_LIMIT
00045             && CSSMin::getMimeType( $file ) !== false );
00046     }
00047 
00058     public static function embed( $frame, $less ) {
00059         $base = pathinfo( $less->parser->sourceName, PATHINFO_DIRNAME );
00060         $url = $frame[2][0];
00061         $file = realpath( $base . '/' . $url );
00062 
00063         $data = CSSMin::encodeImageAsDataURI( $file );
00064         $less->addParsedFile( $file );
00065         return 'url(' . $data . ')';
00066     }
00067 }