当前位置: 首页>>代码示例>>PHP>>正文


PHP DomDocument::createElementNS方法代码示例

本文整理汇总了PHP中DomDocument::createElementNS方法的典型用法代码示例。如果您正苦于以下问题:PHP DomDocument::createElementNS方法的具体用法?PHP DomDocument::createElementNS怎么用?PHP DomDocument::createElementNS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DomDocument的用法示例。


在下文中一共展示了DomDocument::createElementNS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createWsdl2Service

 /**
  * Function that creates service elements for WSDL2.0
  * @param DomDocument $svr_name DomDocument element of the wsdl document 
  * @param DomElement $svr_root service dom element 
  */
 public function createWsdl2Service(DomDocument $svr_dom, DomElement $svr_root)
 {
     $svr_ele = $svr_dom->createElementNS(WS_WSDL_Const::WS_WSDL2_NAMESPACE, WS_WSDL_Const::WS_WSDL_SERVICE_ATTR_NAME);
     $svr_ele->setAttribute(WS_WSDL_Const::WS_WSDL_SERVICE_ATTR_NAME, $this->S_name);
     $svr_ele->setAttribute(WS_WSDL_Const::WS_WSDL_INTERFACE_ATTR_NAME, $this->S_name . ucfirst(WS_WSDL_Const::WS_WSDL_INTERFACE_ATTR_NAME));
     $svr_port = $svr_dom->createElementNS(WS_WSDL_Const::WS_WSDL2_NAMESPACE, WS_WSDL_Const::WS_WSDL_ENDPOINT_ATTR_NAME);
     $svr_port->setAttribute(WS_WSDL_Const::WS_WSDL_NAME_ATTR_NAME, $this->S_name);
     $svr_port->setAttribute(WS_WSDL_Const::WS_WSDL_BINDING_ATTR_NAME, "tns" . $this->S_name);
     $svr_port->setAttribute(WS_WSDL_Const::WS_WSDL_ADDRESS_ATTR_NAME, $this->endpoint);
     $svr_ele->appendChild($svr_port);
     $svr_root->appendChild($svr_ele);
 }
开发者ID:ztobs,项目名称:wsf,代码行数:17,代码来源:WS_WSDL_Service.php

示例2: setList

 /**
  * @param $field
  * @param $value
  * @param $type
  * @param $ns
  *
  * @return $this
  */
 private function setList($field, $value, $type, $ns)
 {
     $result = $this->xpath->query('//rdf:Description/' . $field . '/' . $type . '/rdf:li');
     $parent = null;
     if ($result->length) {
         $parent = $result->item(0)->parentNode;
         // remove child nodes
         for ($i = 0; $i < $result->length; $i++) {
             $parent->removeChild($result->item($i));
         }
     } else {
         // find the RDF description root
         $description = $this->getOrCreateRDFDescription($ns);
         // create the element and the rdf:Alt child
         $node = $this->dom->createElementNS($ns, $field);
         $parent = $this->dom->createElementNS(self::RDF_NS, $type);
         $description->appendChild($node);
         $node->appendChild($parent);
     }
     if (!$value || !is_array($value) && count($value) == 0) {
         // remove element
         $parent->parentNode->parentNode->removeChild($parent->parentNode);
     } else {
         foreach ((array) $value as $item) {
             $node = $this->dom->createElementNS(self::RDF_NS, 'rdf:li');
             $node->appendChild($this->dom->createTextNode($item));
             if ($type == 'rdf:Alt') {
                 $node->setAttribute('xml:lang', 'x-default');
             }
             $parent->appendChild($node);
         }
     }
     $this->hasChanges = true;
     return $this;
 }
开发者ID:dchesterton,项目名称:image,代码行数:43,代码来源:Xmp.php

示例3: serializePortableProperties

 /**
  * Serialize an associative array of pci properties into a pci xml
  *
  * @param array $properties
  * @param string $ns
  * @return string
  */
 private function serializePortableProperties($properties, $ns = '', $nsUri = '', $name = null, $element = null)
 {
     $document = null;
     $result = '';
     if ($element === null) {
         $document = new \DomDocument();
         $element = $ns ? $document->createElementNS($nsUri, $ns . ':properties') : $document->createElement('properties');
         $document->appendChild($element);
     } else {
         $newElement = $ns ? $element->ownerDocument->createElementNS($nsUri, $ns . ':properties') : $element->ownerDocument->createElement('properties');
         $element->appendChild($newElement);
         $element = $newElement;
     }
     if ($name !== null) {
         $element->setAttribute('key', $name);
     }
     foreach ($properties as $name => $value) {
         if (is_array($value)) {
             $this->serializePortableProperties($value, $ns, $nsUri, $name, $element);
         } else {
             $entryElement = $ns ? $element->ownerDocument->createElementNS($nsUri, $ns . ':entry') : $element->ownerDocument->createElementNS('entry');
             $entryElement->setAttribute('key', $name);
             $entryElement->appendChild(new \DOMText($value));
             $element->appendChild($entryElement);
         }
     }
     if ($document !== null) {
         foreach ($document->childNodes as $node) {
             $result .= $document->saveXML($node);
         }
     }
     return $result;
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:40,代码来源:PortableElementTrait.php

示例4: createPortType

 /**
  * Function that creates portType elements for WSDL1.1
  * @param DomDocument $port_doc DomDocument element of the wsdl document
  * @param DomElement $port_root service dom element
  */
 public function createPortType(DomDocument $port_doc, DomElement $port_root, $extra, $operations)
 {
     $attr_name_to_postfix_map = array(WS_WSDL_Const::WS_WSDL_INPUT_ATTR_NAME => WS_WSDL_Const::WS_WSDL_OPERTION_INPUT_TAG, WS_WSDL_Const::WS_WSDL_OUTPUT_ATTR_NAME => WS_WSDL_Const::WS_WSDL_OPERTION_OUTPUT_TAG);
     $port_el = $port_doc->createElementNS(WS_WSDL_Const::WS_SCHEMA_WSDL_NAMESPACE, WS_WSDL_Const::WS_WSDL_PORTTYPE_ATTR_NAME);
     $port_el->setAttribute(WS_WSDL_Const::WS_WSDL_NAME_ATTR_NAME, $this->service_name . "PortType");
     foreach ($this->operations as $name => $params) {
         $operation = $port_doc->createElementNS(WS_WSDL_Const::WS_SCHEMA_WSDL_NAMESPACE, WS_WSDL_Const::WS_WSDL_OPERATION_ATTR_NAME);
         foreach ($this->fun_mapping as $key => $value) {
             if ($value == $name) {
                 $operation->setAttribute(WS_WSDL_Const::WS_WSDL_NAME_ATTR_NAME, $key);
             }
         }
         //----SIU: INICO
         if (isset($operations[$name]['documentation'])) {
             $part = $port_doc->createElementNS(WS_WSDL_Const::WS_SCHEMA_WSDL_NAMESPACE, "documentation");
             $part->nodeValue = $operations[$name]['documentation'];
             $operation->appendChild($part);
         }
         //----SIU: FIN
         // be sensitive to the available directions
         $directions_arr = array();
         // we anyway have the input message
         $directions_arr[] = WS_WSDL_Const::WS_WSDL_INPUT_ATTR_NAME;
         if (array_key_exists("output", $params)) {
             $directions_arr[] = WS_WSDL_Const::WS_WSDL_OUTPUT_ATTR_NAME;
         }
         foreach ($directions_arr as $type) {
             $sel = $port_doc->createElementNS(WS_WSDL_Const::WS_SCHEMA_WSDL_NAMESPACE, $type);
             foreach ($this->fun_mapping as $key => $value) {
                 if ($value == $name) {
                     $sel->setAttribute(WS_WSDL_Const::WS_WSDL_MESSAGE_ATTR_NAME, WS_WSDL_Const::WS_WSDL_TNS_ATTR_NAME . ":" . "{$key}" . ucfirst($attr_name_to_postfix_map[$type]));
                     if ($this->use_wsa) {
                         $action = NULL;
                         if ($this->r_actions && is_array($this->r_actions) && array_key_exists($key, $this->r_actions)) {
                             $action = $this->r_actions[$key];
                             $sel->setAttributeNS(WS_WSDL_Const::WS_WSDL_WSAW_NAMESPACE, WS_WSDL_Const::WS_WSDL_WSAW_PREFIX . ":" . WS_WSDL_CONST::WS_WSDL_ACTION, $action);
                         }
                     }
                 }
             }
             $operation->appendChild($sel);
         }
         $port_el->appendChild($operation);
     }
     $port_root->appendChild($port_el);
 }
开发者ID:emma5021,项目名称:toba,代码行数:51,代码来源:WS_WSDL_Port.php

示例5: buildWsdlDom

 /**
  * Creates the wsdl document for WSDL1.1
  */
 private function buildWsdlDom()
 {
     $wsdl_dom = new DomDocument(WS_WSDL_Const::WS_DOM_DOCUMENT_VERSION_NO, WS_WSDL_Const::WS_DOM_DOCUMENT_ENCODING);
     $wsdl_root_ele = $wsdl_dom->createElementNS(WS_WSDL_const::WS_SCHEMA_WSDL_NAMESPACE, WS_WSDL_const::WS_WSDL_DEFINITION);
     $wsdl_dom->appendChild($wsdl_root_ele);
     $wsdl_root_ele->setAttributeNS(WS_WSDL_const::WS_WSDL_DEF_SCHEMA_URI, WS_WSDL_const::WS_WSDL_DEF_XSD_QN, WS_WSDL_const::WS_SOAP_XML_SCHEMA_NAMESPACE);
     $wsdl_root_ele->setAttributeNS(WS_WSDL_const::WS_WSDL_DEF_SCHEMA_URI, WS_WSDL_const::WS_WSDL_DEF_TNS_QN, $this->namespace);
     $wsdl_root_ele->setAttributeNS(WS_WSDL_const::WS_WSDL_DEF_SCHEMA_URI, WS_WSDL_const::WS_WSDL_DEF_ELEMENT_PREFIX, $this->namespace . WS_WSDL_Const::WS_WSDL_DEF_ELEMENT_NS_POSTFIX);
     $wsdl_root_ele->setAttributeNS(WS_WSDL_const::WS_WSDL_DEF_SCHEMA_URI, WS_WSDL_const::WS_WSDL_DEF_SOAP_ENV_QN, WS_WSDL_const::WS_SCHEMA_SOAP_NAMESPACE);
     $wsdl_root_ele->setAttributeNS(WS_WSDL_const::WS_WSDL_DEF_SCHEMA_URI, WS_WSDL_const::WS_WSDL_DEF_WSDL_QN, WS_WSDL_const::WS_SCHEMA_WSDL_NAMESPACE);
     $wsdl_root_ele->setAttributeNS(WS_WSDL_const::WS_WSDL_DEF_SCHEMA_URI, WS_WSDL_const::WS_WSDL_DEF_SOAP_ENC_QN, WS_WSDL_const::WS_SOAP_SCHEMA_ENCODING_NAMESPACE);
     $wsdl_root_ele->setAttributeNS(WS_WSDL_const::WS_WSDL_DEF_SCHEMA_URI, WS_WSDL_const::WS_WSDL_DEF_HTTP_QN, WS_WSDL_const::WS_WSDL_HTTP12_NAMESPACE);
     $wsdl_root_ele->setAttribute("xmlns:" . WS_WSDL_Const::WS_WSDL_WSAW_PREFIX, WS_WSDL_Const::WS_WSDL_WSAW_NAMESPACE);
     $wsdl_root_ele->setAttribute(WS_WSDL_const::WS_WSDL_DEF_TARGET_NS, $this->namespace);
     if (!$this->annotations) {
         // we infer doc comments only when annotations are not provided as an array
         $oper_obj = new WS_WSDL_Operations($this->f_arry, $this->class_arry);
         $schemaTypes = $oper_obj->getSchemaTypes();
         $operations = $oper_obj->operations;
     }
     if ($this->Binding_style == WS_WSDL_Const::WSF_WSDL_DOCLIT) {
         $type_obj = new WS_WSDL_Type($this->namespace, $this->ops_to_functions, $this->classmap);
         if ($this->annotations) {
             $ele_names_info = $type_obj->createDocLitTypeWithAnnotations($wsdl_dom, $wsdl_root_ele, $this->annotations);
             $operations = $ele_names_info;
             $this->classmap = array(0);
             //should just go with the classmap behaviour
         } else {
             $ele_names_info = $type_obj->createDocLitType($wsdl_dom, $wsdl_root_ele, $schemaTypes);
         }
         $msg_obj = new WS_WSDL_Message($operations, $this->ops_to_functions, $this->classmap);
         $msg_obj->createDocLitMessage($wsdl_dom, $wsdl_root_ele, $ele_names_info);
     }
     if ($this->Binding_style == WS_WSDL_Const::WSF_WSDL_RPC) {
         $type_obj = new WS_WSDL_Type($this->namespace, $this->ops_to_functions, $this->classmap);
         // class to prefix will be filled from the following function call
         $class_to_prefix = array();
         /* no types for the time being */
         $ele_names_info = $type_obj->createRPCType($wsdl_dom, $wsdl_root_ele, $class_to_prefix, $schemaTypes);
         $msg_obj = new WS_WSDL_Message($operations, $this->ops_to_functions, $this->classmap);
         $msg_obj->createRPCMessage($wsdl_dom, $wsdl_root_ele, $class_to_prefix, $ele_names_info);
     }
     $port_obj = new WS_WSDL_Port($this->service_name, $ele_names_info, $this->ops_to_functions, $this->use_wsa, $this->r_actions);
     $port_obj->createPortType($wsdl_dom, $wsdl_root_ele, $ele_names_info, $operations);
     if ($this->Binding_style == WS_WSDL_Const::WSF_WSDL_DOCLIT) {
         $bind_obj = new WS_WSDL_Binding($this->service_name, $this->endpoint, $ele_names_info, $this->ops_to_functions, $this->r_actions);
         $bind_obj->createDocLitBinding($wsdl_dom, $wsdl_root_ele, $ele_names_info);
     }
     if ($this->Binding_style == WS_WSDL_Const::WSF_WSDL_RPC) {
         $bind_obj = new WS_WSDL_Binding($this->service_name, $this->endpoint, $ele_names_info, $this->ops_to_functions, $this->r_actions);
         $bind_obj->createRPCBinding($wsdl_dom, $wsdl_root_ele);
     }
     $svr_obj = new WS_WSDL_Service($this->service_name, $this->endpoint);
     $svr_obj->createService($wsdl_dom, $wsdl_root_ele);
     return $wsdl_dom->saveXML();
 }
开发者ID:emma5021,项目名称:toba,代码行数:59,代码来源:WS_WSDL_Creator.php

示例6: element

 /**
  * Create a new element
  *
  * @param   string  $name
  * @param   string  $value
  * @param   string  $namespace
  * @return  object  $this
  */
 public function element($name, $value = null, $namespace = null)
 {
     $element = $namespace ? $this->dom->createElementNS($namespace, $name) : $this->dom->createElement($name);
     $this->current->appendChild($element);
     $this->current = $element;
     if (null !== $value) {
         $this->text($value);
     }
     return $this;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:18,代码来源:element.php

示例7: createInterface

 public function createInterface(DomDocument $interface_doc, DomElement $interface_root)
 {
     $interface_ele = $interface_doc->createElementNS(WS_WSDL_Const::WS_WSDL2_NAMESPACE, self::WS_WSDL2_INTERFACE_INTERFACE_ATTR_NAME);
     $interface_ele->setAttribute(self::WS_WSDL_INTERFACE_NAME_ATTR_NAME, $this->svr_name . ucfirst(self::WS_WSDL2_INTERFACE_INTERFACE_ATTR_NAME));
     foreach ($this->operations as $name => $params) {
         $op = $interface_doc->createElementNS(WS_WSDL_Const::WS_WSDL2_NAMESPACE, self::WS_WSDL_INTERFACE_OPERATION_ATTR_NAME);
         $op->setAttribute(self::WS_WSDL_INTERFACE_NAME_ATTR_NAME, $name);
         $op->setAttribute(self::WS_WSDL2_INTERFACE_PATTERN_ATTR_NAME, WS_WSDL_Const::WS_WSDL2_PATTERN_ATTR_VAL);
         foreach (array(self::WS_WSDL_INTERFACE_INPUT_ATTR_NAME, self::WS_WSDL_INTERFACE_OUTPUT_ATTR_NAME) as $type) {
             $operation_ele = $interface_doc->createElementNS(WS_WSDL_Const::WS_WSDL2_NAMESPACE, $type);
             if ($type == self::WS_WSDL_INTERFACE_INPUT_ATTR_NAME) {
                 $operation_ele->setAttribute(self::WS_WSDL2_INTERFACE_PATTERN_ATTR_NAME, $name);
             } else {
                 $operation_ele->setAttribute(self::WS_WSDL2_INTERFACE_PATTERN_ATTR_NAME, $name . "Response");
             }
             $op->appendChild($operation_ele);
         }
         $interface_ele->appendChild($op);
     }
     $interface_root->appendChild($interface_ele);
 }
开发者ID:emma5021,项目名称:toba,代码行数:21,代码来源:WS_WSDL_Interface.php

示例8: prepareDom

 /**
  * Prepare DOM
  * 
  * @return void 
  */
 private function prepareDom()
 {
     $this->dom = new \DOMDocument('1.0', 'UTF-8');
     if ($this->debug) {
         $this->dom->formatOutput = true;
     }
     $this->wsDefinitions = $this->dom->createElementNS($this->namespaces['wsdl'], 'wsdl:definitions');
     $this->dom->appendChild($this->wsDefinitions);
     $this->wsDefinitions->setAttribute('name', $this->wsdlName);
     $this->wsDefinitions->setAttribute('targetNamespace', $this->wsdlTargetNamespace);
     $this->dom->createAttributeNS($this->wsdlTargetNamespace, $this->targetNsPrefix . ':definitions');
     // This NS
     $this->common->dom = $this->dom;
 }
开发者ID:irfan-blackhawk,项目名称:XSD-to-PHP,代码行数:19,代码来源:AbstractWsdl.php

示例9: DomDocument

 /**
  * Serialize this object to XML and return it.
  */
 function as_xml($with_preamble = FALSE)
 {
     $dc_xml = new DomDocument();
     $oai_dc = $dc_xml->createElementNS('http://www.openarchives.org/OAI/2.0/oai_dc/', 'oai_dc:dc');
     $oai_dc->setAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
     foreach ($this->dc as $dc_element => $values) {
         if (is_array($values) && !empty($values)) {
             foreach ($values as $value) {
                 $new_item = $dc_xml->createElement($dc_element, $value);
                 $oai_dc->appendChild($new_item);
             }
         } else {
             $new_item = $dc_xml->createElement($dc_element);
             $oai_dc->appendChild($new_item);
         }
     }
     $dc_xml->appendChild($oai_dc);
     return $dc_xml->saveXML();
 }
开发者ID:ratzeni,项目名称:islandora,代码行数:22,代码来源:dublin_core.php

示例10: addService

 /**
  * Add the service definition
  * @param		DomDocument 		$dom		The document to add to
  */
 protected function addService(DomDocument $dom)
 {
     $service = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:service');
     $service->setAttribute('name', $this->serviceName . 'Service');
     $port = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/', 'wsdl:port');
     $port->setAttribute('name', $this->serviceName . 'Port');
     $port->setAttribute('binding', 'tns:' . $this->serviceName . 'Binding');
     $soapAddress = $dom->createElementNS('http://schemas.xmlsoap.org/wsdl/soap/', 'soap:address');
     $soapAddress->setAttribute('location', $this->serviceUri);
     $port->appendChild($soapAddress);
     $service->appendChild($port);
     $this->definitions->appendChild($service);
 }
开发者ID:bailey-ann,项目名称:stringtools,代码行数:17,代码来源:Wsdl.php

示例11: fopen

 $hdrReq['phone_03'] = FALSE;
 $hdrReq['mobile_03'] = FALSE;
 // not used
 $hdrReq['fax_03'] = FALSE;
 // not used
 $hdrReq['other_03'] = FALSE;
 // not used
 // Open csv to read
 $inputFile = fopen($inputFilename, 'rt');
 // Get the headers of the file
 $headers = fgetcsv($inputFile);
 // Create a new dom document with pretty formatting
 $xmlDoc = new DomDocument('1.0', 'UTF-8');
 $xmlDoc->formatOutput = true;
 // create root node
 $root = $xmlDoc->createElementNS('http://com/exlibris/digitool/repository/extsystem/xmlbeans', 'users');
 $xmlDoc->appendChild($root);
 $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
 $counter = 0;
 $errCtr = 0;
 $todayDate = date('Ymd');
 // Loop through each row creating a <row> node with the correct data
 while (($row = fgetcsv($inputFile)) !== FALSE) {
     $userGroup = "";
     $status = NULL;
     $creationDate = NULL;
     $expiryDate = NULL;
     $userIdentifiers = NULL;
     $primary_id = NULL;
     $statisticalCategory = NULL;
     $name_type = NULL;
开发者ID:HomerITS,项目名称:Alma,代码行数:31,代码来源:VoyagerCSVtoXML_v2.3.php

示例12: foreach

 function gglstmp_sitemapcreate()
 {
     global $wpdb, $gglstmp_settings;
     $str_post_type = "";
     foreach ($gglstmp_settings['post_type'] as $val) {
         if ($str_post_type != "") {
             $str_post_type .= ", ";
         }
         $str_post_type .= "'" . $val . "'";
     }
     $taxonomies = array();
     foreach ($gglstmp_settings['taxonomy'] as $val) {
         $taxonomies[] = $val;
     }
     $xml = new DomDocument('1.0', 'utf-8');
     $xml_stylesheet_path = defined('WP_CONTENT_DIR') ? home_url('/') . basename(WP_CONTENT_DIR) : home_url('/') . 'wp-content';
     $xml_stylesheet_path .= defined('WP_PLUGIN_DIR') ? '/' . basename(WP_PLUGIN_DIR) . '/google-sitemap-plugin/sitemap.xsl' : '/plugins/google-sitemap-plugin/sitemap.xsl';
     $xslt = $xml->createProcessingInstruction('xml-stylesheet', "type=\"text/xsl\" href=\"{$xml_stylesheet_path}\"");
     $xml->appendChild($xslt);
     $gglstmppr_urlset = $xml->appendChild($xml->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset'));
     if (!empty($str_post_type)) {
         $loc = $wpdb->get_results("SELECT `ID`, `post_modified` FROM {$wpdb->posts} WHERE `post_status` = 'publish' AND `post_type` IN (" . $str_post_type . ")");
         if (!empty($loc)) {
             foreach ($loc as $val) {
                 $gglstmppr_url = $gglstmppr_urlset->appendChild($xml->createElement('url'));
                 $loc = $gglstmppr_url->appendChild($xml->createElement('loc'));
                 $permalink = get_permalink($val->ID);
                 $loc->appendChild($xml->createTextNode($permalink));
                 $lastmod = $gglstmppr_url->appendChild($xml->createElement('lastmod'));
                 $now = $val->post_modified;
                 $date = date('Y-m-d\\TH:i:sP', strtotime($now));
                 $lastmod->appendChild($xml->createTextNode($date));
                 $changefreq = $gglstmppr_url->appendChild($xml->createElement('changefreq'));
                 $changefreq->appendChild($xml->createTextNode('monthly'));
                 $priority = $gglstmppr_url->appendChild($xml->createElement('priority'));
                 $priority->appendChild($xml->createTextNode(1.0));
             }
         }
     }
     if (!empty($taxonomies)) {
         foreach ($taxonomies as $value) {
             $terms = get_terms($value, 'hide_empty=1');
             if (!empty($terms) && !is_wp_error($terms)) {
                 foreach ($terms as $term_value) {
                     $gglstmppr_url = $gglstmppr_urlset->appendChild($xml->createElement('url'));
                     $loc = $gglstmppr_url->appendChild($xml->createElement('loc'));
                     $permalink = get_term_link((int) $term_value->term_id, $value);
                     $loc->appendChild($xml->createTextNode($permalink));
                     $lastmod = $gglstmppr_url->appendChild($xml->createElement('lastmod'));
                     $now = $wpdb->get_var("SELECT `post_modified` FROM {$wpdb->posts}, {$wpdb->term_relationships} WHERE `post_status` = 'publish' AND `term_taxonomy_id` = " . $term_value->term_taxonomy_id . " AND {$wpdb->posts}.ID= {$wpdb->term_relationships}.object_id ORDER BY `post_modified` DESC");
                     $date = date('Y-m-d\\TH:i:sP', strtotime($now));
                     $lastmod->appendChild($xml->createTextNode($date));
                     $changefreq = $gglstmppr_url->appendChild($xml->createElement('changefreq'));
                     $changefreq->appendChild($xml->createTextNode('monthly'));
                     $priority = $gglstmppr_url->appendChild($xml->createElement('priority'));
                     $priority->appendChild($xml->createTextNode(1.0));
                 }
             }
         }
     }
     $xml->formatOutput = true;
     if (is_multisite()) {
         $home_url = preg_replace("/[^a-zA-ZА-Яа-я0-9\\s]/", "_", str_replace('http://', '', str_replace('https://', '', home_url())));
         $xml->save(ABSPATH . 'sitemap_' . $home_url . '.xml');
     } else {
         $xml->save(ABSPATH . 'sitemap.xml');
     }
     gglstmp_sitemap_info();
 }
开发者ID:qcstw-dev,项目名称:qcsasia,代码行数:69,代码来源:google-sitemap-plugin.php

示例13: foreach

 function gglstmp_sitemapcreate()
 {
     global $wpdb;
     if (isset($_POST['gglstmp_settings'])) {
         $gglstmp_settings = $_POST['gglstmp_settings'];
     } else {
         global $gglstmp_settings;
     }
     $str = "";
     foreach ($gglstmp_settings as $val) {
         if ($str != "") {
             $str .= ", ";
         }
         $str .= "'" . $val . "'";
     }
     $xml = new DomDocument('1.0', 'utf-8');
     $xml_stylesheet_path = plugins_url() . "/google-sitemap-plugin/sitemap.xsl";
     $xslt = $xml->createProcessingInstruction('xml-stylesheet', "type=\"text/xsl\" href=\"{$xml_stylesheet_path}\"");
     $xml->appendChild($xslt);
     $urlset = $xml->appendChild($xml->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset'));
     if (!empty($str)) {
         $loc = $wpdb->get_results("SELECT ID, post_modified, post_status, post_type, ping_status FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type IN (" . $str . ")");
         foreach ($loc as $val) {
             $url = $urlset->appendChild($xml->createElement('url'));
             $loc = $url->appendChild($xml->createElement('loc'));
             $permalink = get_permalink($val->ID);
             $loc->appendChild($xml->createTextNode($permalink));
             $lastmod = $url->appendChild($xml->createElement('lastmod'));
             $now = $val->post_modified;
             $date = date('Y-m-d\\TH:i:sP', strtotime($now));
             $lastmod->appendChild($xml->createTextNode($date));
             $changefreq = $url->appendChild($xml->createElement('changefreq'));
             $changefreq->appendChild($xml->createTextNode('monthly'));
             $priority = $url->appendChild($xml->createElement('priority'));
             $priority->appendChild($xml->createTextNode(1.0));
         }
         $xml->formatOutput = true;
     }
     if (is_multisite()) {
         $home_url = preg_replace("/[^a-zA-ZА-Яа-я0-9\\s]/", "_", str_replace('http://', '', str_replace('https://', '', home_url())));
         $xml->save(ABSPATH . 'sitemap_' . $home_url . '.xml');
     } else {
         $xml->save(ABSPATH . 'sitemap.xml');
     }
 }
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:45,代码来源:google-sitemap-plugin.php

示例14: addIncludeReference

 /**
  * Internal function used to add another inlude statement to a supplied
  * XSLT stylesheet. Include will be added at end of stylesheet. 
  * 
  * @param DomDocument $xsltStylesheet	stylesheet to be modified
  * @param string $absoluteFilePath abs filepath of stylesheet to be imported
  */
 private static function addIncludeReference($xsltStylesheet, $absoluteFilePath)
 {
     $include_element = $xsltStylesheet->createElementNS("http://www.w3.org/1999/XSL/Transform", "xsl:include");
     $include_element->setAttribute("href", $absoluteFilePath);
     $xsltStylesheet->documentElement->appendChild($include_element);
 }
开发者ID:laiello,项目名称:xerxes-portal,代码行数:13,代码来源:Parser.php

示例15: getRelatedWords

 public static function getRelatedWords()
 {
     global $LINK_DB;
     $node_table = PWLemma::getTableName();
     $edge_table = PWRelatedWords::getTableName();
     // Construct DOM elements
     $xml = new DomDocument('1.0', 'UTF-8');
     $xml->formatOutput = true;
     // Nicely formats output with indentation and extra space
     $gexf = $xml->createElementNS(null, 'gexf');
     // Create new element node with an associated namespace
     $gexf = $xml->appendChild($gexf);
     // Assign namespaces for GexF with VIZ
     $gexf->setAttribute('xmlns:viz', 'http://www.gexf.net/1.1draft/viz');
     // Skip if you don't need viz!
     $gexf->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $gexf->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation', 'http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd');
     $gexf->setAttribute('version', '1.2');
     // Add Meta data
     $meta = $gexf->appendChild($xml->createElement('meta'));
     $meta->setAttribute('lastmodifieddate', date('Y-m-d'));
     $meta->appendChild($xml->createElement('creator', 'PHP GEXF Generator v0.1'));
     $meta->appendChild($xml->createElement('description', 'Related words'));
     // Add Graph data!
     $graph = $gexf->appendChild($xml->createElement('graph'));
     $nodes = $graph->appendChild($xml->createElement('nodes'));
     $edges = $graph->appendChild($xml->createElement('edges'));
     // Add Nodes!
     $res_node = $LINK_DB->query_e("SELECT * FROM {$node_table} WHERE id in (select lemma_id1 from {$edge_table}) or id in (select lemma_id2 from {$edge_table}) order by id", "Query failed in file <b>" . __FILE__ . "</b>, string <b>" . __LINE__ . "</b>");
     while ($row_node = $res_node->fetch_object()) {
         $node = $xml->createElement('node');
         $node->setAttribute('id', $row_node->id);
         $node->setAttribute('label', $row_node->lemma);
         /*
                 // Set color for node
                 $color = $xml->createElement('viz:color');
                 $color->setAttribute('r', '1');
                 $color->setAttribute('g', '1');
                 $color->setAttribute('b', '1');
                 $node->appendChild($color);
         
                 // Set position for node
                 $position = $xml->createElement('viz:position');
                 $position->setAttribute('x', '1');
                 $position->setAttribute('y', '1');
                 $position->setAttribute('z', '1');
                 $node->appendChild($position);
         
                 // Set size for node
                 $size = $xml->createElement('viz:size');
                 $size->setAttribute('value', '1');
                 $node->appendChild($size);
         
                 // Set shape for node
                 $shape = $xml->createElement('viz:shape');
                 $shape->setAttribute('value', 'disc');
                 $node->appendChild($shape);
         */
         $nodes->appendChild($node);
     }
     // Add Edges
     $res_relw = $LINK_DB->query_e("SELECT * FROM " . PWRelatedWords::getTableName() . " order by lemma_id1", "Query failed in file <b>" . __FILE__ . "</b>, string <b>" . __LINE__ . "</b>");
     while ($row_relw = $res_relw->fetch_object()) {
         $edge = $xml->createElement('edge');
         $edge->setAttribute('source', $row_relw->lemma_id1);
         $edge->setAttribute('target', $row_relw->lemma_id2);
         $edge->setAttribute('weight', $row_relw->weight);
         $edges->appendChild($edge);
     }
     return $xml->saveXML();
 }
开发者ID:stasonmokoron,项目名称:nerpa,代码行数:71,代码来源:PWGEXF.php


注:本文中的DomDocument::createElementNS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。