Merge branch 'develop' of github.com:jgpATs2w/PHPWord into develop
This commit is contained in:
commit
2593e9e200
|
|
@ -0,0 +1,21 @@
|
|||
# build config
|
||||
/.scrutinizer.yml export-ignore
|
||||
/.travis.yml export-ignore
|
||||
/php_cs.dist export-ignore
|
||||
/phpmd.xml.dist export-ignore
|
||||
/phpstan.neon export-ignore
|
||||
|
||||
/composer.lock export-ignore
|
||||
|
||||
# git files
|
||||
/.gitignore export-ignore
|
||||
/.gitattributes export-ignore
|
||||
|
||||
# project directories
|
||||
/build export-ignore
|
||||
/docs export-ignore
|
||||
/samples export-ignore
|
||||
|
||||
# tests
|
||||
/phpunit.xml.dist export-ignore
|
||||
/tests export-ignore
|
||||
|
|
@ -37,7 +37,7 @@ before_script:
|
|||
- composer self-update
|
||||
- travis_wait composer install --prefer-source
|
||||
## PHPDocumentor
|
||||
- mkdir -p build/docs
|
||||
##- mkdir -p build/docs
|
||||
- mkdir -p build/coverage
|
||||
|
||||
script:
|
||||
|
|
@ -52,7 +52,7 @@ script:
|
|||
## PHPLOC
|
||||
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phploc src/ ; fi
|
||||
## PHPDocumentor
|
||||
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
|
||||
##- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" ; fi
|
||||
|
||||
after_success:
|
||||
## Coveralls
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ v0.15.0 (?? ??? 2018)
|
|||
- Add support for table indent (tblInd) @Trainmaster #1343
|
||||
- Added parsing of internal links in HTML reader @lalop #1336
|
||||
- Several improvements to charts @JAEK-S #1332
|
||||
- Add parsing of html image in base64 format @jgpATs2w #1382
|
||||
|
||||
### Fixed
|
||||
- Fix reading of docx default style - @troosan #1238
|
||||
|
|
|
|||
|
|
@ -65,14 +65,13 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.36 || ^5.0",
|
||||
"phpdocumentor/phpdocumentor":"2.*",
|
||||
"squizlabs/php_codesniffer": "^2.7",
|
||||
"friendsofphp/php-cs-fixer": "^2.0",
|
||||
"squizlabs/php_codesniffer": "^2.9",
|
||||
"friendsofphp/php-cs-fixer": "^2.2",
|
||||
"phpmd/phpmd": "2.*",
|
||||
"phploc/phploc": "2.* || 3.* || 4.*",
|
||||
"dompdf/dompdf":"0.8.*",
|
||||
"tecnickcom/tcpdf": "6.*",
|
||||
"mpdf/mpdf": "5.* || 6.* || 7.*",
|
||||
"mpdf/mpdf": "5.7.4 || 6.* || 7.*",
|
||||
"php-coveralls/php-coveralls": "1.1.0 || ^2.0"
|
||||
},
|
||||
"suggest": {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ $templateProcessor->setValue('userPhone#3', '+1 428 889 775');
|
|||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||
$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx');
|
||||
|
||||
echo getEndingNotes(array('Word2007' => 'docx'));
|
||||
echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_07_TemplateCloneRow.docx');
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ $templateProcessor->deleteBlock('DELETEME');
|
|||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');
|
||||
|
||||
echo getEndingNotes(array('Word2007' => 'docx'));
|
||||
echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_23_TemplateBlock.docx');
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ abstract class AbstractElement
|
|||
*
|
||||
* @param \PhpOffice\PhpWord\Element\AbstractElement $container
|
||||
*/
|
||||
public function setParentContainer(AbstractElement $container)
|
||||
public function setParentContainer(self $container)
|
||||
{
|
||||
$this->parentContainer = substr(get_class($container), strrpos(get_class($container), '\\') + 1);
|
||||
$this->parent = $container;
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ use PhpOffice\PhpWord\Exception\Exception;
|
|||
* @method int addChart(Element\Chart $chart)
|
||||
* @method int addComment(Element\Comment $comment)
|
||||
*
|
||||
* @method Style\Paragraph addParagraphStyle(string $styleName, array $styles)
|
||||
* @method Style\Paragraph addParagraphStyle(string $styleName, mixed $styles)
|
||||
* @method Style\Font addFontStyle(string $styleName, mixed $fontStyle, mixed $paragraphStyle = null)
|
||||
* @method Style\Font addLinkStyle(string $styleName, mixed $styles)
|
||||
* @method Style\Font addTitleStyle(int $depth, mixed $fontStyle, mixed $paragraphStyle = null)
|
||||
* @method Style\Font addTitleStyle(mixed $depth, mixed $fontStyle, mixed $paragraphStyle = null)
|
||||
* @method Style\Table addTableStyle(string $styleName, mixed $styleTable, mixed $styleFirstRow = null)
|
||||
* @method Style\Numbering addNumberingStyle(string $styleName, mixed $styles)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -666,8 +666,10 @@ class Html
|
|||
|
||||
$ifp = fopen($imgFile, 'wb');
|
||||
|
||||
fwrite($ifp, base64_decode($match[2]));
|
||||
fclose($ifp);
|
||||
if ($ifp !== false) {
|
||||
fwrite($ifp, base64_decode($match[2]));
|
||||
fclose($ifp);
|
||||
}
|
||||
}
|
||||
$src = urldecode($src);
|
||||
|
||||
|
|
@ -687,8 +689,10 @@ class Html
|
|||
|
||||
$ifp = fopen($src, 'wb');
|
||||
|
||||
fwrite($ifp, $imgBlob);
|
||||
fclose($ifp);
|
||||
if ($ifp !== false) {
|
||||
fwrite($ifp, $imgBlob);
|
||||
fclose($ifp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Style
|
|||
* Add paragraph style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $styles
|
||||
* @param array|\PhpOffice\PhpWord\Style\AbstractStyle $styles
|
||||
* @return \PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public static function addParagraphStyle($styleName, $styles)
|
||||
|
|
@ -51,8 +51,8 @@ class Style
|
|||
* Add font style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $fontStyle
|
||||
* @param array $paragraphStyle
|
||||
* @param array|\PhpOffice\PhpWord\Style\AbstractStyle $fontStyle
|
||||
* @param array|\PhpOffice\PhpWord\Style\AbstractStyle $paragraphStyle
|
||||
* @return \PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public static function addFontStyle($styleName, $fontStyle, $paragraphStyle = null)
|
||||
|
|
@ -64,7 +64,7 @@ class Style
|
|||
* Add link style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $styles
|
||||
* @param array|\PhpOffice\PhpWord\Style\AbstractStyle $styles
|
||||
* @return \PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public static function addLinkStyle($styleName, $styles)
|
||||
|
|
@ -76,7 +76,7 @@ class Style
|
|||
* Add numbering style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $styleValues
|
||||
* @param array|\PhpOffice\PhpWord\Style\AbstractStyle $styleValues
|
||||
* @return \PhpOffice\PhpWord\Style\Numbering
|
||||
* @since 0.10.0
|
||||
*/
|
||||
|
|
@ -88,14 +88,14 @@ class Style
|
|||
/**
|
||||
* Add title style
|
||||
*
|
||||
* @param int $depth
|
||||
* @param array $fontStyle
|
||||
* @param array $paragraphStyle
|
||||
* @param int|null $depth Provide null to set title font
|
||||
* @param array|\PhpOffice\PhpWord\Style\AbstractStyle $fontStyle
|
||||
* @param array|\PhpOffice\PhpWord\Style\AbstractStyle $paragraphStyle
|
||||
* @return \PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public static function addTitleStyle($depth, $fontStyle, $paragraphStyle = null)
|
||||
{
|
||||
if ($depth == null) {
|
||||
if (empty($depth)) {
|
||||
$styleName = 'Title';
|
||||
} else {
|
||||
$styleName = "Heading_{$depth}";
|
||||
|
|
@ -141,7 +141,7 @@ class Style
|
|||
/**
|
||||
* Set default paragraph style
|
||||
*
|
||||
* @param array $styles Paragraph style definition
|
||||
* @param array|\PhpOffice\PhpWord\Style\AbstractStyle $styles Paragraph style definition
|
||||
* @return \PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public static function setDefaultParagraphStyle($styles)
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ class Font extends AbstractStyle
|
|||
* Create new font style
|
||||
*
|
||||
* @param string $type Type of font
|
||||
* @param array $paragraph Paragraph styles definition
|
||||
* @param array|string|\PhpOffice\PhpWord\Style\AbstractStyle $paragraph Paragraph styles definition
|
||||
*/
|
||||
public function __construct($type = 'text', $paragraph = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -526,11 +526,12 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
/**
|
||||
* Test parsing of remote img that can be found locally
|
||||
*
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testCouldNotLoadImage()
|
||||
{
|
||||
$src = 'https://fakedomain.io/images/firefox.png';
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
|
|
|
|||
Loading…
Reference in New Issue