From: <tr...@us...> - 2012-12-10 00:22:51
|
Revision: 10343 http://sourceforge.net/p/xoops/svn/10343 Author: trabis Date: 2012-12-10 00:22:48 +0000 (Mon, 10 Dec 2012) Log Message: ----------- Module Codex - Showing files content along with the examples Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/cache.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/form.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/pdf.php XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/Xoops/Debug.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/cache.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/cache.php 2012-12-09 21:20:35 UTC (rev 10342) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/cache.php 2012-12-10 00:22:48 UTC (rev 10343) @@ -55,4 +55,6 @@ echo $ret . '<br />'; echo '<a href="?nodelete">Refresh</a> - <a href="?delete">Delete caches</a>'; + +Xoops_Debug::dumpFile(__FILE__ ); $xoops->footer(); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/form.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/form.php 2012-12-09 21:20:35 UTC (rev 10342) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/form.php 2012-12-10 00:22:48 UTC (rev 10343) @@ -20,6 +20,7 @@ $xoops = Xoops::getInstance(); $xoops->header(); + // Form Horizontal $form = new XoopsThemeForm('Form Horizontal', 'form_horizontal', 'testform.php', 'post', true, 'horizontal'); @@ -137,4 +138,6 @@ $form->addElement($button_tray); $form->display(); + +Xoops_Debug::dumpFile(__FILE__ ); $xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/pdf.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/pdf.php 2012-12-09 21:20:35 UTC (rev 10342) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/codex/pdf.php 2012-12-10 00:22:48 UTC (rev 10343) @@ -20,19 +20,27 @@ $xoops = Xoops::getInstance(); -$content = Xoops_Debug::dump($xoops->getConfigs(), false); +if (isset($_GET['pdf'])) { + $content = Xoops_Debug::dump($xoops->getConfigs(), false); -$tpl = new XoopsTpl(); -$tpl->assign('dummy_content' , $content); -$content2 = $tpl->fetch('module:system|system_dummy.html'); + $tpl = new XoopsTpl(); + $tpl->assign('dummy_content' , $content); + $content2 = $tpl->fetch('module:system|system_dummy.html'); -if ($xoops->isActiveModule('pdf')) { - $pdf = new Pdf(); - $pdf->writeHtml($content2, false); - $pdf->Output('example.pdf'); + if ($xoops->isActiveModule('pdf')) { + $pdf = new Pdf(); + $pdf->writeHtml($content2, false); + $pdf->Output('example.pdf'); + } else { + $xoops->header(); + echo 'Oops, Please install pdf module!'; + Xoops_Debug::dumpFile(__FILE__ ); + $xoops->footer(); + } } else { $xoops->header(); - echo 'Oops, Please install pdf module!'; + echo '<a href="?pdf">Make Pdf</a>'; + Xoops_Debug::dumpFile(__FILE__ ); $xoops->footer(); } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/Xoops/Debug.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/Xoops/Debug.php 2012-12-09 21:20:35 UTC (rev 10342) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/xoops_lib/Xoops/Debug.php 2012-12-10 00:22:48 UTC (rev 10343) @@ -47,4 +47,27 @@ } return $msg; } + + /** + * Output a dump of a file + * + * @param mixed $file file which will be dumped + * @param bool $echo + * @param bool $exit + * + * @return string + */ + static function dumpFile($file, $echo = true, $exit = false) + { + $msg = highlight_file($file, true); + $msg = "<div style='padding: 5px; font-weight: bold'>{$msg}</div>"; + if (!$echo) { + return $msg; + } + echo $msg; + if ($exit) { + die(); + } + return $msg; + } } \ No newline at end of file |