nl2br plugin by ophian

This commit is contained in:
Garvin Hicking 2011-11-24 12:21:40 +01:00
parent 2749dc54ad
commit 000f77224c
13 changed files with 301 additions and 152 deletions

View File

@ -4,6 +4,8 @@
Version 1.7 () Version 1.7 ()
------------------------------------------------------------------------ ------------------------------------------------------------------------
* Updated nl2br plugin (ophian)
* EXPERIMENTAL: Smarty3 support (ophian) * EXPERIMENTAL: Smarty3 support (ophian)
* Added new serendipity['defaultBaseURL'] variable that makes sure * Added new serendipity['defaultBaseURL'] variable that makes sure

View File

@ -1,11 +1,11 @@
<?php # $Id$ <?php # $Id$
/** /**
* @version $Revision$ * @version $Revision$
* @author Ivan Cenov jwalker@hotmail.bg * @author Ivan Cenov jwalker@hotmail.bg
*/ */
@define('PLUGIN_EVENT_NL2BR_NAME', 'Форматиране на текст: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Форматиране на текст: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Заменя новите редове в текста с HTML BR тагове'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Заменя новите редове в текста с HTML BR тагове');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Списък на HTML-тагове, в които няма да се използва това форматиране'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Списък на HTML-тагове, в които няма да се използва това форматиране');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Препоръка: "code,pre,geshi,textarea". Използвайте "," за да укажете повече от един таг. Забележка: Въведените тагове се изчисляват като регулярни изрази.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Препоръка: "code,pre,geshi,textarea". Използвайте "," за да укажете повече от един таг. Забележка: Въведените тагове се изчисляват като регулярни изрази.');

View File

@ -1,19 +1,19 @@
<?php # lang_cs.inc.php 1501.1 2009-08-15 10:29:04 VladaAjgl $ <?php # lang_cs.inc.php 1501.1 2009-08-15 10:29:04 VladaAjgl $
/** /**
* @version 1501.1 * @version 1501.1
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* EN-Revision: Revision of lang_en.inc.php * EN-Revision: Revision of lang_en.inc.php
* Translated on 2007/11/30 * Translated on 2007/11/30
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* @revisionDate 2009/05/06 * @revisionDate 2009/05/06
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* @revisionDate 2009/08/15 * @revisionDate 2009/08/15
*/ */
@define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Mění znaky konce řádku na tagy <br />'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Mění znaky konce řádku na tagy <br />');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Seznam html tagů, uvnitř kterých nemají být konce řádků nahrazovány.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Seznam html tagů, uvnitř kterých nemají být konce řádků nahrazovány.');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Návrhy: "code,pre,geshi,textarea". Názvy tagů oddělujte čárkou. Tip: Zadávané tagy jsou vyhodnocovány jako regulární výraz.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Návrhy: "code,pre,geshi,textarea". Názvy tagů oddělujte čárkou. Tip: Zadávané tagy jsou vyhodnocovány jako regulární výraz.');
@define('PLUGIN_EVENT_NL2BR_PTAGS', 'Použít tagy &lt;p&gt;'); @define('PLUGIN_EVENT_NL2BR_PTAGS', 'Použít tagy &lt;p&gt;');
@define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Vkládat tagy &lt;p&gt; místo tagů &lt;br /&gt;'); @define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Vkládat tagy &lt;p&gt; místo tagů &lt;br /&gt;');

View File

@ -1,19 +1,19 @@
<?php # lang_cz.inc.php 1501.1 2009-08-15 10:29:04 VladaAjgl $ <?php # lang_cz.inc.php 1501.1 2009-08-15 10:29:04 VladaAjgl $
/** /**
* @version 1501.1 * @version 1501.1
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* EN-Revision: Revision of lang_en.inc.php * EN-Revision: Revision of lang_en.inc.php
* Translated on 2007/11/30 * Translated on 2007/11/30
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* @revisionDate 2009/05/06 * @revisionDate 2009/05/06
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* @revisionDate 2009/08/15 * @revisionDate 2009/08/15
*/ */
@define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Mění znaky konce řádku na tagy <br />'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Mění znaky konce řádku na tagy <br />');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Seznam html tagů, uvnitř kterých nemají být konce řádků nahrazovány.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Seznam html tagů, uvnitř kterých nemají být konce řádků nahrazovány.');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Návrhy: "code,pre,geshi,textarea". Názvy tagů oddělujte čárkou. Tip: Zadávané tagy jsou vyhodnocovány jako regulární výraz.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Návrhy: "code,pre,geshi,textarea". Názvy tagů oddělujte čárkou. Tip: Zadávané tagy jsou vyhodnocovány jako regulární výraz.');
@define('PLUGIN_EVENT_NL2BR_PTAGS', 'Použít tagy &lt;p&gt;'); @define('PLUGIN_EVENT_NL2BR_PTAGS', 'Použít tagy &lt;p&gt;');
@define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Vkládat tagy &lt;p&gt; místo tagů &lt;br /&gt;'); @define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Vkládat tagy &lt;p&gt; místo tagů &lt;br /&gt;');

View File

@ -1,8 +1,15 @@
<?php # $Id$ <?php # $Id: lang_de.inc.php 2492 2011-03-22 17:56:40Z ian $
@define('PLUGIN_EVENT_NL2BR_NAME', 'Textformatierung: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Textformatierung: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Konvertiert Zeilenumbrüche zu HTML'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Konvertiert Zeilenumbrüche zu HTML');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Eine Liste von HTML-Tags, innerhalb derer keine Umbrüche konvertiert werden'); @define('PLUGIN_EVENT_NL2BR_CHECK_MARKUP', 'Überprüfe Markup-Plugins?');
@define('PLUGIN_EVENT_NL2BR_CHECK_MARKUP_DESC', 'Überprüft automatisch auf existierende Markup-Plugins, um die weitere Ausführung des NL2BR-Plugins zu untersagen. Dies gilt dann, wenn WYSIWYG oder spezifische Markup-Plugins entdeckt werden.');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Eine Liste von HTML-Tags, innerhalb derer keine Umbrüche bei Benutzung von P-Tags konvertiert werden');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Konfigurationsvorschlag: "code,pre,geshi,textarea". Trennen Sie mehrere HTML-Tags mit Komma. Hinweis: Die eingegebenen Tags sind reguläre Ausdrücke!'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Konfigurationsvorschlag: "code,pre,geshi,textarea". Trennen Sie mehrere HTML-Tags mit Komma. Hinweis: Die eingegebenen Tags sind reguläre Ausdrücke!');
@define('PLUGIN_EVENT_NL2BR_PTAGS', 'Nutze P-Tags'); @define('PLUGIN_EVENT_NL2BR_PTAGS', 'Nutze P-Tags');
@define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Setze statt br-Tags p-Tags ein.'); @define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Setze statt br-Tags p-Tags ein.');
@define('PLUGIN_EVENT_NL2BR_ISOBR_TAG', 'ISOBR Isolations-Default BR Einstellung');
@define('PLUGIN_EVENT_NL2BR_ISOBR_TAG_DESC', 'Mit dem neu eingefügten NON-HTML-Tag <nl> </nl> als NL2BR Isolations-Default Einstellung, kann die NL2BR Funktion nun so genutzt werden, dass alles innerhalb dieses Tags nicht von NL2BR geparst wird. Auch nicht verschachtelte mehrfach Vorkommen im Text werden unterstützt! Beispiel: <nl>do not parse newline to br inside</nl>');
@define('PLUGIN_EVENT_NL2BR_CLEANTAGS', 'Nutze BR-Clean-Tags fallback, wenn ISOBR false');
@define('PLUGIN_EVENT_NL2BR_CLEANTAGS_DESC', 'Bei Benutzung von <HTML-Tags> in den Einträgen, die nicht zufriedenstellend mit der ISOBR Config-Option gelöst werden können, lösche nl2br Umbruch nach <tag>. Dies gilt für alle <tags>, die mit > oder >\n enden! Default (table|thead|tbody|tfoot|th|tr|td|caption|colgroup|col|ol|ul|li|dl|dt|dd)');
@define('PLUGIN_EVENT_NL2BR_CONFIG_ERROR', 'Konfigurations Fehler! Die Option: "clean_tags" wurde zurückgesetzt, weil die Option \'isobr\' aktiv geschaltet war! Benutzen sie bitte nur eine dieser Optionen.');

View File

@ -1,17 +1,17 @@
<?php # $Id$ <?php # $Id$
########################################################################## ##########################################################################
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity # # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity #
# Developer Team) All rights reserved. See LICENSE file for licensing # # Developer Team) All rights reserved. See LICENSE file for licensing #
# details # # details #
# # # #
# (c) 2003 Jannis Hermanns <J@hacked.it> # # (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html # # http://www.jannis.to/programming/serendipity.html #
# # # #
# Translated by # # Translated by #
# (c) 2004-2005 CapriSkye <admin@capriskye.com> # # (c) 2004-2005 CapriSkye <admin@capriskye.com> #
# http://open.38.com # # http://open.38.com #
########################################################################## ##########################################################################
@define('PLUGIN_EVENT_NL2BR_NAME', '標記語言: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', '標記語言: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', '轉換新行成 BR 標籤'); @define('PLUGIN_EVENT_NL2BR_DESC', '轉換新行成 BR 標籤');
?> ?>

View File

@ -1,11 +1,11 @@
<?php # $Id$ <?php # $Id$
/** /**
* @version $Revision$ * @version $Revision$
* @author Ivan Cenov jwalker@hotmail.bg * @author Ivan Cenov jwalker@hotmail.bg
*/ */
@define('PLUGIN_EVENT_NL2BR_NAME', 'Ôîðìàòèðàíå íà òåêñò: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Ôîðìàòèðàíå íà òåêñò: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Çàìåíÿ íîâèòå ðåäîâå â òåêñòà ñ HTML BR òàãîâå'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Çàìåíÿ íîâèòå ðåäîâå â òåêñòà ñ HTML BR òàãîâå');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Ñïèñúê íà HTML-òàãîâå, â êîèòî íÿìà äà ñå èçïîëçâà òîâà ôîðìàòèðàíå'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Ñïèñúê íà HTML-òàãîâå, â êîèòî íÿìà äà ñå èçïîëçâà òîâà ôîðìàòèðàíå');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Ïðåïîðúêà: "code,pre,geshi,textarea". Èçïîëçâàéòå "," çà äà óêàæåòå ïîâå÷å îò åäèí òàã. Çàáåëåæêà: Âúâåäåíèòå òàãîâå ñå èç÷èñëÿâàò êàòî ðåãóëÿðíè èçðàçè.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Ïðåïîðúêà: "code,pre,geshi,textarea". Èçïîëçâàéòå "," çà äà óêàæåòå ïîâå÷å îò åäèí òàã. Çàáåëåæêà: Âúâåäåíèòå òàãîâå ñå èç÷èñëÿâàò êàòî ðåãóëÿðíè èçðàçè.');

View File

@ -1,19 +1,19 @@
<?php # lang_cs.inc.php 1501.1 2009-08-15 10:29:04 VladaAjgl $ <?php # lang_cs.inc.php 1501.1 2009-08-15 10:29:04 VladaAjgl $
/** /**
* @version 1501.1 * @version 1501.1
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* EN-Revision: Revision of lang_en.inc.php * EN-Revision: Revision of lang_en.inc.php
* Translated on 2007/11/30 * Translated on 2007/11/30
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* @revisionDate 2009/05/06 * @revisionDate 2009/05/06
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* @revisionDate 2009/08/15 * @revisionDate 2009/08/15
*/ */
@define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Mìní znaky konce øádku na tagy <br />'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Mìní znaky konce øádku na tagy <br />');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Seznam html tagù, uvnitø kterých nemají být konce øádkù nahrazovány.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Seznam html tagù, uvnitø kterých nemají být konce øádkù nahrazovány.');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Návrhy: "code,pre,geshi,textarea". Názvy tagù oddìlujte èárkou. Tip: Zadávané tagy jsou vyhodnocovány jako regulární výraz.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Návrhy: "code,pre,geshi,textarea". Názvy tagù oddìlujte èárkou. Tip: Zadávané tagy jsou vyhodnocovány jako regulární výraz.');
@define('PLUGIN_EVENT_NL2BR_PTAGS', 'Použít tagy &lt;p&gt;'); @define('PLUGIN_EVENT_NL2BR_PTAGS', 'Použít tagy &lt;p&gt;');
@define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Vkládat tagy &lt;p&gt; místo tagù &lt;br /&gt;'); @define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Vkládat tagy &lt;p&gt; místo tagù &lt;br /&gt;');

View File

@ -1,19 +1,19 @@
<?php # lang_cz.inc.php 1501.1 2009-08-15 10:29:04 VladaAjgl $ <?php # lang_cz.inc.php 1501.1 2009-08-15 10:29:04 VladaAjgl $
/** /**
* @version 1501.1 * @version 1501.1
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* EN-Revision: Revision of lang_en.inc.php * EN-Revision: Revision of lang_en.inc.php
* Translated on 2007/11/30 * Translated on 2007/11/30
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* @revisionDate 2009/05/06 * @revisionDate 2009/05/06
* @author Vladimír Ajgl <vlada@ajgl.cz> * @author Vladimír Ajgl <vlada@ajgl.cz>
* @revisionDate 2009/08/15 * @revisionDate 2009/08/15
*/ */
@define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Mìní znaky konce øádku na tagy <br />'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Mìní znaky konce øádku na tagy <br />');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Seznam html tagù, uvnitø kterých nemají být konce øádkù nahrazovány.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Seznam html tagù, uvnitø kterých nemají být konce øádkù nahrazovány.');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Návrhy: "code,pre,geshi,textarea". Názvy tagù oddìlujte èárkou. Tip: Zadávané tagy jsou vyhodnocovány jako regulární výraz.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Návrhy: "code,pre,geshi,textarea". Názvy tagù oddìlujte èárkou. Tip: Zadávané tagy jsou vyhodnocovány jako regulární výraz.');
@define('PLUGIN_EVENT_NL2BR_PTAGS', 'Pou¾ít tagy &lt;p&gt;'); @define('PLUGIN_EVENT_NL2BR_PTAGS', 'Pou¾ít tagy &lt;p&gt;');
@define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Vkládat tagy &lt;p&gt; místo tagù &lt;br /&gt;'); @define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Vkládat tagy &lt;p&gt; místo tagù &lt;br /&gt;');

View File

@ -1,8 +1,15 @@
<?php # $Id$ <?php # $Id: lang_de.inc.php 2492 2011-03-23 17:57:00Z ian $
@define('PLUGIN_EVENT_NL2BR_NAME', 'Textformatierung: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Textformatierung: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Konvertiert Zeilenumbrüche zu HTML'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Konvertiert Zeilenumbrüche zu HTML');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Eine Liste von HTML-Tags, innerhalb derer keine Umbrüche konvertiert werden'); @define('PLUGIN_EVENT_NL2BR_CHECK_MARKUP', 'Überprüfe Markup-Plugins?');
@define('PLUGIN_EVENT_NL2BR_CHECK_MARKUP_DESC', 'Überprüft automatisch auf existierende Markup-Plugins, um die weitere Ausführung des NL2BR-Plugins zu untersagen. Dies gilt dann, wenn WYSIWYG oder spezifische Markup-Plugins entdeckt werden.');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'Eine Liste von HTML-Tags, innerhalb derer keine Umbrüche bei Benutzung von P-Tags konvertiert werden');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Konfigurationsvorschlag: "code,pre,geshi,textarea". Trennen Sie mehrere HTML-Tags mit Komma. Hinweis: Die eingegebenen Tags sind reguläre Ausdrücke!'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Konfigurationsvorschlag: "code,pre,geshi,textarea". Trennen Sie mehrere HTML-Tags mit Komma. Hinweis: Die eingegebenen Tags sind reguläre Ausdrücke!');
@define('PLUGIN_EVENT_NL2BR_PTAGS', 'Nutze P-Tags'); @define('PLUGIN_EVENT_NL2BR_PTAGS', 'Nutze P-Tags');
@define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Setze statt br-Tags p-Tags ein.'); @define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Setze statt br-Tags p-Tags ein.');
@define('PLUGIN_EVENT_NL2BR_ISOBR_TAG', 'ISOBR Isolations-Default BR Einstellung');
@define('PLUGIN_EVENT_NL2BR_ISOBR_TAG_DESC', 'Mit dem neu eingefügten NON-HTML-Tag <nl> </nl> als NL2BR Isolations-Default Einstellung, kann die NL2BR Funktion nun so genutzt werden, dass alles innerhalb dieses Tags nicht von NL2BR geparst wird. Auch nicht verschachtelte mehrfach Vorkommen im Text werden unterstützt! Beispiel: <nl>do not parse newline to br inside</nl>');
@define('PLUGIN_EVENT_NL2BR_CLEANTAGS', 'Nutze BR-Clean-Tags fallback, wenn ISOBR false');
@define('PLUGIN_EVENT_NL2BR_CLEANTAGS_DESC', 'Bei Benutzung von <HTML-Tags> in den Einträgen, die nicht zufriedenstellend mit der ISOBR Config-Option gelöst werden können, lösche nl2br Umbruch nach <tag>. Dies gilt für alle <tags>, die mit > oder >\n enden! Default (table|thead|tbody|tfoot|th|tr|td|caption|colgroup|col|ol|ul|li|dl|dt|dd)');
@define('PLUGIN_EVENT_NL2BR_CONFIG_ERROR', 'Konfigurations Fehler! Die Option: "clean_tags" wurde zurückgesetzt, weil die Option \'isobr\' aktiv geschaltet war! Benutzen sie bitte nur eine dieser Optionen.');

View File

@ -1,15 +1,22 @@
<?php # $Id$ <?php # $Id: lang_en.inc.php 2492 2011-03-22 17:52:00Z ian $
/** /**
* @version $Revision$ * @version $Revision: 2491 $
* @author Translator Name <yourmail@example.com> * @author Translator Name <yourmail@example.com>
* EN-Revision: Revision of lang_en.inc.php * EN-Revision: Revision of lang_en.inc.php
*/ */
@define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', 'Markup: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', 'Convert newlines to BR tags'); @define('PLUGIN_EVENT_NL2BR_DESC', 'Convert newlines to BR tags');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'A list of HTML-tags where no breaks shall be converted'); @define('PLUGIN_EVENT_NL2BR_CHECK_MARKUP', 'Check other markup plugins?');
@define('PLUGIN_EVENT_NL2BR_CHECK_MARKUP_DESC', 'Automaticly check existing markup plugins to disable the use of NL2BR plugin. This is true, when WYSIWYG or specific markup plugins are detected.');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS', 'A list of HTML-tags where no breaks shall be converted, if using P-Tags');
@define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Suggestion: "code,pre,geshi,textarea". Seperate multiple tags with a comma. Hint: The entered tags are evaluated as regular expressions.'); @define('PLUGIN_EVENT_NL2BR_ISOLATE_TAGS_DESC', 'Suggestion: "code,pre,geshi,textarea". Seperate multiple tags with a comma. Hint: The entered tags are evaluated as regular expressions.');
@define('PLUGIN_EVENT_NL2BR_PTAGS', 'Use P-Tags'); @define('PLUGIN_EVENT_NL2BR_PTAGS', 'Use P-Tags');
@define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Insert p-tags instead of br.'); @define('PLUGIN_EVENT_NL2BR_PTAGS_DESC', 'Insert p-tags instead of br.');
@define('PLUGIN_EVENT_NL2BR_ISOBR_TAG', 'ISOBR isolations-default BR setting');
@define('PLUGIN_EVENT_NL2BR_ISOBR_TAG_DESC', 'With this newly added NON-HTML-Tag <nl> </nl>, as a NL2BR Isolations-Default setting, you can use the NL2BR function now by shutting down the parsing inside this tag. You can use it multiple times inside your entry, but not nested! Example: <nl>do not parse newline to br inside</nl>');
@define('PLUGIN_EVENT_NL2BR_CLEANTAGS', 'Use BR-Clean-Tags as fallback, when ISOBR false');
@define('PLUGIN_EVENT_NL2BR_CLEANTAGS_DESC', 'If using <HTML-Tags> in you entries, which can\'t be solved satisfiable with the ISOBR Config-Option, remove nl2br after <tag>. This applies to all <tags> ending with > or >\n! Default (table|thead|tbody|tfoot|th|tr|td|caption|colgroup|col|ol|ul|li|dl|dt|dd)');
@define('PLUGIN_EVENT_NL2BR_CONFIG_ERROR', 'Config missmatch alert! The Option: "clean_tags" is set back to false, while \'isobr\' is active! Just use one of them, please.');
?> ?>

View File

@ -1,17 +1,17 @@
<?php # $Id$ <?php # $Id$
########################################################################## ##########################################################################
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity # # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity #
# Developer Team) All rights reserved. See LICENSE file for licensing # # Developer Team) All rights reserved. See LICENSE file for licensing #
# details # # details #
# # # #
# (c) 2003 Jannis Hermanns <J@hacked.it> # # (c) 2003 Jannis Hermanns <J@hacked.it> #
# http://www.jannis.to/programming/serendipity.html # # http://www.jannis.to/programming/serendipity.html #
# # # #
# Translated by # # Translated by #
# (c) 2004-2005 CapriSkye <admin@capriskye.com> # # (c) 2004-2005 CapriSkye <admin@capriskye.com> #
# http://open.38.com # # http://open.38.com #
########################################################################## ##########################################################################
@define('PLUGIN_EVENT_NL2BR_NAME', '標記語言: NL2BR'); @define('PLUGIN_EVENT_NL2BR_NAME', '標記語言: NL2BR');
@define('PLUGIN_EVENT_NL2BR_DESC', '轉換新行成 BR 標籤'); @define('PLUGIN_EVENT_NL2BR_DESC', '轉換新行成 BR 標籤');
?> ?>

View File

@ -1,4 +1,4 @@
<?php # $Id$ <?php # $Id: serendipity_event_nl2br.php 2011-11-21 18:47:00Z ian $
@serendipity_plugin_api::load_language(dirname(__FILE__)); @serendipity_plugin_api::load_language(dirname(__FILE__));
@ -14,16 +14,18 @@ class serendipity_event_nl2br extends serendipity_event
$propbag->add('description', PLUGIN_EVENT_NL2BR_DESC); $propbag->add('description', PLUGIN_EVENT_NL2BR_DESC);
$propbag->add('stackable', false); $propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team'); $propbag->add('author', 'Serendipity Team');
$propbag->add('version', '2.0'); $propbag->add('version', '2.12');
$propbag->add('requirements', array( $propbag->add('requirements', array(
'serendipity' => '0.8', 'serendipity' => '0.8',
'smarty' => '2.6.7', 'smarty' => '2.6.7',
'php' => '4.1.0' 'php' => '4.1.0'
)); ));
$propbag->add('cachable_events', array('frontend_display' => true)); $propbag->add('cachable_events', array('frontend_display' => true));
$propbag->add('event_hooks', array('frontend_display' => true,
'css' => true) $propbag->add('event_hooks', array('frontend_display' => true,
); 'backend_display' => true,
'css' => true)
);
$propbag->add('groups', array('MARKUP')); $propbag->add('groups', array('MARKUP'));
$this->markup_elements = array( $this->markup_elements = array(
@ -45,13 +47,27 @@ class serendipity_event_nl2br extends serendipity_event
) )
); );
$conf_array = array('isolate', 'p_tags');
$conf_array = array('check_markup', 'isolate', 'p_tags', 'isobr', 'clean_tags');
foreach($this->markup_elements as $element) { foreach($this->markup_elements as $element) {
$conf_array[] = $element['name']; $conf_array[] = $element['name'];
} }
$propbag->add('configuration', $conf_array); $propbag->add('configuration', $conf_array);
} }
function cleanup() {
global $serendipity;
/* check possible config mismatch setting */
if ( serendipity_db_bool($this->get_config('isobr')) === true && serendipity_db_bool($this->get_config('clean_tags')) === true ) {
$this->set_config('clean_tags', false);
echo '<div class="serendipityAdminMsgError"><img class="backend_attention" src="' . $serendipity['serendipityHTTPPath'] . 'templates/default/admin/img/admin_msg_note.png" alt="" />';
echo PLUGIN_EVENT_NL2BR_CONFIG_ERROR . '</div>';
return false;
}
return true;
}
function install() { function install() {
serendipity_plugin_api::hook_event('backend_cache_entries', $this->title); serendipity_plugin_api::hook_event('backend_cache_entries', $this->title);
} }
@ -68,6 +84,13 @@ class serendipity_event_nl2br extends serendipity_event
function introspect_config_item($name, &$propbag) function introspect_config_item($name, &$propbag)
{ {
switch($name) { switch($name) {
case 'check_markup':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_NL2BR_CHECK_MARKUP);
$propbag->add('description', PLUGIN_EVENT_NL2BR_CHECK_MARKUP_DESC);
$propbag->add('default', 'true');
break;
case 'isolate': case 'isolate':
$propbag->add('type', 'string'); $propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_NL2BR_ISOLATE_TAGS); $propbag->add('name', PLUGIN_EVENT_NL2BR_ISOLATE_TAGS);
@ -79,7 +102,21 @@ class serendipity_event_nl2br extends serendipity_event
$propbag->add('type', 'boolean'); $propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_NL2BR_PTAGS); $propbag->add('name', PLUGIN_EVENT_NL2BR_PTAGS);
$propbag->add('description', PLUGIN_EVENT_NL2BR_PTAGS_DESC); $propbag->add('description', PLUGIN_EVENT_NL2BR_PTAGS_DESC);
$propbag->add('default', 'false'); $propbag->add('default', 'false');
break;
case 'isobr':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_NL2BR_ISOBR_TAG);
$propbag->add('description', PLUGIN_EVENT_NL2BR_ISOBR_TAG_DESC);
$propbag->add('default', 'true');
break;
case 'clean_tags':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_NL2BR_CLEANTAGS);
$propbag->add('description', PLUGIN_EVENT_NL2BR_CLEANTAGS_DESC);
$propbag->add('default', 'false');
break; break;
default: default:
@ -105,57 +142,120 @@ class serendipity_event_nl2br extends serendipity_event
function event_hook($event, &$bag, &$eventData) { function event_hook($event, &$bag, &$eventData) {
global $serendipity; global $serendipity;
static $markup = null;
static $isolate = null; static $isolate = null;
static $p_tags = null; static $p_tags = null;
static $isobr = null;
static $clean_tags = null;
global $_buf; global $_buf;
$hooks = &$bag->get('event_hooks'); $hooks = &$bag->get('event_hooks');
if ($markup === null) {
$markup = serendipity_db_bool($this->get_config('check_markup'));
}
if ($p_tags === null) { if ($p_tags === null) {
$p_tags = serendipity_db_bool($this->get_config('p_tags')); $p_tags = serendipity_db_bool($this->get_config('p_tags'));
} }
if ($isobr === null) {
$isobr = serendipity_db_bool($this->get_config('isobr'));
}
if ($clean_tags === null) {
$clean_tags = serendipity_db_bool($this->get_config('clean_tags'));
}
if (isset($hooks[$event])) { if (isset($hooks[$event])) {
switch($event) { switch($event) {
case 'frontend_display': case 'frontend_display':
if ($isolate === null) {
$isolate = $this->get_config('isolate'); // check single entry for temporary disabled markups
$tags = (array)explode(',', $isolate); if ( !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
$isolate = array(); !in_array($this->instance, (array)$serendipity['POST']['properties']['disable_markups']) &&
foreach($tags AS $tag) { !$eventData['properties']['ep_no_textile'] && !isset($serendipity['POST']['properties']['ep_no_textile']) &&
$tag = trim($tag); !$eventData['properties']['ep_no_markdown'] && !isset($serendipity['POST']['properties']['ep_no_markdown'])) {
if (!empty($tag)) { // yes, this markup shall be applied
$isolate[] = $tag; $serendipity['nl2br']['entry_disabled_markup'] = false;
} else {
// no, do not apply markup
$serendipity['nl2br']['entry_disabled_markup'] = true;
}
// don't add additional br or p tags, if the wysiwyg-editor, the textile, or markdown plugin already took care about markup
if($markup) {
if ( ($serendipity['wysiwyg'] && serendipity_userLoggedIn()) ||
($serendipity['nl2br']['entry_disabled_markup'] === false && (class_exists('serendipity_event_textile') || class_exists('serendipity_event_markdown'))) ) {
return true;
} }
} }
if (count($isolate) < 1) { // check for users isolation tags
$isolate = false; if ($isolate === null) {
} $isolate = $this->get_config('isolate');
} $tags = (array)explode(',', $isolate);
$isolate = array();
foreach ($this->markup_elements as $temp) { foreach($tags AS $tag) {
if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) && $tag = trim($tag);
!$eventData['properties']['ep_disable_markup_' . $this->instance] && if (!empty($tag)) {
!in_array($this->instance, (array)$serendipity['POST']['properties']['disable_markups']) && $isolate[] = $tag;
!$eventData['properties']['ep_no_nl2br'] && }
!isset($serendipity['POST']['properties']['ep_no_nl2br'])) { }
if (count($isolate) < 1) {
$element = $temp['element']; $isolate = false;
if ($p_tags) { }
$eventData[$element] = $this->nl2p($eventData[$element]); }
} else if ($isolate) {
$eventData[$element] = $this->isolate($eventData[$element], '~[<\[](' . implode('|', $isolate) . ').*?[>\]].*?[<\[]/\1[>\]]~si'); foreach ($this->markup_elements as $temp) {
$eventData[$element] = nl2br($eventData[$element]); if (serendipity_db_bool($this->get_config($temp['name'], true)) && isset($eventData[$temp['element']]) &&
$eventData[$element] = $this->restore($eventData[$element]); !$eventData['properties']['ep_disable_markup_' . $this->instance] &&
} else { !in_array($this->instance, (array)$serendipity['POST']['properties']['disable_markups']) &&
$eventData[$element] = nl2br($eventData[$element]); !$eventData['properties']['ep_no_nl2br'] &&
!isset($serendipity['POST']['properties']['ep_no_nl2br'])) {
$element = $temp['element'];
if ($p_tags) {
$eventData[$element] = $this->nl2p($eventData[$element]);
} else if ($isolate) {
$eventData[$element] = $this->isolate($eventData[$element], '~[<\[](' . implode('|', $isolate) . ').*?[>\]].*?[<\[]/\1[>\]]~si');
$eventData[$element] = nl2br($eventData[$element]);
$eventData[$element] = $this->restore($eventData[$element]);
} else {
if($isobr) {
$eventData[$element] = $this->isolate($eventData[$element], '~[<\[](nl).*?[>\]].*?[<\[]/\1[>\]]~si');
$eventData[$element] = nl2br($eventData[$element]);
$eventData[$element] = $this->restore($eventData[$element]);
// unset nl tagline, if is
$eventData[$element] = str_replace(array("<nl>", "</nl><br />", "</nl><br/>", "</nl>"), "", $eventData[$element]);
} else {
$eventData[$element] = nl2br($eventData[$element]);
}
}
/* this is an option if not using new isobr default config setting */
if (!$p_tags && $isobr === false && $clean_tags === true) {
// convert line endings to Unix style, if not already done
$eventData[$element] = str_replace(array("\r\n", "\r"), "\n", $eventData[$element]);
// clean special tags from nl2br
$eventData[$element] = $this->clean_nl2brtags($eventData[$element]);
}
} }
} }
}
return true; return true;
break; break;
case 'css': case 'backend_display':
/*
// create some buttons
if( $isobr ) {
// ToDo: hook into default/admin/entries.tpl somehow via the Heart Of Gold = serendipity_printEntryForm() before! it is loaded
$serendipity['smarty']->assign('iso2br', true);
}
*/
return true;
break;
case 'css':
?> ?>
p.whiteline { p.whiteline {
@ -172,7 +272,7 @@ p.break {
return true; return true;
break; break;
default: default:
return false; return false;
} }
@ -181,6 +281,32 @@ p.break {
} }
} }
/* clean nl2br from markup where it is invalid and/or breaks html output
* @param string entrytext
* @return string
* */
function clean_nl2brtags(&$entry) {
$allTags = explode('|', 'table|thead|tbody|tfoot|th|tr|td|caption|colgroup|col|ol|ul|li|dl|dt|dd');
$br2nl = array();
foreach($allTags as $tag){
/* for \\1 ( start with : < followed by any number of white spaces : \s* optionally a slash : /? and the tag itself )
* for \\2 ( anything with spaces and characters following until )
* for \\3 ( finally the > )
* for \\4 ( <br followed by any number of spaces, the optional slash and ending with > )
* regex modifier : i - using a case-insensitive match, as upper <TAGS> are valid in HTML
* regex modifier : s - using the dot metacharacter in the pattern to match all characters, including newlines */
$br2nl[] = "%(<\s*/?$tag)(.*?)([^>]*>)(<br\s*/?>)%is";
}
if(sizeof($br2nl)) $entry = preg_replace($br2nl, '\\1\\2\\3', $entry);
return $entry;
}
/* Insert <p class="whiteline" at paragraphs ending with two newlines /* Insert <p class="whiteline" at paragraphs ending with two newlines
* Insert <p class="break" at paragraphs ending with one nl * Insert <p class="break" at paragraphs ending with one nl
* @param string text * @param string text
@ -193,7 +319,7 @@ p.break {
} }
//Standardize line endings: //Standardize line endings:
//DOS to Unix and Mac to Unix //DOS to Unix and Mac to Unix
$text = str_replace(array("\r\n", "\r"), "\n", $text); $text = str_replace(array("\r\n", "\r"), "\n", $text);
$text = str_split($text); $text = str_split($text);
$big_p = '<p class="whiteline">'; $big_p = '<p class="whiteline">';