This commit is contained in:
Laurent Destailleur 2023-02-09 15:58:28 +01:00
parent 5ae079b018
commit 04c0272d05

View File

@ -24,10 +24,10 @@ class OdfException extends Exception
class Odf
{
protected $config = array(
'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}',
'PATH_TO_TMP' => '/tmp'
'ZIP_PROXY' => 'PclZipProxy', // PclZipProxy, PhpZipProxy
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}',
'PATH_TO_TMP' => '/tmp'
);
protected $file;
protected $contentXml; // To store content of content.xml file
@ -152,12 +152,12 @@ class Odf
}
/**
* Replaces html tags in odt tags and returns a compatible string
* Replaces html tags found into the $value with ODT compatible tags and return the converted compatible string
*
* @param string $value Replacement value
* @param bool $encode If true, special XML characters are encoded
* @param string $charset Charset
* @return string
* @param string $value Replacement value
* @param bool $encode If true, special XML characters are encoded
* @param string $charset Charset
* @return string String in ODTsyntax format
*/
public function convertVarToOdf($value, $encode = true, $charset = 'ISO-8859')
{
@ -203,15 +203,18 @@ class Odf
}
}
$this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml);
} else $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $value);
} else {
$convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $value);
}
return $convertedValue;
}
/**
* Replaces html tags in with odt tags and returns an odt string
* @param array $tags An array with html tags generated by the getDataFromHtml() function
* @param array $customStyles An array of style defenitions that should be included inside the odt file
*
* @param array $tags An array with html tags generated by the getDataFromHtml() function
* @param array $customStyles An array of style defenitions that should be included inside the odt file
* @param array $fontDeclarations An array of font declarations that should be included inside the odt file
* @return string
*/