Il codice qui sotto mi genera questo errore:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /membri/marioierardi/engine.php on line 100
Ho controllato un sacco di volte ma non capisco dove ho sbagliato.
Ho provato a spostare le proprietà dopo i metodi e lo stesso errore si verifica sul primo metodo dopo il costruttore.
P.S.
La riga 100 e quella contenente la prima proprietà della classe Page: "private $path;"
Help!
Codice PHP:
<?php 
    
include_once 'engine_resources/codes.php'
    
$pagePath verifyRequest(); 
    
$page = new Page($pagePath); 
     
    function 
verifyFirstLevelRequest($path
    { 
        
$firstLevPath $path
        
/*Concateno con la cartella e procedo a verifica*/ 
         
        
foreach($_GET as $key=>$index
        { 
            if(
is_dir($firstLevPath.$key)!==FALSE
            {     
                
$firstLevPath.=$key
            } 
        } 
         
        if(
$firstLevPath==$path
        { 
            return 
REQUESTED_INEXISTENT_PAGE;/*La cartella non esiste per il percorso specificato*/ 
        

         
        return 
verifyPageTree($firstLevPath); 
    } 
     
    function 
verifySecondLevelRequest($path
    { 
        
$secondLevelPath ""
        if((
$firstLevelPath verifyFirstLevelRequest($path))!=FALSE
        { 
            
/*Concateno con la sottocartella e procedo a verifica*/ 
            
$subDir $firstLevelPath
            
str_replace($path,'',$subDir);/*Cancella il percorso lasciando solo il nome*/ 
            
$secondLevelPath.=$firstLevelPath.'/'.$_GET[$subDir]; 
             
            if(!
is_dir($secondLevelPath)) 
            { 
                return 
REQUESTED_INEXISTENT_PAGE;/*La cartella non esiste per il percorso specificato*/ 
            

             
            return 
verifyPageTree($secondLevelPath); 
        } 
    } 
     
    function 
verifyPageTree($path
    { 
        
/*Verifica basilare di integrità dell'albero della pagina richiesta*/ 
         
        
$childrenRequired = array("/subpages/","content.php","include_apps","meta","style.css"); 
         
        
$pagePath $path
        if((
$pageResorce opendir($pagePath))!==FALSE
        { 
            
$childrenExisting = array(); 
            while((
$subFile readdir($pageResorce)) !== FALSE
            { 
                
array_push($childrenExisting,$subFile); 
            } 
            
closedir(); 
             
            if(
$childrenRequired==$childrenExisting
            { 
                
/*Integrità confermata*/ 
                
return pagePath
            }else{ 
                return 
REQUESTED_INEXISTENT_PAGE;/*Integrità non confermata*/ 
            

        }else{ 
            return 
REQUESTED_INEXISTENT_PAGE;/*Cartella inaccessibile*/ 
        

    } 
     
    function 
verifyRequest() 
    { 
        
$pagesPath $_SERVER['DOCUMENT_ROOT'].'/pages/'
         
        if(
$_SERVER['REQUEST_METHOD'] == 'GET'
        { 
            
$sog=sizeof($_GET); 
            if(
$sog>1
            { 
                return 
REQUESTED_INEXISTENT_PAGE
            }elseif(
$sog==1
            { 
                if(empty(
$_GET[0])) 
                { 
                    return 
verifyFirstLevelRequest($pagesPath); 
                }else 
                { 
                    return 
verifySecondLevelRequest($pagesPath); 
                } 
            } 
        }else{ 
            return 
REQUESTED_DEFAULT_PAGE
        } 
    } 
     
    class 
Page{     
        private 
$path
        private 
$meta
        private 
$headerApps
        private 
$bodyApps
        private 
$css
        private 
$subPagesReferences = array();/*Carichiamo solo alcuni dati, utili alla navigazione, delle sottocategorie della pagina*/ 
     
        
function __construct($requestSubject){ 
            
$this->parseRequest($requestSubject); /*Fatto*/ 
            
$this->getCSS(); 
            
$this->getMeta(); /*Fatto*/ 
            
$this->getApps(); /*Fatto*/ 
            
$this->getSubPagesRef(); 
        } 
         
        private function 
getMeta(){ 
            
$rawData $this->getByFile($this->path.'meta'); 
            
$metalist explode(';',$rawData); 
            foreach(
$metalist as $value
            { 
                
$tmp explode('=',$value); 
                
$formatted '<meta name="'.$tmp[0].'" content="'.$tmp[1].'"/>'
                
$this->meta.=$formatted
            }         
        } 
         
        private function 
getApps(){ 
            
$localApps $this->getLocalApps(); 
            
$formatted=''
            
$rawData $this->getByFile($this->path.'include_apps'); 
            
$applist explode(';',$rawData); 
            foreach(
$applist as $value
            { 
                if(
substr($value,0,11)=='external://'
                { 
                    
$formatted '<script language="javascript" type="text/javascript" src="'.substr($value,11).'"></script>'
                    
$headerApps.=$formatted;/*I link esterni evngono messi per default nella testata*/ 
                
}else{ 
                    if((
$appIndex array_search($value$localApps)) != FALSE
                    { 
                        
$formatted '<script language="javascript" type="text/javascript" src="'.$localApps[0].$localApps[1].'"></script>'
                        if(
$localApps[0]=='/apps/head/'
                        { 
                            
$headerApps.=$formatted
                        }else{ 
                            
$bodyApps.=$formatted
                        } 
                    } 
                } 
            } 
        } 
         
        private function 
getLocalApps(){ 
            
$localAppList = array(); 
            
$bodyAppPath 'apps/body/'
            
$headAppPath 'apps/head/'
            
$pageResorce opendir($bodyAppPath) or die('impossibile aprire la cartella!'); 
            while((
$file readdir($pageResorce)) !== FALSE
            { 
                
array_push($localAppList,array($file,$bodyAppPath)); 
            } 
            
closedir(); 
            
$pageResorce opendir($headAppPath) or die('impossibile aprire la cartella!'); 
            while((
$file readdir($pageResorce)) !== FALSE
            { 
                
array_push($localAppList,array($headAppPath,$file)); 
            } 
            
closedir(); 
            return 
$localAppList
        } 
         
        private function 
getCSS(){ 
             
        } 
         
        private function 
getSubPagesRef(){ 
             
        } 
         
        private function 
parseRequest($subject){ 
            
$requestPath $subject
            if(
$requestPath==REQUESTED_DEFAULT_PAGE
            {     
                
$requestPath=$_SERVER['DOCUMENT_ROOT'].'/pages/home/'
            }elseif(
$requestPath==REQUESTED_INEXISTENT_PAGE
            { 
                
$requestPath=$_SERVER['DOCUMENT_ROOT'].'/pages/pagenotfound/'
            } 
             
            
$this->path=$requestPath
        } 
         
        private function 
getByFile($path){ 
            
$text ""
            
$fp fopen($path,'r') or die('Impossibile aprire il file!'); 
             
            while((
$line fgets($fp))!== FALSE
            { 
                
$text.=$line
            } 
            return 
$text
        } 
         
        function 
printDocTitle(){ 
            print 
"Mio titolo"
        } 
         
        function 
printMetaTags(){ 
            print 
$this->meta
        } 
         
        function 
printHeaderApps(){ 
            print 
$this->headerApps
        } 
         
        function 
printCSS(){ 
            print 
$this->css
        } 
         
        function 
printBodyHeader(){ 
            include_once 
'shared_content/header.php'
        } 
         
        function 
printBodyContent(){ 
            include_once 
$this->path.'/content.php'
        } 
         
        function 
printBodyFooter(){ 
            include_once 
'shared_content/footer.php'
        } 
         
        function 
printBodyApps(){ 
            print 
$this->bodyApps
        }         
    }; 
?>