1<?php
2/**
3 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
4 * @author     lpaulsen93
5 */
6
7class helper_plugin_fields extends DokuWiki_Plugin {
8    function ODTSetUserField(&$renderer, $name, $value) {
9        if (!method_exists ($renderer, 'addUserField')) {
10            $name = $this->_fieldsODTFilterUserFieldName($name);
11            $renderer->fields[$name] = $value;
12        } else {
13            $renderer->addUserField($name, $value);
14        }
15    }
16
17    function ODTDisplayUserField(&$renderer, $name) {
18        if (!method_exists ($renderer, 'insertUserField')) {
19            $name = $this->_fieldsODTFilterUserFieldName($name);
20            if (array_key_exists($name, $renderer->fields)) {
21                return '<text:user-field-get text:name="'.$name.'">'.$renderer->fields[$name].'</text:user-field-get>';
22            }
23        } else {
24            $renderer->insertUserField($name);
25        }
26        return '';
27    }
28}
29