コード例 #1
0
 /**
  * Attempt to parse the build log, constructing from it a collection
  * of the abstract objects we use to model the events an packages it
  * defines.
  *
  * @param builds  (Array) Collection to be populated with BuildEvents.
  * @return (Boolean) @c TRUE iff successful.
  */
 private function constructBuilds(&$builds)
 {
     /*        $buildLogUri = self::XML_FEED_URI;
     
             // Is it time to update our cached copy of the build log?
             $logCacheName = 'buildrepository/events.xml';
             if(self::mustUpdateCachedBuildLog($buildLogUri, $logCacheName))
             {
                 try
                 {
                     // Grab a copy of the latest build log..
                     $logXml = self::retrieveBuildLogXml($buildLogUri);
                     if($logXml === false)
                         throw new Exception('Failed retrieving build log');
     
                     // Attempt to parse the new log.
                     BuildLogParser::parse($logXml, $builds);
     
                     // Parsed successfully; update the cache with this new file.
                     FrontController::contentCache()->store($logCacheName, $logXml);
                     return TRUE;
                 }
                 catch(Exception $e)
                 {
                     // Log the error.
                     $msg = "Failed parsing new XML build log.";
                     $msg .= "\nError:" . $e->getMessage();
                     trigger_error($msg, E_USER_WARNING);
     
                     // Touch our cached copy so we don't try again too soon.
                     FrontController::contentCache()->touch($logCacheName);
                 }
             }*/
     // Re-parse our locally cached copy of the log, hopefully
     // we don't need to do this too often (cache everything!).
     try {
         //$cachedLogXml = FrontController::contentCache()->retrieve($logCacheName);
         $path = nativePath("/home/skyjake/files/builds/events.xml");
         $stream = fopen($path, 'r');
         $cachedLogXml = stream_get_contents($stream);
         fclose($stream);
         BuildLogParser::parse($cachedLogXml, $builds);
         return TRUE;
     } catch (Exception $e) {
         // Yikes! Looks like we broke something...
         trigger_error(sprintf('Failed parsing cached XML build log.\\nError:%s', $e->getMessage()), E_USER_WARNING);
         return FALSE;
     }
 }
コード例 #2
0
    /**
     * Implements Actioner.
     */
    public function execute($args = NULL)
    {
        $fc =& FrontController::fc();
        // Build the add-ons collection.
        $addonListXml = file_get_contents(nativePath("plugins/addonrepository/addons.xml"));
        $this->addons = array();
        AddonsParser::parse($addonListXml, $this->addons);
        // Sort the collection.
        uasort($this->addons, array('self', 'packageSorter'));
        // Output the page.
        $fc->outputHeader($this->title(), 'addons');
        $fc->beginPage($this->title(), 'addons');
        ?>
<div id="contentbox" class="addons"><?php 
        includeHTML('overview', self::$name);
        $this->outputFeaturedAddons();
        ?>
<div class="block"><article><h1>DOOM</h1>
<p>The following add-ons are for use with <a href="/doom" title="Tell me more about DOOM">DOOM</a> or a variant of it such as <strong>DOOM2</strong> and <strong>Final Doom: The Plutonia Experiment</strong>.</p>
<?php 
        $this->outputAddonList(self::$doomGameModes);
        ?>
</article></div><?php 
        ?>
<div class="block"><article><h1>Heretic</h1>
<p>The following add-ons are for use with <a href="/heretic" title="Tell me more about Heretic">Heretic</a> and the <strong>Shadow of the Serpent Riders</strong> expansion pack.</p>
<?php 
        $this->outputAddonList(self::$hereticGameModes);
        ?>
</article></div><?php 
        ?>
<div class="block"><article><h1>Hexen</h1>
<p>The following add-ons are for use with <a href="/hexen" title="Tell me more about Hexen">Hexen</a> and the <strong>Deathkings of the Dark Citadel</strong> expansion pack.</p>
<?php 
        $this->outputAddonList(self::$hexenGameModes);
        ?>
</article></div><?php 
        ?>
</div><?php 
        $fc->endPage();
    }
コード例 #3
0
 /**
  * Attempt to import a content element from the cache, outputting
  * its contents straight to the output buffer.
  *
  * @param relPath  (String) File name to retrieve.
  * @return  (Boolean) TRUE iff the content element was imported.
  */
 public function import($relPath)
 {
     $path = nativePath($this->_docRoot . "/{$relPath}");
     if (!$path || !file_exists($path)) {
         throw new Exception(sprintf('file %s not present in content cache.', $relPath));
     }
     return @readfile($path);
 }
コード例 #4
0
function absolutePath($path)
{
    return $_SERVER['DOCUMENT_ROOT'] . nativePath('/' . $path);
}