示例#1
0
文件: view.php 项目: rair/yacs
 // buttons to display previous and next pages, if any
 if ($neighbours) {
     $canvas['trailer'] .= Skin::neighbours($neighbours, 'manual');
 }
 // insert anchor suffix
 if (is_object($anchor)) {
     $canvas['trailer'] .= $anchor->get_suffix();
 }
 // reflect content canvas from anchor
 if (!isset($item['canvas']) && is_object($anchor)) {
     $item['canvas'] = $anchor->get_articles_canvas();
 }
 // reflect content canvas from anchor
 if (empty($item['canvas'])) {
     $item['canvas'] = 'standard';
 } elseif (!Safe::file('../canvas/' . $item['canvas'] . '.php')) {
     $item['canvas'] = 'standard';
 }
 // get canvas result
 $text = '';
 require_once '../canvas/' . $item['canvas'] . '.php';
 // special layout for digg
 if (defined('DIGG')) {
     $text = '<div class="digg_content">' . $text . '</div>';
 }
 // update the main content panel
 $context['text'] .= $text;
 //
 // extra panel
 //
 // page tools
示例#2
0
文件: scripts.php 项目: rair/yacs
 /**
  * merge two files
  *
  * @param string a file name of the original content
  * @param string a file for the updated content
  * @return an ASCII string
  */
 public static function merge($original, $updated)
 {
     global $context;
     // read the original file
     if (!is_array($original_lines = Safe::file($context['path_to_root'] . $original))) {
         echo sprintf(i18n::s('Impossible to read %s.'), $original) . BR . "\n";
         return NULL;
     }
     // read the updated file
     if (!is_array($updated_lines = Safe::file($context['path_to_root'] . $updated))) {
         echo sprintf(i18n::s('Impossible to read %s.'), $updated) . BR . "\n";
         return NULL;
     }
     // compare the two sequences
     $sequence = Scripts::compare($original_lines, $updated_lines);
     //		echo $original.' vs. '.$updated.BR."\n";
     // format the output string
     $text = '';
     foreach ($sequence as $item) {
         list($tag, $left, $right) = $item;
         //comment out suppressed lines
         if ($tag == '-') {
             $text .= '//-' . $left . "\n";
         } else {
             $text .= $right . "\n";
         }
     }
     // return the result of the whole comparison
     return $text;
 }