Holiday ext
This commit is contained in:
parent
79b4adf1d1
commit
fd9ab64132
33
contrib/holiday/main.php
Normal file
33
contrib/holiday/main.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Name: Holiday Theme
|
||||
* Author: DakuTree <thedakutree@codeanimu.net>
|
||||
* Link: http://www.codeanimu.net
|
||||
* License: GPLv2
|
||||
* Description: Use an additional stylesheet on certain holidays.
|
||||
*/
|
||||
class Holiday extends SimpleExtension {
|
||||
public function onInitExt(Event $event) {
|
||||
global $config;
|
||||
$config->set_default_bool("holiday_aprilfools", false);
|
||||
}
|
||||
|
||||
public function onSetupBuilding(Event $event) {
|
||||
global $config;
|
||||
$sb = new SetupBlock("Holiday Theme");
|
||||
$sb->add_bool_option("holiday_aprilfools", "Enable April Fools");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
public function onPageRequest(Event $event) {
|
||||
global $config;
|
||||
$date = /*date('d/m') == '01/01' ||date('d/m') == '14/02' || */date('d/m') == '01/04'/* || date('d/m') == '24/12' || date('d/m') == '25/12' || date('d/m') == '31/12'*/;
|
||||
if($date){
|
||||
if($config->get_bool("holiday_aprilfools")){
|
||||
$this->theme->display_holiday($date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
15
contrib/holiday/stylesheets/aprilfools.css
Normal file
15
contrib/holiday/stylesheets/aprilfools.css
Normal file
@ -0,0 +1,15 @@
|
||||
BODY {
|
||||
background: #F0F7FF;
|
||||
font-family: sans-serif;
|
||||
font-size: 14px;
|
||||
margin: 0px;
|
||||
/* It's a bit crazy but, april fools is supposed to be crazy.
|
||||
This flips the entire page upside down.
|
||||
TODO: Add a way for the user to disable this */
|
||||
|
||||
-webkit-transform: rotate(-180deg); /*Safari*/
|
||||
-moz-transform: rotate(-180deg); /*Firefox*/
|
||||
-o-transform: rotate(-180deg); /*Opera*/
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); /*IE6*/
|
||||
ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)"; /*IE7+?*/
|
||||
}
|
21
contrib/holiday/theme.php
Normal file
21
contrib/holiday/theme.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
class HolidayTheme extends Themelet {
|
||||
public function display_holiday($date) {
|
||||
global $page;
|
||||
if($date){
|
||||
$csssheet = "<link rel='stylesheet' href='".get_base_href()"/contrib/holiday/stylesheets/";
|
||||
|
||||
// April Fools
|
||||
// Flips the entire page upside down!
|
||||
// TODO: Make it possible for the user to turn this off!
|
||||
if(date('d/m') == '01/04'){
|
||||
$csssheet .= "aprilfools.css";
|
||||
//$holtag = "april_fools";
|
||||
}
|
||||
|
||||
$csssheet .= "' type='text/css'>";
|
||||
$page->add_html_header("$csssheet");
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user