', ''), $string); $string = str_replace(array('{/@+' . '+}', '{/@-' . '-}'), '', $string); // nl2br $string = nl2br($string); return $string; } // ################################################################### /** * Formats a SVN log message * * @access public * * @param string Unformatted log message * * @return string Output-ready log message */ function format_log_message($message) { global $viewsvn; $message = $viewsvn->entity_encode($message); $message = preg_replace('#r([0-9]+)#e', '"maincontrol->href_struct("diff.php" . Paths::fetch_rev_str(true, "\1", 0), "/") . "\">r\1"', $message); $list = false; $lines = explode("\n", $message); $message = ''; foreach ($lines AS $line) { if (preg_match('#^\s*?(\*|\-)\s?(.*)#', $line, $matches)) { if ($list) { $message .= '
  • ' . $matches[2] . '
  • '; } else { $message .= ''; $message .= $line; } else { $message .= $line; $message .= '
    '; } $list = false; } $message .= "\n"; } if ($list) { $message .= ''; } $message = preg_replace('#(
    )*$#', '', $message); return $message; } // ################################################################### /** * Parses a date from Xquery XML outut * * @access public * * @param string Date string * * @return string Formatted and readable date string */ function format_date_string($string) { // 2005-01-23T20:42:53.703057Z return preg_replace('#(....)\-(..)\-(..)T(..):(..):(..).(.*)Z#e', 'gmdate("r", mktime(\4, \5, \6, \2, \3, \1))', $string); } // ################################################################### /** * Counts the spaces and replaces two or more ones * * @access private * * @param string Spaced string * * @return string  'd string */ function format_spaces($thestring) { if (strlen($thestring) >= 2) { $thestring = str_replace(' ', ' ', $thestring); } return $thestring; } // ################################################################### /** * Prints the file changed list * * @access public * * @public array List of file changes * @public string The repository * @public integer Current revision * * @return string Processed HTML */ function construct_file_changes($changes, $repos, $revision) { global $viewsvn; $files = ''; foreach ($changes AS $file) { switch ($file['action']) { case 'A': $class = 'file_add'; $tooltip = $viewsvn->lang->string('Added'); break; case 'D': $class = 'file_delete'; $tooltip = $viewsvn->lang->string('Deleted'); break; case 'M': $class = 'file_modify'; $tooltip = $viewsvn->lang->string('Modified'); break; case 'R': $class = 'file_replace'; $tooltip = $viewsvn->lang->string('Replaced'); break; } $show['from'] = (bool)$file['from']; if ($file['from']) { $class = 'file_move'; $tooltip = 'Moved/Copied'; preg_match('#(.*):([0-9]+)#', $file['from'], $matches); $link['from'] = $viewsvn->path . '/view.php/' . $repos . '/' . $matches[1] . Paths::fetch_rev_str(false, $matches[2]); } $link['file'] = $viewsvn->path . '/view.php/' . $repos . $file['value'] . Paths::fetch_rev_str(false, $revision); eval('$files .= "' . $viewsvn->template->fetch('file_change') . '";'); } return $files; } // ################################################################### /** * Generates a clean revision number * * @access public * * @param integer Revision number * * @return mixed Cleaned revision or HEAD */ function rev($revision) { if (($revision = intval($revision)) < 1) { $revision = 'HEAD'; } return $revision; } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>