private function init() { if (!$this->isInit) { $this->isInit = true; // Discover location of editor plugin. $editor_plugin = WIRISpluginWrapper::get_wiris_plugin(); $this->installed = !empty($editor_plugin); // Return if editor plugin is not installed. if (!$this->installed) { global $COURSE, $PAGE; $coursecontext = context_course::instance($COURSE->id); if (has_capability('moodle/site:config', $coursecontext)) { // Display missing WIRIS editor plugin dependency error $PAGE->requires->js('/filter/wiris/js/message.js', false); } return null; } // Init haxe environment. if (!class_exists('com_wiris_system_CallWrapper')) { require_once $editor_plugin->path . '/integration/lib/com/wiris/system/CallWrapper.class.php'; } com_wiris_system_CallWrapper::getInstance()->init($editor_plugin->path . '/integration'); // Start haxe environment. $this->begin(); // Create PluginBuilder with Moodle specific configuration. require_once 'MoodleConfigurationUpdater.php'; $this->moodleConfig = new com_wiris_plugin_configuration_MoodleConfigurationUpdater($editor_plugin); $this->instance = com_wiris_plugin_api_PluginBuilder::getInstance(); $this->instance->addConfigurationUpdater($this->moodleConfig); $this->instance->addConfigurationUpdater(new com_wiris_plugin_web_PhpConfigurationUpdater()); // Stop haxe environment. $this->end(); } }
static function getInstance() { if (com_wiris_system_CallWrapper::$wrapper === null) { com_wiris_system_CallWrapper::$wrapper = new com_wiris_system_CallWrapper(); } return com_wiris_system_CallWrapper::$wrapper; }
<?php // ${license.statement} require_once 'plugin.php'; $wrap = com_wiris_system_CallWrapper::getInstance(); $wrap->start(); $pluginBuilder = com_wiris_plugin_api_PluginBuilder::getInstance(); $wrap->stop(); $moodle = file_exists(".." . DIRECTORY_SEPARATOR . "version.php"); if ($moodle) { $wirisFilter = '../MoodleConfigurationUpdater.php'; $config = '../../../' . 'config.php'; define('NO_MOODLE_COOKIES', true); // Because it interferes with caching $scriptName = explode('/', $_SERVER["SCRIPT_FILENAME"]); $scriptName = array_pop($scriptName); if ($scriptName == 'showimage.php') { define('ABORT_AFTER_CONFIG', true); define('MOODLE_INTERNAL', true); // Moodle 2.2 - 2.5 min config doesn't define 'MOODLE_INTERNAL'. } $wrap->stop(); include_once $config; include_once $wirisFilter; $wrap->start(); $pluginBuilder->addConfigurationUpdater(new com_wiris_plugin_configuration_MoodleConfigurationUpdater()); $wrap->stop(); } $wrap->start(); $pluginBuilder->addConfigurationUpdater(new com_wiris_plugin_web_PhpConfigurationUpdater());
<?php if (!class_exists('com_wiris_system_CallWrapper')) { require_once dirname(__FILE__) . '/lib/com/wiris/system/CallWrapper.class.php'; } com_wiris_system_CallWrapper::getInstance()->init(dirname(__FILE__));