Changeset 7584 in spip-zone


Ignore:
Timestamp:
Nov 26, 2006, 6:42:28 PM (12 years ago)
Author:
real3t@…
Message:

Mise à jour de HTML Purifier en version 1.2.0.

À noter : l'auteur m'a contacté directement pour m'informer de la mise à jour !
Si ça c'est pas du suivi de projet !

Location:
_plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library
Files:
5 added
28 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier.php

    r6358 r7584  
    2323
    2424/*
    25     HTML Purifier - Standards Compliant HTML Filtering
     25    HTML Purifier 1.2.0 - Standards Compliant HTML Filtering
    2626    Copyright (C) 2006 Edward Z. Yang
    2727
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrDef.php

    r6358 r7584  
    2121   
    2222    /**
    23      * Abstract function defined for functions that validate and clean strings.
    24      *
    25      * This function forms the basis for all the subclasses: they must
    26      * define this method.
     23     * Validates and cleans passed string according to a definition.
    2724     *
    2825     * @public
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrDef/CSS.php

    r6358 r7584  
    4444        }
    4545       
     46        // procedure does not write the new CSS simultaneously, so it's
    4647        // slightly inefficient, but it's the only way of getting rid of
    4748        // duplicates. Perhaps config to optimize it, but not now.
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrDef/Class.php

    r6358 r7584  
    2525        // see that anyway).
    2626        $matches = array();
    27         $pattern = '/(?:(?<=\s)|\A)'.
     27        $pattern = '/(?:(?<=\s)|\A)'. // look behind for space or string start
    2828                   '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)'.
    29                    '(?:(?=\s)|\z)/';
     29                   '(?:(?=\s)|\z)/'; // look ahead for space or string end
    3030        preg_match_all($pattern, $string, $matches);
    3131       
    3232        if (empty($matches[1])) return false;
    3333       
     34        // reconstruct class string
    3435        $new_string = '';
    3536        foreach ($matches[1] as $class_names) {
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrDef/Host.php

    r6358 r7584  
    66
    77/**
    8  * Validates a host according to the IPv4, IPv6 and DNS specifications.
     8 * Validates a host according to the IPv4, IPv6 and DNS (future) specifications.
    99 */
    1010class HTMLPurifier_AttrDef_Host extends HTMLPurifier_AttrDef
     
    3636            return '['. $valid . ']';
    3737        }
     38       
     39        // need to do checks on unusual encodings too
    3840        $ipv4 = $this->ipv4->validate($string, $config, $context);
    3941        if ($ipv4 !== false) return $ipv4;
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrDef/ID.php

    r6358 r7584  
    33require_once 'HTMLPurifier/AttrDef.php';
    44require_once 'HTMLPurifier/IDAccumulator.php';
     5
     6HTMLPurifier_ConfigSchema::define(
     7    'Attr', 'IDPrefix', '', 'string',
     8    'String to prefix to IDs.  If you have no idea what IDs your pages '.
     9    'may use, you may opt to simply add a prefix to all user-submitted ID '.
     10    'attributes so that they are still usable, but will not conflict with '.
     11    'core page IDs. Example: setting the directive to \'user_\' will result in '.
     12    'a user submitted \'foo\' to become \'user_foo\'  Be sure to set '.
     13    '%HTML.EnableAttrID to true before using '.
     14    'this.  This directive was available since 1.2.0.'
     15);
     16
     17HTMLPurifier_ConfigSchema::define(
     18    'Attr', 'IDPrefixLocal', '', 'string',
     19    'Temporary prefix for IDs used in conjunction with %Attr.IDPrefix.  If '.
     20    'you need to allow multiple sets of '.
     21    'user content on web page, you may need to have a seperate prefix that '.
     22    'changes with each iteration.  This way, seperately submitted user content '.
     23    'displayed on the same page doesn\'t clobber each other. Ideal values '.
     24    'are unique identifiers for the content it represents (i.e. the id of '.
     25    'the row in the database). Be sure to add a seperator (like an underscore) '.
     26    'at the end.  Warning: this directive will not work unless %Attr.IDPrefix '.
     27    'is set to a non-empty value! This directive was available since 1.2.0.'
     28);
    529
    630/**
     
    2246        if ($id === '') return false;
    2347       
    24         $id_accumulator = $context->get('IDAccumulator');
     48        $prefix = $config->get('Attr', 'IDPrefix');
     49        if ($prefix !== '') {
     50            $prefix .= $config->get('Attr', 'IDPrefixLocal');
     51            // prevent re-appending the prefix
     52            if (strpos($id, $prefix) !== 0) $id = $prefix . $id;
     53        } elseif ($config->get('Attr', 'IDPrefixLocal') !== '') {
     54            trigger_error('%Attr.IDPrefixLocal cannot be used unless '.
     55                '%Attr.IDPrefix is set', E_USER_WARNING);
     56        }
     57       
     58        $id_accumulator =& $context->get('IDAccumulator');
    2559        if (isset($id_accumulator->ids[$id])) return false;
    2660       
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrDef/URI.php

    r6358 r7584  
    55require_once 'HTMLPurifier/URISchemeRegistry.php';
    66require_once 'HTMLPurifier/AttrDef/Host.php';
     7require_once 'HTMLPurifier/PercentEncoder.php';
    78
    89HTMLPurifier_ConfigSchema::define(
     
    1011    'Defines through what scheme the output will be served, in order to '.
    1112    'select the proper object validator when no scheme information is present.'
     13);
     14
     15HTMLPurifier_ConfigSchema::define(
     16    'URI', 'Host', null, 'string/null',
     17    'Defines the domain name of the server, so we can determine whether or '.
     18    'an absolute URI is from your website or not.  Not strictly necessary, '.
     19    'as users should be using relative URIs to reference resources on your '.
     20    'website.  It will, however, let you use absolute URIs to link to '.
     21    'subdomains of the domain you post here: i.e. example.com will allow '.
     22    'sub.example.com.  However, higher up domains will still be excluded: '.
     23    'if you set %URI.Host to sub.example.com, example.com will be blocked. '.
     24    'This directive has been available since 1.2.0.'
     25);
     26
     27HTMLPurifier_ConfigSchema::Define(
     28    'URI', 'DisableExternal', false, 'bool',
     29    'Disables links to external websites.  This is a highly effective '.
     30    'anti-spam and anti-pagerank-leech measure, but comes at a hefty price: no'.
     31    'links or images outside of your domain will be allowed.  Non-linkified '.
     32    'URIs will still be preserved.  If you want to be able to link to '.
     33    'subdomains or use absolute URIs, specify %URI.Host for your website. '.
     34    'This directive has been available since 1.2.0.'
    1235);
    1336
     
    2043   
    2144    var $host;
    22    
    23     function HTMLPurifier_AttrDef_URI() {
     45    var $PercentEncoder;
     46    var $embeds;
     47   
     48    /**
     49     * @param $embeds Does the URI here result in an extra HTTP request?
     50     */
     51    function HTMLPurifier_AttrDef_URI($embeds = false) {
    2452        $this->host = new HTMLPurifier_AttrDef_Host();
     53        $this->PercentEncoder = new HTMLPurifier_PercentEncoder();
     54        $this->embeds = (bool) $embeds;
    2555    }
    2656   
     
    3262        // parse as CDATA
    3363        $uri = $this->parseCDATA($uri);
     64       
     65        // fix up percent-encoding
     66        $uri = $this->PercentEncoder->normalize($uri);
    3467       
    3568        // while it would be nice to use parse_url(), that's specifically
     
    6497            // retrieve the specific scheme object from the registry
    6598            $scheme = ctype_lower($scheme) ? $scheme : strtolower($scheme);
    66             $scheme_obj =& $registry->getScheme($scheme, $config);
     99            $scheme_obj =& $registry->getScheme($scheme, $config, $context);
    67100            if (!$scheme_obj) return false; // invalid scheme, clean it out
    68101        } else {
    69102            $scheme_obj =& $registry->getScheme(
    70                 $config->get('URI', 'DefaultScheme'), $config
     103                $config->get('URI', 'DefaultScheme'), $config, $context
    71104            );
    72105        }
    73106       
    74107       
     108        // the URI we're processing embeds a resource in the page, but the URI
     109        // it references cannot be located
     110        if ($this->embeds && !$scheme_obj->browsable) {
     111            return false;
     112        }
     113       
    75114       
    76115        if ($authority !== null) {
     116           
     117            // remove URI if it's absolute and we disallow externals
     118            unset($our_host);
     119            if ($config->get('URI', 'DisableExternal')) {
     120                $our_host = $config->get('URI', 'Host');
     121                if ($our_host === null) return false;
     122            }
    77123           
    78124            $HEXDIG = '[A-Fa-f0-9]';
     
    98144            if ($host === false) $host = null;
    99145           
     146            // more lenient absolute checking
     147            if (isset($our_host)) {
     148                $host_parts = array_reverse(explode('.', $host));
     149                // could be cached
     150                $our_host_parts = array_reverse(explode('.', $our_host));
     151                foreach ($our_host_parts as $i => $discard) {
     152                    if (!isset($host_parts[$i])) return false;
     153                    if ($host_parts[$i] != $our_host_parts[$i]) return false;
     154                }
     155            }
     156           
    100157            // userinfo and host are validated within the regexp
    101158           
     
    121178        list($userinfo, $host, $port, $path, $query) =
    122179            $scheme_obj->validateComponents(
    123                 $userinfo, $host, $port, $path, $query, $config
     180                $userinfo, $host, $port, $path, $query, $config, $context
    124181            );
    125182       
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrTransform.php

    r6358 r7584  
    2424     *              HTMLPurifier_Token_Tag::$attributes
    2525     * @param $config Mandatory HTMLPurifier_Config object.
     26     * @param $context Mandatory HTMLPurifier_Context object
    2627     * @returns Processed attribute array.
    2728     */
    28     function transform($attr, $config) {
     29    function transform($attr, $config, &$context) {
    2930        trigger_error('Cannot call abstract function', E_USER_ERROR);
    3031    }
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrTransform/BdoDir.php

    r6358 r7584  
    2121{
    2222   
    23     function transform($attr, $config) {
     23    function transform($attr, $config, $context) {
    2424        if (isset($attr['dir'])) return $attr;
    2525        $attr['dir'] = $config->get('Attr', 'DefaultTextDir');
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrTransform/ImgRequired.php

    r6358 r7584  
    2626{
    2727   
    28     function transform($attr, $config) {
     28    function transform($attr, $config, $context) {
    2929       
    3030        $src = true;
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrTransform/Lang.php

    r6358 r7584  
    1111{
    1212   
    13     function transform($attr, $config) {
     13    function transform($attr, $config, $context) {
    1414       
    1515        $lang     = isset($attr['lang']) ? $attr['lang'] : false;
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/AttrTransform/TextAlign.php

    r6358 r7584  
    99    extends HTMLPurifier_AttrTransform {
    1010
    11     function transform($attr, $config) {
     11    function transform($attr, $config, $context) {
    1212       
    1313        if (!isset($attr['align'])) return $attr;
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/Config.php

    r6358 r7584  
    6161     */
    6262    function get($namespace, $key) {
    63         if (!isset($this->conf[$namespace][$key])) {
     63        if (!isset($this->def->info[$namespace][$key])) {
    6464            trigger_error('Cannot retrieve value of undefined directive',
    6565                E_USER_WARNING);
     
    7676     */
    7777    function set($namespace, $key, $value) {
    78         if (!isset($this->conf[$namespace][$key])) {
     78        if (!isset($this->def->info[$namespace][$key])) {
    7979            trigger_error('Cannot set undefined directive to value',
    8080                E_USER_WARNING);
    8181            return;
    8282        }
    83         $value = $this->def->validate($value,
    84                                       $this->def->info[$namespace][$key]->type);
     83        $value = $this->def->validate(
     84                    $value,
     85                    $this->def->info[$namespace][$key]->type,
     86                    $this->def->info[$namespace][$key]->allow_null
     87                 );
    8588        if (is_string($value)) {
    8689            // resolve value alias if defined
     
    9699            }
    97100        }
    98         if ($value === null) {
     101        if ($this->def->isError($value)) {
    99102            trigger_error('Value is of invalid type', E_USER_WARNING);
    100103            return;
     
    125128    }
    126129   
     130    /**
     131     * Loads configuration values from an array with the following structure:
     132     * Namespace.Directive => Value
     133     * @param $config_array Configuration associative array
     134     */
     135    function loadArray($config_array) {
     136        foreach ($config_array as $key => $value) {
     137            if (strpos($key, '.') !== false) {
     138                // condensed form
     139                list($namespace, $directive) = explode('.', $key);
     140                $this->set($namespace, $directive, $value);
     141            } else {
     142                $namespace = $key;
     143                $namespace_values = $value;
     144                foreach ($namespace_values as $directive => $value) {
     145                    $this->set($namespace, $directive, $value);
     146                }
     147            }
     148        }
     149    }
     150   
    127151}
    128152
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/ConfigSchema.php

    r6358 r7584  
    11<?php
     2
     3require_once 'HTMLPurifier/Error.php';
    24
    35/**
     
    112114            }
    113115        } else {
     116            // process modifiers
     117            $type_values = explode('/', $type, 2);
     118            $type = $type_values[0];
     119            $modifier = isset($type_values[1]) ? $type_values[1] : false;
     120            $allow_null = ($modifier === 'null');
     121           
    114122            if (!isset($def->types[$type])) {
    115123                trigger_error('Invalid type for configuration directive',
     
    117125                return;
    118126            }
    119             if ($def->validate($default, $type) === null) {
     127            $default = $def->validate($default, $type, $allow_null);
     128            if ($def->isError($default)) {
    120129                trigger_error('Default value does not match directive type',
    121130                    E_USER_ERROR);
     
    125134                new HTMLPurifier_ConfigEntity_Directive();
    126135            $def->info[$namespace][$name]->type = $type;
     136            $def->info[$namespace][$name]->allow_null = $allow_null;
    127137            $def->defaults[$namespace][$name]   = $default;
    128138        }
     
    213223     * Validate a variable according to type. Return null if invalid.
    214224     */
    215     function validate($var, $type) {
     225    function validate($var, $type, $allow_null = false) {
    216226        if (!isset($this->types[$type])) {
    217227            trigger_error('Invalid type', E_USER_ERROR);
    218228            return;
    219229        }
     230        if ($allow_null && $var === null) return null;
    220231        switch ($type) {
    221232            case 'mixed':
     
    223234            case 'istring':
    224235            case 'string':
    225                 if (!is_string($var)) return;
     236                if (!is_string($var)) break;
    226237                if ($type === 'istring') $var = strtolower($var);
    227238                return $var;
    228239            case 'int':
    229240                if (is_string($var) && ctype_digit($var)) $var = (int) $var;
    230                 elseif (!is_int($var)) return;
     241                elseif (!is_int($var)) break;
    231242                return $var;
    232243            case 'float':
    233244                if (is_string($var) && is_numeric($var)) $var = (float) $var;
    234                 elseif (!is_float($var)) return;
     245                elseif (!is_float($var)) break;
    235246                return $var;
    236247            case 'bool':
    237248                if (is_int($var) && ($var === 0 || $var === 1)) {
    238249                    $var = (bool) $var;
    239                 } elseif (!is_bool($var)) return;
     250                } elseif (!is_bool($var)) break;
    240251                return $var;
    241252            case 'list':
    242253            case 'hash':
    243254            case 'lookup':
    244                 if (!is_array($var)) return;
     255                if (!is_array($var)) break;
    245256                $keys = array_keys($var);
    246257                if ($keys === array_keys($keys)) {
     
    252263                        }
    253264                        return $new;
    254                     } else return;
     265                    } else break;
    255266                }
    256267                if ($type === 'lookup') {
     
    261272                return $var;
    262273        }
    263     }
    264    
     274        $error = new HTMLPurifier_Error();
     275        return $error;
     276    }
     277   
     278    /**
     279     * Takes an absolute path and munges it into a more manageable relative path
     280     */
    265281    function mungeFilename($filename) {
    266282        $offset = strrpos($filename, 'HTMLPurifier');
     
    270286    }
    271287   
     288    /**
     289     * Checks if var is an HTMLPurifier_Error object
     290     */
     291    function isError($var) {
     292        if (!is_object($var)) return false;
     293        if (!is_a($var, 'HTMLPurifier_Error')) return false;
     294        return true;
     295    }
    272296}
    273297
     
    319343     */
    320344    var $type = 'mixed';
     345   
     346    /**
     347     * Is null allowed? Has no affect for mixed type.
     348     * @bool
     349     */
     350    var $allow_null = false;
     351   
    321352    /**
    322353     * Plaintext descriptions of the configuration entity is. Organized by
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/Context.php

    r6358 r7584  
    3535            trigger_error('Attempted to retrieve non-existent variable',
    3636                          E_USER_ERROR);
    37             return;
     37            $var = null; // so we can return by reference
     38            return $var;
    3839        }
    3940        return $this->_storage[$name];
     
    6162    }
    6263   
     64    /**
     65     * Loads a series of variables from an associative array
     66     * @param $context_array Assoc array of variables to load
     67     */
     68    function loadArray(&$context_array) {
     69        foreach ($context_array as $key => $discard) {
     70            $this->register($key, $context_array[$key]);
     71        }
     72    }
     73   
    6374}
    6475
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/EntityParser.php

    r6358 r7584  
    33require_once 'HTMLPurifier/EntityLookup.php';
    44require_once 'HTMLPurifier/Encoder.php';
     5
     6// if want to implement error collecting here, we'll need to use some sort
     7// of global data (probably trigger_error) because it's impossible to pass
     8// $config or $context to the callback functions.
    59
    610/**
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/HTMLDefinition.php

    r6358 r7584  
    2222require_once 'HTMLPurifier/Token.php';
    2323require_once 'HTMLPurifier/TagTransform.php';
     24
     25HTMLPurifier_ConfigSchema::define(
     26    'HTML', 'EnableAttrID', false, 'bool',
     27    'Allows the ID attribute in HTML.  This is disabled by default '.
     28    'due to the fact that without proper configuration user input can '.
     29    'easily break the validation of a webpage by specifying an ID that is '.
     30    'already on the surrounding HTML.  If you don\'t mind throwing caution to '.
     31    'the wind, enable this directive, but I strongly recommend you also '.
     32    'consider blacklisting IDs you use (%Attr.IDBlacklist) or prefixing all '.
     33    'user supplied IDs (%Attr.IDPrefix).  This directive has been available '.
     34    'since 1.2.0, and when set to true reverts to the behavior of pre-1.2.0 '.
     35    'versions.'
     36);
    2437
    2538/**
     
    237250       
    238251        // reuses $e_Inline and $e_Block
    239        
    240         foreach ($e_Inline->elements as $name) {
     252        foreach ($e_Inline->elements as $name => $bool) {
     253            if ($name == '#PCDATA' || $name == '') continue;
    241254            $this->info[$name]->type = 'inline';
    242255        }
    243256       
    244257        $e_Block = new HTMLPurifier_ChildDef_Optional($e_block);
    245         foreach ($e_Block->elements as $name) {
     258        foreach ($e_Block->elements as $name => $bool) {
    246259            $this->info[$name]->type = 'block';
    247260        }
     
    272285        $this->info_global_attr = array(
    273286            // core attrs
    274             'id'    => new HTMLPurifier_AttrDef_ID(),
    275287            'class' => new HTMLPurifier_AttrDef_Class(),
    276288            'title' => $e_Text,
     
    282294            );
    283295       
     296        if ($config->get('HTML', 'EnableAttrID')) {
     297            $this->info_global_attr['id'] = new HTMLPurifier_AttrDef_ID();
     298        }
     299       
    284300        // required attribute stipulation handled in attribute transformation
    285301        $this->info['bdo']->attr = array(); // nothing else
     
    336352        $this->info['a']->attr['href'] =
    337353        $this->info['img']->attr['longdesc'] =
    338         $this->info['img']->attr['src'] =
    339354        $this->info['del']->attr['cite'] =
    340355        $this->info['ins']->attr['cite'] =
    341356        $this->info['blockquote']->attr['cite'] =
    342357        $this->info['q']->attr['cite'] = $e_URI;
     358       
     359        // URI that causes HTTP request
     360        $this->info['img']->attr['src'] = new HTMLPurifier_AttrDef_URI(true);
    343361       
    344362        //////////////////////////////////////////////////////////////////////
     
    397415       
    398416        $this->info_attr_transform_post[] = new HTMLPurifier_AttrTransform_Lang();
     417       
     418        // protect against stdclasses floating around
     419        foreach ($this->info as $key => $obj) {
     420            if (is_a($obj, 'stdclass')) {
     421                unset($this->info[$key]);
     422            }
     423        }
    399424       
    400425    }
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/IDAccumulator.php

    r6358 r7584  
    44 * Component of HTMLPurifier_AttrContext that accumulates IDs to prevent dupes
    55 * @note In Slashdot-speak, dupe means duplicate.
     6 * @note This class does not accept $config or $context, thus, it is the
     7 *       burden of the callee to register the appropriate errors or
     8 *       configuration.
    69 */
    710class HTMLPurifier_IDAccumulator
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/Strategy/RemoveForeignElements.php

    r6358 r7584  
    3434                    $token = $definition->
    3535                                info_tag_transform[$token->name]->
    36                                     transform($token);
     36                                    transform($token, $config, $context);
    3737                } elseif ($escape_invalid_tags) {
    3838                    // invalid tag, generate HTML and insert in
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/Strategy/ValidateAttributes.php

    r6358 r7584  
    3939           
    4040            // do global transformations (pre)
    41             // ex. <ELEMENT lang="fr"> to <ELEMENT lang="fr" xml:lang="fr">
    42             // DEFINITION CALL
     41            // nothing currently utilizes this
    4342            foreach ($definition->info_attr_transform_pre as $transform) {
    44                 $attr = $transform->transform($attr, $config);
     43                $attr = $transform->transform($attr, $config, $context);
    4544            }
    4645           
    4746            // do local transformations only applicable to this element (pre)
    4847            // ex. <p align="right"> to <p style="text-align:right;">
    49             // DEFINITION CALL
    5048            foreach ($definition->info[$token->name]->attr_transform_pre
    5149                as $transform
    5250            ) {
    53                 $attr = $transform->transform($attr, $config);
     51                $attr = $transform->transform($attr, $config, $context);
    5452            }
    5553           
     
    107105           
    108106            // post transforms
     107           
     108            // ex. <x lang="fr"> to <x lang="fr" xml:lang="fr">
    109109            foreach ($definition->info_attr_transform_post as $transform) {
    110                 $attr = $transform->transform($attr, $config);
     110                $attr = $transform->transform($attr, $config, $context);
    111111            }
     112           
     113            // ex. <bdo> to <bdo dir="ltr">
    112114            foreach ($definition->info[$token->name]->attr_transform_post as $transform) {
    113                 $attr = $transform->transform($attr, $config);
     115                $attr = $transform->transform($attr, $config, $context);
    114116            }
    115117           
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/TagTransform.php

    r6358 r7584  
    1818     * Transforms the obsolete tag into the valid tag.
    1919     * @param $tag Tag to be transformed.
     20     * @param $config Mandatory HTMLPurifier_Config object
     21     * @param $context Mandatory HTMLPurifier_Context object
    2022     */
    21     function transform($tag) {
     23    function transform($tag, $config, &$context) {
    2224        trigger_error('Call to abstract function', E_USER_ERROR);
    2325    }
     
    3840    }
    3941   
    40     function transform($tag) {
     42    function transform($tag, $config, &$context) {
    4143        $new_tag = $tag->copy();
    4244        $new_tag->name = $this->transform_to;
     
    5658    var $transform_to = 'div';
    5759   
    58     function transform($tag) {
     60    function transform($tag, $config, &$context) {
    5961        if ($tag->type == 'end') {
    6062            $new_tag = new HTMLPurifier_Token_End($this->transform_to);
     
    107109    );
    108110   
    109     function transform($tag) {
     111    function transform($tag, $config, &$context) {
    110112       
    111113        if ($tag->type == 'end') {
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/URIScheme.php

    r6358 r7584  
    1414   
    1515    /**
     16     * Whether or not URIs of this schem are locatable by a browser
     17     * http and ftp are accessible, while mailto and news are not.
     18     * @public
     19     */
     20    var $browsable = false;
     21   
     22    /**
    1623     * Validates the components of a URI
    1724     * @note This implementation should be called by children if they define
     
    2431     * @param $query Query of URI, found after question mark
    2532     * @param $config HTMLPurifier_Config object
     33     * @param $context HTMLPurifier_Context object
    2634     */
    2735    function validateComponents(
    28         $userinfo, $host, $port, $path, $query, $config
     36        $userinfo, $host, $port, $path, $query, $config, &$context
    2937    ) {
    3038        if ($this->default_port == $port) $port = null;
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/URIScheme/ftp.php

    r6358 r7584  
    99   
    1010    var $default_port = 21;
     11    var $browsable = true; // usually
    1112   
    1213    function validateComponents(
    13         $userinfo, $host, $port, $path, $query, $config
     14        $userinfo, $host, $port, $path, $query, $config, &$context
    1415    ) {
    1516        list($userinfo, $host, $port, $path, $query) =
    1617            parent::validateComponents(
    17                 $userinfo, $host, $port, $path, $query, $config );
     18                $userinfo, $host, $port, $path, $query, $config, $context );
    1819        $semicolon_pos = strrpos($path, ';'); // reverse
    1920        if ($semicolon_pos !== false) {
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/URIScheme/http.php

    r6358 r7584  
    99   
    1010    var $default_port = 80;
     11    var $browsable = true;
    1112   
    1213    function validateComponents(
    13         $userinfo, $host, $port, $path, $query, $config
     14        $userinfo, $host, $port, $path, $query, $config, &$context
    1415    ) {
    1516        list($userinfo, $host, $port, $path, $query) =
    1617            parent::validateComponents(
    17                 $userinfo, $host, $port, $path, $query, $config );
     18                $userinfo, $host, $port, $path, $query, $config, $context );
    1819        return array(null, $host, $port, $path, $query);
    1920    }
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/URIScheme/mailto.php

    r6358 r7584  
    1414class HTMLPurifier_URIScheme_mailto extends HTMLPurifier_URIScheme {
    1515   
     16    var $browsable = false;
     17   
    1618    function validateComponents(
    17         $userinfo, $host, $port, $path, $query, $config
     19        $userinfo, $host, $port, $path, $query, $config, &$context
    1820    ) {
    1921        list($userinfo, $host, $port, $path, $query) =
    2022            parent::validateComponents(
    21                 $userinfo, $host, $port, $path, $query, $config );
     23                $userinfo, $host, $port, $path, $query, $config, $context );
    2224        // we need to validate path against RFC 2368's addr-spec
    2325        return array(null, null, null, $path, $query);
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/URIScheme/news.php

    r6358 r7584  
    88class HTMLPurifier_URIScheme_news extends HTMLPurifier_URIScheme {
    99   
     10    var $browsable = false;
     11   
    1012    function validateComponents(
    11         $userinfo, $host, $port, $path, $query, $config
     13        $userinfo, $host, $port, $path, $query, $config, &$context
    1214    ) {
    1315        list($userinfo, $host, $port, $path, $query) =
    1416            parent::validateComponents(
    15                 $userinfo, $host, $port, $path, $query, $config );
     17                $userinfo, $host, $port, $path, $query, $config, $context );
    1618        // typecode check needed on path
    1719        return array(null, null, null, $path, null);
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/URIScheme/nntp.php

    r6358 r7584  
    99   
    1010    var $default_port = 119;
     11    var $browsable = false;
    1112   
    1213    function validateComponents(
    13         $userinfo, $host, $port, $path, $query, $config
     14        $userinfo, $host, $port, $path, $query, $config, &$context
    1415    ) {
    1516        list($userinfo, $host, $port, $path, $query) =
    1617            parent::validateComponents(
    17                 $userinfo, $host, $port, $path, $query, $config );
     18                $userinfo, $host, $port, $path, $query, $config, $context );
    1819        return array(null, $host, $port, $path, null);
    1920    }
  • _plugins_/_dev_/_ze_laboratoire_/htmlpurifier/library/HTMLPurifier/URISchemeRegistry.php

    r6358 r7584  
    6464     * @param $scheme String scheme name like http or mailto
    6565     * @param $config HTMLPurifier_Config object
     66     * @param $config HTMLPurifier_Context object
    6667     */
    67     function &getScheme($scheme, $config = null) {
     68    function &getScheme($scheme, $config, &$context) {
    6869        if (!$config) $config = HTMLPurifier_Config::createDefault();
    6970        $null = null; // for the sake of passing by reference
Note: See TracChangeset for help on using the changeset viewer.