<?php
class NP_CommentLinkAdd extends NucleusPlugin {
function getName() { return 'CommentLinkAdd'; }
function getAuthor() { return 'Pavel Jaros'; }
function getURL() { return 'http://jaros.ezin.cz/'; }
function getVersion() { return '1.0'; }
function getDescription() {
return 'CommentLinkAdd replaces strings like [X] in comment body by link to comment with number X';
}
function getEventList() { return array('PreComment'); }
function event_PreComment($data) {
$data['comment']['body'] = preg_replace('#\[[0-9]+\]#', '<a href="#c~\\0~">\\0</a>:', $data['comment']['body']);
$data['comment']['body'] = str_replace(Array('~[', ']~'), '', $data['comment']['body']);
}
}
?>