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