diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-12-07 08:49:06 +0100 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-12-07 08:49:06 +0100 |
commit | ebf1501f6d253ef906c44bae278a2f80ffcb9f54 (patch) | |
tree | 433bac6de834b9584a965e87d39793fee0a846ac /inc/changelog.php | |
parent | 5aa52fafe8be8e728c0d2c9ff12c999e80766127 (diff) | |
download | rpg-ebf1501f6d253ef906c44bae278a2f80ffcb9f54.tar.gz rpg-ebf1501f6d253ef906c44bae278a2f80ffcb9f54.tar.bz2 |
changelog type strings replaced with constants
Using more verbose constant names in the place of single character strings
should make the code much more readable. This does not change the behavior
of the changelog.
darcs-hash:20061207074906-05dcb-0bdc35e7241bf14063b2b43a6ff26d8a3c307cb9.gz
Diffstat (limited to 'inc/changelog.php')
-rw-r--r-- | inc/changelog.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/inc/changelog.php b/inc/changelog.php index 43d18f148..c985e5694 100644 --- a/inc/changelog.php +++ b/inc/changelog.php @@ -6,6 +6,14 @@ * @author Andreas Gohr <andi@splitbrain.org> */ +// Constants for known core changelog line types. +// Use these in place of string literals for more readable code. +define('DOKU_CHANGE_TYPE_CREATE', 'C'); +define('DOKU_CHANGE_TYPE_EDIT', 'E'); +define('DOKU_CHANGE_TYPE_MINOR_EDIT', 'e'); +define('DOKU_CHANGE_TYPE_DELETE', 'D'); +define('DOKU_CHANGE_TYPE_REVERT', 'R'); + /** * parses a changelog line into it's components * @@ -33,7 +41,7 @@ function parseChangelogLine($line) { * @author Esther Brunner <wikidesign@gmail.com> * @author Ben Coburn <btcoburn@silicodon.net> */ -function addLogEntry($date, $id, $type='E', $summary='', $extra='', $flags=null){ +function addLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extra='', $flags=null){ global $conf, $INFO; // check for special flags as keys @@ -43,8 +51,8 @@ function addLogEntry($date, $id, $type='E', $summary='', $extra='', $flags=null) $id = cleanid($id); $file = wikiFN($id); $created = @filectime($file); - $minor = ($type==='e'); - $wasRemoved = ($type==='D'); + $minor = ($type===DOKU_CHANGE_TYPE_MINOR_EDIT); + $wasRemoved = ($type===DOKU_CHANGE_TYPE_DELETE); if(!$date) $date = time(); //use current time if none supplied $remote = (!$flagExternalEdit)?$_SERVER['REMOTE_ADDR']:'127.0.0.1'; @@ -147,7 +155,7 @@ function _handleRecent($line,$ns,$flags){ if(isset($seen[$recent['id']])) return false; // skip minors - if($recent['type']==='e' && ($flags & RECENTS_SKIP_MINORS)) return false; + if($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT && ($flags & RECENTS_SKIP_MINORS)) return false; // remember in seen to skip additional sights $seen[$recent['id']] = 1; |