~ubuntu-branches/ubuntu/natty/moodle/natty

« back to all changes in this revision

Viewing changes to lib/htmlpurifier/HTMLPurifier/ConfigSchema/Builder/ConfigSchema.php

  • Committer: Bazaar Package Importer
  • Author(s): Tomasz Muras
  • Date: 2010-10-30 12:19:28 UTC
  • mfrom: (1.1.12 upstream) (3.1.10 squeeze)
  • Revision ID: james.westby@ubuntu.com-20101030121928-qzobi6mctpnk4dif
Tags: 1.9.9.dfsg2-2
* Added Romanian translation
* Updated Japanese translation (closes: #596820)
* Backporting security fixes from Moodle 1.9.10 (closes: #601384)
   - Updated embedded CAS to 1.1.3
   - Added patch for MDL-24523:
     clean_text() not filtering text in markdown format
   - Added patch for MDL-24810 and upgraded customized HTML Purifier to 4.2.0 
   - Added patch for MDL-24258:
     students can delete their forum posts later than $CFG->maxeditingtime 
     under certain conditions
   - Added patch for MDL-23377:
     Can't delete quiz attempts in course without enrolled students

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * Converts HTMLPurifier_ConfigSchema_Interchange to our runtime
 
5
 * representation used to perform checks on user configuration.
 
6
 */
 
7
class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
 
8
{
 
9
 
 
10
    public function build($interchange) {
 
11
        $schema = new HTMLPurifier_ConfigSchema();
 
12
        foreach ($interchange->directives as $d) {
 
13
            $schema->add(
 
14
                $d->id->key,
 
15
                $d->default,
 
16
                $d->type,
 
17
                $d->typeAllowsNull
 
18
            );
 
19
            if ($d->allowed !== null) {
 
20
                $schema->addAllowedValues(
 
21
                    $d->id->key,
 
22
                    $d->allowed
 
23
                );
 
24
            }
 
25
            foreach ($d->aliases as $alias) {
 
26
                $schema->addAlias(
 
27
                    $alias->key,
 
28
                    $d->id->key
 
29
                );
 
30
            }
 
31
            if ($d->valueAliases !== null) {
 
32
                $schema->addValueAliases(
 
33
                    $d->id->key,
 
34
                    $d->valueAliases
 
35
                );
 
36
            }
 
37
        }
 
38
        $schema->postProcess();
 
39
        return $schema;
 
40
    }
 
41
 
 
42
}
 
43
 
 
44
// vim: et sw=4 sts=4