1 |
bareface |
1.1 |
<?php |
2 |
|
|
/* |
3 |
|
|
|
4 |
|
|
YakkaPageStorage |
5 |
|
|
|
6 |
|
|
An abstract class definition (interface), which a typical yakka page storage provider must implement. |
7 |
|
|
PHP has no language term to strongly verify this, so great care must be taken to meet the requirements |
8 |
|
|
of this interface when writing an implementation. |
9 |
|
|
|
10 |
|
|
Please read all comments on all methods carefully to implement correctly. |
11 |
|
|
*/ |
12 |
|
|
|
13 |
|
|
class YakkaPageStorage { |
14 |
|
|
function YakkaPageStorage($parameters = null) { |
15 |
|
|
/* |
16 |
|
|
|
17 |
|
|
YakkaPageStorage($parameters : array) : void |
18 |
|
|
|
19 |
|
|
Constructor of your storage provider. |
20 |
|
|
|
21 |
|
|
Yakka will optionally pass you parameters for your storage provider (such as username, password, databasename aso.). |
22 |
|
|
These parameters are defined in the yakka-settings.xml file as child-elements of your storage-provider definition. |
23 |
|
|
|
24 |
|
|
You'll get all parameters as an associative php-array, in form of "element-name" => "element-text-node-childs-content", i.e. |
25 |
|
|
|
26 |
|
|
array( |
27 |
|
|
"user" => "user-value", |
28 |
|
|
"host" => "host-value" |
29 |
|
|
) |
30 |
|
|
*/ |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
function hasPage($id, $revision = null) { |
34 |
|
|
/* |
35 |
|
|
|
36 |
|
|
hasPage($id : string, $revision : string) : boolean |
37 |
|
|
|
38 |
|
|
Check if the page exists on storage. |
39 |
|
|
|
40 |
|
|
Yakka has to check if a certain page already exists on your storage. Therefore you'll get the $id parameter as page identifier. |
41 |
|
|
Maybe Yakka wants to check on a special revision and passes you optionally a $revision. |
42 |
|
|
|
43 |
|
|
Yakka expects a php-boolean value to be returned |
44 |
|
|
*/ |
45 |
|
|
} |
46 |
|
|
|
47 |
|
|
function loadPage($id, $revision = null) { |
48 |
|
|
/* |
49 |
|
|
|
50 |
|
|
loadPage($id : string, $revision: string) : YakkaPage |
51 |
|
|
|
52 |
|
|
Load a certain page. |
53 |
|
|
|
54 |
|
|
Yakka will call this method to load a certain page from your storage. You'll get the page identifier $id and optionally a $revision string; |
55 |
|
|
if passed a $revision identifier, you have to return this revision of that page. |
56 |
|
|
|
57 |
|
|
Yakka expects an instance of a YakkaPage as return value. Read documentation of YakkaPage on how to create a valid instance of it. |
58 |
|
|
*/ |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
function loadPageLinkedPages($id) { |
62 |
|
|
/* |
63 |
|
|
|
64 |
|
|
loadPageLinkedPages($id : string) : array |
65 |
|
|
|
66 |
|
|
Load page identifiers linked from a certain page. |
67 |
|
|
|
68 |
|
|
On certain occasions, Yakka may request your storage to pass all page identifers back which are linked from a page given by $id string. |
69 |
|
|
|
70 |
|
|
Yakka wants an array passed back from this method containing all page identifiers your storage has found. |
71 |
|
|
The order and key values of this array irrelevant. Just return the id's like |
72 |
|
|
array("FirstPage", "AnyOtherPage", "AgainAnyPage"); |
73 |
|
|
*/ |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
function loadPageReferrerPages($id) { |
77 |
|
|
/* |
78 |
|
|
|
79 |
|
|
loadPageReferrerPages($id : string) : array |
80 |
|
|
|
81 |
|
|
Load page identifiers linking to a certain page. |
82 |
|
|
|
83 |
|
|
This method is similar to loadPageLinkedPages, except that it should pass all page identifiers linking to a certain page given by $id string. |
84 |
|
|
On most wiki-engines these pages are known as BackLinks or ReferrerPages. |
85 |
|
|
|
86 |
|
|
Yakka expects the same type of array as stated in loadPageLinkedPages. |
87 |
|
|
*/ |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
function loadPageRevisions($id) { |
91 |
|
|
/* |
92 |
|
|
|
93 |
|
|
loadPageRevisions($id : string) : array |
94 |
|
|
|
95 |
|
|
Load all revision identifiers of a certain page. |
96 |
|
|
|
97 |
|
|
Yakka may request a list of all available revisions of a page identified by $id. |
98 |
|
|
|
99 |
|
|
In return, pass back a **sorted** array of revision identifiers beginning with the most recent revision and ending with the oldest revision. |
100 |
|
|
This array may be indexed and just needs to be a list in a form like |
101 |
|
|
array("first revision id", "second revision id"...); |
102 |
|
|
or |
103 |
|
|
array(0 => "first revision id", 1 => "second revision id"...); |
104 |
|
|
*/ |
105 |
|
|
} |
106 |
|
|
|
107 |
|
|
function loadPagePermission($id, $permissionType) { |
108 |
|
|
/* |
109 |
|
|
|
110 |
|
|
loadPagePermission($id : string, $permissionType : int) : YakkaObjectPermission |
111 |
|
|
|
112 |
|
|
Load a certain permission for a certain page. |
113 |
|
|
|
114 |
|
|
To check access permissions of a certain user or role on a page identified by $id string, Yakka calls this method to gather that information |
115 |
|
|
from your storage. Yakka always will request a certain type of permission identified by $permissionType value. Possible values are: |
116 |
|
|
1 = YAKKA_OBJECT_PERMISSION_READ |
117 |
|
|
2 = YAKKA_OBJECT_PERMISSION_WRITE |
118 |
|
|
3 = YAKKA_OBJECT_PERMISSION_DELETE |
119 |
|
|
|
120 |
|
|
Yakka expects an instance of YakkaObjectPermission to be returns. Consult the YakkaObjectPermission documentation to get knowledge on how |
121 |
|
|
to instantiate a valid object of YakkaObjectPermission. |
122 |
|
|
*/ |
123 |
|
|
} |
124 |
|
|
|
125 |
|
|
function savePage($id, $source, $user = null, $revision = null) {} |
126 |
|
|
function savePagePermission($id, $permissionType, $allowDefault = null, $allowUsers = null, $allowRoles = null, $denyDefault = null, $denyUsers = null, $denyRoles = null) {} |
127 |
|
|
function savePageLinkedPages($ids) {} |
128 |
|
|
} |
129 |
|
|
|
130 |
|
|
?> |