Is there a way (of course there is I guess
Any hints?
Thx & regards
Code: Select all
Index: serendipity_event_emoticonchooser.php
===================================================================
RCS file: /cvsroot/php-blog/additional_plugins/serendipity_event_emoticonchooser/serendipity_event_emoticonchooser.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- serendipity_event_emoticonchooser.php 8 Jul 2005 13:07:46 -0000 1.11
+++ serendipity_event_emoticonchooser.php 24 Jul 2005 12:23:57 -0000 1.12
@@ -1,4 +1,4 @@
-<?php # $Id: serendipity_event_emoticonchooser.php,v 1.11 2005/07/08 13:07:46 garvinhicking Exp $
+<?php # $Id: serendipity_event_emoticonchooser.php,v 1.12 2005/07/24 12:23:57 garvinhicking Exp $
// Probe for a language include with constants. Still include defines later on, if some constants were missing
$probelang = dirname(__FILE__) . '/lang_' . $serendipity['lang'] . '.inc.php';
@@ -10,6 +10,7 @@
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. Funktioniert NICHT im WYSIWYG-Editor!');
+ @define('PLUGIN_EVENT_EMOTICONCHOOSER_FRONTEND', 'Smilie-Auswahl für Kommentare anbieten?');
break;
case 'en':
@@ -17,6 +18,7 @@
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. Does NOT work in the WYSIWYG editor!');
+ @define('PLUGIN_EVENT_EMOTICONCHOOSER_FRONTEND', 'Show emoticon selector for comments?');
break;
}
@@ -37,18 +39,35 @@
'smarty' => '2.6.7',
'php' => '4.1.0'
));
- $propbag->add('version', '1.1');
+ $propbag->add('version', '1.2');
$propbag->add('event_hooks', array(
'backend_entry_toolbar_extended' => true,
'backend_entry_toolbar_body' => true,
+ 'frontend_comment' => true
));
$propbag->add('groups', array('BACKEND_EDITOR'));
+ $propbag->add('configuration', array('frontend'));
}
function generate_content(&$title) {
$title = PLUGIN_EVENT_EMOTICONCHOOSER_TITLE;
}
+ function introspect_config_item($name, &$propbag)
+ {
+ switch($name) {
+ case 'frontend':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', PLUGIN_EVENT_EMOTICONCHOOSER_FRONTEND);
+ $propbag->add('description', '');
+ $propbag->add('default', false);
+ return true;
+ break;
+ }
+ return false;
+ }
+
+
function event_hook($event, &$bag, &$eventData) {
global $serendipity;
@@ -59,12 +78,28 @@
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
switch($event) {
+ case 'frontend_comment':
+ if (serendipity_db_bool($this->get_config('frontend', false)) === false) {
+ break;
+ }
+ $txtarea = 'serendipity_commentform_comment';
+ $func = 'comment';
+ $style = '';
+
case 'backend_entry_toolbar_extended':
- $txtarea = 'extended';
+ if (!isset($txtarea)) {
+ $txtarea = 'serendipity[extended]';
+ $func = 'extended';
+ }
case 'backend_entry_toolbar_body':
if (!isset($txtarea)) {
- $txtarea = 'body';
+ $txtarea = 'serendipity[body]';
+ $func = 'body';
+ }
+
+ if (!isset($style)) {
+ $style = 'text-align: right; margin-top: 5px';
}
$i = 1;
@@ -78,8 +113,8 @@
}
?>
<script type="text/javascript">
-function use_emoticon_<?php echo $txtarea; ?>(img) {
- txtarea = document.getElementById('serendipity[<?php echo $txtarea; ?>]');
+function use_emoticon_<?php echo $func; ?>(img) {
+ txtarea = document.getElementById('<?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 + ' ';
@@ -92,9 +127,9 @@
}
</script>
<?php
- echo '<div style="text-align: right; margin-top: 5px">';
+ echo '<div id="serendipity_emoticonchooser" style="' . $style . '">';
foreach($unique as $value => $key) {
- echo '<a href="javascript:use_emoticon_' . $txtarea . '(\'' . addslashes($key) . '\')" title="' . $key . '"><img src="'. $value .'" style="border: 0px" /></a> ';
+ echo '<a href="javascript:use_emoticon_' . $func . '(\'' . addslashes($key) . '\')" title="' . $key . '"><img src="'. $value .'" style="border: 0px" /></a> ';
if ($i++ % 10 == 0) {
echo '<br />';
}
Did you try to install serendipity_event_emoticonchooser plugin ? It is here in CVS or in additional_plugins.tgz.kj wrote:Hi, I would like to use this function of emoticon choice to people who comment. How can I do this ? Where should I paste the Garvin's note? In which plug in should I use? thanks for your help.