Skip to content

Commit c1b0348

Browse files
authoredSep 20, 2016
Merge pull request #8 from phalcongelist/2.0.x
Bump version (2.0.4)
2 parents cce4029 + 86329ca commit c1b0348

File tree

7 files changed

+93
-12
lines changed

7 files changed

+93
-12
lines changed
 

‎.github/CONTRIBUTING.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ Phalcon Diff is an open source project and a volunteer effort.
55
Phalcon Diff does not have human resources fully dedicated to the maintenance of this software.
66
If you want something to be improved or you want a new feature please submit a Pull Request.
77

8-
If you have a change or new feature in mind, please fill an [NFR](https://github.com/phalcon/cphalcon/wiki/New-Feature-Request---NFR).
8+
If you have a change or new feature in mind, please fill an [NFR][:nfr:].
9+
**Note**: We don't add changes directly to stable branches or `master`.
10+
So, if you are going to do a PR, use the dev-branch.
911

1012
Thanks! <br />
1113
Phalcon Team
14+
15+
[:nfr:]: https://github.com/phalcongelist/php-diff/wiki/New-Feature-Request---NFR

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ script:
2626
notifications:
2727
email:
2828
recipients:
29-
- serghei@phalconphp.com
29+
- build@phalconphp.com
3030
on_success: change
3131
on_failure: always

‎CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# [2.0.5](https://github.com/phalcongelist/php-diff/releases/tag/v2.0.5) (2016-XX-XX)
2+
3+
4+
# [2.0.4](https://github.com/phalcongelist/php-diff/releases/tag/v2.0.4) (2016-09-20)
5+
6+
* Added ability to set title for `SideBySide` renderer
7+
* Added ability to set title for `Inline` renderer
8+
* Added `mbstring` extension as package dependency [#6](https://github.com/phalcongelist/php-diff/issues/6)
9+
110
# [2.0.3](https://github.com/phalcongelist/php-diff/releases/tag/v2.0.3) (2016-07-18)
211

312
* Fixed `BaseArray` class name

‎README.md

+38-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is a fork of [Chris Boulton's Diff][fork] project.
88

99
## Introduction
1010

11-
A comprehensive library for generating differences between
11+
Phalcon Diff is a comprehensive library for generating differences between
1212
two hashable objects (strings or arrays). Generated differences can be
1313
rendered in all of the standard formats including:
1414

@@ -21,6 +21,41 @@ The logic behind the core of the diff engine (ie, the sequence matcher)
2121
is primarily based on the Python difflib package. The reason for doing
2222
so is primarily because of its high degree of accuracy.
2323

24+
Please write us if you have any feedback.
25+
26+
## Get Started
27+
28+
### Requirements
29+
30+
To run this library on your project, you need at least:
31+
32+
* PHP >= 5.4
33+
* PHP mbstring extension
34+
35+
### Installation
36+
37+
Install [Composer][composer] in a common location or in your project:
38+
39+
```sh
40+
$ curl -s http://getcomposer.org/installer | php
41+
```
42+
43+
Create the `composer.json` file as follows:
44+
45+
```json
46+
{
47+
"require": {
48+
"phalcongelist/php-diff": "~2.0"
49+
}
50+
}
51+
```
52+
53+
Run the composer installer:
54+
55+
```sh
56+
$ php composer.phar install
57+
```
58+
2459
## Example Use
2560

2661
More complete documentation will be available shortly.
@@ -35,9 +70,10 @@ More complete documentation will be available shortly.
3570

3671
Phalcon Diff is open-sourced software licensed under the [New BSD License][license].
3772

38-
© 2009-2016, Chris Boulton <chris.boulton@interspire.com> <br>
3973
© 2016, Phalcon Framework Team and contributors <br>
74+
© 2009-2016, Chris Boulton <chris.boulton@interspire.com> <br>
4075
All rights reserved.
4176

4277
[fork]: https://github.com/chrisboulton/php-diff
78+
[composer]: https://getcomposer.org
4379
[license]: https://github.com/phalcongelist/php-diff/blob/master/docs/LICENSE.txt

‎composer.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"type": "library",
44
"description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).",
55
"license": "BSD-3-Clause",
6+
"keywords": [
7+
"php", "diff", "phalcon"
8+
],
69
"authors": [
710
{
811
"name": "Phalcon Team",
@@ -16,13 +19,15 @@
1619
],
1720
"support": {
1821
"source": "https://github.com/phalcongelist/php-diff",
19-
"issues": "https://github.com/phalcongelist/php-diff/issues"
22+
"issues": "https://github.com/phalcongelist/php-diff/issues",
23+
"wiki": "https://github.com/phalcongelist/php-diff/wiki"
2024
},
2125
"require": {
22-
"php": ">= 5.4"
26+
"php": ">= 5.4",
27+
"ext-mbstring": "*"
2328
},
2429
"require-dev": {
25-
"squizlabs/php_codesniffer": "~2.6"
30+
"squizlabs/php_codesniffer": "~2.7"
2631
},
2732
"autoload": {
2833
"psr-4": {

‎src/Diff/Renderer/Html/Inline.php

+19-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
*/
2626
class Inline extends BaseArray
2727
{
28+
private $oldTitle = 'Old';
29+
private $newTitle = 'New';
30+
private $diffTitle = 'Differences';
31+
2832
/**
2933
* Render a and return diff with changes between the two sequences
3034
* displayed inline (under each other)
@@ -40,12 +44,24 @@ public function render()
4044
return $html;
4145
}
4246

47+
if (isset($this->options['oldTitle'])) {
48+
$this->oldTitle = $this->options['oldTitle'];
49+
}
50+
51+
if (isset($this->options['newTitle'])) {
52+
$this->newTitle = $this->options['newTitle'];
53+
}
54+
55+
if (isset($this->options['diffTitle'])) {
56+
$this->diffTitle = $this->options['diffTitle'];
57+
}
58+
4359
$html .= '<table class="Differences DifferencesInline">';
4460
$html .= '<thead>';
4561
$html .= '<tr>';
46-
$html .= '<th>Old</th>';
47-
$html .= '<th>New</th>';
48-
$html .= '<th>Differences</th>';
62+
$html .= '<th>' . htmlspecialchars($this->oldTitle) . '</th>';
63+
$html .= '<th>' . htmlspecialchars($this->newTitle) . '</th>';
64+
$html .= '<th>' . htmlspecialchars($this->diffTitle) . '</th>';
4965
$html .= '</tr>';
5066
$html .= '</thead>';
5167
foreach ($changes as $i => $blocks) {

‎src/Diff/Renderer/Html/SideBySide.php

+13-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
*/
2626
class SideBySide extends BaseArray
2727
{
28+
private $oldTitle = 'Old Version';
29+
private $newTitle = 'New Version';
30+
2831
/**
2932
* Render a and return diff with changes between the two sequences
3033
* displayed side by side.
@@ -40,11 +43,19 @@ public function render()
4043
return $html;
4144
}
4245

46+
if (isset($this->options['oldTitle'])) {
47+
$this->oldTitle = $this->options['oldTitle'];
48+
}
49+
50+
if (isset($this->options['newTitle'])) {
51+
$this->newTitle = $this->options['newTitle'];
52+
}
53+
4354
$html .= '<table class="Differences DifferencesSideBySide">';
4455
$html .= '<thead>';
4556
$html .= '<tr>';
46-
$html .= '<th colspan="2">Old Version</th>';
47-
$html .= '<th colspan="2">New Version</th>';
57+
$html .= '<th colspan="2">' . htmlspecialchars($this->oldTitle) . '</th>';
58+
$html .= '<th colspan="2">' . htmlspecialchars($this->newTitle) . '</th>';
4859
$html .= '</tr>';
4960
$html .= '</thead>';
5061

0 commit comments

Comments
 (0)
Please sign in to comment.