[ljcom] r12423: LJSUP-13151: Sony branding of main page
Committer: afedorov
LJSUP-13151: Sony branding of main pageU trunk/cgi-bin/LJ/Hooks/Homepage.pm
Modified: trunk/cgi-bin/LJ/Hooks/Homepage.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/Homepage.pm 2012-08-06 14:09:16 UTC (rev 12422)
+++ trunk/cgi-bin/LJ/Hooks/Homepage.pm 2012-08-06 14:46:14 UTC (rev 12423)
@@ -20,7 +20,14 @@
return 1;
}
-sub LJ::_is_branding_active {
+# recognized %opts:
+# countries (an arrayref, defaults to ['RU'])
+# For example: LJ::_is_branding_active( countries => ['RU', 'BY', 'UA'] )
+sub LJ::_is_branding_active {
+ my %opts = @_;
+
+ my $countries = ( ref(%opts{countries}) eq 'ARRAY' ) ? %opts{countries} : ['RU'];
+
## Only homepage must be branded
return unless LJ::Request->hostname eq "www.$LJ::DOMAIN";
@@ -34,7 +41,7 @@
my $country = LJ::GeoLocation->get_country_info_by_ip;
my $time = time();
- return unless grep {$_ eq $country} qw{BY RU UA};
+ return unless grep {$_ eq $country} @$countries;
## only Cyr users
return unless LJ::SUP->is_remote_sup;
@@ -56,7 +63,7 @@
# Sony pictures "Totall Recall"
# 6 august 00:00 - 12 august 23:59
- if (LJ::_is_branding_active() && ($time >= 1344196800 && $time < 1344801600)) {
+ if (LJ::_is_branding_active( countries => ['RU'] ) && ($time >= 1344196800 && $time < 1344801600)) {
my $rnd = int(rand(1_000_000));
return '<a href="http://ad.adriver.ru/cgi-bin/click.cgi?sid=1&bt=21&ad=351561&pid=896467&bid=1923794&bn=1923794&rnd=' . $rnd . '" target="_blank" class="sony-link"> </a><img src="http://ad.adriver.ru/cgi-bin/rle.cgi?sid=1&bt=21&ad=351561&pid=896467&bid=1923794&bn=1923794&rnd=' . $rnd . '" width="1" height="1" border="0" class="sony-pixel" />';
}
@@ -68,7 +75,7 @@
# Sony pictures "Totall Recall"
# 6 august 00:00 - 12 august 23:59
- if (LJ::_is_branding_active() && ($time >= 1344196800 && $time < 1344801600)) {
+ if (LJ::_is_branding_active( countries => ['RU'] ) && ($time >= 1344196800 && $time < 1344801600)) {
LJ::need_res("stc/reskining/2012/august/sony/sony.css");
}

