WhitespaceClean-resources/others

whitespace pass over files
for reference regex that was used s/[ \t]+(\r?\n)/\1/
This commit is contained in:
mafoo
2016-03-11 13:57:01 +00:00
parent 66ba2802bd
commit 5e97c0df2c
18 changed files with 166 additions and 166 deletions

View File

@@ -44,7 +44,7 @@ class FPDI extends FPDF_TPL
* @var fpdi_pdf_parser[]
*/
public $parsers = array();
/**
* Current parser
*
@@ -65,7 +65,7 @@ class FPDI extends FPDF_TPL
* @var array
*/
protected $_objStack;
/**
* Done object stack
*
@@ -79,14 +79,14 @@ class FPDI extends FPDF_TPL
* @var integer
*/
protected $_currentObjId;
/**
* Cache for imported pages/template ids
*
* @var array
*/
protected $_importedPages = array();
/**
* Set a source-file.
*
@@ -103,7 +103,7 @@ class FPDI extends FPDF_TPL
$filename = $_filename;
$this->currentFilename = $filename;
if (!isset($this->parsers[$filename])) {
$this->parsers[$filename] = $this->_getPdfParser($filename);
$this->setPdfVersion(
@@ -112,10 +112,10 @@ class FPDI extends FPDF_TPL
}
$this->currentParser =& $this->parsers[$filename];
return $this->parsers[$filename]->getPageCount();
}
/**
* Returns a PDF parser object
*
@@ -127,7 +127,7 @@ class FPDI extends FPDF_TPL
require_once('fpdi_pdf_parser.php');
return new fpdi_pdf_parser($filename);
}
/**
* Get the current PDF version.
*
@@ -137,7 +137,7 @@ class FPDI extends FPDF_TPL
{
return $this->PDFVersion;
}
/**
* Set the PDF version.
*
@@ -147,7 +147,7 @@ class FPDI extends FPDF_TPL
{
$this->PDFVersion = sprintf('%.1F', $version);
}
/**
* Import a page.
*
@@ -178,7 +178,7 @@ class FPDI extends FPDF_TPL
if ($this->_inTpl) {
throw new LogicException('Please import the desired pages before creating a new template.');
}
$fn = $this->currentFilename;
$boxName = '/' . ltrim($boxName, '/');
@@ -187,16 +187,16 @@ class FPDI extends FPDF_TPL
if (isset($this->_importedPages[$pageKey])) {
return $this->_importedPages[$pageKey];
}
$parser = $this->parsers[$fn];
$parser->setPageNo($pageNo);
if (!in_array($boxName, $parser->availableBoxes)) {
throw new InvalidArgumentException(sprintf('Unknown box: %s', $boxName));
}
$pageBoxes = $parser->getPageBoxes($pageNo, $this->k);
/**
* MediaBox
* CropBox: Default -> MediaBox
@@ -208,14 +208,14 @@ class FPDI extends FPDF_TPL
$boxName = '/CropBox';
if (!isset($pageBoxes[$boxName]) && $boxName == '/CropBox')
$boxName = '/MediaBox';
if (!isset($pageBoxes[$boxName]))
return false;
$this->lastUsedPageBox = $boxName;
$box = $pageBoxes[$boxName];
$this->tpl++;
$this->_tpls[$this->tpl] = array();
$tpl =& $this->_tpls[$this->tpl];
@@ -230,33 +230,33 @@ class FPDI extends FPDF_TPL
// To build an array that can be used by PDF_TPL::useTemplate()
$this->_tpls[$this->tpl] = array_merge($this->_tpls[$this->tpl], $box);
// An imported page will start at 0,0 all the time. Translation will be set in _putformxobjects()
$tpl['x'] = 0;
$tpl['y'] = 0;
// handle rotated pages
$rotation = $parser->getPageRotation($pageNo);
$tpl['_rotationAngle'] = 0;
if (isset($rotation[1]) && ($angle = $rotation[1] % 360) != 0) {
$steps = $angle / 90;
$_w = $tpl['w'];
$_h = $tpl['h'];
$tpl['w'] = $steps % 2 == 0 ? $_w : $_h;
$tpl['h'] = $steps % 2 == 0 ? $_h : $_w;
if ($angle < 0)
$angle += 360;
$tpl['_rotationAngle'] = $angle * -1;
}
$this->_importedPages[$pageKey] = $this->tpl;
return $this->tpl;
}
/**
* Returns the last used page boundary box.
*
@@ -295,12 +295,12 @@ class FPDI extends FPDF_TPL
$size = $this->getTemplateSize($tplIdx, $w, $h);
$orientation = $size['w'] > $size['h'] ? 'L' : 'P';
$size = array($size['w'], $size['h']);
if (is_subclass_of($this, 'TCPDF')) {
$this->setPageFormat($size, $orientation);
} else {
$size = $this->_getpagesize($size);
if($orientation != $this->CurOrientation ||
$size[0] != $this->CurPageSize[0] ||
$size[1] != $this->CurPageSize[1]
@@ -320,16 +320,16 @@ class FPDI extends FPDF_TPL
$this->CurPageSize = $size;
$this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
}
}
}
}
$this->_out('q 0 J 1 w 0 j 0 G 0 g'); // reset standard values
$size = parent::useTemplate($tplIdx, $x, $y, $w, $h);
$this->_out('Q');
return $size;
}
/**
* Copy all imported objects to the resulting document.
*/
@@ -373,33 +373,33 @@ class FPDI extends FPDF_TPL
foreach($this->_tpls AS $tplIdx => $tpl) {
$this->_newobj();
$currentN = $this->n; // TCPDF/Protection: rem current "n"
$this->_tpls[$tplIdx]['n'] = $this->n;
$this->_out('<<' . $filter . '/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
(isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x']) * $this->k,
(isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y']) * $this->k,
(isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x']) * $this->k,
(isset($tpl['box']['ury']) ? $tpl['box']['ury'] : $tpl['h'] - $tpl['y']) * $this->k
));
$c = 1;
$s = 0;
$tx = 0;
$ty = 0;
if (isset($tpl['box'])) {
$tx = -$tpl['box']['llx'];
$ty = -$tpl['box']['lly'];
$ty = -$tpl['box']['lly'];
if ($tpl['_rotationAngle'] <> 0) {
$angle = $tpl['_rotationAngle'] * M_PI/180;
$c = cos($angle);
$s = sin($angle);
switch($tpl['_rotationAngle']) {
case -90:
$tx = -$tpl['box']['lly'];
@@ -419,16 +419,16 @@ class FPDI extends FPDF_TPL
$tx = -$tpl['x'] * 2;
$ty = $tpl['y'] * 2;
}
$tx *= $this->k;
$ty *= $this->k;
if ($c != 1 || $s != 0 || $tx != 0 || $ty != 0) {
$this->_out(sprintf('/Matrix [%.5F %.5F %.5F %.5F %.5F %.5F]',
$c, $s, -$s, $c, $tx, $ty
));
}
$this->_out('/Resources ');
if (isset($tpl['resources'])) {
@@ -484,7 +484,7 @@ class FPDI extends FPDF_TPL
$this->_out('endobj');
$this->n = $newN; // TCPDF: reset to new "n"
}
$this->_putimportedobjects();
}
@@ -509,7 +509,7 @@ class FPDI extends FPDF_TPL
$this->_out($objId . ' 0 obj');
$this->_currentObjId = $objId; // for later use with encryption
}
return $objId;
}
@@ -525,7 +525,7 @@ class FPDI extends FPDF_TPL
if (is_subclass_of($this, 'TCPDF')) {
parent::_prepareValue($value);
}
switch ($value[0]) {
case pdf_parser::TYPE_TOKEN:
@@ -539,7 +539,7 @@ class FPDI extends FPDF_TPL
$this->_straightOut($value[1] . ' ');
}
break;
case pdf_parser::TYPE_ARRAY:
// An array. Output the proper
@@ -600,7 +600,7 @@ class FPDI extends FPDF_TPL
$this->_out($value[2][1]);
$this->_straightOut("endstream");
break;
case pdf_parser::TYPE_HEX:
$this->_straightOut('<' . $value[1] . '>');
break;
@@ -608,7 +608,7 @@ class FPDI extends FPDF_TPL
case pdf_parser::TYPE_BOOLEAN:
$this->_straightOut($value[1] ? 'true ' : 'false ');
break;
case pdf_parser::TYPE_NULL:
// The null object.
@@ -616,8 +616,8 @@ class FPDI extends FPDF_TPL
break;
}
}
/**
* Modified _out() method so not each call will add a newline to the output.
*/
@@ -664,7 +664,7 @@ class FPDI extends FPDF_TPL
parent::_enddoc();
$this->_closeParsers();
}
/**
* Close all files opened by parsers.
*
@@ -679,7 +679,7 @@ class FPDI extends FPDF_TPL
return false;
}
/**
* Removes cycled references and closes the file handles of the parser objects.
*/

View File

@@ -32,35 +32,35 @@ class fpdi_pdf_parser extends pdf_parser
* @var array
*/
protected $_pages;
/**
* Page count
*
* @var integer
*/
protected $_pageCount;
/**
* Current page number
*
* @var integer
*/
public $pageNo;
/**
* PDF version of imported document
*
* @var string
*/
public $_pdfVersion;
/**
* Available BoxTypes
*
* @var array
*/
public $availableBoxes = array('/MediaBox', '/CropBox', '/BleedBox', '/TrimBox', '/ArtBox');
/**
* The constructor.
*
@@ -75,11 +75,11 @@ class fpdi_pdf_parser extends pdf_parser
// Read pages
$this->_readPages($pages, $this->_pages);
// count pages;
$this->_pageCount = count($this->_pages);
}
/**
* Get page count from source file.
*
@@ -106,7 +106,7 @@ class fpdi_pdf_parser extends pdf_parser
$this->pageNo = $pageNo;
}
/**
* Get page-resources from current page
*
@@ -116,7 +116,7 @@ class fpdi_pdf_parser extends pdf_parser
{
return $this->_getPageResources($this->_pages[$this->pageNo]);
}
/**
* Get page-resources from a /Page dictionary.
*
@@ -158,14 +158,14 @@ class fpdi_pdf_parser extends pdf_parser
public function getContent()
{
$buffer = '';
if (isset($this->_pages[$this->pageNo][1][1]['/Contents'])) {
$contents = $this->_getPageContent($this->_pages[$this->pageNo][1][1]['/Contents']);
foreach ($contents AS $tmpContent) {
$buffer .= $this->_unFilterStream($tmpContent) . ' ';
}
}
return $buffer;
}
@@ -178,7 +178,7 @@ class fpdi_pdf_parser extends pdf_parser
protected function _getPageContent($contentRef)
{
$contents = array();
if ($contentRef[0] == pdf_parser::TYPE_OBJREF) {
$content = $this->resolveObject($contentRef);
if ($content[1][0] == pdf_parser::TYPE_ARRAY) {
@@ -213,12 +213,12 @@ class fpdi_pdf_parser extends pdf_parser
if (isset($page[1][1][$boxIndex])) {
$box = $page[1][1][$boxIndex];
}
if (!is_null($box) && $box[0] == pdf_parser::TYPE_OBJREF) {
$tmp_box = $this->resolveObject($box);
$box = $tmp_box[1];
}
if (!is_null($box) && $box[0] == pdf_parser::TYPE_ARRAY) {
$b = $box[1];
return array(
@@ -240,7 +240,7 @@ class fpdi_pdf_parser extends pdf_parser
/**
* Get all page boundary boxes by page number
*
*
* @param int $pageNo The page number
* @param float $k Scale factor from user space units to points
* @return array
@@ -254,7 +254,7 @@ class fpdi_pdf_parser extends pdf_parser
return $this->_getPageBoxes($this->_pages[$pageNo - 1], $k);
}
/**
* Get all boxes from /Page dictionary
*