$item = $this->getItem($database, $table, $match);
// Reprocess the request for censorship if required
- if ($this->plugins->hasPlugin('Censor')) {
+ $attempts = 0;
+ while ($censor && $attempts < 3) {
$plugin = $this->plugins->getPlugin('Censor');
- $attempts = 0;
- while ($censor && $attempts < 3) {
- $clean = $plugin->cleanString($item->name);
- if ($item->name != $clean) {
- $attempts++;
- $item = $this->getItem($database, $table, $match);
- } else {
- $censor = false;
- }
- }
- if ($censor && $attempts == 3) {
- $this->doAction($this->event->getSource(), 'shrugs.');
+ $clean = $plugin->cleanString($item->name);
+ if ($item->name != $clean) {
+ $attempts++;
+ $item = $this->getItem($database, $table, $match);
+ } else {
+ $censor = false;
}
}
+ if ($censor && $attempts == 3) {
+ $this->doAction($this->event->getSource(), 'shrugs.');
+ }
+
// Derive the proper article for the item
if (preg_match('/^[aeiou]/i', $item->name)) {
$article = 'an';