Update of /cvsroot/php-blog/additional_plugins/serendipity_event_emoticonchooser
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1539
Modified Files:
serendipity_event_emoticonchooser.php
Log Message:
linefeeds, depend on serendipity_event_emoticate
Index: serendipity_event_emoticonchooser.php
===================================================================
RCS file: /cvsroot/php-blog/additional_plugins/serendipity_event_emoticonchooser/serendipity_event_emoticonchooser.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- serendipity_event_emoticonchooser.php 17 Dec 2004 10:31:17 -0000 1.1
+++ serendipity_event_emoticonchooser.php 17 Dec 2004 10:32:13 -0000 1.2
@@ -1,98 +1,102 @@
-<?php # $Id$
-
-switch ($serendipity['lang']) {
- case 'de':
- @define('PLUGIN_EVENT_EMOTICONCHOOSER_TITLE', 'Smilie-Auswahlleiste');
- @define('PLUGIN_EVENT_EMOTICONCHOOSER_DESC', 'Zeigt eine Auswahlleiste bei der Erstellung eines Eintrags um Smilies einzufügen.');
- break;
-
- case 'en':
- case 'es':
- default:
- @define('PLUGIN_EVENT_EMOTICONCHOOSER_TITLE', 'Show Emoticon toolbar');
- @define('PLUGIN_EVENT_EMOTICONCHOOSER_DESC', 'Shows a toolbar to select emoticons to insert into your entry');
- break;
-}
-
-class serendipity_event_emoticonchooser extends serendipity_event
-{
- var $title = PLUGIN_EVENT_EMOTICONCHOOSER_TITLE;
-
- function introspect(&$propbag)
- {
- global $serendipity;
-
- $propbag->add('name', PLUGIN_EVENT_EMOTICONCHOOSER_TITLE);
- $propbag->add('description', PLUGIN_EVENT_EMOTICONCHOOSER_DESC);
- $propbag->add('stackable', false);
- $propbag->add('author', 'Garvin Hicking');
- $propbag->add('version', '1.0');
- $propbag->add('event_hooks', array(
- 'backend_entry_toolbar_extended' => true,
- 'backend_entry_toolbar_body' => true,
- ));
- }
-
- function generate_content(&$title) {
- $title = PLUGIN_EVENT_EMOTICONCHOOSER_TITLE;
- }
-
- function event_hook($event, &$bag, &$eventData) {
- global $serendipity;
-
- $hooks = &$bag->get('event_hooks');
- if (isset($hooks[$event])) {
- switch($event) {
- case 'backend_entry_toolbar_extended':
- $txtarea = 'extended';
-
- case 'backend_entry_toolbar_body':
- if (!isset($txtarea)) {
- $txtarea = 'body';
- }
-
- $i = 1;
- $emoticons = serendipity_event_emoticate::getEmoticons();
- $unique = array();
- foreach($emoticons as $key => $value) {
- $unique[$value] = $key;
- }
-?>
-<script type="text/javascript">
-function use_emoticon_<?php echo $txtarea; ?>(img) {
- txtarea = document.getElementById('serendipity[<?php echo $txtarea; ?>]');
- if (txtarea.createTextRange && txtarea.caretPos) {
- caretPos = txtarea.caretPos;
- caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + ' ' + img + ' ' : caretPos.text + ' ' + img + ' ';
- txtarea.focus();
- } else {
- txtarea.value += ' ' + img + ' ';
- txtarea.focus();
- }
-}
-</script>
-<?php
- echo '<div style="text-align: right; margin-top: 5px">';
- foreach($unique as $value => $key) {
- echo '<a href="javascript:use_emoticon_' . $txtarea . '(\'' . addslashes($key) . '\')" title="' . $key . '"><img src="'. $value .'" style="border: 0px" /></a> ';
- if ($i++ % 10 == 0) {
- echo '<br />';
- }
- }
- echo '</div>';
-
- return true;
- break;
-
- default:
- return false;
- break;
- }
- } else {
- return false;
- }
- }
-}
-
-/* vim: set sts=4 ts=4 expandtab : */
-?>
+<?php # $Id$
+
+switch ($serendipity['lang']) {
+ case 'de':
+ @define('PLUGIN_EVENT_EMOTICONCHOOSER_TITLE', 'Smilie-Auswahlleiste');
+ @define('PLUGIN_EVENT_EMOTICONCHOOSER_DESC', 'Zeigt eine Auswahlleiste bei der Erstellung eines Eintrags um Smilies einzufügen.');
+ break;
+
+ case 'en':
+ case 'es':
+ default:
+ @define('PLUGIN_EVENT_EMOTICONCHOOSER_TITLE', 'Show Emoticon toolbar');
+ @define('PLUGIN_EVENT_EMOTICONCHOOSER_DESC', 'Shows a toolbar to select emoticons to insert into your entry');
+ break;
+}
+
+class serendipity_event_emoticonchooser extends serendipity_event
+{
+ var $title = PLUGIN_EVENT_EMOTICONCHOOSER_TITLE;
+
+ function introspect(&$propbag)
+ {
+ global $serendipity;
+
+ $propbag->add('name', PLUGIN_EVENT_EMOTICONCHOOSER_TITLE);
+ $propbag->add('description', PLUGIN_EVENT_EMOTICONCHOOSER_DESC);
+ $propbag->add('stackable', false);
+ $propbag->add('author', 'Garvin Hicking');
+ $propbag->add('version', '1.0');
+ $propbag->add('event_hooks', array(
+ 'backend_entry_toolbar_extended' => true,
+ 'backend_entry_toolbar_body' => true,
+ ));
+ }
+
+ function generate_content(&$title) {
+ $title = PLUGIN_EVENT_EMOTICONCHOOSER_TITLE;
+ }
+
+ function event_hook($event, &$bag, &$eventData) {
+ global $serendipity;
+
+ if (!class_exists('serendipity_event_emoticate')) {
+ return false;
+ }
+
+ $hooks = &$bag->get('event_hooks');
+ if (isset($hooks[$event])) {
+ switch($event) {
+ case 'backend_entry_toolbar_extended':
+ $txtarea = 'extended';
+
+ case 'backend_entry_toolbar_body':
+ if (!isset($txtarea)) {
+ $txtarea = 'body';
+ }
+
+ $i = 1;
+ $emoticons = serendipity_event_emoticate::getEmoticons();
+ $unique = array();
+ foreach($emoticons as $key => $value) {
+ $unique[$value] = $key;
+ }
+?>
+<script type="text/javascript">
+function use_emoticon_<?php echo $txtarea; ?>(img) {
+ txtarea = document.getElementById('serendipity[<?php echo $txtarea; ?>]');
+ if (txtarea.createTextRange && txtarea.caretPos) {
+ caretPos = txtarea.caretPos;
+ caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + ' ' + img + ' ' : caretPos.text + ' ' + img + ' ';
+ txtarea.focus();
+ } else {
+ txtarea.value += ' ' + img + ' ';
+ txtarea.focus();
+ }
+}
+</script>
+<?php
+ echo '<div style="text-align: right; margin-top: 5px">';
+ foreach($unique as $value => $key) {
+ echo '<a href="javascript:use_emoticon_' . $txtarea . '(\'' . addslashes($key) . '\')" title="' . $key . '"><img src="'. $value .'" style="border: 0px" /></a> ';
+ if ($i++ % 10 == 0) {
+ echo '<br />';
+ }
+ }
+ echo '</div>';
+
+ return true;
+ break;
+
+ default:
+ return false;
+ break;
+ }
+ } else {
+ return false;
+ }
+ }
+}
+
+/* vim: set sts=4 ts=4 expandtab : */
+?>
|