GIF89a=( �' 7IAXKgNgYvYx\%wh&h}t�h%�s%x�}9�R��&�0%� (�.��5�SD��&�a)�x5��;ͣ*ȡ&ղ)ׯ7׵<ѻ4�3�H֧KͯT��Y�aq��q��F� !� ' !� NETSCAPE2.0 , =( ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g���E�������R���E����B�� ��ȸ��D���"�Ů� �H��L��D٫D�B�����D���T���H �G��A R�ڐ |�� ٭&��E8�S�kG�A�px�a��� R2XB��E8I���6X�:vT)�~��q�賥��"F~%x� � 4#Z�0O|-4Bs�X:= Q� Sal��yXJ`GȦ|s h��K3l7�B|�$'7Jީܪ0!��D�n=�P� ����0`�R�lj����v>���5 �.69�ϸd�����nlv�9��f{���Pbx �l5}�p� ��� �3a���I�O����!ܾ���i��9��#��)p�a ޽ �{�)vm��%D~ 6f��s}Œ�D�W E�`!� �&L8x� �ܝ{)x`X/>�}m��R�*|`D�=�_ ^�5 !_&'a�O�7�c��`DCx`�¥�9�Y�F���`?��"� �n@`�} lď��@4>�d S �v�xN��"@~d��=�g�s~G��� ���ud &p8Q�)ƫlXD����A~H�ySun�j���k*D�LH�] ��C"J��Xb~ʪwSt}6K,��q�S:9ت:���l�@�`�� �.۬�t9�S�[:��=`9N����{¿�A !R�:���6��x�0�_ �;������^���#����!����U���;0L1�����p% A��U̬ݵ��%�S��!���~`�G���� ���=4�np�3���������u�u�ٮ|%2�I��r�#0��J``8�@S@5� ���^`8E�]�.�S���7 � �0�j S�D� z���i�S�����!���l��w9*�D�I�nEX��� &A�Go�Qf��F��;���}�J����F5��Q|���X��T��y���]� o ��C=��:���PB@ D׽S�(>�C�x}`��xJЬ�۠��p+eE0`�}`A �/NE�� �9@��� H�7�!%B0`�l*��!8 2�%� �:�1�0E��ux%nP1�!�C)�P81l�ɸF#Ƭ{����B0>�� �b�`��O3��()yRpb��E.ZD8�H@% �Rx+%���c� ���f��b�d�`F�"8�XH"��-�|1�6iI, 2�$+](A*j� QT�o0.�U�`�R�}`�SN����yae�����b��o~ S)�y�@��3 �tT�0�&�+~L�f"�-|�~��>!�v��~�\Q1)}@�}h#aP72�"�$ !� " , =( &7IAXG]KgNgYvYxR"k\%w]'}h}t�h%�g+�s%r.m3ax3�x�}9��&��+�!7�0%� (�.�SD��&��;�"&ײ)׻4��6�K� �@pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E �� �������E �´��C���ǶR��D��"Ʒ�ʱH��M��GڬD�B����D��T����G���C�C� l&�~:'�tU�6ɹ#��)�'�.6�&��Ȼ K(8p0N�?!�2"��NIJX>R��OM '��2�*x�>#n� �@<[:�I�f ��T���Cdb��[�}E�5MBo��@�`@��tW-3 �x�B���jI�&E�9[T&$��ﯧ&"s��ȳ����dc�UUρ#���ldj?����`\}���u|3'�R]�6 �S#�!�FKL�*N E���`$�:e�YD�q�.�촁�s \-�jA 9�����-��M[�x(�s��x�|���p��}k�T�DpE@W� ��]k`1� ���Yb ��0l��*n0��"~zBd�~u�7�0Bl��0-�x~|U�U0 �h�*HS�|��e"#"?vp�i`e6^�+q��`m8 #V�� ��VS|`��"m"сSn|@:U���~`pb�G�ED����2F�I�? >�x� R� ��%~jx��<�a�9ij�2�D��&: Z`�]w���:�6��B�7eFJ|�ҧ�,���FǮcS�ʶ+B�,�ܺN���>PAD�HD��~���n��}�#�� Q��S���2�X�{�k�lQ�2�����w�|2� h9��G�,m���3��6-��E�L��I�³*K���q�`DwV�QXS��peS��� qܧTS����R�u �<�a�*At�lmE� � ��N[P1�ۦ��$��@`��Dpy�yXvCAy�B`}D� 0QwG#� �a[^�� $���Ǧ{L�"[��K�g�;�S~��GX.�goT.��ư��x���?1z��x~:�g�|�L� ��S`��0S]P�^p F<""�?!,�!N4&P� ����:T�@h�9%t��:�-~�I<`�9p I&.)^ 40D#p@�j4�ج:�01��rܼF2oW�#Z ;$Q q  �K��Nl#29 !F@�Bh�ᏬL!XF�LHKh�.�hE&J�G��<"WN!�����Y@� >R~19J"�2,/ &.GXB%�R�9B6�W]���W�I�$��9�RE8Y� ��"�A5�Q.axB�&ة�J�! �t)K%tS-�JF b�NMxL��)�R��"���6O!TH�H� 0 !� ) , =( &AXKgNgYvYxR"k\%wh&h}h%�g+�s%r.x3�x�}9��&��+�R,�!7�0%� (�.��5��&�a)��;�"&ף*Ȳ)ׯ7׻4�3��6�H֧KͻH�T��Y��q��h� ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E$����� � ����$E$��"��D� � ������R��C��� E ��H�M��G�D� �B��ϾD��a��`1r��Ӑ�� �o~�zU!L�C'�yW�UGt����ll�0���uG�)A�s[��x� �xO%��X2�  P�n:R/��aHae+�Dm?# ǣ6�8�J�x�Di�M���j���5oQ7�- <! *�l��R2r/a!l)d� A"�E���� &� ;��c �%����b��pe~C"B���H�eF2��`8qb�t_`ur`e� w�u3��Pv�h""�`�Íx�LĹ��3� �~ֺ�:���MDfJ� �۵�W�%�S�X �؁)�@��:E��w�u�Sxb8y\m�zS��Zb�E�L��w!y(>�"w�=�|��s�d �C�W)H�cC$�L �7r.�\{)@�`@ �X�$PD `aaG:���O�72E�amn]�"Rc�x�R� &dR8`g��i�xLR!�P &d����T���i�|�_ � Qi�#�`g:��:noM� :V �)p����W&a=�e�k� j���1߲s�x�W�jal|0��B0�, \j۴:6���C ��W��|��9���zĸV {�;��n��V�m�I��.��PN� ����C��+��By�ѾHŸ:��� 7�Y�FTk�SaoaY$D�S���29R�kt� ��f� ��:��Sp�3�I��DZ� �9���g��u�*3)O��[_hv ,���Et x�BH� �[��64M@�S�M7d�l�ܶ5-��U܍��z�R3Ԭ3~ ��P��5�g: ���kN�&0�j4���#{��3S�2�K�'ợl���2K{� {۶?~m𸧠�I�nE�='����^���_�=��~�#O���'���o..�Y�n��CSO��a��K��o,���b�����{�C�� "�{�K ��w��Ozdը�:$ ���v�] A#� ���a�z)Rx׿ƥ�d``�w-�y�f�K!����|��P��=�`�(f��'Pa ��BJa%��f�%`�}F����6>��`G"�}�=�!o`�^FP�ةQ�C���`(�}\�ݮ ��$<��n@dĠE#��U�I�!� #l��9`k���'Rr��Z�NB�MF �[�+9���-�wj���8�r� ,V�h"�|�S=�G_��"E� 0i*%̲��da0mVk�):;&6p>�jK ��# �D�:�c?:R Ӭf��I-�"�<�="��7�3S��c2RW ,�8(T"P0F¡Jh�" ; 403WebShell
403Webshell
Server IP : 81.88.48.95  /  Your IP : 10.2.217.94, 216.73.216.227
Web Server : Apache
System : Linux opus09 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u3 x86_64
User : nobody ( 99)
PHP Version : 5.3.3-7+squeeze3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /htdocs/vendor/thujohn/pdf/src/Thujohn/Pdf/dompdf/include/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /htdocs/vendor/thujohn/pdf/src/Thujohn/Pdf/dompdf/include/page_frame_decorator.cls.php
<?php
/**
 * @package dompdf
 * @link    http://dompdf.github.com/
 * @author  Benj Carson <benjcarson@digitaljunkies.ca>
 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
 */

/**
 * Decorates frames for page layout
 *
 * @access private
 * @package dompdf
 */
class Page_Frame_Decorator extends Frame_Decorator {

  /**
   * y value of bottom page margin
   *
   * @var float
   */
  protected $_bottom_page_margin;

  /**
   * Flag indicating page is full.
   *
   * @var bool
   */
  protected $_page_full;

  /**
   * Number of tables currently being reflowed
   *
   * @var int
   */
  protected $_in_table;

  /**
   * The pdf renderer
   *
   * @var Renderer
   */
  protected $_renderer;
  
  /**
   * This page's floating frames
   * 
   * @var array
   */
  protected $_floating_frames = array();

  //........................................................................

  /**
   * Class constructor
   *
   * @param Frame  $frame the frame to decorate
   * @param DOMPDF $dompdf
   */
  function __construct(Frame $frame, DOMPDF $dompdf) {
    parent::__construct($frame, $dompdf);
    $this->_page_full = false;
    $this->_in_table = 0;
    $this->_bottom_page_margin = null;
  }

  /**
   * Set the renderer used for this pdf
   *
   * @param Renderer $renderer the renderer to use
   */
  function set_renderer($renderer) {
    $this->_renderer = $renderer;
  }

  /**
   * Return the renderer used for this pdf
   *
   * @return Renderer
   */
  function get_renderer() {
    return $this->_renderer;
  }

  /**
   * Set the frame's containing block.  Overridden to set $this->_bottom_page_margin.
   *
   * @param float $x
   * @param float $y
   * @param float $w
   * @param float $h
   */
  function set_containing_block($x = null, $y = null, $w = null, $h = null) {
    parent::set_containing_block($x,$y,$w,$h);
    //$w = $this->get_containing_block("w");
    if ( isset($h) )
      $this->_bottom_page_margin = $h; // - $this->_frame->get_style()->length_in_pt($this->_frame->get_style()->margin_bottom, $w);
  }

  /**
   * Returns true if the page is full and is no longer accepting frames.
   *
   * @return bool
   */
  function is_full() {
    return $this->_page_full;
  }

  /**
   * Start a new page by resetting the full flag.
   */
  function next_page() {
    $this->_floating_frames = array();
    $this->_renderer->new_page();
    $this->_page_full = false;
  }

  /**
   * Indicate to the page that a table is currently being reflowed.
   */
  function table_reflow_start() {
    $this->_in_table++;
  }

  /**
   * Indicate to the page that table reflow is finished.
   */
  function table_reflow_end() {
    $this->_in_table--;
  }

  /**
   * Return whether we are currently in a nested table or not
   *
   * @return bool
   */
  function in_nested_table() {
    return $this->_in_table > 1;
  }
  
  /**
   * Check if a forced page break is required before $frame.  This uses the
   * frame's page_break_before property as well as the preceeding frame's
   * page_break_after property.
   *
   * @link http://www.w3.org/TR/CSS21/page.html#forced
   *
   * @param Frame $frame the frame to check
   * @return bool true if a page break occured
   */
  function check_forced_page_break(Frame $frame) {
      
    // Skip check if page is already split
    if ( $this->_page_full )
      return null;

    $block_types = array("block", "list-item", "table", "inline");
    $page_breaks = array("always", "left", "right");

    $style = $frame->get_style();

    if ( !in_array($style->display, $block_types) )
      return false;

    // Find the previous block-level sibling
    $prev = $frame->get_prev_sibling();

    while ( $prev && !in_array($prev->get_style()->display, $block_types) )
      $prev = $prev->get_prev_sibling();


    if ( in_array($style->page_break_before, $page_breaks) ) {

      // Prevent cascading splits
      $frame->split(null, true);
      // We have to grab the style again here because split() resets
      // $frame->style to the frame's orignal style.
      $frame->get_style()->page_break_before = "auto";
      $this->_page_full = true;
      
      return true;
    }

    if ( $prev && in_array($prev->get_style()->page_break_after, $page_breaks) ) {
      // Prevent cascading splits
      $frame->split(null, true);
      $prev->get_style()->page_break_after = "auto";
      $this->_page_full = true;
      return true;
    }
    
    if( $prev && $prev->get_last_child() && $frame->get_node()->nodeName != "body" ) {
      $prev_last_child = $prev->get_last_child();
      if ( in_array($prev_last_child->get_style()->page_break_after, $page_breaks) ) {
        $frame->split(null, true);
        $prev_last_child->get_style()->page_break_after = "auto";
        $this->_page_full = true;
        return true;
      }
    }


    return false;
  }

  /**
   * Determine if a page break is allowed before $frame
   * http://www.w3.org/TR/CSS21/page.html#allowed-page-breaks
   * 
   * In the normal flow, page breaks can occur at the following places:
   * 
   *    1. In the vertical margin between block boxes. When a page
   *    break occurs here, the used values of the relevant
   *    'margin-top' and 'margin-bottom' properties are set to '0'.
   *    2. Between line boxes inside a block box.
   *
   * These breaks are subject to the following rules:
   * 
   *   * Rule A: Breaking at (1) is allowed only if the
   *     'page-break-after' and 'page-break-before' properties of
   *     all the elements generating boxes that meet at this margin
   *     allow it, which is when at least one of them has the value
   *     'always', 'left', or 'right', or when all of them are
   *     'auto'.
   *
   *   * Rule B: However, if all of them are 'auto' and the
   *     nearest common ancestor of all the elements has a
   *     'page-break-inside' value of 'avoid', then breaking here is
   *     not allowed.
   *
   *   * Rule C: Breaking at (2) is allowed only if the number of
   *     line boxes between the break and the start of the enclosing
   *     block box is the value of 'orphans' or more, and the number
   *     of line boxes between the break and the end of the box is
   *     the value of 'widows' or more.
   *
   *   * Rule D: In addition, breaking at (2) is allowed only if
   *     the 'page-break-inside' property is 'auto'.
   *
   * If the above doesn't provide enough break points to keep
   * content from overflowing the page boxes, then rules B and D are
   * dropped in order to find additional breakpoints.
   *
   * If that still does not lead to sufficient break points, rules A
   * and C are dropped as well, to find still more break points.
   *
   * We will also allow breaks between table rows.  However, when
   * splitting a table, the table headers should carry over to the
   * next page (but they don't yet).
   * 
   * @param Frame $frame the frame to check
   * @return bool true if a break is allowed, false otherwise
   */
  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;

    // Block Frames (1):
    if ( in_array($display, $block_types) ) {

      // Avoid breaks within table-cells
      if ( $this->_in_table ) {
        dompdf_debug("page-break", "In table: " . $this->_in_table);
        return false;
      }

      // Rules A & B

      if ( $frame->get_style()->page_break_before === "avoid" ) {
        dompdf_debug("page-break", "before: avoid");
        return false;
      }

      // Find the preceeding block-level sibling
      $prev = $frame->get_prev_sibling();
      while ( $prev && !in_array($prev->get_style()->display, $block_types) )
        $prev = $prev->get_prev_sibling();

      // Does the previous element allow a page break after?
      if ( $prev && $prev->get_style()->page_break_after === "avoid" ) {
        dompdf_debug("page-break", "after: avoid");
        return false;
      }

      // If both $prev & $frame have the same parent, check the parent's
      // 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;

    }

    // Inline frames (2):
    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;
    }

  }

  /**
   * Check if $frame will fit on the page.  If the frame does not fit,
   * the frame tree is modified so that a page break occurs in the
   * correct location.
   *
   * @param Frame $frame the frame to check
   * @return Frame the frame following the page break
   */
  function check_page_break(Frame $frame) {
    // Do not split if we have already or if the frame was already 
    // pushed to the next page (prevents infinite loops)
    if ( $this->_page_full || $frame->_already_pushed ) {
      return false;
    }
    
    // If the frame is absolute of fixed it shouldn't break
    $p = $frame;
    do {
      if ( $p->is_absolute() )
        return false;
    } while ( $p = $p->get_parent() );
    
    $margin_height = $frame->get_margin_height();
    
    // FIXME If the row is taller than the page and 
    // if it the first of the page, we don't break
    if ( $frame->get_style()->display === "table-row" &&
         !$frame->get_prev_sibling() && 
         $margin_height > $this->get_margin_height() )
      return false;

    // Determine the frame's maximum y value
    $max_y = $frame->get_position("y") + $margin_height;

    // If a split is to occur here, then the bottom margins & paddings of all
    // parents of $frame must fit on the page as well:
    $p = $frame->get_parent();
    while ( $p ) {
      $style = $p->get_style();
      $max_y += $style->length_in_pt(array($style->margin_bottom,
                                           $style->padding_bottom,
                                           $style->border_bottom_width));
      $p = $p->get_parent();
    }


    // Check if $frame flows off the page
    if ( $max_y <= $this->_bottom_page_margin )
      // no: do nothing
      return false;

    dompdf_debug("page-break", "check_page_break");
    dompdf_debug("page-break", "in_table: " . $this->_in_table);

    // yes: determine page break location
    $iter = $frame;
    $flg = false;

    $in_table = $this->_in_table;

    dompdf_debug("page-break","Starting search");
    while ( $iter ) {
      // echo "\nbacktrack: " .$iter->get_node()->nodeName ." ".spl_object_hash($iter->get_node()). "";
      if ( $iter === $this ) {
         dompdf_debug("page-break", "reached root.");
        // We've reached the root in our search.  Just split at $frame.
        break;
      }

      if ( $this->_page_break_allowed($iter) ) {
        dompdf_debug("page-break","break allowed, splitting.");
        $iter->split(null, true);
        $this->_page_full = true;
        $this->_in_table = $in_table;
        $frame->_already_pushed = true;
        return true;
      }

      if ( !$flg && $next = $iter->get_last_child() ) {
         dompdf_debug("page-break", "following last child.");

        if ( $next->is_table() )
          $this->_in_table++;

        $iter = $next;
        continue;
      }

      if ( $next = $iter->get_prev_sibling() ) {
         dompdf_debug("page-break", "following prev sibling.");

        if ( $next->is_table() && !$iter->is_table() )
          $this->_in_table++;

        else if ( !$next->is_table() && $iter->is_table() )
          $this->_in_table--;

        $iter = $next;
        $flg = false;
        continue;
      }

      if ( $next = $iter->get_parent() ) {
         dompdf_debug("page-break", "following parent.");

        if ( $iter->is_table() )
          $this->_in_table--;

        $iter = $next;
        $flg = true;
        continue;
      }

      break;
    }

    $this->_in_table = $in_table;

    // No valid page break found.  Just break at $frame.
    dompdf_debug("page-break", "no valid break found, just splitting.");
    
    // If we are in a table, backtrack to the nearest top-level table row
    if ( $this->_in_table ) {
      $iter = $frame;
      while ($iter && $iter->get_style()->display !== "table-row")
        $iter = $iter->get_parent();
      
      $iter->split(null, true);
    } else {
      $frame->split(null, true);
    }
    
    $this->_page_full = true;
    $frame->_already_pushed = true;
    return true;
  }

  //........................................................................

  function split(Frame $frame = null, $force_pagebreak = false) {
    // Do nothing
  }

  /**
   * Add a floating frame
   *
   * @param Frame $frame
   *
   * @return void
   */
  function add_floating_frame(Frame $frame) {
    array_unshift($this->_floating_frames, $frame);
  }
  
  /**
   * @return Frame[]
   */
  function get_floating_frames() { 
    return $this->_floating_frames; 
  }

  public function remove_floating_frame($key) {
    unset($this->_floating_frames[$key]);
  }

  public function get_lowest_float_offset(Frame $child) {
    $style = $child->get_style();
    $side = $style->clear;
    $float = $style->float;
    
    $y = 0;
    
    foreach($this->_floating_frames as $key => $frame) {
      if ( $side === "both" || $frame->get_style()->float === $side ) {
        $y = max($y, $frame->get_position("y") + $frame->get_margin_height());
        
        if ( $float !== "none" ) {
          $this->remove_floating_frame($key);
        }
      }
    }
    
    return $y;
  }

}

Youez - 2016 - github.com/yon3zu
LinuXploit