grep is your friend.
You don't even have to use the conditional. The Discussion or Comment will be in $Sender->EventArguments['Object'] regardless of what type it is.
$Sender->EventArguments['Object']
$Sender->EventArguments['Object']->Body = ParseSyntax($Sender->EventArguments['Object']->Body);
$Args['Object']
<?phpif (!defined('APPLICATION')) exit(); $PluginInfo['PlainFormatter'] = array( 'Name' => 'Plain Formatter PLUGIN', 'Description' => 'Very plain formatter', 'Version' => '1.0', 'Author' => "JohansonLocker", 'AuthorEmail' => '', 'AuthorUrl' => '');Gdn::FactoryInstall('BBCodeFormatter', 'PlainFormatter', __FILE__, Gdn::FactorySingleton); class PlainFormatter extends Gdn_Plugin { public function Format($Text) { return "PlainFormatter".$Text; } public function Setup() {// Nothing to do here! }}
Comments
grep is your friend.
$Sender->EventArguments['Object']->Body = ParseSyntax($Sender->EventArguments['Object']->Body);
Cool.
$Args['Object']
with the second parameter being $Argsgrep is your friend.
<?php
if (!defined('APPLICATION'))
exit();
$PluginInfo['PlainFormatter'] = array(
'Name' => 'Plain Formatter PLUGIN',
'Description' => 'Very plain formatter',
'Version' => '1.0',
'Author' => "JohansonLocker",
'AuthorEmail' => '',
'AuthorUrl' => ''
);
Gdn::FactoryInstall('BBCodeFormatter', 'PlainFormatter', __FILE__, Gdn::FactorySingleton);
class PlainFormatter extends Gdn_Plugin {
public function Format($Text) {
return "PlainFormatter
".$Text;
}
public function Setup() {// Nothing to do here!
}
}
but there's a bug - Factory doesn't work on Discussiom subject post.
the one is bbcode for replies, and the other is html for subject with same parser.