コード例 #1
0
 public function filter($text, array $options = array())
 {
     $n0 = stripos($text, '«math');
     $n1 = stripos($text, '<math');
     $n2 = stripos($text, '«applet');
     if ($n0 === false && $n1 === false && $n2 === false) {
         // Nothing to do
         return $text;
     }
     require_once "wirispluginwrapper.php";
     $wirisplugin = new WIRISpluginWrapper();
     if (!$wirisplugin->is_installed()) {
         return $text;
     }
     $wirisplugin->begin();
     $textservice = $wirisplugin->get_instance()->newTextService();
     $query = '';
     global $COURSE;
     if (isset($COURSE->id)) {
         $query .= '?course=' . $COURSE->id;
     }
     if (isset($COURSE->category)) {
         $query .= empty($query) ? '?' : '/';
         $query .= 'category=' . $COURSE->category;
     }
     $prop['refererquery'] = $query;
     $prop['savemode'] = 'safeXml';
     // safeXml filtering.
     $text = $textservice->filter($text, $prop);
     $prop['savemode'] = 'xml';
     // xml filtering.
     $text = $textservice->filter($text, $prop);
     $wirisplugin->end();
     return $text;
 }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
 public function com_wiris_plugin_configuration_MoodleConfigurationUpdater()
 {
     $scriptName = explode('/', $_SERVER["SCRIPT_FILENAME"]);
     $scriptName = array_pop($scriptName);
     if ($scriptName == 'showimage.php') {
         return;
     }
     global $CFG;
     require_once 'wirispluginwrapper.php';
     $this->editor_plugin = WIRISpluginWrapper::get_wiris_plugin();
 }
コード例 #4
0
ファイル: info.php プロジェクト: OctaveBabel/moodle-itop
$report_text = 'WIRIS plugin for ' . $wiris_plugin_base_string . ' must be installed.';
$solution_link = 'http://www.wiris.com/plugins/moodle/download';
$wiris_plugin = $wiris_plugin_base . '/integration';
$condition = file_exists($wiris_plugin);
if (!$condition) {
    $wiris_plugin = '../../lib/editor/tinymce/plugins/tiny_mce_wiris/integration';
    $condition = file_exists($wiris_plugin);
}
echo wrs_createTableRow($test_name, $report_text, $solution_link, $condition);
?>
			 
			</tr>
			<tr>	
				<?php 
@(include 'wirispluginwrapper.php');
$wirisplugin = WIRISpluginWrapper::get_wiris_plugin();
$test_name = 'Matching WIRIS plugin filter and WIRIS plugin for ' . $wiris_plugin_base_string . ' versions';
if (isset($plugin->release)) {
    $filter_version = $plugin->release;
} else {
    $report_text = '';
}
// Using version.php to check release number
if (strtolower($wiris_plugin_base_string) == 'tinymce') {
    include $wiris_plugin_base . '/../version.php';
} else {
    include $wiris_plugin_base . '/version.php';
}
if (isset($plugin->release)) {
    $plugin_version = $plugin->release;
} else {
コード例 #5
0
//  (at your option) any later version.
//
//  Moodle WIRIS Plugin is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with Moodle WIRIS Plugin. If not, see <http://www.gnu.org/licenses/>.
//
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
    global $CFG;
    global $wirisconfigurationclass;
    require_once 'wirispluginwrapper.php';
    $wirisplugin = new WIRISpluginWrapper();
    // If "uninstall" status changes, plugins caches must be reloaded in order to read new dependencies.
    // Moodle 2.4 and upwards
    if ($CFG->version >= 2012120300) {
        if (get_config('filter_wiris', 'uninstall') !== get_config('filter_wiris', 'uninstallchange')) {
            set_config('uninstallchange', get_config('filter_wiris', 'uninstall'), 'filter_wiris');
            if ($CFG->version >= 2013111800) {
                $cache = cache::make('core', 'plugin_manager');
                $cache->purge();
                $pluginmanager = core_plugin_manager::instance();
                if ($plugininfo = $pluginmanager->get_plugin_info('tinymce_tiny_mce_wiris')) {
                    set_config('uninstall', get_config('filter_wiris', 'uninstall'), 'tinymce_tiny_mce_wiris');
                }
                if ($plugininfo = $pluginmanager->get_plugin_info('atto_wiris')) {
                    set_config('uninstall', get_config('filter_wiris', 'uninstall'), 'atto_wiris');
                }