Changeset 6

Show
Ignore:
Timestamp:
10/22/04 11:25:23
Author:
argh
Message:

Removed some notices

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/patXMLRenderer.php

    r2 r6  
    221221         
    222222/** 
     223*       stores which tags are cacheable 
     224*       @var    array 
     225*/ 
     226        var $cacheAble = array(); 
     227         
     228/** 
    223229*       set the urls that should not be logged in the referer log 
    224230* 
     
    625631        function        autoAddExtension( $ns ) 
    626632        { 
    627                 $ns                     =       strtoupper( $ns ); 
    628                  
    629                 if( $this->extensions[$ns] ) 
     633                $ns = strtoupper( $ns ); 
     634                if( isset( $this->extensions[$ns] ) ) { 
    630635                        return  true; 
    631  
    632                 $filename       =       $this->getExtensionDir() ? $this->getExtensionDir()."/".$this->knownExtensions[$ns]["phpfile"] : $this->knownExtensions[$ns]["phpfile"]; 
    633  
    634                 if( !class_exists( $this->knownExtensions[$ns]["extension"] ) && file_exists( $filename ) ) 
     636                } 
     637                         
     638                $filename = $this->getExtensionDir() ? $this->getExtensionDir()."/".$this->knownExtensions[$ns]["phpfile"] : $this->knownExtensions[$ns]["phpfile"]; 
     639 
     640                if( !class_exists( $this->knownExtensions[$ns]["extension"] ) && file_exists( $filename ) ) { 
    635641                        include_once( $filename ); 
    636          
    637                if( class_exists( $this->knownExtensions[$ns]["extension"] ) ) 
    638                
    639                         $tmp   =       new     $this->knownExtensions[$ns]["extension"]; 
     642               } 
     643         
     644                if( class_exists( $this->knownExtensions[$ns]["extension"] ) )
     645                        $tmp = new $this->knownExtensions[$ns]["extension"]; 
    640646                        $this->addExtension( $ns, $tmp ); 
    641647                } 
     
    694700                else 
    695701                { 
     702                        $lastUpdated = 'Unknown'; 
     703                         
    696704                        if( !$this->xmlFile ) 
    697705                                $this->setXMLFile( $this->defaultFile ); 
     
    702710                        if( !file_exists( $file ) ) 
    703711                        { 
    704                                 $this->requestedFile           =       $this->xmlFile; 
     712                                $this->requestedFile = $this->xmlFile; 
    705713                                $this->setXMLFile( $this->errorFile ); 
    706                                 $file  =       ( $this->xmlDir!="" ) ? $this->xmlDir."/".$this->xmlFile : $this->xmlFile;  
     714                                $file = ( $this->xmlDir!="" ) ? $this->xmlDir."/".$this->xmlFile : $this->xmlFile;  
    707715         
    708716                                if( $this->getOption( "log" ) == "on" ) 
    709717                                        $this->logger->writeErrorLog( $this->requestedFile ); 
    710718                        } 
     719                        else 
     720                        { 
     721                                $lastUpdated = date( "Y-m-d H:i:s", filemtime( $file ) ); 
     722                        } 
    711723 
    712724                        //      add global variables 
    713                         $this->tmpl->addGlobalVar( "XMLSRING", "" ); 
     725                        $this->tmpl->addGlobalVar( "XMLSTRING", "" ); 
    714726                        $this->tmpl->addGlobalVar( "XMLFILE", $this->xmlFile ); 
    715727                        $this->tmpl->addGlobalVar( "XMLSOURCE", $file ); 
    716                         $this->tmpl->addGlobalVar( "PAGE_LAST_UPDATED", date( "Y-m-d H:i:s", filemtime( $file ) ) ); 
    717          
    718                         $this->xmlSource        =       $file; 
     728                        $this->tmpl->addGlobalVar( "PAGE_LAST_UPDATED", $lastUpdated ); 
     729                         
     730         
     731                        $this->xmlSource = $file; 
    719732                } 
    720733                 
     
    825838                else 
    826839                        $data                   =       $this->parseString( $this->xmlString ); 
    827                         
     840                 
    828841                return  str_replace( "[RANDY_SELF]", $randyUrl, $data ); 
    829842        } 
     
    884897                                { 
    885898                                        //      auto-add extensions activated and namespace is known? 
    886                                         if( $this->getOption( "autoadd" ) == "on" && isset( $this->knownExtensions[$ns] ) ) 
     899                                        if( $this->getOption( "autoadd" ) == "on" && isset( $this->knownExtensions[$ns] ) ) { 
    887900                                                $this->autoAddExtension( $ns ); 
     901                                        } 
    888902                                } 
    889903         
     
    10121026        function        characterData( $parser, $data ) 
    10131027        { 
    1014                 $tagDepth       =       count( $this->tagStack[$this->parsers] ) - 1; 
    1015                 $ns                     =       $this->nsStack[$this->parsers][$tagDepth]; 
    1016  
    1017                 if( $this->getOption( "replaceentities" ) == "on" ) 
    1018                         $data           =       htmlspecialchars( $data ); 
    1019  
    1020                 $this->data[$this->parsers][$tagDepth]          .=      $data; 
     1028                $tagDepth = count( $this->tagStack[$this->parsers] ) - 1; 
     1029                 
     1030                if( $this->getOption( "replaceentities" ) == "on" )     { 
     1031                        $data = htmlspecialchars( $data ); 
     1032                } 
     1033 
     1034                if( !isset( $this->data[$this->parsers][$tagDepth] ) ) { 
     1035                        $this->data[$this->parsers][$tagDepth]  = ''; 
     1036                } 
     1037 
     1038                $this->data[$this->parsers][$tagDepth] .= $data; 
    10211039        } 
    10221040 
     
    10281046        function        getData( $parser = false ) 
    10291047        { 
    1030                 if( $parser === false ) 
    1031                         $parser =       $this->parsers; 
     1048                if( $parser === false ) { 
     1049                        $parser = $this->parsers; 
     1050                } 
    10321051                         
    1033                 $tagDepth       =       count( $this->tagStack[$this->parsers] ) - 1; 
     1052                $tagDepth = count( $this->tagStack[$this->parsers] ) - 1; 
     1053 
     1054                if( !isset( $this->data[$parser][$tagDepth] ) ) { 
     1055                        return ''; 
     1056                } 
     1057                 
    10341058                return  trim( $this->data[$parser][$tagDepth] ); 
    10351059        } 
     
    11021126                $parser =       $this->createParser(); 
    11031127 
    1104                 if( !( $fp = fopen( $file, "r" ) ) ) 
    1105                         die( "patXMLRenderer could not open XML file :".$file ); 
     1128                if( !( @$fp = fopen( $file, "r" ) ) ) 
     1129                        die( 'patXMLRenderer could not open the XML file "'.$file.'"' ); 
    11061130 
    11071131                flock( $fp, LOCK_SH ); 
     
    11211145                flock( $fp, LOCK_UN ); 
    11221146 
    1123                 if( $this->cacheAble[$this->parsers] || $this->getOption( "cache" ) == "force" ) 
     1147                if( isset( $this->cacheAble[$this->parsers] ) || $this->getOption( "cache" ) == "force" ) { 
    11241148                        $this->writeCache( $file, $data ); 
    1125                 else 
     1149                } else { 
    11261150                        $this->deleteCache( $file ); 
     1151                } 
    11271152 
    11281153                $this->parsers--; 
     
    13741399        function        getSelfUrl() 
    13751400        { 
    1376                 $self   =       $GLOBALS["PHP_SELF"]."?"; 
     1401                $self   =       $_SERVER["PHP_SELF"]."?"; 
    13771402                for( $i=0; $i<count( $this->keepVars ); $i++ ) 
    13781403                        if( $GLOBALS[$this->keepVars[$i]] )