Merge branch 'MDL-77308-master' of https://github.com/andrewnicols/moodle
1
.gitignore
vendored
@ -20,7 +20,6 @@
|
||||
*~
|
||||
#
|
||||
/config.php
|
||||
/lib/editor/tinymce/extra/tools/temp/
|
||||
/tags
|
||||
/TAGS
|
||||
/cscope.*
|
||||
|
@ -278,9 +278,6 @@ class helper {
|
||||
static::add_plugin($presetid, 'repository', 'url', false);
|
||||
static::add_plugin($presetid, 'repository', 'wikimedia', false);
|
||||
|
||||
// Text editors: Disable TinyMCE HTML editor.
|
||||
static::add_plugin($presetid, 'editor', 'tinymce', false);
|
||||
|
||||
// Create the "Full" site admin preset.
|
||||
$data = [
|
||||
'name' => get_string('fullpreset', 'core_adminpresets'),
|
||||
@ -383,8 +380,5 @@ class helper {
|
||||
static::add_plugin($presetid, 'repository', 'local', true);
|
||||
static::add_plugin($presetid, 'repository', 'url', true);
|
||||
static::add_plugin($presetid, 'repository', 'wikimedia', true);
|
||||
|
||||
// Text editors: Enable TinyMCE HTML editor.
|
||||
static::add_plugin($presetid, 'editor', 'tinymce', true);
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,6 @@ class manager {
|
||||
'adminpresets_auth_shibboleth_admin_setting_special_idp_configtextarea' => 'adminpresets_admin_setting_configtext',
|
||||
'adminpresets_auth_shibboleth_admin_setting_special_wayf_select' => 'adminpresets_admin_setting_configselect',
|
||||
'adminpresets_editor_atto_toolbar_setting' => 'adminpresets_admin_setting_configtext',
|
||||
'adminpresets_editor_tinymce_json_setting_textarea' => 'adminpresets_admin_setting_configtext',
|
||||
'adminpresets_enrol_database_admin_setting_category' => 'adminpresets_admin_setting_configselect',
|
||||
'adminpresets_enrol_flatfile_role_setting' => 'adminpresets_admin_setting_configtext',
|
||||
'adminpresets_enrol_ldap_admin_setting_category' => 'adminpresets_admin_setting_configselect',
|
||||
|
@ -96,7 +96,6 @@ Feature: I can apply presets
|
||||
And I should see "Starred courses" in the "Setting changes" "table"
|
||||
And I should see "Survey" in the "Setting changes" "table"
|
||||
And I should see "Tags" in the "Setting changes" "table"
|
||||
And I should see "TinyMCE HTML editor" in the "Setting changes" "table"
|
||||
And I should see "URL downloader" in the "Setting changes" "table"
|
||||
And I should see "Wiki" in the "Setting changes" "table"
|
||||
And I should see "Wikimedia" in the "Setting changes" "table"
|
||||
|
@ -25,12 +25,6 @@
|
||||
* @copyright 2011 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Singleton class providing general plugins management functionality.
|
||||
*/
|
||||
class core_plugin_manager {
|
||||
|
||||
/** the plugin is shipped with standard Moodle distribution */
|
||||
@ -1730,6 +1724,7 @@ class core_plugin_manager {
|
||||
'auth' => array('radius', 'fc', 'nntp', 'pam', 'pop3', 'imap'),
|
||||
'block' => array('course_overview', 'messages', 'community', 'participants', 'quiz_results'),
|
||||
'cachestore' => array('memcache', 'memcached', 'mongodb'),
|
||||
'editor' => array('tinymce'),
|
||||
'enrol' => array('authorize'),
|
||||
'filter' => array('censor'),
|
||||
'media' => array('swf'),
|
||||
@ -1739,7 +1734,10 @@ class core_plugin_manager {
|
||||
'quizaccess' => array('safebrowser'),
|
||||
'report' => array('search'),
|
||||
'repository' => array('alfresco', 'picasa', 'skydrive', 'boxnet'),
|
||||
'tinymce' => array('dragmath'),
|
||||
'tinymce' => array('dragmath', 'ctrlhelp', 'managefiles', 'moodleemoticon', 'moodleimage',
|
||||
'moodlemedia', 'moodlenolink', 'pdw', 'spellchecker', 'wrap'
|
||||
),
|
||||
|
||||
'tool' => array('bloglevelupgrade', 'qeupgradehelper', 'timezoneimport', 'assignmentupgrade', 'health'),
|
||||
'theme' => array('bootstrapbase', 'clean', 'more', 'afterburner', 'anomaly', 'arialist', 'base',
|
||||
'binarius', 'boxxie', 'brick', 'canvas', 'formal_white', 'formfactor', 'fusion', 'leatherbound',
|
||||
@ -1862,7 +1860,7 @@ class core_plugin_manager {
|
||||
),
|
||||
|
||||
'editor' => array(
|
||||
'atto', 'textarea', 'tiny', 'tinymce'
|
||||
'atto', 'textarea', 'tiny',
|
||||
),
|
||||
|
||||
'enrol' => array(
|
||||
@ -2038,11 +2036,6 @@ class core_plugin_manager {
|
||||
'recordrtc',
|
||||
],
|
||||
|
||||
'tinymce' => array(
|
||||
'ctrlhelp', 'managefiles', 'moodleemoticon', 'moodleimage',
|
||||
'moodlemedia', 'moodlenolink', 'pdw', 'spellchecker', 'wrap'
|
||||
),
|
||||
|
||||
'theme' => array(
|
||||
'boost', 'classic'
|
||||
),
|
||||
|
@ -3099,5 +3099,24 @@ privatefiles,moodle|/user/files.php';
|
||||
upgrade_main_savepoint(true, 2023030300.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2023030300.03) {
|
||||
// If editor_tinymce is no longer present, remove it.
|
||||
if (!file_exists($CFG->dirroot . '/lib/editor/tinymce/version.php')) {
|
||||
// Clean config.
|
||||
uninstall_plugin('editor', 'tinymce');
|
||||
$DB->delete_records('user_preferences', [
|
||||
'name' => 'htmleditor',
|
||||
'value' => 'tinymce',
|
||||
]);
|
||||
|
||||
if ($editors = get_config('core', 'texteditors')) {
|
||||
$editors = array_flip(explode(',', $editors));
|
||||
unset($editors['tinymce']);
|
||||
set_config('texteditors', implode(',', array_flip($editors)));
|
||||
}
|
||||
}
|
||||
upgrade_main_savepoint(true, 2023030300.03);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,222 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE admin setting stuff.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
/**
|
||||
* Special class for TinyMCE subplugin administration.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tiynce_subplugins_settings extends admin_setting {
|
||||
public function __construct() {
|
||||
$this->nosave = true;
|
||||
parent::__construct('tinymcesubplugins', get_string('subplugintype_tinymce_plural', 'editor_tinymce'), '', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns true, does nothing.
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public function get_setting() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns true, does nothing.
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
public function get_defaultsetting() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns '', does not write anything.
|
||||
*
|
||||
* @param string $data
|
||||
* @return string Always returns ''
|
||||
*/
|
||||
public function write_setting($data) {
|
||||
// Do not write any setting.
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if $query is one of the available subplugins.
|
||||
*
|
||||
* @param string $query The string to search for
|
||||
* @return bool Returns true if found, false if not
|
||||
*/
|
||||
public function is_related($query) {
|
||||
if (parent::is_related($query)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$subplugins = core_component::get_plugin_list('tinymce');
|
||||
foreach ($subplugins as $name=>$dir) {
|
||||
if (stripos($name, $query) !== false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$namestr = get_string('pluginname', 'tinymce_'.$name);
|
||||
if (strpos(core_text::strtolower($namestr), core_text::strtolower($query)) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the XHTML to display the control.
|
||||
*
|
||||
* @param string $data Unused
|
||||
* @param string $query
|
||||
* @return string
|
||||
*/
|
||||
public function output_html($data, $query='') {
|
||||
global $CFG, $OUTPUT, $PAGE;
|
||||
require_once("$CFG->libdir/editorlib.php");
|
||||
require_once(__DIR__.'/lib.php');
|
||||
$tinymce = new tinymce_texteditor();
|
||||
$pluginmanager = core_plugin_manager::instance();
|
||||
|
||||
// display strings
|
||||
$strbuttons = get_string('availablebuttons', 'editor_tinymce');
|
||||
$strdisable = get_string('disable');
|
||||
$strenable = get_string('enable');
|
||||
$strname = get_string('name');
|
||||
$strsettings = get_string('settings');
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
$strversion = get_string('version');
|
||||
|
||||
$subplugins = core_component::get_plugin_list('tinymce');
|
||||
|
||||
$return = $OUTPUT->heading(get_string('subplugintype_tinymce_plural', 'editor_tinymce'), 3, 'main', true);
|
||||
$return .= $OUTPUT->box_start('generalbox tinymcesubplugins');
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array($strname, $strbuttons, $strversion, $strenable, $strsettings, $struninstall);
|
||||
$table->align = array('left', 'left', 'center', 'center', 'center', 'center');
|
||||
$table->data = array();
|
||||
$table->attributes['class'] = 'admintable generaltable';
|
||||
|
||||
// Iterate through subplugins.
|
||||
foreach ($subplugins as $name => $dir) {
|
||||
$namestr = get_string('pluginname', 'tinymce_'.$name);
|
||||
$version = get_config('tinymce_'.$name, 'version');
|
||||
if ($version === false) {
|
||||
$version = '';
|
||||
}
|
||||
$plugin = $tinymce->get_plugin($name);
|
||||
$plugininfo = $pluginmanager->get_plugin_info('tinymce_'.$name);
|
||||
|
||||
// Add hide/show link.
|
||||
$class = '';
|
||||
if (!$version) {
|
||||
$hideshow = '';
|
||||
$displayname = html_writer::tag('span', $name, array('class'=>'error'));
|
||||
} else if ($plugininfo->is_enabled()) {
|
||||
$url = new moodle_url('/lib/editor/tinymce/subplugins.php', array('sesskey'=>sesskey(), 'return'=>'settings', 'disable'=>$name));
|
||||
$hideshow = $OUTPUT->pix_icon('t/hide', $strdisable);
|
||||
$hideshow = html_writer::link($url, $hideshow);
|
||||
$displayname = $namestr;
|
||||
} else {
|
||||
$url = new moodle_url('/lib/editor/tinymce/subplugins.php', array('sesskey'=>sesskey(), 'return'=>'settings', 'enable'=>$name));
|
||||
$hideshow = $OUTPUT->pix_icon('t/show', $strenable);
|
||||
$hideshow = html_writer::link($url, $hideshow);
|
||||
$displayname = $namestr;
|
||||
$class = 'dimmed_text';
|
||||
}
|
||||
|
||||
if ($PAGE->theme->resolve_image_location('icon', 'tinymce_' . $name, false)) {
|
||||
$icon = $OUTPUT->pix_icon('icon', '', 'tinymce_' . $name, array('class' => 'icon pluginicon'));
|
||||
} else {
|
||||
$icon = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
|
||||
}
|
||||
$displayname = $icon . ' ' . $displayname;
|
||||
|
||||
// Add available buttons.
|
||||
$buttons = implode(', ', $plugin->get_buttons());
|
||||
$buttons = html_writer::tag('span', $buttons, array('class'=>'tinymcebuttons'));
|
||||
|
||||
// Add settings link.
|
||||
if (!$version) {
|
||||
$settings = '';
|
||||
} else if ($url = $plugininfo->get_settings_url()) {
|
||||
$settings = html_writer::link($url, $strsettings);
|
||||
} else {
|
||||
$settings = '';
|
||||
}
|
||||
|
||||
// Add uninstall info.
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('tinymce_' . $name, 'manage')) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
// Add a row to the table.
|
||||
$row = new html_table_row(array($displayname, $buttons, $version, $hideshow, $settings, $uninstall));
|
||||
if ($class) {
|
||||
$row->attributes['class'] = $class;
|
||||
}
|
||||
$table->data[] = $row;
|
||||
}
|
||||
$return .= html_writer::table($table);
|
||||
$return .= html_writer::tag('p', get_string('tablenosave', 'admin'));
|
||||
$return .= $OUTPUT->box_end();
|
||||
return highlight($query, $return);
|
||||
}
|
||||
}
|
||||
|
||||
class editor_tinymce_json_setting_textarea extends admin_setting_configtextarea {
|
||||
/**
|
||||
* Returns an XHTML string for the editor
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $query
|
||||
* @return string XHTML string for the editor
|
||||
*/
|
||||
public function output_html($data, $query='') {
|
||||
$result = parent::output_html($data, $query);
|
||||
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
$decoded = json_decode($data, true);
|
||||
// Note: it is not very nice to abuse these file classes, but anyway...
|
||||
if (is_array($decoded)) {
|
||||
$valid = '<span class="pathok">✔</span>';
|
||||
} else {
|
||||
$valid = '<span class="patherror">✘</span>';
|
||||
}
|
||||
$result = str_replace('</textarea>', '</textarea>'.$valid, $result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* On-the-fly conversion of Moodle lang strings to TinyMCE expected JS format.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2009 Petr Skoda (http://skodak.org)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('NO_MOODLE_COOKIES', true);
|
||||
define('NO_UPGRADE_CHECK', true);
|
||||
|
||||
require('../../../config.php');
|
||||
require_once("$CFG->dirroot/lib/jslib.php");
|
||||
require_once("$CFG->dirroot/lib/configonlylib.php");
|
||||
|
||||
$lang = optional_param('elanguage', 'en', PARAM_SAFEDIR);
|
||||
$rev = optional_param('rev', -1, PARAM_INT);
|
||||
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_url('/lib/editor/tinymce/extra/strings.php');
|
||||
|
||||
if (!get_string_manager()->translation_exists($lang, false)) {
|
||||
$lang = 'en';
|
||||
$rev = -1; // Do not cache missing langs.
|
||||
}
|
||||
|
||||
$candidate = "$CFG->cachedir/editor_tinymce/$rev/$lang.js";
|
||||
$etag = sha1("$lang/$rev");
|
||||
|
||||
if ($rev > -1 and file_exists($candidate)) {
|
||||
if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
|
||||
// we do not actually need to verify the etag value because our files
|
||||
// never change in cache because we increment the rev parameter
|
||||
js_send_unmodified(filemtime($candidate), $etag);
|
||||
}
|
||||
js_send_cached($candidate, $etag, 'all_strings.php');
|
||||
}
|
||||
|
||||
$string = get_string_manager()->load_component_strings('editor_tinymce', $lang);
|
||||
|
||||
// Process the $strings to match expected tinymce lang array structure.
|
||||
$result = array();
|
||||
|
||||
foreach ($string as $key=>$value) {
|
||||
$parts = explode(':', $key);
|
||||
if (count($parts) != 2) {
|
||||
// Ignore non-TinyMCE strings.
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[$parts[0]][$parts[1]] = $value;
|
||||
}
|
||||
|
||||
// Add subplugin strings, accept only those with proper pluginname prefix with colon.
|
||||
foreach (core_component::get_plugin_list('tinymce') as $component => $ignored) {
|
||||
$componentstrings = get_string_manager()->load_component_strings(
|
||||
'tinymce_' . $component, $lang);
|
||||
foreach ($componentstrings as $key => $value) {
|
||||
if (strpos($key, "$component:") !== 0 and strpos($key, $component.'_dlg:') !== 0) {
|
||||
// Ignore normal lang strings.
|
||||
continue;
|
||||
}
|
||||
$parts = explode(':', $key);
|
||||
if (count($parts) != 2) {
|
||||
// Ignore malformed strings with more colons.
|
||||
continue;
|
||||
}
|
||||
$component = $parts[0];
|
||||
$string = $parts[1];
|
||||
$result[$component][$string] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$output = 'tinyMCE.addI18n({'.$lang.':'.json_encode($result).'});';
|
||||
|
||||
if ($rev > -1) {
|
||||
js_write_cache_file_content($candidate, $output);
|
||||
// verify nothing failed in cache file creation
|
||||
clearstatcache();
|
||||
if (file_exists($candidate)) {
|
||||
js_send_cached($candidate, $etag, 'all_strings.php');
|
||||
}
|
||||
}
|
||||
|
||||
js_send_uncached($output, 'all_strings.php');
|
@ -1,476 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* TinyMCE text editor plugin base class.
|
||||
*
|
||||
* This is a base class for TinyMCE plugins implemented within Moodle. These
|
||||
* plugins can optionally provide new buttons/plugins within TinyMCE itself,
|
||||
* or configure the TinyMCE options.
|
||||
*
|
||||
* As well as overridable functions, other utility functions in this class
|
||||
* can be used when writing the plugins.
|
||||
*
|
||||
* Finally, a static function in this class is used to call into all the
|
||||
* plugins when required.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class editor_tinymce_plugin {
|
||||
/** @var string Plugin folder */
|
||||
protected $plugin;
|
||||
|
||||
/** @var array Plugin settings */
|
||||
protected $config = null;
|
||||
|
||||
/** @var array list of buttons defined by this plugin */
|
||||
protected $buttons = array();
|
||||
|
||||
/**
|
||||
* @param string $plugin Name of folder
|
||||
*/
|
||||
public function __construct($plugin) {
|
||||
$this->plugin = $plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of buttons defined by this plugin.
|
||||
* useful mostly as information when setting custom toolbar.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_buttons() {
|
||||
return $this->buttons;
|
||||
}
|
||||
/**
|
||||
* Makes sure config is loaded and cached.
|
||||
* @return void
|
||||
*/
|
||||
protected function load_config() {
|
||||
if (!isset($this->config)) {
|
||||
$name = $this->get_name();
|
||||
$this->config = get_config("tinymce_$name");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns plugin config value.
|
||||
* @param string $name
|
||||
* @param string $default value if config does not exist yet
|
||||
* @return string value or default
|
||||
*/
|
||||
public function get_config($name, $default = null) {
|
||||
$this->load_config();
|
||||
return isset($this->config->$name) ? $this->config->$name : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets plugin config value.
|
||||
* @param string $name name of config
|
||||
* @param string $value string config value, null means delete
|
||||
* @return string value
|
||||
*/
|
||||
public function set_config($name, $value) {
|
||||
$pluginname = $this->get_name();
|
||||
$this->load_config();
|
||||
if ($value === null) {
|
||||
unset($this->config->$name);
|
||||
} else {
|
||||
$this->config->$name = $value;
|
||||
}
|
||||
set_config($name, $value, "tinymce_$pluginname");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns name of this tinymce plugin.
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
// All class names start with "tinymce_".
|
||||
$words = explode('_', get_class($this), 2);
|
||||
return $words[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts TinyMCE init parameters for this plugin.
|
||||
*
|
||||
* Subclasses must implement this function in order to carry out changes
|
||||
* to the TinyMCE settings.
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param context $context Context where editor is being shown
|
||||
* @param array $options Options for this editor
|
||||
*/
|
||||
protected abstract function update_init_params(array &$params, context $context,
|
||||
array $options = null);
|
||||
|
||||
/**
|
||||
* Gets the order in which to run this plugin. Order usually only matters if
|
||||
* (a) the place you add your button might depend on another plugin, or
|
||||
* (b) you want to make some changes to layout etc. that should happen last.
|
||||
* The default order is 100; within that, plugins are sorted alphabetically.
|
||||
* Return a lower number if you want this plugin to run earlier, or a higher
|
||||
* number if you want it to run later.
|
||||
*/
|
||||
protected function get_sort_order() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a button to the editor, after another button (or at the end).
|
||||
*
|
||||
* Specify the location of this button using the $after variable. If you
|
||||
* leave this blank, the button will be added at the end.
|
||||
*
|
||||
* If you want to try different possible locations depending on existing
|
||||
* plugins you can set $alwaysadd to false and check the return value
|
||||
* to see if it succeeded.
|
||||
*
|
||||
* Note: button will not be added if it is already present in any row
|
||||
* (separator is an exception).
|
||||
*
|
||||
* The following example will add the button 'newbutton' after the
|
||||
* 'existingbutton' if it exists or in the end of the last row otherwise:
|
||||
* <pre>
|
||||
* if ($row = $this->find_button($params, 'existingbutton')) {
|
||||
* $this->add_button_after($params, $row, 'newbutton', 'existingbutton');
|
||||
* } else {
|
||||
* $this->add_button_after($params, $this->count_button_rows($params), 'newbutton');
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param int $row Row to add button to (1 to 3)
|
||||
* @param string $button Identifier of button/plugin
|
||||
* @param string $after Adds button directly after the named plugin
|
||||
* @param bool $alwaysadd If specified $after string not found, add at end
|
||||
* @return bool True if added or button already exists (in any row)
|
||||
*/
|
||||
protected function add_button_after(array &$params, $row, $button,
|
||||
$after = '', $alwaysadd = true) {
|
||||
|
||||
if ($button !== '|' && $this->find_button($params, $button)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$row = $this->fix_row($params, $row);
|
||||
|
||||
$field = 'theme_advanced_buttons' . $row;
|
||||
$old = $params[$field];
|
||||
|
||||
// Empty = add at end.
|
||||
if ($after === '') {
|
||||
$params[$field] = $old . ',' . $button;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Try to add after given plugin.
|
||||
$params[$field] = preg_replace('~(,|^)(' . preg_quote($after) . ')(,|$)~',
|
||||
'$1$2,' . $button . '$3', $old);
|
||||
if ($params[$field] !== $old) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If always adding, recurse to add it empty.
|
||||
if ($alwaysadd) {
|
||||
return $this->add_button_after($params, $row, $button);
|
||||
}
|
||||
|
||||
// Otherwise return false (failed to add).
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a button to the editor.
|
||||
*
|
||||
* Specify the location of this button using the $before variable. If you
|
||||
* leave this blank, the button will be added at the start.
|
||||
*
|
||||
* If you want to try different possible locations depending on existing
|
||||
* plugins you can set $alwaysadd to false and check the return value
|
||||
* to see if it succeeded.
|
||||
*
|
||||
* Note: button will not be added if it is already present in any row
|
||||
* (separator is an exception).
|
||||
*
|
||||
* The following example will add the button 'newbutton' before the
|
||||
* 'existingbutton' if it exists or in the end of the last row otherwise:
|
||||
* <pre>
|
||||
* if ($row = $this->find_button($params, 'existingbutton')) {
|
||||
* $this->add_button_before($params, $row, 'newbutton', 'existingbutton');
|
||||
* } else {
|
||||
* $this->add_button_after($params, $this->count_button_rows($params), 'newbutton');
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param int $row Row to add button to (1 to 10)
|
||||
* @param string $button Identifier of button/plugin
|
||||
* @param string $before Adds button directly before the named plugin
|
||||
* @param bool $alwaysadd If specified $before string not found, add at start
|
||||
* @return bool True if added or button already exists (in any row)
|
||||
*/
|
||||
protected function add_button_before(array &$params, $row, $button,
|
||||
$before = '', $alwaysadd = true) {
|
||||
|
||||
if ($button !== '|' && $this->find_button($params, $button)) {
|
||||
return true;
|
||||
}
|
||||
$row = $this->fix_row($params, $row);
|
||||
|
||||
$field = 'theme_advanced_buttons' . $row;
|
||||
$old = $params[$field];
|
||||
|
||||
// Empty = add at start.
|
||||
if ($before === '') {
|
||||
$params[$field] = $button . ',' . $old;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Try to add before given plugin.
|
||||
$params[$field] = preg_replace('~(,|^)(' . preg_quote($before) . ')(,|$)~',
|
||||
'$1' . $button . ',$2$3', $old);
|
||||
if ($params[$field] !== $old) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If always adding, recurse to add it empty.
|
||||
if ($alwaysadd) {
|
||||
return $this->add_button_before($params, $row, $button);
|
||||
}
|
||||
|
||||
// Otherwise return false (failed to add).
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if button is already present.
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param string $button button name
|
||||
* @return false|int false if button is not found, row number otherwise (row numbers start from 1)
|
||||
*/
|
||||
protected function find_button(array &$params, $button) {
|
||||
foreach ($params as $key => $value) {
|
||||
if (preg_match('/^theme_advanced_buttons(\d+)$/', $key, $matches) &&
|
||||
strpos(','. $value. ',', ','. $button. ',') !== false) {
|
||||
return (int)$matches[1];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the row value is valid, fix if necessary.
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param int $row Row to add button if exists
|
||||
* @return int requested row if exists, lower number if does not exist.
|
||||
*/
|
||||
private function fix_row(array &$params, $row) {
|
||||
if ($row <= 1) {
|
||||
// Row 1 is always present.
|
||||
return 1;
|
||||
} else if (isset($params['theme_advanced_buttons' . $row])) {
|
||||
return $row;
|
||||
} else {
|
||||
return $this->count_button_rows($params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts the number of rows in TinyMCE editor (row numbering starts with 1)
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @return int the maximum existing row number
|
||||
*/
|
||||
protected function count_button_rows(array &$params) {
|
||||
$maxrow = 1;
|
||||
foreach ($params as $key => $value) {
|
||||
if (preg_match('/^theme_advanced_buttons(\d+)$/', $key, $matches) &&
|
||||
(int)$matches[1] > $maxrow) {
|
||||
$maxrow = (int)$matches[1];
|
||||
}
|
||||
}
|
||||
return $maxrow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a JavaScript plugin into TinyMCE. Note that adding a plugin does
|
||||
* not by itself add a button; you must do both.
|
||||
*
|
||||
* If you leave $pluginname blank (default) it uses the folder name.
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param string $pluginname Identifier for plugin within TinyMCE
|
||||
* @param string $jsfile Name of JS file (within plugin 'tinymce' directory)
|
||||
*/
|
||||
protected function add_js_plugin(&$params, $pluginname='', $jsfile='editor_plugin.js') {
|
||||
global $CFG;
|
||||
|
||||
// Set default plugin name.
|
||||
if ($pluginname === '') {
|
||||
$pluginname = $this->plugin;
|
||||
}
|
||||
|
||||
// Add plugin to list in params, so it doesn't try to load it again.
|
||||
$params['plugins'] .= ',-' . $pluginname;
|
||||
|
||||
// Add special param that causes Moodle TinyMCE init to load the plugin.
|
||||
if (!isset($params['moodle_init_plugins'])) {
|
||||
$params['moodle_init_plugins'] = '';
|
||||
} else {
|
||||
$params['moodle_init_plugins'] .= ',';
|
||||
}
|
||||
|
||||
// Get URL of main JS file and store in params.
|
||||
$jsurl = $this->get_tinymce_file_url($jsfile, false);
|
||||
$params['moodle_init_plugins'] .= $pluginname . ':' . $jsurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns URL to files in the TinyMCE folder within this plugin, suitable
|
||||
* for client-side use such as loading JavaScript files. (This URL normally
|
||||
* goes through loader.php and contains the plugin version to ensure
|
||||
* correct and long-term cacheing.)
|
||||
*
|
||||
* @param string $file Filename or path within the folder
|
||||
* @param bool $absolute Set false to get relative URL from plugins folder
|
||||
*/
|
||||
public function get_tinymce_file_url($file='', $absolute=true) {
|
||||
global $CFG;
|
||||
|
||||
// Version number comes from plugin version.php, except in developer
|
||||
// mode where the special string 'dev' is used (prevents cacheing and
|
||||
// serves unminified JS).
|
||||
if ($CFG->debugdeveloper) {
|
||||
$version = '-1';
|
||||
} else {
|
||||
$version = $this->get_version();
|
||||
}
|
||||
|
||||
// Calculate the JS url (relative to the TinyMCE plugins folder - using
|
||||
// relative URL saves a few bytes in each HTML page).
|
||||
if ($CFG->slasharguments) {
|
||||
// URL is usually from loader.php...
|
||||
$jsurl = 'loader.php/' . $this->plugin . '/' . $version . '/' . $file;
|
||||
} else {
|
||||
// ...except when slash arguments are turned off it serves direct.
|
||||
// In this situation there is no version details and it is up to
|
||||
// the browser and server to negotiate cacheing, which will mean
|
||||
// requesting the JS files frequently (reduced performance).
|
||||
$jsurl = $this->plugin . '/tinymce/' . $file;
|
||||
}
|
||||
|
||||
if ($absolute) {
|
||||
$jsurl = $CFG->wwwroot . '/lib/editor/tinymce/plugins/' . $jsurl;
|
||||
}
|
||||
|
||||
return $jsurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains version number from version.php for this plugin.
|
||||
*
|
||||
* @return string Version number
|
||||
*/
|
||||
protected function get_version() {
|
||||
global $CFG;
|
||||
|
||||
$plugin = new stdClass;
|
||||
require($CFG->dirroot . '/lib/editor/tinymce/plugins/' . $this->plugin . '/version.php');
|
||||
return $plugin->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls all available plugins to adjust the TinyMCE init parameters.
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param context $context Context where editor is being shown
|
||||
* @param array $options Options for this editor
|
||||
*/
|
||||
public static function all_update_init_params(array &$params,
|
||||
context $context, array $options = null) {
|
||||
global $CFG;
|
||||
|
||||
// Get list of plugin directories.
|
||||
$plugins = core_component::get_plugin_list('tinymce');
|
||||
|
||||
// Get list of disabled subplugins.
|
||||
$disabled = array();
|
||||
if ($params['moodle_config']->disabledsubplugins) {
|
||||
foreach (explode(',', $params['moodle_config']->disabledsubplugins) as $sp) {
|
||||
$sp = trim($sp);
|
||||
if ($sp !== '') {
|
||||
$disabled[$sp] = $sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Construct all the plugins.
|
||||
$pluginobjects = array();
|
||||
foreach ($plugins as $plugin => $dir) {
|
||||
if (isset($disabled[$plugin])) {
|
||||
continue;
|
||||
}
|
||||
require_once($dir . '/lib.php');
|
||||
$classname = 'tinymce_' . $plugin;
|
||||
$pluginobjects[] = new $classname($plugin);
|
||||
}
|
||||
|
||||
// Sort plugins by sort order and name.
|
||||
usort($pluginobjects, array('editor_tinymce_plugin', 'compare_plugins'));
|
||||
|
||||
// Run the function for each plugin.
|
||||
foreach ($pluginobjects as $obj) {
|
||||
$obj->update_init_params($params, $context, $options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a named plugin object. Will cause fatal error if plugin doesn't exist.
|
||||
*
|
||||
* @param string $plugin Name of plugin e.g. 'moodleemoticon'
|
||||
* @return editor_tinymce_plugin Plugin object
|
||||
*/
|
||||
public static function get($plugin) {
|
||||
$dir = core_component::get_component_directory('tinymce_' . $plugin);
|
||||
require_once($dir . '/lib.php');
|
||||
$classname = 'tinymce_' . $plugin;
|
||||
return new $classname($plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two plugins.
|
||||
* @param editor_tinymce_plugin $a
|
||||
* @param editor_tinymce_plugin $b
|
||||
* @return Negative number if $a is before $b
|
||||
*/
|
||||
public static function compare_plugins(editor_tinymce_plugin $a, editor_tinymce_plugin $b) {
|
||||
// Use sort order first.
|
||||
$order = $a->get_sort_order() - $b->get_sort_order();
|
||||
if ($order != 0) {
|
||||
return $order;
|
||||
}
|
||||
|
||||
// Then sort alphabetically.
|
||||
return strcmp($a->plugin, $b->plugin);
|
||||
}
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Subplugin info class.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace editor_tinymce\plugininfo;
|
||||
|
||||
use core\plugininfo\base, moodle_url, part_of_admin_tree, admin_settingpage, core_component;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
class tinymce extends base {
|
||||
/**
|
||||
* Finds all enabled plugins, the result may include missing plugins.
|
||||
* @return array|null of enabled plugins $pluginname=>$pluginname, null means unknown
|
||||
*/
|
||||
public static function get_enabled_plugins() {
|
||||
$disabledsubplugins = array();
|
||||
$config = get_config('editor_tinymce', 'disabledsubplugins');
|
||||
if ($config) {
|
||||
$config = explode(',', $config);
|
||||
foreach ($config as $sp) {
|
||||
$sp = trim($sp);
|
||||
if ($sp !== '') {
|
||||
$disabledsubplugins[$sp] = $sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$enabled = array();
|
||||
$installed = core_component::get_plugin_list('tinymce');
|
||||
foreach ($installed as $plugin => $fulldir) {
|
||||
if (isset($disabledsubplugins[$plugin])) {
|
||||
continue;
|
||||
}
|
||||
$enabled[$plugin] = $plugin;
|
||||
}
|
||||
|
||||
return $enabled;
|
||||
}
|
||||
|
||||
public static function enable_plugin(string $pluginname, int $enabled): bool {
|
||||
$haschanged = false;
|
||||
$plugins = [];
|
||||
$oldvalue = get_config('editor_tinymce', 'disabledsubplugins');
|
||||
if (!empty($oldvalue)) {
|
||||
$plugins = array_flip(explode(',', $oldvalue));
|
||||
}
|
||||
// Only set visibility if it's different from the current value.
|
||||
if ($enabled && array_key_exists($pluginname, $plugins)) {
|
||||
unset($plugins[$pluginname]);
|
||||
$haschanged = true;
|
||||
} else if (!$enabled && !array_key_exists($pluginname, $plugins)) {
|
||||
$plugins[$pluginname] = $pluginname;
|
||||
$haschanged = true;
|
||||
}
|
||||
|
||||
if ($haschanged) {
|
||||
$new = implode(',', array_flip($plugins));
|
||||
add_to_config_log('disabledsubplugins', $oldvalue, $new, 'editor_tinymce');
|
||||
set_config('disabledsubplugins', $new, 'editor_tinymce');
|
||||
// Reset caches.
|
||||
\core_plugin_manager::reset_caches();
|
||||
}
|
||||
|
||||
return $haschanged;
|
||||
}
|
||||
|
||||
public function is_uninstall_allowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return URL used for management of plugins of this type.
|
||||
* @return moodle_url
|
||||
*/
|
||||
public static function get_manage_url() {
|
||||
return new moodle_url('/admin/settings.php', array('section'=>'editorsettingstinymce'));
|
||||
}
|
||||
|
||||
public function get_settings_section_name() {
|
||||
return 'tinymce'.$this->name.'settings';
|
||||
}
|
||||
|
||||
public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
|
||||
global $CFG, $USER, $DB, $OUTPUT, $PAGE; // In case settings.php wants to refer to them.
|
||||
$ADMIN = $adminroot; // May be used in settings.php.
|
||||
$plugininfo = $this; // Also can be used inside settings.php.
|
||||
|
||||
if (!$this->is_installed_and_upgraded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$hassiteconfig or !file_exists($this->full_path('settings.php'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$section = $this->get_settings_section_name();
|
||||
$settings = new admin_settingpage($section, $this->displayname, 'moodle/site:config', $this->is_enabled() === false);
|
||||
include($this->full_path('settings.php')); // This may also set $settings to null.
|
||||
|
||||
if ($settings) {
|
||||
$ADMIN->add($parentnodename, $settings);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for editor_tinymce.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace editor_tinymce\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for editor_tinymce implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,215 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* This script imports TinyMCE lang strings into Moodle English lang pack.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2009 Petr Skoda (http://skodak.org)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
|
||||
require __DIR__ . '/../../../../config.php';
|
||||
|
||||
if (!$CFG->debugdeveloper) {
|
||||
die('Only for developers!!!!!');
|
||||
}
|
||||
|
||||
// Current strings in our lang pack.
|
||||
$old_strings = editor_tinymce_get_all_strings();
|
||||
ksort($old_strings);
|
||||
|
||||
// Upstream strings.
|
||||
$parsed = editor_tinymce_parse_js_files();
|
||||
ksort($parsed);
|
||||
|
||||
// Our modifications and upstream changes in existing strings.
|
||||
$tweaked = array();
|
||||
|
||||
// Detect changes and new additions - ignore case difference, no UTF-8 here.
|
||||
foreach ($parsed as $key=>$value) {
|
||||
if (array_key_exists($key, $old_strings)) {
|
||||
$oldvalue = $old_strings[$key];
|
||||
if (strtolower($oldvalue) === strtolower($value)) {
|
||||
$parsed[$key] = $oldvalue;
|
||||
} else {
|
||||
$tweaked[$key] = $oldvalue;
|
||||
}
|
||||
unset($old_strings[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$handle = fopen("$CFG->dirroot/lib/editor/tinymce/lang/en/editor_tinymce.php", 'w')) {
|
||||
echo "Cannot write to $filename !!";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$header = <<<EOT
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'editor_tinymce', language 'en'.
|
||||
*
|
||||
* Note: use editor/tinymce/extra/tools/update_lang_files.php script to import strings from upstream JS lang files.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
EOT;
|
||||
|
||||
fwrite($handle, $header);
|
||||
|
||||
fwrite($handle, "\n\n//== Custom Moodle strings that are not part of upstream TinyMCE ==\n");
|
||||
foreach ($old_strings as $key=>$value) {
|
||||
fwrite($handle, editor_tinymce_encode_stringline($key, $value));
|
||||
}
|
||||
|
||||
fwrite($handle, "\n\n// == TinyMCE upstream lang strings from all standard upstream plugins ==\n");
|
||||
foreach ($parsed as $key=>$value) {
|
||||
fwrite($handle, editor_tinymce_encode_stringline($key, $value, isset($tweaked[$key])));
|
||||
}
|
||||
|
||||
if ($tweaked) {
|
||||
fwrite($handle, "\n\n// == Our modifications or upstream changes ==\n");
|
||||
foreach ($tweaked as $key=>$value) {
|
||||
fwrite($handle, editor_tinymce_encode_stringline($key, $value));
|
||||
}
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
|
||||
get_string_manager()->reset_caches();
|
||||
die("\nFinished update of EN lang pack (other langs have to be imported via AMOS)\n\n");
|
||||
|
||||
|
||||
|
||||
/// ============ Utility functions ========================
|
||||
|
||||
function editor_tinymce_encode_stringline($key, $value, $commentedout=false) {
|
||||
$return = "\$string['$key'] = ".var_export($value, true).";";
|
||||
if ($commentedout) {
|
||||
$return = "/* $return */";
|
||||
}
|
||||
return $return."\n";
|
||||
}
|
||||
|
||||
function editor_tinymce_get_all_strings() {
|
||||
$sm = get_string_manager();
|
||||
return $sm->load_component_strings('editor_tinymce', 'en', true, true);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"plugintypes": {
|
||||
"tinymce": "lib\/editor\/tinymce\/plugins"
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE editor integration upgrade.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_editor_tinymce_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
@ -1,897 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'editor_tinymce', language 'en'.
|
||||
*
|
||||
* Note: use editor/tinymce/extra/tools/update_lang_files.php script to import strings from upstream JS lang files.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
//== Custom Moodle strings that are not part of upstream TinyMCE ==
|
||||
$string['availablebuttons'] = 'Available buttons';
|
||||
$string['customconfig'] = 'Custom configuration';
|
||||
$string['customconfig_desc'] = 'Custom advanced TinyMCE configuration in JSON format, for example: {"option1" : "value2", "option2" : "value2"}. Any options specified here override standard and plugin settings.';
|
||||
$string['customtoolbar'] = 'Editor toolbar';
|
||||
$string['customtoolbar_desc'] = 'Each line contains a list of comma separated button names, use "wrap" as a group separator, empty lines are ignored. See <a href="{$a}" target="_blank">{$a}</a> for the list of default TinyMCE buttons.<br />The first row will always be shown, where as the visibility of second and third toolbars can be toggled.';
|
||||
$string['fontselectlist'] = 'Available fonts list';
|
||||
$string['pluginname'] = 'TinyMCE HTML editor (legacy)';
|
||||
$string['settings'] = 'General settings';
|
||||
$string['subplugintype_tinymce'] = 'Plugin';
|
||||
$string['subplugintype_tinymce_plural'] = 'Plugins';
|
||||
|
||||
|
||||
// == TinyMCE upstream lang strings from all standard upstream plugins ==
|
||||
$string['advanced:address'] = 'Address';
|
||||
$string['advanced:anchor_delta_height'] = '';
|
||||
$string['advanced:anchor_delta_width'] = '';
|
||||
$string['advanced:anchor_desc'] = 'Insert/edit anchor';
|
||||
$string['advanced:backcolor_desc'] = 'Select background color';
|
||||
$string['advanced:block'] = 'Format';
|
||||
$string['advanced:blockquote'] = 'Block quote';
|
||||
$string['advanced:blockquote_desc'] = 'Block quote';
|
||||
$string['advanced:bold_desc'] = 'Bold (Ctrl+B)';
|
||||
$string['advanced:bullist_desc'] = 'Insert/remove bulleted list';
|
||||
$string['advanced:charmap_delta_height'] = '';
|
||||
$string['advanced:charmap_delta_width'] = '';
|
||||
$string['advanced:charmap_desc'] = 'Insert special character';
|
||||
$string['advanced:cleanup_desc'] = 'Cleanup messy code';
|
||||
$string['advanced:clipboard_msg'] = 'Copy/cut/paste is not available in Mozilla and Firefox.
|
||||
Do you want more information about this issue?';
|
||||
$string['advanced:code'] = 'Code';
|
||||
$string['advanced:code_desc'] = 'Edit HTML source';
|
||||
$string['advanced:colorpicker_delta_height'] = '';
|
||||
$string['advanced:colorpicker_delta_width'] = '';
|
||||
/* $string['advanced:copy_desc'] = 'Copy (Ctrl+C)'; */
|
||||
$string['advanced:custom1_desc'] = 'Your custom description here';
|
||||
/* $string['advanced:cut_desc'] = 'Cut (Ctrl+X)'; */
|
||||
$string['advanced:dd'] = 'Definition description';
|
||||
$string['advanced:div'] = 'DIV';
|
||||
$string['advanced:dt'] = 'Definition term ';
|
||||
$string['advanced:font_size'] = 'Font size';
|
||||
$string['advanced:fontdefault'] = 'Font family';
|
||||
$string['advanced:forecolor_desc'] = 'Select text color';
|
||||
$string['advanced:h1'] = 'Heading 1';
|
||||
$string['advanced:h2'] = 'Heading 2';
|
||||
$string['advanced:h3'] = 'Heading 3';
|
||||
$string['advanced:h4'] = 'Heading 4';
|
||||
$string['advanced:h5'] = 'Heading 5';
|
||||
$string['advanced:h6'] = 'Heading 6';
|
||||
$string['advanced:help_desc'] = 'Help';
|
||||
$string['advanced:help_shortcut'] = 'Press ALT-F10 for toolbar. Press ALT-0 for help';
|
||||
$string['advanced:hr_desc'] = 'Insert horizontal line';
|
||||
$string['advanced:image_delta_height'] = '';
|
||||
$string['advanced:image_delta_width'] = '';
|
||||
$string['advanced:image_desc'] = 'Insert/edit image';
|
||||
$string['advanced:image_props_desc'] = 'Image properties';
|
||||
$string['advanced:indent_desc'] = 'Increase indent';
|
||||
$string['advanced:italic_desc'] = 'Italic (Ctrl+I)';
|
||||
$string['advanced:justifycenter_desc'] = 'Align center';
|
||||
$string['advanced:justifyfull_desc'] = 'Align full';
|
||||
$string['advanced:justifyleft_desc'] = 'Align left';
|
||||
$string['advanced:justifyright_desc'] = 'Align right';
|
||||
$string['advanced:link_delta_height'] = '';
|
||||
$string['advanced:link_delta_width'] = '';
|
||||
$string['advanced:link_desc'] = 'Insert/edit link';
|
||||
$string['advanced:more_colors'] = 'More colors...';
|
||||
$string['advanced:newdocument'] = 'Are you sure you want clear all contents?';
|
||||
$string['advanced:newdocument_desc'] = 'New document';
|
||||
$string['advanced:numlist_desc'] = 'Insert/remove numbered list';
|
||||
$string['advanced:outdent_desc'] = 'Decrease indent';
|
||||
$string['advanced:paragraph'] = 'Paragraph';
|
||||
/* $string['advanced:paste_desc'] = 'Paste (Ctrl+V)'; */
|
||||
$string['advanced:path'] = 'Path';
|
||||
$string['advanced:pre'] = 'Preformatted';
|
||||
$string['advanced:redo_desc'] = 'Redo (Ctrl+Y)';
|
||||
$string['advanced:removeformat_desc'] = 'Remove formatting';
|
||||
$string['advanced:rich_text_area'] = 'Rich text area';
|
||||
$string['advanced:samp'] = 'Code sample';
|
||||
/* $string['advanced:shortcuts_desc'] = 'Accessability Help'; */
|
||||
$string['advanced:striketrough_desc'] = 'Strikethrough';
|
||||
$string['advanced:style_select'] = 'Styles';
|
||||
$string['advanced:sub_desc'] = 'Subscript';
|
||||
$string['advanced:sup_desc'] = 'Superscript';
|
||||
$string['advanced:toolbar'] = 'Toolbar';
|
||||
$string['advanced:toolbar_focus'] = 'Jump to tool buttons - Alt+Q, jump to editor - Alt-Z, jump to element path - Alt-X';
|
||||
$string['advanced:underline_desc'] = 'Underline (Ctrl+U)';
|
||||
$string['advanced:undo_desc'] = 'Undo (Ctrl+Z)';
|
||||
$string['advanced:unlink_desc'] = 'Unlink';
|
||||
$string['advanced:visualaid_desc'] = 'Show/hide guidelines/invisible elements';
|
||||
$string['advanced_dlg:'] = '';
|
||||
$string['advanced_dlg:about_author'] = 'Author';
|
||||
$string['advanced_dlg:about_general'] = 'About';
|
||||
$string['advanced_dlg:about_help'] = 'Help';
|
||||
$string['advanced_dlg:about_license'] = 'Licence';
|
||||
$string['advanced_dlg:about_loaded'] = 'Loaded plugins';
|
||||
$string['advanced_dlg:about_plugin'] = 'Plugin';
|
||||
$string['advanced_dlg:about_plugins'] = 'Plugins';
|
||||
$string['advanced_dlg:about_title'] = 'About TinyMCE';
|
||||
$string['advanced_dlg:about_version'] = 'Version';
|
||||
$string['advanced_dlg:accessibility_help'] = 'Accessibility help';
|
||||
$string['advanced_dlg:accessibility_usage_title'] = 'General usage';
|
||||
$string['advanced_dlg:anchor_invalid'] = 'Please specify a valid anchor name.';
|
||||
$string['advanced_dlg:anchor_name'] = 'Anchor name';
|
||||
$string['advanced_dlg:anchor_title'] = 'Insert/edit anchor';
|
||||
$string['advanced_dlg:charmap_title'] = 'Select special character';
|
||||
$string['advanced_dlg:charmap_usage'] = 'Use left and right arrows to navigate.';
|
||||
$string['advanced_dlg:code_title'] = 'HTML source editor';
|
||||
$string['advanced_dlg:code_wordwrap'] = 'Word wrap';
|
||||
$string['advanced_dlg:colorpicker_color'] = 'Color:';
|
||||
$string['advanced_dlg:colorpicker_name'] = 'Name:';
|
||||
$string['advanced_dlg:colorpicker_named_tab'] = 'Named';
|
||||
$string['advanced_dlg:colorpicker_named_title'] = 'Named colors';
|
||||
$string['advanced_dlg:colorpicker_palette_tab'] = 'Palette';
|
||||
$string['advanced_dlg:colorpicker_palette_title'] = 'Palette colors';
|
||||
$string['advanced_dlg:colorpicker_picker_tab'] = 'Picker';
|
||||
$string['advanced_dlg:colorpicker_picker_title'] = 'Color picker';
|
||||
$string['advanced_dlg:colorpicker_title'] = 'Select a color';
|
||||
$string['advanced_dlg:image_align'] = 'Alignment';
|
||||
$string['advanced_dlg:image_align_baseline'] = 'Baseline';
|
||||
$string['advanced_dlg:image_align_bottom'] = 'Bottom';
|
||||
$string['advanced_dlg:image_align_left'] = 'Left';
|
||||
$string['advanced_dlg:image_align_middle'] = 'Middle';
|
||||
$string['advanced_dlg:image_align_right'] = 'Right';
|
||||
$string['advanced_dlg:image_align_textbottom'] = 'Text bottom';
|
||||
$string['advanced_dlg:image_align_texttop'] = 'Text top';
|
||||
$string['advanced_dlg:image_align_top'] = 'Top';
|
||||
$string['advanced_dlg:image_alt'] = 'Image description';
|
||||
$string['advanced_dlg:image_border'] = 'Border';
|
||||
$string['advanced_dlg:image_dimensions'] = 'Dimensions';
|
||||
$string['advanced_dlg:image_hspace'] = 'Horizontal space';
|
||||
$string['advanced_dlg:image_list'] = 'Image list';
|
||||
$string['advanced_dlg:image_src'] = 'Image URL';
|
||||
$string['advanced_dlg:image_title'] = 'Insert/edit image';
|
||||
$string['advanced_dlg:image_vspace'] = 'Vertical space';
|
||||
$string['advanced_dlg:invalid_color_value'] = 'Invalid color value';
|
||||
$string['advanced_dlg:link_is_email'] = 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?';
|
||||
$string['advanced_dlg:link_is_external'] = 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?';
|
||||
$string['advanced_dlg:link_list'] = 'Link list';
|
||||
$string['advanced_dlg:link_target'] = 'Target';
|
||||
$string['advanced_dlg:link_target_blank'] = 'Open link in a new window';
|
||||
$string['advanced_dlg:link_target_same'] = 'Open link in the same window';
|
||||
$string['advanced_dlg:link_title'] = 'Insert/edit link';
|
||||
$string['advanced_dlg:link_titlefield'] = 'Title';
|
||||
$string['advanced_dlg:link_url'] = 'Link URL';
|
||||
$string['advhr:advhr_desc'] = 'Insert horizontal line';
|
||||
$string['advhr:delta_height'] = '';
|
||||
$string['advhr:delta_width'] = '';
|
||||
$string['advhr_dlg:normal'] = 'Normal';
|
||||
$string['advhr_dlg:noshade'] = 'No shadow';
|
||||
$string['advhr_dlg:size'] = 'Height';
|
||||
$string['advhr_dlg:width'] = 'Width';
|
||||
$string['advhr_dlg:widthunits'] = 'Units';
|
||||
$string['advimage:delta_height'] = '';
|
||||
$string['advimage:delta_width'] = '';
|
||||
$string['advimage:image_desc'] = 'Insert/edit image';
|
||||
$string['advimage_dlg:align'] = 'Alignment';
|
||||
$string['advimage_dlg:align_baseline'] = 'Baseline';
|
||||
$string['advimage_dlg:align_bottom'] = 'Bottom';
|
||||
$string['advimage_dlg:align_left'] = 'Left';
|
||||
$string['advimage_dlg:align_middle'] = 'Middle';
|
||||
$string['advimage_dlg:align_right'] = 'Right';
|
||||
$string['advimage_dlg:align_textbottom'] = 'Text bottom';
|
||||
$string['advimage_dlg:align_texttop'] = 'Text top';
|
||||
$string['advimage_dlg:align_top'] = 'Top';
|
||||
$string['advimage_dlg:alt'] = 'Image description';
|
||||
$string['advimage_dlg:alt_image'] = 'Alternative image';
|
||||
$string['advimage_dlg:border'] = 'Border';
|
||||
$string['advimage_dlg:classes'] = 'Classes';
|
||||
$string['advimage_dlg:constrain_proportions'] = 'Constrain proportions';
|
||||
$string['advimage_dlg:dialog_title'] = 'Insert/edit image';
|
||||
$string['advimage_dlg:dimensions'] = 'Dimensions';
|
||||
$string['advimage_dlg:example_img'] = 'Appearance preview image';
|
||||
$string['advimage_dlg:general'] = 'General';
|
||||
$string['advimage_dlg:height'] = 'Height';
|
||||
$string['advimage_dlg:hspace'] = 'Horizontal space';
|
||||
$string['advimage_dlg:id'] = 'ID';
|
||||
$string['advimage_dlg:image_list'] = 'Image list';
|
||||
$string['advimage_dlg:langcode'] = 'Language code';
|
||||
$string['advimage_dlg:langdir'] = 'Language direction';
|
||||
$string['advimage_dlg:list'] = 'Image list';
|
||||
$string['advimage_dlg:long_desc'] = 'Long description link';
|
||||
$string['advimage_dlg:ltr'] = 'Left to right';
|
||||
$string['advimage_dlg:map'] = 'Image map';
|
||||
$string['advimage_dlg:misc'] = 'Miscellaneous';
|
||||
$string['advimage_dlg:missing_alt'] = 'Are you sure you want to continue without including an image description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images turned off.';
|
||||
$string['advimage_dlg:mouseout'] = 'for mouse out';
|
||||
$string['advimage_dlg:mouseover'] = 'for mouse over';
|
||||
$string['advimage_dlg:preview'] = 'Preview';
|
||||
$string['advimage_dlg:rtl'] = 'Right to left';
|
||||
$string['advimage_dlg:src'] = 'Image URL';
|
||||
$string['advimage_dlg:style'] = 'Style';
|
||||
$string['advimage_dlg:swap_image'] = 'Swap image';
|
||||
$string['advimage_dlg:tab_advanced'] = 'Advanced';
|
||||
$string['advimage_dlg:tab_appearance'] = 'Appearance';
|
||||
$string['advimage_dlg:tab_general'] = 'General';
|
||||
$string['advimage_dlg:title'] = 'Title';
|
||||
$string['advimage_dlg:vspace'] = 'Vertical space';
|
||||
$string['advimage_dlg:width'] = 'Width';
|
||||
$string['advlink:delta_height'] = '';
|
||||
$string['advlink:delta_width'] = '';
|
||||
$string['advlink:link_desc'] = 'Insert/edit link';
|
||||
$string['advlink_dlg:accesskey'] = 'AccessKey';
|
||||
$string['advlink_dlg:advanced_props'] = 'Advanced properties';
|
||||
$string['advlink_dlg:advanced_tab'] = 'Advanced';
|
||||
$string['advlink_dlg:anchor_names'] = 'Anchors';
|
||||
$string['advlink_dlg:classes'] = 'Classes';
|
||||
$string['advlink_dlg:encoding'] = 'Target character encoding';
|
||||
$string['advlink_dlg:event_props'] = 'Events';
|
||||
$string['advlink_dlg:events_tab'] = 'Events';
|
||||
$string['advlink_dlg:general_props'] = 'General properties';
|
||||
$string['advlink_dlg:general_tab'] = 'General';
|
||||
$string['advlink_dlg:height'] = 'Height';
|
||||
$string['advlink_dlg:id'] = 'ID';
|
||||
$string['advlink_dlg:is_email'] = 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?';
|
||||
$string['advlink_dlg:is_external'] = 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?';
|
||||
$string['advlink_dlg:langcode'] = 'Language code';
|
||||
$string['advlink_dlg:langdir'] = 'Language direction';
|
||||
$string['advlink_dlg:link_list'] = 'Link list';
|
||||
$string['advlink_dlg:list'] = 'Link list';
|
||||
$string['advlink_dlg:ltr'] = 'Left to right';
|
||||
$string['advlink_dlg:mime'] = 'Target MIME type';
|
||||
$string['advlink_dlg:popup'] = 'JavaScript popup';
|
||||
$string['advlink_dlg:popup_dependent'] = 'Dependent (Mozilla/Firefox only)';
|
||||
$string['advlink_dlg:popup_location'] = 'Show location bar';
|
||||
$string['advlink_dlg:popup_menubar'] = 'Show menu bar';
|
||||
$string['advlink_dlg:popup_name'] = 'Window name';
|
||||
$string['advlink_dlg:popup_opts'] = 'Options';
|
||||
$string['advlink_dlg:popup_position'] = 'Position (X/Y)';
|
||||
$string['advlink_dlg:popup_props'] = 'Popup properties';
|
||||
$string['advlink_dlg:popup_resizable'] = 'Make window resizable';
|
||||
$string['advlink_dlg:popup_return'] = 'Insert \'return false\'';
|
||||
$string['advlink_dlg:popup_scrollbars'] = 'Show scrollbars';
|
||||
$string['advlink_dlg:popup_size'] = 'Size';
|
||||
$string['advlink_dlg:popup_statusbar'] = 'Show status bar';
|
||||
$string['advlink_dlg:popup_tab'] = 'Popup';
|
||||
$string['advlink_dlg:popup_toolbar'] = 'Show toolbars';
|
||||
$string['advlink_dlg:popup_url'] = 'Popup URL';
|
||||
$string['advlink_dlg:rel'] = 'Relationship page to target';
|
||||
$string['advlink_dlg:rev'] = 'Relationship target to page';
|
||||
$string['advlink_dlg:rtl'] = 'Right to left';
|
||||
$string['advlink_dlg:style'] = 'Style';
|
||||
$string['advlink_dlg:tabindex'] = 'TabIndex';
|
||||
$string['advlink_dlg:target'] = 'Target';
|
||||
$string['advlink_dlg:target_blank'] = 'Open in new window';
|
||||
$string['advlink_dlg:target_langcode'] = 'Target language';
|
||||
$string['advlink_dlg:target_name'] = 'Target name';
|
||||
$string['advlink_dlg:target_parent'] = 'Open in parent window/frame';
|
||||
$string['advlink_dlg:target_same'] = 'Open in this window/frame';
|
||||
$string['advlink_dlg:target_top'] = 'Open in top frame (replaces all frames)';
|
||||
$string['advlink_dlg:title'] = 'Insert/edit link';
|
||||
$string['advlink_dlg:titlefield'] = 'Title';
|
||||
$string['advlink_dlg:url'] = 'Link URL';
|
||||
$string['advlink_dlg:width'] = 'Width';
|
||||
$string['advlist:circle'] = 'Circle';
|
||||
$string['advlist:def'] = 'Default';
|
||||
$string['advlist:disc'] = 'Disc';
|
||||
$string['advlist:lower_alpha'] = 'Lower alpha';
|
||||
$string['advlist:lower_greek'] = 'Lower greek';
|
||||
$string['advlist:lower_roman'] = 'Lower roman';
|
||||
$string['advlist:square'] = 'Square';
|
||||
$string['advlist:types'] = 'Types';
|
||||
$string['advlist:upper_alpha'] = 'Upper alpha';
|
||||
$string['advlist:upper_roman'] = 'Upper roman';
|
||||
$string['aria:rich_text_area'] = 'Rich text area';
|
||||
/* $string['autosave:restore_content'] = 'Restore auto-saved content.'; */
|
||||
$string['autosave:unload_msg'] = 'The changes you made will be lost if you navigate away from this page.';
|
||||
$string['autosave:warning_message'] = 'If you restore the saved content, you will lose all the content that is currently in the editor.
|
||||
|
||||
Are you sure you want to restore the saved content?';
|
||||
$string['colors:000000'] = 'Black';
|
||||
$string['colors:000080'] = 'Navy blue';
|
||||
$string['colors:0000FF'] = 'Blue';
|
||||
$string['colors:003300'] = 'Dark green';
|
||||
$string['colors:003366'] = 'Dark azure';
|
||||
$string['colors:008000'] = 'Green';
|
||||
$string['colors:008080'] = 'Teal';
|
||||
$string['colors:00CCFF'] = 'Sky blue';
|
||||
$string['colors:00FF00'] = 'Lime';
|
||||
$string['colors:00FFFF'] = 'Aqua';
|
||||
$string['colors:333300'] = 'Dark olive';
|
||||
$string['colors:333333'] = 'Very dark grey';
|
||||
$string['colors:333399'] = 'Indigo';
|
||||
$string['colors:3366FF'] = 'Royal blue';
|
||||
$string['colors:339966'] = 'Sea green';
|
||||
$string['colors:33CCCC'] = 'Turquoise';
|
||||
$string['colors:666699'] = 'Greyish blue';
|
||||
$string['colors:800000'] = 'Maroon';
|
||||
$string['colors:800080'] = 'Purple';
|
||||
$string['colors:808000'] = 'Olive';
|
||||
$string['colors:808080'] = 'Grey';
|
||||
$string['colors:993300'] = 'Burnt orange';
|
||||
$string['colors:993366'] = 'Brown';
|
||||
$string['colors:999999'] = 'Medium grey';
|
||||
$string['colors:99CC00'] = 'Yellow green';
|
||||
$string['colors:99CCFF'] = 'Light sky blue';
|
||||
$string['colors:C0C0C0'] = 'Silver';
|
||||
$string['colors:CC99FF'] = 'Plum';
|
||||
$string['colors:CCFFCC'] = 'Pale green';
|
||||
$string['colors:CCFFFF'] = 'Pale cyan';
|
||||
$string['colors:FF0000'] = 'Red';
|
||||
$string['colors:FF00FF'] = 'Magenta';
|
||||
$string['colors:FF6600'] = 'Orange';
|
||||
$string['colors:FF9900'] = 'Amber';
|
||||
$string['colors:FF99CC'] = 'Pink';
|
||||
$string['colors:FFCC00'] = 'Gold';
|
||||
$string['colors:FFCC99'] = 'Peach';
|
||||
$string['colors:FFFF00'] = 'Yellow';
|
||||
$string['colors:FFFF99'] = 'Light yellow';
|
||||
$string['colors:FFFFFF'] = 'White';
|
||||
$string['common:apply'] = 'Apply';
|
||||
$string['common:browse'] = 'Browse';
|
||||
$string['common:cancel'] = 'Cancel';
|
||||
$string['common:class_name'] = 'Class';
|
||||
$string['common:clipboard_msg'] = 'Copy/cut/paste is not available in Mozilla and Firefox.
|
||||
Do you want more information about this issue?';
|
||||
$string['common:clipboard_no_support'] = 'Currently not supported by your browser, use keyboard shortcuts instead.';
|
||||
$string['common:close'] = 'Close';
|
||||
$string['common:edit_confirm'] = 'Do you want to use the WYSIWYG mode for this textarea?';
|
||||
$string['common:insert'] = 'Insert';
|
||||
$string['common:invalid_data'] = 'Error: Invalid values entered, these are marked in red.';
|
||||
$string['common:invalid_data_min'] = '{#field} must be a number greater than {#min}';
|
||||
$string['common:invalid_data_number'] = '{#field} must be a number';
|
||||
$string['common:invalid_data_size'] = '{#field} must be a number or percentage';
|
||||
$string['common:more_colors'] = 'More colors...';
|
||||
$string['common:not_set'] = '-- Not set --';
|
||||
$string['common:popup_blocked'] = 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.';
|
||||
$string['common:update'] = 'Update';
|
||||
$string['common:value'] = '(value)';
|
||||
$string['contextmenu:align'] = 'Alignment';
|
||||
$string['contextmenu:center'] = 'Center';
|
||||
$string['contextmenu:full'] = 'Full';
|
||||
$string['contextmenu:left'] = 'Left';
|
||||
$string['contextmenu:right'] = 'Right';
|
||||
$string['directionality:ltr_desc'] = 'Direction left to right';
|
||||
$string['directionality:rtl_desc'] = 'Direction right to left';
|
||||
$string['emotions:delta_height'] = '';
|
||||
$string['emotions:delta_width'] = '';
|
||||
$string['emotions:emotions_desc'] = 'Emotions';
|
||||
$string['emotions_dlg:cool'] = 'Cool';
|
||||
$string['emotions_dlg:cry'] = 'Cry';
|
||||
$string['emotions_dlg:desc'] = 'Emotions';
|
||||
$string['emotions_dlg:embarassed'] = 'Embarassed';
|
||||
$string['emotions_dlg:foot_in_mouth'] = 'Foot in mouth';
|
||||
$string['emotions_dlg:frown'] = 'Frown';
|
||||
$string['emotions_dlg:innocent'] = 'Innocent';
|
||||
$string['emotions_dlg:kiss'] = 'Kiss';
|
||||
$string['emotions_dlg:laughing'] = 'Laughing';
|
||||
$string['emotions_dlg:money_mouth'] = 'Money mouth';
|
||||
$string['emotions_dlg:sealed'] = 'Sealed';
|
||||
$string['emotions_dlg:smile'] = 'Smile';
|
||||
$string['emotions_dlg:surprised'] = 'Surprised';
|
||||
$string['emotions_dlg:title'] = 'Insert emotion';
|
||||
$string['emotions_dlg:tongue_out'] = 'Tongue out';
|
||||
$string['emotions_dlg:undecided'] = 'Undecided';
|
||||
$string['emotions_dlg:usage'] = 'Use left and right arrows to navigate.';
|
||||
$string['emotions_dlg:wink'] = 'Wink';
|
||||
$string['emotions_dlg:yell'] = 'Yell';
|
||||
$string['fullpage:delta_height'] = '';
|
||||
$string['fullpage:delta_width'] = '';
|
||||
$string['fullpage:desc'] = 'Document properties';
|
||||
$string['fullpage_dlg:active_color'] = 'Active color';
|
||||
$string['fullpage_dlg:add'] = 'Add new element';
|
||||
$string['fullpage_dlg:add_base'] = 'Base element';
|
||||
$string['fullpage_dlg:add_comment'] = 'Comment node';
|
||||
$string['fullpage_dlg:add_link'] = 'Link element';
|
||||
$string['fullpage_dlg:add_meta'] = 'Meta element';
|
||||
$string['fullpage_dlg:add_script'] = 'Script element';
|
||||
$string['fullpage_dlg:add_style'] = 'Style element';
|
||||
$string['fullpage_dlg:add_title'] = 'Title element';
|
||||
$string['fullpage_dlg:advanced_props'] = 'Advanced';
|
||||
$string['fullpage_dlg:advanced_tab'] = 'Advanced';
|
||||
$string['fullpage_dlg:appearance_bgprops'] = 'Background properties';
|
||||
$string['fullpage_dlg:appearance_linkprops'] = 'Link colors';
|
||||
$string['fullpage_dlg:appearance_marginprops'] = 'Body margins';
|
||||
$string['fullpage_dlg:appearance_style'] = 'Stylesheet and style properties';
|
||||
$string['fullpage_dlg:appearance_tab'] = 'Appearance';
|
||||
$string['fullpage_dlg:appearance_textprops'] = 'Text properties';
|
||||
$string['fullpage_dlg:author'] = 'Author';
|
||||
$string['fullpage_dlg:base_element'] = 'Base element';
|
||||
$string['fullpage_dlg:bgcolor'] = 'Background color';
|
||||
$string['fullpage_dlg:bgimage'] = 'Background image';
|
||||
$string['fullpage_dlg:bottom_margin'] = 'Bottom margin';
|
||||
$string['fullpage_dlg:charset'] = 'Charset';
|
||||
$string['fullpage_dlg:comment_element'] = 'Comment';
|
||||
$string['fullpage_dlg:content'] = 'Content';
|
||||
$string['fullpage_dlg:copyright'] = 'Copyright';
|
||||
$string['fullpage_dlg:defer'] = 'Defer';
|
||||
$string['fullpage_dlg:doctypes'] = 'Doctype';
|
||||
$string['fullpage_dlg:encoding'] = 'Character encoding';
|
||||
$string['fullpage_dlg:font_face'] = 'Font face';
|
||||
$string['fullpage_dlg:font_size'] = 'Font size';
|
||||
$string['fullpage_dlg:fontface'] = 'Font family';
|
||||
$string['fullpage_dlg:fontsize'] = 'Font size';
|
||||
$string['fullpage_dlg:general_props'] = 'General';
|
||||
$string['fullpage_dlg:head_elements'] = 'Head elements';
|
||||
$string['fullpage_dlg:hover_color'] = 'Hover color';
|
||||
$string['fullpage_dlg:href'] = 'HREF';
|
||||
$string['fullpage_dlg:hreflang'] = 'HREF lang';
|
||||
$string['fullpage_dlg:info'] = 'Information';
|
||||
$string['fullpage_dlg:langcode'] = 'Language code';
|
||||
$string['fullpage_dlg:langdir'] = 'Language direction';
|
||||
$string['fullpage_dlg:langprops'] = 'Language and encoding';
|
||||
$string['fullpage_dlg:language'] = 'Language';
|
||||
$string['fullpage_dlg:left_margin'] = 'Left margin';
|
||||
$string['fullpage_dlg:link_color'] = 'Link color';
|
||||
$string['fullpage_dlg:link_element'] = 'Link element';
|
||||
$string['fullpage_dlg:ltr'] = 'Left to right';
|
||||
$string['fullpage_dlg:media'] = 'Media';
|
||||
$string['fullpage_dlg:meta_description'] = 'Description';
|
||||
$string['fullpage_dlg:meta_element'] = 'Meta element';
|
||||
$string['fullpage_dlg:meta_index_follow'] = 'Index and follow the links';
|
||||
$string['fullpage_dlg:meta_index_nofollow'] = 'Index and don\'t follow the links';
|
||||
$string['fullpage_dlg:meta_keywords'] = 'Keywords';
|
||||
$string['fullpage_dlg:meta_noindex_follow'] = 'Do not index but follow the links';
|
||||
$string['fullpage_dlg:meta_noindex_nofollow'] = 'Do not index and don\'t follow the links';
|
||||
$string['fullpage_dlg:meta_props'] = 'Meta information';
|
||||
$string['fullpage_dlg:meta_robots'] = 'Robots';
|
||||
$string['fullpage_dlg:meta_tab'] = 'General';
|
||||
$string['fullpage_dlg:meta_title'] = 'Title';
|
||||
$string['fullpage_dlg:movedown'] = 'Move selected element down';
|
||||
$string['fullpage_dlg:moveup'] = 'Move selected element up';
|
||||
$string['fullpage_dlg:name'] = 'Name';
|
||||
$string['fullpage_dlg:properties'] = 'Properties';
|
||||
$string['fullpage_dlg:rel'] = 'Rel';
|
||||
$string['fullpage_dlg:remove'] = 'Remove selected element';
|
||||
$string['fullpage_dlg:rev'] = 'Rev';
|
||||
$string['fullpage_dlg:right_margin'] = 'Right margin';
|
||||
$string['fullpage_dlg:rtl'] = 'Right to left';
|
||||
$string['fullpage_dlg:script_element'] = 'Script element';
|
||||
$string['fullpage_dlg:src'] = 'Source';
|
||||
$string['fullpage_dlg:style'] = 'Style';
|
||||
$string['fullpage_dlg:style_element'] = 'Style element';
|
||||
$string['fullpage_dlg:stylesheet'] = 'Stylesheet';
|
||||
$string['fullpage_dlg:target'] = 'Target';
|
||||
$string['fullpage_dlg:text_color'] = 'Text color';
|
||||
$string['fullpage_dlg:textcolor'] = 'Color';
|
||||
$string['fullpage_dlg:title'] = 'Document properties';
|
||||
$string['fullpage_dlg:title_element'] = 'Title element';
|
||||
$string['fullpage_dlg:top_margin'] = 'Top margin';
|
||||
$string['fullpage_dlg:type'] = 'Type';
|
||||
$string['fullpage_dlg:value'] = 'Value';
|
||||
$string['fullpage_dlg:visited_color'] = 'Visited color';
|
||||
$string['fullpage_dlg:xml_pi'] = 'XML declaration';
|
||||
$string['fullscreen:desc'] = 'Toggle full screen mode';
|
||||
$string['iespell:download'] = 'ieSpell not detected. Do you want to install it now?';
|
||||
$string['iespell:iespell_desc'] = 'Check spelling';
|
||||
$string['insertdatetime:date_fmt'] = '%Y-%m-%d';
|
||||
$string['insertdatetime:day_long'] = 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday';
|
||||
$string['insertdatetime:day_short'] = 'Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun';
|
||||
$string['insertdatetime:insertdate_desc'] = 'Insert date';
|
||||
$string['insertdatetime:inserttime_desc'] = 'Insert time';
|
||||
$string['insertdatetime:months_long'] = 'January,February,March,April,May,June,July,August,September,October,November,December';
|
||||
$string['insertdatetime:months_short'] = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec';
|
||||
$string['insertdatetime:time_fmt'] = '%H:%M:%S';
|
||||
$string['layer:absolute_desc'] = 'Toggle absolute positioning';
|
||||
$string['layer:backward_desc'] = 'Move backward';
|
||||
$string['layer:content'] = 'New layer...';
|
||||
$string['layer:forward_desc'] = 'Move forward';
|
||||
$string['layer:insertlayer_desc'] = 'Insert new layer';
|
||||
$string['media:delta_height'] = '';
|
||||
$string['media:delta_width'] = '';
|
||||
$string['media:desc'] = 'Insert/edit embedded media';
|
||||
$string['media:edit'] = 'Edit embedded media';
|
||||
$string['media_dlg:advanced'] = 'Advanced';
|
||||
$string['media_dlg:align'] = 'Align';
|
||||
$string['media_dlg:align_bottom'] = 'Bottom';
|
||||
$string['media_dlg:align_bottom_left'] = 'Bottom left';
|
||||
$string['media_dlg:align_bottom_right'] = 'Bottom right';
|
||||
$string['media_dlg:align_center'] = 'Center';
|
||||
$string['media_dlg:align_left'] = 'Left';
|
||||
$string['media_dlg:align_right'] = 'Right';
|
||||
$string['media_dlg:align_top'] = 'Top';
|
||||
$string['media_dlg:align_top_left'] = 'Top left';
|
||||
$string['media_dlg:align_top_right'] = 'Top right';
|
||||
$string['media_dlg:altsource1'] = 'Alternative source 1';
|
||||
$string['media_dlg:altsource2'] = 'Alternative source 2';
|
||||
$string['media_dlg:audio'] = 'HTML5 audio';
|
||||
$string['media_dlg:autogotourl'] = 'Auto goto URL';
|
||||
$string['media_dlg:autohref'] = 'Auto HREF';
|
||||
$string['media_dlg:autostart'] = 'Auto start';
|
||||
$string['media_dlg:balance'] = 'Balance';
|
||||
$string['media_dlg:base'] = 'Base';
|
||||
$string['media_dlg:baseurl'] = 'Base URL';
|
||||
$string['media_dlg:bgcolor'] = 'Background';
|
||||
$string['media_dlg:cache'] = 'Cache';
|
||||
$string['media_dlg:captioningid'] = 'Captioning ID';
|
||||
$string['media_dlg:center'] = 'Center';
|
||||
$string['media_dlg:class_name'] = 'Class';
|
||||
$string['media_dlg:console'] = 'Console';
|
||||
$string['media_dlg:constrain_proportions'] = 'Constrain proportions';
|
||||
$string['media_dlg:controller'] = 'Controller';
|
||||
$string['media_dlg:controls'] = 'Controls';
|
||||
$string['media_dlg:correction'] = 'No correction';
|
||||
$string['media_dlg:currentmarker'] = 'Current marker';
|
||||
$string['media_dlg:currentposition'] = 'Current position';
|
||||
$string['media_dlg:defaultframe'] = 'Default frame';
|
||||
$string['media_dlg:embedded_audio_options'] = 'Embedded audio options';
|
||||
$string['media_dlg:embeddedaudio'] = 'Embedded audio';
|
||||
$string['media_dlg:enabled'] = 'Enabled';
|
||||
$string['media_dlg:enablejavascript'] = 'Enable JavaScript';
|
||||
$string['media_dlg:endtime'] = 'End time';
|
||||
$string['media_dlg:file'] = 'File/URL';
|
||||
$string['media_dlg:flash'] = 'Flash';
|
||||
$string['media_dlg:flash_options'] = 'Flash options';
|
||||
$string['media_dlg:flashvars'] = 'Flash vars';
|
||||
$string['media_dlg:fullscreen'] = 'Full screen';
|
||||
$string['media_dlg:general'] = 'General';
|
||||
$string['media_dlg:hidden'] = 'Hidden';
|
||||
$string['media_dlg:href'] = 'HREF';
|
||||
$string['media_dlg:hspace'] = 'H-Space';
|
||||
$string['media_dlg:html5_audio_options'] = 'Audio options';
|
||||
$string['media_dlg:html5_video_options'] = 'HTML5 video options';
|
||||
$string['media_dlg:id'] = 'ID';
|
||||
$string['media_dlg:iframe'] = 'Iframe';
|
||||
$string['media_dlg:imagestatus'] = 'Image status';
|
||||
$string['media_dlg:invokeurls'] = 'Invoke URLs';
|
||||
$string['media_dlg:kioskmode'] = 'Kiosk mode';
|
||||
$string['media_dlg:list'] = 'List';
|
||||
$string['media_dlg:liveconnect'] = 'SWLiveConnect';
|
||||
$string['media_dlg:loop'] = 'Loop';
|
||||
$string['media_dlg:maintainaspect'] = 'Maintain aspect';
|
||||
$string['media_dlg:menu'] = 'Show menu';
|
||||
$string['media_dlg:mute'] = 'Mute';
|
||||
$string['media_dlg:name'] = 'Name';
|
||||
$string['media_dlg:nojava'] = 'No Java';
|
||||
$string['media_dlg:numloop'] = 'Num loops';
|
||||
$string['media_dlg:play'] = 'Auto play';
|
||||
$string['media_dlg:playcount'] = 'Play count';
|
||||
$string['media_dlg:playeveryframe'] = 'Play every frame';
|
||||
$string['media_dlg:poster'] = 'Poster';
|
||||
$string['media_dlg:prefetch'] = 'Prefetch';
|
||||
$string['media_dlg:preload'] = 'Preload';
|
||||
$string['media_dlg:preload_auto'] = 'Let user\'s browser decide';
|
||||
$string['media_dlg:preload_metadata'] = 'Preload video metadata';
|
||||
$string['media_dlg:preload_none'] = 'Don\'t preload';
|
||||
$string['media_dlg:preview'] = 'Preview';
|
||||
$string['media_dlg:progress'] = 'Progress';
|
||||
$string['media_dlg:qt_options'] = 'QuickTime options';
|
||||
$string['media_dlg:qt_stream_warn'] = 'Streamed RTSP resources should be added to the QT source field under the advanced tab.
|
||||
You should also add a non-streamed version to the source field.';
|
||||
$string['media_dlg:qtsrc'] = 'QT source';
|
||||
$string['media_dlg:qtsrcchokespeed'] = 'Choke speed';
|
||||
$string['media_dlg:quality'] = 'Quality';
|
||||
$string['media_dlg:quicktime'] = 'QuickTime';
|
||||
$string['media_dlg:rate'] = 'Rate';
|
||||
$string['media_dlg:realmedia'] = 'Real Media';
|
||||
$string['media_dlg:rmp_options'] = 'Real Media Player options';
|
||||
$string['media_dlg:salign'] = 'SAlign';
|
||||
$string['media_dlg:scale'] = 'Scale';
|
||||
$string['media_dlg:scriptcallbacks'] = 'Script callbacks';
|
||||
$string['media_dlg:shockwave'] = 'Shockwave';
|
||||
$string['media_dlg:shockwave_options'] = 'Shockwave options';
|
||||
$string['media_dlg:shuffle'] = 'Shuffle';
|
||||
$string['media_dlg:size'] = 'Dimensions';
|
||||
$string['media_dlg:sound'] = 'Sound';
|
||||
$string['media_dlg:source'] = 'Source';
|
||||
$string['media_dlg:starttime'] = 'Start time';
|
||||
$string['media_dlg:stretchtofit'] = 'Stretch to fit';
|
||||
$string['media_dlg:swstretchhalign'] = 'Stretch H-Align';
|
||||
$string['media_dlg:swstretchstyle'] = 'Stretch Style';
|
||||
$string['media_dlg:swstretchvalign'] = 'Stretch V-Align';
|
||||
$string['media_dlg:target'] = 'Target';
|
||||
$string['media_dlg:targetcache'] = 'Target cache';
|
||||
$string['media_dlg:title'] = 'Insert/edit embedded media';
|
||||
$string['media_dlg:type'] = 'Type';
|
||||
$string['media_dlg:uimode'] = 'UI mode';
|
||||
$string['media_dlg:video'] = 'HTML5 video';
|
||||
$string['media_dlg:volume'] = 'Volume';
|
||||
$string['media_dlg:vspace'] = 'V-Space';
|
||||
$string['media_dlg:windowlessvideo'] = 'Windowless video';
|
||||
$string['media_dlg:windowsmedia'] = 'Windows Media';
|
||||
$string['media_dlg:wmode'] = 'WMode';
|
||||
$string['media_dlg:wmp_options'] = 'Windows Media Player options';
|
||||
$string['nonbreaking:nonbreaking_desc'] = 'Insert non-breaking space character';
|
||||
$string['pagebreak:desc'] = 'Insert page break for printing';
|
||||
$string['paste:paste_text_desc'] = 'Paste as plain Text';
|
||||
$string['paste:paste_word_desc'] = 'Paste from Word';
|
||||
$string['paste:plaintext_mode'] = 'Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.';
|
||||
$string['paste:plaintext_mode_stick'] = 'Paste is now in plain text mode. Click again to toggle back to regular paste mode.';
|
||||
$string['paste:selectall_desc'] = 'Select All';
|
||||
$string['paste_dlg:text_linebreaks'] = 'Keep linebreaks';
|
||||
$string['paste_dlg:text_title'] = 'Use Ctrl+V on your keyboard to paste the text into the window.';
|
||||
$string['paste_dlg:word_title'] = 'Use Ctrl+V on your keyboard to paste the text into the window.';
|
||||
$string['preview:preview_desc'] = 'Preview';
|
||||
$string['print:print_desc'] = 'Print';
|
||||
$string['save:cancel_desc'] = 'Cancel all changes';
|
||||
$string['save:save_desc'] = 'Save';
|
||||
$string['searchreplace:delta_height'] = '';
|
||||
$string['searchreplace:delta_width'] = '';
|
||||
$string['searchreplace:replace_desc'] = 'Find/replace';
|
||||
$string['searchreplace:search_desc'] = 'Find';
|
||||
$string['searchreplace_dlg:allreplaced'] = 'All occurrences of the search string were replaced.';
|
||||
$string['searchreplace_dlg:direction'] = 'Direction';
|
||||
$string['searchreplace_dlg:down'] = 'Down';
|
||||
$string['searchreplace_dlg:findnext'] = 'Find next';
|
||||
$string['searchreplace_dlg:findwhat'] = 'Find what';
|
||||
$string['searchreplace_dlg:mcase'] = 'Match case';
|
||||
$string['searchreplace_dlg:notfound'] = 'The search has been completed. The search string could not be found.';
|
||||
$string['searchreplace_dlg:replace'] = 'Replace';
|
||||
$string['searchreplace_dlg:replace_title'] = 'Find/replace';
|
||||
$string['searchreplace_dlg:replaceall'] = 'Replace all';
|
||||
$string['searchreplace_dlg:replacewith'] = 'Replace with';
|
||||
$string['searchreplace_dlg:search_title'] = 'Find';
|
||||
$string['searchreplace_dlg:searchnext_desc'] = 'Find again';
|
||||
$string['searchreplace_dlg:up'] = 'Up';
|
||||
$string['simple:bold_desc'] = 'Bold (Ctrl+B)';
|
||||
$string['simple:bullist_desc'] = 'Insert/remove bulleted list';
|
||||
$string['simple:cleanup_desc'] = 'Cleanup messy code';
|
||||
$string['simple:italic_desc'] = 'Italic (Ctrl+I)';
|
||||
$string['simple:numlist_desc'] = 'Insert/remove numbered list';
|
||||
$string['simple:redo_desc'] = 'Redo (Ctrl+Y)';
|
||||
$string['simple:striketrough_desc'] = 'Strikethrough';
|
||||
$string['simple:underline_desc'] = 'Underline (Ctrl+U)';
|
||||
$string['simple:undo_desc'] = 'Undo (Ctrl+Z)';
|
||||
$string['spellchecker:desc'] = 'Toggle spell checker';
|
||||
$string['spellchecker:ignore_word'] = 'Ignore word';
|
||||
$string['spellchecker:ignore_words'] = 'Ignore all';
|
||||
$string['spellchecker:langs'] = 'Languages';
|
||||
$string['spellchecker:learn_word'] = 'Learn word';
|
||||
$string['spellchecker:menu'] = 'Spell checker settings';
|
||||
$string['spellchecker:no_mpell'] = 'No misspellings found.';
|
||||
$string['spellchecker:no_sug'] = 'No Suggestions';
|
||||
$string['spellchecker:sug'] = 'Suggestions';
|
||||
$string['spellchecker:wait'] = 'Please wait...';
|
||||
$string['style:delta_height'] = '';
|
||||
$string['style:delta_width'] = '';
|
||||
$string['style:desc'] = 'Edit CSS style';
|
||||
$string['style_dlg:apply'] = 'Apply';
|
||||
$string['style_dlg:background'] = 'Background';
|
||||
$string['style_dlg:background_attachment'] = 'Attachment';
|
||||
$string['style_dlg:background_color'] = 'Background color';
|
||||
$string['style_dlg:background_hpos'] = 'Horizontal position';
|
||||
$string['style_dlg:background_image'] = 'Background image';
|
||||
$string['style_dlg:background_repeat'] = 'Repeat';
|
||||
$string['style_dlg:background_tab'] = 'Background';
|
||||
$string['style_dlg:background_vpos'] = 'Vertical position';
|
||||
$string['style_dlg:block'] = 'Block';
|
||||
$string['style_dlg:block_display'] = 'Display';
|
||||
$string['style_dlg:block_letterspacing'] = 'Letter spacing';
|
||||
$string['style_dlg:block_tab'] = 'Block';
|
||||
$string['style_dlg:block_text_align'] = 'Text align';
|
||||
$string['style_dlg:block_text_indent'] = 'Text indent';
|
||||
$string['style_dlg:block_vertical_alignment'] = 'Vertical alignment';
|
||||
$string['style_dlg:block_whitespace'] = 'Whitespace';
|
||||
$string['style_dlg:block_wordspacing'] = 'Word spacing';
|
||||
$string['style_dlg:border'] = 'Border';
|
||||
$string['style_dlg:border_tab'] = 'Border';
|
||||
$string['style_dlg:bottom'] = 'Bottom';
|
||||
$string['style_dlg:box'] = 'Box';
|
||||
$string['style_dlg:box_clear'] = 'Clear';
|
||||
$string['style_dlg:box_float'] = 'Float';
|
||||
$string['style_dlg:box_height'] = 'Height';
|
||||
$string['style_dlg:box_tab'] = 'Box';
|
||||
$string['style_dlg:box_width'] = 'Width';
|
||||
$string['style_dlg:bullet_image'] = 'Bullet image';
|
||||
$string['style_dlg:clip'] = 'Clip';
|
||||
$string['style_dlg:color'] = 'Color';
|
||||
$string['style_dlg:height'] = 'Height';
|
||||
$string['style_dlg:left'] = 'Left';
|
||||
$string['style_dlg:list'] = 'List';
|
||||
$string['style_dlg:list_tab'] = 'List';
|
||||
$string['style_dlg:list_type'] = 'Type';
|
||||
$string['style_dlg:margin'] = 'Margin';
|
||||
$string['style_dlg:overflow'] = 'Overflow';
|
||||
$string['style_dlg:padding'] = 'Padding';
|
||||
$string['style_dlg:placement'] = 'Placement';
|
||||
$string['style_dlg:position'] = 'Position';
|
||||
$string['style_dlg:positioning_tab'] = 'Positioning';
|
||||
$string['style_dlg:positioning_type'] = 'Type';
|
||||
$string['style_dlg:right'] = 'Right';
|
||||
$string['style_dlg:same'] = 'Same for all';
|
||||
$string['style_dlg:style'] = 'Style';
|
||||
$string['style_dlg:text'] = 'Text';
|
||||
$string['style_dlg:text_blink'] = 'Blink';
|
||||
$string['style_dlg:text_case'] = 'Case';
|
||||
$string['style_dlg:text_color'] = 'Color';
|
||||
$string['style_dlg:text_decoration'] = 'Decoration';
|
||||
$string['style_dlg:text_font'] = 'Font';
|
||||
$string['style_dlg:text_lineheight'] = 'Line height';
|
||||
$string['style_dlg:text_none'] = 'None';
|
||||
$string['style_dlg:text_overline'] = 'Overline';
|
||||
$string['style_dlg:text_props'] = 'Text';
|
||||
$string['style_dlg:text_size'] = 'Size';
|
||||
$string['style_dlg:text_striketrough'] = 'Strikethrough';
|
||||
$string['style_dlg:text_style'] = 'Style';
|
||||
$string['style_dlg:text_tab'] = 'Text';
|
||||
$string['style_dlg:text_underline'] = 'Underline';
|
||||
$string['style_dlg:text_variant'] = 'Variant';
|
||||
$string['style_dlg:text_weight'] = 'Weight';
|
||||
$string['style_dlg:title'] = 'Edit CSS style';
|
||||
$string['style_dlg:toggle_insert_span'] = 'Insert span at selection';
|
||||
$string['style_dlg:top'] = 'Top';
|
||||
$string['style_dlg:visibility'] = 'Visibility';
|
||||
$string['style_dlg:width'] = 'Width';
|
||||
$string['style_dlg:zindex'] = 'Z-index';
|
||||
$string['table:cell'] = 'Cell';
|
||||
$string['table:cell_desc'] = 'Table cell properties';
|
||||
$string['table:cellprops_delta_height'] = '';
|
||||
$string['table:cellprops_delta_width'] = '';
|
||||
$string['table:col'] = 'Column';
|
||||
$string['table:col_after_desc'] = 'Insert column after';
|
||||
$string['table:col_before_desc'] = 'Insert column before';
|
||||
$string['table:copy_row_desc'] = 'Copy table row';
|
||||
$string['table:cut_row_desc'] = 'Cut table row';
|
||||
$string['table:del'] = 'Delete Table';
|
||||
$string['table:delete_col_desc'] = 'Delete column';
|
||||
$string['table:delete_row_desc'] = 'Delete row';
|
||||
$string['table:desc'] = 'Insert/edit table';
|
||||
$string['table:merge_cells_delta_height'] = '';
|
||||
$string['table:merge_cells_delta_width'] = '';
|
||||
$string['table:merge_cells_desc'] = 'Merge table cells';
|
||||
$string['table:paste_row_after_desc'] = 'Paste table row after';
|
||||
$string['table:paste_row_before_desc'] = 'Paste table row before';
|
||||
$string['table:props_desc'] = 'Table properties';
|
||||
$string['table:row'] = 'Row';
|
||||
$string['table:row_after_desc'] = 'Insert row after';
|
||||
$string['table:row_before_desc'] = 'Insert row before';
|
||||
$string['table:row_desc'] = 'Table row properties';
|
||||
$string['table:rowprops_delta_height'] = '';
|
||||
$string['table:rowprops_delta_width'] = '';
|
||||
$string['table:split_cells_desc'] = 'Split merged table cells';
|
||||
$string['table:table_delta_height'] = '';
|
||||
$string['table:table_delta_width'] = '';
|
||||
$string['table_dlg:advanced_props'] = 'Advanced properties';
|
||||
$string['table_dlg:advanced_tab'] = 'Advanced';
|
||||
$string['table_dlg:align'] = 'Alignment';
|
||||
$string['table_dlg:align_bottom'] = 'Bottom';
|
||||
$string['table_dlg:align_default'] = 'Default';
|
||||
$string['table_dlg:align_left'] = 'Left';
|
||||
$string['table_dlg:align_middle'] = 'Center';
|
||||
$string['table_dlg:align_right'] = 'Right';
|
||||
$string['table_dlg:align_top'] = 'Top';
|
||||
$string['table_dlg:bgcolor'] = 'Background color';
|
||||
$string['table_dlg:bgimage'] = 'Background image';
|
||||
$string['table_dlg:border'] = 'Border';
|
||||
$string['table_dlg:bordercolor'] = 'Border color';
|
||||
$string['table_dlg:caption'] = 'Table caption';
|
||||
$string['table_dlg:cell_all'] = 'Update all cells in table';
|
||||
$string['table_dlg:cell_cell'] = 'Update current cell';
|
||||
$string['table_dlg:cell_col'] = 'Update all cells in column';
|
||||
$string['table_dlg:cell_limit'] = 'You\'ve exceeded the maximum number of cells of {$cells}.';
|
||||
$string['table_dlg:cell_row'] = 'Update all cells in row';
|
||||
$string['table_dlg:cell_title'] = 'Table cell properties';
|
||||
$string['table_dlg:cell_type'] = 'Cell type';
|
||||
$string['table_dlg:cellpadding'] = 'Cell padding';
|
||||
$string['table_dlg:cellspacing'] = 'Cell spacing';
|
||||
$string['table_dlg:col_limit'] = 'You\'ve exceeded the maximum number of columns of {$cols}.';
|
||||
$string['table_dlg:colgroup'] = 'Col group';
|
||||
$string['table_dlg:cols'] = 'Columns';
|
||||
$string['table_dlg:frame'] = 'Frame';
|
||||
$string['table_dlg:frame_all'] = 'all';
|
||||
$string['table_dlg:frame_cols'] = 'cols';
|
||||
$string['table_dlg:frame_groups'] = 'groups';
|
||||
$string['table_dlg:frame_none'] = 'none';
|
||||
$string['table_dlg:frame_rows'] = 'rows';
|
||||
$string['table_dlg:general_props'] = 'General properties';
|
||||
$string['table_dlg:general_tab'] = 'General';
|
||||
$string['table_dlg:height'] = 'Height';
|
||||
$string['table_dlg:id'] = 'ID';
|
||||
$string['table_dlg:langcode'] = 'Language code';
|
||||
$string['table_dlg:langdir'] = 'Language direction';
|
||||
$string['table_dlg:ltr'] = 'Left to right';
|
||||
$string['table_dlg:merge_cells_title'] = 'Merge table cells';
|
||||
$string['table_dlg:mime'] = 'Target MIME type';
|
||||
$string['table_dlg:missing_scope'] = 'Are you sure you want to continue without specifying a scope for this table header cell? Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.';
|
||||
$string['table_dlg:row_all'] = 'Update all rows in table';
|
||||
$string['table_dlg:row_even'] = 'Update even rows in table';
|
||||
$string['table_dlg:row_limit'] = 'You\'ve exceeded the maximum number of rows of {$rows}.';
|
||||
$string['table_dlg:row_odd'] = 'Update odd rows in table';
|
||||
$string['table_dlg:row_row'] = 'Update current row';
|
||||
$string['table_dlg:row_title'] = 'Table row properties';
|
||||
$string['table_dlg:rowgroup'] = 'Row group';
|
||||
$string['table_dlg:rows'] = 'Rows';
|
||||
$string['table_dlg:rowtype'] = 'Row type';
|
||||
$string['table_dlg:rtl'] = 'Right to left';
|
||||
$string['table_dlg:rules'] = 'Rules';
|
||||
$string['table_dlg:rules_above'] = 'above';
|
||||
$string['table_dlg:rules_below'] = 'below';
|
||||
$string['table_dlg:rules_border'] = 'border';
|
||||
$string['table_dlg:rules_box'] = 'box';
|
||||
$string['table_dlg:rules_hsides'] = 'hsides';
|
||||
$string['table_dlg:rules_lhs'] = 'lhs';
|
||||
$string['table_dlg:rules_rhs'] = 'rhs';
|
||||
$string['table_dlg:rules_void'] = 'void';
|
||||
$string['table_dlg:rules_vsides'] = 'vsides';
|
||||
$string['table_dlg:scope'] = 'Scope';
|
||||
$string['table_dlg:style'] = 'Style';
|
||||
$string['table_dlg:summary'] = 'Summary';
|
||||
$string['table_dlg:tbody'] = 'Body';
|
||||
$string['table_dlg:td'] = 'Data';
|
||||
$string['table_dlg:tfoot'] = 'Footer';
|
||||
$string['table_dlg:th'] = 'Header';
|
||||
$string['table_dlg:thead'] = 'Header';
|
||||
$string['table_dlg:title'] = 'Insert/edit table';
|
||||
$string['table_dlg:valign'] = 'Vertical alignment';
|
||||
$string['table_dlg:width'] = 'Width';
|
||||
$string['template:desc'] = 'Insert predefined template content';
|
||||
$string['template_dlg:cdate_format'] = '%Y-%m-%d %H:%M:%S';
|
||||
$string['template_dlg:day_long'] = 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday';
|
||||
$string['template_dlg:day_short'] = 'Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun';
|
||||
$string['template_dlg:desc'] = 'Insert predefined template content';
|
||||
$string['template_dlg:desc_label'] = 'Description';
|
||||
$string['template_dlg:label'] = 'Template';
|
||||
$string['template_dlg:mdate_format'] = '%Y-%m-%d %H:%M:%S';
|
||||
$string['template_dlg:months_long'] = 'January,February,March,April,May,June,July,August,September,October,November,December';
|
||||
$string['template_dlg:months_short'] = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec';
|
||||
$string['template_dlg:preview'] = 'Preview';
|
||||
$string['template_dlg:select'] = 'Select a template';
|
||||
$string['template_dlg:title'] = 'Templates';
|
||||
$string['template_dlg:warning'] = 'Warning: Updating a template with a different one may cause data loss.';
|
||||
$string['visualblocks:desc'] = 'Show/hide block elements';
|
||||
$string['visualchars:desc'] = 'Show/hide visual control characters';
|
||||
$string['wordcount:words'] = 'Words:';
|
||||
$string['xhtmlxtras:abbr_delta_height'] = '';
|
||||
$string['xhtmlxtras:abbr_delta_width'] = '';
|
||||
$string['xhtmlxtras:abbr_desc'] = 'Abbreviation';
|
||||
$string['xhtmlxtras:acronym_delta_height'] = '';
|
||||
$string['xhtmlxtras:acronym_delta_width'] = '';
|
||||
$string['xhtmlxtras:acronym_desc'] = 'Acronym';
|
||||
$string['xhtmlxtras:attribs_delta_height'] = '';
|
||||
$string['xhtmlxtras:attribs_delta_width'] = '';
|
||||
$string['xhtmlxtras:attribs_desc'] = 'Insert/edit attributes';
|
||||
$string['xhtmlxtras:cite_delta_height'] = '';
|
||||
$string['xhtmlxtras:cite_delta_width'] = '';
|
||||
$string['xhtmlxtras:cite_desc'] = 'Citation';
|
||||
$string['xhtmlxtras:del_delta_height'] = '';
|
||||
$string['xhtmlxtras:del_delta_width'] = '';
|
||||
$string['xhtmlxtras:del_desc'] = 'Deletion';
|
||||
$string['xhtmlxtras:ins_delta_height'] = '';
|
||||
$string['xhtmlxtras:ins_delta_width'] = '';
|
||||
$string['xhtmlxtras:ins_desc'] = 'Insertion';
|
||||
$string['xhtmlxtras_dlg:attrib_tab'] = 'Attributes';
|
||||
$string['xhtmlxtras_dlg:attribs_title'] = 'Insert/edit attributes';
|
||||
$string['xhtmlxtras_dlg:attribute_attrib_tab'] = 'Attributes';
|
||||
$string['xhtmlxtras_dlg:attribute_events_tab'] = 'Events';
|
||||
$string['xhtmlxtras_dlg:attribute_label_accesskey'] = 'AccessKey';
|
||||
$string['xhtmlxtras_dlg:attribute_label_cite'] = 'Cite';
|
||||
$string['xhtmlxtras_dlg:attribute_label_class'] = 'Class';
|
||||
$string['xhtmlxtras_dlg:attribute_label_datetime'] = 'Date/time';
|
||||
$string['xhtmlxtras_dlg:attribute_label_id'] = 'ID';
|
||||
$string['xhtmlxtras_dlg:attribute_label_langcode'] = 'Language';
|
||||
$string['xhtmlxtras_dlg:attribute_label_langdir'] = 'Text direction';
|
||||
$string['xhtmlxtras_dlg:attribute_label_style'] = 'Style';
|
||||
$string['xhtmlxtras_dlg:attribute_label_tabindex'] = 'TabIndex';
|
||||
$string['xhtmlxtras_dlg:attribute_label_title'] = 'Title';
|
||||
$string['xhtmlxtras_dlg:attribute_option_ltr'] = 'Left to right';
|
||||
$string['xhtmlxtras_dlg:attribute_option_rtl'] = 'Right to left';
|
||||
$string['xhtmlxtras_dlg:events_tab'] = 'Events';
|
||||
$string['xhtmlxtras_dlg:fieldset_attrib_tab'] = 'Element attributes';
|
||||
$string['xhtmlxtras_dlg:fieldset_events_tab'] = 'Element events';
|
||||
$string['xhtmlxtras_dlg:fieldset_general_tab'] = 'General settings';
|
||||
$string['xhtmlxtras_dlg:general_tab'] = 'General';
|
||||
$string['xhtmlxtras_dlg:insert_date'] = 'Insert current date/time';
|
||||
$string['xhtmlxtras_dlg:option_ltr'] = 'Left to right';
|
||||
$string['xhtmlxtras_dlg:option_rtl'] = 'Right to left';
|
||||
$string['xhtmlxtras_dlg:remove'] = 'Remove';
|
||||
$string['xhtmlxtras_dlg:title_abbr_element'] = 'Abbreviation element';
|
||||
$string['xhtmlxtras_dlg:title_acronym_element'] = 'Acronym element';
|
||||
$string['xhtmlxtras_dlg:title_cite_element'] = 'Citation element';
|
||||
$string['xhtmlxtras_dlg:title_del_element'] = 'Deletion element';
|
||||
$string['xhtmlxtras_dlg:title_ins_element'] = 'Insertion element';
|
||||
|
||||
|
||||
// == Our modifications or upstream changes ==
|
||||
$string['advanced:copy_desc'] = 'Copy';
|
||||
$string['advanced:cut_desc'] = 'Cut';
|
||||
$string['advanced:paste_desc'] = 'Paste';
|
||||
$string['advanced:shortcuts_desc'] = 'Accessibility help';
|
||||
$string['autosave:restore_content'] = 'Restore auto-saved content';
|
||||
$string['privacy:metadata'] = 'The TinyMCE HTML editor plugin does not store any personal data.';
|
@ -1,263 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE text editor integration.
|
||||
*
|
||||
* @package editor
|
||||
* @subpackage tinymce
|
||||
* @copyright 2009 Petr Skoda (http://skodak.org)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
class tinymce_texteditor extends texteditor {
|
||||
/** @var string active version - this is the directory name where to find tinymce code */
|
||||
public $version = '3.5.11';
|
||||
|
||||
/**
|
||||
* Is the current browser supported by this editor?
|
||||
* @return bool
|
||||
*/
|
||||
public function supported_by_browser() {
|
||||
// We don't support any browsers which it doesn't support.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array of supported text formats.
|
||||
* @return array
|
||||
*/
|
||||
public function get_supported_formats() {
|
||||
// FORMAT_MOODLE is not supported here, sorry.
|
||||
return array(FORMAT_HTML => FORMAT_HTML);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns text format preferred by this editor.
|
||||
* @return int
|
||||
*/
|
||||
public function get_preferred_format() {
|
||||
return FORMAT_HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this editor support picking from repositories?
|
||||
* @return bool
|
||||
*/
|
||||
public function supports_repositories() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up head code if necessary.
|
||||
*/
|
||||
public function head_setup() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this editor for give element.
|
||||
*
|
||||
* @param string $elementid
|
||||
* @param array $options
|
||||
* @param null $fpoptions
|
||||
*/
|
||||
public function use_editor($elementid, array $options=null, $fpoptions=null) {
|
||||
global $PAGE, $CFG;
|
||||
// Note: use full moodle_url instance to prevent standard JS loader, make sure we are using https on profile page if required.
|
||||
if ($CFG->debugdeveloper) {
|
||||
$PAGE->requires->js(new moodle_url('/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce_src.js'));
|
||||
} else {
|
||||
$PAGE->requires->js(new moodle_url('/lib/editor/tinymce/tiny_mce/'.$this->version.'/tiny_mce.js'));
|
||||
}
|
||||
$PAGE->requires->js_init_call('M.editor_tinymce.init_editor', array($elementid, $this->get_init_params($elementid, $options)), true);
|
||||
if ($fpoptions) {
|
||||
$PAGE->requires->js_init_call('M.editor_tinymce.init_filepicker', array($elementid, $fpoptions), true);
|
||||
}
|
||||
}
|
||||
|
||||
protected function get_init_params($elementid, array $options=null) {
|
||||
global $CFG, $PAGE, $OUTPUT;
|
||||
|
||||
//TODO: we need to implement user preferences that affect the editor setup too
|
||||
|
||||
$directionality = get_string('thisdirection', 'langconfig');
|
||||
$strtime = get_string('strftimetime');
|
||||
$strdate = get_string('strftimedaydate');
|
||||
$lang = current_language();
|
||||
$contentcss = $PAGE->theme->editor_css_url()->out(false);
|
||||
|
||||
$context = empty($options['context']) ? context_system::instance() : $options['context'];
|
||||
|
||||
$config = get_config('editor_tinymce');
|
||||
if (!isset($config->disabledsubplugins)) {
|
||||
$config->disabledsubplugins = '';
|
||||
}
|
||||
|
||||
// Remove the manage files button if requested.
|
||||
if (isset($options['enable_filemanagement']) && !$options['enable_filemanagement']) {
|
||||
if (!strpos($config->disabledsubplugins, 'managefiles')) {
|
||||
$config->disabledsubplugins .= ',managefiles';
|
||||
}
|
||||
}
|
||||
|
||||
$fontselectlist = empty($config->fontselectlist) ? '' : $config->fontselectlist;
|
||||
|
||||
$langrev = -1;
|
||||
if (!empty($CFG->cachejs)) {
|
||||
$langrev = get_string_manager()->get_revision();
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'moodle_config' => $config,
|
||||
'mode' => "exact",
|
||||
'elements' => $elementid,
|
||||
'relative_urls' => false,
|
||||
'document_base_url' => $CFG->wwwroot,
|
||||
'moodle_plugin_base' => "$CFG->wwwroot/lib/editor/tinymce/plugins/",
|
||||
'content_css' => $contentcss,
|
||||
'language' => $lang,
|
||||
'directionality' => $directionality,
|
||||
'plugin_insertdate_dateFormat ' => $strdate,
|
||||
'plugin_insertdate_timeFormat ' => $strtime,
|
||||
'theme' => "advanced",
|
||||
'skin' => "moodle",
|
||||
'apply_source_formatting' => true,
|
||||
'remove_script_host' => false,
|
||||
'entity_encoding' => "raw",
|
||||
'plugins' => 'lists,table,style,layer,advhr,advlink,emotions,inlinepopups,' .
|
||||
'searchreplace,paste,directionality,fullscreen,nonbreaking,contextmenu,' .
|
||||
'insertdatetime,save,iespell,preview,print,noneditable,visualchars,' .
|
||||
'xhtmlxtras,template,pagebreak',
|
||||
'gecko_spellcheck' => true,
|
||||
'theme_advanced_font_sizes' => "1,2,3,4,5,6,7",
|
||||
'theme_advanced_layout_manager' => "SimpleLayout",
|
||||
'theme_advanced_toolbar_align' => "left",
|
||||
'theme_advanced_fonts' => $fontselectlist,
|
||||
'theme_advanced_resize_horizontal' => true,
|
||||
'theme_advanced_resizing' => true,
|
||||
'theme_advanced_resizing_min_height' => 30,
|
||||
'min_height' => 30,
|
||||
'theme_advanced_toolbar_location' => "top",
|
||||
'theme_advanced_statusbar_location' => "bottom",
|
||||
'language_load' => false, // We load all lang strings directly from Moodle.
|
||||
'langrev' => $langrev,
|
||||
);
|
||||
|
||||
// Should we override the default toolbar layout unconditionally?
|
||||
if (!empty($config->customtoolbar) and $customtoolbar = self::parse_toolbar_setting($config->customtoolbar)) {
|
||||
$i = 1;
|
||||
foreach ($customtoolbar as $line) {
|
||||
$params['theme_advanced_buttons'.$i] = $line;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
// At least one line is required.
|
||||
$params['theme_advanced_buttons1'] = '';
|
||||
}
|
||||
|
||||
if (!empty($config->customconfig)) {
|
||||
$config->customconfig = trim($config->customconfig);
|
||||
$decoded = json_decode($config->customconfig, true);
|
||||
if (is_array($decoded)) {
|
||||
foreach ($decoded as $k=>$v) {
|
||||
$params[$k] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($options['legacy']) or !empty($options['noclean']) or !empty($options['trusted'])) {
|
||||
// now deal somehow with non-standard tags, people scream when we do not make moodle code xtml strict,
|
||||
// but they scream even more when we strip all tags that are not strict :-(
|
||||
$params['valid_elements'] = 'script[src|type],*[*]'; // for some reason the *[*] does not inlcude javascript src attribute MDL-25836
|
||||
$params['invalid_elements'] = '';
|
||||
}
|
||||
// Add unique moodle elements - unfortunately we have to decide if these are SPANs or DIVs.
|
||||
$params['extended_valid_elements'] = 'nolink,tex,algebra,lang[lang]';
|
||||
$params['custom_elements'] = 'nolink,~tex,~algebra,lang';
|
||||
|
||||
//Add onblur event for client side text validation
|
||||
if (!empty($options['required'])) {
|
||||
$params['init_instance_callback'] = 'M.editor_tinymce.onblur_event';
|
||||
}
|
||||
|
||||
// Allow plugins to adjust parameters.
|
||||
editor_tinymce_plugin::all_update_init_params($params, $context, $options);
|
||||
|
||||
// Remove temporary parameters.
|
||||
unset($params['moodle_config']);
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the custom toolbar setting.
|
||||
* @param string $customtoolbar
|
||||
* @return array csv toolbar lines
|
||||
*/
|
||||
public static function parse_toolbar_setting($customtoolbar) {
|
||||
$result = array();
|
||||
$customtoolbar = trim($customtoolbar);
|
||||
if ($customtoolbar === '') {
|
||||
return $result;
|
||||
}
|
||||
$customtoolbar = str_replace("\r", "\n", $customtoolbar);
|
||||
$customtoolbar = strtolower($customtoolbar);
|
||||
$i = 0;
|
||||
foreach (explode("\n", $customtoolbar) as $line) {
|
||||
$line = preg_replace('/[^a-z0-9_,\|\-]/', ',', $line);
|
||||
$line = str_replace('|', ',|,', $line);
|
||||
$line = preg_replace('/,,+/', ',', $line);
|
||||
$line = trim($line, ',|');
|
||||
if ($line === '') {
|
||||
continue;
|
||||
}
|
||||
if ($i == 10) {
|
||||
// Maximum is ten lines, merge the rest to the last line.
|
||||
$result[9] = $result[9].','.$line;
|
||||
} else {
|
||||
$result[] = $line;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a named plugin object. Will cause fatal error if plugin doesn't
|
||||
* exist. This is intended for use by plugin files themselves.
|
||||
*
|
||||
* @param string $plugin Name of plugin e.g. 'moodleemoticon'
|
||||
* @return editor_tinymce_plugin Plugin object
|
||||
*/
|
||||
public function get_plugin($plugin) {
|
||||
global $CFG;
|
||||
return editor_tinymce_plugin::get($plugin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to tinyMCE.baseURL value available from JavaScript,
|
||||
* always use instead of /../ when referencing tinymce core code from moodle plugins!
|
||||
*
|
||||
* @return moodle_url url pointing to the root of TinyMCE javascript code.
|
||||
*/
|
||||
public function get_tinymce_base_url() {
|
||||
global $CFG;
|
||||
return new moodle_url("/lib/editor/tinymce/tiny_mce/$this->version/");
|
||||
}
|
||||
|
||||
}
|
@ -1,167 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE helper javascript functions.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2010 Petr Skoda (http://skodak.org)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
M.editor_tinymce = M.editor_tinymce || {};
|
||||
|
||||
M.editor_tinymce.editor_options = M.editor_tinymce.options || {};
|
||||
M.editor_tinymce.filepicker_options = M.editor_tinymce.filepicker_options || {};
|
||||
M.editor_tinymce.initialised = false;
|
||||
|
||||
M.editor_tinymce.init_editor = function(Y, editorid, options) {
|
||||
|
||||
if (!M.editor_tinymce.initialised) {
|
||||
// Load all language strings for all plugins - we do not use standard TinyMCE lang pack loading!
|
||||
tinymce.ScriptLoader.add(M.cfg.wwwroot + '/lib/editor/tinymce/all_strings.php?elanguage=' + options.language + '&rev=' + options.langrev);
|
||||
|
||||
// Monkey patch for MDL-35284 - this hack ignores empty toolbars.
|
||||
tinymce.ui.Toolbar.prototype.oldRenderHTML = tinymce.ui.Toolbar.prototype.renderHTML;
|
||||
tinymce.ui.Toolbar.prototype.renderHTML = function() {
|
||||
if (this.controls.length == 0) {
|
||||
return;
|
||||
}
|
||||
return tinymce.ui.Toolbar.prototype.oldRenderHTML.call(this);
|
||||
};
|
||||
|
||||
M.editor_tinymce.initialised = true;
|
||||
M.util.js_pending('editors');
|
||||
options.oninit = "M.editor_tinymce.init_callback";
|
||||
}
|
||||
|
||||
M.editor_tinymce.editor_options[editorid] = options;
|
||||
|
||||
// Load necessary Moodle plugins into editor.
|
||||
if (options.moodle_init_plugins) {
|
||||
var extraplugins = options.moodle_init_plugins.split(',');
|
||||
for (var i=0; i<extraplugins.length; i++) {
|
||||
var filedetails = extraplugins[i].split(':');
|
||||
tinyMCE.PluginManager.load(filedetails[0],
|
||||
M.cfg.wwwroot + '/lib/editor/tinymce/plugins/' + filedetails[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Retain any setup which is already defined.
|
||||
options.originalSetupFunction = options.setup || function(){};
|
||||
options.setup = function(editor) {
|
||||
options.originalSetupFunction();
|
||||
editor.onChange.add(function(ed) {
|
||||
ed.save();
|
||||
});
|
||||
Y.use('event', 'moodle-core-event', function(Y) {
|
||||
var form = Y.one(document.getElementById(editor.id)).ancestor('form');
|
||||
if (form) {
|
||||
form.on(M.core.event.FORM_SUBMIT_AJAX, function() {
|
||||
editor.save();
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
tinyMCE.baseURL = M.cfg.wwwroot + '/lib/editor/tinymce/tiny_mce/3.5.11';
|
||||
tinyMCE.baseURI = new tinymce.util.URI(tinyMCE.baseURL);
|
||||
tinyMCE.init(options);
|
||||
|
||||
var item = document.getElementById(editorid+'_filemanager');
|
||||
if (item) {
|
||||
item.parentNode.removeChild(item);
|
||||
}
|
||||
|
||||
document.getElementById(editorid).addEventListener('form:editorUpdated', function() {
|
||||
M.editor_tinymce.updateEditorState(editorid);
|
||||
});
|
||||
};
|
||||
|
||||
M.editor_tinymce.init_callback = function() {
|
||||
M.util.js_complete('editors');
|
||||
}
|
||||
|
||||
M.editor_tinymce.init_filepicker = function(Y, editorid, options) {
|
||||
M.editor_tinymce.filepicker_options[editorid] = options;
|
||||
};
|
||||
|
||||
M.editor_tinymce.toggle = function(id) {
|
||||
tinyMCE.execCommand('mceToggleEditor', false, id);
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the state of the editor.
|
||||
* @param {String} id
|
||||
*/
|
||||
M.editor_tinymce.updateEditorState = function(id) {
|
||||
var instance = window.tinyMCE.get(id),
|
||||
content = instance.getBody(),
|
||||
controls = instance.controlManager.controls,
|
||||
disabled = instance.getElement().readOnly;
|
||||
// Enable/Disable all plugins.
|
||||
for (var key in controls) {
|
||||
if (controls.hasOwnProperty(key)) {
|
||||
controls[key].setDisabled(disabled);
|
||||
}
|
||||
}
|
||||
// Enable/Disable body content.
|
||||
content.setAttribute('contenteditable', !disabled);
|
||||
};
|
||||
|
||||
M.editor_tinymce.filepicker_callback = function(args) {
|
||||
};
|
||||
|
||||
M.editor_tinymce.filepicker = function(target_id, url, type, win) {
|
||||
YUI().use('core_filepicker', function (Y) {
|
||||
var editor_id = tinyMCE.selectedInstance.editorId;
|
||||
if (editor_id == 'mce_fullscreen') {
|
||||
editor_id = tinyMCE.selectedInstance.settings.elements;
|
||||
}
|
||||
var options = null;
|
||||
if (type == 'media') {
|
||||
// When media button clicked.
|
||||
options = M.editor_tinymce.filepicker_options[editor_id]['media'];
|
||||
} else if (type == 'file') {
|
||||
// When link button clicked.
|
||||
options = M.editor_tinymce.filepicker_options[editor_id]['link'];
|
||||
} else if (type == 'image') {
|
||||
// When image button clicked.
|
||||
options = M.editor_tinymce.filepicker_options[editor_id]['image'];
|
||||
}
|
||||
|
||||
options.formcallback = M.editor_tinymce.filepicker_callback;
|
||||
options.editor_target = win.document.getElementById(target_id);
|
||||
|
||||
M.core_filepicker.show(Y, options);
|
||||
});
|
||||
};
|
||||
|
||||
M.editor_tinymce.onblur_event = function(ed) {
|
||||
// Attach event only after tinymce is initialized.
|
||||
if (ed.onInit != undefined) {
|
||||
var s = ed.settings;
|
||||
// Save before event is attached, so that if this event is not generated then textarea should
|
||||
// have loaded contents and submitting form should not throw error.
|
||||
ed.save();
|
||||
|
||||
// Attach blur event for tinymce to save contents to textarea.
|
||||
var doc = s.content_editable ? ed.getBody() : (tinymce.isGecko ? ed.getDoc() : ed.getWin());
|
||||
tinymce.dom.Event.add(doc, 'blur', function() {
|
||||
// Save contents to textarea before calling validation script.
|
||||
ed.save();
|
||||
});
|
||||
};
|
||||
};
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for tinymce_ctrlhelp.
|
||||
*
|
||||
* @package tinymce_ctrlhelp
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tinymce_ctrlhelp\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for tinymce_ctrlhelp implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for CTRL+Right click helper.
|
||||
*
|
||||
* @package tinymce_ctrlhelp
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'CTRL+right click helper';
|
||||
|
||||
/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
|
||||
$string['ctrlhelp:desc'] = 'CTRL + right click for more options';
|
||||
$string['privacy:metadata'] = 'The Ctrl+right TinyMCE plugin does not store any personal data.';
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* CTRL + right click helper
|
||||
*
|
||||
* @package tinymce_ctrlhelp
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tinymce_ctrlhelp extends editor_tinymce_plugin {
|
||||
protected function update_init_params(array &$params, context $context, array $options = null) {
|
||||
$this->add_js_plugin($params);
|
||||
}
|
||||
|
||||
protected function get_sort_order() {
|
||||
// We want this plugin to register as the last one in the context menu.
|
||||
return 66666;
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.CtrlHelpPlugin', {
|
||||
|
||||
init : function(ed, url) {
|
||||
ed.onContextMenu.add(function(ed, e) {
|
||||
var m = ed.plugins.contextmenu._menu;
|
||||
m.add({title : 'ctrlhelp.desc', icon : '', cmd : ''});
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Moodle CTRL + right click helper plugin',
|
||||
author : 'Petr Skoda',
|
||||
authorurl : 'http://skodak.org/',
|
||||
infourl : 'http://moodle.org',
|
||||
version : '1.0'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('ctrlhelp', tinymce.plugins.CtrlHelpPlugin);
|
||||
})();
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* CTRL + right click helper.
|
||||
*
|
||||
* @package tinymce_ctrlhelp
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2022112800;
|
||||
$plugin->requires = 2022111800;
|
||||
$plugin->component = 'tinymce_ctrlhelp';
|
@ -1,98 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Loader for resource files within TinyMCE plugins.
|
||||
*
|
||||
* This loader handles requests which have the plugin version number in. These
|
||||
* requests are set to never expire from cache, to improve performance. Only
|
||||
* files within the 'tinymce' folder of the plugin will be served.
|
||||
*
|
||||
* Note there are no access checks in this script - you do not have to be
|
||||
* logged in to retrieve the plugin resource files.
|
||||
*
|
||||
* @package editor_tinymce
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('NO_MOODLE_COOKIES', true);
|
||||
require_once('../../../../config.php');
|
||||
require_once($CFG->dirroot . '/lib/filelib.php');
|
||||
require_once($CFG->dirroot . '/lib/jslib.php');
|
||||
|
||||
// Safely get slash params (cleaned using PARAM_PATH, without /../).
|
||||
$path = get_file_argument();
|
||||
|
||||
// Param must be of the form [plugin]/[version]/[path] where path is a relative
|
||||
// path inside the plugin tinymce folder.
|
||||
$matches = array();
|
||||
if (!preg_match('~^/([a-z0-9_]+)/((?:[0-9.]+)|-1)(/.*)$~', $path, $matches)) {
|
||||
throw new \moodle_exception('filenotfound');
|
||||
}
|
||||
list($junk, $tinymceplugin, $version, $innerpath) = $matches;
|
||||
|
||||
// Note that version number is totally ignored, user can specify anything,
|
||||
// except for the difference between '-1' and anything else.
|
||||
|
||||
// Check the file exists.
|
||||
$pluginfolder = $CFG->dirroot . '/lib/editor/tinymce/plugins/' . $tinymceplugin;
|
||||
$file = $pluginfolder . '/tinymce' .$innerpath;
|
||||
if (!file_exists($file)) {
|
||||
throw new \moodle_exception('filenotfound');
|
||||
}
|
||||
|
||||
// We don't actually care what the version number is but there is a special
|
||||
// case for '-1' which means, set the files to not be cached.
|
||||
$allowcache = ($version !== '-1');
|
||||
if ($allowcache) {
|
||||
// Set it to expire a year later. Note that this means we should never get
|
||||
// If-Modified-Since requests so there is no need to handle them specially.
|
||||
header('Expires: ' . date('r', time() + 365 * 24 * 3600));
|
||||
header('Cache-Control: max-age=' . 365 * 24 * 3600 . ', immutable');
|
||||
// Pragma is set to no-cache by default so must be overridden.
|
||||
header('Pragma:');
|
||||
}
|
||||
|
||||
// Get the right MIME type.
|
||||
$mimetype = mimeinfo('type', $file);
|
||||
|
||||
// For JS files, these can be minified and stored in cache.
|
||||
if ($mimetype === 'application/x-javascript' && $allowcache) {
|
||||
// The cached file is stored without version number etc. This is okay
|
||||
// because $CFG->cachedir is cleared each time there is a plugin update,
|
||||
// such as a new version of a tinymce plugin.
|
||||
|
||||
// Flatten filename and include cache location.
|
||||
$cache = $CFG->cachedir . '/editor_tinymce/pluginjs';
|
||||
$cachefile = $cache . '/' . $tinymceplugin .
|
||||
str_replace('/', '_', $innerpath);
|
||||
|
||||
// If it doesn't exist, minify it and save to that location.
|
||||
if (!file_exists($cachefile)) {
|
||||
$content = core_minify::js_files(array($file));
|
||||
js_write_cache_file_content($cachefile, $content);
|
||||
}
|
||||
|
||||
$file = $cachefile;
|
||||
} else if ($mimetype === 'text/html') {
|
||||
header('X-UA-Compatible: IE=edge');
|
||||
}
|
||||
|
||||
// Serve file.
|
||||
header('Content-Length: ' . filesize($file));
|
||||
header('Content-Type: ' . $mimetype);
|
||||
readfile($file);
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for tinymce_managefiles.
|
||||
*
|
||||
* @package tinymce_managefiles
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tinymce_managefiles\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for tinymce_managefiles implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE manage files plugin language file
|
||||
*
|
||||
* @package tinymce_managefiles
|
||||
* @copyright 2013 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Manage embedded files';
|
||||
$string['manageareafiles'] = 'Manage files embedded in text editor';
|
||||
$string['managefiles:desc'] = 'Manage embedded files';
|
||||
$string['allfilesok'] = 'There are no missing or unused files';
|
||||
$string['hasmissingfiles'] = 'Warning! The following files that are referenced in the text area appear to be missing:';
|
||||
$string['refreshfiles'] = 'Refresh the lists of missing and unused files';
|
||||
$string['unusedfilesheader'] = 'Unused files';
|
||||
$string['unusedfilesdesc'] = 'The following embedded files are not used in the text area:';
|
||||
$string['deleteselected'] = 'Delete selected files';
|
||||
$string['privacy:metadata'] = 'The Manage embedded files TinyMCE plugin does not store any personal data.';
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin for managing files embedded in the text editor
|
||||
*
|
||||
* @package tinymce_managefiles
|
||||
* @copyright 2013 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tinymce_managefiles extends editor_tinymce_plugin {
|
||||
/** @var array list of buttons defined by this plugin */
|
||||
protected $buttons = array('managefiles');
|
||||
|
||||
/**
|
||||
* Adjusts TinyMCE init parameters for tinymce_managefiles
|
||||
*
|
||||
* Adds file area restrictions parameters and actual 'managefiles' button
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param context $context Context where editor is being shown
|
||||
* @param array $options Options for this editor
|
||||
*/
|
||||
protected function update_init_params(array &$params, context $context,
|
||||
array $options = null) {
|
||||
global $USER;
|
||||
|
||||
if (!isloggedin() or isguestuser()) {
|
||||
// Must be a real user to manage any files.
|
||||
return;
|
||||
}
|
||||
if (!isset($options['maxfiles']) or $options['maxfiles'] == 0) {
|
||||
// No files allowed - easy, do not load anything.
|
||||
return;
|
||||
}
|
||||
|
||||
// Add parameters for filemanager
|
||||
$params['managefiles'] = array('usercontext' => context_user::instance($USER->id)->id);
|
||||
foreach (array('itemid', 'context', 'areamaxbytes', 'maxbytes', 'subdirs', 'return_types') as $key) {
|
||||
if (isset($options[$key])) {
|
||||
if ($key === 'context' && is_object($options[$key])) {
|
||||
// Just context id is enough
|
||||
$params['managefiles'][$key] = $options[$key]->id;
|
||||
} else {
|
||||
$params['managefiles'][$key] = $options[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($row = $this->find_button($params, 'moodlemedia')) {
|
||||
// Add button after 'moodlemedia' button.
|
||||
$this->add_button_after($params, $row, 'managefiles', 'moodlemedia');
|
||||
} else if ($row = $this->find_button($params, 'image')) {
|
||||
// If 'moodlemedia' is not found add after 'image'.
|
||||
$this->add_button_after($params, $row, 'managefiles', 'image');
|
||||
} else {
|
||||
// OTherwise add button in the end of the last row.
|
||||
$this->add_button_after($params, $this->count_button_rows($params), 'managefiles');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
}
|
||||
|
||||
protected function get_sort_order() {
|
||||
return 310;
|
||||
}
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Manage files in user draft area attached to texteditor
|
||||
*
|
||||
* @package tinymce_managefiles
|
||||
* @copyright 2013 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require('../../../../../config.php');
|
||||
require_once('manage_form.php');
|
||||
require_once($CFG->libdir.'/filestorage/file_storage.php');
|
||||
|
||||
$itemid = required_param('itemid', PARAM_INT);
|
||||
$maxbytes = optional_param('maxbytes', 0, PARAM_INT);
|
||||
$subdirs = optional_param('subdirs', 0, PARAM_INT);
|
||||
$accepted_types = optional_param('accepted_types', '*', PARAM_RAW); // TODO not yet passed to this script
|
||||
$return_types = optional_param('return_types', null, PARAM_INT);
|
||||
$areamaxbytes = optional_param('areamaxbytes', FILE_AREA_MAX_BYTES_UNLIMITED, PARAM_INT);
|
||||
$contextid = optional_param('context', SYSCONTEXTID, PARAM_INT);
|
||||
|
||||
$context = context::instance_by_id($contextid);
|
||||
if ($context->contextlevel == CONTEXT_MODULE) {
|
||||
// Module context.
|
||||
$cm = $DB->get_record('course_modules', array('id' => $context->instanceid));
|
||||
require_login($cm->course, true, $cm);
|
||||
} else if (($coursecontext = $context->get_course_context(false)) && $coursecontext->id != SITEID) {
|
||||
// Course context or block inside the course.
|
||||
require_login($coursecontext->instanceid);
|
||||
$PAGE->set_context($context);
|
||||
} else {
|
||||
// Block that is not inside the course, user or system context.
|
||||
require_login();
|
||||
$PAGE->set_context($context);
|
||||
}
|
||||
if (isguestuser()) {
|
||||
// Guests can never manage files.
|
||||
throw new \moodle_exception('noguest');
|
||||
}
|
||||
|
||||
$title = get_string('manageareafiles', 'tinymce_managefiles');
|
||||
|
||||
$PAGE->set_url('/lib/editor/tinymce/plugins/managefiles/manage.php');
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($title);
|
||||
$PAGE->set_pagelayout('popup');
|
||||
|
||||
if ($return_types !== null) {
|
||||
$return_types = $return_types ^ 1; // links are allowed in textarea but never allowed in filemanager
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'subdirs' => $subdirs,
|
||||
'maxbytes' => $maxbytes,
|
||||
'maxfiles' => -1,
|
||||
'accepted_types' => $accepted_types,
|
||||
'areamaxbytes' => $areamaxbytes,
|
||||
'return_types' => $return_types,
|
||||
'context' => $context
|
||||
);
|
||||
|
||||
$usercontext = context_user::instance($USER->id);
|
||||
$fs = get_file_storage();
|
||||
$files = $fs->get_directory_files($usercontext->id, 'user', 'draft', $itemid, '/', !empty($subdirs), false);
|
||||
$filenames = array();
|
||||
foreach ($files as $file) {
|
||||
$filenames[] = ltrim($file->get_filepath(), '/'). $file->get_filename();
|
||||
}
|
||||
|
||||
$mform = new tinymce_managefiles_manage_form(null,
|
||||
array('options' => $options, 'draftitemid' => $itemid, 'files' => $filenames),
|
||||
'post', '', array('id' => 'tinymce_managefiles_manageform'));
|
||||
|
||||
if ($data = $mform->get_data()) {
|
||||
if (!empty($data->deletefile)) {
|
||||
foreach (array_keys($data->deletefile) as $filename) {
|
||||
$filepath = '/';
|
||||
if (!empty($subdirs) && strlen(dirname($filename)) ) {
|
||||
$filepath = '/'. dirname($filename). '/';
|
||||
}
|
||||
if ($file = $fs->get_file($usercontext->id, 'user', 'draft', $itemid,
|
||||
$filepath, basename($filename))) {
|
||||
$file->delete();
|
||||
}
|
||||
}
|
||||
$filenames = array_diff($filenames, array_keys($data->deletefile));
|
||||
$mform = new tinymce_managefiles_manage_form(null,
|
||||
array('options' => $options, 'draftitemid' => $itemid, 'files' => $filenames),
|
||||
'post', '', array('id' => 'tinymce_managefiles_manageform'));
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$mform->display();
|
||||
echo $OUTPUT->footer();
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Class tinymce_managefiles_manage_form
|
||||
*
|
||||
* @package tinymce_managefiles
|
||||
* @copyright 2013 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir."/formslib.php");
|
||||
|
||||
/**
|
||||
* Form allowing to edit files in one draft area
|
||||
*
|
||||
* No buttons are necessary since the draft area files are saved immediately using AJAX
|
||||
*
|
||||
* @package tinymce_managefiles
|
||||
* @copyright 2013 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tinymce_managefiles_manage_form extends moodleform {
|
||||
function definition() {
|
||||
global $PAGE;
|
||||
$mform = $this->_form;
|
||||
|
||||
$itemid = $this->_customdata['draftitemid'];
|
||||
$options = $this->_customdata['options'];
|
||||
$files = $this->_customdata['files'];
|
||||
|
||||
$mform->addElement('hidden', 'itemid');
|
||||
$mform->setType('itemid', PARAM_INT);
|
||||
$mform->addElement('hidden', 'maxbytes');
|
||||
$mform->setType('maxbytes', PARAM_INT);
|
||||
$mform->addElement('hidden', 'subdirs');
|
||||
$mform->setType('subdirs', PARAM_INT);
|
||||
$mform->addElement('hidden', 'accepted_types');
|
||||
$mform->setType('accepted_types', PARAM_RAW);
|
||||
$mform->addElement('hidden', 'return_types');
|
||||
$mform->setType('return_types', PARAM_INT);
|
||||
$mform->addElement('hidden', 'context');
|
||||
$mform->setType('context', PARAM_INT);
|
||||
$mform->addElement('hidden', 'areamaxbytes');
|
||||
$mform->setType('areamaxbytes', PARAM_INT);
|
||||
|
||||
$mform->addElement('filemanager', 'files_filemanager', '', null, $options);
|
||||
|
||||
$mform->addElement('submit', 'refresh', get_string('refreshfiles', 'tinymce_managefiles'));
|
||||
$mform->registerNoSubmitButton('refresh');
|
||||
|
||||
$mform->addElement('static', '', '',
|
||||
html_writer::tag('div', '', array('class' => 'managefilesstatus')));
|
||||
|
||||
$mform->addElement('header', 'deletefiles', get_string('unusedfilesheader', 'tinymce_managefiles'));
|
||||
$mform->addElement('static', '', '',
|
||||
html_writer::tag('span', get_string('unusedfilesdesc', 'tinymce_managefiles'), array('class' => 'managefilesunuseddesc')));
|
||||
foreach ($files as $file) {
|
||||
$mform->addElement('checkbox', 'deletefile['.$file.']', '', $file);
|
||||
$mform->setType('deletefile['.$file.']', PARAM_INT);
|
||||
}
|
||||
$mform->addElement('submit', 'delete', get_string('deleteselected', 'tinymce_managefiles'));
|
||||
|
||||
$PAGE->requires->js_init_call('M.tinymce_managefiles.analysefiles', array(), true);
|
||||
$PAGE->requires->strings_for_js(array('allfilesok', 'hasmissingfiles'), 'tinymce_managefiles');
|
||||
|
||||
$this->set_data(array('files_filemanager' => $itemid,
|
||||
'itemid' => $itemid,
|
||||
'subdirs' => $options['subdirs'],
|
||||
'maxbytes' => $options['maxbytes'],
|
||||
'areamaxbytes' => $options['areamaxbytes'],
|
||||
'accepted_types' => $options['accepted_types'],
|
||||
'return_types' => $options['return_types'],
|
||||
'context' => $options['context']->id,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
M.tinymce_managefiles = M.tinymce_managefiles || {}
|
||||
M.tinymce_managefiles.analysefiles = function(Y) {
|
||||
var form = Y.one('#tinymce_managefiles_manageform'),
|
||||
usedfiles, missingfiles = '', i;
|
||||
if (!form || !window.parent || !window.parent.tinyMCE.activeEditor) {
|
||||
return;
|
||||
}
|
||||
usedfiles = window.parent.tinyMCE.activeEditor.execCommand('mceManageFilesUsedFiles')
|
||||
var delfilesfieldset = form.one('#deletefiles,#id_deletefiles')
|
||||
for (i in usedfiles) {
|
||||
if (!delfilesfieldset.one('.felement.fcheckbox input[name="deletefile[' + usedfiles[i] + ']"]')) {
|
||||
missingfiles += '<li>' + usedfiles[i] + '</li>';
|
||||
}
|
||||
}
|
||||
if (missingfiles !== '') {
|
||||
form.addClass('hasmissingfiles')
|
||||
form.one('.managefilesstatus').setContent(M.util.get_string('hasmissingfiles', 'tinymce_managefiles') + ' <ul>' + missingfiles + '</ul>').addClass('error');
|
||||
}
|
||||
delfilesfieldset.all('.felement.fcheckbox').each(function(el) {
|
||||
var chb = el.one('input[type=checkbox]'),
|
||||
match = /^deletefile\[(.*)\]$/.exec(chb.get('name'));
|
||||
if (match && usedfiles.indexOf(match[1]) === -1) {
|
||||
el.addClass('isunused')
|
||||
form.addClass('hasunusedfiles')
|
||||
}
|
||||
});
|
||||
if (missingfiles === '' && !form.hasClass('hasunusedfiles')) {
|
||||
form.one('.managefilesstatus').setContent(M.util.get_string('allfilesok', 'tinymce_managefiles'));
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 136 B |
@ -1,23 +0,0 @@
|
||||
#tinymce_managefiles_manageform.hasunusedfiles .managefilesstatus {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#tinymce_managefiles_manageform.hasmissingfiles .managefilesstatus {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#tinymce_managefiles_manageform #id_deletefiles {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#tinymce_managefiles_manageform.hasunusedfiles #id_deletefiles {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#tinymce_managefiles_manageform #id_deletefiles .felement.fcheckbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#tinymce_managefiles_manageform #id_deletefiles .felement.fcheckbox.isunused {
|
||||
display: block;
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
/**
|
||||
* TinyMCE plugin ManageFiles - provides UI to edit files embedded in the text editor.
|
||||
*
|
||||
* @author Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.MoodleManageFiles', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
ed.addCommand('mceForceRepaint', function() {
|
||||
var root = ed.dom.getRoot();
|
||||
items = root.getElementsByTagName("img");
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
src = items[i].getAttribute('src').replace(/\?\d+$/, '');
|
||||
items[i].setAttribute('src', src+'?'+(new Date().getTime()))
|
||||
}
|
||||
ed.execCommand('mceRepaint');
|
||||
ed.focus();
|
||||
});
|
||||
|
||||
ed.addCommand('mceMaximizeWindow', function(w) {
|
||||
// This function duplicates the TinyMCE windowManager code when 'maximize' button is pressed.
|
||||
var vp = ed.dom.getViewPort(),
|
||||
id = w.id;
|
||||
// Reduce viewport size to avoid scrollbars
|
||||
vp.w -= 2;
|
||||
vp.h -= 2;
|
||||
|
||||
w.oldPos = w.element.getXY();
|
||||
w.oldSize = w.element.getSize();
|
||||
|
||||
w.element.moveTo(vp.x, vp.y);
|
||||
w.element.resizeTo(vp.w, vp.h);
|
||||
ed.dom.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});
|
||||
ed.dom.addClass(id + '_wrapper', 'mceMaximized');
|
||||
});
|
||||
|
||||
ed.addCommand('mceManageFiles', function() {
|
||||
var managefiles = ed.getParam('managefiles', {}), key, cnt = 0,
|
||||
fileurl = ed.getParam("moodle_plugin_base") + 'managefiles/manage.php?';
|
||||
for (key in managefiles) {
|
||||
fileurl += (cnt++ ? '&' : '') + encodeURIComponent(key) + "=" + encodeURIComponent(managefiles[key]) + "&";
|
||||
}
|
||||
var onClose = function() {
|
||||
ed.windowManager.onClose.remove(onClose);
|
||||
ed.execCommand('mceForceRepaint');
|
||||
};
|
||||
ed.windowManager.onClose.add(onClose);
|
||||
var vp = ed.dom.getViewPort(),
|
||||
width = 900 + parseInt(ed.getLang('advimage.delta_width', 0)),
|
||||
height = 600 + parseInt(ed.getLang('advimage.delta_height', 0)),
|
||||
maximizedmode = (width >= vp.w - 2 || height >= vp.h - 2);
|
||||
if (maximizedmode) {
|
||||
width = vp.w;
|
||||
height = vp.h;
|
||||
}
|
||||
w = ed.windowManager.open({
|
||||
file : fileurl ,
|
||||
width : width,
|
||||
height : height,
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url // Plugin absolute URL
|
||||
});
|
||||
if (maximizedmode) {
|
||||
ed.execCommand('mceMaximizeWindow', w);
|
||||
}
|
||||
});
|
||||
|
||||
ed.addCommand('mceManageFilesUsedFiles', function() {
|
||||
var managefiles = ed.getParam('managefiles', {}),
|
||||
text = ed.dom.getRoot().innerHTML,
|
||||
base = ed.getParam('document_base_url') + '/draftfile.php/' + managefiles['usercontext'] + '/user/draft/' + managefiles['itemid'] + '/',
|
||||
patt = new RegExp(base.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
|
||||
arr = [], match, filename;
|
||||
while ((match = patt.exec(text)) !== null) {
|
||||
filename = decodeURI(match[1]);
|
||||
if (arr.indexOf(filename) === -1) {
|
||||
arr[arr.length] = filename;
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
});
|
||||
|
||||
var managefiles = ed.getParam('managefiles', {});
|
||||
// Get draft area id from filepicker options.
|
||||
if (!managefiles.itemid && M.editor_tinymce.filepicker_options
|
||||
&& M.editor_tinymce.filepicker_options[ed.id]
|
||||
&& M.editor_tinymce.filepicker_options[ed.id].image
|
||||
&& M.editor_tinymce.filepicker_options[ed.id].image.itemid) {
|
||||
managefiles.itemid = M.editor_tinymce.filepicker_options[ed.id].image.itemid;
|
||||
ed.settings['managefiles'].itemid = managefiles.itemid;
|
||||
}
|
||||
|
||||
// Register buttons
|
||||
if (managefiles.itemid) {
|
||||
ed.addButton('managefiles', {
|
||||
title : 'managefiles.desc',
|
||||
cmd : 'mceManageFiles',
|
||||
image : url + '/img/managefiles.png'
|
||||
});
|
||||
}
|
||||
},
|
||||
createControl : function(n, cm) {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Moodle Manage embedded files plugin',
|
||||
author : 'Marina Glancy',
|
||||
infourl : 'http://moodle.org',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin.
|
||||
tinymce.PluginManager.add('managefiles', tinymce.plugins.MoodleManageFiles);
|
||||
})();
|
Before Width: | Height: | Size: 295 B |
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE manage files plugin version details.
|
||||
*
|
||||
* @package tinymce_managefiles
|
||||
* @copyright 2013 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2022112800; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2022111800; // Required Moodle version.
|
||||
$plugin->component = 'tinymce_managefiles'; // Full name of the plugin (used for diagnostics).
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for tinymce_moodleemoticon.
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tinymce_moodleemoticon\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for tinymce_moodleemoticon implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Displays the TinyMCE popup window to insert a Moodle emoticon
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2010 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('NO_MOODLE_COOKIES', true); // Session not used here.
|
||||
|
||||
require(__DIR__ . '/../../../../../config.php');
|
||||
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_url('/lib/editor/tinymce/plugins/moodleemoticon/dialog.php');
|
||||
|
||||
$emoticonmanager = get_emoticon_manager();
|
||||
$stringmanager = get_string_manager();
|
||||
|
||||
$editor = get_texteditor('tinymce');
|
||||
$plugin = $editor->get_plugin('moodleemoticon');
|
||||
|
||||
$htmllang = get_html_lang();
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
header('X-UA-Compatible: IE=edge');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html <?php echo $htmllang ?>
|
||||
<head>
|
||||
<title><?php print_string('moodleemoticon:desc', 'tinymce_moodleemoticon'); ?></title>
|
||||
<script type="text/javascript" src="<?php echo $editor->get_tinymce_base_url(); ?>/tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $plugin->get_tinymce_file_url('js/dialog.js'); ?>"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table border="0" align="center" style="width:100%;">
|
||||
<?php
|
||||
|
||||
$emoticons = $emoticonmanager->get_emoticons(true);
|
||||
// This is tricky - we must somehow include the information about the original
|
||||
// emoticon text so that we can replace the image back with it on editor save.
|
||||
// so we are going to encode the index of the emoticon. this will break when the
|
||||
// admin changes the mapping table while the user has the editor opened
|
||||
// but I am not able to come with better solution at the moment :-/
|
||||
$index = 0;
|
||||
foreach ($emoticons as $emoticon) {
|
||||
$txt = $emoticon->text;
|
||||
$img = $OUTPUT->render(
|
||||
$emoticonmanager->prepare_renderable_emoticon($emoticon, array('class' => 'emoticon emoticon-index-'.$index)));
|
||||
if ($stringmanager->string_exists($emoticon->altidentifier, $emoticon->altcomponent)) {
|
||||
$alt = get_string($emoticon->altidentifier, $emoticon->altcomponent);
|
||||
} else {
|
||||
$alt = '';
|
||||
}
|
||||
echo html_writer::tag('tr',
|
||||
html_writer::tag('td', $img, array('style' => 'width:20%;text-align:center;')) .
|
||||
html_writer::tag('td', s($txt), array('style' => 'width:40%;text-align:center;font-family:monospace;')) .
|
||||
html_writer::tag('td', $alt),
|
||||
array(
|
||||
'class' => 'emoticoninfo emoticoninfo-index-'.$index,
|
||||
)
|
||||
);
|
||||
$index++;
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for Moodle emoticon plugin.
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Insert emoticon';
|
||||
$string['requireemoticon'] = 'Require emoticon filter';
|
||||
$string['requireemoticon_desc'] = 'If enabled the emoticon button is visible only when the emoticon filter is enabled in the editor context.';
|
||||
|
||||
/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
|
||||
$string['moodleemoticon:desc'] = 'Insert emoticon';
|
||||
$string['privacy:metadata'] = 'The Moodle Emoticon TinyMCE plugin does not store any personal data.';
|
@ -1,65 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin for Moodle emoticons.
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tinymce_moodleemoticon extends editor_tinymce_plugin {
|
||||
/** @var array list of buttons defined by this plugin */
|
||||
protected $buttons = array('moodleemoticon');
|
||||
|
||||
protected function update_init_params(array &$params, context $context,
|
||||
array $options = null) {
|
||||
global $OUTPUT;
|
||||
|
||||
if ($this->get_config('requireemoticon', 1)) {
|
||||
// If emoticon filter is disabled, do not add button.
|
||||
$filters = filter_get_active_in_context($context);
|
||||
if (!array_key_exists('emoticon', $filters)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($row = $this->find_button($params, 'image')) {
|
||||
// Add button after 'image'.
|
||||
$this->add_button_after($params, $row, 'moodleemoticon', 'image');
|
||||
} else {
|
||||
// If 'image' is not found, add button in the end of the last row.
|
||||
$this->add_button_after($params, $this->count_button_rows($params), 'moodleemoticon');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
|
||||
// Extra params specifically for emoticon plugin.
|
||||
$manager = get_emoticon_manager();
|
||||
$emoticons = $manager->get_emoticons(true);
|
||||
$imgs = array();
|
||||
// See the TinyMCE plugin moodleemoticon for how the emoticon index is (ab)used.
|
||||
$index = 0;
|
||||
foreach ($emoticons as $emoticon) {
|
||||
$imgs[$emoticon->text] = $OUTPUT->render($manager->prepare_renderable_emoticon(
|
||||
$emoticon, array('class' => 'emoticon emoticon-index-'.$index++)));
|
||||
}
|
||||
$params['moodleemoticon_emoticons'] = json_encode($imgs);
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.0 KiB |
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Emoticon integration settings.
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_configcheckbox('tinymce_moodleemoticon/requireemoticon',
|
||||
get_string('requireemoticon', 'tinymce_moodleemoticon'), get_string('requireemoticon_desc', 'tinymce_moodleemoticon'), 1));
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
/**
|
||||
* TinyMCE plugin MoodleEmoticon - provides GUI to insert emoticon images.
|
||||
*
|
||||
* Based on the example plugin (c) 2009 Moxiecode Systems AB.
|
||||
*
|
||||
* @author David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.MoodleEmoticon', {
|
||||
|
||||
/**
|
||||
* Holds the list of emoticons provided by emoticon_manager.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
_emoticons : {},
|
||||
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceMoodleEmoticon');
|
||||
ed.addCommand('mceMoodleEmoticon', function() {
|
||||
lang = ed.getParam('language');
|
||||
ed.windowManager.open({
|
||||
file : ed.getParam("moodle_plugin_base") + 'moodleemoticon/dialog.php?lang=' + lang ,
|
||||
width : 250 + parseInt(ed.getLang('moodleemoticon.delta_width', 0)),
|
||||
height : 400 + parseInt(ed.getLang('moodleemoticon.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url // Plugin absolute URL
|
||||
});
|
||||
});
|
||||
|
||||
// Add an observer to the onInit event to convert emoticon texts to images.
|
||||
ed.onInit.add(function(ed) {
|
||||
var data = ed.getContent();
|
||||
this._emoticons = tinymce.util.JSON.parse(ed.getParam('moodleemoticon_emoticons'));
|
||||
for (var emotxt in this._emoticons) {
|
||||
// escape the metacharacters so we can use it as regexp
|
||||
search = emotxt.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
// convert to regexp
|
||||
search = new RegExp(search, 'g');
|
||||
// and replace all occurrences of it with the image
|
||||
data = data.replace(search, this._emoticons[emotxt]);
|
||||
}
|
||||
ed.setContent(data);
|
||||
});
|
||||
|
||||
// Add an observer to the onPreProcess event to convert emoticon images to texts.
|
||||
ed.onPreProcess.add(function(ed, o) {
|
||||
if (o.save) {
|
||||
tinymce.each(ed.dom.select('img.emoticon', o.node), function(image) {
|
||||
var emoticontxt = '';
|
||||
if (image.classList.contains('emoticon')) {
|
||||
var matches = /emoticon-index-([0-9]+)/.exec(image.className);
|
||||
if (!matches) {
|
||||
// this is not valid emoticon image inserted via dialog
|
||||
// return true so that each() does not halt
|
||||
return true;
|
||||
}
|
||||
var index = matches[1];
|
||||
var search = new RegExp('emoticon-index-'.concat(index, '"'));
|
||||
for (var emotxt in this._emoticons) {
|
||||
if (search.test(this._emoticons[emotxt])) {
|
||||
emoticontxt = emotxt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (emoticontxt) {
|
||||
ed.dom.setOuterHTML(image, emoticontxt);
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
});
|
||||
|
||||
// Register moodleemoticon button.
|
||||
ed.addButton('moodleemoticon', {
|
||||
title : 'moodleemoticon.desc',
|
||||
cmd : 'mceMoodleEmoticon',
|
||||
image : url + '/img/moodleemoticon.png'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates control instances based in the incomming name. This method is normally not
|
||||
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
||||
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
||||
* method can be used to create those.
|
||||
*
|
||||
* @param {String} n Name of the control to create.
|
||||
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
||||
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
||||
*/
|
||||
createControl : function(n, cm) {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Moodle Emoticon plugin',
|
||||
author : 'David Mudrak',
|
||||
authorurl : 'http://mudrak.name',
|
||||
infourl : 'http://moodle.org',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin.
|
||||
tinymce.PluginManager.add('moodleemoticon', tinymce.plugins.MoodleEmoticon);
|
||||
})();
|
Before Width: | Height: | Size: 396 B |
@ -1,54 +0,0 @@
|
||||
var MoodleEmoticonDialog = {
|
||||
|
||||
init : function() {
|
||||
// Register event handlers for the table rows.
|
||||
tinymce.each(tinymce.DOM.select('tr.emoticoninfo', document), function(row) {
|
||||
|
||||
tinymce.dom.Event.add(row, 'mouseover', function(e) {
|
||||
this.style.backgroundColor = 'white';
|
||||
}, row);
|
||||
|
||||
tinymce.dom.Event.add(row, 'mouseout', function(e) {
|
||||
this.style.backgroundColor = 'transparent';
|
||||
}, row);
|
||||
|
||||
tinymce.dom.Event.add(row, 'click', function(e) {
|
||||
var matches = /^emoticoninfo emoticoninfo-index-([0-9]+)$/.exec(this.className);
|
||||
if (matches.length != 2) {
|
||||
// continue with the next row
|
||||
return true;
|
||||
}
|
||||
var index = matches[1];
|
||||
MoodleEmoticonDialog.insert(index);
|
||||
}, row);
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
insert : function(index) {
|
||||
emoticons = tinyMCEPopup.editor._emoticons;
|
||||
i = 0;
|
||||
for (var emoticon in emoticons) {
|
||||
if (i == index) {
|
||||
if (tinymce.isIE) {
|
||||
tinyMCEPopup.restoreSelection();
|
||||
}
|
||||
tinyMCEPopup.editor.execCommand('mceInsertContent', false, emoticons[emoticon]);
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
},
|
||||
|
||||
highlight : function(row) {
|
||||
row.style.backgroundColor="white";
|
||||
},
|
||||
|
||||
unhighlight : function(row) {
|
||||
row.style.backgroundColor="transparent";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(MoodleEmoticonDialog.init, MoodleEmoticonDialog);
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE emoticon plugin version details.
|
||||
*
|
||||
* @package tinymce_moodleemoticon
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2022112800;
|
||||
// Required Moodle version.
|
||||
$plugin->requires = 2022111800;
|
||||
// Full name of the plugin (used for diagnostics).
|
||||
$plugin->component = 'tinymce_moodleemoticon';
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for tinymce_moodleimage.
|
||||
*
|
||||
* @package tinymce_moodleimage
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tinymce_moodleimage\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for tinymce_moodleimage implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for Moodle Media plugin.
|
||||
*
|
||||
* @package tinymce_moodleimage
|
||||
* @copyright 2012 Petr Skoda (http://skodak.org)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Insert image';
|
||||
|
||||
/* This plugin abuses strings from the standard TinyMCE advimage plugin, there is no need to duplicate them here. */
|
||||
$string['moodleimage:browseimage'] = 'Find or upload an image...';
|
||||
$string['privacy:metadata'] = 'The TinyMCE Moodle image plugin does not store any personal data.';
|
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin for inserting and editing of images with Moodle file picker support.
|
||||
*
|
||||
* @package tinymce_moodleimage
|
||||
* @copyright 2012 Petr Skoda (http://skodak.org)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tinymce_moodleimage extends editor_tinymce_plugin {
|
||||
/** @var array list of buttons defined by this plugin */
|
||||
protected $buttons = array('image');
|
||||
|
||||
protected function update_init_params(array &$params, context $context,
|
||||
array $options = null) {
|
||||
|
||||
// Add file picker callback.
|
||||
if (empty($options['legacy'])) {
|
||||
if (isset($options['maxfiles']) and $options['maxfiles'] != 0) {
|
||||
$params['file_browser_callback'] = "M.editor_tinymce.filepicker";
|
||||
}
|
||||
}
|
||||
|
||||
// This plugin overrides standard 'image' button, no need to insert new button.
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
}
|
||||
|
||||
protected function get_sort_order() {
|
||||
return 110;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1,88 +0,0 @@
|
||||
#src_list,
|
||||
#over_list,
|
||||
#out_list {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
.mceActionPanel {
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.moodlebutton {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
padding: 3px 3px 3px 1.5em;
|
||||
border: 1px solid #ccc;
|
||||
text-decoration: none;
|
||||
background: url(search.png) .2em .3em no-repeat;
|
||||
}
|
||||
|
||||
.moodlebutton:hover {
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
.alignPreview {
|
||||
border: 1px solid #000;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
overflow: hidden;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 305px;
|
||||
}
|
||||
|
||||
#prev {
|
||||
margin: 0;
|
||||
border: 1px solid #000;
|
||||
width: 428px;
|
||||
height: 180px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#align,
|
||||
#classlist {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#width,
|
||||
#height {
|
||||
vertical-align: middle;
|
||||
width: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#vspace,
|
||||
#hspace,
|
||||
#border {
|
||||
vertical-align: middle;
|
||||
width: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#class_list {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
#constrain,
|
||||
#onmousemovecheck {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#id,
|
||||
#title,
|
||||
#dir,
|
||||
#lang,
|
||||
#usemap,
|
||||
#longdesc {
|
||||
width: 200px;
|
||||
}
|
Before Width: | Height: | Size: 522 B |
@ -1,50 +0,0 @@
|
||||
/**
|
||||
* Based on editor_plugin_src.js
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.MoodleImagePlugin', {
|
||||
init : function(ed, url) {
|
||||
// Register commands
|
||||
ed.addCommand('mceMoodleImage', function() {
|
||||
// Internal image object like a flash placeholder
|
||||
if (ed.dom.getAttrib(ed.selection.getNode(), 'class', '').indexOf('mceItem') != -1)
|
||||
return;
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/image.htm',
|
||||
width : 480 + parseInt(ed.getLang('advimage.delta_width', 0)),
|
||||
height : 385 + parseInt(ed.getLang('advimage.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('image', {
|
||||
title : 'advimage.image_desc',
|
||||
cmd : 'mceMoodleImage'
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Moodle image',
|
||||
author : 'Moodle.com - based on AdvImage by Moxiecode Systems AB',
|
||||
authorurl : 'http://moodle.org',
|
||||
infourl : 'http://moodle.org',
|
||||
version : '3.6.0' // Version of AdvImage plugin this plugin is based on.
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('moodleimage', tinymce.plugins.MoodleImagePlugin);
|
||||
})();
|
@ -1,260 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>{#advimage_dlg.dialog_title}</title>
|
||||
<script type="text/javascript">
|
||||
// Because there is no relative path to TinyMCE, we have to use JavaScript
|
||||
// to work out correct path from the .js files from TinyMCE. Only files
|
||||
// inside this plugin can be included with relative path (below).
|
||||
var editor_tinymce_include = function(path) {
|
||||
document.write('<script type="text/javascript" src="' +
|
||||
parent.tinyMCE.baseURL + '/' + path + '"></' + 'script>');
|
||||
};
|
||||
editor_tinymce_include('tiny_mce_popup.js');
|
||||
editor_tinymce_include('utils/mctabs.js');
|
||||
editor_tinymce_include('utils/validate.js');
|
||||
editor_tinymce_include('utils/form_utils.js');
|
||||
editor_tinymce_include('utils/editable_selects.js');
|
||||
|
||||
var getImageBrowserHTML = function(id, target_form_element, type, prefix) {
|
||||
var option = prefix + "_" + type + "_browser_callback", cb, html;
|
||||
|
||||
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
|
||||
|
||||
if (!cb)
|
||||
return "";
|
||||
|
||||
html = '<a class="moodlebutton" id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
|
||||
html += '<span id="' + id + '">' + tinyMCEPopup.getLang('moodleimage.browseimage') + '</span>';
|
||||
html += '</a>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="js/image.js"></script>
|
||||
<link href="css/image.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body id="moodleimage" style="display: none" role="application" aria-labelledby="app_title">
|
||||
<span id="app_title" style="display:none">{#advimage_dlg.dialog_title}</span>
|
||||
<form onsubmit="ImageDialog.insert();return false;" action="#">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advimage_dlg.tab_general}</a></span></li>
|
||||
<li id="appearance_tab" aria-controls="appearance_panel"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#advimage_dlg.tab_appearance}</a></span></li>
|
||||
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#advimage_dlg.tab_advanced}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.general}</legend>
|
||||
|
||||
<table role="presentation" class="properties"td>
|
||||
<tr>
|
||||
<td class="column1"> </td>
|
||||
<td align="left" id="srcbrowsercontainer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label id="srclabel" for="src">{#advimage_dlg.src}</label></td>
|
||||
<td><input name="src" type="text" id="src" value="" class="mceFocus" onchange="ImageDialog.showPreviewImage(this.value);" aria-required="true" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="src_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="src_list" name="src_list" onchange="document.getElementById('src').value=this.options[this.selectedIndex].value;document.getElementById('alt').value=this.options[this.selectedIndex].text;document.getElementById('title').value=this.options[this.selectedIndex].text;ImageDialog.showPreviewImage(this.options[this.selectedIndex].value);"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"><label id="altlabel" for="alt">{#advimage_dlg.alt}</label></td>
|
||||
<td><input id="alt" name="alt" type="text" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.preview}</legend>
|
||||
<div id="prev"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="appearance_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.tab_appearance}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="column1"td><label id="alignlabel" for="align">{#advimage_dlg.align}</label></td>
|
||||
<td><select id="align" name="align" onchange="ImageDialog.updateStyle('align');ImageDialog.changeAppearance();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="baseline">{#advimage_dlg.align_baseline}</option>
|
||||
<option value="top">{#advimage_dlg.align_top}</option>
|
||||
<option value="middle">{#advimage_dlg.align_middle}</option>
|
||||
<option value="bottom">{#advimage_dlg.align_bottom}</option>
|
||||
<option value="text-top">{#advimage_dlg.align_texttop}</option>
|
||||
<option value="text-bottom">{#advimage_dlg.align_textbottom}</option>
|
||||
<option value="left">{#advimage_dlg.align_left}</option>
|
||||
<option value="right">{#advimage_dlg.align_right}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td rowspan="6" valign="top"td>
|
||||
<div class="alignPreview">
|
||||
<img id="alignSampleImg" src="img/sample.gif" alt="{#advimage_dlg.example_img}" />
|
||||
Lorem ipsum, Dolor sit amet, consectetuer adipiscing loreum ipsum edipiscing elit, sed diam
|
||||
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.Loreum ipsum
|
||||
edipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam
|
||||
erat volutpat.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr role="group" aria-labelledby="widthlabel">
|
||||
<td class="column1"td><label id="widthlabel" for="width">{#advimage_dlg.dimensions}</label></td>
|
||||
<td class="nowrap"td>
|
||||
<span style="display:none" id="width_voiceLabel">{#advimage_dlg.width}</span>
|
||||
<input name="width" type="text" id="width" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeHeight();" aria-labelledby="width_voiceLabel" /> x
|
||||
<span style="display:none" id="height_voiceLabel">{#advimage_dlg.height}</span>
|
||||
<input name="height" type="text" id="height" value="" size="5" maxlength="5" class="size" onchange="ImageDialog.changeWidth();" aria-labelledby="height_voiceLabel" /> px
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><table role="presentation" border="0" cellpadding="0" cellspacing="0"td>
|
||||
<tr>
|
||||
<td><input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
|
||||
<td><label id="constrainlabel" for="constrain">{#advimage_dlg.constrain_proportions}</label></td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"td><label id="vspacelabel" for="vspace">{#advimage_dlg.vspace}</label></td>
|
||||
<td><input name="vspace" type="text" id="vspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('vspace');ImageDialog.changeAppearance();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"td><label id="hspacelabel" for="hspace">{#advimage_dlg.hspace}</label></td>
|
||||
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('hspace');ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"td><label id="borderlabel" for="border">{#advimage_dlg.border}</label></td>
|
||||
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" class="number" onchange="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" onblur="ImageDialog.updateStyle('border');ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="class_list">{#class_name}</label></td>
|
||||
<td colspan="2"td><select id="class_list" name="class_list" class="mceEditableSelect"><option value=""></option></select></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"td><label id="stylelabel" for="style">{#advimage_dlg.style}</label></td>
|
||||
<td colspan="2"td><input id="style" name="style" type="text" value="" onchange="ImageDialog.changeAppearance();" /></td>
|
||||
</tr>
|
||||
|
||||
<!-- <tr>
|
||||
<td class="column1"><label id="classeslabel" for="classes">{#advimage_dlg.classes}</label></td>
|
||||
<td colspan="2"><input id="classes" name="classes" type="text" value="" onchange="selectByValue(this.form,'classlist',this.value,true);" /></td>
|
||||
</tr> -->
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="advanced_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.swap_image}</legend>
|
||||
|
||||
<input type="checkbox" id="onmousemovecheck" name="onmousemovecheck" class="checkbox" onclick="ImageDialog.setSwapImage(this.checked);" aria-controls="onmouseoversrc onmouseoutsrc" />
|
||||
<label id="onmousemovechecklabel" for="onmousemovecheck">{#advimage_dlg.alt_image}</label>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%"td>
|
||||
<tr>
|
||||
<td class="column1"td><label id="onmouseoversrclabel" for="onmouseoversrc">{#advimage_dlg.mouseover}</label></td>
|
||||
<td><table role="presentation" border="0" cellspacing="0" cellpadding="0"td>
|
||||
<tr>
|
||||
<td><input id="onmouseoversrc" name="onmouseoversrc" type="text" value="" /></td>
|
||||
<td id="onmouseoversrccontainer"td> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="over_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="over_list" name="over_list" onchange="document.getElementById('onmouseoversrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"td><label id="onmouseoutsrclabel" for="onmouseoutsrc">{#advimage_dlg.mouseout}</label></td>
|
||||
<td class="column2"td><table role="presentation" border="0" cellspacing="0" cellpadding="0"td>
|
||||
<tr>
|
||||
<td><input id="onmouseoutsrc" name="onmouseoutsrc" type="text" value="" /></td>
|
||||
<td id="onmouseoutsrccontainer"td> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="out_list">{#advimage_dlg.image_list}</label></td>
|
||||
<td><select id="out_list" name="out_list" onchange="document.getElementById('onmouseoutsrc').value=this.options[this.selectedIndex].value;"><option value=""></option></select></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#advimage_dlg.misc}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0"td>
|
||||
<tr>
|
||||
<td class="column1"><label id="titlelabel" for="title">{#advimage_dlg.title}</label></td>
|
||||
<td><input id="title" name="title" type="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="column1"td><label id="idlabel" for="id">{#advimage_dlg.id}</label></td>
|
||||
<td><input id="id" name="id" type="text" value="" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"td><label id="dirlabel" for="dir">{#advimage_dlg.langdir}</label></td>
|
||||
<td>
|
||||
<select id="dir" name="dir" onchange="ImageDialog.changeAppearance();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="ltr">{#advimage_dlg.ltr}</option>
|
||||
<option value="rtl">{#advimage_dlg.rtl}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"td><label id="langlabel" for="lang">{#advimage_dlg.langcode}</label></td>
|
||||
<td>
|
||||
<input id="lang" name="lang" type="text" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"td><label id="usemaplabel" for="usemap">{#advimage_dlg.map}</label></td>
|
||||
<td>
|
||||
<input id="usemap" name="usemap" type="text" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="column1"td><label id="longdesclabel" for="longdesc">{#advimage_dlg.long_desc}</label></td>
|
||||
<td><table role="presentation" border="0" cellspacing="0" cellpadding="0"td>
|
||||
<tr>
|
||||
<td><input id="longdesc" name="longdesc" type="text" value="" /></td>
|
||||
<td id="longdesccontainer"> </td>
|
||||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 1.6 KiB |
@ -1,464 +0,0 @@
|
||||
var ImageDialog = {
|
||||
preInit : function() {
|
||||
var url;
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
if (url = tinyMCEPopup.getParam("external_image_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
},
|
||||
|
||||
init : function(ed) {
|
||||
var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(), fl = tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList');
|
||||
|
||||
tinyMCEPopup.resizeToInnerSize();
|
||||
this.fillClassList('class_list');
|
||||
this.fillFileList('src_list', fl);
|
||||
this.fillFileList('over_list', fl);
|
||||
this.fillFileList('out_list', fl);
|
||||
TinyMCE_EditableSelects.init();
|
||||
|
||||
if (n.nodeName == 'IMG') {
|
||||
nl.src.value = dom.getAttrib(n, 'src');
|
||||
nl.width.value = dom.getAttrib(n, 'width');
|
||||
nl.height.value = dom.getAttrib(n, 'height');
|
||||
nl.alt.value = dom.getAttrib(n, 'alt');
|
||||
nl.title.value = dom.getAttrib(n, 'title');
|
||||
nl.vspace.value = this.getAttrib(n, 'vspace');
|
||||
nl.hspace.value = this.getAttrib(n, 'hspace');
|
||||
nl.border.value = this.getAttrib(n, 'border');
|
||||
selectByValue(f, 'align', this.getAttrib(n, 'align'));
|
||||
selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true);
|
||||
nl.style.value = dom.getAttrib(n, 'style');
|
||||
nl.id.value = dom.getAttrib(n, 'id');
|
||||
nl.dir.value = dom.getAttrib(n, 'dir');
|
||||
nl.lang.value = dom.getAttrib(n, 'lang');
|
||||
nl.usemap.value = dom.getAttrib(n, 'usemap');
|
||||
nl.longdesc.value = dom.getAttrib(n, 'longdesc');
|
||||
nl.insert.value = ed.getLang('update');
|
||||
|
||||
if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover')))
|
||||
nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
|
||||
|
||||
if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout')))
|
||||
nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
// Move attribs to styles
|
||||
if (dom.getAttrib(n, 'align'))
|
||||
this.updateStyle('align');
|
||||
|
||||
if (dom.getAttrib(n, 'hspace'))
|
||||
this.updateStyle('hspace');
|
||||
|
||||
if (dom.getAttrib(n, 'border'))
|
||||
this.updateStyle('border');
|
||||
|
||||
if (dom.getAttrib(n, 'vspace'))
|
||||
this.updateStyle('vspace');
|
||||
}
|
||||
}
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('srcbrowsercontainer').innerHTML = getImageBrowserHTML('srcbrowser','src','image','theme_advanced_image'); // Moodle hack
|
||||
if (isVisible('srcbrowser'))
|
||||
document.getElementById('src').style.width = '260px';
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image');
|
||||
if (isVisible('overbrowser'))
|
||||
document.getElementById('onmouseoversrc').style.width = '260px';
|
||||
|
||||
// Setup browse button
|
||||
document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image');
|
||||
if (isVisible('outbrowser'))
|
||||
document.getElementById('onmouseoutsrc').style.width = '260px';
|
||||
|
||||
// If option enabled default contrain proportions to checked
|
||||
if (ed.getParam("advimage_constrain_proportions", true))
|
||||
f.constrain.checked = true;
|
||||
|
||||
// Check swap image if valid data
|
||||
if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value)
|
||||
this.setSwapImage(true);
|
||||
else
|
||||
this.setSwapImage(false);
|
||||
|
||||
this.changeAppearance();
|
||||
this.showPreviewImage(nl.src.value, 1);
|
||||
},
|
||||
|
||||
insert : function(file, title) {
|
||||
var ed = tinyMCEPopup.editor, t = this, f = document.forms[0];
|
||||
|
||||
if (f.src.value === '') {
|
||||
if (ed.selection.getNode().nodeName == 'IMG') {
|
||||
ed.dom.remove(ed.selection.getNode());
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
|
||||
if (!f.alt.value) {
|
||||
tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) {
|
||||
if (s)
|
||||
t.insertAndClose();
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
t.insertAndClose();
|
||||
},
|
||||
|
||||
insertAndClose : function() {
|
||||
var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
|
||||
// Fixes crash in Safari
|
||||
if (tinymce.isWebKit)
|
||||
ed.getWin().focus();
|
||||
|
||||
if (!ed.settings.inline_styles) {
|
||||
args = {
|
||||
vspace : nl.vspace.value,
|
||||
hspace : nl.hspace.value,
|
||||
border : nl.border.value,
|
||||
align : getSelectValue(f, 'align')
|
||||
};
|
||||
} else {
|
||||
// Remove deprecated values
|
||||
args = {
|
||||
vspace : '',
|
||||
hspace : '',
|
||||
border : '',
|
||||
align : ''
|
||||
};
|
||||
}
|
||||
|
||||
tinymce.extend(args, {
|
||||
src : nl.src.value.replace(/ /g, '%20'),
|
||||
width : nl.width.value,
|
||||
height : nl.height.value,
|
||||
alt : nl.alt.value,
|
||||
title : nl.title.value,
|
||||
'class' : getSelectValue(f, 'class_list'),
|
||||
style : nl.style.value,
|
||||
id : nl.id.value,
|
||||
dir : nl.dir.value,
|
||||
lang : nl.lang.value,
|
||||
usemap : nl.usemap.value,
|
||||
longdesc : nl.longdesc.value
|
||||
});
|
||||
|
||||
args.onmouseover = args.onmouseout = '';
|
||||
|
||||
if (f.onmousemovecheck.checked) {
|
||||
if (nl.onmouseoversrc.value)
|
||||
args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';";
|
||||
|
||||
if (nl.onmouseoutsrc.value)
|
||||
args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';";
|
||||
}
|
||||
|
||||
el = ed.selection.getNode();
|
||||
|
||||
if (el && el.nodeName == 'IMG') {
|
||||
ed.dom.setAttribs(el, args);
|
||||
} else {
|
||||
tinymce.each(args, function(value, name) {
|
||||
if (value === "") {
|
||||
delete args[name];
|
||||
}
|
||||
});
|
||||
|
||||
ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});
|
||||
ed.undoManager.add();
|
||||
}
|
||||
|
||||
tinyMCEPopup.editor.execCommand('mceRepaint');
|
||||
tinyMCEPopup.editor.focus();
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
getAttrib : function(e, at) {
|
||||
var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
|
||||
|
||||
if (ed.settings.inline_styles) {
|
||||
switch (at) {
|
||||
case 'align':
|
||||
if (v = dom.getStyle(e, 'float'))
|
||||
return v;
|
||||
|
||||
if (v = dom.getStyle(e, 'vertical-align'))
|
||||
return v;
|
||||
|
||||
break;
|
||||
|
||||
case 'hspace':
|
||||
v = dom.getStyle(e, 'margin-left')
|
||||
v2 = dom.getStyle(e, 'margin-right');
|
||||
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'vspace':
|
||||
v = dom.getStyle(e, 'margin-top')
|
||||
v2 = dom.getStyle(e, 'margin-bottom');
|
||||
if (v && v == v2)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
|
||||
case 'border':
|
||||
v = 0;
|
||||
|
||||
tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
|
||||
sv = dom.getStyle(e, 'border-' + sv + '-width');
|
||||
|
||||
// False or not the same as prev
|
||||
if (!sv || (sv != v && v !== 0)) {
|
||||
v = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sv)
|
||||
v = sv;
|
||||
});
|
||||
|
||||
if (v)
|
||||
return parseInt(v.replace(/[^0-9]/g, ''));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (v = dom.getAttrib(e, at))
|
||||
return v;
|
||||
|
||||
return '';
|
||||
},
|
||||
|
||||
setSwapImage : function(st) {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.onmousemovecheck.checked = st;
|
||||
setBrowserDisabled('overbrowser', !st);
|
||||
setBrowserDisabled('outbrowser', !st);
|
||||
|
||||
if (f.over_list)
|
||||
f.over_list.disabled = !st;
|
||||
|
||||
if (f.out_list)
|
||||
f.out_list.disabled = !st;
|
||||
|
||||
f.onmouseoversrc.disabled = !st;
|
||||
f.onmouseoutsrc.disabled = !st;
|
||||
},
|
||||
|
||||
fillClassList : function(id) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
|
||||
cl = [];
|
||||
|
||||
tinymce.each(v.split(';'), function(v) {
|
||||
var p = v.split('=');
|
||||
|
||||
cl.push({'title' : p[0], 'class' : p[1]});
|
||||
});
|
||||
} else
|
||||
cl = tinyMCEPopup.editor.dom.getClasses();
|
||||
|
||||
if (cl.length > 0) {
|
||||
lst.options.length = 0;
|
||||
lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
|
||||
|
||||
tinymce.each(cl, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
fillFileList : function(id, l) {
|
||||
var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
|
||||
|
||||
l = typeof(l) === 'function' ? l() : window[l];
|
||||
lst.options.length = 0;
|
||||
|
||||
if (l && l.length > 0) {
|
||||
lst.options[lst.options.length] = new Option('', '');
|
||||
|
||||
tinymce.each(l, function(o) {
|
||||
lst.options[lst.options.length] = new Option(o[0], o[1]);
|
||||
});
|
||||
} else
|
||||
dom.remove(dom.getParent(id, 'tr'));
|
||||
},
|
||||
|
||||
resetImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.elements.width.value = f.elements.height.value = '';
|
||||
},
|
||||
|
||||
updateImageData : function(img, st) {
|
||||
var f = document.forms[0];
|
||||
|
||||
if (!st) {
|
||||
f.elements.width.value = img.width;
|
||||
f.elements.height.value = img.height;
|
||||
}
|
||||
|
||||
this.preloadImg = img;
|
||||
},
|
||||
|
||||
changeAppearance : function() {
|
||||
var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg');
|
||||
|
||||
if (img) {
|
||||
if (ed.getParam('inline_styles')) {
|
||||
ed.dom.setAttrib(img, 'style', f.style.value);
|
||||
} else {
|
||||
img.align = f.align.value;
|
||||
img.border = f.border.value;
|
||||
img.hspace = f.hspace.value;
|
||||
img.vspace = f.vspace.value;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
changeHeight : function() {
|
||||
var f = document.forms[0], tp, t = this;
|
||||
|
||||
if (!f.constrain.checked || !t.preloadImg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (f.width.value == "" || f.height.value == "")
|
||||
return;
|
||||
|
||||
tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height;
|
||||
f.height.value = tp.toFixed(0);
|
||||
},
|
||||
|
||||
changeWidth : function() {
|
||||
var f = document.forms[0], tp, t = this;
|
||||
|
||||
if (!f.constrain.checked || !t.preloadImg) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (f.width.value == "" || f.height.value == "")
|
||||
return;
|
||||
|
||||
tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width;
|
||||
f.width.value = tp.toFixed(0);
|
||||
},
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, b, bStyle, bColor, v, isIE = tinymce.isIE, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
// Handle align
|
||||
if (ty == 'align') {
|
||||
dom.setStyle(img, 'float', '');
|
||||
dom.setStyle(img, 'vertical-align', '');
|
||||
|
||||
v = getSelectValue(f, 'align');
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right')
|
||||
dom.setStyle(img, 'float', v);
|
||||
else
|
||||
img.style.verticalAlign = v;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle border
|
||||
if (ty == 'border') {
|
||||
b = img.style.border ? img.style.border.split(' ') : [];
|
||||
bStyle = dom.getStyle(img, 'border-style');
|
||||
bColor = dom.getStyle(img, 'border-color');
|
||||
|
||||
dom.setStyle(img, 'border', '');
|
||||
|
||||
v = f.border.value;
|
||||
if (v || v == '0') {
|
||||
if (v == '0')
|
||||
img.style.border = isIE ? '0' : '0 none none';
|
||||
else {
|
||||
var isOldIE = tinymce.isIE && (!document.documentMode || document.documentMode < 9);
|
||||
|
||||
if (b.length == 3 && b[isOldIE ? 2 : 1])
|
||||
bStyle = b[isOldIE ? 2 : 1];
|
||||
else if (!bStyle || bStyle == 'none')
|
||||
bStyle = 'solid';
|
||||
if (b.length == 3 && b[isIE ? 0 : 2])
|
||||
bColor = b[isOldIE ? 0 : 2];
|
||||
else if (!bColor || bColor == 'none')
|
||||
bColor = 'black';
|
||||
img.style.border = v + 'px ' + bStyle + ' ' + bColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hspace
|
||||
if (ty == 'hspace') {
|
||||
dom.setStyle(img, 'marginLeft', '');
|
||||
dom.setStyle(img, 'marginRight', '');
|
||||
|
||||
v = f.hspace.value;
|
||||
if (v) {
|
||||
img.style.marginLeft = v + 'px';
|
||||
img.style.marginRight = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle vspace
|
||||
if (ty == 'vspace') {
|
||||
dom.setStyle(img, 'marginTop', '');
|
||||
dom.setStyle(img, 'marginBottom', '');
|
||||
|
||||
v = f.vspace.value;
|
||||
if (v) {
|
||||
img.style.marginTop = v + 'px';
|
||||
img.style.marginBottom = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Merge
|
||||
dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText), 'img');
|
||||
}
|
||||
},
|
||||
|
||||
changeMouseMove : function() {
|
||||
},
|
||||
|
||||
showPreviewImage : function(u, st) {
|
||||
if (!u) {
|
||||
tinyMCEPopup.dom.setHTML('prev', '');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))
|
||||
this.resetImageData();
|
||||
|
||||
u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u);
|
||||
|
||||
if (!st)
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />');
|
||||
else
|
||||
tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />');
|
||||
}
|
||||
};
|
||||
|
||||
ImageDialog.preInit();
|
||||
tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE image insert/edit plugin version details.
|
||||
*
|
||||
* @package tinymce_moodleimage
|
||||
* @copyright 2012 Petr Skoda (http://skodak.org)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2022112800;
|
||||
// Required Moodle version.
|
||||
$plugin->requires = 2022111800;
|
||||
// Full name of the plugin (used for diagnostics).
|
||||
$plugin->component = 'tinymce_moodleimage';
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for tinymce_moodlemedia.
|
||||
*
|
||||
* @package tinymce_moodlemedia
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tinymce_moodlemedia\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for tinymce_moodlemedia implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for Moodle Media plugin.
|
||||
*
|
||||
* @package tinymce_moodlemedia
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['nopreview'] = 'Can not preview media.';
|
||||
$string['pluginname'] = 'Insert media';
|
||||
|
||||
/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
|
||||
$string['moodlemedia:browsemedia'] = 'Find or upload a sound, video or applet...';
|
||||
$string['moodlemedia:desc'] = 'Insert Moodle media';
|
||||
$string['privacy:metadata'] = 'The TinyMCE Moodle Media plugin does not store any personal data.';
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin for Moodle media (audio/video) insertion dialog.
|
||||
*
|
||||
* @package tinymce_moodlemedia
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tinymce_moodlemedia extends editor_tinymce_plugin {
|
||||
/** @var array list of buttons defined by this plugin */
|
||||
protected $buttons = array('moodlemedia');
|
||||
|
||||
protected function update_init_params(array &$params, context $context,
|
||||
array $options = null) {
|
||||
|
||||
// Add file picker callback.
|
||||
if (empty($options['legacy'])) {
|
||||
if (isset($options['maxfiles']) and $options['maxfiles'] != 0) {
|
||||
$params['file_browser_callback'] = "M.editor_tinymce.filepicker";
|
||||
}
|
||||
}
|
||||
|
||||
if ($row = $this->find_button($params, 'moodleemoticon')) {
|
||||
// Add button after 'moodleemoticon' icon.
|
||||
$this->add_button_after($params, $row, 'moodlemedia', 'moodleemoticon');
|
||||
} else if ($row = $this->find_button($params, 'image')) {
|
||||
// Note: We know that the plugin emoticon button has already been added
|
||||
// if it is enabled because this plugin has higher sortorder.
|
||||
// Otherwise add after 'image'.
|
||||
$this->add_button_after($params, $row, 'moodlemedia', 'image');
|
||||
} else {
|
||||
// Add this button in the end of the first row (by default 'image' button should be in the first row).
|
||||
$this->add_button_after($params, 1, 'moodlemedia');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
}
|
||||
|
||||
protected function get_sort_order() {
|
||||
return 110;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.6 KiB |
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Provides A/V preview features for the TinyMCE editor Moodle Media plugin.
|
||||
* The preview is included in an iframe within the popup dialog.
|
||||
*
|
||||
* @package tinymce_moodlemedia
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require(__DIR__ . '/../../../../../config.php');
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
// Decode the url - it can not be passed around unencoded because security filters might block it.
|
||||
$media = required_param('media', PARAM_RAW);
|
||||
$media = base64_decode($media);
|
||||
$url = clean_param($media, PARAM_URL);
|
||||
$url = new moodle_url($url);
|
||||
|
||||
// Now output this file which is super-simple
|
||||
$PAGE->set_pagelayout('embedded');
|
||||
$PAGE->set_url(new moodle_url('/lib/editor/tinymce/plugins/moodlemedia/preview.php'));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->add_body_class('core_media_preview');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$mediarenderer = core_media_manager::instance($PAGE);
|
||||
|
||||
if (isloggedin() and !isguestuser() and $mediarenderer->can_embed_url($url)) {
|
||||
require_sesskey();
|
||||
echo $mediarenderer->embed_url($url);
|
||||
} else {
|
||||
print_string('nopreview', 'tinymce_moodlemedia');
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
@ -1,139 +0,0 @@
|
||||
#id,
|
||||
#name,
|
||||
#hspace,
|
||||
#vspace,
|
||||
#class_name,
|
||||
#align {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.moodlebutton {
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
padding: 3px 3px 3px 1.5em;
|
||||
border: 1px solid #ccc;
|
||||
text-decoration: none;
|
||||
background: url(search.png) .2em .3em no-repeat;
|
||||
}
|
||||
|
||||
.moodlebutton:hover {
|
||||
background: #ccc;
|
||||
}
|
||||
|
||||
#hspace,
|
||||
#vspace {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#flash_quality,
|
||||
#flash_align,
|
||||
#flash_scale,
|
||||
#flash_salign,
|
||||
#flash_wmode {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
#flash_base,
|
||||
#flash_flashvars {
|
||||
width: 240px;
|
||||
}
|
||||
|
||||
#width,
|
||||
#height {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
#src,
|
||||
#media_type {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
#class {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
#prev {
|
||||
margin: 0;
|
||||
border: 1px solid black;
|
||||
width: 430px;
|
||||
height: 330px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.panel_wrapper div.current {
|
||||
height: 410px;
|
||||
}
|
||||
|
||||
.panel_wrapper {
|
||||
border-top-style: solid;
|
||||
}
|
||||
|
||||
.panel_wrapper {
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.panel_wrapper {
|
||||
border-top-color: rgb(145, 155, 156);
|
||||
}
|
||||
|
||||
#flash_options,
|
||||
#shockwave_options,
|
||||
#qt_options,
|
||||
#wmp_options,
|
||||
#rmp_options {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mceAddSelectValue {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
#qt_starttime,
|
||||
#qt_endtime,
|
||||
#qt_fov,
|
||||
#qt_href,
|
||||
#qt_moveid,
|
||||
#qt_moviename,
|
||||
#qt_node,
|
||||
#qt_pan,
|
||||
#qt_qtsrc,
|
||||
#qt_qtsrcchokespeed,
|
||||
#qt_target,
|
||||
#qt_tilt,
|
||||
#qt_urlsubstituten,
|
||||
#qt_volume {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#wmp_balance,
|
||||
#wmp_baseurl,
|
||||
#wmp_captioningid,
|
||||
#wmp_currentmarker,
|
||||
#wmp_currentposition,
|
||||
#wmp_defaultframe,
|
||||
#wmp_playcount,
|
||||
#wmp_rate,
|
||||
#wmp_uimode,
|
||||
#wmp_volume {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#rmp_console,
|
||||
#rmp_numloop,
|
||||
#rmp_controls,
|
||||
#rmp_scriptcallbacks {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
#shockwave_swvolume,
|
||||
#shockwave_swframe,
|
||||
#shockwave_swurl,
|
||||
#shockwave_swstretchvalign,
|
||||
#shockwave_swstretchhalign,
|
||||
#shockwave_swstretchstyle {
|
||||
width: 90px;
|
||||
}
|
||||
|
||||
#qt_qtsrc {
|
||||
width: 200px;
|
||||
}
|
Before Width: | Height: | Size: 522 B |
@ -1,53 +0,0 @@
|
||||
/**
|
||||
* @author Dongsheng Cai <dongsheng@moodle.com>
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var each = tinymce.each;
|
||||
|
||||
tinymce.PluginManager.requireLangPack('moodlemedia');
|
||||
|
||||
tinymce.create('tinymce.plugins.MoodlemediaPlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
t.url = url;
|
||||
|
||||
// Register commands.
|
||||
ed.addCommand('mceMoodleMedia', function() {
|
||||
ed.windowManager.open({
|
||||
file : url + '/moodlemedia.htm',
|
||||
width : 480 + parseInt(ed.getLang('media.delta_width', 0)),
|
||||
height : 480 + parseInt(ed.getLang('media.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons.
|
||||
ed.addButton('moodlemedia', {
|
||||
title : 'moodlemedia.desc',
|
||||
image : url + '/img/icon.png',
|
||||
cmd : 'mceMoodleMedia'});
|
||||
|
||||
},
|
||||
|
||||
_parse : function(s) {
|
||||
return tinymce.util.JSON.parse('{' + s + '}');
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Moodle media',
|
||||
author : 'Dongsheng Cai <dongsheng@moodle.com>',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Register plugin.
|
||||
tinymce.PluginManager.add('moodlemedia', tinymce.plugins.MoodlemediaPlugin);
|
||||
})();
|
Before Width: | Height: | Size: 221 B |
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" style="overflow:visible;enable-background:new 0 0 16 16;"
|
||||
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
|
||||
<defs>
|
||||
</defs>
|
||||
<path style="fill:#888;" d="M0,0v16h16V0H0z M3,15H1v-2h2V15z M3,11H1V9h2V11z M3,7H1V5h2V7z M3,3H1V1h2V3z M12,15H4V1h8V15z
|
||||
M15,15h-2v-2h2V15z M15,11h-2V9h2V11z M15,7h-2V5h2V7z M15,3h-2V1h2V3z M10,8l-4,3V5L10,8z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 854 B |
@ -1,146 +0,0 @@
|
||||
/**
|
||||
* @author Dongsheng Cai <dongsheng@moodle.com>
|
||||
*/
|
||||
|
||||
// No need to require lang packs in moodle plugins.
|
||||
|
||||
var ed, url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("media_external_list_url")) {
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
}
|
||||
|
||||
function init() {
|
||||
ed = tinyMCEPopup.editor;
|
||||
document.getElementById('filebrowsercontainer').innerHTML = getFileBrowserHTML('filebrowser','src','media','media');
|
||||
}
|
||||
|
||||
function insertMedia() {
|
||||
var f = document.forms[0];
|
||||
var url = f.filename.value;
|
||||
var linkname = url.substring(url.lastIndexOf('/')+1);
|
||||
var h = '<a href="'+f.src.value+'">'+linkname+'</a>';
|
||||
ed.execCommand('mceInsertContent', false, h);
|
||||
tinyMCEPopup.close();
|
||||
}
|
||||
|
||||
function serializeParameters() {
|
||||
var d = document, s = '';
|
||||
s += getStr(null, 'src');
|
||||
|
||||
// delete the tail comma
|
||||
s = s.length > 0 ? s.substring(0, s.length - 1) : s;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function getStr(p, n, d) {
|
||||
var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
|
||||
var v = e.type == "hidden" ? e.value : e.options[e.selectedIndex].value;
|
||||
|
||||
if (n == 'src')
|
||||
v = tinyMCEPopup.editor.convertURL(v, 'src', null);
|
||||
|
||||
return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
|
||||
}
|
||||
|
||||
function jsEncode(s) {
|
||||
s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
|
||||
s = s.replace(new RegExp('"', 'g'), '\\"');
|
||||
s = s.replace(new RegExp("'", 'g'), "\\'");
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
function generatePreview(c) {
|
||||
var f = document.forms[0], p = document.getElementById('prev');
|
||||
|
||||
p.innerHTML = '<!-- x --->';
|
||||
var re = new RegExp("(.+)\#(.+)", "i");
|
||||
var result = f.src.value.match(re);
|
||||
if (result) {
|
||||
f.src.value = result[1];
|
||||
f.filename.value = result[2];
|
||||
} else {
|
||||
f.src.value = f.src.value;
|
||||
f.filename.value = f.src.value;
|
||||
}
|
||||
|
||||
// After constrain
|
||||
var pl = serializeParameters();
|
||||
if (pl == '') {
|
||||
p.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
pl = tinyMCEPopup.editor.plugins.moodlemedia._parse(pl);
|
||||
|
||||
if (!pl.src) {
|
||||
p.innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src);
|
||||
|
||||
// NOTE: Do not try to prevent https security popups here - users would get them later on real page anyway!
|
||||
|
||||
// We can not include URL directly in parameters because some security filters might block it.
|
||||
p.innerHTML = '<iframe src="' + tinyMCEPopup.editor.getParam("moodle_plugin_base") + 'moodlemedia/preview.php'
|
||||
+ '?media=' + encodeURIComponent(encode64(pl.src.toString()))
|
||||
+ '&sesskey=' + encodeURIComponent(parent.M.cfg.sesskey)
|
||||
+ '" width="100%" height="100%"></iframe>';
|
||||
}
|
||||
|
||||
function encode64(input) {
|
||||
/*
|
||||
CryptoMX Tools
|
||||
Copyright (C) 2004 - 2006 Derek Buitenhuis
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
var output = "";
|
||||
var chr1, chr2, chr3 = "";
|
||||
var enc1, enc2, enc3, enc4 = "";
|
||||
var i = 0;
|
||||
|
||||
do {
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
|
||||
output = output +
|
||||
keyStr.charAt(enc1) +
|
||||
keyStr.charAt(enc2) +
|
||||
keyStr.charAt(enc3) +
|
||||
keyStr.charAt(enc4);
|
||||
chr1 = chr2 = chr3 = "";
|
||||
enc1 = enc2 = enc3 = enc4 = "";
|
||||
} while (i < input.length);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
tinyMCEPopup.onInit.add(init);
|
@ -1,73 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>{#moodlemedia.desc}</title>
|
||||
<script type="text/javascript">
|
||||
// Because there is no relative path to TinyMCE, we have to use JavaScript
|
||||
// to work out correct path from the .js files from TinyMCE. Only files
|
||||
// inside this plugin can be included with relative path (below).
|
||||
var editor_tinymce_include = function(path) {
|
||||
document.write('<script type="text/javascript" src="' +
|
||||
parent.tinyMCE.baseURL + '/' + path + '"></' + 'script>');
|
||||
};
|
||||
editor_tinymce_include('tiny_mce_popup.js');
|
||||
editor_tinymce_include('utils/validate.js');
|
||||
editor_tinymce_include('utils/form_utils.js');
|
||||
editor_tinymce_include('utils/editable_selects.js');
|
||||
|
||||
var getFileBrowserHTML = function(id, target_form_element, type, prefix) {
|
||||
var option = prefix + "_" + type + "_browser_callback", cb, html;
|
||||
|
||||
cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
|
||||
|
||||
if (!cb)
|
||||
return "";
|
||||
|
||||
html = '<a class="moodlebutton" id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
|
||||
html += '<span id="' + id + '">' + tinyMCEPopup.getLang('moodlemedia.browsemedia') + '</span>';
|
||||
html += '</a>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="js/media.js"></script>
|
||||
<link href="css/media.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body style="display: none">
|
||||
<form onsubmit="insertMedia();return false;" action="#">
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<input id="src" name="src" type="hidden" value="" class="mceFocus" onchange="generatePreview();" />
|
||||
<input id="filename" name="filename" type="hidden" value="" />
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.general}</legend>
|
||||
|
||||
<table align="center" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr align="center">
|
||||
<td colspan='2' id="filebrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.preview}</legend>
|
||||
<div id="prev"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<div style="float: left">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE media insert plugin version details.
|
||||
*
|
||||
* @package tinymce_moodlemedia
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2022112800;
|
||||
// Required Moodle version.
|
||||
$plugin->requires = 2022111800;
|
||||
// Full name of the plugin (used for diagnostics).
|
||||
$plugin->component = 'tinymce_moodlemedia';
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for tinymce_moodlenolink.
|
||||
*
|
||||
* @package tinymce_moodlenolink
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tinymce_moodlenolink\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for tinymce_moodlenolink implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for 'no link' plugin.
|
||||
*
|
||||
* @package tinymce_moodlenolink
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Prevent automatic linking';
|
||||
|
||||
/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
|
||||
$string['moodlenolink:desc'] = 'Prevent automatic linking';
|
||||
$string['privacy:metadata'] = 'The TinyMCE Automatic link prevention plugin does not store any personal data.';
|
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin for Moodle 'no link' button.
|
||||
*
|
||||
* @package tinymce_moodlenolink
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tinymce_moodlenolink extends editor_tinymce_plugin {
|
||||
/** @var array list of buttons defined by this plugin */
|
||||
protected $buttons = array('moodlenolink');
|
||||
|
||||
protected function update_init_params(array &$params, context $context,
|
||||
array $options = null) {
|
||||
|
||||
if ($row = $this->find_button($params, 'unlink')) {
|
||||
// Add button after 'unlink'.
|
||||
$this->add_button_after($params, $row, 'moodlenolink', 'unlink');
|
||||
} else {
|
||||
// Add this button in the end of the first row (by default 'unlink' button should be in the first row).
|
||||
$this->add_button_after($params, 1, 'moodlenolink');
|
||||
}
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 314 B |
@ -1,81 +0,0 @@
|
||||
/**
|
||||
* @author Mathieu Petit-Clair
|
||||
*/
|
||||
|
||||
(function() {
|
||||
// Do not load language pack in moodle plugins.
|
||||
|
||||
tinymce.create('tinymce.plugins.moodlenolinkPlugin', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceMoodleNolink');
|
||||
ed.addCommand('mceMoodleNolink', function() {
|
||||
var n, p;
|
||||
|
||||
n = ed.selection.getNode();
|
||||
p = ed.dom.getParent(n, function(t) {
|
||||
return ed.dom.getAttrib(t, 'class') == 'nolink';
|
||||
});
|
||||
|
||||
if (p) {
|
||||
ed.dom.remove(p, true);
|
||||
} else {
|
||||
ed.selection.setContent('<span class="nolink">' + ed.selection.getContent() + '</span>');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Register moodlenolink button
|
||||
ed.addButton('moodlenolink', {
|
||||
title : 'moodlenolink.desc',
|
||||
cmd : 'mceMoodleNolink',
|
||||
image : url + '/img/prevent_autolink.png'
|
||||
});
|
||||
|
||||
// Add a node change handler, selects the button in the UI when a image is selected
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
var p, c;
|
||||
c = cm.get('moodlenolink');
|
||||
if (!c) {
|
||||
// Button not used.
|
||||
return;
|
||||
}
|
||||
p = ed.dom.getParent(n, 'SPAN');
|
||||
|
||||
c.setActive(p && ed.dom.hasClass(p, 'nolink'));
|
||||
|
||||
if (p && ed.dom.hasClass(p, 'nolink') || ed.selection.getContent()) {
|
||||
c.setDisabled(false);
|
||||
} else {
|
||||
c.setDisabled(true);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'moodlenolink plugin',
|
||||
author : 'Mathieu Petit-Clair',
|
||||
authorurl : 'http://moodle.com/hq',
|
||||
infourl : 'http://docs.moodle.org/en/TinyMCE',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin.
|
||||
tinymce.PluginManager.add('moodlenolink', tinymce.plugins.moodlenolinkPlugin);
|
||||
})();
|
Before Width: | Height: | Size: 399 B |
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE no-link marker plugin version details.
|
||||
*
|
||||
* @package tinymce_moodlenolink
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2022112800;
|
||||
// Required Moodle version.
|
||||
$plugin->requires = 2022111800;
|
||||
// Full name of the plugin (used for diagnostics).
|
||||
$plugin->component = 'tinymce_moodlenolink';
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for tinymce_pdw.
|
||||
*
|
||||
* @package tinymce_pdw
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tinymce_pdw\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for tinymce_pdw implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for 'Toolbar Toggle' plugin.
|
||||
*
|
||||
* @package tinymce_pdw
|
||||
* @copyright 2013 Jason Fowler
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Toolbar Toggle';
|
||||
|
||||
/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
|
||||
$string['pdw:desc'] = 'Toolbar Toggle';
|
||||
$string['privacy:metadata'] = 'The TinyMCE Toolbar toggle plugin does not store any personal data.';
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Plugin for Moodle 'Toolbar Toggle' button.
|
||||
*
|
||||
* @package tinymce_pdw
|
||||
* @copyright 2013 Jason Fowler
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tinymce_pdw extends editor_tinymce_plugin {
|
||||
/**
|
||||
* Adds pdw toggle button if there are more than one row of buttons in TinyMCE
|
||||
*
|
||||
* @param array $params TinyMCE init parameters array
|
||||
* @param context $context Context where editor is being shown
|
||||
* @param array $options Options for this editor
|
||||
*/
|
||||
protected function update_init_params(array &$params, context $context,
|
||||
array $options = null) {
|
||||
|
||||
$rowsnumber = $this->count_button_rows($params);
|
||||
if ($rowsnumber > 1) {
|
||||
$this->add_button_before($params, 1, 'pdw_toggle', '');
|
||||
$params['pdw_toggle_on'] = 1;
|
||||
$params['pdw_toggle_toolbars'] = join(',', range(2, $rowsnumber));
|
||||
|
||||
// Add JS file, which uses default name.
|
||||
$this->add_js_plugin($params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the order in which to run this plugin
|
||||
*
|
||||
* We need pdw plugin to be added the last, so nothing is added before the button.
|
||||
*/
|
||||
protected function get_sort_order() {
|
||||
return 100000;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 2.8 KiB |
@ -1,20 +0,0 @@
|
||||
Description of PDW Toolbar Toggle integration in Moodle
|
||||
=========================================================================================
|
||||
|
||||
Copyright: Guido Neele (www.neele.name)
|
||||
License: MIT
|
||||
|
||||
Moodle maintainer: Jason Fowler (phalacee)
|
||||
|
||||
=========================================================================================
|
||||
Upgrade procedure:
|
||||
1/ extract standard PDW package into lib/editor/tinymce/plugins/pdw/tinymce/
|
||||
2/ bump up version.php
|
||||
3/ update ./thirdpartylibs.xml
|
||||
4/ reimplement patch in MDL-23646
|
||||
5/ reimplement patch in MDL-40668
|
||||
6/ add in "DOM.setStyle(ifr, 'width',DOM.getSize(ifrcon).w); // Resize iframe" (without quotes)
|
||||
after "DOM.setStyle(ifr, 'height',DOM.getSize(ifr).h + dy); // Resize iframe"
|
||||
7/ reimplement patch in MDL-42481
|
||||
8/ reimplement patch in MDL-42684
|
||||
9/ reimplement patch in MDL-42887
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<libraries>
|
||||
<library>
|
||||
<location>tinymce</location>
|
||||
<name>PDW Toolbar Toggle</name>
|
||||
<description>A plugin for the TinyMCE WYSIWYG editor. The plugin shows and hides the toolbars just like the Kitchen Sink plugin in Wordpress.</description>
|
||||
<version>1.2</version>
|
||||
<license>MIT</license>
|
||||
<repository>https://github.com/GuidoNeele/PDW-Toggle-Toolbars-TinyMCE</repository>
|
||||
<copyrights>
|
||||
<copyright>Guido Neele (www.neele.name)</copyright>
|
||||
</copyrights>
|
||||
</library>
|
||||
</libraries>
|
@ -1,213 +0,0 @@
|
||||
/**
|
||||
* PDW Toggle Toolbars v1.2
|
||||
* Url: http://www.neele.name
|
||||
* Author: Guido Neele
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
* Based on TinyMCE Wordpress plugin (Kitchen Sink)
|
||||
*
|
||||
* Changes V1.1.1 --> V1.2
|
||||
*
|
||||
* heeae made some modifications and posted his work on Sourceforge. I thought the cookie support
|
||||
* was really handy so I updated the script.
|
||||
* http://sourceforge.net/tracker/?func=detail&atid=738747&aid=2904683&group_id=103281
|
||||
*
|
||||
* 1. Added cookie support.
|
||||
* 2. Some optimization
|
||||
* 3. Bug fix of fire ifr.clientHeight in FF 3 ( to DOM.getStyles)
|
||||
*
|
||||
* Thanks heeae!
|
||||
*
|
||||
* Changes V1.1 --> V1.1.1
|
||||
*
|
||||
* Bugfix for Firefox 3.6. Caused error while loading script.
|
||||
*
|
||||
* Added lines 72 - 76:
|
||||
*
|
||||
* obj = ed.controlManager.get(tbIds[j]);
|
||||
* if(typeof obj =="undefined") {
|
||||
* continue;
|
||||
* }
|
||||
* id = obj.id;
|
||||
*
|
||||
* instead of:
|
||||
*
|
||||
* try {
|
||||
* id = ed.controlManager.get(tbIds[j]).id;
|
||||
* }
|
||||
* catch(e) {
|
||||
* //if(typeof id == "undefined") continue;
|
||||
* continue;
|
||||
* }
|
||||
*
|
||||
* Thanks Anton for fixing this bug
|
||||
*
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var DOM = tinymce.DOM;
|
||||
tinymce.PluginManager.requireLangPack('pdw');
|
||||
|
||||
tinymce.create('tinymce.plugins.pdw', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
var t = this, tbIds = new Array(), toolbars = new Array(), i;
|
||||
|
||||
// Split toolbars
|
||||
toolbars = (ed.settings.pdw_toggle_toolbars).split(',');
|
||||
|
||||
for(i = 0; i < toolbars.length; i++){
|
||||
tbIds[i] = ed.getParam('', 'toolbar' + (toolbars[i]).replace(' ',''));
|
||||
}
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
ed.addCommand('mcePDWToggleToolbars', function() {
|
||||
|
||||
var cm = ed.controlManager, id, j, Cookie = tinymce.util.Cookie, Toggle_PDW, Toggle = Cookie.getHash("TinyMCE_toggle") || new Object();
|
||||
for(j = 0; j < tbIds.length; j++){
|
||||
|
||||
obj = ed.controlManager.get(tbIds[j]);
|
||||
if(typeof obj =="undefined") {
|
||||
continue;
|
||||
}
|
||||
id = obj.id;
|
||||
|
||||
if (DOM.isHidden(id)) {
|
||||
Toggle_PDW = 0;
|
||||
var e = document.getElementById(id);
|
||||
if (e) {
|
||||
e.style.display = 'table';
|
||||
t._resizeIframe(ed, tbIds[j], -26);
|
||||
}
|
||||
|
||||
} else {
|
||||
Toggle_PDW = 1;
|
||||
var e = document.getElementById(id);
|
||||
if (e) {
|
||||
e.style.display = 'none';
|
||||
}
|
||||
t._resizeIframe(ed, tbIds[j], 26);
|
||||
}
|
||||
}
|
||||
cm.setActive('pdw_toggle', Toggle_PDW);
|
||||
ed.settings.pdw_toggle_on = Toggle_PDW;
|
||||
Toggle[ed.id] = Toggle_PDW;
|
||||
Cookie.setHash("TinyMCE_toggle", Toggle);
|
||||
});
|
||||
|
||||
// Register pdw_toggle button
|
||||
ed.addButton('pdw_toggle', {
|
||||
title : ed.getLang('pdw.desc', 0),
|
||||
cmd : 'mcePDWToggleToolbars',
|
||||
image : url + '/img/toolbars.png'
|
||||
});
|
||||
|
||||
ed.onPostRender.add(function(){
|
||||
var toggle = tinymce.util.Cookie.getHash("TinyMCE_toggle") || new Object();
|
||||
var run = false;
|
||||
|
||||
// Check if value is stored in cookie
|
||||
if(toggle[ed.id] == null){
|
||||
// No cookie so check if the setting pdw_toggle_on is set to 1 then hide toolbars and set button active
|
||||
run = ed.settings.pdw_toggle_on == 1 ? true : false;
|
||||
} else if(toggle[ed.id] == 1){
|
||||
run = true;
|
||||
}
|
||||
|
||||
if (run) {
|
||||
|
||||
var cm = ed.controlManager, tdId, id;
|
||||
|
||||
for(i = 0; i < toolbars.length; i++){
|
||||
tbId = ed.getParam('', 'toolbar' + (toolbars[i]).replace(' ',''));
|
||||
id = ed.controlManager.get(tbId).id;
|
||||
cm.setActive('pdw_toggle', 1);
|
||||
DOM.hide(id);
|
||||
t._resizeIframe(ed, tbId, 26);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Resizes the iframe by a relative height value
|
||||
_resizeIframe : function(ed, tb_id, dy) {
|
||||
var ifr = ed.getContentAreaContainer().firstChild;
|
||||
var parcon = ed.getContainer(); //Parent container
|
||||
var tablecon = ed.getContainer().childNodes[1]; // Table container
|
||||
var textarea = DOM.get(ed.id);
|
||||
var rows = textarea ? textarea.getAttribute('rows') : 3;
|
||||
|
||||
// This set of changes addresses MDL-42481.
|
||||
// Moodle collapses form sections by setting display to none on the fcontainer element.
|
||||
// In order to calculate the offsetWidth, the iframe must be visible within the DOM, otherwise it's offsetWidth is
|
||||
// calculate as 0px.
|
||||
// We attempt to find any collapsed element, uncollapse them, then calculate the width and height, and finally
|
||||
// collapse them again.
|
||||
var collapsedContainer = DOM.getParent(ifr, 'fieldset.collapsed');
|
||||
if (collapsedContainer) {
|
||||
DOM.removeClass(collapsedContainer, 'collapsed');
|
||||
}
|
||||
// For very small text areas - allow the editable region to be smaller than the size of the toolbars.
|
||||
if (rows >= 3) {
|
||||
DOM.setStyle(ifr, 'height',DOM.getSize(ifr).h + dy); // Resize iframe
|
||||
ed.theme.deltaHeight += dy; // For resize cookie
|
||||
}
|
||||
|
||||
// Set all the containers to the same width
|
||||
DOM.setStyle(textarea, 'width','100%');
|
||||
DOM.setStyle(parcon, 'width','100%');
|
||||
DOM.setStyle(tablecon, 'width','100%');
|
||||
DOM.setStyle(ifr, 'width','100%');
|
||||
|
||||
|
||||
if (collapsedContainer) {
|
||||
// We have a collapsedContainer, so collapse it again.
|
||||
DOM.addClass(collapsedContainer, 'collapsed');
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'PDW Toggle Toolbars',
|
||||
author : 'Guido Neele',
|
||||
authorurl : 'http://www.neele.name/',
|
||||
infourl : 'http://www.neele.name/pdw_toggle_toolbars',
|
||||
version : "1.2"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('pdw', tinymce.plugins.pdw);
|
||||
})();
|
||||
|
Before Width: | Height: | Size: 2.8 KiB |
@ -1,3 +0,0 @@
|
||||
tinyMCE.addI18n('en.pdw',{
|
||||
desc : 'Show/hide toolbars'
|
||||
});
|
@ -1,3 +0,0 @@
|
||||
tinyMCE.addI18n('nl.pdw',{
|
||||
desc : 'Toon/verberg werkbalken'
|
||||
});
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* TinyMCE image insert/edit plugin version details.
|
||||
*
|
||||
* @package tinymce_pdw
|
||||
* @copyright 2013 Jason Fowler
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2022112800;
|
||||
// Required Moodle version.
|
||||
$plugin->requires = 2022111800;
|
||||
// Full name of the plugin (used for diagnostics).
|
||||
$plugin->component = 'tinymce_pdw';
|
@ -1,35 +0,0 @@
|
||||
Version 2.0.6.1 (2012-11-16)
|
||||
Fixed security issue with google spellchecker.
|
||||
Version 2.0.6 (2011-09-29)
|
||||
Fixed incorrect position of suggestion menu.
|
||||
Fixed handling of mispelled words with no suggestions in PSpellShell engine.
|
||||
Fixed PSpellShell command on Windows.
|
||||
Fixed bug where Javascript error is produced when enchant_dict_suggest() returns unexpected result.
|
||||
Version 2.0.5 (2011-03-24)
|
||||
Merged with the latest TinyMCE spellchecker version.
|
||||
Version 2.0.4 (2010-12-20)
|
||||
Fixed issue with the JSON class not having the correct number of parameters to ord calls.
|
||||
Version 2.0.3 (2010-04-19)
|
||||
Added standalone support. Will use native spellchecker for supported browsers.
|
||||
Added @package phpdoc comments. Patch contributed by Jacob Santos.
|
||||
Fixed some PHP missing function issue.
|
||||
Version 2.0.2 (2008-04-30)
|
||||
Added new EnchantSpell engine class contributed by Michel Weimerskirch.
|
||||
Added new general.remote_rpc_url option, enables you to proxy requests to another server.
|
||||
Fixed security hole in PSpellShell.php file if PSpellShell engine was used.
|
||||
Version 2.0.1 (2008-03-07)
|
||||
Fixed bug where spellchecker was auto focusing the editor in IE.
|
||||
Version 2.0 (2008-01-30)
|
||||
Fixed bug where the suggestions menu was placed at an incorrect location.
|
||||
Version 2.0rc1 (2008-01-14)
|
||||
Moved package from beta to release candidate.
|
||||
Version 2.0b3 (2007-12-xx)
|
||||
Fixed bug where the suggestions menu could appear at the wrong location.
|
||||
Version 2.0b2 (2007-11-29)
|
||||
Fixed bug where the spellchecker was removing the word when it was ignored.
|
||||
Version 2.0b1 (2007-11-21)
|
||||
Moved spellchecker from alpha to beta status.
|
||||
Version 2.0a2 (2007-11-13)
|
||||
Updated plugin so it works correctly with the TinyMCE 3.0a3 version.
|
||||
Version 2.0a1 (2007-11-01)
|
||||
Rewritten version for TinyMCE 3.0 this new version uses JSON RPC.
|
@ -1,71 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* This class was contributed by Michel Weimerskirch.
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class EnchantSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
|
||||
* @param Array $words Array of words to check.
|
||||
* @return Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$r = enchant_broker_init();
|
||||
|
||||
if (enchant_broker_dict_exists($r,$lang)) {
|
||||
$d = enchant_broker_request_dict($r, $lang);
|
||||
|
||||
$returnData = array();
|
||||
foreach($words as $key => $value) {
|
||||
$correct = enchant_dict_check($d, $value);
|
||||
if(!$correct) {
|
||||
$returnData[] = trim($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $returnData;
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
|
||||
}
|
||||
enchant_broker_free($r);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions for a specific word.
|
||||
*
|
||||
* @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
|
||||
* @param String $word Specific word to get suggestions for.
|
||||
* @return Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$r = enchant_broker_init();
|
||||
|
||||
if (enchant_broker_dict_exists($r,$lang)) {
|
||||
$d = enchant_broker_request_dict($r, $lang);
|
||||
$suggs = enchant_dict_suggest($d, $word);
|
||||
|
||||
// enchant_dict_suggest() sometimes returns NULL
|
||||
if (!is_array($suggs))
|
||||
$suggs = array();
|
||||
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
$suggs = array();
|
||||
}
|
||||
|
||||
enchant_broker_free($r);
|
||||
|
||||
return $suggs;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,182 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <EFBFBD> 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class GoogleSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$wordstr = implode(' ', $words);
|
||||
$matches = $this->_getMatches($lang, $wordstr);
|
||||
$words = array();
|
||||
|
||||
for ($i=0; $i<count($matches); $i++)
|
||||
$words[] = $this->_unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8"));
|
||||
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$sug = array();
|
||||
$osug = array();
|
||||
$matches = $this->_getMatches($lang, $word);
|
||||
|
||||
if (count($matches) > 0)
|
||||
$sug = explode("\t", $this->_unhtmlentities($matches[0][4]));
|
||||
|
||||
// Remove empty
|
||||
foreach ($sug as $item) {
|
||||
if ($item)
|
||||
$osug[] = $item;
|
||||
}
|
||||
|
||||
return $osug;
|
||||
}
|
||||
|
||||
function &_getMatches($lang, $str) {
|
||||
$lang = preg_replace('/[^a-z\-]/i', '', $lang); // Sanitize, remove everything but a-z or -
|
||||
$str = preg_replace('/[\x00-\x1F\x7F]/', '', $str); // Sanitize, remove all control characters
|
||||
$server = "www.google.com";
|
||||
$port = 443;
|
||||
$path = "/tbproxy/spell?lang=" . $lang . "&hl=en";
|
||||
$host = "www.google.com";
|
||||
$url = "https://" . $server;
|
||||
|
||||
// Setup XML request
|
||||
$xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $str . '</text></spellrequest>';
|
||||
|
||||
$header = "POST ".$path." HTTP/1.0 \r\n";
|
||||
$header .= "MIME-Version: 1.0 \r\n";
|
||||
$header .= "Content-type: application/PTI26 \r\n";
|
||||
$header .= "Content-length: ".strlen($xml)." \r\n";
|
||||
$header .= "Content-transfer-encoding: text \r\n";
|
||||
$header .= "Request-number: 1 \r\n";
|
||||
$header .= "Document-type: Request \r\n";
|
||||
$header .= "Interface-Version: Test 1.4 \r\n";
|
||||
$header .= "Connection: close \r\n\r\n";
|
||||
$header .= $xml;
|
||||
|
||||
// Use curl if it exists
|
||||
if (function_exists('curl_init')) {
|
||||
// Use curl
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,$url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
if (!empty($this->_config['GoogleSpell.proxyhost'])) {
|
||||
if (!empty($this->_config['GoogleSpell.proxytype']) and ($this->_config['GoogleSpell.proxytype'] === 'SOCKS5')) {
|
||||
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTML);
|
||||
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, FALSE);
|
||||
}
|
||||
if (empty($this->_config['GoogleSpell.proxyport'])) {
|
||||
curl_setopt($ch, CURLOPT_PROXY, $this->_config['GoogleSpell.proxyhost']);
|
||||
} else {
|
||||
curl_setopt($ch, CURLOPT_PROXY, $this->_config['GoogleSpell.proxyhost'].':'.$this->_config['GoogleSpell.proxyport']);
|
||||
}
|
||||
if (!empty($this->_config['GoogleSpell.proxyuser']) and !empty($this->_config['GoogleSpell.proxypassword'])) {
|
||||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $this->_config['GoogleSpell.proxyuser'].':'.$this->_config['GoogleSpell.proxypassword']);
|
||||
if (defined('CURLOPT_PROXYAUTH')) {
|
||||
// any proxy authentication if PHP 5.1
|
||||
curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
|
||||
}
|
||||
}
|
||||
}
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
} else {
|
||||
// Use raw sockets
|
||||
$fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30);
|
||||
if ($fp) {
|
||||
// Send request
|
||||
fwrite($fp, $header);
|
||||
|
||||
// Read response
|
||||
$xml = "";
|
||||
while (!feof($fp))
|
||||
$xml .= fgets($fp, 128);
|
||||
|
||||
fclose($fp);
|
||||
} else
|
||||
echo "Could not open SSL connection to google.";
|
||||
}
|
||||
|
||||
// Grab and parse content
|
||||
$matches = array();
|
||||
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
|
||||
|
||||
return $matches;
|
||||
}
|
||||
|
||||
function _unhtmlentities($string) {
|
||||
return core_text::entities_to_utf8($string); // Moodle hack
|
||||
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
|
||||
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
|
||||
|
||||
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
|
||||
$trans_tbl = array_flip($trans_tbl);
|
||||
|
||||
return strtr($string, $trans_tbl);
|
||||
}
|
||||
}
|
||||
|
||||
// Patch in multibyte support
|
||||
if (!function_exists('mb_substr')) {
|
||||
function mb_substr($str, $start, $len = '', $encoding="UTF-8"){
|
||||
$limit = strlen($str);
|
||||
|
||||
for ($s = 0; $start > 0;--$start) {// found the real start
|
||||
if ($s >= $limit)
|
||||
break;
|
||||
|
||||
if ($str[$s] <= "\x7F")
|
||||
++$s;
|
||||
else {
|
||||
++$s; // skip length
|
||||
|
||||
while ($str[$s] >= "\x80" && $str[$s] <= "\xBF")
|
||||
++$s;
|
||||
}
|
||||
}
|
||||
|
||||
if ($len == '')
|
||||
return substr($str, $s);
|
||||
else
|
||||
for ($e = $s; $len > 0; --$len) {//found the real end
|
||||
if ($e >= $limit)
|
||||
break;
|
||||
|
||||
if ($str[$e] <= "\x7F")
|
||||
++$e;
|
||||
else {
|
||||
++$e;//skip length
|
||||
|
||||
while ($str[$e] >= "\x80" && $str[$e] <= "\xBF" && $e < $limit)
|
||||
++$e;
|
||||
}
|
||||
}
|
||||
|
||||
return substr($str, $s, $e - $s);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class PSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$plink = $this->_getPLink($lang);
|
||||
|
||||
$outWords = array();
|
||||
foreach ($words as $word) {
|
||||
if (!pspell_check($plink, trim($word)))
|
||||
$outWords[] = $word;
|
||||
}
|
||||
|
||||
return $outWords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$words = pspell_suggest($this->_getPLink($lang), $word);
|
||||
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a link for pspell.
|
||||
*/
|
||||
function &_getPLink($lang) {
|
||||
// Check for native PSpell support
|
||||
if (!function_exists("pspell_new"))
|
||||
$this->throwError("PSpell support not found in PHP installation.");
|
||||
|
||||
// Setup PSpell link
|
||||
$plink = pspell_new(
|
||||
$lang,
|
||||
$this->_config['PSpell.spelling'],
|
||||
$this->_config['PSpell.jargon'],
|
||||
empty($this->_config['PSpell.encoding']) ? 'utf-8' : $this->_config['PSpell.encoding'],
|
||||
$this->_config['PSpell.mode']
|
||||
);
|
||||
|
||||
// Setup PSpell link
|
||||
/* if (!$plink) {
|
||||
$pspellConfig = pspell_config_create(
|
||||
$lang,
|
||||
$this->_config['PSpell.spelling'],
|
||||
$this->_config['PSpell.jargon'],
|
||||
$this->_config['PSpell.encoding']
|
||||
);
|
||||
|
||||
$plink = pspell_new_config($pspell_config);
|
||||
}*/
|
||||
|
||||
if (!$plink)
|
||||
$this->throwError("No PSpell link found opened.");
|
||||
|
||||
return $plink;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,114 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class PSpellShell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$cmd = $this->_getCMD($lang);
|
||||
|
||||
if ($fh = fopen($this->_tmpfile, "w")) {
|
||||
fwrite($fh, "!\n");
|
||||
|
||||
foreach($words as $key => $value)
|
||||
fwrite($fh, "^" . $value . "\n");
|
||||
|
||||
fclose($fh);
|
||||
} else
|
||||
$this->throwError("PSpell support was not found.");
|
||||
|
||||
$data = shell_exec($cmd);
|
||||
@unlink($this->_tmpfile);
|
||||
|
||||
$returnData = array();
|
||||
$dataArr = preg_split("/[\r\n]/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach ($dataArr as $dstr) {
|
||||
$matches = array();
|
||||
|
||||
// Skip this line.
|
||||
if ($dstr[0] == "@")
|
||||
continue;
|
||||
|
||||
preg_match("/(\&|#) ([^ ]+) .*/i", $dstr, $matches);
|
||||
|
||||
if (!empty($matches[2]))
|
||||
$returnData[] = mb_convert_encoding(trim($matches[2]), 'UTF-8', 'ISO-8859-1');
|
||||
}
|
||||
|
||||
return $returnData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$cmd = $this->_getCMD($lang);
|
||||
|
||||
$word = mb_convert_encoding($word, 'ISO-8859-1', 'UTF-8');
|
||||
|
||||
if ($fh = fopen($this->_tmpfile, "w")) {
|
||||
fwrite($fh, "!\n");
|
||||
fwrite($fh, "^$word\n");
|
||||
fclose($fh);
|
||||
} else
|
||||
$this->throwError("Error opening tmp file.");
|
||||
|
||||
$data = shell_exec($cmd);
|
||||
@unlink($this->_tmpfile);
|
||||
|
||||
$returnData = array();
|
||||
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach($dataArr as $dstr) {
|
||||
$matches = array();
|
||||
|
||||
// Skip this line.
|
||||
if ($dstr[0] == "@")
|
||||
continue;
|
||||
|
||||
preg_match("/\&[^:]+:(.*)/i", $dstr, $matches);
|
||||
|
||||
if (!empty($matches[1])) {
|
||||
$words = array_slice(explode(',', $matches[1]), 0, 10);
|
||||
|
||||
for ($i=0; $i<count($words); $i++)
|
||||
$words[$i] = trim($words[$i]);
|
||||
|
||||
return $words;
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
function _getCMD($lang) {
|
||||
$this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
|
||||
|
||||
$file = $this->_tmpfile;
|
||||
$lang = preg_replace("/[^-_a-z]/", "", strtolower($lang));
|
||||
$bin = $this->_config['PSpellShell.aspell'];
|
||||
|
||||
if (preg_match("#win#i", php_uname()))
|
||||
return "$bin -a --lang=$lang --encoding=utf-8 -H < $file 2>&1";
|
||||
|
||||
return "cat $file | $bin -a --lang=$lang --encoding=utf-8 -H";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,72 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class SpellChecker {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param $config Configuration name/value array.
|
||||
*/
|
||||
public function __construct(&$config) {
|
||||
$this->_config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function SpellChecker(&$config) {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple loopback function everything that gets in will be send back.
|
||||
*
|
||||
* @param $args.. Arguments.
|
||||
* @return {Array} Array of all input arguments.
|
||||
*/
|
||||
function &loopback(/* args.. */) {
|
||||
return func_get_args();
|
||||
}
|
||||
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an error message back to the user. This will stop all execution.
|
||||
*
|
||||
* @param {String} $str Message to send back to user.
|
||||
*/
|
||||
function throwError($str) {
|
||||
die('{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy Subsystem implementation for tinymce_spellchecker.
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tinymce_spellchecker\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for tinymce_spellchecker implementing null_provider.
|
||||
*
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
@ -1,615 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: JSON.php 40 2007-06-18 11:43:15Z spocke $
|
||||
*
|
||||
* @package MCManager.utils
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
define('JSON_BOOL', 1);
|
||||
define('JSON_INT', 2);
|
||||
define('JSON_STR', 3);
|
||||
define('JSON_FLOAT', 4);
|
||||
define('JSON_NULL', 5);
|
||||
define('JSON_START_OBJ', 6);
|
||||
define('JSON_END_OBJ', 7);
|
||||
define('JSON_START_ARRAY', 8);
|
||||
define('JSON_END_ARRAY', 9);
|
||||
define('JSON_KEY', 10);
|
||||
define('JSON_SKIP', 11);
|
||||
|
||||
define('JSON_IN_ARRAY', 30);
|
||||
define('JSON_IN_OBJECT', 40);
|
||||
define('JSON_IN_BETWEEN', 50);
|
||||
|
||||
class Moxiecode_JSONReader {
|
||||
var $_data, $_len, $_pos;
|
||||
var $_value, $_token;
|
||||
var $_location, $_lastLocations;
|
||||
var $_needProp;
|
||||
|
||||
public function __construct($data) {
|
||||
$this->_data = $data;
|
||||
$this->_len = strlen($data);
|
||||
$this->_pos = -1;
|
||||
$this->_location = JSON_IN_BETWEEN;
|
||||
$this->_lastLocations = array();
|
||||
$this->_needProp = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function Moxiecode_JSONReader($data) {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct($data);
|
||||
}
|
||||
|
||||
function getToken() {
|
||||
return $this->_token;
|
||||
}
|
||||
|
||||
function getLocation() {
|
||||
return $this->_location;
|
||||
}
|
||||
|
||||
function getTokenName() {
|
||||
switch ($this->_token) {
|
||||
case JSON_BOOL:
|
||||
return 'JSON_BOOL';
|
||||
|
||||
case JSON_INT:
|
||||
return 'JSON_INT';
|
||||
|
||||
case JSON_STR:
|
||||
return 'JSON_STR';
|
||||
|
||||
case JSON_FLOAT:
|
||||
return 'JSON_FLOAT';
|
||||
|
||||
case JSON_NULL:
|
||||
return 'JSON_NULL';
|
||||
|
||||
case JSON_START_OBJ:
|
||||
return 'JSON_START_OBJ';
|
||||
|
||||
case JSON_END_OBJ:
|
||||
return 'JSON_END_OBJ';
|
||||
|
||||
case JSON_START_ARRAY:
|
||||
return 'JSON_START_ARRAY';
|
||||
|
||||
case JSON_END_ARRAY:
|
||||
return 'JSON_END_ARRAY';
|
||||
|
||||
case JSON_KEY:
|
||||
return 'JSON_KEY';
|
||||
}
|
||||
|
||||
return 'UNKNOWN';
|
||||
}
|
||||
|
||||
function getValue() {
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
function readToken() {
|
||||
$chr = $this->read();
|
||||
|
||||
if ($chr != null) {
|
||||
switch ($chr) {
|
||||
case '[':
|
||||
$this->_lastLocation[] = $this->_location;
|
||||
$this->_location = JSON_IN_ARRAY;
|
||||
$this->_token = JSON_START_ARRAY;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
return true;
|
||||
|
||||
case ']':
|
||||
$this->_location = array_pop($this->_lastLocation);
|
||||
$this->_token = JSON_END_ARRAY;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
|
||||
case '{':
|
||||
$this->_lastLocation[] = $this->_location;
|
||||
$this->_location = JSON_IN_OBJECT;
|
||||
$this->_needProp = true;
|
||||
$this->_token = JSON_START_OBJ;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
return true;
|
||||
|
||||
case '}':
|
||||
$this->_location = array_pop($this->_lastLocation);
|
||||
$this->_token = JSON_END_OBJ;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
|
||||
// String
|
||||
case '"':
|
||||
case '\'':
|
||||
return $this->_readString($chr);
|
||||
|
||||
// Null
|
||||
case 'n':
|
||||
return $this->_readNull();
|
||||
|
||||
// Bool
|
||||
case 't':
|
||||
case 'f':
|
||||
return $this->_readBool($chr);
|
||||
|
||||
default:
|
||||
// Is number
|
||||
if (is_numeric($chr) || $chr == '-' || $chr == '.')
|
||||
return $this->_readNumber($chr);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _readBool($chr) {
|
||||
$this->_token = JSON_BOOL;
|
||||
$this->_value = $chr == 't';
|
||||
|
||||
if ($chr == 't')
|
||||
$this->skip(3); // rue
|
||||
else
|
||||
$this->skip(4); // alse
|
||||
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _readNull() {
|
||||
$this->_token = JSON_NULL;
|
||||
$this->_value = null;
|
||||
|
||||
$this->skip(3); // ull
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _readString($quote) {
|
||||
$output = "";
|
||||
$this->_token = JSON_STR;
|
||||
$endString = false;
|
||||
|
||||
while (($chr = $this->peek()) != -1) {
|
||||
switch ($chr) {
|
||||
case '\\':
|
||||
// Read away slash
|
||||
$this->read();
|
||||
|
||||
// Read escape code
|
||||
$chr = $this->read();
|
||||
switch ($chr) {
|
||||
case 't':
|
||||
$output .= "\t";
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
$output .= "\b";
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
$output .= "\f";
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
$output .= "\r";
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
$output .= "\n";
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
$output .= $this->_int2utf8(hexdec($this->read(4)));
|
||||
break;
|
||||
|
||||
default:
|
||||
$output .= $chr;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
case '"':
|
||||
if ($chr == $quote)
|
||||
$endString = true;
|
||||
|
||||
$chr = $this->read();
|
||||
if ($chr != -1 && $chr != $quote)
|
||||
$output .= $chr;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$output .= $this->read();
|
||||
}
|
||||
|
||||
// String terminated
|
||||
if ($endString)
|
||||
break;
|
||||
}
|
||||
|
||||
$this->readAway();
|
||||
$this->_value = $output;
|
||||
|
||||
// Needed a property
|
||||
if ($this->_needProp) {
|
||||
$this->_token = JSON_KEY;
|
||||
$this->_needProp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _int2utf8($int) {
|
||||
$int = intval($int);
|
||||
|
||||
switch ($int) {
|
||||
case 0:
|
||||
return chr(0);
|
||||
|
||||
case ($int & 0x7F):
|
||||
return chr($int);
|
||||
|
||||
case ($int & 0x7FF):
|
||||
return chr(0xC0 | (($int >> 6) & 0x1F)) . chr(0x80 | ($int & 0x3F));
|
||||
|
||||
case ($int & 0xFFFF):
|
||||
return chr(0xE0 | (($int >> 12) & 0x0F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr (0x80 | ($int & 0x3F));
|
||||
|
||||
case ($int & 0x1FFFFF):
|
||||
return chr(0xF0 | ($int >> 18)) . chr(0x80 | (($int >> 12) & 0x3F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr(0x80 | ($int & 0x3F));
|
||||
}
|
||||
}
|
||||
|
||||
function _readNumber($start) {
|
||||
$value = "";
|
||||
$isFloat = false;
|
||||
|
||||
$this->_token = JSON_INT;
|
||||
$value .= $start;
|
||||
|
||||
while (($chr = $this->peek()) != -1) {
|
||||
if (is_numeric($chr) || $chr == '-' || $chr == '.') {
|
||||
if ($chr == '.')
|
||||
$isFloat = true;
|
||||
|
||||
$value .= $this->read();
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
$this->readAway();
|
||||
|
||||
if ($isFloat) {
|
||||
$this->_token = JSON_FLOAT;
|
||||
$this->_value = floatval($value);
|
||||
} else
|
||||
$this->_value = intval($value);
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function readAway() {
|
||||
while (($chr = $this->peek()) != null) {
|
||||
if ($chr != ':' && $chr != ',' && $chr != ' ')
|
||||
return;
|
||||
|
||||
$this->read();
|
||||
}
|
||||
}
|
||||
|
||||
function read($len = 1) {
|
||||
if ($this->_pos < $this->_len) {
|
||||
if ($len > 1) {
|
||||
$str = substr($this->_data, $this->_pos + 1, $len);
|
||||
$this->_pos += $len;
|
||||
|
||||
return $str;
|
||||
} else
|
||||
return $this->_data[++$this->_pos];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function skip($len) {
|
||||
$this->_pos += $len;
|
||||
}
|
||||
|
||||
function peek() {
|
||||
if ($this->_pos < $this->_len)
|
||||
return $this->_data[$this->_pos + 1];
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class handles JSON stuff.
|
||||
*
|
||||
* @package MCManager.utils
|
||||
*/
|
||||
class Moxiecode_JSON {
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function Moxiecode_JSON() {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct();
|
||||
}
|
||||
|
||||
function decode($input) {
|
||||
$reader = new Moxiecode_JSONReader($input);
|
||||
|
||||
return $this->readValue($reader);
|
||||
}
|
||||
|
||||
function readValue(&$reader) {
|
||||
$this->data = array();
|
||||
$this->parents = array();
|
||||
$this->cur =& $this->data;
|
||||
$key = null;
|
||||
$loc = JSON_IN_ARRAY;
|
||||
|
||||
while ($reader->readToken()) {
|
||||
switch ($reader->getToken()) {
|
||||
case JSON_STR:
|
||||
case JSON_INT:
|
||||
case JSON_BOOL:
|
||||
case JSON_FLOAT:
|
||||
case JSON_NULL:
|
||||
switch ($reader->getLocation()) {
|
||||
case JSON_IN_OBJECT:
|
||||
$this->cur[$key] = $reader->getValue();
|
||||
break;
|
||||
|
||||
case JSON_IN_ARRAY:
|
||||
$this->cur[] = $reader->getValue();
|
||||
break;
|
||||
|
||||
default:
|
||||
return $reader->getValue();
|
||||
}
|
||||
break;
|
||||
|
||||
case JSON_KEY:
|
||||
$key = $reader->getValue();
|
||||
break;
|
||||
|
||||
case JSON_START_OBJ:
|
||||
case JSON_START_ARRAY:
|
||||
if ($loc == JSON_IN_OBJECT)
|
||||
$this->addArray($key);
|
||||
else
|
||||
$this->addArray(null);
|
||||
|
||||
$cur =& $obj;
|
||||
|
||||
$loc = $reader->getLocation();
|
||||
break;
|
||||
|
||||
case JSON_END_OBJ:
|
||||
case JSON_END_ARRAY:
|
||||
$loc = $reader->getLocation();
|
||||
|
||||
if (count($this->parents) > 0) {
|
||||
$this->cur =& $this->parents[count($this->parents) - 1];
|
||||
array_pop($this->parents);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->data[0];
|
||||
}
|
||||
|
||||
// This method was needed since PHP is crapy and doesn't have pointers/references
|
||||
function addArray($key) {
|
||||
$this->parents[] =& $this->cur;
|
||||
$ar = array();
|
||||
|
||||
if ($key)
|
||||
$this->cur[$key] =& $ar;
|
||||
else
|
||||
$this->cur[] =& $ar;
|
||||
|
||||
$this->cur =& $ar;
|
||||
}
|
||||
|
||||
function getDelim($index, &$reader) {
|
||||
switch ($reader->getLocation()) {
|
||||
case JSON_IN_ARRAY:
|
||||
case JSON_IN_OBJECT:
|
||||
if ($index > 0)
|
||||
return ",";
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function encode($input) {
|
||||
switch (gettype($input)) {
|
||||
case 'boolean':
|
||||
return $input ? 'true' : 'false';
|
||||
|
||||
case 'integer':
|
||||
return (int) $input;
|
||||
|
||||
case 'float':
|
||||
case 'double':
|
||||
return (float) $input;
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'string':
|
||||
return $this->encodeString($input);
|
||||
|
||||
case 'array':
|
||||
return $this->_encodeArray($input);
|
||||
|
||||
case 'object':
|
||||
return $this->_encodeArray(get_object_vars($input));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function encodeString($input) {
|
||||
// Needs to be escaped
|
||||
if (preg_match('/[^a-zA-Z0-9]/', $input)) {
|
||||
$output = '';
|
||||
|
||||
for ($i=0; $i<strlen($input); $i++) {
|
||||
switch ($input[$i]) {
|
||||
case "\b":
|
||||
$output .= "\\b";
|
||||
break;
|
||||
|
||||
case "\t":
|
||||
$output .= "\\t";
|
||||
break;
|
||||
|
||||
case "\f":
|
||||
$output .= "\\f";
|
||||
break;
|
||||
|
||||
case "\r":
|
||||
$output .= "\\r";
|
||||
break;
|
||||
|
||||
case "\n":
|
||||
$output .= "\\n";
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
$output .= "\\\\";
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
$output .= "\\'";
|
||||
break;
|
||||
|
||||
case '"':
|
||||
$output .= '\"';
|
||||
break;
|
||||
|
||||
default:
|
||||
$byte = ord($input[$i]);
|
||||
|
||||
if (($byte & 0xE0) == 0xC0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]));
|
||||
$i += 1;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xF0) == 0xE0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]));
|
||||
$i += 2;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xF8) == 0xF0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]));
|
||||
$i += 3;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xFC) == 0xF8) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]), ord($input[$i + 4]));
|
||||
$i += 4;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xFE) == 0xFC) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]), ord($input[$i + 4]), ord($input[$i + 5]));
|
||||
$i += 5;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} else if ($byte < 128)
|
||||
$output .= $input[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return '"' . $output . '"';
|
||||
}
|
||||
|
||||
return '"' . $input . '"';
|
||||
}
|
||||
|
||||
function _utf82utf16($utf8) {
|
||||
if (function_exists('mb_convert_encoding'))
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
|
||||
switch (strlen($utf8)) {
|
||||
case 1:
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1])));
|
||||
|
||||
case 3:
|
||||
return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2])));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function _encodeArray($input) {
|
||||
$output = '';
|
||||
$isIndexed = true;
|
||||
|
||||
$keys = array_keys($input);
|
||||
for ($i=0; $i<count($keys); $i++) {
|
||||
if (!is_int($keys[$i])) {
|
||||
$output .= $this->encodeString($keys[$i]) . ':' . $this->encode($input[$keys[$i]]);
|
||||
$isIndexed = false;
|
||||
} else
|
||||
$output .= $this->encode($input[$keys[$i]]);
|
||||
|
||||
if ($i != count($keys) - 1)
|
||||
$output .= ',';
|
||||
}
|
||||
|
||||
return $isIndexed ? '[' . $output . ']' : '{' . $output . '}';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,278 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: Logger.class.php 10 2007-05-27 10:55:12Z spocke $
|
||||
*
|
||||
* @package MCFileManager.filesystems
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
// File type contstants
|
||||
define('MC_LOGGER_DEBUG', 0);
|
||||
define('MC_LOGGER_INFO', 10);
|
||||
define('MC_LOGGER_WARN', 20);
|
||||
define('MC_LOGGER_ERROR', 30);
|
||||
define('MC_LOGGER_FATAL', 40);
|
||||
|
||||
/**
|
||||
* Logging utility class. This class handles basic logging with levels, log rotation and custom log formats. It's
|
||||
* designed to be compact but still powerful and flexible.
|
||||
*/
|
||||
class Moxiecode_Logger {
|
||||
// Private fields
|
||||
var $_path;
|
||||
var $_filename;
|
||||
var $_maxSize;
|
||||
var $_maxFiles;
|
||||
var $_maxSizeBytes;
|
||||
var $_level;
|
||||
var $_format;
|
||||
|
||||
/**
|
||||
* Constructs a new logger instance.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->_path = "";
|
||||
$this->_filename = "{level}.log";
|
||||
$this->setMaxSize("100k");
|
||||
$this->_maxFiles = 10;
|
||||
$this->_level = MC_LOGGER_DEBUG;
|
||||
$this->_format = "[{time}] [{level}] {message}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function Moxiecode_Logger() {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current log level, use the MC_LOGGER constants.
|
||||
*
|
||||
* @param int $level Log level instance for example MC_LOGGER_DEBUG.
|
||||
*/
|
||||
function setLevel($level) {
|
||||
if (is_string($level)) {
|
||||
switch (strtolower($level)) {
|
||||
case "debug":
|
||||
$level = MC_LOGGER_DEBUG;
|
||||
break;
|
||||
|
||||
case "info":
|
||||
$level = MC_LOGGER_INFO;
|
||||
break;
|
||||
|
||||
case "warn":
|
||||
case "warning":
|
||||
$level = MC_LOGGER_WARN;
|
||||
break;
|
||||
|
||||
case "error":
|
||||
$level = MC_LOGGER_ERROR;
|
||||
break;
|
||||
|
||||
case "fatal":
|
||||
$level = MC_LOGGER_FATAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
$level = MC_LOGGER_FATAL;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_level = $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current log level for example MC_LOGGER_DEBUG.
|
||||
*
|
||||
* @return int Current log level for example MC_LOGGER_DEBUG.
|
||||
*/
|
||||
function getLevel() {
|
||||
return $this->_level;
|
||||
}
|
||||
|
||||
function setPath($path) {
|
||||
$this->_path = $path;
|
||||
}
|
||||
|
||||
function getPath() {
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
function setFileName($file_name) {
|
||||
$this->_filename = $file_name;
|
||||
}
|
||||
|
||||
function getFileName() {
|
||||
return $this->_filename;
|
||||
}
|
||||
|
||||
function setFormat($format) {
|
||||
$this->_format = $format;
|
||||
}
|
||||
|
||||
function getFormat() {
|
||||
return $this->_format;
|
||||
}
|
||||
|
||||
function setMaxSize($size) {
|
||||
// Fix log max size
|
||||
$logMaxSizeBytes = intval(preg_replace("/[^0-9]/", "", $size));
|
||||
|
||||
// Is KB
|
||||
if (strpos((strtolower($size)), "k") > 0)
|
||||
$logMaxSizeBytes *= 1024;
|
||||
|
||||
// Is MB
|
||||
if (strpos((strtolower($size)), "m") > 0)
|
||||
$logMaxSizeBytes *= (1024 * 1024);
|
||||
|
||||
$this->_maxSizeBytes = $logMaxSizeBytes;
|
||||
$this->_maxSize = $size;
|
||||
}
|
||||
|
||||
function getMaxSize() {
|
||||
return $this->_maxSize;
|
||||
}
|
||||
|
||||
function setMaxFiles($max_files) {
|
||||
$this->_maxFiles = $max_files;
|
||||
}
|
||||
|
||||
function getMaxFiles() {
|
||||
return $this->_maxFiles;
|
||||
}
|
||||
|
||||
function debug($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_DEBUG, implode(', ', $args));
|
||||
}
|
||||
|
||||
function info($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_INFO, implode(', ', $args));
|
||||
}
|
||||
|
||||
function warn($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_WARN, implode(', ', $args));
|
||||
}
|
||||
|
||||
function error($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_ERROR, implode(', ', $args));
|
||||
}
|
||||
|
||||
function fatal($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_FATAL, implode(', ', $args));
|
||||
}
|
||||
|
||||
function isDebugEnabled() {
|
||||
return $this->_level >= MC_LOGGER_DEBUG;
|
||||
}
|
||||
|
||||
function isInfoEnabled() {
|
||||
return $this->_level >= MC_LOGGER_INFO;
|
||||
}
|
||||
|
||||
function isWarnEnabled() {
|
||||
return $this->_level >= MC_LOGGER_WARN;
|
||||
}
|
||||
|
||||
function isErrorEnabled() {
|
||||
return $this->_level >= MC_LOGGER_ERROR;
|
||||
}
|
||||
|
||||
function isFatalEnabled() {
|
||||
return $this->_level >= MC_LOGGER_FATAL;
|
||||
}
|
||||
|
||||
function _logMsg($level, $message) {
|
||||
$roll = false;
|
||||
|
||||
if ($level < $this->_level)
|
||||
return;
|
||||
|
||||
$logFile = $this->toOSPath($this->_path . "/" . $this->_filename);
|
||||
|
||||
switch ($level) {
|
||||
case MC_LOGGER_DEBUG:
|
||||
$levelName = "DEBUG";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_INFO:
|
||||
$levelName = "INFO";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_WARN:
|
||||
$levelName = "WARN";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_ERROR:
|
||||
$levelName = "ERROR";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_FATAL:
|
||||
$levelName = "FATAL";
|
||||
break;
|
||||
}
|
||||
|
||||
$logFile = str_replace('{level}', strtolower($levelName), $logFile);
|
||||
|
||||
$text = $this->_format;
|
||||
$text = str_replace('{time}', date("Y-m-d H:i:s"), $text);
|
||||
$text = str_replace('{level}', strtolower($levelName), $text);
|
||||
$text = str_replace('{message}', $message, $text);
|
||||
$message = $text . "\r\n";
|
||||
|
||||
// Check filesize
|
||||
if (file_exists($logFile)) {
|
||||
$size = @filesize($logFile);
|
||||
|
||||
if ($size + strlen($message) > $this->_maxSizeBytes)
|
||||
$roll = true;
|
||||
}
|
||||
|
||||
// Roll if the size is right
|
||||
if ($roll) {
|
||||
for ($i=$this->_maxFiles-1; $i>=1; $i--) {
|
||||
$rfile = $this->toOSPath($logFile . "." . $i);
|
||||
$nfile = $this->toOSPath($logFile . "." . ($i+1));
|
||||
|
||||
if (@file_exists($rfile))
|
||||
@rename($rfile, $nfile);
|
||||
}
|
||||
|
||||
@rename($logFile, $this->toOSPath($logFile . ".1"));
|
||||
|
||||
// Delete last logfile
|
||||
$delfile = $this->toOSPath($logFile . "." . ($this->_maxFiles + 1));
|
||||
if (@file_exists($delfile))
|
||||
@unlink($delfile);
|
||||
}
|
||||
|
||||
// Append log line
|
||||
if (($fp = @fopen($logFile, "a")) != null) {
|
||||
@fputs($fp, $message);
|
||||
@fflush($fp);
|
||||
@fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Unix path to OS specific path.
|
||||
*
|
||||
* @param String $path Unix path to convert.
|
||||
*/
|
||||
function toOSPath($path) {
|
||||
return str_replace("/", DIRECTORY_SEPARATOR, $path);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Spellchecker configuration. (Has been rewritten for Moodle.)
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2012 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require('../../../../../config.php');
|
||||
|
||||
@error_reporting(E_ALL ^ E_NOTICE); // Hide notices even if Moodle is configured to show them.
|
||||
|
||||
// General settings
|
||||
$engine = get_config('tinymce_spellchecker', 'spellengine');
|
||||
if (!$engine or $engine === 'GoogleSpell') {
|
||||
$engine = 'PSpell';
|
||||
}
|
||||
$config['general.engine'] = $engine;
|
||||
|
||||
if ($config['general.engine'] === 'PSpell') {
|
||||
// PSpell settings
|
||||
$config['PSpell.mode'] = PSPELL_FAST;
|
||||
$config['PSpell.spelling'] = "";
|
||||
$config['PSpell.jargon'] = "";
|
||||
$config['PSpell.encoding'] = "";
|
||||
} else if ($config['general.engine'] === 'PSpellShell') {
|
||||
// PSpellShell settings
|
||||
$config['PSpellShell.mode'] = PSPELL_FAST;
|
||||
$config['PSpellShell.aspell'] = $CFG->aspellpath;
|
||||
$config['PSpellShell.tmp'] = '/tmp';
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Spellchecker post install script.
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_tinymce_spellchecker_install() {
|
||||
global $CFG, $DB;
|
||||
require_once(__DIR__.'/upgradelib.php');
|
||||
|
||||
tinymce_spellchecker_migrate_settings();
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Spellchecker upgrade script.
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_tinymce_spellchecker_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Automatically generated Moodle v3.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Automatically generated Moodle v4.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle 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. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Spellchecker upgrade script.
|
||||
*
|
||||
* @package tinymce_spellchecker
|
||||
* @copyright 2012 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Migrate spell related settings from tinymce.
|
||||
*/
|
||||
function tinymce_spellchecker_migrate_settings() {
|
||||
$engine = get_config('editor_tinymce', 'spellengine');
|
||||
if ($engine !== false) {
|
||||
set_config('spellengine', $engine, 'tinymce_spellchecker');
|
||||
unset_config('spellengine', 'editor_tinymce');
|
||||
}
|
||||
$list = get_config('editor_tinymce', 'spelllanguagelist');
|
||||
if ($list !== false) {
|
||||
set_config('spelllanguagelist', $list, 'tinymce_spellchecker');
|
||||
unset_config('spelllanguagelist', 'editor_tinymce');
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* general.php
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <EFBFBD> 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
@error_reporting(E_ALL ^ E_NOTICE);
|
||||
$config = array();
|
||||
|
||||
require_once(__DIR__ . "/../classes/utils/Logger.php");
|
||||
require_once(__DIR__ . "/../classes/utils/JSON.php");
|
||||
require_once(__DIR__ . "/../config.php");
|
||||
require_once(__DIR__ . "/../classes/SpellChecker.php");
|
||||
|
||||
if (isset($config['general.engine']))
|
||||
require_once(__DIR__ . "/../classes/" . $config["general.engine"] . ".php");
|
||||
|
||||
/**
|
||||
* Returns an request value by name without magic quoting.
|
||||
*
|
||||
* @param String $name Name of parameter to get.
|
||||
* @param String $default_value Default value to return if value not found.
|
||||
* @return String request value by name without magic quoting or default value.
|
||||
*/
|
||||
function getRequestParam($name, $default_value = false) {
|
||||
if (!isset($_REQUEST[$name]))
|
||||
return $default_value;
|
||||
|
||||
if (is_array($_REQUEST[$name])) {
|
||||
$newarray = array();
|
||||
|
||||
foreach ($_REQUEST[$name] as $name => $value)
|
||||
$newarray[$name] = $value;
|
||||
|
||||
return $newarray;
|
||||
}
|
||||
|
||||
return $_REQUEST[$name];
|
||||
}
|
||||
|
||||
function &getLogger() {
|
||||
global $mcLogger, $man;
|
||||
|
||||
if (isset($man))
|
||||
$mcLogger = $man->getLogger();
|
||||
|
||||
if (!$mcLogger) {
|
||||
$mcLogger = new Moxiecode_Logger();
|
||||
|
||||
// Set logger options
|
||||
$mcLogger->setPath(__DIR__ . "/../logs");
|
||||
$mcLogger->setMaxSize("100kb");
|
||||
$mcLogger->setMaxFiles("10");
|
||||
$mcLogger->setFormat("{time} - {message}");
|
||||
}
|
||||
|
||||
return $mcLogger;
|
||||
}
|
||||
|
||||
function debug($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->debug(implode(', ', $args));
|
||||
}
|
||||
|
||||
function info($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->info(implode(', ', $args));
|
||||
}
|
||||
|
||||
function xx_error($msg) { // collides with our moodle error(), it does not look to be used at all
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->error(implode(', ', $args));
|
||||
}
|
||||
|
||||
function warn($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->warn(implode(', ', $args));
|
||||
}
|
||||
|
||||
function fatal($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->fatal(implode(', ', $args));
|
||||
}
|
||||
|
||||
?>
|