add('name', PLUGIN_EVENT_EMOTICONCHOOSER_TITLE); $propbag->add('description', PLUGIN_EVENT_EMOTICONCHOOSER_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking, Jay Bertrandt, Ian'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', 'php' => '4.1.0' )); $propbag->add('version', '2.12.1'); $propbag->add('event_hooks', array( 'backend_entry_toolbar_extended' => true, 'backend_entry_toolbar_body' => true, 'frontend_comment' => true, 'backend_header' => true, 'frontend_footer' => true, 'css_backend' => true )); $propbag->add('groups', array('BACKEND_EDITOR')); $propbag->add('configuration', array('frontend', 'popup', 'button', 'popuptext')); } 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; case 'popup': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_EMOTICONCHOOSER_POPUP); $propbag->add('description', ''); $propbag->add('default', false); return true; break; case 'button': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_EVENT_EMOTICONCHOOSER_POPUP_BUTTON); $propbag->add('description', 'default: as link'); $propbag->add('default', false); return true; break; case 'popuptext': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_EVENT_EMOTICONCHOOSER_POPUPTEXT); $propbag->add('description', ''); $propbag->add('default', PLUGIN_EVENT_EMOTICONCHOOSER_POPUPTEXT_DEFAULT); return true; break; } return false; } function event_hook($event, &$bag, &$eventData, $addData = null) { global $serendipity; if (!class_exists('serendipity_event_emoticate')) { return false; } $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 = ''; $popcl = ''; case 'backend_entry_toolbar_extended': if (!isset($txtarea)) { $txtarea = 'serendipity[extended]'; $func = 'extended'; } case 'backend_entry_toolbar_body': if (!isset($txtarea)) { if (isset($eventData['backend_entry_toolbar_body:textarea'])) { // event caller has given us the name of the textarea converted // into a wysiwg editor(for example, the staticpages plugin) $txtarea = $eventData['backend_entry_toolbar_body:textarea']; } else { // default value $txtarea = 'serendipity[body]'; } if (isset($eventData['backend_entry_toolbar_body:nugget'])) { $func = $eventData['backend_entry_toolbar_body:nugget']; } else{ $func = 'body'; } } // CKEDITOR and plain editor need this little switch if (preg_match('@^nugget@i', $func)) { $cke_txtarea = $func; } else { $cke_txtarea = $txtarea; } if (!isset($popcl)) { $popcl = ' serendipityPrettyButton'; } if (!isset($style)) { $style = 'margin-top: 5px; vertical-align: bottom'; } $popupstyle = ''; $popuplink = ''; if (serendipity_db_bool($this->get_config('popup', false))) { $popupstyle = '; display: none'; $popuplink = serendipity_db_bool($this->get_config('button', false)) ? '' : '' . $this->get_config('popuptext') . ''; } $i = 1; // This plugin wants to access serendipity_event_emoticate. Its methods are non-static // and it's not properly working with PHP5 to call. So to perform properly, let's take // the actual plugin: $plugins = serendipity_plugin_api::get_event_plugins(); $emoticate_plugin = null; foreach ($plugins as $plugin => $plugin_data) { if (strpos($plugin, 'serendipity_event_emoticate') !== FALSE) { $emoticate_plugin =& $plugin_data['p']; break; } } if ($emoticate_plugin === null) { return; } $emoticons = $emoticate_plugin->getEmoticons(); $unique = array(); foreach($emoticons as $key => $value) { if (is_callable(array($emoticate_plugin, 'humanReadableEmoticon'))) { $key = $emoticate_plugin->humanReadableEmoticon($key); } $unique[$value] = $key; } // script include has to stick to to backend_header, while using inline onclick (see above) if (defined('IN_serendipity_admin') && IN_serendipity_admin === true) { ?>
'."\n"; foreach($unique as $value => $key) { echo ' ' . $key . ' '."\n"; if ($i++ % 10 == 0) { echo "
\n"; } } echo '
'."\n"; echo '
'."\n"; return true; break; case 'backend_header': case 'frontend_footer': ?> .serendipity_toggle_emoticon_bar.serendipityPrettyButton { display: inline-block; margin: 0 auto 1px; } .serendipity_emoticon_bar { margin: 3px auto 0; text-align: right; }