require_once __DIR__ . '/../vendor/autoload.php';
// Set writers
$writers = array('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} - ";
$pageTitle .= 'PHPPresentation';
$pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";
$oShapeDrawing = new Drawing\File();
$oShapeDrawing->setName('PHPPresentation logo')->setDescription('PHPPresentation logo')->setPath('./resources/phppowerpoint_logo.gif')->setHeight(36)->setOffsetX(10)->setOffsetY(10);
$oShapeDrawing->getShadow()->setVisible(true)->setDirection(45)->setDistance(10);
$oShapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
// Create a shape (text)
$oShapeRichText = new RichText();
$oShapeRichText->setHeight(300)->setWidth(600)->setOffsetX(170)->setOffsetY(180);
$oShapeRichText->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$textRun = $oShapeRichText->createTextRun('Thank you for using PHPPresentation!');
$textRun->getFont()->setBold(true)->setSize(60)->setColor(new Color('FFE06B20'));
// Populate samples
$files = '';
if ($handle = opendir('.')) {
    while (false !== ($file = readdir($handle))) {
        if (preg_match('/^Sample_\\d+_/', $file)) {
            $name = str_replace('_', ' ', preg_replace('/(Sample_|\\.php)/', '', $file));
            $files .= "<li><a href='{$file}'>{$name}</a></li>";
        }
    }