<?php /* Plugin Name: Trac Ticket Number/Link Conversion Description: Replaces #123 with a link to the ticket on Trac, and wiki:MyPage with a link to Trac's wiki page MyPage Author: Russell Jurney */ function convert_ticket($text) { $link = preg_replace('/[^&]#([0-9]+)/m', " <a href='/trac/myproject/ticket/$1'>#$1", $text); return $link; } function convert_wiki($text) { $link = preg_replace('/wiki:(\w+)/m', "$1", $text); return $link; } add_filter('the_content', 'convert_ticket'); add_filter('the_content', 'convert_wiki'); ?> WordPress/Trac Integration Plugin |