1<?php
2/**
3 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
4 * @author     Brend Wanders <b.wanders@utwente.nl>
5 */
6// must be run within Dokuwiki
7if(!defined('DOKU_INC')) die('Meh.');
8
9/**
10 * This base class defines the methods required by Strata types.
11 *
12 * There are two kinds of types: normal types and synthetic types.
13 * Normal types are meant for users, while synthetic types exist to
14 * keep the plugin working. (i.e., unloadable types are faked by a
15 * synthetic type, and non-user types should be synthetic).
16 */
17class plugin_strata_type {
18    /**
19     * Renders the value.
20     *
21     * @param mode string output format being rendered
22     * @param renderer ref reference to the current renderer object
23     * @param triples ref reference to the current triples helper
24     * @param value string the value to render (this should be a normalized value)
25     * @param hint string a type hint
26     * @return true if the mode was handled, false if it was not
27     */
28    function render($mode, &$renderer, &$triples, $value, $hint) {
29        $renderer->cdata($value);
30        return true;
31    }
32
33    /**
34     * Normalizes the given value
35     *
36     * @param value string the value to normalize
37     * @param hint string a type hint
38     * @return the normalized value
39     */
40    function normalize($value, $hint) {
41        return $value;
42    }
43
44    /**
45     * Returns meta-data on the type. This method returns an array with
46     * the following keys:
47     *   - desc: A human-readable description of the type
48     *   - synthetic: an optional boolean indicating that the type is synthethic
49     *                (see class docs for definition of synthetic types)
50     *   - hint: an optional string indicating what the type hint's function is
51     *   - tags: an array op applicable tags
52     *
53     * @return an array containing
54     */
55    function getInfo() {
56        return array(
57            'desc'=>'The generic type.',
58            'hint'=>false,
59            'synthetic'=>true,
60            'tags'=>array()
61        );
62    }
63}
64