Esempio n. 1
0
 function start($text, $request, $echo = true, $wordwrap = true, $esc = true, $autolink = true, $nl2br = false)
 {
     $this->project = $request->project;
     $this->request = $request;
     $this->scm = IDF_Scm::get($request->project);
     if ($esc) {
         $text = Pluf_esc($text);
     }
     if ($autolink) {
         $text = preg_replace('#([a-z]+://[^\\s\\(\\)]+)#i', '<a href="\\1">\\1</a>', $text);
     }
     if ($request->rights['hasIssuesAccess']) {
         $text = preg_replace_callback('#((?:issue|bug|ticket)(s)?\\s+|\\s+\\#)(\\d+)(\\#ic\\d+)?(?(2)((?:[, \\w]+(?:\\s+\\#)?)?\\d+(?:\\#ic\\d+)?){0,})#im', array($this, 'callbackIssues'), $text);
     }
     if ($request->rights['hasReviewAccess']) {
         $text = preg_replace_callback('#(reviews?\\s+)(\\d+(?:(?:\\s+and|\\s+or|,)\\s+\\d+)*)\\b#i', array($this, 'callbackReviews'), $text);
     }
     if ($request->rights['hasSourceAccess']) {
         $text = preg_replace_callback('#(commits?\\s+)([0-9a-f]{1,40}(?:(?:\\s+and|\\s+or|,)\\s+[0-9a-f]{1,40})*)\\b#i', array($this, 'callbackCommits'), $text);
         $text = preg_replace_callback('#(src:)([^\\s\\(\\)\\\\]+(?:(\\\\)\\s+[^\\s\\(\\)\\\\]+){0,})+#im', array($this, 'callbackSource'), $text);
     }
     if ($wordwrap) {
         $text = Pluf_Text::wrapHtml($text, 69, "\n");
     }
     if ($nl2br) {
         $text = nl2br($text);
     }
     if ($echo) {
         echo $text;
     } else {
         return $text;
     }
 }
Esempio n. 2
0
 function start($text, $request, $echo = true, $wordwrap = true, $esc = true, $autolink = true, $nl2br = false)
 {
     $this->project = $request->project;
     $this->request = $request;
     $this->scm = IDF_Scm::get($request->project);
     if ($esc) {
         $text = Pluf_esc($text);
     }
     if ($autolink) {
         $text = preg_replace('#([a-z]+://[^\\s\\(\\)]+)#i', '<a href="\\1">\\1</a>', $text);
     }
     if ($request->rights['hasIssuesAccess']) {
         $text = preg_replace_callback('#((?:issue|bug|ticket)(s)?\\s+|\\s+\\#)(\\d+)(\\#ic\\d+)?(?(2)((?:[, \\w]+(?:\\s+\\#)?)?\\d+(?:\\#ic\\d+)?){0,})#im', array($this, 'callbackIssues'), $text);
     }
     if ($request->rights['hasReviewAccess']) {
         $text = preg_replace_callback('#(reviews?\\s+)(\\d+(?:(?:\\s+and|\\s+or|,)\\s+\\d+)*)\\b#i', array($this, 'callbackReviews'), $text);
     }
     if ($request->rights['hasSourceAccess']) {
         $verbs = array('added', 'fixed', 'reverted', 'changed', 'removed');
         $nouns = array('commit', 'commits', 'revision', 'revisions', 'rev', 'revs');
         $prefix = implode(' in|', $verbs) . ' in' . '|' . implode('|', $nouns);
         $text = preg_replace_callback('#((?:' . $prefix . ')(?:\\s+r?))([0-9a-f]{1,40}((?:\\s+and|\\s+or|,)\\s+r?[0-9a-f]{1,40})*)\\b#i', array($this, 'callbackCommits'), $text);
         $text = preg_replace_callback('=(src:)([^\\s@#,\\(\\)\\\\]+(?:(\\\\)[\\s@#][^\\s@#,\\(\\)\\\\]+){0,})+(?:\\@([^\\s#,]+))(?:#(\\d+))?=im', array($this, 'callbackSource'), $text);
     }
     if ($wordwrap) {
         $text = Pluf_Text::wrapHtml($text, 69, "\n");
     }
     if ($nl2br) {
         $text = nl2br($text);
     }
     if ($echo) {
         echo $text;
     } else {
         return $text;
     }
 }