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