public function populate($fixes)
    {
        foreach ($fixes as $name => $fix) {
            // determine what the fix is for
            list($type, $params) = $this->getFixType($name);
            switch ($type) {
                case 'attr_transform_pre':
                case 'attr_transform_post':
                    $attr = $params['attr'];
                    if (isset($params['element'])) {
                        $element = $params['element'];
                        if (empty($this->info[$element])) {
                            $e = $this->addBlankElement($element);
                        } else {
                            $e = $this->info[$element];
                        }
                    } else {
                        $type = "info_$type";
                        $e = $this;
                    }
                    // PHP does some weird parsing when I do
                    // $e->$type[$attr], so I have to assign a ref.
                    $f =& $e->$type;
                    $f[$attr] = $fix;
                    break;
                case 'tag_transform':
                    $this->info_tag_transform[$params['element']] = $fix;
                    break;
                case 'child':
                case 'content_model_type':
                    $element = $params['element'];
                    if (empty($this->info[$element])) {
                        $e = $this->addBlankElement($element);
                    } else {
                        $e = $this->info[$element];
                    }
                    $e->$type = $fix;
                    break;
                default:
                    trigger_error("Fix type $type not supported", E_USER_ERROR);
                    break;
            }
        }
    }
public function populate($fixes)
    {
        foreach ($fixes as $name => $fix) {
            // determine what the fix is for
            list($type, $params) = $this->getFixType($name);
            switch ($type) {
                case 'attr_transform_pre':
                case 'attr_transform_post':
                    $attr = $params['attr'];
                    if (isset($params['element'])) {
                        $element = $params['element'];
                        if (empty($this->info[$element])) {
                            $e = $this->addBlankElement($element);
                        } else {
                            $e = $this->info[$element];
                        }
                    } else {
                        $type = "info_$type";
                        $e = $this;
                    }
                    // PHP does some weird parsing when I do
                    // $e->$type[$attr], so I have to assign a ref.
                    $f =& $e->$type;
                    $f[$attr] = $fix;
                    break;
                case 'tag_transform':
                    $this->info_tag_transform[$params['element']] = $fix;
                    break;
                case 'child':
                case 'content_model_type':
                    $element = $params['element'];
                    if (empty($this->info[$element])) {
                        $e = $this->addBlankElement($element);
                    } else {
                        $e = $this->info[$element];
                    }
                    $e->$type = $fix;
                    break;
                default:
                    trigger_error("Fix type $type not supported", E_USER_ERROR);
                    break;
            }
        }
    }
public function populate ( $ fixes ) { foreach ( $ fixes as $ name => $ fix ) { // determine what the fix is for
 list ( $ type , $ params ) = $ this -> getFixType ( $ name ) ; switch ( $ type ) { case 'attr_transform_pre' : case 'attr_transform_post' : $ attr = $ params [ 'attr' ] ; if ( isset ( $ params [ 'element' ] ) ) { $ element = $ params [ 'element' ] ; if ( empty ( $ this -> info [ $ element ] ) ) { $ e = $ this -> addBlankElement ( $ element ) ; } else { $ e = $ this -> info [ $ element ] ; } } else { $ type = "info_$type" ; $ e = $ this ; } // PHP does some weird parsing when I do
 // $e->$type[$attr], so I have to assign a ref.
 $ f = & $ e -> $ type ; $ f [ $ attr ] = $ fix ; break ; case 'tag_transform' : $ this -> info_tag_transform [ $ params [ 'element' ] ] = $ fix ; break ; case 'child' : case 'content_model_type' : $ element = $ params [ 'element' ] ; if ( empty ( $ this -> info [ $ element ] ) ) { $ e = $ this -> addBlankElement ( $ element ) ; } else { $ e = $ this -> info [ $ element ] ; } $ e -> $ type = $ fix ; break ; default : trigger_error ( "Fix type $type not supported" , E_USER_ERROR ) ; break ; } } }
Populates the module with transforms and other special-case code
based on a list of fixes passed to it
@param array $fixes Lookup table of fixes to activate
Populates the module with transforms and other special - case code based on a list of fixes passed to it