First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,69 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Abstract class to superclass all batch class
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* Abstract class to superclass all batch class
*
* @category PHP
* @package PHP_Beautifier
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
abstract class PHP_Beautifier_Batch_Output
{
protected $oBatch;
public function __construct(PHP_Beautifier_Batch $oBatch)
{
$this->oBatch = $oBatch;
}
protected function beautifierSetInputFile($sFile)
{
return $this->oBatch->callBeautifier($this, 'setInputFile', array(
$sFile
));
}
protected function beautifierProcess()
{
return $this->oBatch->callBeautifier($this, 'process');
}
protected function beautifierGet()
{
return $this->oBatch->callBeautifier($this, 'get');
}
protected function beautifierSave($sFile)
{
return $this->oBatch->callBeautifier($this, 'save', array(
$sFile
));
}
public function get()
{
}
public function save()
{
}
}
?>

View file

@ -0,0 +1,74 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* PHP_Beautifier_Batch_Files
* Handle the batch process for multiple php files to one directory
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* PHP_Beautifier_Batch_Files
* Handle the batch process for multiple php files to one directory
*
* @category PHP
* @package PHP_Beautifier
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
class PHP_Beautifier_Batch_Output_Directory extends PHP_Beautifier_Batch_Output {
public function save()
{
$aInputFiles = $this->oBatch->getInputFiles();
$sOutputPath = $this->oBatch->getOutputPath();
$aOutputFiles = PHP_Beautifier_Common::getSavePath($aInputFiles, $sOutputPath);
$oLog = PHP_Beautifier_Common::getLog();
for ($x = 0;$x<count($aInputFiles);$x++) {
try {
$this->beautifierSetInputFile($aInputFiles[$x]);
$this->beautifierProcess();
PHP_Beautifier_Common::createDir($aOutputFiles[$x]);
$this->beautifierSave($aOutputFiles[$x]);
}
catch(Exception $oExp) {
$oLog->log($oExp->getMessage() , PEAR_LOG_ERR);
}
}
return true;
}
/**
* Send the output of the files, one after another
* With a little header
* @return string
*/
public function get()
{
$aInputFiles = $this->oBatch->getInputFiles();
$sText = '';
foreach($aInputFiles as $sFile) {
$this->beautifierSetInputFile($sFile);
$this->beautifierProcess();
$sText.= $this->beautifierGet()."\n";
}
return $sText;
}
}
?>

View file

@ -0,0 +1,48 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Compress all the files to one bz2 file
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* Include PHP_Beautifier_Batch_DirectoryTar
*/
require_once ('DirectoryTar.php');
/**
* PHP_Beautifier_Batch_FilesGz
*
* Compress all the files to one bz2 file
*
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
class PHP_Beautifier_Batch_Output_DirectoryBz2 extends PHP_Beautifier_Batch_DirectoryTar {
protected function getTar($sFileName)
{
return new Archive_Tar($sFileName.'.tar.bz2', 'bz2');
}
}
?>

View file

@ -0,0 +1,48 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Compress all the files to one tgz file
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* Include PHP_Beautifier_Batch_DirectoryTar
*/
require_once ('DirectoryTar.php');
/**
* PHP_Beautifier_Batch_FilesGz
*
* Compress all the files to one tgz file
*
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
class PHP_Beautifier_Batch_Output_DirectoryGz extends PHP_Beautifier_Batch_Output_DirectoryTar {
protected function getTar($sFileName)
{
return new Archive_Tar($sFileName.'.tgz', 'gz');
}
}
?>

View file

@ -0,0 +1,65 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Manage compression of many files to one compressed file (gz or bz2)
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* Include Archive_Tar
*/
include_once 'Archive/Tar.php';
/**
* PHP_Beautifier_Batch_FilesGz
*
* Manage compression of many files to one compressed file (gz or bz2)
*
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
abstract class PHP_Beautifier_Batch_Output_DirectoryTar extends PHP_Beautifier_Batch_Output {
public function save()
{
$aInputFiles = $this->oBatch->getInputFiles();
$sOutputPath = $this->oBatch->getOutputPath();
$aOutputFiles = PHP_Beautifier_Common::getSavePath($aInputFiles, $sOutputPath);
for ($x = 0;$x<count($aInputFiles);$x++) {
unset($oTar);
$oTar = $this->getTar($aOutputFiles[$x]);
$this->beautifierSetInputFile($aInputFiles[$x]);
$this->beautifierProcess();
PHP_Beautifier_Common::createDir($aOutputFiles[$x]);
$oTar->addString(basename($aOutputFiles[$x]) , $this->beautifierGet());
}
return true;
}
/**
* @todo implements this
*/
protected function getTar($sFileName)
{
}
}
?>

View file

@ -0,0 +1,86 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* PHP_Beautifier_Batch_Files
* Handle the batch process for one/multiple php files to one out
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* PHP_Beautifier_Batch_Files
* Handle the batch process for one/multiple php files to one out
*
* @category PHP
* @package PHP_Beautifier
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
class PHP_Beautifier_Batch_Output_Files extends PHP_Beautifier_Batch_Output {
public function get()
{
$aInputFiles = $this->oBatch->getInputFiles();
if (count($aInputFiles) == 1) {
$this->beautifierSetInputFile(reset($aInputFiles));
$this->beautifierProcess();
return $this->beautifierGet();
} else {
$sText = '';
foreach($aInputFiles as $sFile) {
$this->beautifierSetInputFile($sFile);
$this->beautifierProcess();
$sText.= $this->getWithHeader($sFile);
}
return $sText;
}
}
private function getWithHeader($sFile)
{
$sNewLine = $this->oBatch->callBeautifier($this, 'getNewLine');
$sHeader = '- BEGIN OF '.$sFile.' -'.$sNewLine;
$sLine = str_repeat('-', strlen($sHeader) -1) .$sNewLine;
$sEnd = '- END OF '.$sFile.str_repeat(' ', strlen($sHeader) -strlen($sFile) -12) .' -'.$sNewLine;
$sText = $sLine.$sHeader.$sLine.$sNewLine;
$sText.= $this->beautifierGet();
$sText.= $sNewLine.$sLine.$sEnd.$sLine.$sNewLine;
return $sText;
}
public function save()
{
$bCli = php_sapi_name() == 'cli';
$sFile = $this->oBatch->getOutputPath();
if ($bCli and $sFile == STDOUT) {
$fp = STDOUT;
} else {
$fp = fopen($this->oBatch->getOutputPath() , "w");
}
if (!$fp) {
throw (new Exception("Can't save file $sFile"));
}
$sText = $this->get();
fputs($fp, $sText, strlen($sText));
if (!($bCli and $fp == STDOUT)) {
fclose($fp);
}
return true;
}
}
?>

View file

@ -0,0 +1,44 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Handle the batch process for one/multiple php files to one tar bzip2 file
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* Include PHP_Beautifier_Batch_FilesGz
*/
require_once 'FilesTar.php';
/**
* Handle the batch process for one/multiple php files to one tar bzip2 file
*
* @category PHP
* @package PHP_Beautifier
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
class PHP_Beautifier_Batch_Output_FilesBz2 extends PHP_Beautifier_Batch_Output_FilesTar {
protected $sCompress = 'bz2';
protected $sExt = 'tar.bz2';
}
?>

View file

@ -0,0 +1,43 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Handle the batch process for one/multiple php files to one tar gzip file
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* Include PHP_Beautifier_Batch_FilesGz
*/
require_once 'FilesTar.php';
/**
* Handle the batch process for one/multiple php files to one tar gzip file
*
* @category PHP
* @package PHP_Beautifier
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
class PHP_Beautifier_Batch_Output_FilesGz extends PHP_Beautifier_Batch_Output_FilesTar {
protected $sCompress = 'gz';
protected $sExt = 'tgz';
}
?>

View file

@ -0,0 +1,65 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Handle the batch process for one/multiple php files to one tar compressed file
*
* PHP version 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
* @category PHP
* @package PHP_Beautifier
* @subpackage Batch
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id:$
*/
/**
* Require Archive_Tar
*/
include_once 'Archive/Tar.php';
/**
* Handle the batch process for one/multiple php files to one tar compressed file
* @category PHP
* @package PHP_Beautifier
* @author Claudio Bustos <cdx@users.sourceforge.com>
* @copyright 2004-2006 Claudio Bustos
* @link http://pear.php.net/package/PHP_Beautifier
* @link http://beautifyphp.sourceforge.net
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 0.1.14
*/
class PHP_Beautifier_Batch_Output_FilesTar extends PHP_Beautifier_Batch_Output {
protected $oTar;
protected $sCompress=false;
protected $sExt="tar";
public function __construct(PHP_Beautifier_Batch $oBatch)
{
parent::__construct($oBatch);
$sOutput = $this->oBatch->getOutputPath();
$sOutput = preg_replace("/(\.tar|\.tar\.gz|\.tgz|\.gz|\.tar\.bz2)$/", '', $sOutput) .".".$this->sExt;
PHP_Beautifier_Common::createDir($sOutput);
$this->oTar = new Archive_Tar($sOutput, $this->sCompress);
}
public function get()
{
throw (new Exception("TODO"));
}
public function save()
{
$aInputFiles = $this->oBatch->getInputFiles();
$aOutputFiles = PHP_Beautifier_Common::getSavePath($aInputFiles);
for ($x = 0;$x<count($aInputFiles);$x++) {
$this->beautifierSetInputFile($aInputFiles[$x]);
$this->beautifierProcess();
$this->oTar->addString($aOutputFiles[$x], $this->beautifierGet());
}
}
}
?>