Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feat-axis-options
Browse files Browse the repository at this point in the history
  • Loading branch information
mindline-analytics committed Nov 27, 2021
2 parents 7f17f8e + 47046dd commit e1c938c
Show file tree
Hide file tree
Showing 120 changed files with 1,474 additions and 1,160 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0'] #, '8.1'
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -68,7 +68,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0'] #, '8.1'
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -93,3 +93,26 @@ jobs:
wget https://github.com/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
30 changes: 28 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"php": "^7.1|^8.0",
"ext-xml": "*",
"ext-zip": "*",
"phpoffice/common": "dev-develop",
"phpoffice/common": "^1",
"phpoffice/phpspreadsheet": "^1.9.0"
},
"require-dev": {
"phpunit/phpunit": ">=7.0",
"phpmd/phpmd": "2.*",
"phpstan/phpstan": "^0.12.88"
"phpstan/phpstan": "^0.12.88 || ^1.0.0"
},
"suggest": {
"ext-gd": "Required to add images"
Expand All @@ -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"
]
}
}
9 changes: 5 additions & 4 deletions docs/changes/1.0.0.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# 1.0.0 - WIP
# 1.0.0

## Bugfix
- PowerPoint2007 Writer : Text is subscripted when set superscript to false - [[@qmachard]](https://github.com/qmachard])(https://github.com/qmachard) GH-360
- Core : Defining width & height of a shape don't return any error if width & height were equal to 0 - [[@surger]](https://github.com/surger])(https://github.com/surger) GH-555
- ODPresentation Writer : Display axis title depending the visibility - [[@Progi1984]](https://github.com/Progi1984])(https://github.com/Progi1984) GH-410
- PowerPoint2007 Writer : Text is subscripted when set superscript to false - [@qmachard](https://github.com/qmachard) GH-360
- Core : Defining width & height of a shape don't return any error if width & height were equal to 0 - [@surger](https://github.com/surger) GH-555
- ODPresentation Writer : Display axis title depending the visibility - [@Progi1984](https://github.com/Progi1984) GH-410

## Changes
- Dropped support for HHVM - [@sunspikes](https://github.com/sunspikes) GH-556
- PHP 7.1 is now supported - [@Progi1984](https://github.com/Progi1984) GH-355
- Added support PHP 7.4 to 8.0 & Removed support PHP < 7.1 - [@Progi1984](https://github.com/Progi1984) GH-636
- Added support for PHP 8.1 - [@Progi1984](https://github.com/Progi1984) GH-661
- Removed deprecated methods/classes - [@Progi1984](https://github.com/Progi1984) GH-650
- Migrated use of PHPExcel to PhpSpreadsheet - [@Progi1984](https://github.com/Progi1984) GH-652
- PhpOffice\PhpPresentation\Style\Color : Define only the transparency - [@Progi1984](https://github.com/Progi1984) GH-370
Expand Down
7 changes: 7 additions & 0 deletions docs/changes/1.1.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 1.0.0 - WIP

## Features

- Support for Hyperlink Text Color - [@MartynasJanu](https://github.com/MartynasJanu) & [@Progi1984](https://github.com/Progi1984) GH-682
- PowerPoint2007 Reader
- PowerPoint2007 Writer
36 changes: 36 additions & 0 deletions docs/usage/shapes/richtext.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,42 @@ $richText->setColumnSpacing(200);
$columnSpacing = $richText->getColumnSpacing();
```

## Hyperlink

For a rich text, you can define the hyperlink.

Example:

```php
<?php

use PhpOffice\PhpPresentation\Shape\RichText;

$richText = new RichText();
$richText->getHyperlink()->setUrl('https://phpoffice.github.io/PHPPresentation/');

```

### Use of Text Color

!!! warning
Available only on the PowerPoint2007 Reader/Writer

Hyperlinks can be set to use the text color instead of the default theme color.

Example:

```php
<?php

use PhpOffice\PhpPresentation\Shape\RichText;

$richText = new RichText();
$richText->getHyperlink()->setUrl('https://phpoffice.github.io/PHPPresentation/');
$richText->getHyperlink()->setIsTextColorUsed(true);

```

## Paragraph
### Bullet

Expand Down
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ nav:
- FAQ: 'faq.md'
- Credits: 'credits.md'
- Releases:
- '1.0.0 (WIP)': 'changes/1.0.0.md'
- '1.1.0 (WIP)': 'changes/1.1.0.md'
- '1.0.0': 'changes/1.0.0.md'
- '0.9.0': 'changes/0.9.0.md'
- '0.8.0': 'changes/0.8.0.md'
- '0.7.0': 'changes/0.7.0.md'
Expand Down
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_13_MarkAsFinal.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$objPHPPresentation = new PhpPresentation();

// Mark the document as final
$objPHPPresentation->markAsFinal(true);
$objPHPPresentation->getPresentationProperties()->markAsFinal(true);

// Create slide
echo date('H:i:s') . ' Create slide' . EOL;
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
25 changes: 15 additions & 10 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 All @@ -88,12 +88,17 @@
$name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file));
$group = substr($name, 0, 1);
if (!isset($files[$group])) {
$files[$group] = '';
$files[$group] = [];
}
$files[$group] .= "<li><a href='{$file}'>{$name}</a></li>";
$files[$group][$name] = "<li><a href='{$file}'>{$name}</a></li>";
}
}
closedir($handle);

foreach ($files as $group => $a) {
natsort($files[$group]);
}
ksort($files);
}

/**
Expand Down Expand Up @@ -497,10 +502,10 @@ protected function getConstantName($class, $search, $startWith = '')
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<?php foreach ($files as $key => $fileStr) { ?>
<?php foreach ($files as $key => $groupfiles) { ?>
<li class="dropdown active">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-code fa-lg"></i>&nbsp;Samples <?php echo $key; ?>x<strong class="caret"></strong></a>
<ul class="dropdown-menu"><?php echo $fileStr; ?></ul>
<ul class="dropdown-menu"><?php echo implode('', $groupfiles); ?></ul>
</li>
<?php } ?>
</ul>
Expand Down
Empty file added samples/results/.gitkeep
Empty file.
15 changes: 5 additions & 10 deletions src/PhpPresentation/AbstractShape.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

namespace PhpOffice\PhpPresentation;

use PhpOffice\PhpPresentation\Exception\ShapeContainerAlreadyAssignedException;
use PhpOffice\PhpPresentation\Shape\Hyperlink;
use PhpOffice\PhpPresentation\Shape\Placeholder;
use PhpOffice\PhpPresentation\Style\Border;
Expand Down Expand Up @@ -146,7 +147,7 @@ public function getContainer(): ?ShapeContainerInterface
* @param ShapeContainerInterface $pValue
* @param bool $pOverrideOld If a Slide has already been assigned, overwrite it and remove image from old Slide?
*
* @throws \Exception
* @throws ShapeContainerAlreadyAssignedException
*
* @return $this
*/
Expand Down Expand Up @@ -175,7 +176,7 @@ public function setContainer(ShapeContainerInterface $pValue = null, $pOverrideO
// Set new \PhpOffice\PhpPresentation\Slide
$this->setContainer($pValue);
} else {
throw new \Exception(sprintf('A %s has already been assigned. Shapes can only exist on one %s.', ShapeContainerInterface::class, ShapeContainerInterface::class));
throw new ShapeContainerAlreadyAssignedException(self::class);
}
}

Expand Down Expand Up @@ -328,8 +329,6 @@ public function getShadow(): ?Shadow
}

/**
* @throws \Exception
*
* @return $this
*/
public function setShadow(Shadow $pValue = null)
Expand All @@ -350,9 +349,7 @@ public function hasHyperlink()
}

/**
* Get Hyperlink.
*
* @throws \Exception
* Get Hyperlink
*/
public function getHyperlink(): Hyperlink
{
Expand All @@ -364,9 +361,7 @@ public function getHyperlink(): Hyperlink
}

/**
* Set Hyperlink.
*
* @throws \Exception
* Set Hyperlink
*/
public function setHyperlink(Hyperlink $pHyperlink = null): self
{
Expand Down
32 changes: 32 additions & 0 deletions src/PhpPresentation/Exception/DirectoryNotFoundException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* This file is part of PHPPresentation - A pure PHP library for reading and writing
* presentations documents.
*
* PHPPresentation is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* 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/PHPPresentation/contributors.
*
* @see https://github.com/PHPOffice/PHPPresentation
*
* @copyright 2009-2015 PHPPresentation contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/

declare(strict_types=1);

namespace PhpOffice\PhpPresentation\Exception;

class DirectoryNotFoundException extends PhpPresentationException
{
public function __construct(string $path)
{
parent::__construct(sprintf(
'The directory %s doesn\'t exist',
$path
));
}
}
Loading

0 comments on commit e1c938c

Please sign in to comment.