private function scanAreas($dirPath)
    {
        $dirPath = realpath($dirPath);

        if(strcmp($this->contentPath, $dirPath) > 0)
        {
            return;
        }

        if(is_dir($dirPath) && (($dir = @opendir($dirPath)) !== false))
        {
            while (($subDirName = readdir($dir)) !== false)
            {
                if(
                    ((substr($subDirName, 0, 1) == '.') || (substr($subDirName, 0, 1) == '_')) &&
                    $subDirName != '.' &&
                    $subDirName != '..' &&
                    is_dir($dirPath . DIRECTORY_SEPARATOR . $subDirName)
                ) {
                    $areaName = $subDirName;
                    //Searching for all areas
                    if(realpath($this->contentPath . $this->getNode()->getUri()) == $dirPath)
                    {
                        //normalize area name
                        $areaName = (substr($areaName, 1, 5) == 'tree_') ? substr($areaName, 6) : substr($areaName, 1);
                        $area = new Area($areaName, false);
                        $this->areas[$areaName] = $area;
                        $this->fillArea($area, $dirPath . DIRECTORY_SEPARATOR . $subDirName);
                    }
                    //Searching for areas to inherit only
                    else
                    {
                        if(substr($areaName, 1, 5) == 'tree_')
                        {
                            $areaName = substr($areaName, 6);

                            if(!$this->hasArea($areaName))
                            {
                                $area = new Area($areaName, true);
                                $this->areas[$areaName] = $area;
                                $this->fillArea($area, $dirPath . DIRECTORY_SEPARATOR . $subDirName);
                            }
                        }
                    }
                }
            }

            closedir($dir);
        }
        // @codeCoverageIgnoreStart
        else
        {
            throw new  PageException("Unable to read path");
        }
        // @codeCoverageIgnoreEnd

        $this->scanAreas($dirPath . '/..');
    }
private function scanAreas($dirPath)
    {
        $dirPath = realpath($dirPath);

        if(strcmp($this->contentPath, $dirPath) > 0)
        {
            return;
        }

        if(is_dir($dirPath) && (($dir = @opendir($dirPath)) !== false))
        {
            while (($subDirName = readdir($dir)) !== false)
            {
                if(
                    ((substr($subDirName, 0, 1) == '.') || (substr($subDirName, 0, 1) == '_')) &&
                    $subDirName != '.' &&
                    $subDirName != '..' &&
                    is_dir($dirPath . DIRECTORY_SEPARATOR . $subDirName)
                ) {
                    $areaName = $subDirName;
                    //Searching for all areas
                    if(realpath($this->contentPath . $this->getNode()->getUri()) == $dirPath)
                    {
                        //normalize area name
                        $areaName = (substr($areaName, 1, 5) == 'tree_') ? substr($areaName, 6) : substr($areaName, 1);
                        $area = new Area($areaName, false);
                        $this->areas[$areaName] = $area;
                        $this->fillArea($area, $dirPath . DIRECTORY_SEPARATOR . $subDirName);
                    }
                    //Searching for areas to inherit only
                    else
                    {
                        if(substr($areaName, 1, 5) == 'tree_')
                        {
                            $areaName = substr($areaName, 6);

                            if(!$this->hasArea($areaName))
                            {
                                $area = new Area($areaName, true);
                                $this->areas[$areaName] = $area;
                                $this->fillArea($area, $dirPath . DIRECTORY_SEPARATOR . $subDirName);
                            }
                        }
                    }
                }
            }

            closedir($dir);
        }
        // @codeCoverageIgnoreStart
        else
        {
            throw new  PageException("Unable to read path");
        }
        // @codeCoverageIgnoreEnd

        $this->scanAreas($dirPath . '/..');
    }
private function scanAreas ( $ dirPath ) { $ dirPath = realpath ( $ dirPath ) ; if ( strcmp ( $ this -> contentPath , $ dirPath ) > 0 ) { return ; } if ( is_dir ( $ dirPath ) && ( ( $ dir = @ opendir ( $ dirPath ) ) !== false ) ) { while ( ( $ subDirName = readdir ( $ dir ) ) !== false ) { if ( ( ( substr ( $ subDirName , 0 , 1 ) == '.' ) || ( substr ( $ subDirName , 0 , 1 ) == '_' ) ) && $ subDirName != '.' && $ subDirName != '..' && is_dir ( $ dirPath . DIRECTORY_SEPARATOR . $ subDirName ) ) { $ areaName = $ subDirName ; //Searching for all areas if ( realpath ( $ this -> contentPath . $ this -> getNode ( ) -> getUri ( ) ) == $ dirPath ) { //normalize area name $ areaName = ( substr ( $ areaName , 1 , 5 ) == 'tree_' ) ? substr ( $ areaName , 6 ) : substr ( $ areaName , 1 ) ; $ area = new Area ( $ areaName , false ) ; $ this -> areas [ $ areaName ] = $ area ; $ this -> fillArea ( $ area , $ dirPath . DIRECTORY_SEPARATOR . $ subDirName ) ; } //Searching for areas to inherit only else { if ( substr ( $ areaName , 1 , 5 ) == 'tree_' ) { $ areaName = substr ( $ areaName , 6 ) ; if ( ! $ this -> hasArea ( $ areaName ) ) { $ area = new Area ( $ areaName , true ) ; $ this -> areas [ $ areaName ] = $ area ; $ this -> fillArea ( $ area , $ dirPath . DIRECTORY_SEPARATOR . $ subDirName ) ; } } } } } closedir ( $ dir ) ; } // @codeCoverageIgnoreStart else { throw new PageException ( "Unable to read path" ) ; } // @codeCoverageIgnoreEnd $ this -> scanAreas ( $ dirPath . '/..' ) ; }
Read area definitions and content from the disk

@param  string $dirPath
Read area definitions and content from the disk