<commit_before><?php
/**
 * APNG extension - Enables animated PNG support in Webkit browsers and Internet Explorer 10
 *
 * @file
 * @ingroup Extensions
 */

if ( !defined( 'MEDIAWIKI' ) ) { die(); }

// credits
$wgExtensionCredits['other'][] = array(
	'path' => __FILE__,
	'name' => 'APNG',
	'version' => '0.1.1',
	'author' => array( '<NAME>', 'Mudkip' ),
	'url' => 'https://github.com/mudkipme/mediawiki-apng',
	'descriptionmsg'  => 'apng-desc',
);

$wgExtensionMessagesFiles['APNG'] = dirname( __FILE__ ) . '/APNG.i18n.php';

$wgResourceModules['ext.apng'] = array(
	'scripts' => array('udeferred.js', 'crc32.js', 'apng-canvas.js', 'apng-loader.js' ),
	'localBasePath' => dirname( __FILE__ ) . '/modules',
	'remoteExtPath' => 'APNG/modules'
);

$wgHooks['ImageBeforeProduceHTML'][] = function($skin, $title, $file, &$frameParams, $handlerParams, $time, $res){
	if ( $file ) {
		$mimetype = $file->getMimeType();
		if ( $mimetype == 'image/png' && $file->getHandler()->isAnimatedImage( $file ) ) {
			$skin->getOutput()->addModules( 'ext.apng' );
			if ( !isset($frameParams['class']) ) {
				$frameParams['class'] = 'apng';
			} else {
				$frameParams['class'] .= ' apng';
			}
		}
	}
	return true;
};<commit_msg>Fix up loading of the 'ext.apng' module<commit_after><?php
/**
 * APNG extension - Enables animated PNG support in Webkit browsers and Internet Explorer 10
 *
 * @file
 * @ingroup Extensions
 */

if ( !defined( 'MEDIAWIKI' ) ) { die(); }

// credits
$wgExtensionCredits['other'][] = array(
	'path' => __FILE__,
	'name' => 'APNG',
	'version' => '0.1.1',
	'author' => array( '<NAME>', 'Mudkip' ),
	'url' => 'https://github.com/mudkipme/mediawiki-apng',
	'descriptionmsg'  => 'apng-desc',
);

$wgExtensionMessagesFiles['APNG'] = dirname( __FILE__ ) . '/APNG.i18n.php';

$wgResourceModules['ext.apng'] = array(
	'scripts' => array('udeferred.js', 'crc32.js', 'apng-canvas.js', 'apng-loader.js' ),
	'localBasePath' => dirname( __FILE__ ) . '/modules',
	'remoteExtPath' => 'APNG/modules'
);

class APNG {
	public static function isFileSupported( File $file ) {
		return (
			$file->getMimeType() == 'image/png' &&
			$file->getHandler()->isAnimatedImage( $file )
		);
	}
}

$wgHooks['ImageBeforeProduceHTML'][] = function($skin, $title, $file, &$frameParams, $handlerParams, $time, $res){
	if ( $file && APNG::isFileSupported( $file ) ) {
		if ( !isset($frameParams['class']) ) {
			$frameParams['class'] = 'apng';
		} else {
			$frameParams['class'] .= ' apng';
		}
	}
	return true;
};

$wgHooks['ImageOpenShowImageInlineBefore'][] = function ( $imagePage, $output ) {
	$file = $imagePage->getDisplayedFile();
	if ( $file && APNG::isFileSupported( $file ) ) {
		$output->addModules( 'ext.apng' );
	}
	return true;
};
{'fraction_non_alphanumeric': 0.21810850439882698, 'fraction_numerical': 0.006598240469208211, 'mean_word_length': 4.479919678714859, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 33, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2777974', 'n_tokens_mistral': 1085, 'n_tokens_neox': 1043, 'n_words': 192}