1*46ca39b7SAndreas Gohr<?php 2*46ca39b7SAndreas Gohr/** 3*46ca39b7SAndreas Gohr * DokuWiki Plugin struct (Helper Component) 4*46ca39b7SAndreas Gohr * 5*46ca39b7SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6*46ca39b7SAndreas Gohr * @author Andreas Gohr, Michael Große <dokuwiki@cosmocode.de> 7*46ca39b7SAndreas Gohr */ 8*46ca39b7SAndreas Gohr 9*46ca39b7SAndreas Gohr// must be run within Dokuwiki 10*46ca39b7SAndreas Gohruse plugin\struct\meta\StructException; 11*46ca39b7SAndreas Gohr 12*46ca39b7SAndreas Gohrif(!defined('DOKU_INC')) die(); 13*46ca39b7SAndreas Gohr 14*46ca39b7SAndreas Gohr/** 15*46ca39b7SAndreas Gohr * The public interface for the struct plugin 16*46ca39b7SAndreas Gohr * 17*46ca39b7SAndreas Gohr * 3rd party developer should always interact with struct data through this 18*46ca39b7SAndreas Gohr * helper plugin only. 19*46ca39b7SAndreas Gohr * 20*46ca39b7SAndreas Gohr * All functions will throw StructExceptions when something goes wrong. 21*46ca39b7SAndreas Gohr */ 22*46ca39b7SAndreas Gohrclass helper_plugin_struct extends DokuWiki_Plugin { 23*46ca39b7SAndreas Gohr 24*46ca39b7SAndreas Gohr /** 25*46ca39b7SAndreas Gohr * Get the structured data of a given page 26*46ca39b7SAndreas Gohr * 27*46ca39b7SAndreas Gohr * @param string $page The page to get data for 28*46ca39b7SAndreas Gohr * @param string|null $schema The schema to use null for all 29*46ca39b7SAndreas Gohr * @param int $time A timestamp if you want historic data (0 for now) 30*46ca39b7SAndreas Gohr * @return array ('schema' => ( 'fieldlabel' => 'value', ...)) 31*46ca39b7SAndreas Gohr * @throws StructException 32*46ca39b7SAndreas Gohr */ 33*46ca39b7SAndreas Gohr public function getData($page, $schema=null, $time=0) { 34*46ca39b7SAndreas Gohr 35*46ca39b7SAndreas Gohr } 36*46ca39b7SAndreas Gohr 37*46ca39b7SAndreas Gohr /** 38*46ca39b7SAndreas Gohr * Saves data for a given page (creates a new revision) 39*46ca39b7SAndreas Gohr * 40*46ca39b7SAndreas Gohr * @param string $page 41*46ca39b7SAndreas Gohr * @param string $summary 42*46ca39b7SAndreas Gohr * @throws StructException 43*46ca39b7SAndreas Gohr */ 44*46ca39b7SAndreas Gohr public function saveData($page, $summary='') { 45*46ca39b7SAndreas Gohr 46*46ca39b7SAndreas Gohr } 47*46ca39b7SAndreas Gohr 48*46ca39b7SAndreas Gohr /** 49*46ca39b7SAndreas Gohr * Get info about existing schemas 50*46ca39b7SAndreas Gohr * 51*46ca39b7SAndreas Gohr * @param string|null $schema the schema to query, null for all 52*46ca39b7SAndreas Gohr * @return array ('schema' => ( (sort, label, type, ...), ...)) 53*46ca39b7SAndreas Gohr * @throws StructException 54*46ca39b7SAndreas Gohr */ 55*46ca39b7SAndreas Gohr public function getSchema($schema=null) { 56*46ca39b7SAndreas Gohr 57*46ca39b7SAndreas Gohr } 58*46ca39b7SAndreas Gohr 59*46ca39b7SAndreas Gohr /** 60*46ca39b7SAndreas Gohr * Returns all pages known to the struct plugin 61*46ca39b7SAndreas Gohr * 62*46ca39b7SAndreas Gohr * That means all pages that have or had once struct data saved 63*46ca39b7SAndreas Gohr * 64*46ca39b7SAndreas Gohr * @param string|null $schema limit the result to a given schema 65*46ca39b7SAndreas Gohr * @return array ((page, schema), ...) 66*46ca39b7SAndreas Gohr * @throws StructException 67*46ca39b7SAndreas Gohr */ 68*46ca39b7SAndreas Gohr public function getPages($schema=null) { 69*46ca39b7SAndreas Gohr 70*46ca39b7SAndreas Gohr } 71*46ca39b7SAndreas Gohr 72*46ca39b7SAndreas Gohr} 73