* @author: Robert Bienert * @version: 0.6 * @date: 2012-04-24 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Dieses Plugin erweitert BBCode um die folgenden Tags: * ins: eingefuegter Text * del: geloeschter Text * cite: (Zitat-) Quelle * xcode: inline Code * q: inline Zitat * * Im Adminbereich stehen darueber hinaus noch folgende Tags, jeweils * mit Parameter, zur Verfuegung: * q: inline Zitat mit Quelle (URI) * abbr: Abkuerzung mit Erlaeuterung * acronym: Akronym mit Erlaeuterung */ # TODO: komfortables JavaScript fuer: q=, abbr=, acronym= //-- // Hilfsfunktionen fuer erweiterte BBCodes function semanticBBCode_doQ($action, $attr, $ct, $param, & $node) { if ($action == 'validate') { if (isset($attr['default'])) { } return true; // kein Quell-URI gesetzt } $cite = isset($attr['default']) ? ' cite="'.htmlspecialchars($attr['default']).'"' : NULL; return "{$ct}"; } function semanticBBCode_doAbbrAcronym($action, $attr, $ct, $param, & $node) { if ($action == 'validate') return isset($attr['default']); return "<{$param['tag']} title='" . htmlspecialchars($attr['default']) . "'>{$ct}"; } class SemanticBBCode extends JlogPlugin { //-- // Funktionen fuer Administratoren/Autoren: function hook_bbcode($bbc) { $this->_private_BBCode_($bbc); $bbc->addCode('q', 'callback_replace', 'semanticBBCode_doQ', array('usecontent_param' => 'default'), 'inline', array('block', 'inline', 'listitem', 'link'), array()); $bbc->addCode('abbr', 'callback_replace', 'semanticBBCode_doAbbrAcronym', array('usecontent_param' => 'default', 'tag' => 'abbr'), 'inline', array('block', 'inline', 'listitem', 'link'), array()); $bbc->addCode('acronym', 'callback_replace', 'semanticBBCode_doAbbrAcronym', array('usecontent_param' => 'default', 'tag' => 'acronym'), 'inline', array('block', 'inline', 'listitem', 'link'), array()); return $bbc; } function hook_adminForm($form, $data) { return $form . $this->_private_BBCodeButtons_() . # TODO sehr einfache Testvariante ""; } //-- // Funktionen fuer Kommentatoren: function hook_bbcomments($bbc) { $this->_private_BBCode_($bbc); $bbc->addCode('q', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('block', 'inline', 'link'), array()); return $bbc; } function hook_commentForm($form, $cf) { return $this->_private_BBCodeButtons_() . $form; } // Infodarstellung function hook_adminContent($output) { return <<Copyright © 2008 Robert Bienert, http://jeenaparadies.net/projects/jlog/wiki/plugins/SemanticBBCode

Dieses Plugin erweitert BBCode um die folgenden Tags:

ins
eingefügter Text
del
gelöschter Text
cite
(Zitat-) Quelle
xcode
inline Code
q
inline Zitat

Im Adminbereich stehen darüber hinaus noch folgende Tags, jeweils mit Parameter, zur Verfügung:

q
inline Zitat mit Quelle (URI)
abbr
Abkürzung mit Erläuterung
acronym
Akronym mit Erläuterung
EOT; } //-- // private Ressourcen fuer beide Arten von BBCode-Unterstuetzung // (Adminbereich und Kommentator) function _private_BBCode_(& $bbc) { $bbc->addCode('del', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('block', 'inline', 'link', 'listitem'), array()); $bbc->addCode('ins', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('block', 'inline', 'link', 'listitem'), array()); // Der Elementname 'xcode' ist dem MacOSXHints.ch-Forum // entliehen, dort heissen inline-codes ebenfalls so. $bbc->addCode('xcode', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('block', 'inline', 'link', 'listitem'), array()); $bbc->addCode('cite', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('block', 'inline', 'link', 'listitem'), array()); } function _private_BBCodeButtons_() { return " "; } } ?>