Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -1213,41 +1213,52 @@ |
1214 | 1214 | |
1215 | 1215 | /** |
1216 | 1216 | * @param Array $flags |
1217 | | - * @return bool, is this revision at quality condition? |
| 1217 | + * @return bool, is this revision at basic review condition? |
1218 | 1218 | */ |
| 1219 | + public static function isSighted( $flags ) { |
| 1220 | + return self::tagsAtLevel( $flags, self::$minSL ); |
| 1221 | + } |
| 1222 | + |
| 1223 | + /** |
| 1224 | + * @param Array $flags |
| 1225 | + * @return bool, is this revision at quality review condition? |
| 1226 | + */ |
1219 | 1227 | public static function isQuality( $flags ) { |
1220 | | - if( empty($flags) ) return false; |
1221 | | - foreach( self::$dimensions as $f => $x ) { |
1222 | | - if( !isset($flags[$f]) || self::$minQL[$f] > $flags[$f] ) |
1223 | | - return false; |
1224 | | - } |
1225 | | - return true; |
| 1228 | + return self::tagsAtLevel( $flags, self::$minQL ); |
1226 | 1229 | } |
1227 | 1230 | |
1228 | 1231 | /** |
1229 | 1232 | * @param Array $flags |
1230 | | - * @return bool, is this revision at optimal condition? |
| 1233 | + * @return bool, is this revision at pristine review condition? |
1231 | 1234 | */ |
1232 | 1235 | public static function isPristine( $flags ) { |
| 1236 | + return self::tagsAtLevel( $flags, self::$minPL ); |
| 1237 | + } |
| 1238 | + |
| 1239 | + // Checks if $flags meets $reqFlagLevels |
| 1240 | + protected static function tagsAtLevel( $flags, $reqFlagLevels ) { |
1233 | 1241 | if( empty($flags) ) return false; |
1234 | 1242 | foreach( self::$dimensions as $f => $x ) { |
1235 | | - if( !isset($flags[$f]) || self::$minPL[$f] > $flags[$f] ) |
| 1243 | + if( !isset($flags[$f]) || $reqFlagLevels[$f] > $flags[$f] ) |
1236 | 1244 | return false; |
1237 | 1245 | } |
1238 | 1246 | return true; |
1239 | 1247 | } |
1240 | 1248 | |
1241 | 1249 | /** |
| 1250 | + * Get the quality tier of review flags |
1242 | 1251 | * @param Array $flags |
1243 | | - * @return int, flagging tier |
| 1252 | + * @return int, flagging tier (-1 for non-sighted) |
1244 | 1253 | */ |
1245 | 1254 | public static function getLevelTier( $flags ) { |
1246 | | - if( self::isPristine($flags ) ) |
| 1255 | + if( self::isPristine( $flags ) ) |
1247 | 1256 | return FR_PRISTINE; |
1248 | | - elseif( self::isQuality($flags ) ) |
| 1257 | + elseif( self::isQuality( $flags ) ) |
1249 | 1258 | return FR_QUALITY; |
| 1259 | + elseif( self::isSighted( $flags ) ) |
| 1260 | + return FR_SIGHTED; |
1250 | 1261 | else |
1251 | | - return 0; |
| 1262 | + return -1; |
1252 | 1263 | } |
1253 | 1264 | |
1254 | 1265 | /** |