Skip to content

Commit cec16ce

Browse files
committed
Merge branch 'develop' into fancy-samples
2 parents 9922f8e + fca9e53 commit cec16ce

Some content is hidden

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

70 files changed

+1351
-201
lines changed

Classes/PHPWord.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ public function setDefaultParagraphStyle($styles)
188188
/**
189189
* Adds a paragraph style definition to styles.xml
190190
*
191-
* @param $styleName string
192-
* @param $styles array
191+
* @param string $styleName
192+
* @param array $styles
193193
*/
194194
public function addParagraphStyle($styleName, $styles)
195195
{
@@ -199,8 +199,9 @@ public function addParagraphStyle($styleName, $styles)
199199
/**
200200
* Adds a font style definition to styles.xml
201201
*
202-
* @param $styleName string
203-
* @param $styles array
202+
* @param string $styleName
203+
* @param array $styleFont
204+
* @param array $styleParagraph
204205
*/
205206
public function addFontStyle($styleName, $styleFont, $styleParagraph = null)
206207
{
@@ -210,8 +211,9 @@ public function addFontStyle($styleName, $styleFont, $styleParagraph = null)
210211
/**
211212
* Adds a table style definition to styles.xml
212213
*
213-
* @param $styleName string
214-
* @param $styles array
214+
* @param string $styleName
215+
* @param array $styleTable
216+
* @param array $styleFirstRow
215217
*/
216218
public function addTableStyle($styleName, $styleTable, $styleFirstRow = null)
217219
{
@@ -221,8 +223,9 @@ public function addTableStyle($styleName, $styleTable, $styleFirstRow = null)
221223
/**
222224
* Adds a heading style definition to styles.xml
223225
*
224-
* @param $titleCount int
225-
* @param $styles array
226+
* @param int $titleCount
227+
* @param array $styleFont
228+
* @param array $styleParagraph
226229
*/
227230
public function addTitleStyle($titleCount, $styleFont, $styleParagraph = null)
228231
{
@@ -232,8 +235,8 @@ public function addTitleStyle($titleCount, $styleFont, $styleParagraph = null)
232235
/**
233236
* Adds a hyperlink style to styles.xml
234237
*
235-
* @param $styleName string
236-
* @param $styles array
238+
* @param string $styleName
239+
* @param array $styles
237240
*/
238241
public function addLinkStyle($styleName, $styles)
239242
{

Classes/PHPWord/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static function load($strObjectName)
6969
/**
7070
* Autoloader
7171
*
72-
* @param string
72+
* @param string $class
7373
*/
7474
public static function autoload($class)
7575
{

Classes/PHPWord/Exceptions/Exception.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
<?php
2+
/**
3+
* PHPWord
4+
*
5+
* Copyright (c) 2014 PHPWord
6+
*
7+
* This library is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* @category PHPWord
22+
* @package PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
24+
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25+
* @version 0.8.0
26+
*/
227
namespace PhpOffice\PhpWord\Exceptions;
328

429
/**

Classes/PHPWord/Exceptions/InvalidImageException.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
<?php
2+
/**
3+
* PHPWord
4+
*
5+
* Copyright (c) 2014 PHPWord
6+
*
7+
* This library is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* @category PHPWord
22+
* @package PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
24+
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25+
* @version 0.8.0
26+
*/
227
namespace PhpOffice\PhpWord\Exceptions;
328

429
/**

Classes/PHPWord/Exceptions/InvalidStyleException.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
<?php
2+
/**
3+
* PHPWord
4+
*
5+
* Copyright (c) 2014 PHPWord
6+
*
7+
* This library is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* @category PHPWord
22+
* @package PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
24+
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25+
* @version 0.8.0
26+
*/
227
namespace PhpOffice\PhpWord\Exceptions;
328

429
use InvalidArgumentException;

Classes/PHPWord/Exceptions/UnsupportedImageTypeException.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
<?php
2+
/**
3+
* PHPWord
4+
*
5+
* Copyright (c) 2014 PHPWord
6+
*
7+
* This library is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* @category PHPWord
22+
* @package PHPWord
23+
* @copyright Copyright (c) 2014 PHPWord
24+
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25+
* @version 0.8.0
26+
*/
227
namespace PhpOffice\PhpWord\Exceptions;
328

429
/**

Classes/PHPWord/Footnote.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ public static function countFootnoteElements()
8686
/**
8787
* Add new Footnote Link Element
8888
*
89-
* @param string $src
90-
* @param string $type
89+
* @param string $linkSrc
9190
*
9291
* @return mixed
9392
*/

Classes/PHPWord/Media.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,13 @@ public static function addSectionMediaElement($src, $type, PHPWord_Section_Memor
9494
if (!$isMemImage) {
9595
$isMemImage = (filter_var($src, FILTER_VALIDATE_URL) !== false);
9696
}
97-
$extension = '';
9897
if ($isMemImage) {
9998
$extension = $memoryImage->getImageExtension();
10099
$media['isMemImage'] = true;
101100
$media['createfunction'] = $memoryImage->getImageCreateFunction();
102101
$media['imagefunction'] = $memoryImage->getImageFunction();
103102
} else {
104-
$imageType = exif_imagetype($src);
105-
if ($imageType === IMAGETYPE_JPEG) {
106-
$extension = 'jpg';
107-
} elseif ($imageType === IMAGETYPE_GIF) {
108-
$extension = 'gif';
109-
} elseif ($imageType === IMAGETYPE_PNG) {
110-
$extension = 'png';
111-
} elseif ($imageType === IMAGETYPE_BMP) {
112-
$extension = 'bmp';
113-
} elseif ($imageType === IMAGETYPE_TIFF_II || $imageType === IMAGETYPE_TIFF_MM) {
114-
$extension = 'tif';
115-
}
103+
$extension = PHPWord_Shared_File::imagetype($src);
116104
}
117105

118106
$folder = 'media';

Classes/PHPWord/Reader/Abstract.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ abstract class PHPWord_Reader_Abstract implements PHPWord_Reader_IReader
4242
protected $readDataOnly = true;
4343

4444
/**
45+
* File pointer
46+
*
4547
* @var bool|resource
4648
*/
4749
protected $fileHandle = true;

Classes/PHPWord/Section/Footer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class PHPWord_Section_Footer
5454

5555
/**
5656
* Create a new Footer
57+
*
58+
* @param int $sectionCount
5759
*/
5860
public function __construct($sectionCount)
5961
{
@@ -95,6 +97,7 @@ public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = nu
9597
/**
9698
* Create a new TextRun
9799
*
100+
* @param null|string|array|PHPWord_Style_Paragraph $styleParagraph
98101
* @return PHPWord_Section_TextRun
99102
*/
100103
public function createTextRun($styleParagraph = null)

Classes/PHPWord/Section/Footer/PreserveText.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ class PHPWord_Section_Footer_PreserveText
5656
/**
5757
* Create a new Preserve Text Element
5858
*
59-
* @var string $text
60-
* @var mixed $style
59+
* @param string $text
60+
* @param mixed $styleFont
61+
* @param mixed $styleParagraph
62+
* @return PHPWord_Section_Footer_PreserveText
6163
*/
6264
public function __construct($text = null, $styleFont = null, $styleParagraph = null)
6365
{

Classes/PHPWord/Section/Footnote.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class PHPWord_Section_Footnote
5454

5555
/**
5656
* Create a new Footnote Element
57+
*
58+
* @param mixed $styleParagraph
5759
*/
5860
public function __construct($styleParagraph = null)
5961
{
@@ -78,8 +80,8 @@ public function __construct($styleParagraph = null)
7880
/**
7981
* Add a Text Element
8082
*
81-
* @var string $text
82-
* @var mixed $styleFont
83+
* @param null|string $text
84+
* @param mixed $styleFont
8385
* @return PHPWord_Section_Text
8486
*/
8587
public function addText($text = null, $styleFont = null)

Classes/PHPWord/Section/Header.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ class PHPWord_Section_Header
8383

8484
/**
8585
* Create a new Header
86+
*
87+
* @param int $sectionCount
8688
*/
8789
public function __construct($sectionCount)
8890
{
@@ -124,6 +126,7 @@ public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = nu
124126
/**
125127
* Create a new TextRun
126128
*
129+
* @param mixed $styleParagraph
127130
* @return PHPWord_Section_TextRun
128131
*/
129132
public function createTextRun($styleParagraph = null)

Classes/PHPWord/Section/Image.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class PHPWord_Section_Image
6161
*/
6262
private $_isWatermark;
6363

64-
6564
/**
6665
* Create a new Image
6766
*
@@ -72,13 +71,11 @@ class PHPWord_Section_Image
7271
*/
7372
public function __construct($src, $style = null, $isWatermark = false)
7473
{
75-
$supportedImageTypes = array(IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM);
76-
7774
if (!file_exists($src)) {
7875
throw new InvalidImageException;
7976
}
8077

81-
if (!in_array(exif_imagetype($src), $supportedImageTypes)) {
78+
if (!PHPWord_Shared_File::imagetype($src)) {
8279
throw new UnsupportedImageTypeException;
8380
}
8481

Classes/PHPWord/Section/Link.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ class PHPWord_Section_Link
7070
/**
7171
* Create a new Link Element
7272
*
73-
* @var string $linkSrc
74-
* @var string $linkName
75-
* @var mixed $styleFont
76-
* @var mixed $styleParagraph
73+
* @param string $linkSrc
74+
* @param string $linkName
75+
* @param mixed $styleFont
76+
* @param mixed $styleParagraph
7777
*/
7878
public function __construct($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null)
7979
{

Classes/PHPWord/Section/ListItem.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ class PHPWord_Section_ListItem
5858
*
5959
* @param string $text
6060
* @param int $depth
61-
* @param mixed $styleText
61+
* @param mixed $styleFont
6262
* @param mixed $styleList
63+
* @param mixed $styleParagraph
6364
*/
6465
public function __construct($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null)
6566
{

Classes/PHPWord/Section/Settings.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,15 @@ class PHPWord_Section_Settings
158158
private $pageNumberingStart;
159159

160160
/**
161+
* Header height
162+
*
161163
* @var int
162164
*/
163165
private $headerHeight;
164166

165167
/**
168+
* Footer height
169+
*
166170
* @var int
167171
*/
168172
private $footerHeight;
@@ -594,6 +598,8 @@ public function getBorderBottomColor()
594598
}
595599

596600
/**
601+
* Set page numbering start
602+
*
597603
* @param null|int $pageNumberingStart
598604
* @return $this
599605
*/
@@ -604,6 +610,8 @@ public function setPageNumberingStart($pageNumberingStart = null)
604610
}
605611

606612
/**
613+
* Get page numbering start
614+
*
607615
* @return null|int
608616
*/
609617
public function getPageNumberingStart()

Classes/PHPWord/Section/Table.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public function __construct($insideOf, $pCount, $style = null)
9999
* Add a row
100100
*
101101
* @param int $height
102+
* @param mixed $style
102103
*/
103104
public function addRow($height = null, $style = null)
104105
{
@@ -144,7 +145,7 @@ public function getStyle()
144145
/**
145146
* Set table width
146147
*
147-
* @var int $width
148+
* @param int $width
148149
*/
149150
public function setWidth($width)
150151
{

0 commit comments

Comments
 (0)