preg_match_all('/[\{\<]\?(php)?\s+(?P<content>.+)\?[\}\>]/iU',$this->contentXml,$matches);// detecting all {?php code ?} or <?php code ? >
for($i=0;$i<count($matches['content']);$i++){
$nbfound=count($matches['content']);
for($i=0;$i<$nbfound;$i++)
{
try{
$ob_output='';// flush the output for each code. This var will be filled in by the eval($code) and output buffering : any print or echo or output will be redirected into this variable
$code=$matches['content'][$i];
...
...
@@ -247,13 +251,18 @@ IMG;
/**
* Move segment tags for lines of tables
* Called automatically within the constructor
* This function is called automatically within the constructor, so this->contentXml is clean before any other thing
*
* @return void
*/
privatefunction_moveRowSegments()
{
// Search all possible rows in the document
// Replace BEGIN<text:s/>xxx into BEGIN xxx
$this->contentXml=preg_replace('/\[!--\sBEGIN<text:s[^>]>(row.[\S]*)\s--\]/sm','[!-- BEGIN \\1 --]',$this->contentXml);
// Replace END<text:s/>xxx into END xxx
$this->contentXml=preg_replace('/\[!--\sEND<text:s[^>]>(row.[\S]*)\s--\]/sm','[!-- END \\1 --]',$this->contentXml);
thrownewOdfException("'$segment' segment not found in the document");
thrownewOdfException("'".$segment."' segment not found in the document. The tag [!-- BEGIN xxx --] or [!-- END xxx --] is not present into content file.");