home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / PHP / Beautifier / Batch / Output / Directory.php next >
Encoding:
PHP Script  |  2008-07-02  |  2.6 KB  |  74 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3. /**
  4. * PHP_Beautifier_Batch_Files
  5. * Handle the batch process for multiple php files to one directory
  6. *
  7. * PHP version 5
  8. *
  9. * LICENSE: This source file is subject to version 3.0 of the PHP license
  10. * that is available through the world-wide-web at the following URI:
  11. * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
  12. * the PHP License and are unable to obtain it through the web, please
  13. * send a note to license@php.net so we can mail you a copy immediately.
  14. * @category   PHP
  15. * @package PHP_Beautifier
  16. * @subpackage Batch
  17. * @author Claudio Bustos <cdx@users.sourceforge.com>
  18. * @copyright  2004-2006 Claudio Bustos
  19. * @link     http://pear.php.net/package/PHP_Beautifier
  20. * @link     http://beautifyphp.sourceforge.net
  21. * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  22. * @version    CVS: $Id:$
  23. */
  24. /**
  25. * PHP_Beautifier_Batch_Files
  26. * Handle the batch process for multiple php files to one directory
  27. *
  28. * @category   PHP
  29. * @package PHP_Beautifier
  30. * @author Claudio Bustos <cdx@users.sourceforge.com>
  31. * @copyright  2004-2006 Claudio Bustos
  32. * @link     http://pear.php.net/package/PHP_Beautifier
  33. * @link     http://beautifyphp.sourceforge.net
  34. * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  35. * @version    Release: 0.1.14
  36. */
  37. class PHP_Beautifier_Batch_Output_Directory extends PHP_Beautifier_Batch_Output {
  38.     public function save() 
  39.     {
  40.         $aInputFiles = $this->oBatch->getInputFiles();
  41.         $sOutputPath = $this->oBatch->getOutputPath();
  42.         $aOutputFiles = PHP_Beautifier_Common::getSavePath($aInputFiles, $sOutputPath);
  43.         $oLog = PHP_Beautifier_Common::getLog();
  44.         for ($x = 0;$x<count($aInputFiles);$x++) {
  45.             try {
  46.                 $this->beautifierSetInputFile($aInputFiles[$x]);
  47.                 $this->beautifierProcess();
  48.                 PHP_Beautifier_Common::createDir($aOutputFiles[$x]);
  49.                 $this->beautifierSave($aOutputFiles[$x]);
  50.             }
  51.             catch(Exception $oExp) {
  52.                 $oLog->log($oExp->getMessage() , PEAR_LOG_ERR);
  53.             }
  54.         }
  55.         return true;
  56.     }
  57.     /**
  58.     * Send the output of the files, one after another
  59.     * With a little header
  60.     * @return string
  61.     */
  62.     public function get() 
  63.     {
  64.         $aInputFiles = $this->oBatch->getInputFiles();
  65.         $sText = '';
  66.         foreach($aInputFiles as $sFile) {
  67.             $this->beautifierSetInputFile($sFile);
  68.             $this->beautifierProcess();
  69.             $sText.= $this->beautifierGet()."\n";
  70.         }
  71.         return $sText;
  72.     }
  73. }
  74. ?>