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


PHP Frame::append_child方法代码示例

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


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

示例1: while

 function append_child(Frame $child, $update_node = true)
 {
     while ($child instanceof Frame_Decorator) {
         $child = $child->_frame;
     }
     $this->_frame->append_child($child, $update_node);
 }
开发者ID:SkMamtajuddin,项目名称:bamboo-invoice,代码行数:7,代码来源:frame_decorator.cls.php

示例2: _build_tree_r

 /**
  * Recursively adds {@link Frame} objects to the tree
  *
  * Recursively build a tree of Frame objects based on a dom tree.
  * No layout information is calculated at this time, although the
  * tree may be adjusted (i.e. nodes and frames for generated content
  * and images may be created).
  *
  * @param DomNode $node the current DomNode being considered
  * @return Frame
  */
 protected function _build_tree_r(DomNode $node)
 {
     $frame = new Frame($node);
     $id = $frame->get_id();
     $this->_registry[$id] = $frame;
     if (!$node->hasChildNodes()) {
         return $frame;
     }
     // Fixes 'cannot access undefined property for object with
     // overloaded access', fix by Stefan radulian
     // <stefan.radulian@symbion.at>
     //foreach ($node->childNodes as $child) {
     // Store the children in an array so that the tree can be modified
     $children = array();
     for ($i = 0; $i < $node->childNodes->length; $i++) {
         $children[] = $node->childNodes->item($i);
     }
     foreach ($children as $child) {
         $node_name = mb_strtolower($child->nodeName);
         // Skip non-displaying nodes
         if (in_array($node_name, self::$_HIDDEN_TAGS)) {
             if ($node_name !== "head" && $node_name !== "style") {
                 $child->parentNode->removeChild($child);
             }
             continue;
         }
         // Skip empty text nodes
         if ($node_name === "#text" && $child->nodeValue == "") {
             $child->parentNode->removeChild($child);
             continue;
         }
         // Skip empty image nodes
         if ($node_name === "img" && $child->getAttribute("src") == "") {
             $child->parentNode->removeChild($child);
             continue;
         }
         $frame->append_child($this->_build_tree_r($child), false);
     }
     return $frame;
 }
开发者ID:agashish,项目名称:test_new,代码行数:51,代码来源:frame_tree.cls.php

示例3: _build_tree_r

  /**
   * Recursively adds {@link Frame} objects to the tree
   *
   * Recursively build a tree of Frame objects based on a dom tree.
   * No layout information is calculated at this time, although the
   * tree may be adjusted (i.e. nodes and frames for generated content
   * and images may be created).
   *
   * @param DomNode $node the current DomNode being considered
   * @return Frame
   */
  protected function _build_tree_r(DomNode $node) {
    
    $frame = new Frame($node);
    $id = $frame->get_id();
    $this->_registry[ $id ] = $frame;
    
    if ( !$node->hasChildNodes() )
      return $frame;

    // Fixes 'cannot access undefined property for object with
    // overloaded access', fix by Stefan radulian
    // <stefan.radulian@symbion.at>    
    //foreach ($node->childNodes as $child) {

    // Store the children in an array so that the tree can be modified
    $children = array();
    for ($i = 0; $i < $node->childNodes->length; $i++)
      $children[] = $node->childNodes->item($i);

    foreach ($children as $child) {
      // Skip non-displaying nodes
      if ( in_array( mb_strtolower($child->nodeName), self::$_HIDDEN_TAGS) )  {
        if ( mb_strtolower($child->nodeName) != "head" &&
             mb_strtolower($child->nodeName) != "style" ) 
          $child->parentNode->removeChild($child);
        continue;
      }

      // Skip empty text nodes
      if ( $child->nodeName == "#text" && $child->nodeValue == "" ) {
        $child->parentNode->removeChild($child);
        continue;
      }
      
      // Add a container frame for images
      if ( $child->nodeName == "img" ) {
        $img_node = $child->ownerDocument->createElement("img_inner");
     
        // Move attributes to inner node        
        foreach ( $child->attributes as $attr => $attr_node ) {
          // Skip style, but move all other attributes
          if ( $attr == "style" )
            continue;
       
          $img_node->setAttribute($attr, $attr_node->value);
        }

        foreach ( $child->attributes as $attr => $node ) {
          if ( $attr == "style" )
            continue;
          $child->removeAttribute($attr);
        }

        $child->appendChild($img_node);
      }
   
      $frame->append_child($this->_build_tree_r($child), false);

    }
    
    return $frame;
  }
开发者ID:piyapan,项目名称:Oms,代码行数:73,代码来源:frame_tree.cls.php

示例4: _build_tree_r

 protected function _build_tree_r(DomNode $node)
 {
     $frame = new Frame($node);
     $id = $frame->get_id();
     $this->_registry[$id] = $frame;
     if (!$node->hasChildNodes()) {
         return $frame;
     }
     $children = array();
     for ($i = 0; $i < $node->childNodes->length; $i++) {
         $children[] = $node->childNodes->item($i);
     }
     foreach ($children as $child) {
         $node_name = mb_strtolower($child->nodeName);
         if (in_array($node_name, self::$_HIDDEN_TAGS)) {
             if ($node_name !== "head" && $node_name !== "style") {
                 $child->parentNode->removeChild($child);
             }
             continue;
         }
         if ($node_name === "#text" && $child->nodeValue == "") {
             $child->parentNode->removeChild($child);
             continue;
         }
         if ($node_name === "img" && $child->getAttribute("src") == "") {
             $child->parentNode->removeChild($child);
             continue;
         }
         $frame->append_child($this->_build_tree_r($child), false);
     }
     return $frame;
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:32,代码来源:frame_tree.cls.php

示例5: _build_tree_r

 /**
  * Recursively adds {@link Frame} objects to the tree
  *
  * Recursively build a tree of Frame objects based on a dom tree.
  * No layout information is calculated at this time, although the
  * tree may be adjusted (i.e. nodes and frames for generated content
  * and images may be created).
  *
  * @param DomNode $node the current DomNode being considered
  * @return Frame
  */
 protected function _build_tree_r(DomNode $node)
 {
     $frame = new Frame($node);
     $frame->set_id($id = uniqid(rand()));
     $this->_registry[$id] = $frame;
     if (!$node->hasChildNodes()) {
         return $frame;
     }
     foreach ($node->childNodes as $child) {
         // Skip non-displaying nodes
         if (in_array($child->nodeName, self::$_HIDDEN_TAGS)) {
             continue;
         }
         // Skip empty #text nodes
         if ($child->nodeName == "#text" && $child->nodeValue == "") {
             continue;
         }
         // Add a container frame for images
         if ($child->nodeName == "img") {
             $img_node = $child->ownerDocument->createElement("img_inner");
             // Move attributes to inner node
             foreach ($child->attributes as $attr => $attr_node) {
                 // Skip style, but move all other attributes
                 if ($attr == "style") {
                     continue;
                 }
                 $img_node->setAttribute($attr, $attr_node->value);
             }
             foreach ($child->attributes as $attr => $node) {
                 if ($attr == "style") {
                     continue;
                 }
                 $child->removeAttribute($attr);
             }
             $child->appendChild($img_node);
         }
         $frame->append_child($this->_build_tree_r($child), false);
     }
     return $frame;
 }
开发者ID:andrewroth,项目名称:c4c_intranet,代码行数:51,代码来源:frame_tree.cls.php

示例6: _build_tree_r

 /**
  * Recursively adds {@link Frame} objects to the tree
  *
  * Recursively build a tree of Frame objects based on a dom tree.
  * No layout information is calculated at this time, although the
  * tree may be adjusted (i.e. nodes and frames for generated content
  * and images may be created).
  *
  * @param DOMNode $node the current DOMNode being considered
  * @return Frame
  */
 protected function _build_tree_r(DOMNode $node)
 {
     $node_name = mb_strtolower($node->nodeName);
     switch ($node_name) {
         // Let's dump inner svg elements into src attribute so the image renderer could take care of it
         case 'svg':
             /** @var DOMElement $node; */
             if ($node->hasChildNodes()) {
                 $node->setAttribute('src', 'data:image/svg+xml,' . self::exportOuterXML($node));
             }
             $frame = new Frame($node);
             $id = $frame->get_id();
             $this->_registry[$id] = $frame;
             return $frame;
         default:
             $frame = new Frame($node);
             $id = $frame->get_id();
             $this->_registry[$id] = $frame;
             if (!$node->hasChildNodes()) {
                 return $frame;
             }
             // Fixes 'cannot access undefined property for object with
             // overloaded access', fix by Stefan radulian
             // <stefan.radulian@symbion.at>
             //foreach ($node->childNodes as $child) {
             // Store the children in an array so that the tree can be modified
             $children = array();
             for ($i = 0; $i < $node->childNodes->length; $i++) {
                 $children[] = $node->childNodes->item($i);
             }
             foreach ($children as $child) {
                 $node_name = mb_strtolower($child->nodeName);
                 // Skip non-displaying nodes
                 if (in_array($node_name, self::$_HIDDEN_TAGS)) {
                     if ($node_name !== "head" && $node_name !== "style") {
                         $child->parentNode->removeChild($child);
                     }
                     continue;
                 }
                 // Skip empty text nodes
                 if ($node_name === "#text" && $child->nodeValue == "") {
                     $child->parentNode->removeChild($child);
                     continue;
                 }
                 // Skip empty image nodes
                 if ($node_name === "img" && $child->getAttribute("src") == "") {
                     $child->parentNode->removeChild($child);
                     continue;
                 }
                 $frame->append_child($this->_build_tree_r($child), false);
             }
             return $frame;
     }
 }
开发者ID:mezhenko,项目名称:dompdf,代码行数:65,代码来源:frame_tree.cls.php


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