Index: trunk/extensions/CodeReview/backend/DiffHighlighter.php |
— | — | @@ -157,17 +157,13 @@ |
158 | 158 | } |
159 | 159 | |
160 | 160 | function formatLine( $content, $class = null ) { |
161 | | - $formatLN = |
162 | | - "<td class=\"linenumbers\">%s</td>" |
163 | | - . "<td class=\"linenumbers\">%s</td>" |
164 | | - ; |
165 | 161 | |
166 | | - $idAttr = $this->getLineIdAttr(); |
167 | 162 | if( is_null($class) ) { |
168 | | - return sprintf( "<tr class=\"commentable\" {$idAttr}>{$formatLN}<td>%s</td></tr>\n", |
169 | | - $this->left, |
170 | | - $this->right, |
171 | | - $content |
| 163 | + return Html::rawElement( 'tr', |
| 164 | + array_merge( $this->getLineIdAttr(), array( 'class' => 'commentable' ) ), |
| 165 | + Html::Element( 'td', array( 'class'=>'linenumbers' ), $this->left ) |
| 166 | + . Html::Element( 'td', array( 'class'=>'linenumbers' ), $this->right ) |
| 167 | + . Html::Element( 'td', array() , $content ) |
172 | 168 | ); |
173 | 169 | } |
174 | 170 | |
— | — | @@ -193,11 +189,12 @@ |
194 | 190 | # Rely on $left, $right initialization above |
195 | 191 | } |
196 | 192 | |
197 | | - $content = htmlspecialchars( $content ); |
198 | | - $classAttr = is_null($class) ? '' : " class=\"$class\""; |
199 | | - return sprintf( "<tr class=\"commentable\" {$idAttr}>{$formatLN}<td%s>%s</td></tr>\n", |
200 | | - $left, $right, |
201 | | - $classAttr, $content |
| 193 | + $classAttr = is_null($class) ? array() : array( 'class' => $class ); |
| 194 | + return Html::rawElement( 'tr', |
| 195 | + array_merge( $this->getLineIdAttr(), array( 'class' => 'commentable' ) ), |
| 196 | + Html::rawElement( 'td', array( 'class'=>'linenumbers' ), $left ) |
| 197 | + . Html::rawElement( 'td', array( 'class'=>'linenumbers' ), $right ) |
| 198 | + . Html::Element( 'td', $classAttr, $content ) |
202 | 199 | ); |
203 | 200 | } |
204 | 201 | |
— | — | @@ -233,13 +230,15 @@ |
234 | 231 | |
235 | 232 | function handleLineFile( $line ) { |
236 | 233 | $this->chunk = 0; |
237 | | - $idAttr = $this->getLineIdAttr(); |
238 | | - return "<tr $idAttr class=\"patchedfile\"><td colspan=\"3\">$line</td></tr>"; |
| 234 | + return Html::rawElement( 'tr', |
| 235 | + array_merge( $this->getLineIdAttr(), array( 'class' => 'patchedfile' ) ), |
| 236 | + Html::Element( 'td', array('colspan'=>3), $line ) |
| 237 | + ); |
239 | 238 | } |
240 | 239 | #### END OF LINES HANDLERS ######################################### |
241 | 240 | |
242 | 241 | function getLineIdAttr() { |
243 | | - return "id=\"line-{$this->lineNumber}\""; |
| 242 | + return array( 'id' => $this->lineNumber ); |
244 | 243 | } |
245 | 244 | |
246 | 245 | /** |