diff --git a/README.md b/README.md index f1e8fe96..0ac1bdea 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h * updates year in `LICENSE.TXT` * updates es translation +* custom headers/footers are now optional and disabled by default ### v0.17 - *2011-11-28* diff --git a/src/_h5ai/config.js b/src/_h5ai/config.js index b95f9d8f..3292a649 100644 --- a/src/_h5ai/config.js +++ b/src/_h5ai/config.js @@ -18,10 +18,15 @@ var H5AI_CONFIG = { /* * Filenames of customized header and footer files to look for - * in each folder. + * in each folder. For Example: + * + * "customHeader": "_h5ai.header.html", + * "customFooter": "_h5ai.footer.html", + * + * This is disabled by default. */ - "customHeader": "_h5ai.header.html", - "customFooter": "_h5ai.footer.html", + "customHeader": false, + "customFooter": false, /* * An array of view modes the user may choose from. Currently there diff --git a/src/_h5ai/js/inc/Extended.js b/src/_h5ai/js/inc/Extended.js index 9e48e3da..ef12bf79 100644 --- a/src/_h5ai/js/inc/Extended.js +++ b/src/_h5ai/js/inc/Extended.js @@ -52,21 +52,25 @@ }, customize = function () { - $.ajax({ - url: H5AI.core.settings.customHeader, - dataType: "html", - success: function (data) { - $("#content > header").append($(data)).show(); - } - }); + if (H5AI.core.settings.customHeader) { + $.ajax({ + url: H5AI.core.settings.customHeader, + dataType: "html", + success: function (data) { + $("#content > header").append($(data)).show(); + } + }); + } - $.ajax({ - url: H5AI.core.settings.customFooter, - dataType: "html", - success: function (data) { - $("#content > footer").prepend($(data)).show(); - } - }); + if (H5AI.core.settings.customFooter) { + $.ajax({ + url: H5AI.core.settings.customFooter, + dataType: "html", + success: function (data) { + $("#content > footer").prepend($(data)).show(); + } + }); + } }, fetchPath = function (pathname, callback) { diff --git a/src/_h5ai/php/inc/Customize.php b/src/_h5ai/php/inc/Customize.php index aa720efa..689977c3 100644 --- a/src/_h5ai/php/inc/Customize.php +++ b/src/_h5ai/php/inc/Customize.php @@ -7,8 +7,8 @@ class Customize { $absPath = $h5ai->getAbsPath(); $options = $h5ai->getOptions(); - $this->customHeader = $absPath . "/" . $options["customHeader"]; - $this->customFooter = $absPath . "/" . $options["customFooter"]; + $this->customHeader = $options["customHeader"] ? $absPath . "/" . $options["customHeader"] : false; + $this->customFooter = $options["customFooter"] ? $absPath . "/" . $options["customFooter"] : false; } public function getHeader() { @@ -23,7 +23,7 @@ class Customize { private function getContent($file, $tag) { - return file_exists($file) ? ("<" . $tag . ">" . file_get_contents($file) . "") : ""; + return (is_string($file) && file_exists($file)) ? ("<" . $tag . ">" . file_get_contents($file) . "") : ""; } }