Skip to content

Commit

Permalink
Merge pull request #689 from PHPOffice/develop
Browse files Browse the repository at this point in the history
Release 1.0.0 (Fixed samples)
  • Loading branch information
Progi1984 authored Nov 25, 2021
2 parents 680370d + 6784cb4 commit 732d029
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 13 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,26 @@ jobs:
wget https:/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
chmod +x php-coveralls.phar
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv
samples:
name: Check samples
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gd, xml, zip
coverage: xdebug

- uses: actions/checkout@v2

- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Generate samples files
run: composer run samples
26 changes: 26 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,31 @@
"psr-4": {
"PhpOffice\\PhpPresentation\\": "src/PhpPresentation/"
}
},
"scripts": {
"samples": [
"php samples/Sample_01_Complex.php",
"php samples/Sample_01_Simple.php",
"php samples/Sample_03_Image.php",
"php samples/Sample_03_Video.php",
"php samples/Sample_04_Table.php",
"php samples/Sample_05_Chart_Line.php",
"php samples/Sample_05_Chart.php",
"php samples/Sample_05_Chart_with_PhpSpreadsheet.php",
"php samples/Sample_06_Fill.php",
"php samples/Sample_07_Border.php",
"php samples/Sample_08_Group.php",
"php samples/Sample_09_SlideNote.php",
"php samples/Sample_10_Transition.php",
"php samples/Sample_11_Shape.php",
"php samples/Sample_13_MarkAsFinal.php",
"php samples/Sample_14_Zoom.php",
"php samples/Sample_15_Background.php",
"php samples/Sample_16_Thumbnail.php",
"php samples/Sample_17_Comment.php",
"php samples/Sample_18_Animation.php",
"php samples/Sample_19_SlideMaster.php",
"php samples/Sample_20_ExternalSlide.php"
]
}
}
5 changes: 4 additions & 1 deletion samples/Sample_03_Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
$shape = new Media();
$shape->setName('Video')
->setDescription('Video')
->setPath('WIN' === strtoupper(substr(PHP_OS, 0, 3)) ? './resources/sintel_trailer-480p.wmv' : './resources/sintel_trailer-480p.ogv')
->setPath(
__DIR__ . '/resources/sintel_trailer-480p' .
('WIN' === strtoupper(substr(PHP_OS, 0, 3)) ? '.wmv' : '.ogv')
)
->setResizeProportional(false)
->setHeight(90)
->setWidth(90)
Expand Down
2 changes: 1 addition & 1 deletion samples/Sample_08_Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
$shape = $currentGroup->createDrawingShape();
$shape->setName('PHPPresentation logo')
->setDescription('PHPPresentation logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
Expand Down
2 changes: 1 addition & 1 deletion samples/Sample_09_SlideNote.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPresentation logo')
->setDescription('PHPPresentation logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
Expand Down
2 changes: 1 addition & 1 deletion samples/Sample_10_Transition.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$shapeDrawing = $slide0->createDrawingShape();
$shapeDrawing->setName('PHPPresentation logo')
->setDescription('PHPPresentation logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
Expand Down
2 changes: 1 addition & 1 deletion samples/Sample_15_Background.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @link : http://publicdomainarchive.com/public-domain-images-cave-red-rocks-light-beam-cavern/
*/
$oBkgImage = new Image();
$oBkgImage->setPath('./resources/background.jpg');
$oBkgImage->setPath(__DIR__ . '/resources/background.jpg');
$oSlide2->setBackground($oBkgImage);

// Save file
Expand Down
2 changes: 1 addition & 1 deletion samples/Sample_19_SlideMaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
$shape = $currentSlide->createDrawingShape();
$shape->setName('PHPPresentation logo')
->setDescription('PHPPresentation logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
Expand Down
12 changes: 6 additions & 6 deletions samples/Sample_Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@
// Set writers
$writers = ['PowerPoint2007' => 'pptx', 'ODPresentation' => 'odp'];

// Return to the caller script when runs by CLI
if (CLI) {
return;
}

// Set titles and names
$pageHeading = str_replace('_', ' ', SCRIPT_FILENAME);
$pageTitle = IS_INDEX ? 'Welcome to ' : "{$pageHeading} - ";
Expand All @@ -59,7 +54,7 @@
$oShapeDrawing = new Drawing\File();
$oShapeDrawing->setName('PHPPresentation logo')
->setDescription('PHPPresentation logo')
->setPath('./resources/phppowerpoint_logo.gif')
->setPath(__DIR__ . '/resources/phppowerpoint_logo.gif')
->setHeight(36)
->setOffsetX(10)
->setOffsetY(10);
Expand All @@ -80,6 +75,11 @@
->setSize(60)
->setColor(new Color('FFE06B20'));

// Return to the caller script when runs by CLI
if (CLI) {
return;
}

// Populate samples
$files = [];
if ($handle = opendir('.')) {
Expand Down
Empty file added samples/results/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion src/PhpPresentation/Writer/ODPresentation/ObjectsChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ protected function writeTable(): void
$this->xmlContent->writeAttributeIf($cellValueTypeFloat, 'office:value', is_null($cell) ? 'NaN' : $cell);
// text:p
$this->xmlContent->startElement('text:p');
$this->xmlContent->text(is_null($cell) ? 'NaN' : $cell);
$this->xmlContent->text(is_null($cell) ? 'NaN' : (string) $cell);
$this->xmlContent->endElement();
// > table:table-cell
$this->xmlContent->endElement();
Expand Down

0 comments on commit 732d029

Please sign in to comment.