Skip to content

Commit 6daf31b

Browse files
authored
Merge pull request #1226 from PHPOffice/develop
Merge develop branch to master branch
2 parents 7c256b5 + 56720df commit 6daf31b

File tree

420 files changed

+13208
-7426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

420 files changed

+13208
-7426
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ Thumbs.db
66
Desktop.ini
77
.idea
88
_build
9+
/build
910
phpunit.xml
1011
composer.lock
1112
composer.phar
1213
vendor
1314
/report
15+
/build
1416
/samples/resources
1517
/samples/results
1618
/.settings
1719
phpword.ini
1820
/.buildpath
19-
/.project
21+
/.project
22+
/nbproject
23+
/.php_cs.cache

.php_cs.dist

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->notName('pclzip.lib.php')
5+
->notName('OLERead.php')
6+
->in('samples')
7+
->in('src')
8+
->in('tests');
9+
10+
return PhpCsFixer\Config::create()
11+
->setRiskyAllowed(true)
12+
->setFinder($finder)
13+
->setRules(array(
14+
'array_syntax' => array('syntax' => 'long'),
15+
'binary_operator_spaces' => array('align_double_arrow' => true),
16+
'blank_line_after_namespace' => true,
17+
'blank_line_after_opening_tag' => false,
18+
'blank_line_before_return' => true,
19+
'braces' => true,
20+
'cast_spaces' => true,
21+
'class_definition' => true,
22+
'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE
23+
'combine_consecutive_unsets' => true,
24+
'concat_space' => array('spacing' => 'one'),
25+
'declare_equal_normalize' => true,
26+
'declare_strict_types' => false, // Too early to adopt strict types
27+
'dir_constant' => true,
28+
'elseif' => true,
29+
'encoding' => true,
30+
'ereg_to_preg' => true,
31+
'full_opening_tag' => true,
32+
'function_declaration' => true,
33+
'function_typehint_space' => true,
34+
'general_phpdoc_annotation_remove' => false, // No use for that
35+
'hash_to_slash_comment' => true,
36+
'header_comment' => false, // We don't use common header in all our files
37+
'heredoc_to_nowdoc' => false, // Not sure about this one
38+
'is_null' => false, // Risky
39+
'include' => true,
40+
'indentation_type' => true,
41+
'line_ending' => true,
42+
'linebreak_after_opening_tag' => true,
43+
'lowercase_cast' => true,
44+
'lowercase_constants' => true,
45+
'lowercase_keywords' => true,
46+
'mb_str_functions' => false, // No, too dangerous to change that
47+
'method_argument_space' => true,
48+
'method_separation' => true,
49+
'modernize_types_casting' => true,
50+
'native_function_casing' => true,
51+
'native_function_invocation'=> false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now
52+
'new_with_braces' => true,
53+
'no_alias_functions' => true,
54+
'no_blank_lines_after_class_opening' => true,
55+
'no_blank_lines_after_phpdoc' => true,
56+
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
57+
'no_closing_tag' => true,
58+
'no_empty_comment' => true,
59+
'no_empty_phpdoc' => true,
60+
'no_empty_statement' => true,
61+
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'),
62+
'no_leading_import_slash' => true,
63+
'no_leading_namespace_whitespace' => true,
64+
'no_mixed_echo_print' => true,
65+
'no_multiline_whitespace_around_double_arrow' => true,
66+
'no_multiline_whitespace_before_semicolons' => true,
67+
'no_php4_constructor' => true,
68+
'no_short_bool_cast' => true,
69+
'no_short_echo_tag' => true,
70+
'no_singleline_whitespace_before_semicolons' => true,
71+
'no_spaces_after_function_name' => true,
72+
'no_spaces_around_offset' => true,
73+
'no_spaces_inside_parenthesis' => true,
74+
'no_trailing_comma_in_list_call' => true,
75+
'no_trailing_comma_in_singleline_array' => true,
76+
'no_trailing_whitespace' => true,
77+
'no_trailing_whitespace_in_comment' => true,
78+
'no_unneeded_control_parentheses' => true,
79+
'no_unreachable_default_argument_value' => true,
80+
'no_unused_imports' => true,
81+
'no_useless_else' => true,
82+
'no_useless_return' => true,
83+
'no_whitespace_before_comma_in_array' => true,
84+
'no_whitespace_in_blank_line' => true,
85+
'normalize_index_brace' => true,
86+
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
87+
'not_operator_with_successor_space' => false, // idem
88+
'object_operator_without_whitespace' => true,
89+
'ordered_class_elements' => false, // We prefer to keep some freedom
90+
'ordered_imports' => true,
91+
'php_unit_construct' => true,
92+
'php_unit_dedicate_assert' => true,
93+
'php_unit_fqcn_annotation' => true,
94+
'php_unit_strict' => false, // We sometime actually need assertEquals
95+
'phpdoc_add_missing_param_annotation' => true,
96+
'phpdoc_align' => false, // Waste of time
97+
'phpdoc_annotation_without_dot' => true,
98+
'phpdoc_indent' => true,
99+
'phpdoc_inline_tag' => true,
100+
'phpdoc_no_access' => true,
101+
'phpdoc_no_alias_tag' => true,
102+
'phpdoc_no_empty_return' => true,
103+
'phpdoc_no_package' => true,
104+
'phpdoc_no_useless_inheritdoc' => true,
105+
'phpdoc_order' => true,
106+
'phpdoc_return_self_reference' => true,
107+
'phpdoc_scalar' => true,
108+
'phpdoc_separation' => false,
109+
'phpdoc_single_line_var_spacing' => true,
110+
'phpdoc_summary' => false,
111+
'phpdoc_to_comment' => true,
112+
'phpdoc_trim' => true,
113+
'phpdoc_types' => true,
114+
'phpdoc_var_without_name' => true,
115+
'pow_to_exponentiation' => false,
116+
'pre_increment' => false,
117+
'protected_to_private' => true,
118+
'psr0' => true,
119+
'psr4' => true,
120+
'random_api_migration' => false, // This breaks our unit tests
121+
'return_type_declaration' => true,
122+
'self_accessor' => true,
123+
'semicolon_after_instruction' => false, // Buggy in `samples/index.php`
124+
'short_scalar_cast' => true,
125+
'silenced_deprecation_error' => true,
126+
'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null
127+
'single_blank_line_at_eof' => true,
128+
'single_blank_line_before_namespace' => true,
129+
'single_class_element_per_statement' => true,
130+
'single_import_per_statement' => true,
131+
'single_line_after_imports' => true,
132+
'single_quote' => true,
133+
'space_after_semicolon' => true,
134+
'standardize_not_equals' => true,
135+
'strict_comparison' => false, // No, too dangerous to change that
136+
'strict_param' => false, // No, too dangerous to change that
137+
'switch_case_semicolon_to_colon' => true,
138+
'switch_case_space' => true,
139+
'ternary_operator_spaces' => true,
140+
'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6
141+
'trailing_comma_in_multiline_array' => true,
142+
'trim_array_spaces' => false,
143+
'unary_operator_spaces' => true,
144+
'visibility_required' => true,
145+
'whitespace_after_comma_in_array' => true,
146+
));

.travis.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
language: php
22

3+
dist: precise
4+
35
php:
46
- 5.3
57
- 5.4
68
- 5.5
79
- 5.6
810
- 7.0
9-
- hhvm
11+
- 7.1
1012

1113
matrix:
14+
include:
15+
- php: 5.6
16+
env: COVERAGE=1
1217
allow_failures:
1318
- php: 7.0
14-
- php: hhvm
19+
- php: 7.1
20+
21+
cache:
22+
directories:
23+
- vendor
24+
- $HOME/.composer/cache
25+
- .php-cs.cache
1526

1627
env:
1728
global:
@@ -23,6 +34,8 @@ before_install:
2334
- sudo apt-get install -y graphviz
2435

2536
before_script:
37+
## Deactivate xdebug if we don't do code coverage
38+
- if [ -z "$COVERAGE" ]; then phpenv config-rm xdebug.ini ; fi
2639
## Composer
2740
- composer self-update
2841
- composer install --prefer-source
@@ -32,19 +45,20 @@ before_script:
3245

3346
script:
3447
## PHP_CodeSniffer
35-
- ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
48+
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi
49+
## PHP-CS-Fixer
50+
- if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi
3651
## PHP Mess Detector
37-
- ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
52+
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi
3853
## PHPUnit
39-
- ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage
54+
- ./vendor/bin/phpunit -c ./ $(if [ -n "$COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi)
4055
## PHPLOC
41-
- ./vendor/bin/phploc src/
56+
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
4257
## PHPDocumentor
43-
- ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig"
58+
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
4459

4560
after_script:
4661
## PHPDocumentor
4762
- bash .travis_shell_after_success.sh
4863
## Scrutinizer
49-
- wget https://scrutinizer-ci.com/ocular.phar
50-
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
64+
- if [ -n "$COVERAGE" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi

.travis_shell_after_success.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
55
echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION"
66
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
77

8-
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then
8+
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then
99

1010
echo -e "Publishing PHPDoc...\n"
1111

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,53 @@ Change Log
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
v0.14.0 (28 Dec 2017)
7+
----------------------
8+
This release fixes several bugs and adds some new features.
9+
This is the last version to support PHP 5.3
10+
11+
### Added
12+
- Possibility to control the footnote numbering - @troosan #1068
13+
- Image creation from string - @troosan #937
14+
- Introduced the `\PhpOffice\PhpWord\SimpleType\NumberFormat` simple type. - @troosan
15+
- Support for ContextualSpacing - @postHawk #1088
16+
- Possiblity to hide spelling and/or grammatical errors - @troosan #542
17+
- Possiblity to set default document language as well as changing the language for each text element - @troosan #1108
18+
- Support for Comments - @troosan #1067
19+
- Support for paragraph textAlignment - @troosan #1165
20+
- Add support for HTML underline tag <u> in addHtml - @zNightFalLz #1186
21+
- Add support for HTML <br> in addHtml - @anrikun @troosan #659
22+
- Allow to change cell width unit - guillaume-ro-fr #986
23+
- Allow to change the line height rule @troosan
24+
- Implement PageBreak for odt writer @cookiekiller #863 #824
25+
- Allow to force an update of all fields on opening a document - @troosan #951
26+
- Allow adding a CheckBox in a TextRun - @irond #727
27+
- Add support for HTML img tag - @srggroup #934
28+
- Add support for password protection for docx - @mariahaubner #1019
29+
30+
### Fixed
31+
- Loosen dependency to Zend
32+
- Images are not being printed when generating PDF - @hubertinio #1074 #431
33+
- Fixed some PHP 7 warnings - @likeuntomurphy #927
34+
- Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892
35+
- Fixed image loading over https - @troosan #988
36+
- Impossibility to set different even and odd page headers - @troosan #981
37+
- Fixed Word2007 reader where unnecessary paragraphs were being created - @donghaobo #1043 #620
38+
- Fixed Word2007 reader where margins were not being read correctly - @slowprog #885 #1008
39+
- Impossible to add element PreserveText in Section - @rvanlaak #452
40+
- Added missing options for numbering format - @troosan #1041
41+
- Fixed impossibility to set a different footer for first page - @ctrlaltca #1116, @aoloe #875
42+
- Fixed styles not being applied by HTML writer, better pdf output - @sarke #1047 #500 #1139
43+
- Fixed read docx error when document contains image from remote url - @FBnil #1173 #1176
44+
- Padded the $args array to remove error - @kaigoh #1150, @reformed #870
45+
- Fix incorrect image size between windows and mac - @bskrtich #874
46+
- Fix adding HTML table to document - @mogilvie @arivanbastos #324
47+
- Fix parsing on/off values (w:val="true|false|1|0|on|off") - @troosan #1221 #1219
48+
- Fix error on Empty Dropdown Entry - @ComputerTinker #592
49+
50+
### Deprecated
51+
- PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection();
52+
653
v0.13.0 (31 July 2016)
754
-------------------
855
This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default).
@@ -22,6 +69,7 @@ Manual installation feature has been dropped since the release. Please, use [Com
2269
- Improved error message for the case when `autoload.php` is not found. - @RomanSyroeshko #371
2370
- Renamed the `align` option of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles into `alignment`. - @RomanSyroeshko
2471
- Improved performance of `TemplateProcessor::setValue()`. - @kazitanvirahsan #614, #617
72+
- Fixed some HTML tags not rendering any output (p, header & table) - #257, #324 - @twmobius and @garethellis
2573

2674
### Deprecated
2775
- `getAlign` and `setAlign` methods of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles.

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ PHPWord is a library written in pure PHP that provides a set of classes to write
1212

1313
PHPWord is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPWord/blob/develop/COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPWord) and [unit testing](http://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/develop/).
1414

15+
If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword)
16+
1517
Read more about PHPWord:
1618

1719
- [Features](#features)
@@ -55,8 +57,7 @@ PHPWord requires the following:
5557
- PHP 5.3.3+
5658
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
5759
- [Zend\Escaper component](http://framework.zend.com/manual/current/en/modules/zend.escaper.introduction.html)
58-
- Zend\Stdlib component
59-
- [Zend\Validator component](http://framework.zend.com/manual/current/en/modules/zend.validator.html)
60+
- [Zend\Stdlib component](http://framework.zend.com/manual/current/en/modules/zend.stdlib.hydrator.html)
6061
- [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write OOXML and ODF)
6162
- [GD extension](http://php.net/manual/en/book.image.php) (optional, used to add images)
6263
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write OOXML and ODF)
@@ -66,14 +67,22 @@ PHPWord requires the following:
6667
## Installation
6768

6869
PHPWord is installed via [Composer](https://getcomposer.org/).
69-
You just need to [add dependency](https://getcomposer.org/doc/04-schema.md#package-links>) on PHPWord into your package.
70+
To [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links>) to PHPWord in your project, either
7071

71-
Example:
72+
Run the following to use the latest stable version
73+
```sh
74+
composer require phpoffice/phpword
75+
```
76+
or if you want the latest master version
77+
```sh
78+
composer require phpoffice/phpword:dev-master
79+
```
7280

81+
You can of course also manually edit your composer.json file
7382
```json
7483
{
7584
"require": {
76-
"phpoffice/phpword": "v0.13.*"
85+
"phpoffice/phpword": "v0.14.*"
7786
}
7887
}
7988
```

bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* file that was distributed with this source code. For the full list of
1111
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
1212
*
13-
* @link https://github.com/PHPOffice/PHPWord
14-
* @copyright 2010-2016 PHPWord contributors
13+
* @see https://github.com/PHPOffice/PHPWord
14+
* @copyright 2010-2017 PHPWord contributors
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

0 commit comments

Comments
 (0)