bludit/bl-plugins/maintenancemode/plugin.php

37 lines
860 B
PHP
Raw Normal View History

2015-08-07 23:33:43 +02:00
<?php
2016-02-20 17:16:31 +01:00
class pluginMaintenanceMode extends Plugin {
2015-08-07 23:33:43 +02:00
public function init()
{
$this->dbFields = array(
'enable'=>true,
'message'=>'Temporarily down for maintenance.'
);
}
public function form()
{
global $Language;
$html = '<div>';
$html .= '<input name="enable" id="jsenable" type="checkbox" value="true" '.($this->getDbField('enable')?'checked':'').'>';
2016-02-20 17:16:31 +01:00
$html .= '<label class="forCheckbox" for="jsenable">'.$Language->get('Enable maintenance mode').'</label>';
2015-08-07 23:33:43 +02:00
$html .= '</div>';
$html .= '<div>';
$html .= '<label>'.$Language->get('Message').'</label>';
$html .= '<input name="message" id="jsmessage" type="text" value="'.$this->getDbField('message').'">';
$html .= '</div>';
return $html;
}
public function beforeSiteLoad()
{
if($this->getDbField('enable')) {
exit( $this->getDbField('message') );
}
}
2016-02-20 17:16:31 +01:00
}