Browse Source

php7 compatible

- nouvelle version de la librairie et adaptation aux nouvelles méthodes
- appel correct de constructeur de classe
- appel correct de constante
- passage correct de string
- appel correct des fonctions de callback sur preg_replace
svn/attic/article_pdf/branches/php7/112961
maieul@maieul.net 3 years ago
parent
commit
f9a145dab3
  1. 4
      article_pdf_options.php
  2. 1
      paquet.xml
  3. 11
      pdf/lib_pdf_global.php
  4. 2
      pdf/lib_pdf_spip.php

4
article_pdf_options.php

@ -12,7 +12,7 @@ if (!defined('_DIR_STOCK_PDF')) {
}
if (!defined('_DIR_LIB')) define('_DIR_LIB', _DIR_RACINE . 'lib/');
if (!defined('_DIR_FPDF_LIB')) define('_DIR_FPDF_LIB', _DIR_LIB . 'h5c1accba-fpdf17/');
if (!defined('_DIR_FPDF_LIB')) define('_DIR_FPDF_LIB', _DIR_LIB . 'h5c1accba-fpdf181/');
function balise_ARTICLE_PDF_dist($p) {
if (!is_array($p->param))
@ -74,4 +74,4 @@ function balise_RUBRIQUE_PDF_dist($p) {
if (!function_exists($f = 'balise_modele'))
$f = 'balise_modele_dist';
return $f($p);
}
}

1
paquet.xml

@ -19,6 +19,5 @@
<pipeline nom="build_pdf" inclure="article_pdf_pipelines.php" />
<lib nom="h5c1accba-fpdf181" lien="http://www.fpdf.org/fr/download/fpdf181.zip" />
<necessite nom="PHP" compatibilite="[7;]" />
</paquet>

11
pdf/lib_pdf_global.php

@ -7,7 +7,7 @@
*/
// Fichier de dump pour debug
define (DUMP_FILE_FULL_PATH_NAME,"Dump.txt");
define ('DUMP_FILE_FULL_PATH_NAME',"Dump.txt");
class PDF extends FPDF
{
@ -47,12 +47,9 @@ var $CurrentTag=array();
function Build($OutputFileFullPathName)
{
$this->Open();
$this->BuildDocument() ;
$this->Output($OutputFileFullPathName);
$this->Output('F', $OutputFileFullPathName);
$this->Close();
}
@ -73,7 +70,7 @@ function AddCol($field=-1,$width=-1,$align='L')
function PDF($orientation='P', $unit='mm', $format='A4')
{
//Appel au constructeur parent
$this->FPDF($orientation, $unit, $format);
$this->__construct($orientation, $unit, $format);
$this->SetCompression(1);
//$this->InitDumpFile();
@ -86,7 +83,7 @@ function unhtmlentities($string)
$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
$ret = strtr ($string, $trans_tbl);
return preg_replace('/&#(\d+);/me', "chr('\\1')",$ret);
return preg_replace_callback('/&#(\d+);/m', chr($matches[1]),$ret);
}
function WriteHTML($html,$LineFeedHeight)

2
pdf/lib_pdf_spip.php

@ -17,7 +17,7 @@ function SetAllMargins($TopMargin, $LeftMargin, $BottomMargin, $RightMargin)
$this->SetMargins($LeftMargin,$TopMargin,$RightMargin);
// bas
$this->SetAutoPageBreak(auto, $BottomMargin*3/2);
$this->SetAutoPageBreak('auto', $BottomMargin*3/2);
}

Loading…
Cancel
Save