Sample_Header.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <?php
  2. /**
  3. * Header file
  4. */
  5. use PhpOffice\PhpPresentation\Autoloader;
  6. use PhpOffice\PhpPresentation\Settings;
  7. use PhpOffice\PhpPresentation\IOFactory;
  8. use PhpOffice\PhpPresentation\Slide;
  9. use PhpOffice\PhpPresentation\PhpPresentation;
  10. use PhpOffice\PhpPresentation\AbstractShape;
  11. use PhpOffice\PhpPresentation\DocumentLayout;
  12. use PhpOffice\PhpPresentation\Shape\Drawing;
  13. use PhpOffice\PhpPresentation\Shape\RichText;
  14. use PhpOffice\PhpPresentation\Shape\RichText\BreakElement;
  15. use PhpOffice\PhpPresentation\Shape\RichText\TextElement;
  16. use PhpOffice\PhpPresentation\Style\Alignment;
  17. use PhpOffice\PhpPresentation\Style\Bullet;
  18. use PhpOffice\PhpPresentation\Style\Color;
  19. error_reporting(E_ALL);
  20. define('CLI', (PHP_SAPI == 'cli') ? true : false);
  21. define('EOL', CLI ? PHP_EOL : '<br />');
  22. define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php'));
  23. define('IS_INDEX', SCRIPT_FILENAME == 'index');
  24. require_once __DIR__ . '/../src/PhpPresentation/Autoloader.php';
  25. Autoloader::register();
  26. require_once __DIR__ . '/../vendor/autoload.php';
  27. // Set writers
  28. $writers = array('PowerPoint2007' => 'pptx', 'ODPresentation' => 'odp');
  29. // Return to the caller script when runs by CLI
  30. if (CLI) {
  31. return;
  32. }
  33. // Set titles and names
  34. $pageHeading = str_replace('_', ' ', SCRIPT_FILENAME);
  35. $pageTitle = IS_INDEX ? 'Welcome to ' : "{$pageHeading} - ";
  36. $pageTitle .= 'PHPPresentation';
  37. $pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";
  38. $oShapeDrawing = new Drawing\File();
  39. $oShapeDrawing->setName('PHPPresentation logo')
  40. ->setDescription('PHPPresentation logo')
  41. ->setPath('./resources/phppowerpoint_logo.gif')
  42. ->setHeight(36)
  43. ->setOffsetX(10)
  44. ->setOffsetY(10);
  45. $oShapeDrawing->getShadow()->setVisible(true)
  46. ->setDirection(45)
  47. ->setDistance(10);
  48. $oShapeDrawing->getHyperlink()->setUrl('https://github.com/PHPOffice/PHPPresentation/')->setTooltip('PHPPresentation');
  49. // Create a shape (text)
  50. $oShapeRichText = new RichText();
  51. $oShapeRichText->setHeight(300)
  52. ->setWidth(600)
  53. ->setOffsetX(170)
  54. ->setOffsetY(180);
  55. $oShapeRichText->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
  56. $textRun = $oShapeRichText->createTextRun('Thank you for using PHPPresentation!');
  57. $textRun->getFont()->setBold(true)
  58. ->setSize(60)
  59. ->setColor( new Color( 'FFE06B20' ) );
  60. // Populate samples
  61. $files = '';
  62. if ($handle = opendir('.')) {
  63. while (false !== ($file = readdir($handle))) {
  64. if (preg_match('/^Sample_\d+_/', $file)) {
  65. $name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file));
  66. $files .= "<li><a href='{$file}'>{$name}</a></li>";
  67. }
  68. }
  69. closedir($handle);
  70. }
  71. /**
  72. * Write documents
  73. *
  74. * @param \PhpOffice\PhpPresentation\PhpPresentation $phpPresentation
  75. * @param string $filename
  76. * @param array $writers
  77. * @return string
  78. */
  79. function write($phpPresentation, $filename, $writers)
  80. {
  81. $result = '';
  82. // Write documents
  83. foreach ($writers as $writer => $extension) {
  84. $result .= date('H:i:s') . " Write to {$writer} format";
  85. if (!is_null($extension)) {
  86. $xmlWriter = IOFactory::createWriter($phpPresentation, $writer);
  87. $xmlWriter->save(__DIR__ . "/{$filename}.{$extension}");
  88. rename(__DIR__ . "/{$filename}.{$extension}", __DIR__ . "/results/{$filename}.{$extension}");
  89. } else {
  90. $result .= ' ... NOT DONE!';
  91. }
  92. $result .= EOL;
  93. }
  94. $result .= getEndingNotes($writers);
  95. return $result;
  96. }
  97. /**
  98. * Get ending notes
  99. *
  100. * @param array $writers
  101. * @return string
  102. */
  103. function getEndingNotes($writers)
  104. {
  105. $result = '';
  106. // Do not show execution time for index
  107. if (!IS_INDEX) {
  108. $result .= date('H:i:s') . " Done writing file(s)" . EOL;
  109. $result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL;
  110. }
  111. // Return
  112. if (CLI) {
  113. $result .= 'The results are stored in the "results" subdirectory.' . EOL;
  114. } else {
  115. if (!IS_INDEX) {
  116. $types = array_values($writers);
  117. $result .= '<p>&nbsp;</p>';
  118. $result .= '<p>Results: ';
  119. foreach ($types as $type) {
  120. if (!is_null($type)) {
  121. $resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type;
  122. if (file_exists($resultFile)) {
  123. $result .= "<a href='{$resultFile}' class='btn btn-primary'>{$type}</a> ";
  124. }
  125. }
  126. }
  127. $result .= '</p>';
  128. }
  129. }
  130. return $result;
  131. }
  132. /**
  133. * Creates a templated slide
  134. *
  135. * @param PHPPresentation $objPHPPresentation
  136. * @return \PhpOffice\PhpPresentation\Slide
  137. */
  138. function createTemplatedSlide(PhpOffice\PhpPresentation\PhpPresentation $objPHPPresentation)
  139. {
  140. // Create slide
  141. $slide = $objPHPPresentation->createSlide();
  142. // Add logo
  143. $shape = $slide->createDrawingShape();
  144. $shape->setName('PHPPresentation logo')
  145. ->setDescription('PHPPresentation logo')
  146. ->setPath('./resources/phppowerpoint_logo.gif')
  147. ->setHeight(36)
  148. ->setOffsetX(10)
  149. ->setOffsetY(10);
  150. $shape->getShadow()->setVisible(true)
  151. ->setDirection(45)
  152. ->setDistance(10);
  153. // Return slide
  154. return $slide;
  155. }
  156. class PhpPptTree {
  157. protected $oPhpPresentation;
  158. protected $htmlOutput;
  159. public function __construct(PhpPresentation $oPHPPpt)
  160. {
  161. $this->oPhpPresentation = $oPHPPpt;
  162. }
  163. public function display()
  164. {
  165. $this->append('<div class="container-fluid pptTree">');
  166. $this->append('<div class="row">');
  167. $this->append('<div class="collapse in col-md-6">');
  168. $this->append('<div class="tree">');
  169. $this->append('<ul>');
  170. $this->displayPhpPresentation($this->oPhpPresentation);
  171. $this->append('</ul>');
  172. $this->append('</div>');
  173. $this->append('</div>');
  174. $this->append('<div class="col-md-6">');
  175. $this->displayPhpPresentationInfo($this->oPhpPresentation);
  176. $this->append('</div>');
  177. $this->append('</div>');
  178. $this->append('</div>');
  179. return $this->htmlOutput;
  180. }
  181. protected function append($sHTML)
  182. {
  183. $this->htmlOutput .= $sHTML;
  184. }
  185. protected function displayPhpPresentation(PhpPresentation $oPHPPpt)
  186. {
  187. $this->append('<li><span><i class="fa fa-folder-open"></i> PhpPresentation</span>');
  188. $this->append('<ul>');
  189. $this->append('<li><span class="shape" id="divPhpPresentation"><i class="fa fa-info-circle"></i> Info "PhpPresentation"</span></li>');
  190. foreach ($oPHPPpt->getAllSlides() as $oSlide) {
  191. $this->append('<li><span><i class="fa fa-minus-square"></i> Slide</span>');
  192. $this->append('<ul>');
  193. $this->append('<li><span class="shape" id="div'.$oSlide->getHashCode().'"><i class="fa fa-info-circle"></i> Info "Slide"</span></li>');
  194. foreach ($oSlide->getShapeCollection() as $oShape) {
  195. if($oShape instanceof Group) {
  196. $this->append('<li><span><i class="fa fa-minus-square"></i> Shape "Group"</span>');
  197. $this->append('<ul>');
  198. // $this->append('<li><span class="shape" id="div'.$oShape->getHashCode().'"><i class="fa fa-info-circle"></i> Info "Group"</span></li>');
  199. foreach ($oShape->getShapeCollection() as $oShapeChild) {
  200. $this->displayShape($oShapeChild);
  201. }
  202. $this->append('</ul>');
  203. $this->append('</li>');
  204. } else {
  205. $this->displayShape($oShape);
  206. }
  207. }
  208. $this->append('</ul>');
  209. $this->append('</li>');
  210. }
  211. $this->append('</ul>');
  212. $this->append('</li>');
  213. }
  214. protected function displayShape(AbstractShape $shape)
  215. {
  216. if($shape instanceof Drawing\Gd) {
  217. $this->append('<li><span class="shape" id="div'.$shape->getHashCode().'">Shape "Drawing\Gd"</span></li>');
  218. } elseif($shape instanceof Drawing\File) {
  219. $this->append('<li><span class="shape" id="div'.$shape->getHashCode().'">Shape "Drawing\File"</span></li>');
  220. } elseif($shape instanceof Drawing\Base64) {
  221. $this->append('<li><span class="shape" id="div'.$shape->getHashCode().'">Shape "Drawing\Base64"</span></li>');
  222. } elseif($shape instanceof Drawing\Zip) {
  223. $this->append('<li><span class="shape" id="div'.$shape->getHashCode().'">Shape "Drawing\Zip"</span></li>');
  224. } elseif($shape instanceof RichText) {
  225. $this->append('<li><span class="shape" id="div'.$shape->getHashCode().'">Shape "RichText"</span></li>');
  226. } else {
  227. var_dump($shape);
  228. }
  229. }
  230. protected function displayPhpPresentationInfo(PhpPresentation $oPHPPpt)
  231. {
  232. $this->append('<div class="infoBlk" id="divPhpPresentationInfo">');
  233. $this->append('<dl>');
  234. $this->append('<dt>Number of slides</dt><dd>'.$oPHPPpt->getSlideCount().'</dd>');
  235. $this->append('<dt>Document Layout Name</dt><dd>'.(empty($oPHPPpt->getLayout()->getDocumentLayout()) ? 'Custom' : $oPHPPpt->getLayout()->getDocumentLayout()).'</dd>');
  236. $this->append('<dt>Document Layout Height</dt><dd>'.$oPHPPpt->getLayout()->getCY(DocumentLayout::UNIT_MILLIMETER).' mm</dd>');
  237. $this->append('<dt>Document Layout Width</dt><dd>'.$oPHPPpt->getLayout()->getCX(DocumentLayout::UNIT_MILLIMETER).' mm</dd>');
  238. $this->append('<dt>Properties : Category</dt><dd>'.$oPHPPpt->getDocumentProperties()->getCategory().'</dd>');
  239. $this->append('<dt>Properties : Company</dt><dd>'.$oPHPPpt->getDocumentProperties()->getCompany().'</dd>');
  240. $this->append('<dt>Properties : Created</dt><dd>'.$oPHPPpt->getDocumentProperties()->getCreated().'</dd>');
  241. $this->append('<dt>Properties : Creator</dt><dd>'.$oPHPPpt->getDocumentProperties()->getCreator().'</dd>');
  242. $this->append('<dt>Properties : Description</dt><dd>'.$oPHPPpt->getDocumentProperties()->getDescription().'</dd>');
  243. $this->append('<dt>Properties : Keywords</dt><dd>'.$oPHPPpt->getDocumentProperties()->getKeywords().'</dd>');
  244. $this->append('<dt>Properties : Last Modified By</dt><dd>'.$oPHPPpt->getDocumentProperties()->getLastModifiedBy().'</dd>');
  245. $this->append('<dt>Properties : Modified</dt><dd>'.$oPHPPpt->getDocumentProperties()->getModified().'</dd>');
  246. $this->append('<dt>Properties : Subject</dt><dd>'.$oPHPPpt->getDocumentProperties()->getSubject().'</dd>');
  247. $this->append('<dt>Properties : Title</dt><dd>'.$oPHPPpt->getDocumentProperties()->getTitle().'</dd>');
  248. $this->append('</dl>');
  249. $this->append('</div>');
  250. foreach ($oPHPPpt->getAllSlides() as $oSlide) {
  251. $this->append('<div class="infoBlk" id="div'.$oSlide->getHashCode().'Info">');
  252. $this->append('<dl>');
  253. $this->append('<dt>HashCode</dt><dd>'.$oSlide->getHashCode().'</dd>');
  254. $this->append('<dt>Slide Layout</dt><dd>Layout::'.$this->getConstantName('\PhpOffice\PhpPresentation\Slide\Layout', $oSlide->getSlideLayout()).'</dd>');
  255. $this->append('<dt>Offset X</dt><dd>'.$oSlide->getOffsetX().'</dd>');
  256. $this->append('<dt>Offset Y</dt><dd>'.$oSlide->getOffsetY().'</dd>');
  257. $this->append('<dt>Extent X</dt><dd>'.$oSlide->getExtentX().'</dd>');
  258. $this->append('<dt>Extent Y</dt><dd>'.$oSlide->getExtentY().'</dd>');
  259. $oBkg = $oSlide->getBackground();
  260. if ($oBkg instanceof Slide\AbstractBackground) {
  261. if ($oBkg instanceof Slide\Background\Color) {
  262. $this->append('<dt>Background Color</dt><dd>#'.$oBkg->getColor()->getRGB().'</dd>');
  263. }
  264. if ($oBkg instanceof Slide\Background\Image) {
  265. $sBkgImgContents = file_get_contents($oBkg->getPath());
  266. $this->append('<dt>Background Image</dt><dd><img src="data:image/png;base64,'.base64_encode($sBkgImgContents).'"></dd>');
  267. }
  268. }
  269. $oNote = $oSlide->getNote();
  270. if ($oNote->getShapeCollection()->count() > 0) {
  271. $this->append('<dt>Notes</dt>');
  272. foreach ($oNote->getShapeCollection() as $oShape) {
  273. if ($oShape instanceof RichText) {
  274. $this->append('<dd>' . $oShape->getPlainText() . '</dd>');
  275. }
  276. }
  277. }
  278. $this->append('</dl>');
  279. $this->append('</div>');
  280. foreach ($oSlide->getShapeCollection() as $oShape) {
  281. if($oShape instanceof Group) {
  282. foreach ($oShape->getShapeCollection() as $oShapeChild) {
  283. $this->displayShapeInfo($oShapeChild);
  284. }
  285. } else {
  286. $this->displayShapeInfo($oShape);
  287. }
  288. }
  289. }
  290. }
  291. protected function displayShapeInfo(AbstractShape $oShape)
  292. {
  293. $this->append('<div class="infoBlk" id="div'.$oShape->getHashCode().'Info">');
  294. $this->append('<dl>');
  295. $this->append('<dt>HashCode</dt><dd>'.$oShape->getHashCode().'</dd>');
  296. $this->append('<dt>Offset X</dt><dd>'.$oShape->getOffsetX().'</dd>');
  297. $this->append('<dt>Offset Y</dt><dd>'.$oShape->getOffsetY().'</dd>');
  298. $this->append('<dt>Height</dt><dd>'.$oShape->getHeight().'</dd>');
  299. $this->append('<dt>Width</dt><dd>'.$oShape->getWidth().'</dd>');
  300. $this->append('<dt>Rotation</dt><dd>'.$oShape->getRotation().'°</dd>');
  301. $this->append('<dt>Hyperlink</dt><dd>'.ucfirst(var_export($oShape->hasHyperlink(), true)).'</dd>');
  302. $this->append('<dt>Fill</dt><dd>@Todo</dd>');
  303. $this->append('<dt>Border</dt><dd>@Todo</dd>');
  304. $this->append('<dt>IsPlaceholder</dt><dd>' . ($oShape->isPlaceholder() ? 'true' : 'false') . '</dd>');
  305. if($oShape instanceof Drawing\Gd) {
  306. $this->append('<dt>Name</dt><dd>'.$oShape->getName().'</dd>');
  307. $this->append('<dt>Description</dt><dd>'.$oShape->getDescription().'</dd>');
  308. ob_start();
  309. call_user_func($oShape->getRenderingFunction(), $oShape->getImageResource());
  310. $sShapeImgContents = ob_get_contents();
  311. ob_end_clean();
  312. $this->append('<dt>Mime-Type</dt><dd>'.$oShape->getMimeType().'</dd>');
  313. $this->append('<dt>Image</dt><dd><img src="data:'.$oShape->getMimeType().';base64,'.base64_encode($sShapeImgContents).'"></dd>');
  314. } elseif($oShape instanceof Drawing) {
  315. $this->append('<dt>Name</dt><dd>'.$oShape->getName().'</dd>');
  316. $this->append('<dt>Description</dt><dd>'.$oShape->getDescription().'</dd>');
  317. } elseif($oShape instanceof RichText) {
  318. $this->append('<dt># of paragraphs</dt><dd>'.count($oShape->getParagraphs()).'</dd>');
  319. $this->append('<dt>Inset (T / R / B / L)</dt><dd>'.$oShape->getInsetTop().'px / '.$oShape->getInsetRight().'px / '.$oShape->getInsetBottom().'px / '.$oShape->getInsetLeft().'px</dd>');
  320. $this->append('<dt>Text</dt>');
  321. $this->append('<dd>');
  322. foreach ($oShape->getParagraphs() as $oParagraph) {
  323. $this->append('Paragraph<dl>');
  324. $this->append('<dt>Alignment Horizontal</dt><dd> Alignment::'.$this->getConstantName('\PhpOffice\PhpPresentation\Style\Alignment', $oParagraph->getAlignment()->getHorizontal()).'</dd>');
  325. $this->append('<dt>Alignment Vertical</dt><dd> Alignment::'.$this->getConstantName('\PhpOffice\PhpPresentation\Style\Alignment', $oParagraph->getAlignment()->getVertical()).'</dd>');
  326. $this->append('<dt>Alignment Margin (L / R)</dt><dd>'.$oParagraph->getAlignment()->getMarginLeft().' px / '.$oParagraph->getAlignment()->getMarginRight().'px</dd>');
  327. $this->append('<dt>Alignment Indent</dt><dd>'.$oParagraph->getAlignment()->getIndent().' px</dd>');
  328. $this->append('<dt>Alignment Level</dt><dd>'.$oParagraph->getAlignment()->getLevel().'</dd>');
  329. $this->append('<dt>Bullet Style</dt><dd> Bullet::'.$this->getConstantName('\PhpOffice\PhpPresentation\Style\Bullet', $oParagraph->getBulletStyle()->getBulletType()).'</dd>');
  330. if ($oParagraph->getBulletStyle()->getBulletType() != Bullet::TYPE_NONE) {
  331. $this->append('<dt>Bullet Font</dt><dd>' . $oParagraph->getBulletStyle()->getBulletFont() . '</dd>');
  332. $this->append('<dt>Bullet Color</dt><dd>' . $oParagraph->getBulletStyle()->getBulletColor()->getARGB() . '</dd>');
  333. }
  334. if ($oParagraph->getBulletStyle()->getBulletType() == Bullet::TYPE_BULLET) {
  335. $this->append('<dt>Bullet Char</dt><dd>'.$oParagraph->getBulletStyle()->getBulletChar().'</dd>');
  336. }
  337. if ($oParagraph->getBulletStyle()->getBulletType() == Bullet::TYPE_NUMERIC) {
  338. $this->append('<dt>Bullet Start At</dt><dd>'.$oParagraph->getBulletStyle()->getBulletNumericStartAt().'</dd>');
  339. $this->append('<dt>Bullet Style</dt><dd>'.$oParagraph->getBulletStyle()->getBulletNumericStyle().'</dd>');
  340. }
  341. $this->append('<dt>Line Spacing</dt><dd>'.$oParagraph->getLineSpacing().'</dd>');
  342. $this->append('<dt>RichText</dt><dd><dl>');
  343. foreach ($oParagraph->getRichTextElements() as $oRichText) {
  344. if($oRichText instanceof BreakElement) {
  345. $this->append('<dt><i>Break</i></dt>');
  346. } else {
  347. if ($oRichText instanceof TextElement) {
  348. $this->append('<dt><i>TextElement</i></dt>');
  349. } else {
  350. $this->append('<dt><i>Run</i></dt>');
  351. }
  352. $this->append('<dd>'.$oRichText->getText());
  353. $this->append('<dl>');
  354. $this->append('<dt>Font Name</dt><dd>'.$oRichText->getFont()->getName().'</dd>');
  355. $this->append('<dt>Font Size</dt><dd>'.$oRichText->getFont()->getSize().'</dd>');
  356. $this->append('<dt>Font Color</dt><dd>#'.$oRichText->getFont()->getColor()->getARGB().'</dd>');
  357. $this->append('<dt>Font Transform</dt><dd>');
  358. $this->append('<abbr title="Bold">Bold</abbr> : '.($oRichText->getFont()->isBold() ? 'Y' : 'N').' - ');
  359. $this->append('<abbr title="Italic">Italic</abbr> : '.($oRichText->getFont()->isItalic() ? 'Y' : 'N').' - ');
  360. $this->append('<abbr title="Underline">Underline</abbr> : Underline::'.$this->getConstantName('\PhpOffice\PhpPresentation\Style\Font', $oRichText->getFont()->getUnderline()).' - ');
  361. $this->append('<abbr title="Strikethrough">Strikethrough</abbr> : '.($oRichText->getFont()->isStrikethrough() ? 'Y' : 'N').' - ');
  362. $this->append('<abbr title="SubScript">SubScript</abbr> : '.($oRichText->getFont()->isSubScript() ? 'Y' : 'N').' - ');
  363. $this->append('<abbr title="SuperScript">SuperScript</abbr> : '.($oRichText->getFont()->isSuperScript() ? 'Y' : 'N'));
  364. $this->append('</dd>');
  365. if ($oRichText instanceof TextElement) {
  366. if ($oRichText->hasHyperlink()) {
  367. $this->append('<dt>Hyperlink URL</dt><dd>'.$oRichText->getHyperlink()->getUrl().'</dd>');
  368. $this->append('<dt>Hyperlink Tooltip</dt><dd>'.$oRichText->getHyperlink()->getTooltip().'</dd>');
  369. }
  370. }
  371. $this->append('</dl>');
  372. $this->append('</dd>');
  373. }
  374. }
  375. $this->append('</dl></dd></dl>');
  376. }
  377. $this->append('</dd>');
  378. } else {
  379. // Add another shape
  380. }
  381. $this->append('</dl>');
  382. $this->append('</div>');
  383. }
  384. protected function getConstantName($class, $search, $startWith = '') {
  385. $fooClass = new ReflectionClass($class);
  386. $constants = $fooClass->getConstants();
  387. $constName = null;
  388. foreach ($constants as $key => $value ) {
  389. if ($value == $search) {
  390. if (empty($startWith) || (!empty($startWith) && strpos($key, $startWith) === 0)) {
  391. $constName = $key;
  392. }
  393. break;
  394. }
  395. }
  396. return $constName;
  397. }
  398. }
  399. ?>
  400. <title><?php echo $pageTitle; ?></title>
  401. <meta charset="utf-8">
  402. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  403. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  404. <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
  405. <link rel="stylesheet" href="bootstrap/css/font-awesome.min.css" />
  406. <link rel="stylesheet" href="bootstrap/css/phppresentation.css" />
  407. </head>
  408. <body>
  409. <div class="container">
  410. <div class="navbar navbar-default" role="navigation">
  411. <div class="container-fluid">
  412. <div class="navbar-header">
  413. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
  414. <span class="sr-only">Toggle navigation</span>
  415. <span class="icon-bar"></span>
  416. <span class="icon-bar"></span>
  417. <span class="icon-bar"></span>
  418. </button>
  419. <a class="navbar-brand" href="./">PHPPresentation</a>
  420. </div>
  421. <div class="navbar-collapse collapse">
  422. <ul class="nav navbar-nav">
  423. <li class="dropdown active">
  424. <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-code fa-lg"></i>&nbsp;Samples<strong class="caret"></strong></a>
  425. <ul class="dropdown-menu"><?php echo $files; ?></ul>
  426. </li>
  427. </ul>
  428. <ul class="nav navbar-nav navbar-right">
  429. <li><a href="https://github.com/PHPOffice/PHPPresentation"><i class="fa fa-github fa-lg" title="GitHub"></i>&nbsp;</a></li>
  430. <li><a href="http://phppresentation.readthedocs.org/en/develop/"><i class="fa fa-book fa-lg" title="Docs"></i>&nbsp;</a></li>
  431. <li><a href="http://twitter.com/PHPOffice"><i class="fa fa-twitter fa-lg" title="Twitter"></i>&nbsp;</a></li>
  432. </ul>
  433. </div>
  434. </div>
  435. </div>
  436. <?php echo $pageHeading; ?>