cakephp/cakephp — pull request #635 by mfjohansson (2012-05-05 17:19:30+00:00)
Title: Added some more intelligence to the CakeTime class

I improved the CakeTime Utility class a little.

The commit mainly improves the `CakeTime::timeAgoInWords()` by adding options for "accuracy", and a wrapping element around the output.

The accuracy option lets the developer decide how deep the date should be described. For example, the output could be set as `1 year, 3 months, 2 weeks, 3 days, 15 hours, 25 minutes, 7 seconds` or `1 year`.

The element parameter specifies an element which wraps the date, and also adds the input date as the title of it. E.g., by specifying `span` as parameter, the output would be `1 year, 2 months ago`.

Some of the variables in the function has been moved out to the class and can now be set static on the class.

Another function `CakeTime::isWithinNext()` was added for the ability to check if the date is within the specified period.