From a5c392043fe9285c0e395638e3fd5ea11757c6ba Mon Sep 17 00:00:00 2001 From: pal-software Date: Sun, 20 Dec 2020 21:47:26 +1100 Subject: [PATCH] Samples : Allow to run without composer --- docs/changes/1.1.0.md | 1 + samples/Sample_Header.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/changes/1.1.0.md b/docs/changes/1.1.0.md index 2ff907807..189abd6ce 100644 --- a/docs/changes/1.1.0.md +++ b/docs/changes/1.1.0.md @@ -32,6 +32,7 @@ - PowerPoint2007 & ODPresentation Writer : Use of the disk caching directory for temporary files - [@nhalle](https://github.com/nhalle) in [#781](https://github.com/PHPOffice/PHPPresentation/pull/781) - PowerPoint2007 Reader : Fixed reading of RichText shape in Note - [@aelliott1485](https://github.com/aelliott1485) in [#782](https://github.com/PHPOffice/PHPPresentation/pull/782) - PowerPoint2007 Writer : Fixed broken animation for first shape - [@shannan1989](https://github.com/shannan1989) in [#783](https://github.com/PHPOffice/PHPPresentation/pull/783) +- Samples : Allow to run without composer - [@pal-software](https://github.com/pal-software) in [#784](https://github.com/PHPOffice/PHPPresentation/pull/784) ## Miscellaneous diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 0ed440b98..61796fe6f 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -29,7 +29,12 @@ if (is_file(dirname(__DIR__) . '/vendor/autoload.php')) { require_once dirname(__DIR__) . '/vendor/autoload.php'; } else { - throw new Exception('Can not find the vendor folder!'); + if (is_file(__DIR__ . '/../../Common/src/Common/Autoloader.php')) { + include_once __DIR__ . '/../../Common/src/Common/Autoloader.php'; + \PhpOffice\Common\Autoloader::register(); + } else { + throw new Exception('Can not find the vendor or the common folder!'); + } } // do some checks to make sure the outputs are set correctly. if (false === is_dir(__DIR__ . DIRECTORY_SEPARATOR . 'results')) {