ereg
authormarc.nachin <you@example.commarc.nachin@auf.org>
Fri, 29 Jun 2012 15:39:43 +0000 (17:39 +0200)
committermarc.nachin <you@example.commarc.nachin@auf.org>
Fri, 29 Jun 2012 15:39:43 +0000 (17:39 +0200)
lodel-0.9/scripts/nusoap.php

index 72c4fd5..21e097d 100644 (file)
@@ -369,7 +369,7 @@ class nusoap_base {
        case (is_array($val) || $type):
          // detect if struct or array
          $valueType = $this->isArraySimpleOrStruct($val);
-         if($valueType=='arraySimple' || ereg('^ArrayOf',$type)){
+         if($valueType=='arraySimple' || preg('^ArrayOf',$type)){
            $i = 0;
            if(is_array($val) && count($val)> 0){
              foreach($val as $v){
@@ -539,7 +539,7 @@ class nusoap_base {
        */
        function expandQname($qname){
                // get element prefix
-               if(strpos($qname,':') && !ereg('^http://',$qname)){
+               if(strpos($qname,':') && !preg('^http://',$qname)){
                        // get unqualified name
                        $name = substr(strstr($qname,':'),1);
                        // get ns prefix
@@ -661,7 +661,7 @@ class nusoap_base {
 function timestamp_to_iso8601($timestamp,$utc=true){
        $datestr = date('Y-m-d\TH:i:sO',$timestamp);
        if($utc){
-               $eregStr =
+               $pregStr =
                '([0-9]{4})-'.  // centuries & years CCYY-
                '([0-9]{2})-'.  // months MM-
                '([0-9]{2})'.   // days DD
@@ -671,7 +671,7 @@ function timestamp_to_iso8601($timestamp,$utc=true){
                '([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
                '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
 
-               if(ereg($eregStr,$datestr,$regs)){
+               if(preg($pregStr,$datestr,$regs)){
                        return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
                }
                return false;
@@ -687,7 +687,7 @@ function timestamp_to_iso8601($timestamp,$utc=true){
 * @access   public
 */
 function iso8601_to_timestamp($datestr){
-       $eregStr =
+       $pregStr =
        '([0-9]{4})-'.  // centuries & years CCYY-
        '([0-9]{2})-'.  // months MM-
        '([0-9]{2})'.   // days DD
@@ -696,7 +696,7 @@ function iso8601_to_timestamp($datestr){
        '([0-9]{2}):'.  // minutes mm:
        '([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
        '(Z|[+\-][0-9]{2}:?[0-9]{2})?'; // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
-       if(ereg($eregStr,$datestr,$regs)){
+       if(preg($pregStr,$datestr,$regs)){
                // not utc
                if($regs[8] != 'Z'){
                        $op = substr($regs[8],0,1);
@@ -975,7 +975,7 @@ class XMLSchema extends nusoap_base  {
         if(count($attrs) > 0){
                foreach($attrs as $k => $v){
                 // if ns declarations, add to class level array of valid namespaces
-                               if(ereg("^xmlns",$k)){
+                               if(preg("^xmlns",$k)){
                        //$this->xdebug("$k: $v");
                        //$this->xdebug('ns_prefix: '.$this->getPrefix($k));
                        if($ns_prefix = substr(strrchr($k,':'),1)){
@@ -1073,7 +1073,7 @@ class XMLSchema extends nusoap_base  {
                                        $this->currentComplexType = $attrs['name'];
                                        $this->complexTypes[$this->currentComplexType] = $attrs;
                                        $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
-                                       if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
+                                       if(isset($attrs['base']) && preg(':Array$',$attrs['base'])){
                                                $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                                        } else {
                                                $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
@@ -1084,7 +1084,7 @@ class XMLSchema extends nusoap_base  {
                                        $this->currentElement = false;
                                        $this->complexTypes[$this->currentComplexType] = $attrs;
                                        $this->complexTypes[$this->currentComplexType]['typeClass'] = 'complexType';
-                                       if(isset($attrs['base']) && ereg(':Array$',$attrs['base'])){
+                                       if(isset($attrs['base']) && preg(':Array$',$attrs['base'])){
                                                $this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
                                        } else {
                                                $this->complexTypes[$this->currentComplexType]['phpType'] = 'struct';
@@ -1660,7 +1660,7 @@ class soap_transport_http extends nusoap_base {
        */
        function soap_transport_http($url){
                $this->setURL($url);
-               ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+               preg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
                $this->outgoing_headers['User-Agent'] = $this->title.'/'.$this->version.' ('.$rev[1].')';
        }
 
@@ -2149,7 +2149,7 @@ class soap_transport_http extends nusoap_base {
                                }
                        }
                        // remove 100 header
-                       if(isset($lb) && ereg('^HTTP/1.1 100',$data)){
+                       if(isset($lb) && preg('^HTTP/1.1 100',$data)){
                                unset($lb);
                                $data = '';
                        }//
@@ -2291,7 +2291,7 @@ class soap_transport_http extends nusoap_base {
                curl_close($this->ch);
                
                // remove 100 header
-               if (ereg('^HTTP/1.1 100',$data)) {
+               if (preg('^HTTP/1.1 100',$data)) {
                        if ($pos = strpos($data,"\r\n\r\n")) {
                                $data = ltrim(substr($data,$pos));
                        } elseif($pos = strpos($data,"\n\n") ) {
@@ -2566,7 +2566,7 @@ class soap_server extends nusoap_base {
                        $qs = $QUERY_STRING;
                }
 
-               if(isset($qs) && ereg('wsdl', $qs) ){
+               if(isset($qs) && preg('wsdl', $qs) ){
                        // This is a request for WSDL
                        if($this->externalWSDLURL){
               if (strpos($this->externalWSDLURL,"://")!==false) { // assume URL
@@ -2626,7 +2626,7 @@ class soap_server extends nusoap_base {
                        // get the character encoding of the incoming request
                        if(strpos($this->headers['Content-Type'],'=')){
                                $enc = str_replace('"','',substr(strstr($this->headers["Content-Type"],'='),1));
-                               if(eregi('^(utf-8|US-ASCII|UTF-8)$',$enc)){
+                               if(pregi('^(utf-8|US-ASCII|UTF-8)$',$enc)){
                                        $this->xml_encoding = strtoupper($enc);
                                } else {
                                        $this->xml_encoding = 'US-ASCII';
@@ -2654,7 +2654,7 @@ class soap_server extends nusoap_base {
                                                $enc = substr(strstr($v, '='), 1);
                                                $enc = str_replace('"', '', $enc);
                                                $enc = str_replace('\\', '', $enc);
-                                               if (eregi('^(utf-8|US-ASCII|UTF-8)$', $enc)) {
+                                               if (pregi('^(utf-8|US-ASCII|UTF-8)$', $enc)) {
                                                        $this->xml_encoding = strtoupper($enc);
                                                } else {
                                                        $this->xml_encoding = 'US-ASCII';
@@ -2684,7 +2684,7 @@ class soap_server extends nusoap_base {
                                                        $enc = substr(strstr($v, '='), 1);
                                                        $enc = str_replace('"', '', $enc);
                                                        $enc = str_replace('\\', '', $enc);
-                                                       if (eregi('^(utf-8|US-ASCII|UTF-8)$', $enc)) {
+                                                       if (pregi('^(utf-8|US-ASCII|UTF-8)$', $enc)) {
                                                                $this->xml_encoding = strtoupper($enc);
                                                        } else {
                                                                $this->xml_encoding = 'US-ASCII';
@@ -3005,7 +3005,7 @@ class soap_server extends nusoap_base {
                $payload .= $this->getDebugAsXMLComment();
         }
                $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
-               ereg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
+               preg('\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
                $this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
                // Let the Web server decide about this
                //$this->outgoing_headers[] = "Connection: Close\r\n";
@@ -3487,7 +3487,7 @@ class wsdl extends nusoap_base {
             $this->currentSchema->schemaStartElement($parser, $name, $attrs);
             $this->appendDebug($this->currentSchema->getDebug());
             $this->currentSchema->clearDebug();
-        } elseif (ereg('schema$', $name)) {
+        } elseif (preg('schema$', $name)) {
                $this->debug('Parsing WSDL schema');
             // $this->debug("startElement for $name ($attrs[name]). status = $this->status (".$this->getLocalPart($name).")");
             $this->status = 'schema';
@@ -3503,7 +3503,7 @@ class wsdl extends nusoap_base {
             $this->depth_array[$depth] = $pos;
             $this->message[$pos] = array('cdata' => ''); 
             // get element prefix
-            if (ereg(':', $name)) {
+            if (preg(':', $name)) {
                 // get ns prefix
                 $prefix = substr($name, 0, strpos($name, ':')); 
                 // get ns
@@ -3515,7 +3515,7 @@ class wsdl extends nusoap_base {
             if (count($attrs) > 0) {
                 foreach($attrs as $k => $v) {
                     // if ns declarations, add to class level array of valid namespaces
-                    if (ereg("^xmlns", $k)) {
+                    if (preg("^xmlns", $k)) {
                         if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
                             $this->namespaces[$ns_prefix] = $v;
                         } else {
@@ -3692,7 +3692,7 @@ class wsdl extends nusoap_base {
        */
        function end_element($parser, $name){ 
                // unset schema status
-               if (/*ereg('types$', $name) ||*/ ereg('schema$', $name)) {
+               if (/*preg('types$', $name) ||*/ preg('schema$', $name)) {
                        $this->status = "";
                        $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
                $this->debug('Parsing WSDL schema done');
@@ -4857,7 +4857,7 @@ class soap_parser extends nusoap_base {
                        $key_localpart = $this->getLocalPart($key);
                        // if ns declarations, add to class level array of valid namespaces
             if($key_prefix == 'xmlns'){
-                               if(ereg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
+                               if(preg('^http://www.w3.org/[0-9]{4}/XMLSchema$',$value)){
                                        $this->XMLSchemaVersion = $value;
                                        $this->namespaces['xsd'] = $this->XMLSchemaVersion;
                                        $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
@@ -4881,7 +4881,7 @@ class soap_parser extends nusoap_base {
                                // should do something here with the namespace of specified type?
                        } elseif($key_localpart == 'arrayType'){
                                $this->message[$pos]['type'] = 'array';
-                               /* do arrayType ereg here
+                               /* do arrayType preg here
                                [1]    arrayTypeValue    ::=    atype asize
                                [2]    atype    ::=    QName rank*
                                [3]    rank    ::=    '[' (',')* ']'
@@ -4890,7 +4890,7 @@ class soap_parser extends nusoap_base {
                                [6]    nextDimension    ::=    Digit+ ','
                                */
                                $expr = '([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]';
-                               if(ereg($expr,$value,$regs)){
+                               if(preg($expr,$value,$regs)){
                                        $this->message[$pos]['typePrefix'] = $regs[1];
                                        $this->message[$pos]['arrayTypePrefix'] = $regs[1];
                        if (isset($this->namespaces[$regs[1]])) {
@@ -5523,7 +5523,7 @@ class mysoapclient extends nusoap_base  {
                // detect transport
                switch(true){
                        // http(s)
-                       case ereg('^http',$this->endpoint):
+                       case preg('^http',$this->endpoint):
                                $this->debug('transporting via HTTP');
                                if($this->persistentConnection == true && is_object($this->persistentConnection)){
                                        $http =& $this->persistentConnection;
@@ -5545,10 +5545,10 @@ class mysoapclient extends nusoap_base  {
                                        $http->setEncoding($this->http_encoding);
                                }
                                $this->debug('sending message, length: '.strlen($msg));
-                               if(ereg('^http:',$this->endpoint)){
+                               if(preg('^http:',$this->endpoint)){
                                //if(strpos($this->endpoint,'http:')){
                                        $this->responseData = $http->send($msg,$timeout,$response_timeout);
-                               } elseif(ereg('^https',$this->endpoint)){
+                               } elseif(preg('^https',$this->endpoint)){
                                //} elseif(strpos($this->endpoint,'https:')){
                                        //if(phpversion() == '4.3.0-dev'){
                                                //$response = $http->send($msg,$timeout,$response_timeout);
@@ -5605,7 +5605,7 @@ class mysoapclient extends nusoap_base  {
                if (strpos($headers['content-type'], '=')) {
                        $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
                        $this->debug('Got response encoding: ' . $enc);
-                       if(eregi('^(utf-8|US-ASCII|UTF-8)$',$enc)){
+                       if(pregi('^(utf-8|US-ASCII|UTF-8)$',$enc)){
                                $this->xml_encoding = strtoupper($enc);
                        } else {
                                $this->xml_encoding = 'US-ASCII';