當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Frame::position方法代碼示例

本文整理匯總了PHP中Frame::position方法的典型用法代碼示例。如果您正苦於以下問題:PHP Frame::position方法的具體用法?PHP Frame::position怎麽用?PHP Frame::position使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Frame的用法示例。


在下文中一共展示了Frame::position方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: foreach

 function add_frame_to_line(Frame $frame)
 {
     // Handle inline frames (which are effectively wrappers)
     if ($frame instanceof Inline_Frame_Decorator) {
         // Handle line breaks
         if ($frame->get_node()->nodeName == "br") {
             $this->maximize_line_height($frame->get_style()->length_in_pt($frame->get_style()->line_height));
             $this->add_line();
             return;
         }
         // Add each child of the inline frame to the line individually
         foreach ($frame->get_children() as $child) {
             $this->add_frame_to_line($child);
         }
         return;
     }
     // Trim leading text if this is an empty line.  Kinda a hack to put it here,
     // but what can you do...
     if ($this->_lines[$this->_cl]["w"] == 0 && $frame->get_node()->nodeName == "#text" && ($frame->get_style()->white_space != "pre" || $frame->get_style()->white_space != "pre-wrap")) {
         $frame->set_text(ltrim($frame->get_text()));
         $frame->recalculate_width();
     }
     $w = $frame->get_margin_width();
     if ($w == 0) {
         return;
     }
     // Debugging code:
     /*
     pre_r("\nAdding frame to line:");
     
     //    pre_r("Me: " . $this->get_node()->nodeName . " (" . (string)$this->get_node() . ")");
     //    pre_r("Node: " . $frame->get_node()->nodeName . " (" . (string)$frame->get_node() . ")");
     if ( $frame->get_node()->nodeName == "#text" )
       pre_r($frame->get_node()->nodeValue);
     
     pre_r("Line width: " . $this->_lines[$this->_cl]["w"]);
     pre_r("Frame: " . get_class($frame));
     pre_r("Frame width: "  . $w);
     pre_r("Frame height: " . $frame->get_margin_height());
     pre_r("Containing block width: " . $this->get_containing_block("w"));
     */
     // End debugging
     if ($this->_lines[$this->_cl]["w"] + $w > $this->get_containing_block("w")) {
         $this->add_line();
     }
     $frame->position();
     $this->_lines[$this->_cl]["frames"][] = $frame;
     if ($frame->get_node()->nodeName == "#text") {
         $this->_lines[$this->_cl]["wc"] += count(preg_split("/\\s+/", $frame->get_text()));
     }
     $this->_lines[$this->_cl]["w"] += $w;
     $this->_lines[$this->_cl]["h"] = max($this->_lines[$this->_cl]["h"], $frame->get_margin_height());
 }
開發者ID:sgrove,項目名稱:cothinker,代碼行數:53,代碼來源:block_frame_decorator.cls.php

示例2: foreach

 function add_frame_to_line(Frame $frame)
 {
     // Handle inline frames (which are effectively wrappers)
     if ($frame instanceof Inline_Frame_Decorator) {
         // Add each child of the inline frame to the line individually
         foreach ($frame->get_children() as $child) {
             $this->add_frame_to_line($child);
         }
         return;
     }
     if ($frame->get_margin_width() == 0) {
         return;
     }
     $w = $frame->get_margin_width();
     // Debugging code:
     //     pre_r("\nAdding frame to line:");
     //     pre_r("Me: " . $this->get_node()->nodeName . " (" . (string)$this->get_node() . ")");
     //     pre_r("Node: " . $frame->get_node()->nodeName . " (" . (string)$frame->get_node() . ")");
     //     if ( $frame->get_node()->nodeName == "#text" )
     //       pre_r($frame->get_node()->nodeValue);
     //     pre_r("Line width: " . $this->_lines[$this->_cl]["w"]);
     //     pre_r("Frame width: "  . $w);
     //     pre_r("Frame height: " . $frame->get_margin_height());
     //     pre_r("Containing block width: " . $this->get_containing_block("w"));
     // End debugging
     if ($this->_lines[$this->_cl]["w"] + $w >= $this->get_containing_block("w")) {
         $this->add_line();
     }
     $frame->position();
     $this->_lines[$this->_cl]["frames"][] = $frame;
     if ($frame->get_node()->nodeName == "#text") {
         $this->_lines[$this->_cl]["wc"] += count(preg_split("/\\s+/", $frame->get_text()));
     }
     $this->_lines[$this->_cl]["w"] += $w;
     $this->_lines[$this->_cl]["h"] = max($this->_lines[$this->_cl]["h"], $frame->get_margin_height());
 }
開發者ID:andrewroth,項目名稱:c4c_intranet,代碼行數:36,代碼來源:block_frame_decorator.cls.php


注:本文中的Frame::position方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。