���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/public_html/multilangupgrade.tar
���ѧ٧ѧ�
settings.php 0000644 00000002446 15152114237 0007124 0 ustar 00 <?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/>. /** * Link to multilang upgrade script. * * @package tool * @subpackage multilangupgrade * @copyright 2011 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; if ($hassiteconfig) { // Hidden multilang upgrade page - show in settings root to get more attention. $ADMIN->add('root', new admin_externalpage('toolmultilangupgrade', get_string('pluginname', 'tool_multilangupgrade'), $CFG->wwwroot.'/'.$CFG->admin.'/tool/multilangupgrade/index.php', 'moodle/site:config', !empty($CFG->filter_multilang_converted))); } index.php 0000644 00000011711 15152114237 0006366 0 ustar 00 <?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/>. /** * Search and replace strings throughout all texts in the whole database. * * Unfortunately it was a bad idea to use spans for multilang because it * can not support nesting. Hopefully this will get thrown away soon.... * * @package tool * @subpackage multilangupgrade * @copyright 2006 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('NO_OUTPUT_BUFFERING', true); require('../../../config.php'); require_once($CFG->dirroot.'/course/lib.php'); require_once($CFG->libdir.'/adminlib.php'); admin_externalpage_setup('toolmultilangupgrade'); $go = optional_param('go', 0, PARAM_BOOL); ################################################################### echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('pluginname', 'tool_multilangupgrade')); $strmultilangupgrade = get_String('multilangupgradeinfo', 'tool_multilangupgrade'); if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form $optionsyes = array('go'=>1, 'sesskey'=>sesskey()); echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('/admin/tool/multilangupgrade/index.php', $optionsyes), new moodle_url('/admin/')); echo $OUTPUT->footer(); die; } if (!$tables = $DB->get_tables() ) { // No tables yet at all. throw new \moodle_exception('notables', 'debug'); } echo $OUTPUT->box_start(); /// Turn off time limits, sometimes upgrades can be slow. core_php_time_limit::raise(); echo '<strong>Progress:</strong>'; $i = 0; $skiptables = array('config', 'block_instances', 'sessions'); // we can not process tables with serialised data here foreach ($tables as $table) { if (strpos($table,'pma') === 0) { // Not our tables continue; } if (in_array($table, $skiptables)) { // Don't process these continue; } $fulltable = $DB->get_prefix().$table; if ($columns = $DB->get_columns($table)) { if (!array_key_exists('id', $columns)) { continue; // moodle tables have id } foreach ($columns as $column => $data) { if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only // first find candidate records $sql = "SELECT id, $column FROM $fulltable WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'"; $rs = $DB->get_recordset_sql($sql); foreach ($rs as $data) { $text = $data->$column; $id = $data->id; if ($i % 600 == 0) { echo '<br />'; } if ($i % 10 == 0) { echo '.'; } $i++; if (empty($text) or is_numeric($text)) { continue; // nothing to do } $search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is'; $newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text); if (is_null($newtext)) { continue; // regex error } if ($newtext != $text) { $DB->execute("UPDATE $fulltable SET $column=? WHERE id=?", array($newtext, $id)); } } $rs->close(); } } } } // set conversion flag - switches to new plugin automatically set_config('filter_multilang_converted', 1); echo $OUTPUT->box_end(); /// Rebuild course cache which might be incorrect now echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess'); rebuild_course_cache(0, true); echo $OUTPUT->notification('...finished', 'notifysuccess'); echo $OUTPUT->continue_button(new moodle_url('/admin/')); echo $OUTPUT->footer(); die; function multilangupgrade_impl($langblock) { $searchtosplit = '/<(?:lang|span) lang="([a-zA-Z0-9_-]*)".*?>(.+?)<\/(?:lang|span)>/is'; preg_match_all($searchtosplit, $langblock[0], $rawlanglist); $return = ''; foreach ($rawlanglist[1] as $index=>$lang) { $return .= '<span lang="'.$lang.'" class="multilang">'.$rawlanglist[2][$index].'</span>'; } return $return; } version.php 0000644 00000002246 15152114237 0006747 0 ustar 00 <?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/>. /** * Plugin version info * * @package tool * @subpackage multilangupgrade * @copyright 2011 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; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2022111800; // Requires this Moodle version. $plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics) classes/privacy/provider.php 0000644 00000003004 15152114237 0012217 0 ustar 00 <?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 tool_multilangupgrade. * * @package tool_multilangupgrade * @copyright 2018 Zig Tan <zig@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace tool_multilangupgrade\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for tool_multilangupgrade implementing null_provider. * * @copyright 2018 Zig Tan <zig@moodle.com> * @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'; } } lang/en/tool_multilangupgrade.php 0000644 00000002667 15152114237 0013215 0 ustar 00 <?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 'tool_multilangupgrade', language 'en', branch 'MOODLE_22_STABLE' * * @package tool * @subpackage multilangupgrade * @copyright 2011 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['multilangupgradeinfo'] = '<p>The multilang filter syntax was changed in 1.8 and so the <lang> tag is not supported any more.</p> <p>Example: <span lang="en" class="multilang">Hello!</span><span lang="es" class="multilang">Hola!</span></p> <p>Do you want to upgrade the syntax in all existing texts now?</p>'; $string['pluginname'] = 'Multilang upgrade'; $string['privacy:metadata'] = 'The Multilang upgrade plugin does not store any personal data.';
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�