Skip to content

Commit

Permalink
Fix error when page settings emtpy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Verweij committed Jan 28, 2015
1 parent 6b37cf9 commit 770f433
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 7 additions & 1 deletion app/Crispus/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ private function getPageFromDir($sDir, $sUrl, $sGlobalConfigFile){
$sNewUrl = $sUrl.'/'.$sDir;

$oPage = new Page($sNewUrl, $sGlobalConfigFile);
$aConfig = array_change_key_case($oPage->getConfig(), CASE_LOWER);
$aConfig = $oPage->getConfig();

if(is_array($aConfig)){
$aConfig = array_change_key_case($aConfig, CASE_LOWER);
}else{
$aConfig = array();
}

return array('name' => $sDir, 'url' => $sNewUrl, 'config' => $aConfig, 'children' => $oPage->getChildren());
}
Expand Down
8 changes: 7 additions & 1 deletion app/Crispus/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ private function setConfig(){
}

$oPageConfig = new Config($this->sPath.'/'.$this->sConfigFile);
$this->aConfig = array_change_key_case($oPageConfig->getConfig(), CASE_LOWER);
$aConfig = $oPageConfig->getConfig();

if(is_array($aConfig)){
$this->aConfig = array_change_key_case($oPageConfig->getConfig(), CASE_LOWER);
}else{
$this->aConfig = array();
}

// Set page template
if(isset($this->aConfig['template']) && !empty($this->aConfig['template'])){
Expand Down
6 changes: 5 additions & 1 deletion app/Crispus/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ public function renderPage() {

public function setPageConfig($aConfig) {
if(is_array($aConfig)){
$this->aPageConfig = array_change_key_case($aConfig, CASE_LOWER);
if(is_array($aConfig)){
$this->aPageConfig = array_change_key_case($aConfig, CASE_LOWER);
}else{
$this->aPageConfig = array();
}
}
}

Expand Down

0 comments on commit 770f433

Please sign in to comment.