'50',
'height' => '2',
'wrap' => 'virtual'));
$xCommentVars['date_format'] = '%a, %d %b %Y';
$xCommentVars['time_format'] = '%I:%M%p';
$xCommentVars['comment_template'] = "\$Comment[[<<]]\n[+-\$Author+] [-(\$Date, \$Time)-]\n----\n[[x-comment:]]";
$xCommentVars['form_template'] = "
";
}
function ShowXCommentForm($user_input) {
xCommentInit($xCommentParams, $xCommentVars);
return Keep("\n"
. $xCommentVars['form_template']
. "\n");
}
function HandleXCommentPost($pagename) {
global $pagename;
xCommentInit($xCommentParams, $xCommentVars);
$comment = stripmagic($_POST['text']);
$author = stripmagic($_POST['author']);
if ($author=='')
{$author = 'Anonymous';}
$current_epoc_time = time();
$date = strftime($xCommentVars['date_format'],$current_epoc_time);
$time = strftime($xCommentVars['time_format'],$current_epoc_time);
$template = $xCommentVars['comment_template'];
$template = str_replace("\$Date", $date, $template);
$template = str_replace("\$Time", $time, $template);
$template = str_replace("\$Author", $author, $template);
$template = str_replace("\$Comment", $comment, $template);
$existing_page = RetrieveAuthPage($pagename, "edit");
$text = $existing_page['text'];
$text = preg_replace("/\\[\\[x-comment:(.*?)\\]\\]/", $template, $text);
//$text = preg_replace("/^\\[\\[x-comment:(.*?)\\]\\]/", $template, $text);
$_POST['text'] = $text;
HandlePost($pagename);
exit;
}
$DoubleBrackets["/^\\[\\[x-comment:(.*?)\\]\\]/e"] = 'ShowXCommentForm("$1");';
$HandleActions['post_x_comment'] = 'HandleXCommentPost';
?>