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


PHP Node::getContent方法代码示例

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


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

示例1: contentAccessors

 public function contentAccessors()
 {
     $content = '"This is interesting", Tom\'s friend said. "It\'s > 4 but < 2!"';
     $n = new Node('node');
     $n->setContent($content);
     $this->assertEquals($content, $n->getContent());
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:7,代码来源:NodeTest.class.php

示例2: applyArgs

 protected function applyArgs(Node $node)
 {
     if ($node instanceof TextNode) {
         $node->setContent($this->interpolate($node->getContent()));
     } else {
         if ($node instanceof Element) {
             foreach ($node->getAttributes() as $attr => $value) {
                 $node->setAttribute($attr, $this->interpolate($value));
             }
         }
     }
     foreach ($node->getChildren() as $child) {
         $this->applyArgs($child);
     }
 }
开发者ID:torbenkoehn,项目名称:php-xtpl,代码行数:15,代码来源:IncludeElement.php

示例3: getContent

 /**
  * Get content in iso-8859-1 encoding (the default).
  *
  * @param   string encoding
  * @param   var namespaces
  * @return  var data
  */
 public function getContent($encoding = NULL, $namespaces = NULL)
 {
     $ret = parent::getContent();
     @(list($ns, $t) = explode(':', @$this->getAttribute($namespaces[XMLNS_XSI] . ':type')));
     switch (strtolower($t)) {
         case 'base64':
         case 'base64binary':
             return new SOAPBase64Binary($ret, $encoded = TRUE);
             break;
         case 'hexbinary':
             return new SOAPHexBinary($ret, $encoded = TRUE);
             break;
         case 'boolean':
             return 0 == strncasecmp('true', $ret, 4) || 0 == strncasecmp('1', $ret, 1) ? TRUE : FALSE;
         case 'long':
         case 'int':
             $t = 'integer';
             break;
         case 'decimal':
         case 'float':
         case 'double':
             $t = 'double';
             break;
         case 'date':
         case 'datetime':
             // ISO 8601: http://www.w3.org/TR/xmlschema-2/#ISO8601 http://www.w3.org/TR/xmlschema-2/#dateTime
             return new Date($ret);
             break;
         default:
             $t = 'string';
     }
     // Decode if necessary
     switch (strtolower($encoding)) {
         case 'utf-8':
             $ret = iconv('utf-8', xp::ENCODING, $ret);
             break;
     }
     // Set type
     settype($ret, $t);
     return $ret;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:48,代码来源:XPSoapNode.class.php

示例4: insert

 /**
  * Insere Determinado Elemento na Árvore
  * @param Node $node Elemento para Inserção
  * @return Node Próprio Objeto para Encadeamento
  * @throws InvalidArgumentException Conteúdo do Nó Idêntico
  */
 public function insert(Node $node)
 {
     /* Conteúdo Idêntico */
     if ($node->getContent() == $this->getContent()) {
         $content = $node->getContent();
         throw new InvalidArgumentException("Conteúdo Inválido: Valores Idênticos '{$content}'");
     }
     $local = NULL;
     if ($node->getContent() < $this->getContent()) {
         $local = $this->getLeft();
         if ($local === NULL) {
             /* Esquerdo Vazio */
             $this->setLeft($node);
             return $this;
         }
     }
     if ($node->getContent() > $this->getContent()) {
         $local = $this->getRight();
         if ($local === NULL) {
             /* Direito Vazio */
             $this->setRight($node);
             return $this;
         }
     }
     /* Inserção de Subárvore */
     $local->insert($node);
     return $this;
 }
开发者ID:laiello,项目名称:wanderson,代码行数:34,代码来源:node.php

示例5: _unmarshall

 /**
  * Recursively deserialize data for the given node.
  *
  * @param   xml.Node node
  * @return  var
  * @throws  lang.IllegalArgumentException if the data cannot be deserialized
  * @throws  lang.ClassNotFoundException in case a XP object's class could not be loaded
  * @throws  xml.XMLFormatException
  */
 protected function _unmarshall(Node $node)
 {
     // value without type is supposed to be string (XML-RPC specs)
     if ('value' == $node->getName() && !isset($node->children[0])) {
         return (string) $node->getContent();
     }
     if (!isset($node->children[0])) {
         throw new XMLFormatException('Tried to access nonexistant node.');
     }
     // Simple form: If no subnode indicating the type exists, the type
     // is string, e.g. <value>Test</value>
     if (!$node->hasChildren()) {
         return (string) $node->getContent();
     }
     // Long form - with subnode, the type is derived from the node's name,
     // e.g. <value><string>Test</string></value>.
     $c = $node->nodeAt(0);
     switch ($c->getName()) {
         case 'struct':
             $ret = array();
             foreach ($c->getChildren() as $child) {
                 $data = array();
                 $data[$child->nodeAt(0)->getName()] = $child->nodeAt(0);
                 $data[$child->nodeAt(1)->getName()] = $child->nodeAt(1);
                 $ret[$data['name']->getContent()] = $this->_unmarshall($data['value']);
                 unset($data);
             }
             if (!isset($ret['__xp_class'])) {
                 return $ret;
             }
             // Check whether this is a XP object. If so, load the class and
             // create an instance without invoking the constructor.
             $fields = XPClass::forName($ret['__xp_class'])->getFields();
             $cname = array_search($ret['__xp_class'], xp::$cn, TRUE);
             $s = '';
             $n = 0;
             foreach ($fields as $field) {
                 if (!isset($ret[$field->getName()])) {
                     continue;
                 }
                 $m = $field->getModifiers();
                 if ($m & MODIFIER_STATIC) {
                     continue;
                 } else {
                     if ($m & MODIFIER_PUBLIC) {
                         $name = $field->getName();
                     } else {
                         if ($m & MODIFIER_PROTECTED) {
                             $name = "*" . $field->getName();
                         } else {
                             if ($m & MODIFIER_PRIVATE) {
                                 $name = "" . array_search($field->getDeclaringClass()->getName(), xp::$cn, TRUE) . "" . $field->getName();
                             }
                         }
                     }
                 }
                 $s .= 's:' . strlen($name) . ':"' . $name . '";' . serialize($ret[$field->getName()]);
                 $n++;
             }
             return unserialize('O:' . strlen($cname) . ':"' . $cname . '":' . $n . ':{' . $s . '}');
         case 'array':
             $ret = array();
             foreach ($c->nodeAt(0)->getChildren() as $child) {
                 $ret[] = $this->_unmarshall($child);
             }
             return $ret;
         case 'int':
         case 'i4':
             return (int) $c->getContent();
         case 'double':
             return (double) $c->getContent();
         case 'boolean':
             return (bool) $c->getContent();
         case 'string':
             return (string) $c->getContent();
         case 'dateTime.iso8601':
             return Date::fromString($c->getContent());
         case 'nil':
             return NULL;
         case 'base64':
             return new Bytes(base64_decode($c->getContent()));
         default:
             throw new IllegalArgumentException('Could not decode node as its type is not supported: ' . $c->getName());
     }
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:94,代码来源:XmlRpcDecoder.class.php


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