Skip to content

Commit

Permalink
Merge pull request #1 from PHPOffice/develop
Browse files Browse the repository at this point in the history
Sync
  • Loading branch information
patrickbrouwers committed Feb 23, 2016
2 parents d3908de + 16495a0 commit 2944c21
Show file tree
Hide file tree
Showing 390 changed files with 920 additions and 2,151 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ php:
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm

matrix:
allow_failures:
- php: 7.0
- php: hhvm

env:
Expand All @@ -31,8 +33,6 @@ before_script:
script:
## PHP_CodeSniffer
- ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
## PHP Copy/Paste Detector
- ./vendor/bin/phpcpd src/ tests/ --verbose
## PHP Mess Detector
- ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
## PHPUnit
Expand Down
22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,30 @@ Place announcement text here.
### Changed
- 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

### Deprecated
- `getAlign` and `setAlign` methods of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles.
Use the correspondent `getAlignment` and `setAlignment` methods instead.
Use the correspondent `getAlignment` and `setAlignment` methods instead. - @RomanSyroeshko
- `left`, `right`, and `justify` alignment options for paragraphs (now are mapped to `Jc::START`, `Jc::END`, and `Jc::BOTH`). - @RomanSyroeshko
- `left`, `right`, and `justify` alignment options for tables (now are mapped to `Jc::START`, `Jc::END`, and `Jc::CENTER`). - @RomanSyroeshko

### Removed
- `PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
In each case set of available string values is defined by the correspondent simple type.
- `\PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
In each case set of available string values is defined by the correspondent simple type. - @RomanSyroeshko
- Manual installation support. Since the release we have dependencies on third party libraries,
so installation via ZIP-archive download is not an option anymore. To install PHPWord use [Composer](https://getcomposer.org/).
We also removed `\PhpOffice\PhpWord\Autoloader`, because the latter change made it completely useless.
Autoloaders provided by Composer are in use now (see `bootstrap.php`). - @RomanSyroeshko
- `\PhpOffice\PhpWord\Shared\Drawing` replaced by `\PhpOffice\Common\Drawing`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\Font`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\String` replaced by `\PhpOffice\Common\Text`. - @Progi1984 @RomanSyroeshko #658
- `\PhpOffice\PhpWord\Shared\XMLReader` replaced by `\PhpOffice\Common\XMLReader`. - @Progi1984 #658
- `\PhpOffice\PhpWord\Shared\XMLWriter` replaced by `\PhpOffice\Common\XMLWriter`. - @Progi1984 @RomanSyroeshko #658

### Fixed
- `Undefined property` error while reading MS-DOC documents. - @jaberu #610



0.12.1 (30 August 2015)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PHPWord, a pure PHP library for reading and writing word processing documents.

Copyright (c) 2010-2014 PHPWord.
Copyright (c) 2010-2015 PHPWord.

PHPWord is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3 as published by
Expand Down
24 changes: 9 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,42 +53,36 @@ With PHPWord, you can create DOCX, ODT, or RTF documents dynamically using your
PHPWord requires the following:

- PHP 5.3+
- [Zip extension](http://php.net/manual/en/book.zip.php)
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
- [Zend\Validator component](http://framework.zend.com/manual/current/en/modules/zend.validator.html)
- [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write DOCX and ODT)
- [GD extension](http://php.net/manual/en/book.image.php) (optional, used to add images)
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write DOCX and ODT)
- [XSL extension](http://php.net/manual/en/book.xsl.php) (optional, used to apply XSL style sheet to template )
- [dompdf](https://github.com/dompdf/dompdf) (optional, used to write PDF)
- [dompdf library](https://github.com/dompdf/dompdf) (optional, used to write PDF)

## Installation

It is recommended that you install the PHPWord library [through composer](http://getcomposer.org/). To do so, add
the following lines to your ``composer.json``.
PHPWord is installed via [Composer](https://getcomposer.org/).
You just need to [add dependency](https://getcomposer.org/doc/04-schema.md#package-links>) on PHPWord into your package.

Example:

```json
{
"require": {
"phpoffice/phpword": "dev-master"
"phpoffice/phpword": "v0.13.*"
}
}
```

Alternatively, you can download the latest release from the [releases page](https://github.com/PHPOffice/PHPWord/releases).
In this case, you will have to register the autoloader.

```php
require_once 'path/to/PhpWord/src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
```

## Getting started

The following is a basic usage example of the PHPWord library.

```php
<?php
require_once 'src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
require_once 'bootstrap.php';

// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
Expand Down
36 changes: 12 additions & 24 deletions tests/PhpWord/Tests/Shared/XMLWriterTest.php → bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,21 @@
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2014 PHPWord contributors
* @copyright 2010-2015 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/

namespace PhpOffice\PhpWord\Tests\Shared;

use PhpOffice\PhpWord\Settings;
use PhpOffice\PhpWord\Shared\XMLWriter;

/**
* Test class for PhpOffice\PhpWord\Shared\XMLWriter
*/
class XMLWriterTest extends \PHPUnit_Framework_TestCase
{
/**
* Test method exception
*
* @expectedException \BadMethodCallException
* @expectedExceptionMessage Method 'foo' does not exists.
*/
public function testCallException()
{
Settings::setCompatibility(false);
$object = new XMLWriter();
$object->foo();
}
$vendorDirPath = realpath(__DIR__ . '/vendor');
if (file_exists($vendorDirPath . '/autoload.php')) {
require $vendorDirPath . '/autoload.php';
} else {
throw new Exception(
sprintf(
'Could not find file \'%s\'. It is generated by Composer. Use \'install --prefer-source\' or \'update --prefer-source\' Composer commands to move forward.',
$vendorDirPath . '/autoload.php'
)
);
}
23 changes: 14 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,30 @@
],
"require": {
"php": ">=5.3.3",
"ext-xml": "*"
"ext-xml": "*",
"zendframework/zend-validator": "2.5.*",
"zendframework/zend-stdlib": "~2.5",
"phpoffice/common": "0.2.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpdocumentor/phpdocumentor":"2.*",
"squizlabs/php_codesniffer": "1.*",
"phpmd/phpmd": "2.*",
"sebastian/phpcpd": "2.*",
"phploc/phploc": "2.*",
"dompdf/dompdf":"0.6.*",
"tecnick.com/tcpdf": "6.*",
"mpdf/mpdf": "5.*"
"tecnickcom/tcpdf": "6.*",
"mpdf/mpdf": "5.*",
"zendframework/zend-validator": "2.5.*",
"zendframework/zend-stdlib": "~2.5",
"phpoffice/common": "0.2.*"
},
"suggest": {
"ext-zip": "Used to write DOCX and ODT",
"ext-gd2": "Used to add images",
"ext-xmlwriter": "Used to write DOCX and ODT",
"ext-xsl": "Used to apply XSL style sheet to main document part of OOXML template",
"dompdf/dompdf": "Used to write PDF"
"ext-zip": "Allows writing DOCX and ODT",
"ext-gd2": "Allows adding images",
"ext-xmlwriter": "Allows writing DOCX and ODT",
"ext-xsl": "Allows applying XSL style sheet to main document part of OOXML template",
"dompdf/dompdf": "Allows writing PDF"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 1 addition & 2 deletions docs/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
.. code-block:: php
<?php
require_once 'src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
require_once 'bootstrap.php';
// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
Expand Down
50 changes: 14 additions & 36 deletions docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,38 @@ Requirements
Mandatory:

- PHP 5.3+
- PHP `Zip <http://php.net/manual/en/book.zip.php>`__ extension
- PHP `XML Parser <http://www.php.net/manual/en/xml.installation.php>`__ extension
- `XML Parser <http://www.php.net/manual/en/xml.installation.php>`__ extension
- `Zend\\Validator <http://framework.zend.com/manual/current/en/modules/zend.validator.html>`__ component

Optional PHP extensions:
Optional:

- `GD <http://php.net/manual/en/book.image.php>`__
- `XMLWriter <http://php.net/manual/en/book.xmlwriter.php>`__
- `XSL <http://php.net/manual/en/book.xsl.php>`__
- `Zip <http://php.net/manual/en/book.zip.php>`__ extension
- `GD <http://php.net/manual/en/book.image.php>`__ extension
- `XMLWriter <http://php.net/manual/en/book.xmlwriter.php>`__ extension
- `XSL <http://php.net/manual/en/book.xsl.php>`__ extension
- `dompdf <https://github.com/dompdf/dompdf>`__ library

Installation
------------

There are two ways to install PHPWord, i.e. via
`Composer <http://getcomposer.org/>`__ or manually by downloading the
library.
PHPWord is installed via `Composer <https://getcomposer.org/>`__.
You just need to `add dependency <https://getcomposer.org/doc/04-schema.md#package-links>`__ on PHPWord into your package.

Using Composer
~~~~~~~~~~~~~~

To install via Composer, add the following lines to your
``composer.json``:
Example:

.. code-block:: json
{
"require": {
"phpoffice/phpword": "dev-master"
"phpoffice/phpword": "v0.13.*"
}
}
If you are a developer or if you want to help us with testing then fetch the latest branch for developers.
Notice: all contributions must be done against the developer branch.

Example:

.. code-block:: json
{
Expand All @@ -51,27 +50,6 @@ Notice: all contributions must be done against the developer branch.
}
Manual install
~~~~~~~~~~~~~~

To install manually, you change to the web-server directory of your file system. Then you have 2 possibilities.

1. `download PHPWord package from github <https://github.com/PHPOffice/PHPWord/archive/master.zip>`__.
Extract the package and put the contents to your machine.
2. Alternatively you can use Git to install it:
.. code-block:: console
git clone https://github.com/PHPOffice/PHPWord.git
To use the library, include ``src/PhpWord/Autoloader.php`` in your PHP script and
invoke ``Autoloader::register``.

.. code-block:: php
require_once '/path/to/src/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
Using samples
-------------

Expand Down
3 changes: 0 additions & 3 deletions samples/Sample_Footer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<?php
/**
* Footer file
*/
if (CLI) {
return;
}
Expand Down
10 changes: 2 additions & 8 deletions samples/Sample_Header.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<?php
require_once __DIR__ . '/../src/PhpWord/Autoloader.php';
require_once __DIR__ . '/../bootstrap.php';

date_default_timezone_set('UTC');

/**
* Header file
*/
use PhpOffice\PhpWord\Autoloader;
use PhpOffice\PhpWord\Settings;

date_default_timezone_set('UTC');
error_reporting(E_ALL);
define('CLI', (PHP_SAPI == 'cli') ? true : false);
define('EOL', CLI ? PHP_EOL : '<br />');
define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php'));
define('IS_INDEX', SCRIPT_FILENAME == 'index');

Autoloader::register();
Settings::loadConfig();

// Set writers
Expand Down
58 changes: 0 additions & 58 deletions src/PhpWord/Autoloader.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/PhpWord/Collection/AbstractCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2014 PHPWord contributors
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @copyright 2010-2015 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/

namespace PhpOffice\PhpWord\Collection;
Expand Down
Loading

0 comments on commit 2944c21

Please sign in to comment.