[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/htmlpurifier/library/HTMLPurifier/HTMLModule/ -> Legacy.php (source)

   1  <?php
   2  
   3  /**
   4   * XHTML 1.1 Legacy module defines elements that were previously
   5   * deprecated.
   6   *
   7   * @note Not all legacy elements have been implemented yet, which
   8   *       is a bit of a reverse problem as compared to browsers! In
   9   *       addition, this legacy module may implement a bit more than
  10   *       mandated by XHTML 1.1.
  11   *
  12   * This module can be used in combination with TransformToStrict in order
  13   * to transform as many deprecated elements as possible, but retain
  14   * questionably deprecated elements that do not have good alternatives
  15   * as well as transform elements that don't have an implementation.
  16   * See docs/ref-strictness.txt for more details.
  17   */
  18  
  19  class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
  20  {
  21  
  22      public $name = 'Legacy';
  23  
  24      public function setup($config) {
  25  
  26          $this->addElement('basefont', 'Inline', 'Empty', false, array(
  27              'color' => 'Color',
  28              'face' => 'Text', // extremely broad, we should
  29              'size' => 'Text', // tighten it
  30              'id' => 'ID'
  31          ));
  32          $this->addElement('center', 'Block', 'Flow', 'Common');
  33          $this->addElement('dir', 'Block', 'Required: li', 'Common', array(
  34              'compact' => 'Bool#compact'
  35          ));
  36          $this->addElement('font', 'Inline', 'Inline', array('Core', 'I18N'), array(
  37              'color' => 'Color',
  38              'face' => 'Text', // extremely broad, we should
  39              'size' => 'Text', // tighten it
  40          ));
  41          $this->addElement('menu', 'Block', 'Required: li', 'Common', array(
  42              'compact' => 'Bool#compact'
  43          ));
  44  
  45          $s = $this->addElement('s', 'Inline', 'Inline', 'Common');
  46          $s->formatting = true;
  47  
  48          $strike = $this->addElement('strike', 'Inline', 'Inline', 'Common');
  49          $strike->formatting = true;
  50  
  51          $u = $this->addElement('u', 'Inline', 'Inline', 'Common');
  52          $u->formatting = true;
  53  
  54          // setup modifications to old elements
  55  
  56          $align = 'Enum#left,right,center,justify';
  57  
  58          $address = $this->addBlankElement('address');
  59          $address->content_model = 'Inline | #PCDATA | p';
  60          $address->content_model_type = 'optional';
  61          $address->child = false;
  62  
  63          $blockquote = $this->addBlankElement('blockquote');
  64          $blockquote->content_model = 'Flow | #PCDATA';
  65          $blockquote->content_model_type = 'optional';
  66          $blockquote->child = false;
  67  
  68          $br = $this->addBlankElement('br');
  69          $br->attr['clear'] = 'Enum#left,all,right,none';
  70  
  71          $caption = $this->addBlankElement('caption');
  72          $caption->attr['align'] = 'Enum#top,bottom,left,right';
  73  
  74          $div = $this->addBlankElement('div');
  75          $div->attr['align'] = $align;
  76  
  77          $dl = $this->addBlankElement('dl');
  78          $dl->attr['compact'] = 'Bool#compact';
  79  
  80          for ($i = 1; $i <= 6; $i++) {
  81              $h = $this->addBlankElement("h$i");
  82              $h->attr['align'] = $align;
  83          }
  84  
  85          $hr = $this->addBlankElement('hr');
  86          $hr->attr['align'] = $align;
  87          $hr->attr['noshade'] = 'Bool#noshade';
  88          $hr->attr['size'] = 'Pixels';
  89          $hr->attr['width'] = 'Length';
  90  
  91          $img = $this->addBlankElement('img');
  92          $img->attr['align'] = 'Enum#top,middle,bottom,left,right';
  93          $img->attr['border'] = 'Pixels';
  94          $img->attr['hspace'] = 'Pixels';
  95          $img->attr['vspace'] = 'Pixels';
  96  
  97          // figure out this integer business
  98  
  99          $li = $this->addBlankElement('li');
 100          $li->attr['value'] = new HTMLPurifier_AttrDef_Integer();
 101          $li->attr['type']  = 'Enum#s:1,i,I,a,A,disc,square,circle';
 102  
 103          $ol = $this->addBlankElement('ol');
 104          $ol->attr['compact'] = 'Bool#compact';
 105          $ol->attr['start'] = new HTMLPurifier_AttrDef_Integer();
 106          $ol->attr['type'] = 'Enum#s:1,i,I,a,A';
 107  
 108          $p = $this->addBlankElement('p');
 109          $p->attr['align'] = $align;
 110  
 111          $pre = $this->addBlankElement('pre');
 112          $pre->attr['width'] = 'Number';
 113  
 114          // script omitted
 115  
 116          $table = $this->addBlankElement('table');
 117          $table->attr['align'] = 'Enum#left,center,right';
 118          $table->attr['bgcolor'] = 'Color';
 119  
 120          $tr = $this->addBlankElement('tr');
 121          $tr->attr['bgcolor'] = 'Color';
 122  
 123          $th = $this->addBlankElement('th');
 124          $th->attr['bgcolor'] = 'Color';
 125          $th->attr['height'] = 'Length';
 126          $th->attr['nowrap'] = 'Bool#nowrap';
 127          $th->attr['width'] = 'Length';
 128  
 129          $td = $this->addBlankElement('td');
 130          $td->attr['bgcolor'] = 'Color';
 131          $td->attr['height'] = 'Length';
 132          $td->attr['nowrap'] = 'Bool#nowrap';
 133          $td->attr['width'] = 'Length';
 134  
 135          $ul = $this->addBlankElement('ul');
 136          $ul->attr['compact'] = 'Bool#compact';
 137          $ul->attr['type'] = 'Enum#square,disc,circle';
 138  
 139      }
 140  
 141  }
 142  
 143  // vim: et sw=4 sts=4


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1