fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [17050] odt2xhtml: comply with php7


From: sigurdne
Subject: [Fmsystem-commits] [17050] odt2xhtml: comply with php7
Date: Sun, 10 Sep 2017 18:36:30 -0400 (EDT)

Revision: 17050
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17050
Author:   sigurdne
Date:     2017-09-10 18:36:30 -0400 (Sun, 10 Sep 2017)
Log Message:
-----------
odt2xhtml: comply with php7

Modified Paths:
--------------
    trunk/phpgwapi/inc/odt2xhtml/config.php5
    trunk/phpgwapi/inc/odt2xhtml/index.php5
    trunk/phpgwapi/inc/odt2xhtml/php5/odt2xhtml.php5

Modified: trunk/phpgwapi/inc/odt2xhtml/config.php5
===================================================================
--- trunk/phpgwapi/inc/odt2xhtml/config.php5    2017-09-10 20:55:37 UTC (rev 
17049)
+++ trunk/phpgwapi/inc/odt2xhtml/config.php5    2017-09-10 22:36:30 UTC (rev 
17050)
@@ -30,5 +30,4 @@
 
 /*** NOT TOUCH ***/
 define('ODT2XHTML_DEBUG',0);
-define('ODT2XHTML_PHPCLI',0);  // to use with PHP CLI *** USE WITH PRECAUTION, 
@ YOURS RISKS ***
-?>
+define('ODT2XHTML_PHPCLI',0);  // to use with PHP CLI *** USE WITH PRECAUTION, 
@ YOURS RISKS ***
\ No newline at end of file

Modified: trunk/phpgwapi/inc/odt2xhtml/index.php5
===================================================================
--- trunk/phpgwapi/inc/odt2xhtml/index.php5     2017-09-10 20:55:37 UTC (rev 
17049)
+++ trunk/phpgwapi/inc/odt2xhtml/index.php5     2017-09-10 22:36:30 UTC (rev 
17050)
@@ -61,5 +61,4 @@
                unset($file); 
        }       
 }
-else die('<p style="color:red;">Your WebHosting not support correctly the XSL 
Transformation in PHP5! Needed PHP-XSL Library ...</p>');
-?>
+else die('<p style="color:red;">Your WebHosting not support correctly the XSL 
Transformation in PHP5! Needed PHP-XSL Library ...</p>');
\ No newline at end of file

Modified: trunk/phpgwapi/inc/odt2xhtml/php5/odt2xhtml.php5
===================================================================
--- trunk/phpgwapi/inc/odt2xhtml/php5/odt2xhtml.php5    2017-09-10 20:55:37 UTC 
(rev 17049)
+++ trunk/phpgwapi/inc/odt2xhtml/php5/odt2xhtml.php5    2017-09-10 22:36:30 UTC 
(rev 17050)
@@ -174,7 +174,7 @@
        
        /*** try to obtain elements when file html is created ***/
        public function get_elements_html() {
-               $this->subject = 
file_get_contents($this->dir['html'].'/'.$this->file['html']);
+               $this->subject = 
file_get_contents($this->dir['html'].'/'.$this->file['html']);
 
                $this->pattern['meta'] = '`<meta (.*?) />`es';
                if(ODT2XHTML_FILE_CSS==FALSE) $this->pattern['css'] = '`<style 
type="text/css">(.*?)</style>`es';
@@ -192,7 +192,7 @@
                        $this->elements['css'][1][0] = $this->buffer;
                        unset($this->buffer);
                }
-               
+               
                return $this->elements;
        }
        
@@ -554,12 +554,14 @@
        
        /*** replace content ***/
        private function _replace_content($info) {
+               $callback = false;
                switch($info) {
                        case 'analyze_attribute' :
                                $this->exec=1;
-                               $this->search = '/="(.*?)"/es';
+                               $this->search = '/="(.*?)"/s';
                                $this->replace = 
"odt2xhtml::_analyze_attribute('$1')";
                                $this->subject = $this->content;
+                               $callback = true;
                        break;
                        case 'header' :
                                $this->exec=1;
@@ -569,21 +571,24 @@
                        break;
                        case 'img_odt' :
                                $this->exec=1;
-                               $this->search = 
'#xlink:href="Pictures/([.a-zA-Z_0-9]*)"#es';
+                               $this->search = 
'#xlink:href="Pictures/([.a-zA-Z_0-9]*)"#s';
                                $this->replace = "odt2xhtml::_make_image('$1')";
                                $this->subject = $this->content;
+                               $callback = true;
                        break;
                        case 'img_sxw' :
                                $this->exec=1;
-                               $this->search = 
'!xlink:href="\#Pictures/([.a-zA-Z_0-9]*)"!es';
+                               $this->search = 
'!xlink:href="\#Pictures/([.a-zA-Z_0-9]*)"!s';
                                $this->replace = "odt2xhtml::_make_image('$1')";
                                $this->subject = $this->content;
+                               $callback = true;
                        break;
                        case 'link_css' :
                                $this->exec=1;
-                               $this->search = '/<style 
type="text\/css">(.*)<\/style>/es';
+                               $this->search = '/<style 
type="text\/css">(.*)<\/style>/s';
                                $this->replace = "odt2xhtml::_modify_css()";
                                $this->subject = $this->file['tmp'];
+                               $callback = true;
                        break;
                        case 'open_element_xml4odt' :
                                $this->buffer = '<office:document 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0">';
@@ -599,13 +604,25 @@
                        break;
                        case 'title' :
                                $this->exec=1;
-                               $this->search = '/<head>/es';
-                               $this->replace = "odt2xhtml::_modify_title()";
+                               $this->search = '/<head>/s';
+                               $this->replace = "odt2xhtml::_modify_title";
                                $this->subject = $this->file['tmp'];
+                               $callback = true;
                        break;
                }
                
-               if(!empty($this->exec)) $this->buffer = 
preg_replace($this->search,$this->replace,$this->subject);
+               if(!empty($this->exec))
+               {
+                       if($callback)
+                       {
+                               $this->buffer = 
preg_replace_callback($this->search,$this->replace,$this->subject);
+                       }
+                       else
+                       {
+                               $this->buffer = 
preg_replace($this->search,$this->replace,$this->subject);
+                               
+                       }
+               }
                
                return $this->buffer;
                
@@ -732,5 +749,4 @@
                if(ODT2XHTML_DEBUG==TRUE) { echo 
$this->message->display('ok','convert_odf'); }
        }
 
-}
-?>
+}
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]