diff --git a/classes/Controller.php b/classes/Controller.php
index b9817f3..aad2984 100644
--- a/classes/Controller.php
+++ b/classes/Controller.php
@@ -42,16 +42,26 @@ class Controller extends Object
try
{
// @todo Clean this up to be just a single sanity check
- if (isset($this->config->pickles['disabled']) && $this->config->pickles['disabled'] == true)
+ if (isset($this->config->pickles['disabled']) && $this->config->pickles['disabled'])
{
- // @todo Add support for custom templates
- throw new Exception('
-
Down for Maintenance
- ' . $_SERVER['SERVER_NAME'] . ' is currently down for maintenance. Please check back in a few minutes.
- Additionally, a custom maintenance template was not found.
-
- Powered by PICKLES
- ');
+ $custom_template = SITE_TEMPLATE_PATH . '__shared/maintenance.phtml';
+
+ if (file_exists($custom_template))
+ {
+ require_once $custom_template;
+ }
+ else
+ {
+ echo '
+ Down for Maintenance
+ ' . $_SERVER['SERVER_NAME'] . ' is currently down for maintenance. Please check back in a few minutes.
+ Additionally, a custom maintenance template was not found.
+
+ Powered by PICKLES
+ ';
+ }
+
+ throw new Exception();
}
// Checks for attributes passed in the URI
@@ -310,9 +320,6 @@ class Controller extends Object
Profiler::timer('module ' . $default_method);
}
- // @todo Set this in the module and use $module->return and rename module->return to module->data?
- $module->display = ['template', 'json'];
-
// Checks if we have any templates
$parent_template = $module->template;
$template_exists = $this->validateTemplates($module, $parent_template);
diff --git a/tests/classes/ControllerTest.php b/tests/classes/ControllerTest.php
index 660139c..3cec8aa 100644
--- a/tests/classes/ControllerTest.php
+++ b/tests/classes/ControllerTest.php
@@ -27,12 +27,16 @@ class ControllerTest extends PHPUnit_Framework_TestCase
new Controller();
}
- /*
public function testCustomSiteDown()
{
- $this->fail();
+ $this->config->data['pickles']['disabled'] = true;
+
+ file_put_contents(SITE_TEMPLATE_PATH . '__shared/maintenance.phtml', 'Custom Down for Maintenance
');
+
+ new Controller();
+
+ $this->expectOutputRegex('/Custom Down for Maintenance<\/h1>/');
}
- */
public function testAttributesInURI()
{