コード例 #1
0
/**
 * Setup all JS and CSS needed for editors.
 * @return void
 */
function editors_head_setup()
{
    global $CFG;
    if (empty($CFG->texteditors)) {
        $CFG->texteditors = 'tinymce,textarea';
    }
    $active = explode(',', $CFG->texteditors);
    foreach ($active as $editorname) {
        if (!($editor = get_texteditor($editorname))) {
            continue;
        }
        if (!$editor->supported_by_browser()) {
            // bad luck, this editor is not compatible
            continue;
        }
        $editor->head_setup();
    }
}
コード例 #2
0
ファイル: poodll.php プロジェクト: OctaveBabel/moodle-itop
 *
 * __________________________________________________________________________
 */
define('NO_MOODLE_COOKIES', false);
require __DIR__ . '../../../../../../../config.php';
$PAGE->set_context(context_system::instance());
$PAGE->set_url('/lib/editor/atto/plugins/poodll/dialog/poodll.php');
if (isset($SESSION->lang)) {
    // Language is set via page url param.
    $lang = $SESSION->lang;
} else {
    $lang = 'en';
}
require_login();
// CONTEXT_SYSTEM level.
$editor = get_texteditor('atto');
//$plugin = $editor->get_plugin('poodll');
$itemid = optional_param('itemid', '', PARAM_TEXT);
$recorder = optional_param('recorder', '', PARAM_TEXT);
$updatecontrol = optional_param('updatecontrol', '', PARAM_TEXT);
$usewhiteboard = optional_param('usewhiteboard', 'drawingboard', PARAM_TEXT);
//contextid
$usercontextid = context_user::instance($USER->id)->id;
$callbackjs = '';
//'atto_poodll_button.updatefilename';
// Load the recorder.
switch ($recorder) {
    case 'video':
        $recorderhtml = \filter_poodll\poodlltools::fetchVideoRecorderForSubmission('auto', 'none', $updatecontrol, $usercontextid, 'user', 'draft', $itemid, 0, $callbackjs);
        $instruction = get_string('recordtheninsert', 'atto_poodll');
        break;
コード例 #3
0
ファイル: editorlib.php プロジェクト: ajv/Offline-Caching
/**
 * can_use_html_editor is deprecated...
 * @deprecated
 * @todo Deprecated: eradicate completely, replace with something else
 * @return bool
 */
function can_use_html_editor()
{
    //TODO: eradicate completely, replace with something else
    $tinymyce = get_texteditor('tinymce');
    return $tinymyce->supported_by_browser();
}
コード例 #4
0
ファイル: dragmath.php プロジェクト: JP-Git/moodle
if (isset($SESSION->lang)) {
    // Language is set via page url param.
    $lang = $SESSION->lang;
} else {
    $lang = 'en';
}
// Find DragMath language.
$langmapping = array('cs' => 'cz', 'pt_br' => 'pt-br');
// Fix non-standard lang names.
if (array_key_exists($lang, $langmapping)) {
    $lang = $langmapping[$lang];
}
if (!file_exists("{$CFG->dirroot}/lib/dragmath/applet/lang/{$lang}.xml")) {
    $lang = 'en';
}
$editor = get_texteditor('tinymce');
$plugin = $editor->get_plugin('dragmath');
// Prevent https security problems.
$relroot = preg_replace('|^http.?://[^/]+|', '', $CFG->wwwroot);
$htmllang = get_html_lang();
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html <?php 
echo $htmllang;
?>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php 
print_string('title', 'tinymce_dragmath');
?>
コード例 #5
0
function editor_tinymce_parse_js_files()
{
    global $CFG;
    require_once "{$CFG->libdir}/editorlib.php";
    $editor = get_texteditor('tinymce');
    $basedir = "{$CFG->libdir}/editor/tinymce/tiny_mce/{$editor->version}";
    $files = array();
    $strings = array();
    $files['simple'] = "{$basedir}/themes/simple/langs/en.js";
    $files['advanced'] = "{$basedir}/themes/advanced/langs/en.js";
    $files['advanced_dlg'] = "{$basedir}/themes/advanced/langs/en_dlg.js";
    $items = new DirectoryIterator("{$basedir}/plugins/");
    foreach ($items as $item) {
        if ($item->isDot() or !$item->isDir()) {
            continue;
        }
        $plugin = $item->getFilename();
        if ($plugin === 'example') {
            continue;
        }
        if (file_exists("{$basedir}/plugins/{$plugin}/langs/en.js")) {
            $files[$plugin] = "{$basedir}/plugins/{$plugin}/langs/en.js";
        }
        if (file_exists("{$basedir}/plugins/{$plugin}/langs/en_dlg.js")) {
            $files[$plugin . '_dlg'] = "{$basedir}/plugins/{$plugin}/langs/en_dlg.js";
        }
        unset($item);
    }
    unset($items);
    // It would be too easy if TinyMCE used standard JSON in lang files...
    // Core upstream pack.
    $content = file_get_contents("{$basedir}/langs/en.js");
    $content = trim($content);
    $content = preg_replace("/^tinyMCE.addI18n\\(\\{en:/", '', $content);
    $content = preg_replace("/\\}\\);\$/", '', $content);
    $content = preg_replace("/([\\{,])([a-zA-Z0-9_]+):/", '$1"$2":', $content);
    $content = preg_replace("/:'([^']*)'/", ':"$1"', $content);
    $content = str_replace("\\'", "'", $content);
    $maindata = json_decode($content, true);
    if (is_null($maindata) or json_last_error() != 0) {
        echo "error processing main lang file\n";
        echo $content . "\n\n";
        exit(1);
    }
    foreach ($maindata as $component => $data) {
        foreach ($data as $key => $value) {
            $strings["{$component}:{$key}"] = $value;
        }
    }
    unset($content);
    unset($maindata);
    // Upstream plugins.
    foreach ($files as $plugin => $path) {
        $content = file_get_contents($path);
        $content = trim($content);
        $content = preg_replace("/^tinyMCE\\.addI18n\\('en\\.[a-z09_]*',\\s*/", '', $content);
        $content = preg_replace("/\\);\$/", '', $content);
        $content = preg_replace('/(\\{|"\\s*,)\\s*([a-z0-9_]+)\\s*:\\s*"/m', '$1"$2":"', $content);
        $content = str_replace("\\'", "'", $content);
        $data = json_decode($content, true);
        if (is_null($data) or json_last_error() != 0) {
            echo "error processing {$path} lang file\n";
            echo $content . "\n\n";
            exit(1);
        }
        foreach ($data as $key => $value) {
            if ($key === '_empty_') {
                continue;
            }
            $strings["{$plugin}:{$key}"] = $value;
        }
    }
    return $strings;
}