cvs: pear /HTML_Progress2/Progress2/Generator Process.php

From: Date: Wed, 27 Jul 2005 20:50:55 +0000
Subject: cvs: pear /HTML_Progress2/Progress2/Generator Process.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-33393@lists.php.net to get a copy of this message
farell Wed Jul 27 16:50:55 2005 EDT Modified files: /pear/HTML_Progress2/Progress2/Generator Process.php Log: optimize html stream generation when possible http://cvs.php.net/diff.php/pear/HTML_Progress2/Progress2/Generator/Process.php?r1=1.1&r2=1.2&ty=u Index: pear/HTML_Progress2/Progress2/Generator/Process.php diff -u pear/HTML_Progress2/Progress2/Generator/Process.php:1.1 pear/HTML_Progress2/Progress2/Generator/Process.php:1.2 --- pear/HTML_Progress2/Progress2/Generator/Process.php:1.1 Sun Jun 12 17:00:03 2005 +++ pear/HTML_Progress2/Progress2/Generator/Process.php Wed Jul 27 16:50:55 2005 @@ -16,7 +16,7 @@ * @author Laurent Laville <pear@laurent-laville.org> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: Process.php,v 1.1 2005/06/12 21:00:03 farell Exp $ + * @version CVS: $Id: Process.php,v 1.2 2005/07/27 20:50:55 farell Exp $ * @link http://pear.php.net/package/HTML_Progress2 */ @@ -64,13 +64,13 @@ $page->isFormBuilt() or $page->buildForm(); $page->controller->isValid(); - // what kind of source code is requested + // what kind of source code is requested $code = $page->exportValue('phpcss'); $pb = $page->controller->createProgressBar(); $phpCode = (isset($code['P']) === true); $cssCode = (isset($code['C']) === true); - + if ($cssCode) { $strCSS = $this->sprintCSS($pb); $this->exportOutput($strCSS); @@ -97,16 +97,7 @@ */ function sprintCSS(&$pBar, $raw = false) { - if ($raw) { - $css = $pBar->getStyle(); - } else { - $css = '<style type="text/css">' . PHP_EOL; - $css .= '<!--' . PHP_EOL; - $css .= $pBar->getStyle() . PHP_EOL; - $css .= '// -->' . PHP_EOL; - $css .= '</style>' . PHP_EOL; - } - return $css; + return $pBar->getStyle($raw); } /** @@ -132,7 +123,7 @@ $strPHP .= 'require_once \'HTML/Progress2.php\';' . PHP_EOL . PHP_EOL; $strPHP .= '$pb = new HTML_Progress2();' . PHP_EOL; $strPHP .= '$pb->setIdent(\'PB1\');' . PHP_EOL; - + if ($pBar->isIndeterminate()) { $strPHP .= '$pb->setIndeterminate(true);' . PHP_EOL; } @@ -187,17 +178,9 @@ $strPHP .= PHP_EOL; if (!$cssCode) { $strPHP .= 'echo \'<head>\' . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo \'<style type="text/css">\' . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo \'<!--\' . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo $pb->getStyle() . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo \'// -->\' . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo \'</style>\' . PHP_EOL;' . PHP_EOL; - } - $strPHP .= 'echo \'<script type="text/javascript">\' . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo \'<!--\' . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo $pb->getScript() . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo \'//-->\' . PHP_EOL;' . PHP_EOL; - $strPHP .= 'echo \'</script>\' . PHP_EOL;' . PHP_EOL; + $strPHP .= 'echo $pb->getStyle(false) . PHP_EOL;' . PHP_EOL; + } + $strPHP .= 'echo $pb->getScript(false) . PHP_EOL;' . PHP_EOL; if (!$cssCode) { $strPHP .= 'echo \'</head>\' . PHP_EOL;' . PHP_EOL; $strPHP .= 'echo \'<body>\' . PHP_EOL;' . PHP_EOL; @@ -256,7 +239,7 @@ $strPHP .= "'$attr'=>" . ($val ? 'true' : 'false') . ', '; } else { $strPHP .= "'$attr'=>'$val', "; - } + } } $strPHP = ereg_replace(', $', '', $strPHP); $strPHP .= '));';

« previous php.pear.cvs (#33393) next »