From 60ab8fdd1b0f9b3fb69dae9b6a7e666a7a53e768 Mon Sep 17 00:00:00 2001 From: Andreas Oesterreicher Date: Wed, 7 Jun 2017 18:16:11 +0200 Subject: [PATCH] Fixed PHP7 Depecated Warnings --- content/statistik/mitarbeiterexport.xls.php | 26 +++--- include/Excel/BIFFwriter.php | 2 +- include/Excel/File.php | 4 +- include/Excel/Format.php | 14 ++-- include/Excel/OLE.php | 2 +- include/Excel/PEAR.php | 4 +- include/Excel/PPS.php | 2 +- include/Excel/Parser.php | 2 +- include/Excel/Root.php | 4 +- include/Excel/Validator.php | 2 +- include/Excel/Workbook.php | 4 +- include/Excel/Worksheet.php | 4 +- include/Excel/Writer.php | 4 +- include/xslfo2pdf/fpdf/fpdf.php | 2 +- include/xslfo2pdf/fpdf/myfpdf.php | 90 ++++++++++----------- 15 files changed, 83 insertions(+), 83 deletions(-) diff --git a/content/statistik/mitarbeiterexport.xls.php b/content/statistik/mitarbeiterexport.xls.php index 8ad9b8c5c..31463b29c 100644 --- a/content/statistik/mitarbeiterexport.xls.php +++ b/content/statistik/mitarbeiterexport.xls.php @@ -93,7 +93,7 @@ $mitarbeiterDAO->getPersonal($fix, $stgl, $fbl, $aktiv, $karenziert, $ausgeschie //sondern richtig mitsortiert $vorname=array(); $nachname=array(); - + $umlaute = array('ö','Ö','ü','Ü','ä','Ä'); $umlauterep = array('o','O','u','U','a','A'); foreach ($mitarbeiterDAO->result as $key=>$foo) @@ -102,7 +102,7 @@ foreach ($mitarbeiterDAO->result as $key=>$foo) $nachname[$key]=str_replace($umlaute, $umlauterep, $foo->nachname); } array_multisort($nachname, SORT_ASC, $vorname, SORT_ASC, $mitarbeiterDAO->result); - + // Creating a workbook $workbook = new Spreadsheet_Excel_Writer(); $workbook->setVersion(8); @@ -112,7 +112,7 @@ array_multisort($nachname, SORT_ASC, $vorname, SORT_ASC, $mitarbeiterDAO->result // Creating a worksheet $worksheet =& $workbook->addWorksheet("Mitarbeiter"); $worksheet->setInputEncoding('utf-8'); - + $format_bold =& $workbook->addFormat(); $format_bold->setBold(); @@ -145,20 +145,20 @@ array_multisort($nachname, SORT_ASC, $vorname, SORT_ASC, $mitarbeiterDAO->result //Spalten ausgeben for ($i=0;$i<$anzSpalten;$i++) { - if(is_bool($mitarbeiter->$spalte[$i])) - $mitarbeiter->$spalte[$i] = ($mitarbeiter->$spalte[$i]?'Ja':'Nein'); - - if(mb_strlen($mitarbeiter->$spalte[$i])>$maxlength[$i]) - $maxlength[$i] = mb_strlen($mitarbeiter->$spalte[$i]); - $worksheet->write($j,$i, $mitarbeiter->$spalte[$i]); + if(is_bool($mitarbeiter->{$spalte[$i]})) + $mitarbeiter->{$spalte[$i]} = ($mitarbeiter->{$spalte[$i]}?'Ja':'Nein'); + + if(mb_strlen($mitarbeiter->{$spalte[$i]})>$maxlength[$i]) + $maxlength[$i] = mb_strlen($mitarbeiter->{$spalte[$i]}); + $worksheet->write($j,$i, $mitarbeiter->{$spalte[$i]}); } - + //Zustelladresse aus der Datenbank holen und dazuhaengen $qry = "SELECT * FROM public.tbl_adresse WHERE person_id='$mitarbeiter->person_id' AND zustelladresse=true LIMIT 1"; if($result = $db->db_query($qry)) { if($row = $db->db_fetch_object($result)) - { + { if(mb_strlen($row->strasse)>$maxlength[$i]) $maxlength[$i]=mb_strlen($row->strasse); $worksheet->write($j,$i, $row->strasse); @@ -168,7 +168,7 @@ array_multisort($nachname, SORT_ASC, $vorname, SORT_ASC, $mitarbeiterDAO->result if(mb_strlen($row->ort)>$maxlength[$i+2]) $maxlength[$i+2]=mb_strlen($row->ort); $worksheet->write($j,$i+2, $row->ort); - + if($row->firma_id!='') { $qry = "SELECT * FROM public.tbl_firma WHERE firma_id='$row->firma_id'"; @@ -184,7 +184,7 @@ array_multisort($nachname, SORT_ASC, $vorname, SORT_ASC, $mitarbeiterDAO->result } } } - + $j++; } diff --git a/include/Excel/BIFFwriter.php b/include/Excel/BIFFwriter.php index c8fbb1bd1..f6b659fa1 100644 --- a/include/Excel/BIFFwriter.php +++ b/include/Excel/BIFFwriter.php @@ -88,7 +88,7 @@ class Spreadsheet_Excel_Writer_BIFFwriter extends PEAR * * @access public */ - function Spreadsheet_Excel_Writer_BIFFwriter() + function __construct() { $this->_byte_order = ''; $this->_data = ''; diff --git a/include/Excel/File.php b/include/Excel/File.php index ec2c8376e..090ebe6c5 100644 --- a/include/Excel/File.php +++ b/include/Excel/File.php @@ -43,10 +43,10 @@ class OLE_PPS_File extends OLE_PPS * @param string $name The name of the file (in Unicode) * @see OLE::Asc2Ucs() */ - function OLE_PPS_File($name) + function __construct($name) { $this->_tmp_dir = ''; - $this->OLE_PPS( + parent::__construct( null, $name, OLE_PPS_TYPE_FILE, diff --git a/include/Excel/Format.php b/include/Excel/Format.php index 829c3e353..074ec6cec 100644 --- a/include/Excel/Format.php +++ b/include/Excel/Format.php @@ -248,7 +248,7 @@ class Spreadsheet_Excel_Writer_Format extends PEAR * @param integer $index the XF index for the format. * @param array $properties array with properties to be set on initialization. */ - function Spreadsheet_Excel_Writer_Format($BIFF_version, $index = 0, $properties = array()) + function __construct($BIFF_version, $index = 0, $properties = array()) { $this->_xf_index = $index; $this->_BIFF_version = $BIFF_version; @@ -431,12 +431,12 @@ class Spreadsheet_Excel_Writer_Format extends PEAR //$rotation = 0x00; //oesi fix rotation mit utf8 switch($this->_rotation) - { - case 0: $rotation = 0; break; - case 1: $rotation = 255; break; - case 2: $rotation = 90; break; - case 3: $rotation = 180; break; - default: $rotation = 0; break; + { + case 0: $rotation = 0; break; + case 1: $rotation = 255; break; + case 2: $rotation = 90; break; + case 3: $rotation = 180; break; + default: $rotation = 0; break; } $biff8_options = 0x00; $data = pack("vvvC", $ifnt, $ifmt, $style, $align); diff --git a/include/Excel/OLE.php b/include/Excel/OLE.php index 9cbf18742..bda705b88 100644 --- a/include/Excel/OLE.php +++ b/include/Excel/OLE.php @@ -57,7 +57,7 @@ class OLE extends PEAR * Remember to use ampersand when creating an OLE object ($my_ole =& new OLE();) * @access public */ - function OLE() + function __construct() { $this->_list = array(); } diff --git a/include/Excel/PEAR.php b/include/Excel/PEAR.php index cf9724bc9..09f980021 100644 --- a/include/Excel/PEAR.php +++ b/include/Excel/PEAR.php @@ -167,7 +167,7 @@ class PEAR * @access public * @return void */ - function PEAR($error_class = null) + function __construct($error_class = null) { $classname = strtolower(get_class($this)); if ($this->_debug) { @@ -842,7 +842,7 @@ class PEAR_Error * @access public * */ - function PEAR_Error($message = 'unknown error', $code = null, + function __construct($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { if ($mode === null) { diff --git a/include/Excel/PPS.php b/include/Excel/PPS.php index 38ddbf926..ffb1e033f 100644 --- a/include/Excel/PPS.php +++ b/include/Excel/PPS.php @@ -116,7 +116,7 @@ class OLE_PPS extends PEAR * @param integer $time_2nd A timestamp * @param array $children Array containing children PPS for this PPS */ - function OLE_PPS($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children) + function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children) { $this->No = $No; $this->Name = $name; diff --git a/include/Excel/Parser.php b/include/Excel/Parser.php index 5d7a7e169..79a5eeb76 100644 --- a/include/Excel/Parser.php +++ b/include/Excel/Parser.php @@ -164,7 +164,7 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR * @param integer $byte_order The byte order (Little endian or Big endian) of the architecture (optional). 1 => big endian, 0 (default) little endian. */ - function Spreadsheet_Excel_Writer_Parser($byte_order, $biff_version) + function __construct($byte_order, $biff_version) { $this->_current_char = 0; $this->_BIFF_version = $biff_version; diff --git a/include/Excel/Root.php b/include/Excel/Root.php index e3fd631dc..dc883f633 100644 --- a/include/Excel/Root.php +++ b/include/Excel/Root.php @@ -43,11 +43,11 @@ class OLE_PPS_Root extends OLE_PPS * @param integer $time_1st A timestamp * @param integer $time_2nd A timestamp */ - function OLE_PPS_Root($time_1st, $time_2nd, $raChild) + function __construct($time_1st, $time_2nd, $raChild) { $ole_obj = new OLE(); $this->_tmp_dir = ''; - $this->OLE_PPS( + parent::__construct( null, $ole_obj->Asc2Ucs('Root Entry'), OLE_PPS_TYPE_ROOT, diff --git a/include/Excel/Validator.php b/include/Excel/Validator.php index 9a776c6c3..cf68c57e3 100644 --- a/include/Excel/Validator.php +++ b/include/Excel/Validator.php @@ -66,7 +66,7 @@ class Spreadsheet_Excel_Writer_Validator */ var $_parser; - function Spreadsheet_Excel_Writer_Validator(&$parser) + function __construct(&$parser) { $this->_parser = $parser; $this->_type = 0x01; // FIXME: add method for setting datatype diff --git a/include/Excel/Workbook.php b/include/Excel/Workbook.php index f8d1149cd..a0fb64eb9 100644 --- a/include/Excel/Workbook.php +++ b/include/Excel/Workbook.php @@ -171,10 +171,10 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri * @param string filename for storing the workbook. "-" for writing to stdout. * @access public */ - function Spreadsheet_Excel_Writer_Workbook($filename) + function __construct($filename) { // It needs to call its parent's constructor explicitly - $this->Spreadsheet_Excel_Writer_BIFFwriter(); + parent::__construct(); $this->_filename = $filename; $this->_parser = new Spreadsheet_Excel_Writer_Parser($this->_byte_order, $this->_BIFF_version); diff --git a/include/Excel/Worksheet.php b/include/Excel/Worksheet.php index e92a2beed..0a5d3fbed 100644 --- a/include/Excel/Worksheet.php +++ b/include/Excel/Worksheet.php @@ -364,14 +364,14 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr * @param mixed &$parser The formula parser created for the Workbook * @access private */ - function Spreadsheet_Excel_Writer_Worksheet($BIFF_version, $name, + function __construct($BIFF_version, $name, $index, &$activesheet, &$firstsheet, &$str_total, &$str_unique, &$str_table, &$url_format, &$parser) { // It needs to call its parent's constructor explicitly - $this->Spreadsheet_Excel_Writer_BIFFwriter(); + parent::__construct(); $this->_BIFF_version = $BIFF_version; $rowmax = 65536; // 16384 in Excel 5 $colmax = 256; diff --git a/include/Excel/Writer.php b/include/Excel/Writer.php index 4ae1e04d2..90e62b3f5 100644 --- a/include/Excel/Writer.php +++ b/include/Excel/Writer.php @@ -49,10 +49,10 @@ class Spreadsheet_Excel_Writer extends Spreadsheet_Excel_Writer_Workbook * @param string $filename The optional filename for the Workbook. * @return Spreadsheet_Excel_Writer_Workbook The Workbook created */ - function Spreadsheet_Excel_Writer($filename = '') + function __construct($filename = '') { $this->_filename = $filename; - $this->Spreadsheet_Excel_Writer_Workbook($filename); + parent::__construct($filename); } /** diff --git a/include/xslfo2pdf/fpdf/fpdf.php b/include/xslfo2pdf/fpdf/fpdf.php index d2d23b3fb..11dfb5b98 100644 --- a/include/xslfo2pdf/fpdf/fpdf.php +++ b/include/xslfo2pdf/fpdf/fpdf.php @@ -75,7 +75,7 @@ if(!class_exists('FPDF')) * Public methods * * * *******************************************************************************/ - function FPDF($orientation='P',$unit='mm',$format='A4') + function __construct($orientation='P',$unit='mm',$format='A4') { //Some checks $this->_dochecks(); diff --git a/include/xslfo2pdf/fpdf/myfpdf.php b/include/xslfo2pdf/fpdf/myfpdf.php index e1852c7bd..80ab014b5 100644 --- a/include/xslfo2pdf/fpdf/myfpdf.php +++ b/include/xslfo2pdf/fpdf/myfpdf.php @@ -25,7 +25,7 @@ require_once("fpdf.php"); class MyPdf extends FPDF { - + /** * Konstruktor * @@ -43,12 +43,12 @@ class MyPdf extends FPDF { * letter * legal */ - function MyPdf($orientation='P',$unit='mm',$format='A4') + function __construct($orientation='P',$unit='mm',$format='A4') { //Call parent constructor $this->FPDF($orientation,$unit,$format); } - + /** * Additional getter methods **/ @@ -79,14 +79,14 @@ class MyPdf extends FPDF { function GetPageWidth() { return $this->w-$this->rMargin-$this->lMargin; } - + function GetLineWidth() { return $this->LineWidth; } function FontExists($family, $style='') { $fontkey=$family.$style; - return isset($this->fonts[$fontkey]) || + return isset($this->fonts[$fontkey]) || isset($this->CoreFonts[$fontkey]); } @@ -94,7 +94,7 @@ class MyPdf extends FPDF { * Methods to capture output */ function startCapture() { - if($this->state==2) { + if($this->state==2) { $buf = $this->pages[$this->page]; $this->pages[$this->page] = ""; return $buf; @@ -103,11 +103,11 @@ class MyPdf extends FPDF { $buf = $this->buffer; $this->buffer = ""; return $buf; - } + } } - function endCapture($buffer) { - if($this->state==2) { + function endCapture($buffer) { + if($this->state==2) { $buf = $this->pages[$this->page]; $this->pages[$this->page] = $buffer; return $buf; @@ -116,17 +116,17 @@ class MyPdf extends FPDF { $buf = $this->buffer; $this->buffer = $buffer; return $buf; - } + } } function appendBuffer($buffer) { - if($this->state==2) { + if($this->state==2) { $this->pages[$this->page] .= $buffer; } else { $this->buffer .= $buffer; } - + } /** @@ -165,14 +165,14 @@ class MyPdf extends FPDF { * Write string regarding to \n as line breaks * Return an array containing number of line, width and height * of this textual block. The align paramtere accepts L, R and C - * get values using: + * get values using: * list($width, $height, $no, $firstX, $firstY, $lastX, $lastYl) = $pdf->Text2(); **/ function Text2($x, $y, $text, $align="L", $lineHeight=NULL, $xNewLine=NULL, $width=NULL) { if (!$xNewLine) { $xNewLine = $x; } - + $lines = explode('\n', $text); $height = ($lineHeight)?$lineHeight:$this->FontSize; //oesi - add parameter width for set the content-width of fo:block @@ -187,29 +187,29 @@ class MyPdf extends FPDF { $maxWidth = 0; $sx = $x; $sy = $y; - foreach($lines as $line) - { - - $width = $this->GetStringWidth($line); - do + foreach($lines as $line) + { + + $width = $this->GetStringWidth($line); + do { - //$w=$this->w-$this->rMargin-$x; + //$w=$this->w-$this->rMargin-$x; $w = $pw-$x; //oesi - changed //echo "w:$w
"; //$wmax=($w-2*$this->cMargin)*1000/$this->FontSize; $noc = $this->GetNumberOfChars($w, $line); //echo "noc:$noc xNewLine: $xNewLine x:$x w:$w strlen:".strlen($line)." line:$line
"; - if ($noc == -1) + if ($noc == -1) { - if ($x == $xNewLine) + if ($x == $xNewLine) { //word has not enough space on one line, draw it beyond borders $noc = strlen($line); } - else + else { //echo "NEWLINE"; - if ($nb == 0) + if ($nb == 0) { $sy += $height; $sx = $xNewLine; @@ -221,12 +221,12 @@ class MyPdf extends FPDF { continue; } } - + $showLine = substr($line, 0, $noc); $textWidth = $this->GetStringWidth($showLine); //echo "showline: $showLine
"; //echo "nb:$nb x:$x w:$w textwidth:$textWidth showline:$showLine
"; - switch ($align) + switch ($align) { case "R": $tx = $pw-$textWidth; @@ -238,12 +238,12 @@ class MyPdf extends FPDF { default: $tx = $x; } - + $this->Text($tx, $y+$height, $showLine); $line = trim(substr($line, $noc)); $width = $this->GetStringWidth($line); - - if ($textWidth > $maxWidth) + + if ($textWidth > $maxWidth) { $maxWidth = $textWidth; } @@ -263,7 +263,7 @@ class MyPdf extends FPDF { return array($maxWidth, $tot_height, $nb, $sx, $sy, $tx+$textWidth, $y-$height); } - + /* This extension allows to set a dash pattern and draw dashed lines or rectangles. $pdf->SetDash(4,2); //4mm on, 2mm off @@ -327,22 +327,22 @@ class MyPdf extends FPDF { $yc = $y+$r; $this->_out(sprintf('%.2f %.2f l', $xc*$k,($hp-$y)*$k )); - $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, + $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc); $xc = $x+$w-$r ; $yc = $y+$h-$r; $this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k)); - $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, + $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r); $xc = $x+$r ; $yc = $y+$h-$r; $this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k)); - $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, + $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc); $xc = $x+$r ; $yc = $y+$r; $this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k )); - $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, + $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r); $this->_out($op); } @@ -352,7 +352,7 @@ class MyPdf extends FPDF { * $pdf->Rotate($angle,$x,$y); * $pdf->Text($x,$y,$txt); * $pdf->Rotate(0); - */ + */ function Rotate($angle,$x=-1,$y=-1) { if($x==-1) $x=$this->x; @@ -420,7 +420,7 @@ class MyPdf extends FPDF { $op = 'S'; break; } - + if ($rx) { if (!$ry) $ry = $rx; @@ -443,7 +443,7 @@ class MyPdf extends FPDF { $this->_out(sprintf('q %.2f %.2f %.2f %.2f %.2f %.2f cm', cos($a), -1 * sin($a), sin($a), cos($a), $x0*10, $y0*10)); $x0 = 0; $y0 = 0; - } + } $t1 = $astart; $a0 = $x0 + ($rx * cos($t1)); @@ -484,7 +484,7 @@ class MyPdf extends FPDF { $op='B'; else $op='S'; - + $this->_out(sprintf('h %s', $op)); } @@ -495,7 +495,7 @@ class MyPdf extends FPDF { $op='B'; else $op='S'; - + $this->_out(sprintf('%s', $op)); } @@ -520,7 +520,7 @@ class MyPdf extends FPDF { function _Point($x, $y) { $this->_out(sprintf('%.2f %.2f m', $x * $this->k, ($this->h - $y) * $this->k)); } - + // Draws a B�zier curve from last draw point // Parameters: // - x1, y1: Control point 1 @@ -528,9 +528,9 @@ class MyPdf extends FPDF { // - x3, y3: End point function _Curve($x1, $y1, $x2, $y2, $x3, $y3) { $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c', $x1 * $this->k, ($this->h - $y1) * $this->k, $x2 * $this->k, ($this->h - $y2) * $this->k, $x3 * $this->k, ($this->h - $y3) * $this->k)); - } + } + - // Draws a cubic B�zier curve from last draw point // Parameters: // - x2, y2: Control point 2 @@ -547,7 +547,7 @@ class MyPdf extends FPDF { function _CurveRef2($x1, $y1, $x3, $y3) { $this->_out(sprintf('%.2f %.2f %.2f %.2f y', $x1 * $this->k, ($this->h - $y1) * $this->k, $x3 * $this->k, ($this->h - $y3) * $this->k)); - } + } // Draws a line from last draw point // Parameters: @@ -593,7 +593,7 @@ class MyPdf extends FPDF { //echo "X2:$x0:$y0
"; //$x0 -= cos($a); //$y0 -= $ry * sin($a); - } + } $t1 = $astart; $a0 = $x0 + ($rx * cos($t1)); @@ -627,4 +627,4 @@ class MyPdf extends FPDF { } -?> \ No newline at end of file +?>