Simple SVN WordPress Widget

After getting bored on working on my final year project I decided to take a look at creating widgets word my blog. There are SVN hooks on my repositories that store the commit details in a SQL database. I thought I would create a widget that would pull out the last message and display it.

/*
Plugin Name: LastCommit
Plugin URI: http://blog.yeticode.co.uk/
Description: Gets Last Commit Message
Author: John Tindell
Version: 1
Author URI: http://blog.yeticode.co.uk/
*/
function lastCommit_widget() {

	$server = 'localhost';
	$link = mssql_connect($server, 'username', '************');
	echo '
  • '; echo "

    Last Commit

    "; if($link) { mssql_select_db('svnyeti', $link); $query = mssql_query('select top 1 * from SVNLog order by liLogEntryPk desc', $link); $row = mssql_fetch_array($query); print '

    ' . $row['lszLogEntry'] . '

    '; } echo '
  • '; } function init_lastCommit(){ register_sidebar_widget("LastCommit", "lastCommit_widget"); } add_action("plugins_loaded", "init_lastCommit");

    When I get more time I will develop this a bit more.

    Related Posts: