Skip to content

Commit

Permalink
Merge branch 'develop' into feature/EnablePasswordProtection
Browse files Browse the repository at this point in the history
  • Loading branch information
troosan committed Nov 22, 2017
2 parents 71574d1 + b4b87cd commit 7b30145
Show file tree
Hide file tree
Showing 411 changed files with 12,060 additions and 7,343 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ Thumbs.db
Desktop.ini
.idea
_build
/build
phpunit.xml
composer.lock
composer.phar
vendor
/report
/build
/samples/resources
/samples/results
/.settings
phpword.ini
/.buildpath
/.project
/.project
/nbproject
/.php_cs.cache
146 changes: 146 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?php

$finder = PhpCsFixer\Finder::create()
->notName('pclzip.lib.php')
->notName('OLERead.php')
->in('samples')
->in('src')
->in('tests');

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setFinder($finder)
->setRules(array(
'array_syntax' => array('syntax' => 'long'),
'binary_operator_spaces' => array('align_double_arrow' => true),
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => false,
'blank_line_before_return' => true,
'braces' => true,
'cast_spaces' => true,
'class_definition' => true,
'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE
'combine_consecutive_unsets' => true,
'concat_space' => array('spacing' => 'one'),
'declare_equal_normalize' => true,
'declare_strict_types' => false, // Too early to adopt strict types
'dir_constant' => true,
'elseif' => true,
'encoding' => true,
'ereg_to_preg' => true,
'full_opening_tag' => true,
'function_declaration' => true,
'function_typehint_space' => true,
'general_phpdoc_annotation_remove' => false, // No use for that
'hash_to_slash_comment' => true,
'header_comment' => false, // We don't use common header in all our files
'heredoc_to_nowdoc' => false, // Not sure about this one
'is_null' => false, // Risky
'include' => true,
'indentation_type' => true,
'line_ending' => true,
'linebreak_after_opening_tag' => true,
'lowercase_cast' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'mb_str_functions' => false, // No, too dangerous to change that
'method_argument_space' => true,
'method_separation' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'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
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'),
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'no_short_echo_tag' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unreachable_default_argument_value' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
'not_operator_with_successor_space' => false, // idem
'object_operator_without_whitespace' => true,
'ordered_class_elements' => false, // We prefer to keep some freedom
'ordered_imports' => true,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'php_unit_fqcn_annotation' => true,
'php_unit_strict' => false, // We sometime actually need assertEquals
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => false, // Waste of time
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => false,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => false,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => false,
'pre_increment' => false,
'protected_to_private' => true,
'psr0' => true,
'psr4' => true,
'random_api_migration' => false, // This breaks our unit tests
'return_type_declaration' => true,
'self_accessor' => true,
'semicolon_after_instruction' => false, // Buggy in `samples/index.php`
'short_scalar_cast' => true,
'silenced_deprecation_error' => true,
'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'strict_comparison' => false, // No, too dangerous to change that
'strict_param' => false, // No, too dangerous to change that
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => false,
'unary_operator_spaces' => true,
'visibility_required' => true,
'whitespace_after_comma_in_array' => true,
));
32 changes: 23 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
language: php

dist: precise

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
- 7.1

matrix:
include:
- php: 5.6
env: COVERAGE=1
allow_failures:
- php: 7.0
- php: hhvm
- php: 7.1

cache:
directories:
- vendor
- $HOME/.composer/cache
- .php-cs.cache

env:
global:
Expand All @@ -23,6 +34,8 @@ before_install:
- sudo apt-get install -y graphviz

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

script:
## PHP_CodeSniffer
- ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi
## PHP-CS-Fixer
- if [ -n "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi
## PHP Mess Detector
- ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi
## PHPUnit
- ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage
- ./vendor/bin/phpunit -c ./ $(if [ -n "$COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi)
## PHPLOC
- ./vendor/bin/phploc src/
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
## PHPDocumentor
- ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig"
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi

after_script:
## PHPDocumentor
- bash .travis_shell_after_success.sh
## Scrutinizer
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
- 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
2 changes: 1 addition & 1 deletion .travis_shell_after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION"
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"

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

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

Expand Down
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,42 @@ Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http:https://semver.org/).

v0.14.0 (?? ???? 2017)
----------------------
This release fixes several bugs and adds some new features.
This is the last version to support PHP 5.3

### Added
- Possibility to control the footnote numbering - @troosan #1068
- Image creation from string - @troosan #937
- Introduced the `\PhpOffice\PhpWord\SimpleType\NumberFormat` simple type. - @troosan
- Support for ContextualSpacing - @postHawk #1088
- Possiblity to hide spelling and/or grammatical errors - @troosan #542
- Possiblity to set default document language as well as changing the language for each text element - @troosan #1108
- Support for Comments - @troosan #1067
- Support for paragraph textAlignment - @troosan #1165
- Add support for HTML underline tag <u> in addHtml - @zNightFalLz #1186
- Allow to change cell width unit - guillaume-ro-fr #986
- Allow to change the line height rule @troosan

### Fixed
- Loosen dependency to Zend
- Images are not being printed when generating PDF - @hubertinio #1074 #431
- Fixed some PHP 7 warnings - @ likeuntomurphy #927
- Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892
- Fixed image loading over https - @troosan #988
- Impossibility to set different even and odd page headers - @troosan #981
- Fixed Word2007 reader where unnecessary paragraphs were being created - @donghaobo #1043 #620
- Fixed Word2007 reader where margins were not being read correctly - @slowprog #885 #1008
- Impossible to add element PreserveText in Section - @rvanlaak #452
- Added missing options for numbering format - @troosan #1041
- Fixed impossibility to set a different footer for first page - @ctrlaltca #1116, @aoloe #875
- Fixed styles not being applied by HTML writer, better pdf output - @sarke #1047 #500 #1139
- Fixed read docx error when document contains image from remote url - @FBnil #1173 #1176
- Padded the $args array to remove error - @kaigoh #1150, @reformed #870
- Fix incorrect image size between windows and mac - @bskrtich #874
- Fix adding HTML table to document - @mogilvie @arivanbastos #324

v0.13.0 (31 July 2016)
-------------------
This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default).
Expand All @@ -22,6 +58,7 @@ Manual installation feature has been dropped since the release. Please, use [Com
- Improved error message for the case when `autoload.php` is not found. - @RomanSyroeshko #371
- Renamed the `align` option of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles into `alignment`. - @RomanSyroeshko
- Improved performance of `TemplateProcessor::setValue()`. - @kazitanvirahsan #614, #617
- Fixed some HTML tags not rendering any output (p, header & table) - #257, #324 - @twmobius and @garethellis

### Deprecated
- `getAlign` and `setAlign` methods of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles.
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ PHPWord is a library written in pure PHP that provides a set of classes to write

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:https://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http:https://phpword.readthedocs.org/) and the [API Documentation](http:https://phpoffice.github.io/PHPWord/docs/develop/).

If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword)

Read more about PHPWord:

- [Features](#features)
Expand Down Expand Up @@ -55,8 +57,7 @@ PHPWord requires the following:
- PHP 5.3.3+
- [XML Parser extension](http:https://www.php.net/manual/en/xml.installation.php)
- [Zend\Escaper component](http:https://framework.zend.com/manual/current/en/modules/zend.escaper.introduction.html)
- Zend\Stdlib component
- [Zend\Validator component](http:https://framework.zend.com/manual/current/en/modules/zend.validator.html)
- [Zend\Stdlib component](http:https://framework.zend.com/manual/current/en/modules/zend.stdlib.hydrator.html)
- [Zip extension](http:https://php.net/manual/en/book.zip.php) (optional, used to write OOXML and ODF)
- [GD extension](http:https://php.net/manual/en/book.image.php) (optional, used to add images)
- [XMLWriter extension](http:https://php.net/manual/en/book.xmlwriter.php) (optional, used to write OOXML and ODF)
Expand Down
4 changes: 2 additions & 2 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @see https://github.com/PHPOffice/PHPWord
* @copyright 2010-2017 PHPWord contributors
* @license http:https://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/

Expand Down
20 changes: 12 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"name": "Franck Lefevre",
"homepage": "http:https://blog.rootslabs.net"
"homepage": "https:https://rootslabs.net/blog/"
},
{
"name": "Ivan Lanin",
Expand All @@ -29,23 +29,27 @@
{
"name": "Roman Syroeshko",
"homepage": "http:https://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/"
},
{
"name": "Antoine de Troostembergh"
}
],
"require": {
"php": ">=5.3.3",
"ext-xml": "*",
"zendframework/zend-escaper": "2.4.*",
"zendframework/zend-stdlib": "2.4.*",
"zendframework/zend-validator": "2.4.*",
"phpoffice/common": "0.2.*"
"zendframework/zend-escaper": "^2.2",
"zendframework/zend-stdlib": "^2.2",
"phpoffice/common": "^0.2"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpunit/phpunit": "^4.8.36",
"phpdocumentor/phpdocumentor":"2.*",
"squizlabs/php_codesniffer": "1.*",
"twig/twig":"1.27",
"squizlabs/php_codesniffer": "^2.7",
"friendsofphp/php-cs-fixer": "^2.0",
"phpmd/phpmd": "2.*",
"phploc/phploc": "2.*",
"dompdf/dompdf":"0.6.*",
"dompdf/dompdf":"0.8.*",
"tecnickcom/tcpdf": "6.*",
"mpdf/mpdf": "5.*"
},
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@

# General information about the project.
project = u'PHPWord'
copyright = u'2014-2015, PHPWord Contributors'
copyright = u'2014-2017, PHPWord Contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.13.0'
version = '0.14.0'
# The full version, including alpha/beta/rc tags.
release = version

Expand Down Expand Up @@ -120,7 +120,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down
Loading

0 comments on commit 7b30145

Please sign in to comment.