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


PHP Frame::is_text_node方法代码示例

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


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

示例1:

  function __construct(Frame $frame, DOMPDF $dompdf) {
    if ( !$frame->is_text_node() )
      throw new DOMPDF_Exception("Text_Decorator can only be applied to #text nodes.");

    parent::__construct($frame, $dompdf);
    $this->_text_spacing = null;
  }
开发者ID:hendrosteven,项目名称:f3-template,代码行数:7,代码来源:text_frame_decorator.cls.php

示例2: switch

 /**
  * Decorate a Frame
  *
  * @param Frame  $frame  The frame to decorate
  * @param DOMPDF $dompdf The dompdf instance
  * @param Frame  $root   The frame to decorate
  *
  * @throws DOMPDF_Exception
  * @return Frame_Decorator
  * FIXME: this is admittedly a little smelly...
  */
 static function decorate_frame(Frame $frame, DOMPDF $dompdf, Frame $root = null)
 {
     if (is_null($dompdf)) {
         throw new DOMPDF_Exception("The DOMPDF argument is required");
     }
     $style = $frame->get_style();
     // Floating (and more generally out-of-flow) elements are blocks
     // http://coding.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/
     if (!$frame->is_in_flow() && in_array($style->display, Style::$INLINE_TYPES)) {
         $style->display = "block";
     }
     $display = $style->display;
     switch ($display) {
         case "block":
             $positioner = "Block";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "inline-block":
             $positioner = "Inline";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "inline":
             $positioner = "Inline";
             if ($frame->is_text_node()) {
                 $decorator = "Text";
                 $reflower = "Text";
             } else {
                 $enable_css_float = $dompdf->get_option("enable_css_float");
                 if ($enable_css_float && $style->float !== "none") {
                     $decorator = "Block";
                     $reflower = "Block";
                 } else {
                     $decorator = "Inline";
                     $reflower = "Inline";
                 }
             }
             break;
         case "table":
             $positioner = "Block";
             $decorator = "Table";
             $reflower = "Table";
             break;
         case "inline-table":
             $positioner = "Inline";
             $decorator = "Table";
             $reflower = "Table";
             break;
         case "table-row-group":
         case "table-header-group":
         case "table-footer-group":
             $positioner = "Null";
             $decorator = "Table_Row_Group";
             $reflower = "Table_Row_Group";
             break;
         case "table-row":
             $positioner = "Null";
             $decorator = "Table_Row";
             $reflower = "Table_Row";
             break;
         case "table-cell":
             $positioner = "Table_Cell";
             $decorator = "Table_Cell";
             $reflower = "Table_Cell";
             break;
         case "list-item":
             $positioner = "Block";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "-dompdf-list-bullet":
             if ($style->list_style_position === "inside") {
                 $positioner = "Inline";
             } else {
                 $positioner = "List_Bullet";
             }
             if ($style->list_style_image !== "none") {
                 $decorator = "List_Bullet_Image";
             } else {
                 $decorator = "List_Bullet";
             }
             $reflower = "List_Bullet";
             break;
         case "-dompdf-image":
             $positioner = "Inline";
             $decorator = "Image";
             $reflower = "Image";
             break;
//.........这里部分代码省略.........
开发者ID:farzad1120,项目名称:tripexpress,代码行数:101,代码来源:frame_factory.cls.php

示例3: _page_break_allowed


//.........这里部分代码省略.........
         // page_break_inside property.
         $parent = $frame->get_parent();
         if ($prev && $parent && $parent->get_style()->page_break_inside === "avoid") {
             dompdf_debug("page-break", "parent inside: avoid");
             return false;
         }
         // To prevent cascading page breaks when a top-level element has
         // page-break-inside: avoid, ensure that at least one frame is
         // on the page before splitting.
         if ($parent->get_node()->nodeName === "body" && !$prev) {
             // We are the body's first child
             dompdf_debug("page-break", "Body's first child.");
             return false;
         }
         // If the frame is the first block-level frame, use the value from
         // $frame's parent instead.
         if (!$prev && $parent) {
             return $this->_page_break_allowed($parent);
         }
         dompdf_debug("page-break", "block: break allowed");
         return true;
     } else {
         if (in_array($display, Style::$INLINE_TYPES)) {
             // Avoid breaks within table-cells
             if ($this->_in_table) {
                 dompdf_debug("page-break", "In table: " . $this->_in_table);
                 return false;
             }
             // Rule C
             $block_parent = $frame->find_block_parent();
             if (count($block_parent->get_line_boxes()) < $frame->get_style()->orphans) {
                 dompdf_debug("page-break", "orphans");
                 return false;
             }
             // FIXME: Checking widows is tricky without having laid out the
             // remaining line boxes.  Just ignore it for now...
             // Rule D
             $p = $block_parent;
             while ($p) {
                 if ($p->get_style()->page_break_inside === "avoid") {
                     dompdf_debug("page-break", "parent->inside: avoid");
                     return false;
                 }
                 $p = $p->find_block_parent();
             }
             // To prevent cascading page breaks when a top-level element has
             // page-break-inside: avoid, ensure that at least one frame with
             // some content is on the page before splitting.
             $prev = $frame->get_prev_sibling();
             while ($prev && ($prev->is_text_node() && trim($prev->get_node()->nodeValue) == "")) {
                 $prev = $prev->get_prev_sibling();
             }
             if ($block_parent->get_node()->nodeName === "body" && !$prev) {
                 // We are the body's first child
                 dompdf_debug("page-break", "Body's first child.");
                 return false;
             }
             // Skip breaks on empty text nodes
             if ($frame->is_text_node() && $frame->get_node()->nodeValue == "") {
                 return false;
             }
             dompdf_debug("page-break", "inline: break allowed");
             return true;
             // Table-rows
         } else {
             if ($display === "table-row") {
                 // Simply check if the parent table's page_break_inside property is
                 // not 'avoid'
                 $p = Table_Frame_Decorator::find_parent_table($frame);
                 while ($p) {
                     if ($p->get_style()->page_break_inside === "avoid") {
                         dompdf_debug("page-break", "parent->inside: avoid");
                         return false;
                     }
                     $p = $p->find_block_parent();
                 }
                 // Avoid breaking after the first row of a table
                 if ($p && $p->get_first_child() === $frame) {
                     dompdf_debug("page-break", "table: first-row");
                     return false;
                 }
                 // If this is a nested table, prevent the page from breaking
                 if ($this->_in_table > 1) {
                     dompdf_debug("page-break", "table: nested table");
                     return false;
                 }
                 dompdf_debug("page-break", "table-row/row-groups: break allowed");
                 return true;
             } else {
                 if (in_array($display, Table_Frame_Decorator::$ROW_GROUPS)) {
                     // Disallow breaks at row-groups: only split at row boundaries
                     return false;
                 } else {
                     dompdf_debug("page-break", "? " . $frame->get_style()->display . "");
                     return false;
                 }
             }
         }
     }
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:101,代码来源:page_frame_decorator.cls.php

示例4: Exception

 /**
  * Decorate a Frame
  *
  * @param $root Frame The frame to decorate
  * @param $dompdf DOMPDF The dompdf instance
  * @return Frame_Decorator
  * FIXME-notes: this is admittedly a little smelly...
  */
 static function decorate_frame(Frame $frame, DOMPDF $dompdf)
 {
     if (is_null($dompdf)) {
         throw new Exception("foo");
     }
     $style = $frame->get_style();
     switch ($style->display) {
         case "block":
             $positioner = "Block";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "inline-block":
             $positioner = "Inline";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "inline":
             $positioner = "Inline";
             if ($frame->is_text_node()) {
                 $decorator = "Text";
                 $reflower = "Text";
             } else {
                 if (DOMPDF_ENABLE_CSS_FLOAT && $style->float !== "none") {
                     $decorator = "Block";
                     $reflower = "Block";
                 } else {
                     $decorator = "Inline";
                     $reflower = "Inline";
                 }
             }
             break;
         case "table":
             $positioner = "Block";
             $decorator = "Table";
             $reflower = "Table";
             break;
         case "inline-table":
             $positioner = "Inline";
             $decorator = "Table";
             $reflower = "Table";
             break;
         case "table-row-group":
         case "table-header-group":
         case "table-footer-group":
             $positioner = "Null";
             $decorator = "Table_Row_Group";
             $reflower = "Table_Row_Group";
             break;
         case "table-row":
             $positioner = "Null";
             $decorator = "Table_Row";
             $reflower = "Table_Row";
             break;
         case "table-cell":
             $positioner = "Table_Cell";
             $decorator = "Table_Cell";
             $reflower = "Table_Cell";
             break;
         case "list-item":
             $positioner = "Block";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "-dompdf-list-bullet":
             if ($style->list_style_position === "inside") {
                 $positioner = "Inline";
             } else {
                 $positioner = "List_Bullet";
             }
             if ($style->list_style_image !== "none") {
                 $decorator = "List_Bullet_Image";
             } else {
                 $decorator = "List_Bullet";
             }
             $reflower = "List_Bullet";
             break;
         case "-dompdf-image":
             $positioner = "Inline";
             $decorator = "Image";
             $reflower = "Image";
             break;
         case "-dompdf-br":
             $positioner = "Inline";
             $decorator = "Inline";
             $reflower = "Inline";
             break;
         default:
             // Fixme-note: should throw some sort of warning or something?
         // Fixme-note: should throw some sort of warning or something?
         case "none":
             $positioner = "Null";
//.........这里部分代码省略.........
开发者ID:bukastudio,项目名称:themes-2016,代码行数:101,代码来源:frame_factory.cls.php

示例5: _page_break_allowed

 protected function _page_break_allowed(Frame $frame)
 {
     $block_types = array("block", "list-item", "table", "-dompdf-image");
     dompdf_debug("page-break", "_page_break_allowed(" . $frame->get_node()->nodeName . ")");
     $display = $frame->get_style()->display;
     if (in_array($display, $block_types)) {
         if ($this->_in_table) {
             dompdf_debug("page-break", "In table: " . $this->_in_table);
             return false;
         }
         if ($frame->get_style()->page_break_before === "avoid") {
             dompdf_debug("page-break", "before: avoid");
             return false;
         }
         $prev = $frame->get_prev_sibling();
         while ($prev && !in_array($prev->get_style()->display, $block_types)) {
             $prev = $prev->get_prev_sibling();
         }
         if ($prev && $prev->get_style()->page_break_after === "avoid") {
             dompdf_debug("page-break", "after: avoid");
             return false;
         }
         $parent = $frame->get_parent();
         if ($prev && $parent && $parent->get_style()->page_break_inside === "avoid") {
             dompdf_debug("page-break", "parent inside: avoid");
             return false;
         }
         if ($parent->get_node()->nodeName === "body" && !$prev) {
             dompdf_debug("page-break", "Body's first child.");
             return false;
         }
         if (!$prev && $parent) {
             return $this->_page_break_allowed($parent);
         }
         dompdf_debug("page-break", "block: break allowed");
         return true;
     } else {
         if (in_array($display, Style::$INLINE_TYPES)) {
             if ($this->_in_table) {
                 dompdf_debug("page-break", "In table: " . $this->_in_table);
                 return false;
             }
             $block_parent = $frame->find_block_parent();
             if (count($block_parent->get_line_boxes()) < $frame->get_style()->orphans) {
                 dompdf_debug("page-break", "orphans");
                 return false;
             }
             $p = $block_parent;
             while ($p) {
                 if ($p->get_style()->page_break_inside === "avoid") {
                     dompdf_debug("page-break", "parent->inside: avoid");
                     return false;
                 }
                 $p = $p->find_block_parent();
             }
             $prev = $frame->get_prev_sibling();
             while ($prev && ($prev->is_text_node() && trim($prev->get_node()->nodeValue) == "")) {
                 $prev = $prev->get_prev_sibling();
             }
             if ($block_parent->get_node()->nodeName === "body" && !$prev) {
                 dompdf_debug("page-break", "Body's first child.");
                 return false;
             }
             if ($frame->is_text_node() && $frame->get_node()->nodeValue == "") {
                 return false;
             }
             dompdf_debug("page-break", "inline: break allowed");
             return true;
         } else {
             if ($display === "table-row") {
                 $p = Table_Frame_Decorator::find_parent_table($frame);
                 while ($p) {
                     if ($p->get_style()->page_break_inside === "avoid") {
                         dompdf_debug("page-break", "parent->inside: avoid");
                         return false;
                     }
                     $p = $p->find_block_parent();
                 }
                 if ($p && $p->get_first_child() === $frame) {
                     dompdf_debug("page-break", "table: first-row");
                     return false;
                 }
                 if ($this->_in_table > 1) {
                     dompdf_debug("page-break", "table: nested table");
                     return false;
                 }
                 dompdf_debug("page-break", "table-row/row-groups: break allowed");
                 return true;
             } else {
                 if (in_array($display, Table_Frame_Decorator::$ROW_GROUPS)) {
                     return false;
                 } else {
                     dompdf_debug("page-break", "? " . $frame->get_style()->display . "");
                     return false;
                 }
             }
         }
     }
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:99,代码来源:page_frame_decorator.cls.php

示例6: Exception

 /**
  * Decorate a Frame 
  * 
  * @param $root Frame The frame to decorate
  * @param $dompdf DOMPDF The dompdf instance
  * @return Frame_Decorator
  * FIXME: this is admittedly a little smelly...
  */
 static function decorate_frame(Frame $frame, DOMPDF $dompdf, Frame $root = null)
 {
     if (is_null($dompdf)) {
         throw new Exception("foo");
     }
     $style = $frame->get_style();
     $display = $style->display;
     switch ($display) {
         case "block":
             $positioner = "Block";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "inline-block":
             $positioner = "Inline";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "inline":
             $positioner = "Inline";
             if ($frame->is_text_node()) {
                 $decorator = "Text";
                 $reflower = "Text";
             } else {
                 if (DOMPDF_ENABLE_CSS_FLOAT && $style->float !== "none") {
                     $decorator = "Block";
                     $reflower = "Block";
                 } else {
                     $decorator = "Inline";
                     $reflower = "Inline";
                 }
             }
             break;
         case "table":
             $positioner = "Block";
             $decorator = "Table";
             $reflower = "Table";
             break;
         case "inline-table":
             $positioner = "Inline";
             $decorator = "Table";
             $reflower = "Table";
             break;
         case "table-row-group":
         case "table-header-group":
         case "table-footer-group":
             $positioner = "Null";
             $decorator = "Table_Row_Group";
             $reflower = "Table_Row_Group";
             break;
         case "table-row":
             $positioner = "Null";
             $decorator = "Table_Row";
             $reflower = "Table_Row";
             break;
         case "table-cell":
             $positioner = "Table_Cell";
             $decorator = "Table_Cell";
             $reflower = "Table_Cell";
             break;
         case "list-item":
             $positioner = "Block";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "-dompdf-list-bullet":
             if ($style->list_style_position === "inside") {
                 $positioner = "Inline";
             } else {
                 $positioner = "List_Bullet";
             }
             if ($style->list_style_image !== "none") {
                 $decorator = "List_Bullet_Image";
             } else {
                 $decorator = "List_Bullet";
             }
             $reflower = "List_Bullet";
             break;
         case "-dompdf-image":
             $positioner = "Inline";
             $decorator = "Image";
             $reflower = "Image";
             break;
         case "-dompdf-br":
             $positioner = "Inline";
             $decorator = "Inline";
             $reflower = "Inline";
             break;
         default:
             // FIXME: should throw some sort of warning or something?
         // FIXME: should throw some sort of warning or something?
         case "none":
//.........这里部分代码省略.........
开发者ID:nvdnkpr,项目名称:dompdf,代码行数:101,代码来源:frame_factory.cls.php


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