<?php
/*
Plugin Name: Post Updated
Plugin URI: http://guff.szub.net/post-updated
Description: Display notice/date/time of when a post was last updated.
Version: R1
Author: Kaf Oseo
Author URI: http://szub.net
*/
/*
Copyright (c) 2005
Released under the GPL license
http://www.gnu.org/licenses/gpl.txt

    This is a WordPress plugin (http://wordpress.org).

    WordPress is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License,
    or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.

    For a copy of the GNU General Public License, write to:

    Free Software Foundation, Inc.
    59 Temple Place, Suite 330
    Boston, MA  02111-1307
    USA

    You can also view a copy of the HTML version of the GNU General
    Public License at http://www.gnu.org/copyleft/gpl.html
*/

function post_updated($format=''$hours=3$before='Last updated: '$after=''$gmt=false$display=true) {
    global 
$post;

    if(
$gmt) {
        
$post_date $post->post_date_gmt;
        
$mod_date =  $post->post_modified_gmt;
    } else { 
        
$post_date $post->post_date;
        
$mod_date =  $post->post_modified;
    }
    
$post_u mysql2date('U'$post_date);
    
$mod_u mysql2date('U'$mod_date);
    
$post2mod $mod_u $post_u;

    if(
$hours ceil($post2mod/3600)) {
        if(
'' == $format) {
            
$last_updated mysql2date(get_settings('date_format'), $mod_date) . ' @ ' mysql2date(get_settings('time_format'), $mod_date);
        } else {
            
$last_updated mysql2date($format$mod_date);
        }
        if(
$display) {
            echo 
$before $last_updated $after;
        } else {
            return 
$last_updated;
        }
    }
}
?>