File tree 5 files changed +13
-7
lines changed
5 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 32
32
33
33
// Generate a side by side diff
34
34
require_once dirname (__FILE__ ).'/../lib/Diff/Renderer/Html/SideBySide.php ' ;
35
- $ renderer = new Diff_Renderer_Html_SideBySide ;
35
+ $ renderer = new Diff_Renderer_Html_SideBySide (array (
36
+ 'title_a ' => 'Custom title for OLD version ' ,
37
+ 'title_b ' => 'Custom title for NEW version ' ,
38
+ ));
36
39
echo $ diff ->Render ($ renderer );
37
40
38
41
?>
Original file line number Diff line number Diff line change @@ -68,8 +68,6 @@ class Diff
68
68
'ignoreNewLines ' => false ,
69
69
'ignoreWhitespace ' => false ,
70
70
'ignoreCase ' => false ,
71
- 'title_a ' =>'Old Version ' ,
72
- 'title_b ' =>'New Version ' ,
73
71
'labelDifferences ' =>'Differences '
74
72
);
75
73
Original file line number Diff line number Diff line change @@ -50,7 +50,10 @@ abstract class Diff_Renderer_Abstract
50
50
/**
51
51
* @var array Array of the default options that apply to this renderer.
52
52
*/
53
- protected $ defaultOptions = array ();
53
+ protected $ defaultOptions = array (
54
+ 'title_a ' => 'Old Version ' ,
55
+ 'title_b ' => 'New Version ' ,
56
+ );
54
57
55
58
/**
56
59
* @var array Array containing the user applied and merged default options for the renderer.
Original file line number Diff line number Diff line change @@ -51,7 +51,9 @@ class Diff_Renderer_Html_Array extends Diff_Renderer_Abstract
51
51
* @var array Array of the default options that apply to this renderer.
52
52
*/
53
53
protected $ defaultOptions = array (
54
- 'tabSize ' => 4
54
+ 'tabSize ' => 4 ,
55
+ 'title_a ' => 'Old Version ' ,
56
+ 'title_b ' => 'New Version ' ,
55
57
);
56
58
57
59
/**
Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ public function render()
65
65
$ html .= '<table class="Differences DifferencesSideBySide"> ' ;
66
66
$ html .= '<thead> ' ;
67
67
$ html .= '<tr> ' ;
68
- $ html .= '<th colspan="2">Old Version </th> ' ;
69
- $ html .= '<th colspan="2">New Version </th> ' ;
68
+ $ html .= '<th colspan="2"> ' . $ this -> options [ ' title_a ' ]. ' </th> ' ;
69
+ $ html .= '<th colspan="2"> ' . $ this -> options [ ' title_b ' ]. ' </th> ' ;
70
70
$ html .= '</tr> ' ;
71
71
$ html .= '</thead> ' ;
72
72
foreach ($ changes as $ i => $ blocks ) {
You can’t perform that action at this time.
0 commit comments