function out_full($path, $template_path) { global $Sc; $file_count = 0; $options = array('blocks' => array()); $options['assets_path'] = 'assets/'; foreach ($this->Project->data['blocks'] as &$block) { $file_count++; ScStatus::update($block->getID()); $options['blocks'][$block->getID()] = $this->_getNodeOptions($block, $block, 8); } // Template ob_start(); include $template_path . '/full.php'; $output = ob_get_clean(); // Out file_put_contents($path . '/full.html', $output); // ScStatus::updateDone("1 file written."); }
function updateDone($msg2) { $ScS =& ScStatus::getInstance(); if (!isset($ScS->msg1)) { return; } $msg = ' * ' . $ScS->msg1 . ':' . ScStatus::strrepeat(' ', 25 - strlen($ScS->msg1)) . $msg2; $msg .= ScStatus::strrepeat(' ', 79 - strlen($msg)); fwrite($ScS->stderr, $msg . "\n"); unset($ScS->msg1); }
function _doPostBuild() { /* Function: _doPostBuild() * Does post-build actions like modifying the homepage. * [Private, grouped under "Private functions"] */ ScStatus::updateStart("Post build"); // If there's no homepage, // Make one! if (is_null($this->data['home'])) { $this->register("Page: " . $this->getName()); } // Finalize everything $block_count = 0; foreach ($this->data['blocks'] as &$block) { $block->preFinalize(); if (++$block_count % 5 == 0) { ScStatus::update($block_count); } } // Remove blocks that are in the "exclude_tags" list while (TRUE) { foreach ($this->data['blocks'] as &$block) { if (0 < count(array_intersect_i((array) $block->_tags, (array) $this->options['exclude_tags']))) { $block->unregister(); continue 2; } } break; } // [1] If there's a home, [2] each of the tree firstlevels // [3] that isn't the homepage [4] will be the child of the homepage. if (!is_null($this->data['home'])) { foreach ($this->data['tree'] as $i => &$block) { if ($block->getID() != 'index') { $this->data['home']->registerChild($this->data['tree'][$i]); } } } // Finalize everything $block_count = 0; foreach ($this->data['blocks'] as &$block) { $block->finalize(); if (++$block_count % 5 == 0) { ScStatus::update($block_count); } } ScStatus::updateDone("{$block_count} blocks."); }
function do_makeconfig() { ob_start(); @(include SCRIBE_PATH . '/include/misc.defaultconfig.php'); $contents = ob_get_clean(); $output_fname = getcwd() . DS . 'sourcescribe.conf'; if (is_file($output_fname)) { return ScStatus::error("A configuration file already exists!"); } file_put_contents($output_fname, $contents); }
function _verifyBlockTypes() { /* Function: _verifyBlockTypes() * Verifies the block types; called by [[load()]]. * * Returns: * TRUE on success; dies if something is wrong. * * [Private, grouped under "Private functions"] */ if (!isset($this->options['block_types'])) { return ScStatus::error("Block types is not valid!"); } if (!is_array($this->options['block_types'])) { return ScStatus::error("Block types is not valid!"); } $this->options['type_keywords'] = array(); foreach ($this->options['block_types'] as $id => &$block_type) { if (!isset($block_type['title_plural'])) { $block_type['title_plural'] = strtoupper(substr($id, 0, 1)) . substr($id, 1, 999) . "s"; } if (!isset($block_type['has_brief'])) { $block_type['has_brief'] = FALSE; } if (!isset($block_type['parent_in_id'])) { $block_type['parent_in_id'] = array(); } if (!isset($block_type['tags'])) { $block_type['tags'] = array(); } if (!isset($block_type['priority'])) { $block_type['priority'] = NULL; } if (!isset($block_type['default_order'])) { $block_type['default_order'] = 0; } if (!is_array($block_type['tags'])) { $block_type['tags'] = (array) $block_type['tags']; } if (!is_array($block_type['parent_in_id'])) { $block_type['parent_in_id'] = (array) $block_type['parent_in_id']; } if (!isset($block_type['short'])) { $block_type['short'] = $id; } if (!isset($block_type['starts_group_for'])) { $block_type['starts_group_for'] = array(); } if (!is_array($block_type['starts_group_for'])) { $block_type['starts_group_for'] = (array) $block_type['starts_group_for']; } if (!isset($block_type['synonyms'])) { $block_type['synonyms'] = array(); } if (!is_array($block_type['synonyms'])) { $block_type['synonyms'] = (array) $block_type['synonyms']; } $this->options['type_keywords'][$id] = $id; foreach ($block_type['synonyms'] as $alias) { $this->options['type_keywords'][$alias] = $id; } } return TRUE; }