⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 disco.php.tmp

📁 PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。
💻 TMP
📖 第 1 页 / 共 2 页
字号:
            if ($typens == 'xsd') {                // cannot add to xsd, lets use method_namespace                $typens = 'tns';            }            $schema =& $this->_getSchema(array_search($typens, $this->namespaces));            if (!$this->_ifComplexTypeExists($schema['complexType'], $type)) {                $ctype =& $schema['complexType'][];                $ctype['attr']['name'] = $type;                foreach ($_type_def as $_varname => $_vartype) {                    if (!is_int($_varname)) {                        list($_vartypens,$_vartype) = $this->_getTypeNs($_vartype);                        $ctype['all']['attr'] = '';                        $el =& $ctype['all']['element'][];                        $el['attr']['name'] = $_varname;                        $el['attr']['type'] = $_vartypens . ':' . $_vartype;                    } else {                        $ctype['complexContent']['attr'] = '';                        $ctype['complexContent']['restriction']['attr']['base'] = 'SOAP-ENC:Array';                        foreach ($_vartype as $array_var => $array_type) {                            list($_vartypens, $_vartype) = $this->_getTypeNs($array_type);                            $ctype['complexContent']['restriction']['attribute']['attr']['ref'] = 'SOAP-ENC:arrayType';                            $ctype['complexContent']['restriction']['attribute']['attr']['wsdl:arrayType'] = $_vartypens . ':' . $_vartype . '[]';                        }                    }                }            }        }    }    function addMethodsFromMap(&$map, $namespace, $classname = null)    {        if (!$map) {            return;        }        foreach ($map as $method_name => $method_types) {            if (array_key_exists('namespace', $method_types)) {                $method_namespace = $method_types['namespace'];            } else {                $method_namespace = $namespace;            }            // INPUT            if (isset($method_types['in']) && is_array($method_types['in'])) {                $input_message =& $this->_wsdl['definitions']['message'][];                $input_message['attr']['name'] = $method_name . 'Request';                foreach ($method_types['in'] as $name => $type) {                    list($typens, $type) = $this->_getTypeNs($type);                    $part =& $input_message['part'][];                    $part['attr']['name'] = $name;                    $part['attr']['type'] = $typens . ':' . $type;                }            }            // OUTPUT            if (isset($method_types['out']) && is_array($method_types['out'])) {                $output_message =& $this->_wsdl['definitions']['message'][];                $output_message['attr']['name'] = $method_name . 'Response';                foreach ($method_types['out'] as $name => $type) {                    list($typens, $type) = $this->_getTypeNs($type);                    $part =& $output_message['part'][];                    $part['attr']['name'] = $name;                    $part['attr']['type'] = $typens . ':' . $type;                }            }            // PORTTYPES            $operation =& $this->_wsdl['definitions']['portType']['operation'][];            $operation['attr']['name'] = $method_name;            // INPUT            $operation['input']['attr']['message'] = 'tns:'                            . $input_message['attr']['name'];            // OUTPUT            $operation['output']['attr']['message'] = 'tns:'                            . $output_message['attr']['name'];            // BINDING            $binding =& $this->_wsdl['definitions']['binding']['operation'][];            $binding['attr']['name'] = $method_name;            $action = $method_namespace . '#' . ($classname ? $classname . '#' : '') . $method_name;            $binding['soap:operation']['attr']['soapAction'] = $action;            // INPUT            $binding['input']['attr'] = '';            $binding['input']['soap:body']['attr']['use'] = 'encoded';            $binding['input']['soap:body']['attr']['namespace'] = $method_namespace;            $binding['input']['soap:body']['attr']['encodingStyle'] = SOAP_SCHEMA_ENCODING;            // OUTPUT            $binding['output']['attr'] = '';            $binding['output']['soap:body']['attr']['use'] = 'encoded';            $binding['output']['soap:body']['attr']['namespace'] = $method_namespace;            $binding['output']['soap:body']['attr']['encodingStyle'] = SOAP_SCHEMA_ENCODING;        }    }    function _generate_DISCO_XML($disco_array)    {        $disco = '<?xml version="1.0"?>';        foreach ($disco_array as $key => $val) {            $disco .= $this->_arrayToNode($key,$val);        }        $this->disco = $disco;    }    function _generate_WSDL_XML()    {        $wsdl = '<?xml version="1.0"?>';        foreach ($this->_wsdl as $key => $val) {            $wsdl .= $this->_arrayToNode($key, $val);        }        $this->wsdl = $wsdl;    }    function _arrayToNode($node_name = '', $array)    {        $return = '';        if (is_array($array)) {            // we have a node if there's key 'attr'            if (array_key_exists('attr',$array)) {                $return .= "<$node_name";                if (is_array($array['attr'])) {                    foreach ($array['attr'] as $attr_name => $attr_value) {                        $return .= " $attr_name=\"$attr_value\"";                    }                }                // unset 'attr' and proceed other childs...                unset($array['attr']);                if (count($array) > 0) {                    $i = 0;                    foreach ($array as $child_node_name => $child_node_value) {                        $return .= $i == 0 ? ">\n" : '';                        $return .= $this->_arrayToNode($child_node_name,$child_node_value);                        $i++;                    }                    $return .= "</$node_name>\n";                } else {                    $return .= " />\n";                }            } else {                // we have no 'attr' key in array - so it's list of nodes with                // the same name ...                foreach ($array as $child_node_name => $child_node_value) {                    $return .= $this->_arrayToNode($node_name,$child_node_value);                }            }        } else {            // $array is not an array            if ($array !='') {                // and its not empty                $return .= "<$node_name>$array</$node_name>\n";            } else {                // and its empty...                $return .= "<$node_name />\n";            }        }        return $return;    }    function _getTypeNs($type)    {        preg_match_all("'\{(.*)\}'sm", $type, $m);        if (isset($m[1][0]) && $m[1][0] != '') {            if (!array_key_exists($m[1][0],$this->namespaces)) {                $ns_pref = 'ns' . count($this->namespaces);                $this->namespaces[$m[1][0]] = $ns_pref;                $this->_wsdl['definitions']['attr']['xmlns:' . $ns_pref] = $m[1][0];            }            $typens = $this->namespaces[$m[1][0]];            $type = ereg_replace($m[0][0],'',$type);        } else {            $typens = 'xsd';        }        return array($typens,$type);    }    function _ifComplexTypeExists($typesArray, $type_name)    {        if (is_array($typesArray)) {            foreach ($typesArray as $index => $type_data) {                if ($typesArray[$index]['attr']['name'] == $type_name) {                    return true;                }            }        }        return false;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -