Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
// $Header: /cvsroot/html2ps/css.content.inc.php,v 1.8 2007/03/15 18:37:30 Konstantin Exp $
3
 
4
require_once(HTML2PS_DIR.'value.content.php');
5
 
6
/**
7
 * Handles 'content' CSS property (
8
 *
9
 * 'content'
10
 *  Value:   normal   |   [   <string>   |   <uri>   |   <counter>   |
11
 *  attr(<identifier>)  | open-quote |  close-quote |  no-open-quote |
12
 *  no-close-quote ]+ | inherit
13
 *  Initial:  	normal
14
 *  Applies to:  	:before and :after pseudo-elements
15
 *  Inherited:  	no
16
 *  Percentages:  	N/A
17
 *  Media:  	all
18
 *  Computed  value: for  URI  values, the  absolute  URI; for  attr()
19
 *  values, the resulting string; otherwise as specified
20
 *
21
 * This property  is used with the :before  and :after pseudo-elements
22
 * to  generate  content in  a  document.  Values  have the  following
23
 * meanings:
24
 *
25
 * normal
26
 *    The pseudo-element is not generated.
27
 * <string>
28
 *    Text content (see the section on strings).
29
 * <uri>
30
 *    The value  is a URI that  designates an external  resource. If a
31
 *    user  agent cannot  support the  resource because  of  the media
32
 *    types it supports, it must ignore the resource.
33
 * <counter>
34
 *    Counters  may   be  specified  with   two  different  functions:
35
 *    'counter()'   or  'counters()'.  The   former  has   two  forms:
36
 *    'counter(name)' or 'counter(name, style)'. The generated text is
37
 *    the value of  the named counter at this  point in the formatting
38
 *    structure; it is formatted  in the indicated style ('decimal' by
39
 *    default).   The   latter    function   also   has   two   forms:
40
 *    'counters(name, string)' or 'counters(name, string, style)'. The
41
 *    generated text is the value  of all counters with the given name
42
 *    at  this point  in the  formatting structure,  separated  by the
43
 *    specified  string. The  counters are  rendered in  the indicated
44
 *    style  ('decimal'  by default).  See  the  section on  automatic
45
 *    counters and numbering for more information.
46
 * open-quote and close-quote
47
 *    These  values are replaced  by the  appropriate string  from the
48
 *    'quotes' property.
49
 * no-open-quote and no-close-quote
50
 *    Same as 'none', but increments (decrements) the level of nesting
51
 *    for quotes.
52
 * attr(X)
53
 *    This function returns  as a string the value  of attribute X for
54
 *    the subject of the selector. The string is not parsed by the CSS
55
 *    processor.  If  the subject  of  the  selector  doesn't have  an
56
 *    attribute X,  an empty string is  returned. The case-sensitivity
57
 *    of attribute  names depends on  the document language.  Note. In
58
 *    CSS 2.1,  it is  not possible to  refer to attribute  values for
59
 *    other elements than the subject of the selector.
60
 */
61
class CSSContent extends CSSPropertyHandler {
62
  function CSSContent() {
63
    $this->CSSPropertyHandler(false, false);
64
  }
65
 
66
  function &default_value() {
67
    $data =& new ValueContent();
68
    return $data;
69
  }
70
 
71
  // CSS 2.1 p 12.2:
72
  // Value: [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
73
  //
74
  // TODO: process values other than <string>
75
  //
76
  function &parse($value) {
77
    if ($value == 'inherit') {
78
      return CSS_PROPERTY_INHERIT;
79
    };
80
 
81
    $value_obj =& ValueContent::parse($value);
82
    return $value_obj;
83
  }
84
 
85
  function get_property_code() {
86
    return CSS_CONTENT;
87
  }
88
 
89
  function get_property_name() {
90
    return 'content';
91
  }
92
}
93
 
94
CSS::register_css_property(new CSSContent);
95
 
96
?>