<?php

    define( "PLOG_PROJECT_PAGE", "http://www.lifetype.net" );
    
    if ( !defined("DEFAULT_VERSION_FILE") )
      define( "DEFAULT_VERSION_FILE", PLOG_CLASS_PATH . "version.php" );

    /**
     * \ingroup Misc
     *
     * Returns the current version of plog as well as a link to the project page
     */
    class Version  
    {

        /**
         * Returns the current version of pLog, determined by the value of the $version
         * variable in the version.php file.
         * If the file is not available, the result is unknown.
         * @static
         * @return The version identifier.
         */
        function getVersion()
        {
			lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );		
            $versionFile = PLOG_CLASS_PATH."version.php";
			$version = "undefined";

            if( File::isReadable( $versionFile )) {
                include( $versionFile );
            } else {
                $version = "UNKNOWN";
            }
            return $version;
        }

        /**
         * Returns the official page of the project.
         *
         * @return The official project page.
         * @static
         */
        function getProjectPage()
        {
            return PLOG_PROJECT_PAGE;
        }
		
		/**
		 * Compares two LT versions
		 *
		 * @param v1
		 * @param v2
		 * @return 1 if v1>v2, 0 if v1==v2 and -1 if v1<v2
		 * @see http://www.php.net/manual/en/function.version-compare.php
		 * @static
		 */
		function compare( $v1, $v2 )
		{
			return( version_compare( $v1, $v2 ));
		}
    }
?>
