Files
AnatImageViewer/includes/AnnotationHooks.php
2026-05-17 11:16:19 -07:00

33 lines
991 B
PHP

<?php
namespace MediaWiki\Extension\AnatImageViewer;
use MediaWiki\MediaWikiServices;
use RequestContext;
use Html;
use ParserOutput;
class AnnotationHooks {
public static function registrationCallback() {
// Must match the name used in the 'ContentHandlers' section of extension.json
define( 'CONTENT_MODEL_ANNOTATION', 'annotation' );
}
/**
* Small helper function to display information on the browser console
*
* Usage:
* echo '<script>';
* self::console_log('logged string');
* echo '</script>';
*
* @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 = '<script>'. $command . '</script>';
}
echo $command;
}
}