|
@@ -1,16 +1,20 @@
|
|
|
<?php
|
|
|
+
|
|
|
require 'Segment.php';
|
|
|
+
|
|
|
class OdfException extends Exception
|
|
|
-{}
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Templating class for odt file
|
|
|
* You need PHP 5.2 at least
|
|
|
* You need Zip Extension or PclZip library
|
|
|
*
|
|
|
- * @copyright GPL License 2008 - Julien Pauli - Cyril PIERRE de GEYER - Anaska (http://www.anaska.com)
|
|
|
- * @copyright GPL License 2010-2015 - Laurent Destailleur - eldy@users.sourceforge.net
|
|
|
- * @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
|
|
|
- * @copyright GPL License 2012 - Stephen Larroque - lrq3000@gmail.com
|
|
|
+ * @copyright 2008 - Julien Pauli - Cyril PIERRE de GEYER - Anaska (http://www.anaska.com)
|
|
|
+ * @copyright 2010-2015 - Laurent Destailleur - eldy@users.sourceforge.net
|
|
|
+ * @copyright 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com
|
|
|
+ * @copyright 2012 - Stephen Larroque - lrq3000@gmail.com
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GPL License
|
|
|
* @version 1.5.0
|
|
|
*/
|
|
@@ -43,7 +47,8 @@ class Odf
|
|
|
/**
|
|
|
* Class constructor
|
|
|
*
|
|
|
- * @param string $filename the name of the odt file
|
|
|
+ * @param string $filename The name of the odt file
|
|
|
+ * @param string $config Array of config data
|
|
|
* @throws OdfException
|
|
|
*/
|
|
|
public function __construct($filename, $config = array())
|
|
@@ -116,9 +121,10 @@ class Odf
|
|
|
/**
|
|
|
* Assing a template variable
|
|
|
*
|
|
|
- * @param string $key name of the variable within the template
|
|
|
- * @param string $value replacement value
|
|
|
- * @param bool $encode if true, special XML characters are encoded
|
|
|
+ * @param string $key Name of the variable within the template
|
|
|
+ * @param string $value Replacement value
|
|
|
+ * @param bool $encode If true, special XML characters are encoded
|
|
|
+ * @param string $charset Charset
|
|
|
* @throws OdfException
|
|
|
* @return odf
|
|
|
*/
|
|
@@ -129,7 +135,7 @@ class Odf
|
|
|
// <text:span text:style-name="T13">{</text:span><text:span text:style-name="T12">aaa</text:span><text:span text:style-name="T13">}</text:span>
|
|
|
// instead of {aaa} so we should enhance this function.
|
|
|
//print $key.'-'.$value.'-'.strpos($this->contentXml, $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT']).'<br>';
|
|
|
- if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml , $tag) === false) {
|
|
|
+ if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml, $tag) === false) {
|
|
|
//if (strpos($this->contentXml, '">'. $key . '</text;span>') === false) {
|
|
|
throw new OdfException("var $key not found in the document");
|
|
|
//}
|
|
@@ -577,6 +583,7 @@ IMG;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ dol_syslog(get_class($this).'::exportAsAttachedPDF is used but the constant MAIN_DOL_SCRIPTS_ROOT with path to script directory was not defined.', LOG_WARNING);
|
|
|
$command = '../../scripts/odt2pdf/odt2pdf.sh '.escapeshellcmd($name).' '.(is_numeric($conf->global->MAIN_ODT_AS_PDF)?'jodconverter':$conf->global->MAIN_ODT_AS_PDF);
|
|
|
}
|
|
|
|
|
@@ -642,7 +649,8 @@ IMG;
|
|
|
/**
|
|
|
* Returns a variable of configuration
|
|
|
*
|
|
|
- * @return string The requested variable of configuration
|
|
|
+ * @param string $configKey Config key
|
|
|
+ * @return string The requested variable of configuration
|
|
|
*/
|
|
|
public function getConfig($configKey)
|
|
|
{
|
|
@@ -678,7 +686,8 @@ IMG;
|
|
|
|
|
|
/**
|
|
|
* Empty the temporary working directory recursively
|
|
|
- * @param $dir the temporary working directory
|
|
|
+ *
|
|
|
+ * @param string $dir The temporary working directory
|
|
|
* @return void
|
|
|
*/
|
|
|
private function _rrmdir($dir)
|
|
@@ -701,8 +710,8 @@ IMG;
|
|
|
/**
|
|
|
* return the value present on odt in [valuename][/valuename]
|
|
|
*
|
|
|
- * @param string $value name balise in the template
|
|
|
- * @return string the value inside the balise
|
|
|
+ * @param string $valuename Balise in the template
|
|
|
+ * @return string The value inside the balise
|
|
|
*/
|
|
|
public function getvalue($valuename)
|
|
|
{
|