summaryrefslogtreecommitdiff
path: root/platform/www/lib/plugins/textinsert
diff options
context:
space:
mode:
Diffstat (limited to 'platform/www/lib/plugins/textinsert')
-rw-r--r--platform/www/lib/plugins/textinsert/README55
-rw-r--r--platform/www/lib/plugins/textinsert/admin.php292
-rw-r--r--platform/www/lib/plugins/textinsert/conf/default.php5
-rw-r--r--platform/www/lib/plugins/textinsert/conf/metadata.php3
-rw-r--r--platform/www/lib/plugins/textinsert/lang/de/lang.php22
-rw-r--r--platform/www/lib/plugins/textinsert/lang/de/settings.php8
-rw-r--r--platform/www/lib/plugins/textinsert/lang/en/intro.txt16
-rw-r--r--platform/www/lib/plugins/textinsert/lang/en/lang.php31
l---------platform/www/lib/plugins/textinsert/lang/en/macros.php1
-rw-r--r--platform/www/lib/plugins/textinsert/lang/en/settings.php3
-rw-r--r--platform/www/lib/plugins/textinsert/lang/es/intro.txt16
-rw-r--r--platform/www/lib/plugins/textinsert/lang/es/lang.php31
l---------platform/www/lib/plugins/textinsert/lang/es/macros.php1
-rw-r--r--platform/www/lib/plugins/textinsert/lang/es/settings.php3
-rw-r--r--platform/www/lib/plugins/textinsert/lang/fr/intro.txt10
-rw-r--r--platform/www/lib/plugins/textinsert/lang/fr/lang.php25
-rw-r--r--platform/www/lib/plugins/textinsert/lang/fr/settings.php10
-rw-r--r--platform/www/lib/plugins/textinsert/lang/ja/intro.txt16
-rw-r--r--platform/www/lib/plugins/textinsert/lang/ja/lang.php23
-rw-r--r--platform/www/lib/plugins/textinsert/lang/ja/settings.php9
-rw-r--r--platform/www/lib/plugins/textinsert/lang/nl/intro.txt11
-rw-r--r--platform/www/lib/plugins/textinsert/lang/nl/lang.php24
-rw-r--r--platform/www/lib/plugins/textinsert/lang/nl/settings.php8
-rw-r--r--platform/www/lib/plugins/textinsert/lang/pt-br/intro.txt13
-rw-r--r--platform/www/lib/plugins/textinsert/lang/pt-br/lang.php23
-rw-r--r--platform/www/lib/plugins/textinsert/lang/pt-br/settings.php9
-rw-r--r--platform/www/lib/plugins/textinsert/lang/ru/intro.txt10
-rw-r--r--platform/www/lib/plugins/textinsert/lang/ru/lang.php25
-rw-r--r--platform/www/lib/plugins/textinsert/lang/ru/settings.php9
-rw-r--r--platform/www/lib/plugins/textinsert/lang/zh/intro.txt11
-rw-r--r--platform/www/lib/plugins/textinsert/lang/zh/lang.php23
-rw-r--r--platform/www/lib/plugins/textinsert/manager.dat2
-rw-r--r--platform/www/lib/plugins/textinsert/plugin.info.txt9
-rw-r--r--platform/www/lib/plugins/textinsert/syntax.php261
-rw-r--r--platform/www/lib/plugins/textinsert/version2
35 files changed, 1020 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/textinsert/README b/platform/www/lib/plugins/textinsert/README
new file mode 100644
index 0000000..ed0c173
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/README
@@ -0,0 +1,55 @@
+This is a macro substitution plugin which enables substitutions of both words and longer
+strings of text.
+
+Basic Syntax: #@Macro_Name@#
+
+It provides an administrative panel which makes for simple adding, editing and deletion
+of macros.
+
+Much of the functionality of this plugin can be more easily implemented with Dokuwiki's
+own entities facility: http://www.dokuwiki.org/entities. The advantage of TextInsert
+comes when dealing with extended blocks of text and with its ability to include other
+macros inside the primary macro definition. That is, it can accept:
+
+MACRO_1 This macro can include #@MACR0_2@# inside it.
+MACRO_2 a second macro
+
+The result is:
+ This macro can include a second macro inside it.
+
+It accepts only one level of macro inclusion, so that if MACRO_3 were included in
+MACRO_2, MACRO_3 would not be rendered.
+
+The macro definitions will also accept entities defined dokuwiki's conf/entities.conf and
+user-defined entities conf/entities.local.conf. Entities will be replaced in both the
+primary and the included macros.
+
+HTML Support
+#Macro_HTML@#
+A macro name with the _HTML suffix will be output as HTML, whereas without the _HTML suffix the
+HTML markup will be treated as literals. With it, <p> creates a paragraph; wthout it the <p>
+markup is printed to the screen.
+
+Translation Support
+#@LANG_name@#
+If a macro has this format, textinsert checks the file's namespace for a language specified
+as an ISO abbreviation, for instance nl for Dutch or de for German -- as in de:my_file. If it finds
+a language specification, it will check the textinsert/lang directory for either macros.php or a lang.php
+file in the relevant language directory, for instance lang/de/lang.php. It will then look for a
+$lang['name'] entry in lang.php or a $lang_<iso>['name'] entry in macros.php, and if
+it finds one, it will substitute this for the macro. Otherwise, it will substitute the entry for
+LANG_name in the textinsert database. So, there must be a default entry in that database.
+
+Translation macros can be embeded in other macros, including other translation macros.
+And other macros can emdedded in translation macros. They also accept entities, as
+described above.
+
+For HTML output, HTML tags are accepted in translation macros, but for the HTML
+to become effective, these must be included in a standard HTML macro definition
+string. In effect, they must be doubly bound to the HTML
+
+See http://dokuwiki.org/plugin:textinsert for further information.
+
+
+
+
diff --git a/platform/www/lib/plugins/textinsert/admin.php b/platform/www/lib/plugins/textinsert/admin.php
new file mode 100644
index 0000000..3d85347
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/admin.php
@@ -0,0 +1,292 @@
+<?php
+/**
+ *
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Myron Turner <turnermm02@shaw.ca>
+ */
+if(!defined('DOKU_INC')) die();
+
+define('REPLACE_DIR', DOKU_INC . 'data/meta/macros/');
+
+/**
+ * All DokuWiki plugins to extend the admin function
+ * need to inherit from this class
+ */
+class admin_plugin_textinsert extends DokuWiki_Admin_Plugin {
+
+ var $output = false;
+ var $macros_file;
+ var $macros_data; //used for html listings
+ /**
+ * handle user request
+ */
+ function __construct() {
+ if(!$this->getConf('farm')) {
+ define('MACROS_FILE', REPLACE_DIR . 'macros.ser');
+ }
+ else {
+ define('MACROS_FILE', metaFN('macros','.ser'));
+ }
+
+ }
+ function handle() {
+
+ $this->macros_file=MACROS_FILE;
+
+ if (!isset($_REQUEST['cmd'])) return; // first time - nothing to do
+
+ $this->output = '';
+ if (!checkSecurityToken()) return;
+ if (!is_array($_REQUEST['cmd'])) return;
+ $action = "";
+
+ // verify valid values
+ switch (key($_REQUEST['cmd'])) {
+ case 'add' :
+ $action = 'add';
+ $a = $this->add();
+ break;
+
+ case 'delete' :
+ $a = $this->del();
+ break;
+ case 'edit':
+ $a = $this->edit();
+ break;
+ }
+ // $this->output = print_r($a,true);
+ // $this->output .= print_r($_REQUEST,true);
+ }
+
+ function add() {
+ $a = $this->get_macros();
+ $macros = $_REQUEST['macro'];
+ $words = $_REQUEST['word'];
+
+ foreach ($macros AS $key=>$value) {
+ if(isset($value) && trim($value)) {
+ if(isset($words[$key]) && trim($words[$key])) {
+ $value = utf8_deaccent($value);
+ $a[$value] = htmlspecialchars (($words[$key]),ENT_NOQUOTES, 'UTF-8');
+ }
+ }
+ }
+
+ io_saveFile(MACROS_FILE,serialize($a));
+ return $a;
+ }
+
+ function del() {
+ $macros = $this->get_macros();
+
+ $deletions = $_REQUEST['delete'];
+ $keys = array_keys($deletions);
+ foreach ($keys AS $_key) {
+ unset($macros[$_key]);
+ }
+
+ io_saveFile(MACROS_FILE,serialize($macros));
+ return $macros;
+ }
+
+ function edit() {
+ $macros = $this->get_macros();
+
+ $encoded = $_REQUEST['encoded'];
+ $encoded = array_map('urldecode',$encoded);
+ foreach($encoded AS $k=>$val) {
+ $macros[$k] = htmlspecialchars ($val,ENT_NOQUOTES, 'UTF-8', false);
+ }
+ io_saveFile(MACROS_FILE,serialize($macros));
+ return $macros;
+ }
+
+ function get_macros() {
+ if(file_exists(MACROS_FILE)) {
+ $a = unserialize(file_get_contents(MACROS_FILE));
+ if(!is_array($a)) return array();
+ ksort($a);
+ return $a;
+ }
+ return array();
+ }
+
+ function get_delete_list() {
+ $macros = $this->macros_data;
+ ptln('<table cellspacing="4px" width="90%">');
+ foreach($macros as $macro=>$subst) {
+ ptln("<tr><td><input type='checkbox' name='delete[$macro]' value='$subst'>");
+ ptln( "<td style='padding:4px;'>$macro<td>$subst</td>");
+
+ }
+ ptln('</table>');
+ }
+
+ function get_edit_list() {
+ $macros = $this->macros_data;
+ ptln('<table cellspacing="4"><tr><th align="center">Macro</th><th align="center">' . $this->getLang('col_subst') .'</th></tr>');
+ foreach($macros as $macro=>$subst) {
+ ptln("<tr><td align='center'>$macro&nbsp;</td><td>");
+ $encoded = urlencode($subst);
+ if($subst != $encoded) {
+ ptln("<input type = 'hidden' name='encoded[$macro]' value='$encoded'>");
+ }
+ if(strlen($subst) > 80) {
+ ptln ("<textarea cols='55' rows='3' name='edit[$macro]' onchange='replace_encode(this)'>$subst</textarea></td></tr>");
+
+ }
+ else {
+ ptln ("<input type='text' size='80' name='edit[$macro]' onchange='replace_encode(this)' value='$subst'></td></tr>");
+ }
+
+ }
+ ptln('</table>');
+ }
+
+ function view_entries() {
+ $macros = $this->macros_data;
+ ptln('<table cellpadding="8px" width="90%">');
+ foreach($macros as $macro=>$subst) {
+ ptln( "<tr><td align='center'>$macro<td style='padding: 4px; border-bottom: 1px solid black;'>$subst</tr>");
+
+ }
+ ptln('</table>');
+ }
+
+ function js() {
+
+echo <<<JSFN
+
+ <script type="text/javascript">
+ //<![CDATA[
+ var replace_divs= new Array('macro_add','macro_del','macro_edit','ti_info','macro_list');
+ /**
+ * Edit onChange handler
+ * @param el input element which has been changed
+ * @desc if an encode hidden input already exists, its value
+ * is re-encoded from the text input's value
+ * If not, a new encoded hidden input is created with the encoded
+ * value. The encode input value is used to substitute the new edit values
+ * in the php edit() function
+ */
+ function replace_encode (el) {
+ var matches = el.name.match(/\[(.*)\]/);
+ if(matches[1]) {
+ var name = 'encoded['+matches[1]+']';
+ var val = el.value;
+ val = val.replace(/>/g,"&gt;");
+ val = val.replace(/</g,"&lt;");
+ if(!el.form[name]) {
+ var encoder = document.createElement('input');
+ encoder.type = 'hidden';
+ encoder.name = name;
+ encoder.value = encodeURIComponent(val);
+ el.form.appendChild(encoder);
+ }
+ else if(el.form[name]) {
+ el.form[name].value = encodeURIComponent(val);
+ }
+ }
+ }
+
+ function ti_getEL(n) {
+ return document.getElementById(n);
+ }
+
+ function replace_show(which) {
+ for(var i in replace_divs) {
+ ti_getEL(replace_divs[i]).style.display='none';
+ }
+ ti_getEL(which).style.display='block';
+ ti_getEL('ti_info_btn').style.display='inline';
+ }
+//]]>
+ </script>
+JSFN;
+
+ }
+ /**
+ * output appropriate html
+ */
+ function html() {
+ $this->macros_data = $this->get_macros();
+ $this->js();
+ if($this->output) {
+ ptln('<pre>' . $this->output . '</pre>');
+ }
+ ptln('<div style="padding:4px" id="ti_info">');
+ ptln('<div style="text-align:right;">');
+ ptln('<button class="button" style="padding:0px;margin:0px;" onclick="replace_show(\'ti_info_btn\');">');
+ ptln($this->getLang('hide_info') .'</button>&nbsp;&nbsp;&nbsp;&nbsp;');
+ ptln('</div>');
+ ptln('<h2>Info</h2>');
+ ptln( $this->locale_xhtml('intro') . '</div>');
+
+ ptln('<div style="padding-bottom:8px;">');
+ ptln('<button class="button" onclick="replace_show(\'macro_add\'); ">');
+ ptln($this->getLang('add_macros') .'</button>&nbsp;&nbsp;');
+
+ ptln('<button class="button" onclick="replace_show(\'macro_del\'); ">');
+ ptln($this->getLang('delete_macros') .'</button>&nbsp;&nbsp;');
+
+ ptln('<button class="button" onclick="replace_show(\'macro_edit\'); ">');
+ ptln($this->getLang('edit_macros') .'</button>&nbsp;&nbsp;');
+
+ ptln('<button class="button" onclick="ti_getEL(\'macro_list\').style.display=\'block\';ti_getEL(\'macro_list\').scrollIntoView();">');
+ ptln($this->getLang('view_macros') .'</button>&nbsp;&nbsp;');
+
+ ptln('<button class="button" onclick="ti_getEL(\'macro_list\').style.display=\'none\';">');
+ ptln($this->getLang('hide_macros') .'</button>&nbsp;&nbsp;');
+
+ ptln('<button class="button" id="ti_info_btn" style="display:none" onclick="ti_getEL(\'ti_info\').style.display=\'block\';">');
+ ptln($this->getLang('show_info') .'</button>');
+
+ ptln('</div>');
+ ptln('<form action="'.wl($ID).'" method="post">');
+
+ // output hidden values to ensure dokuwiki will return back to this plugin
+ ptln(' <input type="hidden" name="do" value="admin" />');
+ ptln(' <input type="hidden" name="page" value="'.$this->getPluginName().'" />');
+ formSecurityToken();
+
+ ptln('<div id="macro_add" style="display:none">');
+ ptln('<h2>' . $this->getLang('label_add') . '</h2>');
+ ptln( '<table cellspacing="8px"><tr><th>Macro</th><th>' . $this->getLang('col_subst') . '</th></tr>');
+ ptln('<tr><td> <input type="text" name="macro[A]" id="m_A" value="" /></td>');
+ ptln('<td> <input type="text" name="word[A]" size="80" id="w_A" value="" /></td></tr>');
+ ptln('<tr><td> <input type="text" name="macro[B]" id="m_B" value="" /></td>');
+ ptln('<td> <input type="text" name="word[B]" size="80" id="w_B" value="" /></td></tr>');
+ ptln('<tr><td> <input type="text" name="macro[C]" id="m_C" value="" /></td>');
+ ptln('<td> <input type="text" name="word[C]" size="80" id="w_C" value="" /></td></tr>');
+ ptln('<tr><td> <input type="text" name="macro[D]" id="m_D" value="" /></td>');
+ ptln('<td> <input type="text" name="word[D]" size="80" id="w_C" value="" /></td></tr>');
+ ptln('<tr><td> <input type="text" name="macro[E]" id="m_E" value="" /></td>');
+ ptln('<td> <input type="text" name="word[E]" size="80" id="w_E" value="" /></td>');
+ ptln('<tr><td> <input type="text" name="macro[F]" id="m_F" value="" /></td>');
+ ptln('<td> <textarea cols="45" name="word[F]" rows="4" id="w_F"></textarea></td>');
+ ptln('</table>');
+ ptln(' <input type="submit" name="cmd[add]" value="'.$this->getLang('btn_add').'" />');
+ ptln('</div><br />');
+
+ ptln('<div id="macro_del" style="display:none">');
+ ptln('<h2>' . $this->getLang('label_del') . '</h2>');
+ $this->get_delete_list();
+ ptln('<br /><input type="submit" name="cmd[delete]" value="'.$this->getLang('btn_del').'" />');
+ ptln('</div>');
+
+ ptln('<div id="macro_edit" style="display:none; padding: 8px;">');
+ ptln('<h2>' . $this->getLang('label_edit') . '</h2>');
+ $this->get_edit_list();
+ ptln('<br /><input type="submit" name="cmd[edit]" value="'.$this->getLang('btn_edit').'" />');
+ ptln('</div>');
+
+ ptln('</form>');
+
+ ptln('<br /><div id="macro_list" style="overflow:auto;display:block;">');
+ ptln('<h2>' . $this->getLang('label_list') . '</h2>');
+ $this->view_entries();
+ ptln('</div>');
+ }
+
+}
diff --git a/platform/www/lib/plugins/textinsert/conf/default.php b/platform/www/lib/plugins/textinsert/conf/default.php
new file mode 100644
index 0000000..efe3db4
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/conf/default.php
@@ -0,0 +1,5 @@
+<?php
+$conf['stdreplace'] = 1;
+$conf['farm'] = 0;
+
+
diff --git a/platform/www/lib/plugins/textinsert/conf/metadata.php b/platform/www/lib/plugins/textinsert/conf/metadata.php
new file mode 100644
index 0000000..56168e8
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/conf/metadata.php
@@ -0,0 +1,3 @@
+<?php
+$meta['stdreplace'] = array('onoff');
+$meta['farm'] = array('onoff'); \ No newline at end of file
diff --git a/platform/www/lib/plugins/textinsert/lang/de/lang.php b/platform/www/lib/plugins/textinsert/lang/de/lang.php
new file mode 100644
index 0000000..907fe6f
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/de/lang.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Thor Weinreich <thorweinreich@nefkom.net>
+ */
+$lang['btn_add'] = 'Hinzufügen';
+$lang['btn_del'] = 'Löschen';
+$lang['btn_edit'] = 'Änderungen speichern';
+$lang['label_list'] = 'Makro-Liste';
+$lang['label_add'] = 'Makros hinzufügen';
+$lang['label_del'] = 'Makros löschen';
+$lang['label_edit'] = 'Makros bearbeiten';
+$lang['col_subst'] = 'Makros ersetzen';
+$lang['add_macros'] = 'Makros hinzufügen';
+$lang['delete_macros'] = 'Makros löschen';
+$lang['edit_macros'] = 'Makros bearbeiten';
+$lang['view_macros'] = 'Makro-Liste anzeigen';
+$lang['hide_macros'] = 'Makro-Liste verbergen';
+$lang['hide_info'] = 'Info schließen';
+$lang['show_info'] = 'Info anzeigen';
diff --git a/platform/www/lib/plugins/textinsert/lang/de/settings.php b/platform/www/lib/plugins/textinsert/lang/de/settings.php
new file mode 100644
index 0000000..ca9e0e1
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/de/settings.php
@@ -0,0 +1,8 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Thor Weinreich <thorweinreich@nefkom.net>
+ */
+$lang['stdreplace'] = 'Standard Makro-Ersetzungen annehmen, wie sie in Namensraum-Templates benutzt werden';
diff --git a/platform/www/lib/plugins/textinsert/lang/en/intro.txt b/platform/www/lib/plugins/textinsert/lang/en/intro.txt
new file mode 100644
index 0000000..a89d5e5
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/en/intro.txt
@@ -0,0 +1,16 @@
+This panel enables you to add and delete macros and their replacement texts, and to edit them after they have been saved. A macro name can contain letters, numbers, underscores, hyphens and periods. For example: ''Macro_one.txt''. The replacement texts can accept HTML and can be of any length.
+
+You can add up to six macros at a time. The sixth is a text area which will allow for extended texts.
+Enter the macro name in the **Macro** column and the texts which they represent in the
+**Substitution** column.
+
+
+Deletions are unlimited; check off the box(es) next the macro(s) to be deleted and click
+the **Delete** button at the bottom of the screen. Editing is done through the Edit screen, where you are presented
+with all your macros. You can edit the texts of any number of macros.
+
+
+The macro list will not refresh until after you have submitted your edits, additions, or deletions
+by clicking the appropriate button at the bottom of the screen.
+
+
diff --git a/platform/www/lib/plugins/textinsert/lang/en/lang.php b/platform/www/lib/plugins/textinsert/lang/en/lang.php
new file mode 100644
index 0000000..7a01bc6
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/en/lang.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * English language file
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Myron turner <turnermm02@shaw.ca>
+ */
+
+// for admin plugins, the menu prompt to be displayed in the admin menu
+// if set here, the plugin doesn't need to override the getMenuText() method
+$lang['menu'] = 'TextInsert Macro Replacement Plugin';
+
+$lang['btn_add'] = 'Add';
+$lang['btn_del'] = 'Delete';
+$lang['btn_edit'] = 'Submit Edits';
+
+$lang['label_list'] = "Macro List";
+$lang['label_add'] = "Add Macros";
+$lang['label_del'] = "Delete Macros";
+$lang['label_edit'] = "Edit Macros";
+
+$lang['col_subst'] = 'Macro Substitution';
+$lang['add_macros'] = 'Add Macros';
+$lang['delete_macros'] = 'Delete Macros';
+$lang['edit_macros'] = 'Edit Macros';
+$lang['view_macros'] = 'View Macro List';
+$lang['hide_macros'] = 'Hide Macro List';
+$lang['hide_info'] = 'Close Info';
+$lang['show_info'] = 'Show Info';
+$lang['not_found'] = 'macro was not found in the macros database';
+
diff --git a/platform/www/lib/plugins/textinsert/lang/en/macros.php b/platform/www/lib/plugins/textinsert/lang/en/macros.php
new file mode 120000
index 0000000..21b1645
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/en/macros.php
@@ -0,0 +1 @@
+../../../../../../i18n/textinsert_strings.php \ No newline at end of file
diff --git a/platform/www/lib/plugins/textinsert/lang/en/settings.php b/platform/www/lib/plugins/textinsert/lang/en/settings.php
new file mode 100644
index 0000000..4083a83
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/en/settings.php
@@ -0,0 +1,3 @@
+<?php
+$lang['stdreplace'] = 'Accept standard macro replacements as used in namespace templates';
+$lang['farm'] = 'If this is a farm and you and would like each animal to have its own macro database, please select this option; otherwise all animals will share the same (i.e. the farmer\'s) database.';
diff --git a/platform/www/lib/plugins/textinsert/lang/es/intro.txt b/platform/www/lib/plugins/textinsert/lang/es/intro.txt
new file mode 100644
index 0000000..a89d5e5
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/es/intro.txt
@@ -0,0 +1,16 @@
+This panel enables you to add and delete macros and their replacement texts, and to edit them after they have been saved. A macro name can contain letters, numbers, underscores, hyphens and periods. For example: ''Macro_one.txt''. The replacement texts can accept HTML and can be of any length.
+
+You can add up to six macros at a time. The sixth is a text area which will allow for extended texts.
+Enter the macro name in the **Macro** column and the texts which they represent in the
+**Substitution** column.
+
+
+Deletions are unlimited; check off the box(es) next the macro(s) to be deleted and click
+the **Delete** button at the bottom of the screen. Editing is done through the Edit screen, where you are presented
+with all your macros. You can edit the texts of any number of macros.
+
+
+The macro list will not refresh until after you have submitted your edits, additions, or deletions
+by clicking the appropriate button at the bottom of the screen.
+
+
diff --git a/platform/www/lib/plugins/textinsert/lang/es/lang.php b/platform/www/lib/plugins/textinsert/lang/es/lang.php
new file mode 100644
index 0000000..7a01bc6
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/es/lang.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * English language file
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Myron turner <turnermm02@shaw.ca>
+ */
+
+// for admin plugins, the menu prompt to be displayed in the admin menu
+// if set here, the plugin doesn't need to override the getMenuText() method
+$lang['menu'] = 'TextInsert Macro Replacement Plugin';
+
+$lang['btn_add'] = 'Add';
+$lang['btn_del'] = 'Delete';
+$lang['btn_edit'] = 'Submit Edits';
+
+$lang['label_list'] = "Macro List";
+$lang['label_add'] = "Add Macros";
+$lang['label_del'] = "Delete Macros";
+$lang['label_edit'] = "Edit Macros";
+
+$lang['col_subst'] = 'Macro Substitution';
+$lang['add_macros'] = 'Add Macros';
+$lang['delete_macros'] = 'Delete Macros';
+$lang['edit_macros'] = 'Edit Macros';
+$lang['view_macros'] = 'View Macro List';
+$lang['hide_macros'] = 'Hide Macro List';
+$lang['hide_info'] = 'Close Info';
+$lang['show_info'] = 'Show Info';
+$lang['not_found'] = 'macro was not found in the macros database';
+
diff --git a/platform/www/lib/plugins/textinsert/lang/es/macros.php b/platform/www/lib/plugins/textinsert/lang/es/macros.php
new file mode 120000
index 0000000..21b1645
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/es/macros.php
@@ -0,0 +1 @@
+../../../../../../i18n/textinsert_strings.php \ No newline at end of file
diff --git a/platform/www/lib/plugins/textinsert/lang/es/settings.php b/platform/www/lib/plugins/textinsert/lang/es/settings.php
new file mode 100644
index 0000000..4083a83
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/es/settings.php
@@ -0,0 +1,3 @@
+<?php
+$lang['stdreplace'] = 'Accept standard macro replacements as used in namespace templates';
+$lang['farm'] = 'If this is a farm and you and would like each animal to have its own macro database, please select this option; otherwise all animals will share the same (i.e. the farmer\'s) database.';
diff --git a/platform/www/lib/plugins/textinsert/lang/fr/intro.txt b/platform/www/lib/plugins/textinsert/lang/fr/intro.txt
new file mode 100644
index 0000000..ce05cbd
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/fr/intro.txt
@@ -0,0 +1,10 @@
+Ce panneau vous permet d'ajouter et supprimer des macros et leur textes de remplacement, de les modifier après leur enregistrement. Un nom de macro peut contenir des lettres, des nombres, des tirets bas, traits d'union et points. Par exemple : ''Macro_one.txt''. Le texte de remplacement peut accepter le HTML et peut être de n'importe quelle longueur.
+
+Vous pouvez ajouter jusqu'à six macros à la fois. Le sixième est une zone de texte qui permettra de longs textes.
+Entrez le nom de la macro dans la colonne **Macro** et les textes qu'ils représentent dans la colonne **Remplacement**.
+
+
+Les suppressions sont illimitées ; cochez la devant la macro à supprimer et cliquez sur le bouton **Supprimer** en bas de l'écran. La modification se fait à travers l'écran de modification, où vous sont présenté toutes vos macros. Vous pouvez modifier les textes de n'importe quel nombre de macros.
+
+
+La liste macro ne s'actualise pas jusqu'à ce que vous avez envoyer vos modifications, ajouts ou suppressions en cliquant sur le bouton approprié en bas de l'écran. \ No newline at end of file
diff --git a/platform/www/lib/plugins/textinsert/lang/fr/lang.php b/platform/www/lib/plugins/textinsert/lang/fr/lang.php
new file mode 100644
index 0000000..2570f93
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/fr/lang.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Hérisson grognon <dodoperso@laposte.net>
+ * @author Ner0lph <forums@ner0lph.tk>
+ */
+$lang['menu'] = 'TextInsert Macro Replacement Plugin';
+$lang['btn_add'] = 'Ajouter';
+$lang['btn_del'] = 'Supprimer';
+$lang['btn_edit'] = 'Envoyer les modifications';
+$lang['label_list'] = 'Liste des macros';
+$lang['label_add'] = 'Ajouter des macros';
+$lang['label_del'] = 'Supprimer des macros';
+$lang['label_edit'] = 'Modifier des macros';
+$lang['col_subst'] = 'Substitution de macro';
+$lang['add_macros'] = 'Ajouter des macros';
+$lang['delete_macros'] = 'Supprimer des macros';
+$lang['edit_macros'] = 'Modifier des macros';
+$lang['view_macros'] = 'Afficher la liste des macros';
+$lang['hide_macros'] = 'Cacher la liste des macros';
+$lang['hide_info'] = 'Fermer les informations';
+$lang['show_info'] = 'Montrer les informations';
+$lang['not_found'] = 'Le macro n\'a pas été trouvé dans la base de données des macros.';
diff --git a/platform/www/lib/plugins/textinsert/lang/fr/settings.php b/platform/www/lib/plugins/textinsert/lang/fr/settings.php
new file mode 100644
index 0000000..92bd788
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/fr/settings.php
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Ner0lph <forums@ner0lph.tk>
+ * @author ubibene <services.m@benard.info>
+ */
+$lang['stdreplace'] = 'Accepter des remplacements standards de macros en tant que modèles de catégorie';
+$lang['farm'] = 'Si ceci était une ferme et que vous souhaitez que chaque animal ait sa propre base de macros, sélectionnez cette option; sinon tous les animaux partageront la même base de données (c\'est à dire celle du fermier).';
diff --git a/platform/www/lib/plugins/textinsert/lang/ja/intro.txt b/platform/www/lib/plugins/textinsert/lang/ja/intro.txt
new file mode 100644
index 0000000..ef806fd
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/ja/intro.txt
@@ -0,0 +1,16 @@
+この画面では、マクロと代替テキストの追加と削除、保存後の編集ができます。
+マクロ名は、文字・数字・アンダースコア・ハイフン・ピリオドを使用します。
+例:''Macro_one.txt''
+代替テキストは HTML も許容しますし、任意長です。
+
+一度に 6 マクロを追加できます。
+テキスト欄は拡張テキストを入力できます。
+**マクロ**欄にマクロ名、**置換**欄に代替テキストを入力します。
+
+削除に制限はありません。
+削除するマクロの隣にあるチェックを外し、画面下の**削除**ボタンをクリックします。
+編集は編集画面で行います。
+編集画面には登録されたマクロをすべて表示されています。
+複数のマクロのテキスト編集も可能です。
+
+画面下にあるボタンをクリックして編集・追加・削除を実行するまでマクロ一覧は更新されません。 \ No newline at end of file
diff --git a/platform/www/lib/plugins/textinsert/lang/ja/lang.php b/platform/www/lib/plugins/textinsert/lang/ja/lang.php
new file mode 100644
index 0000000..f9b95ba
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/ja/lang.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Hideaki SAWADA <chuno@live.jp>
+ */
+$lang['menu'] = 'TextInsert マクロ置換プラグイン';
+$lang['btn_add'] = '追加';
+$lang['btn_del'] = '削除';
+$lang['btn_edit'] = '編集の実行';
+$lang['label_list'] = 'マクロ一覧';
+$lang['label_add'] = 'マクロ追加';
+$lang['label_del'] = 'マクロ削除';
+$lang['label_edit'] = 'マクロ編集';
+$lang['col_subst'] = 'マクロ置換';
+$lang['add_macros'] = 'マクロ追加';
+$lang['delete_macros'] = 'マクロ削除';
+$lang['edit_macros'] = 'マクロ編集';
+$lang['view_macros'] = 'マクロ一覧を表示';
+$lang['hide_macros'] = 'マクロ一覧を非表示';
+$lang['hide_info'] = '解説を非表示';
+$lang['show_info'] = '解説を表示';
diff --git a/platform/www/lib/plugins/textinsert/lang/ja/settings.php b/platform/www/lib/plugins/textinsert/lang/ja/settings.php
new file mode 100644
index 0000000..c5ef2c1
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/ja/settings.php
@@ -0,0 +1,9 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Hideaki SAWADA <chuno@live.jp>
+ */
+$lang['stdreplace'] = '名前空間テンプレートで使用されている標準マクロ置換を許容する';
+$lang['farm'] = 'この Wiki が牧場で各動物に独自のマクロデータベースを持たせたい場合、このオプションを選択してください。選択しない場合、全ての動物は同一の(つまり牧場主の)データベースを共有することになります。';
diff --git a/platform/www/lib/plugins/textinsert/lang/nl/intro.txt b/platform/www/lib/plugins/textinsert/lang/nl/intro.txt
new file mode 100644
index 0000000..8e35a1e
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/nl/intro.txt
@@ -0,0 +1,11 @@
+Met dit luik kan je macro's en hun vervangingsteksten onderhouden: aanmaken, schrappen en bewerken nadat ze opgeslagen zijn. Een macro naam kan letters, cijfers, onderlijningsstreepjes, koppeltekens en punten bevatten. Voorbeeld: ''Macro_one.txt''. De vervangtekst kan in HTML zijn en gelijk welke lengte.
+
+Zes macro's tegelijk kan je toevoegen. De zesde is de tekstzone waar je uitgebreide teksten kan invoeren.
+Geef een macro naam in de **Macro** kolom en de tekst die hier aan gekoppeld is in de **Vervangteksten** kolom.
+
+Schrappen kan je onbeperkt uitvoeren. Vink het vakje of de vakjes aan naast de macro's die geschrapt moeten
+worden. Klik daarna op de **Schrappen** knop onderaan het scherm. Bewerken doe je via het bewerkingsscherm waar
+je alle macro's ziet staan. Je bewerkt teksten van zoveel macro's als je maar wil.
+
+De macro lijst wordt niet hernieuwd zolang de wijzigingen, toevoegingen, schrappingen niet doorgevoerd zijn
+door te klikken op de voorziene knop onderaan het scherm. \ No newline at end of file
diff --git a/platform/www/lib/plugins/textinsert/lang/nl/lang.php b/platform/www/lib/plugins/textinsert/lang/nl/lang.php
new file mode 100644
index 0000000..ce1b255
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/nl/lang.php
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Myron turner <turnermm02@shaw.ca>
+ * @author hugo smet <hugo.smet@scarlet.be>
+ */
+$lang['menu'] = 'TextInsert Macro Substitutie Plugin';
+$lang['btn_add'] = 'Toevoegen';
+$lang['btn_del'] = 'Schrappen';
+$lang['btn_edit'] = 'Wijzigingen doorvoeren';
+$lang['label_list'] = 'Macro Lijst';
+$lang['label_add'] = 'Macro\'s Toevoegen';
+$lang['label_del'] = 'Macro\'s Schrappen';
+$lang['label_edit'] = 'Macro\'s Bewerken';
+$lang['col_subst'] = 'Macro Vervangteksten';
+$lang['add_macros'] = 'Toevoegen';
+$lang['delete_macros'] = 'Schrappen';
+$lang['edit_macros'] = 'Bewerken';
+$lang['view_macros'] = 'Lijst Tonen';
+$lang['hide_macros'] = 'Lijst Verbergen';
+$lang['hide_info'] = 'Info Sluiten';
+$lang['show_info'] = 'Info Tonen';
diff --git a/platform/www/lib/plugins/textinsert/lang/nl/settings.php b/platform/www/lib/plugins/textinsert/lang/nl/settings.php
new file mode 100644
index 0000000..afb2901
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/nl/settings.php
@@ -0,0 +1,8 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Hugo Smet <hugo.smet@scarlet.be>
+ */
+$lang['stdreplace'] = 'Standaard macro substituties aanvaarden zoals deze in naamruimte sjablonen gebruikt worden';
diff --git a/platform/www/lib/plugins/textinsert/lang/pt-br/intro.txt b/platform/www/lib/plugins/textinsert/lang/pt-br/intro.txt
new file mode 100644
index 0000000..974e84c
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/pt-br/intro.txt
@@ -0,0 +1,13 @@
+Esse painel permite adicionar e excluir macros e seus textos de substituição e editá-los depois de salvos. Um nome de macro pode conter letras, números, sublinhados, hífens e pontos. Por exemplo: '' Macro_one.txt ''. Os textos de substituição podem aceitar HTML e podem ser de qualquer tamanho.
+
+Você pode adicionar até seis macros por vez. A sexta é uma área de texto que permitirá textos estendidos.
+Insira o nome da macro na coluna ** Macro ** e os textos que eles representam na
+** Substituição ** coluna.
+
+Deleções são ilimitadas; marque a caixa ao lado da(s) macro(s) a ser (em) excluída(s) e clique
+no botão ** Excluir ** na parte inferior da tela. A edição é feita através da tela Editar, onde você é apresentado
+com todas as suas macros. Você pode editar os textos de qualquer número de macros.
+
+
+A lista de macros não será atualizada até que você tenha enviado suas edições, adições ou exclusões
+clicando no botão apropriado na parte inferior da tela. \ No newline at end of file
diff --git a/platform/www/lib/plugins/textinsert/lang/pt-br/lang.php b/platform/www/lib/plugins/textinsert/lang/pt-br/lang.php
new file mode 100644
index 0000000..874bb9d
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/pt-br/lang.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Alexandre Belchior <alexbelchior@gmail.com>
+ */
+$lang['menu'] = 'Plugin de Substituição de Macro TextInsert';
+$lang['btn_add'] = 'Adicionar';
+$lang['btn_del'] = 'Delete';
+$lang['btn_edit'] = 'Enviar edições';
+$lang['label_list'] = 'Lista de Macro';
+$lang['label_add'] = 'Adicionar macros';
+$lang['label_del'] = 'Deletar macros';
+$lang['label_edit'] = 'Editar macros';
+$lang['col_subst'] = 'Substituição de macro';
+$lang['add_macros'] = 'Adicionar macros';
+$lang['delete_macros'] = 'Deletar macros';
+$lang['edit_macros'] = 'Editar macros';
+$lang['view_macros'] = 'Visualizar lista de macro';
+$lang['hide_macros'] = 'Ocultar lista de macro';
+$lang['hide_info'] = 'Fechar informação';
+$lang['show_info'] = 'Mostrar informação';
diff --git a/platform/www/lib/plugins/textinsert/lang/pt-br/settings.php b/platform/www/lib/plugins/textinsert/lang/pt-br/settings.php
new file mode 100644
index 0000000..db02fd6
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/pt-br/settings.php
@@ -0,0 +1,9 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Alexandre Belchior <alexbelchior@gmail.com>
+ */
+$lang['stdreplace'] = 'Aceite substituições de macro padrão como usadas em modelos de namespace';
+$lang['farm'] = 'Se isto é uma fazenda e você e gostaria que cada animal tivesse seu próprio banco de dados de macros, selecione essa opção; caso contrário, todos os animais compartilharão o mesmo banco de dados (ou seja, do fazendeiro).';
diff --git a/platform/www/lib/plugins/textinsert/lang/ru/intro.txt b/platform/www/lib/plugins/textinsert/lang/ru/intro.txt
new file mode 100644
index 0000000..e432c6b
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/ru/intro.txt
@@ -0,0 +1,10 @@
+Панель позволяет добавлять, редактировать и удалять макросы и их подстановки. Имена макросов могут содержать буквы, цифры, символ подчёркивания, дефис и точку. Пример: ''Macro_one.txt''. Подстановки неограничены в длине и могут содержать HTML-разметку.
+
+В режиме //добавления// можно создать до шести макросов. Шестое текстовое поле предназначено для длинных текстов. В колонке **Macro** введите имя нового макроса, а в колонке **Подстановки** --- замещающий текст.
+
+В режиме //удаления// появляются флажки для выбора удаляемых макросов. Разовое количество удалений не ограничено.
+
+В режиме //редактирования// все поля подстановок открываются для исправления. Разовое количество исправлений не ограничено.
+
+Список макросов обновится только после нажатия соответствующей функциональной кнопки внизу списка.
+
diff --git a/platform/www/lib/plugins/textinsert/lang/ru/lang.php b/platform/www/lib/plugins/textinsert/lang/ru/lang.php
new file mode 100644
index 0000000..25e2fe7
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/ru/lang.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author Aleksandr Selivanov <alexgearbox@yandex.ru>
+ * @author RainbowSpike <1@2.ru>
+ */
+$lang['menu'] = 'Плагин макрозамен TextInsert';
+$lang['btn_add'] = 'Добавить';
+$lang['btn_del'] = 'Удалить';
+$lang['btn_edit'] = 'Подтвердить изменения';
+$lang['label_list'] = 'Список макросов';
+$lang['label_add'] = 'Добавить макросы';
+$lang['label_del'] = 'Удалить макросы';
+$lang['label_edit'] = 'Изменить макросы';
+$lang['col_subst'] = 'Подстановки';
+$lang['add_macros'] = 'Добавить макросы';
+$lang['delete_macros'] = 'Удалить макросы';
+$lang['edit_macros'] = 'Изменить макросы';
+$lang['view_macros'] = 'Показать список макросов';
+$lang['hide_macros'] = 'Скрыть список макросов';
+$lang['hide_info'] = 'Скрыть справку';
+$lang['show_info'] = 'Показать справку';
+$lang['not_found'] = 'Макрос не найден в перечне макросов';
diff --git a/platform/www/lib/plugins/textinsert/lang/ru/settings.php b/platform/www/lib/plugins/textinsert/lang/ru/settings.php
new file mode 100644
index 0000000..07a8850
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/ru/settings.php
@@ -0,0 +1,9 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author RainbowSpike <1@2.ru>
+ * @author Aleksandr Selivanov <alexgearbox@yandex.ru>
+ */
+$lang['stdreplace'] = 'Допускать стандартные переменные, используемые для шаблонов пространств имён';
diff --git a/platform/www/lib/plugins/textinsert/lang/zh/intro.txt b/platform/www/lib/plugins/textinsert/lang/zh/intro.txt
new file mode 100644
index 0000000..8846119
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/zh/intro.txt
@@ -0,0 +1,11 @@
+通过此面板,您可以添加、删除宏及其替换文本,保存后也可以在次对其进行编辑。 宏名称可以包含字母,数字,下划线,连字符和句号。 例如:''Macro_one.txt''。替换文本支持 HTML,且不限制长度。
+
+您一次最多可以添加六个宏。 第六个是允许扩展文本的文本区域。
+在**宏**列表中输入宏的名称,并在另一边中输入它们的**替换**文本。
+
+
+选中要删除的宏旁边的框,然后单击屏幕底部的**删除**按钮,即可删除宏。
+编辑是通过编辑界面完成的,这个界面会显示你所有的宏。您可以编辑任意数量的宏的内容。
+
+
+在您通过屏幕底部的相应按钮提交编辑、添加或删除之后,宏列表才会刷新。 \ No newline at end of file
diff --git a/platform/www/lib/plugins/textinsert/lang/zh/lang.php b/platform/www/lib/plugins/textinsert/lang/zh/lang.php
new file mode 100644
index 0000000..09d578a
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/lang/zh/lang.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ * @author RainSlide <RainSlide@outlook.com>
+ */
+$lang['menu'] = 'TextInsert 宏插件';
+$lang['btn_add'] = '添加';
+$lang['btn_del'] = '删除';
+$lang['btn_edit'] = '提交编辑';
+$lang['label_list'] = '宏列表';
+$lang['label_add'] = '添加宏';
+$lang['label_del'] = '删除宏';
+$lang['label_edit'] = '编辑宏';
+$lang['col_subst'] = '替换文本';
+$lang['add_macros'] = '添加宏';
+$lang['delete_macros'] = '删除宏';
+$lang['edit_macros'] = '编辑宏';
+$lang['view_macros'] = '显示宏列表';
+$lang['hide_macros'] = '隐藏宏列表';
+$lang['hide_info'] = '关闭信息';
+$lang['show_info'] = '显示信息';
diff --git a/platform/www/lib/plugins/textinsert/manager.dat b/platform/www/lib/plugins/textinsert/manager.dat
new file mode 100644
index 0000000..a12c912
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/manager.dat
@@ -0,0 +1,2 @@
+downloadurl=https://github.com/turnermm/TextInsert/zipball/master
+installed=Thu, 29 Apr 2021 06:46:29 -0300
diff --git a/platform/www/lib/plugins/textinsert/plugin.info.txt b/platform/www/lib/plugins/textinsert/plugin.info.txt
new file mode 100644
index 0000000..ae031d0
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/plugin.info.txt
@@ -0,0 +1,9 @@
+base textinsert
+author Myron Turner
+email turnermm02@shaw.ca
+date 2019-10-03
+name textinsert Plugin
+desc replace macros with text subsitutions
+url https://www.dokuwiki.org/plugin:textinsert
+
+
diff --git a/platform/www/lib/plugins/textinsert/syntax.php b/platform/www/lib/plugins/textinsert/syntax.php
new file mode 100644
index 0000000..82a60b6
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/syntax.php
@@ -0,0 +1,261 @@
+<?php
+/**
+ *
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Myron Turner <turnermm02@shaw.ca>
+ *
+ */
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
+require_once(DOKU_PLUGIN.'syntax.php');
+define('REPLACE_DIR', DOKU_INC . 'data/meta/macros/');
+define('MACROS_FILE', REPLACE_DIR . 'macros.ser');
+
+
+/**
+ * All DokuWiki plugins to extend the parser/rendering mechanism
+ * need to inherit from this class
+ */
+class syntax_plugin_textinsert extends DokuWiki_Syntax_Plugin {
+ var $macros;
+ var $translations;
+ var $ns;
+ /**
+ * return some info
+ */
+
+ /**
+ * What kind of syntax are we?
+ */
+ function getType(){
+ return 'substition';
+ }
+
+ /**
+ * Where to sort in?
+ */
+ function getSort(){
+ return 155;
+ }
+
+
+ /**
+ * Connect pattern to lexer
+ */
+ function connectTo($mode) {
+ $this->Lexer->addSpecialPattern('#@\!?[\w\-\._]+\!?@#',$mode,'plugin_textinsert');
+ $this->Lexer->addSpecialPattern('#@\!\![\w\-\._]+@#',$mode,'plugin_textinsert');
+ $this->Lexer->addSpecialPattern('#@[\w\-\._]+~.*?~@#',$mode,'plugin_textinsert');
+ $this->Lexer->addSpecialPattern('#@[\w\-\._]+[\r\n]+~[^\r\n]+~@#',$mode,'plugin_textinsert');
+ }
+
+
+ /**
+ * Handle the match
+ */
+ function handle($match, $state, $pos, Doku_Handler $handler){
+
+ $html=false;
+ $translation = false;
+ $match = substr($match,2,-2);
+ $match = trim($match);
+ if(strpos($match, 'HTML')) $html=true;
+ if(strpos($match, 'LANG_') !== false) {
+ $translation=true;
+ list($prefix,$trans) = explode('_',$match,2);
+ }
+
+ global $ID;
+ list($ns,$rest) = explode(':',$ID,2);
+ if(@file_exists($filename = DOKU_PLUGIN . "textinsert/lang/$ns/lang.php")) {
+ include $filename;
+ $this->translations = $lang;
+
+ }
+
+ if(@file_exists($filename = DOKU_PLUGIN . "textinsert/lang/$ns/macros.php")) {
+ include $filename;
+ $ar = 'lang_' .$ns;
+ $tr = $$ar;
+ if($this->translations) {
+ $this->translations = array_merge($lang,$tr);
+ }
+ else $this->translations = $tr;
+ }
+
+ if(!empty($ns)) {
+ $this->ns = $ns;
+ }
+ $this->macros = $this->get_macros();
+
+
+
+ while(preg_match('#(\*\*|//|__|\'\').*?\1#m',$match )) {
+ $match = preg_replace_callback(
+ '#(\*\*|//|__|\'\')(.*?)(\1)#',
+ function($matches) {
+ $matches[1] = str_replace(array('**','//','__','\'\'',),array('<b>','<em>','<u>','<code>'),$matches[1]);
+ $matches[3] = str_replace(array('**','//','__','\'\''),array('</b>','</em>','</u>','</code>'),$matches[3]);
+ return $matches[1] . $matches[2] . $matches[3];
+ },$match );
+ }
+
+ if(preg_match('/(.*?)~([\s\S]+)~$/',$match,$subtitution)) {
+ $match=$subtitution[1];
+ $subtitution[2] = str_replace('\\,','&#44;',$subtitution[2]);
+ $substitutions=explode(',',$subtitution[2]);
+ $substitutions = preg_replace('#\/\/.+#',"",$substitutions);
+ $substitutions = preg_replace('#\\\n#',"<br />",$substitutions);
+ }
+
+ if(!array_key_exists($match, $this->macros) ) {
+ $err = $this->getLang('not_found');
+ msg("$match $err", -1);
+ $match = "";
+ }
+ else {
+ if($translation && isset($this->translations[$trans])){
+ $match = $this->translations[$trans];
+ }
+ else {
+ $match =$this->macros[$match];
+ }
+ }
+
+ if(!is_array($substitutions)) $substitutions = array();
+ for($i=0; $i<count($substitutions); $i++) {
+ $search = '%' . ($i+1);
+ $match = str_replace ($search , trim($substitutions[$i]), $match);
+ }
+
+ $match = $this->get_inserts($match,$translation);
+
+ if($html) {
+ $match = str_replace('&lt;','<',$match);
+ $match = str_replace('&gt;','>',$match);
+ }
+
+ return array($state,$match);
+ }
+
+ /**
+ * Create output
+ */
+ function render($mode, Doku_Renderer $renderer, $data) {
+ global $INFO;
+ if($mode == 'xhtml'){
+ list($state, $word) = $data;
+ If(strpos($word,'_ID_') !== false ) {
+ $word = str_replace('_ID_',$INFO['id'], $word);
+ }
+ $renderer->doc .= $word;
+ return true;
+ }
+ return false;
+ }
+
+ function get_macros() {
+ $a = array();
+ if(file_exists(MACROS_FILE)) {
+ $a = unserialize(file_get_contents(MACROS_FILE));
+ }
+ else if($this->getConf('farm')) {
+ $a = unserialize(file_get_contents(metaFN('macros','.ser')));
+ }
+ $r = $this->get_std_replacements() ;
+ $result = array_merge($r,$a);
+ return array_merge($r,$a);
+ }
+
+ function get_inserts($match,$translation) {
+ $inserts = array();
+
+ // replace embedded macros
+ if(preg_match_all('/#@(.*?)@#/',$match,$inserts)) {
+ $keys = $inserts[1];
+ $pats = $inserts[0];
+
+ for($i=0; $i<count($keys); $i++) {
+ $insert = $this->macros[$keys[$i]];
+ if($translation ||strpos($keys[$i], 'LANG_') !== false) {
+ list($prefix,$trans) = explode('_',$keys[$i],2);
+ $_insert = $this->translations[$trans];
+ if($_insert) $insert =$_insert;
+ }
+ $match = str_replace($pats[$i],$insert,$match);
+ }
+
+ } // end replace embedded macros
+
+
+ $entities = getEntities();
+ $e_keys = array_keys($entities);
+ $e_values = array_values($entities);
+ $match = str_replace($e_keys,$e_values,$match);
+
+ return $match;
+ }
+
+ function get_std_replacements() {
+ if(!$this->getConf('stdreplace')) return array();
+ global $conf;
+ global $INFO;
+ global $ID;
+
+ $file = noNS($ID);
+ $page = cleanID($file) ;
+
+ $names =array(
+ 'ID',
+ 'NS',
+ 'FILE',
+ '!FILE',
+ '!FILE!',
+ 'PAGE',
+ '!PAGE',
+ '!!PAGE',
+ '!PAGE!',
+ 'USER',
+ 'DATE',
+ '_ID_'
+ );
+
+ $values = array(
+ $ID,
+ getNS($ID),
+ $file,
+ utf8_ucfirst($file),
+ utf8_strtoupper($file),
+ $page,
+ utf8_ucfirst($page),
+ utf8_ucwords($page),
+ utf8_strtoupper($page),
+ $_SERVER['REMOTE_USER'],
+ strftime($conf['dformat'], time()),
+ '_ID_'
+ );
+ $std_replacements = array();
+ for($i=0; $i<count($names) ; $i++) {
+ $std_replacements[$names[$i]] = $values[$i];
+ }
+
+ return $std_replacements;
+}
+
+ function write_debug($what, $screen = false) {
+ return;
+ $what=print_r($what,true);
+ if($screen) {
+ msg('<pre>' . $what . '</pre>');
+ return;
+ }
+ $handle=fopen("textinsert.txt",'a');
+ fwrite($handle,"$what\n");
+ fclose($handle);
+ }
+}
+
+
diff --git a/platform/www/lib/plugins/textinsert/version b/platform/www/lib/plugins/textinsert/version
new file mode 100644
index 0000000..4fb8186
--- /dev/null
+++ b/platform/www/lib/plugins/textinsert/version
@@ -0,0 +1,2 @@
+19-Oct_03-20_19
+