Permalink
Browse files

make examples API 1.8.0 compatible

git-svn-id: http://svn.php.net/repository/pear/packages/PHP_CompatInfo/trunk@263465 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent b98346f commit 0a421c780ae7e3842c17faea9e6a077f3fa94a76 Laurent Laville committed Jul 24, 2008
Showing with 18 additions and 10 deletions.
  1. +18 −10 docs/examples/parseDir_withCustomProgressBar.php
View
28 docs/examples/parseDir_withCustomProgressBar.php
@@ -4,7 +4,7 @@
* Do not display any progress bar from other SAPI
*
* To run on Windows platform, do:
- * (path to PHP cli)\php.exe -f (this script) -- -d (the dir you want to parse)
+ * (path to PHP cli)\php.exe -f (this script)
*
* PHP versions 4 and 5
*
@@ -16,8 +16,9 @@
* @link http://pear.php.net/package/PHP_CompatInfo
* @ignore
*/
+require_once 'PHP/CompatInfo.php';
+
if (php_sapi_name() == 'cli') {
- include_once 'PHP/CompatInfo/Cli.php';
/*
Display a progress bar like this one:
@@ -29,14 +30,21 @@
'prefill' => ' ',
'options' => array('percent_precision' => 0));
- $cli = new PHP_CompatInfo_Cli($pbar);
- $cli->run();
-} else {
- include_once 'PHP/CompatInfo.php';
-
- $info = new PHP_CompatInfo();
+ $driverType = 'text';
+ $driverOptions = array('silent' => false, 'progress' => 'bar',
+ 'progressbar' => $pbar);
- $dir = 'C:\php\pear\HTML_Progress2';
- var_dump($info->parseDir($dir));
+} else {
+ $driverType = 'array';
+ $driverOptions = array();
}
+
+$info = new PHP_CompatInfo($driverType, $driverOptions);
+$dir = 'C:\php\pear\HTML_Progress2';
+$r = $info->parseDir($dir);
+/*
+ To keep backward compatibility, result is also return (here in $r)
+ but you don't need to print it, it's the default behavior of API 1.8.0
+ */
+//var_export($r);
?>

0 comments on commit 0a421c7

Please sign in to comment.