Example #1
0
 /**
  * Generates a html-view of either the first or the specified svn-commit message.
  * Uses the template to render the 
  * @param string $objLogRootNode
  * @return SimpleXMLElement
  */
 public function generateHtmlFromLogContent($strLogRootNode, $strRevisionNumber = "")
 {
     $objOneLogEntry = $this->getLogNodeToProcess($strLogRootNode, $strRevisionNumber);
     $arrObjAttributes = $objOneLogEntry->attributes();
     //prepare log-message
     $strChangedFiles = "";
     foreach ($objOneLogEntry->paths->path as $objOnePath) {
         $objPathAttributes = $objOnePath->attributes();
         $strChangedFiles .= "<li>" . $objPathAttributes->action . " " . $objOnePath . "</li>";
     }
     $arrTemplate = array();
     $arrTemplate["revision"] = $arrObjAttributes->revision . "";
     $arrTemplate["author"] = $objOneLogEntry->author . "";
     $arrTemplate["date"] = date("r", strtotime($objOneLogEntry->date));
     $arrTemplate["description"] = nl2br(htmlentities($objOneLogEntry->msg . ""));
     $arrTemplate["changedfiles"] = nl2br($strChangedFiles);
     //read the template
     if (!file_exists(SVN2RSS_PROJECT_ROOT . "/" . SVN2RSS_SYSTEM_FOLDER . "/" . $this->objConfig->getStrHtmlViewTemplate())) {
         throw new Svn2RssException("Template could not be loaded: " . SVN2RSS_PROJECT_ROOT . "/" . SVN2RSS_SYSTEM_FOLDER . "/" . $this->objConfig->getStrHtmlViewTemplate());
     }
     $strTemplateContent = file_get_contents(SVN2RSS_PROJECT_ROOT . "/" . SVN2RSS_SYSTEM_FOLDER . "/" . $this->objConfig->getStrHtmlViewTemplate());
     foreach ($arrTemplate as $strKey => $strValue) {
         $strTemplateContent = str_replace("%%" . $strKey . "%%", $strValue, $strTemplateContent);
     }
     return $strTemplateContent;
 }