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();
     }
 }
 public function __construct()
 {
     if (!php_Boot::$skip_constructor) {
         parent::__construct();
         $this->updaterChain = new _hx_array(array());
         $this->updaterChain->push(new com_wiris_plugin_impl_DefaultConfigurationUpdater());
         $ci = new com_wiris_plugin_impl_ConfigurationImpl();
         $this->configuration = $ci;
         $ci->setPluginBuilderImpl($this);
     }
 }
Beispiel #3
0
<?php

// ${license.statement}
require_once 'lib/php/Boot.class.php';
$pluginBuilder = com_wiris_plugin_api_PluginBuilder::getInstance();
// Moodle base dir is 6 or 7 folders up, depending on the text editor.
// If open_basedir is defined, we only check moodlelib.php inside open_basedir environment
//
$moodle_dirrot = '../../../../../..';
$moodle = false;
// $deep = 10 allow to check all cases.
$deep = 10;
if ($openbasedir = get_cfg_var("open_basedir")) {
    $openbasedirarray = explode(DIRECTORY_SEPARATOR, $openbasedir);
    $currentscriptarray = explode(DIRECTORY_SEPARATOR, dirname(__FILE__));
    $deep = count(array_diff($currentscriptarray, $openbasedirarray));
}
if ($deep >= 6) {
    if (file_exists($moodle_dirrot . '/lib/moodlelib.php')) {
        $moodle = true;
    } else {
        if ($deep >= 7) {
            if (file_exists($moodle_dirrot . '/../lib/moodlelib.php')) {
                $moodle_dirrot .= '/..';
                $moodle = true;
            } else {
                if ($deep >= 8) {
                    if (file_exists($moodle_dirrot . '/../../lib/moodlelib.php')) {
                        $moodle_dirrot .= '/../..';
                        $moodle = true;
                    }