The DPlayerPlugin class extends PluginBase to provide video playback capabilities using DPlayer. It registers a hook on user.commonJs.insert to inject the plugin's JavaScript assets into the user interface. When the hook is triggered, the plugin checks for file extension compatibility via isFileExtence and then serves the client-side logic located at static/main.js using echoFile.
<?php
class DPlayerPlugin extends PluginBase{
function __construct(){
parent::__construct();
}
public function regiest(){
$this->hookRegiest(array(
'user.commonJs.insert' => 'DPlayerPlugin.echoJs',
));
}
public function echoJs($st,$act){
if($this->isFileExtence($st,$act)){
$this->echoFile('static/main.js');
}
}
}