Esempio n. 1
0
 /**
  * Returns code for this tag.
  *
  * @return   string Final code to insert in gate
  * @see      Nexista_Builder::getCode()
  */
 public function getCodeStart()
 {
     //block name to insert
     $blockName = $this->action->getAttribute('name');
     //get instance of Application
     $application = Nexista_Foundry::singleton('Nexista_Foundry');
     //get all blocks
     $x = new DOMXPath($application->sitemapDocument);
     $blocks = $x->query('//map:block');
     //find the one with correct name
     $found = false;
     foreach ($blocks as $block) {
         $name = $block->getAttribute('name');
         if ($name == $blockName) {
             /*insert block section in here. Easiest is to insert with
               map:block tag and remove the name attribute to prevent parsing
               of this tag for later inserts*/
             $clone = $block->cloneNode(1);
             $new = $application->sitemapDocument->importNode($clone, 1);
             $this->action->parentNode->insertBefore($new, $this->action->nextSibling);
             $found = true;
             break;
         }
     }
     //nothing found - let's send a warning and return gracefully
     if (!$found) {
         Nexista_Error::init('A matching map:block of name:
             ' . $blockName . ' was not found in sitemap', NX_ERROR_WARNING);
         return null;
     }
     return null;
 }
Esempio n. 2
0
function Nexista_Build_It_now($server_init)
{
    header('Content-type: text/html');
    if (!file_exists(NX_PATH_BASE . 'kernel/foundry.php')) {
        echo 'I am unable to find the nexista foundry class, and cannot continue. 
        Try this:
        <br/><br/><a href="http://www.nexista.org">http://www.nexista.org</a>, 
        and so you know, I looking here: <br/>';
        echo NX_PATH_BASE . 'kernel/foundry.php';
        exit;
    } else {
        require NX_PATH_BASE . 'kernel/foundry.php';
    }
    $foundry = Nexista_Foundry::singleton('Nexista_Foundry');
    $config = PROJECT_ROOT . '/config/config.xml';
    $app_config = PROJECT_ROOT . '/apps/' . APP_NAME . '/config/config.xml';
    ob_end_clean();
    header('Cache-Control: no-cache, no-store');
    ?>

    <html>
    <body style="padding: 150px; font-family: verdana;">
    <?php 
    echo 'Looks like you are installing to ', $server_init, ' Cool! <br/><br/>';
    ?>
    
    <?php 
    if (!file_exists($config)) {
        echo 'Uh-oh, we already ran into a problem. Where is the config file? 
        It is not here: ', $config;
        echo '<br/><br/>**To proceed, config/config.xml.dist must be copied to 
        config/config.xml and configured.**';
        exit;
    }
    $config_file = file_get_contents($config);
    if (!isset($mode)) {
        $mode = 'dev';
    }
    if (isset($_ENV['NEXISTA_MODE'])) {
        $mode = $_ENV['NEXISTA_MODE'];
    }
    if (!file_exists($app_config)) {
        if (!$foundry->configure($config, null, $mode)) {
            echo '<br/><br/>**
            Something is amiss. Please check to make sure the cache
            directory specified in config.xml is writeable by the webserver.**';
            exit;
        }
    } else {
        if (!$foundry->configure($config, $app_config, $mode)) {
            echo '<br/><br/>**
            Something is amiss. Please check to make sure the cache
            directory specified in config.xml is writeable by the webserver.**';
            exit;
        }
    }
    $foundry->debug = 1;
    $my_sitemap = $foundry->getSitemapPath('./build/sitemap');
    $foundry->buildLoader();
    $foundry->buildGates();
    $foundry->buildSitemap();
    ?>

<script type="text/javascript">
if(done_building=="true") {
    setTimeout('top.location.reload()',1500);
}
</script>
</body></html>
    <?php 
    ob_flush();
    exit;
}