[ PHPXref.com ] [ Generated: Sun Jul 20 18:08:07 2008 ] [ html2ps 1.9.4 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> css.utils.inc.php (source)

   1  <?php
   2  // $Header: /cvsroot/html2ps/css.utils.inc.php,v 1.23 2006/03/19 09:25:36 Konstantin Exp $

   3  
   4  // TODO: make an OO-style selectors interface instead of switches

   5  
   6  // Searches the CSS rule selector for pseudoelement selectors 

   7  // (assuming that there can be only one) and returns its value

   8  //

   9  // note that there's not sence in applying pseudoelement to any chained selector except the last

  10  // (the deepest descendant)

  11  // 

  12  function css_find_pseudoelement($selector) {
  13    $selector_type = selector_get_type($selector);
  14    switch ($selector_type) {
  15    case SELECTOR_PSEUDOELEMENT_BEFORE:
  16    case SELECTOR_PSEUDOELEMENT_AFTER:
  17      return $selector_type;
  18    case SELECTOR_SEQUENCE:
  19      foreach ($selector[1] as $subselector) {
  20        $pe = css_find_pseudoelement($subselector);
  21        if ($pe !== null) { return $pe; };
  22      }
  23      return null;
  24    default:
  25      return null;
  26    }
  27  }
  28  
  29  function _fix_tag_display($default_display, &$pipeline) {
  30    // In some cases 'display' CSS property should be ignored for element-generated boxes

  31    // Here we will use the $default_display stored above

  32    // Note that "display: none" should _never_ be changed

  33    //

  34    $handler =& get_css_handler('display');
  35    if ($handler->get() === "none") {
  36      return;
  37    };
  38  
  39    switch ($default_display) {
  40    case 'table-cell':
  41      // TD will always have 'display: table-cell'

  42      $handler->css('table-cell', $pipeline);
  43      break;
  44      
  45    case '-button':
  46      // INPUT buttons will always have 'display: -button' (in latter case if display = 'block', we'll use a wrapper box)

  47      if ($handler->get() === 'block') {
  48        $need_block_wrapper = true;
  49      };
  50      $handler->css('-button', $pipeline);
  51      break;
  52    };
  53  }
  54  
  55  function is_percentage($value) { return $value{strlen($value)-1} == "%"; }
  56  
  57  function css_remove_value_quotes($value) {
  58    if (strlen($value) == 0) { return $value; };
  59  
  60    if ($value{0} === "'" || $value{0} === "\"") {
  61      $value = substr($value, 1, strlen($value)-2);
  62    };
  63    return $value;
  64  }
  65  
  66  function css_import($src, &$pipeline) {
  67  // Update the base url; 

  68  // all urls will be resolved relatively to the current stylesheet url

  69    $url = $pipeline->guess_url($src);
  70  
  71    $data = $pipeline->fetch($url);
  72  
  73    /**

  74     * If referred file could not be fetched return immediately

  75     */
  76    if (is_null($data)) { return; };
  77  
  78    $css = $data->get_content();
  79    if (!empty($css)) { 
  80      parse_css($css, $pipeline); 
  81    };
  82    
  83    $pipeline->pop_base_url();
  84  };
  85  
  86  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]