addExtraTypes('image/annotation an'); $mime->addExtraInfo('image/annotation [METAIMAGE]'); } /** * MWHook: Make sure that an files (fake) get the proper mime assignement on upload * * @see https://www.mediawiki.org/wiki/Manual:Hooks/MimeMagicImproveFromExtension * * @param MimeAnalyzer $mimeAnalyzer Instance of MW MimeAnalyzer object * @param string $ext extention of upload file * @param string &$mime current assigned mime type */ public static function onMimeMagicImproveFromExtension( $mimeAnalyzer, $ext, &$mime ) { if ( $mime !== 'image/annotation' && in_array( $ext, ['an'] ) ) { $mime = 'image/annotation'; } } /** * MWHook: Called when the parser initializes for the first time * * @param Parser $parser: Parser object being initialized */ static function onParserFirstCallInit( $parser ) { $parser->setHook('anconfig', array( __CLASS__, 'renderConfigTag')); } /** * Render the config toml in a
 tag
     * 
     * @param $input The text inside the custom tag
     * @param array $args Any attributes given in the tag
     * @param Parser $parser The parser object
     * @param PPFrame $frame The parent frame calling the parser
     * @return string HTML string of output
     */
    static function renderConfigTag( $input, array $args, $parser, $frame ) {
		return '
' . $input . '
'; } /** * Small helper function to display information on the browser console * * Usage: * echo ''; * * @param $data information to display * @param bool $add_script_tags true to put information is inside complete script tag */ public static function console_log($data, $add_script_tags = false) { $command = 'console.log('. json_encode($data, JSON_HEX_TAG).');'; if ($add_script_tags) { $command = ''; } echo $command; } }