Update of /cvsroot/php-blog/serendipity/plugins/serendipity_plugin_shoutbox
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28720/plugins/serendipity_plugin_shoutbox
Modified Files:
serendipity_plugin_shoutbox.php
Log Message:
immediately show plugin defaults in configuration screen instead of leaving
everything blank.
!!!!PLEASE TEST!!!!
Index: serendipity_plugin_shoutbox.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_plugin_shoutbox/serendipity_plugin_shoutbox.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- serendipity_plugin_shoutbox.php 3 May 2004 11:55:09 -0000 1.9
+++ serendipity_plugin_shoutbox.php 22 Jun 2004 13:45:49 -0000 1.10
@@ -15,7 +15,7 @@
@define('PLUGIN_SHOUTBOX_MAXENTRIES', 'Anzahl an Kommentaren');
@define('PLUGIN_SHOUTBOX_MAXENTRIES_BLAHBLAH', 'Wieviele Kommentare sollen gezeigt werden? (Standard: 15)');
break;
-
+
case 'en':
case 'es':
default:
@@ -37,10 +37,10 @@
function introspect(&$propbag)
{
global $serendipity;
-
+
$propbag->add('name', PLUGIN_SHOUTBOX_NAME);
$propbag->add('description', PLUGIN_SHOUTBOX_BLAHBLAH);
-
+
$propbag->add('configuration', array(
'wordwrap',
'max_chars',
@@ -55,24 +55,28 @@
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SHOUTBOX_WORDWRAP);
$propbag->add('description', PLUGIN_SHOUTBOX_WORDWRAP_BLAHBLAH);
+ $propbag->add('default', 30);
break;
case 'max_chars':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SHOUTBOX_MAXCHARS);
$propbag->add('description', PLUGIN_SHOUTBOX_MAXCHARS_BLAHBLAH);
+ $propbag->add('default', 120);
break;
case 'max_entries':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_SHOUTBOX_MAXENTRIES);
$propbag->add('description', PLUGIN_SHOUTBOX_MAXENTRIES_BLAHBLAH);
+ $propbag->add('default', 15);
break;
case 'dateformat':
$propbag->add('type', 'string');
$propbag->add('name', GENERAL_PLUGIN_DATEFORMAT);
$propbag->add('description', sprintf(GENERAL_PLUGIN_DATEFORMAT_BLAHBLAH, '%a, %m.%m.%Y %H:%M'));
+ $propbag->add('default', '%a, %d.%m.%Y %H:%M');
break;
default:
@@ -90,7 +94,7 @@
$max_chars = $this->get_config('max_chars');
$wordwrap = $this->get_config('wordwrap');
$dateformat = $this->get_config('dateformat');
-
+
//Put new shout into the database if necessary
if ($_REQUEST['action'] == 'fillshoutbox' && $_REQUEST['serendipity']['shouttext'] != '') {
@@ -108,8 +112,8 @@
$sql = sprintf(
"INSERT INTO %sshoutbox (
- timestamp,
- ip,
+ timestamp,
+ ip,
body
) VALUES (
%s,
@@ -123,7 +127,7 @@
serendipity_db_escape_string($_REQUEST['serendipity']['shouttext']));
serendipity_db_query($sql);
}
- if ( $serendipity['GET']['action'] == 'shoutboxdelete'
+ if ( $serendipity['GET']['action'] == 'shoutboxdelete'
&& $_SESSION['serendipityAuthedUser'] === true) {
$sql = sprintf("DELETE from %sshoutbox
WHERE id = %d
@@ -136,15 +140,15 @@
if (!$max_entries || !is_numeric($max_entries) || $max_entries < 1) {
$max_entries = 15;
}
-
+
if (!$max_chars || !is_numeric($max_chars) || $max_chars < 1) {
$max_chars = 120;
}
-
+
if (!$wordwrap || !is_numeric($wordwrap) || $wordwrap < 1) {
$wordwrap = 30;
}
-
+
if (!$dateformat || strlen($dateformat) < 1) {
$dateformat = '%a, %d.%m.%Y %H:%M';
}
@@ -175,18 +179,18 @@
if (count($aComment) > 1) {
$comment .= ' [...]';
}
-
+
$deleteLink = "";
if ($_SESSION['serendipityAuthedUser'] === true) {
$deleteLink = ' | <a href="' . $serendipity['baseURL']
- . '?serendipity[action]=shoutboxdelete&serendipity[comment_id]='
- . $row['comment_id'] . '">' . PLUGIN_SHOUTBOX_DELETE . '</a>';
+ . '?serendipity[action]=shoutboxdelete&serendipity[comment_id]='
+ . $row['comment_id'] . '">' . PLUGIN_SHOUTBOX_DELETE . '</a>';
}
$entry = array('comment' => wordwrap($comment, $wordwrap, "\n",1));
serendipity_plugin_api::hook_event('frontend_display', $entry);
echo "<b>" . htmlspecialchars(strftime($dateformat, $row['stamp'])) . '</b> <br />' . "\n"
- . $entry['comment']
+ . $entry['comment']
. $deleteLink
. '<br /><br /><br />' . "\n\n";
}
|