Skip to content

Commit d3f6256

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/develop' into develop
Conflicts: Classes/PHPWord/Section/Settings.php Classes/PHPWord/Section/TextRun.php Classes/PHPWord/Writer/Word2007/Base.php README.md
2 parents ab2b2de + 1f4a18d commit d3f6256

Some content is hidden

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

83 files changed

+822
-374
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: php
22
php:
3-
- 5.3.3
43
- 5.3
54
- 5.4
65
- 5.5
@@ -13,7 +12,7 @@ matrix:
1312
before_script:
1413
## Composer
1514
- curl -s http://getcomposer.org/installer | php
16-
- php composer.phar install
15+
- php composer.phar install --prefer-source
1716
## PHP_CodeSniffer
1817
- pyrus install pear/PHP_CodeSniffer
1918
- phpenv rehash
@@ -36,9 +35,11 @@ script:
3635
## PHP Copy/Paste Detector
3736
- php phpcpd.phar --verbose Classes/
3837
## PHP Mess Detector
39-
- phpmd Classes/ text codesize,unusedcode,naming,design
38+
- phpmd Classes/ text unusedcode,naming,design
4039
## PHPLOC
4140
- php phploc.phar Classes/
41+
## PHPUnit
42+
- phpunit -c ./ --coverage-text
4243

4344
notifications:
4445
email:

Classes/PHPWord.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* PHPWord
44
*
5-
* Copyright (c) 2013 PHPWord
5+
* Copyright (c) 2014 PHPWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
2424
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/

Classes/PHPWord/Autoloader.php

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* PHPWord
44
*
5-
* Copyright (c) 2013 PHPWord
5+
* Copyright (c) 2014 PHPWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
2424
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/
@@ -31,17 +31,22 @@
3131

3232
/**
3333
* Class PHPWord_Autoloader
34+
*
35+
* TODO: remove legacy autoloader once everything is moved to namespaces
3436
*/
3537
class PHPWord_Autoloader
3638
{
39+
const PREFIX = 'PHPWord';
40+
3741
/**
3842
* Register the autoloader
3943
*
4044
* @return void
4145
*/
4246
public static function register()
4347
{
44-
spl_autoload_register(array('PHPWord_Autoloader', 'load'));
48+
spl_autoload_register(array('PHPWord_Autoloader', 'load')); // Legacy
49+
spl_autoload_register(array(new self, 'autoload')); // PSR-4
4550
}
4651

4752
/**
@@ -60,4 +65,21 @@ public static function load($strObjectName)
6065

6166
return null;
6267
}
68+
69+
/**
70+
* Autoloader
71+
*
72+
* @param string
73+
*/
74+
public static function autoload($class)
75+
{
76+
$prefixLength = strlen(self::PREFIX);
77+
if (0 === strncmp(self::PREFIX, $class, $prefixLength)) {
78+
$file = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, $prefixLength));
79+
$file = realpath(__DIR__ . (empty($file) ? '' : DIRECTORY_SEPARATOR) . $file . '.php');
80+
if (file_exists($file)) {
81+
require_once $file;
82+
}
83+
}
84+
}
6385
}

Classes/PHPWord/DocumentProperties.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* PHPWord
44
*
5-
* Copyright (c) 2013 PHPWord
5+
* Copyright (c) 2014 PHPWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
2424
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/

Classes/PHPWord/Exception.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
24-
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23+
* @copyright Copyright (c) 2014 PHPWord
24+
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/
2727

Classes/PHPWord/HashTable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* PHPWord
44
*
5-
* Copyright (c) 2013 PHPWord
5+
* Copyright (c) 2014 PHPWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,8 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
24-
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23+
* @copyright Copyright (c) 2014 PHPWord
24+
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/
2727

Classes/PHPWord/IOFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* PHPWord
44
*
5-
* Copyright (c) 2013 PHPWord
5+
* Copyright (c) 2014 PHPWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
2424
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/

Classes/PHPWord/Media.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* PHPWord
44
*
5-
* Copyright (c) 2013 PHPWord
5+
* Copyright (c) 2014 PHPWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
2424
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/

Classes/PHPWord/Section.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* PHPWord
44
*
5-
* Copyright (c) 2013 PHPWord
5+
* Copyright (c) 2014 PHPWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
2424
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/

Classes/PHPWord/Section/Footer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* PHPWord
44
*
5-
* Copyright (c) 2013 PHPWord
5+
* Copyright (c) 2014 PHPWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
2020
*
2121
* @category PHPWord
2222
* @package PHPWord
23-
* @copyright Copyright (c) 2013 PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
2424
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2525
* @version 0.7.0
2626
*/

0 commit comments

Comments
 (0)