diff options
author | louise <louise> | 2009-10-19 16:44:55 +0000 |
---|---|---|
committer | louise <louise> | 2009-10-19 16:44:55 +0000 |
commit | 919fa71532b88ed2182dce2edf240988eb6c5ec3 (patch) | |
tree | 4d03dc95931a579bb15b27e9172cb8badbd4fa29 /perllib/Cobrand.pm | |
parent | 4e769b6c42a7d320748058399ae613a34b1d7dac (diff) |
Add hooks for cobrands to add extra checks on location and disallow the display of photos
Diffstat (limited to 'perllib/Cobrand.pm')
-rw-r--r-- | perllib/Cobrand.pm | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm index d4d76aeec..7611103d5 100644 --- a/perllib/Cobrand.pm +++ b/perllib/Cobrand.pm @@ -7,7 +7,7 @@ # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. # Email: louise@mysociety.org. WWW: http://www.mysociety.org # -# $Id: Cobrand.pm,v 1.28 2009-10-19 11:10:32 louise Exp $ +# $Id: Cobrand.pm,v 1.29 2009-10-19 16:44:55 louise Exp $ package Cobrand; use strict; @@ -490,6 +490,43 @@ sub allow_photo_upload { } } +=item allow_photo_display COBRAND + +Return a boolean indicating whether the cobrand allows photo display + +=cut + +sub allow_photo_display { + my ($cobrand) = @_; + my $handle; + if ($cobrand){ + $handle = cobrand_handle($cobrand); + } + if ( !$cobrand || !$handle || !$handle->can('allow_photo_display')){ + return 1; + } else{ + return $handle->allow_photo_display(); + } +} + +=item location_check COBRAND LOCATION QUERY + +Return a boolean indicating whether the location passed any extra location checks defined by the cobrand +using data in the query +=cut +sub location_check { + my ($cobrand, $location, $query) = @_; + my $handle; + if ($cobrand){ + $handle = cobrand_handle($cobrand); + } + if ( !$cobrand || !$handle || !$handle->can('location_check')){ + return 1; + } else{ + return $handle->location_check($location, $query); + } +} + 1; |