1 | <?php |
||
17 | class ScribuntoLuaLibrary extends Scribunto_LuaLibraryBase { |
||
18 | |||
19 | /** |
||
20 | * @var LibraryFactory |
||
21 | */ |
||
22 | private $libraryFactory; |
||
23 | |||
24 | /** |
||
25 | * This is the name of the key for error messages |
||
26 | * |
||
27 | * @var string |
||
28 | * @since 1.0 |
||
29 | */ |
||
30 | const SMW_ERROR_FIELD = 'error'; |
||
31 | |||
32 | /** |
||
33 | * @since 1.0 |
||
34 | */ |
||
35 | 49 | public function register() { |
|
48 | |||
49 | /** |
||
50 | * This mirrors the functionality of the parser function #ask and makes it |
||
51 | * available in lua. |
||
52 | * |
||
53 | * @since 1.0 |
||
54 | * |
||
55 | * @param string|array $arguments parameters passed from lua, string or array depending on call |
||
56 | * |
||
57 | * @return array array( null ) or array[] |
||
58 | */ |
||
59 | 10 | public function ask( $arguments = null ) { |
|
77 | |||
78 | /** |
||
79 | * Returns property type |
||
80 | * |
||
81 | * @since 1.0 |
||
82 | * |
||
83 | * @param string $propertyName |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | 5 | public function getPropertyType( $propertyName = null ) { |
|
104 | |||
105 | /** |
||
106 | * Returns query results in for of the standard API return format |
||
107 | * |
||
108 | * @since 1.0 |
||
109 | * |
||
110 | * @param string|array $arguments |
||
111 | * |
||
112 | * @return array |
||
113 | */ |
||
114 | 8 | public function getQueryResult( $arguments = null ) { |
|
134 | |||
135 | /** |
||
136 | * This mirrors the functionality of the parser function #info and makes it |
||
137 | * available to lua. |
||
138 | * |
||
139 | * @since 1.0 |
||
140 | * |
||
141 | * @param string $text text to show inside the info popup |
||
142 | * @param string $icon identifier for the icon to use |
||
143 | * |
||
144 | * @return string[] |
||
145 | */ |
||
146 | 7 | public function info( $text, $icon = 'info' ) { |
|
174 | |||
175 | /** |
||
176 | * This mirrors the functionality of the parser function #set and makes it |
||
177 | * available in lua. |
||
178 | * |
||
179 | * @since 1.0 |
||
180 | * |
||
181 | * @param string|array $arguments arguments passed from lua, string or array depending on call |
||
182 | * |
||
183 | * @return null|array|array[] |
||
184 | */ |
||
185 | 20 | public function set( $arguments ) { |
|
210 | |||
211 | /** |
||
212 | * This mirrors the functionality of the parser function #subobject and |
||
213 | * makes it available to lua. |
||
214 | * |
||
215 | * @param string|array $arguments arguments passed from lua, string or array depending on call |
||
216 | * @param string $subobjectId if you need to manually assign an id, do this here |
||
217 | * |
||
218 | * @return null|array|array[] |
||
219 | */ |
||
220 | 23 | public function subobject( $arguments, $subobjectId = null ) { |
|
254 | |||
255 | /** |
||
256 | * This takes an array and converts it so, that the result is a viable lua table. |
||
257 | * I.e. the resulting table has its numerical indices start with 1 |
||
258 | * If `$ar` is not an array, it is simply returned |
||
259 | * @param mixed $ar |
||
260 | * @return mixed array |
||
261 | */ |
||
262 | 15 | private function convertArrayToLuaTable( $ar ) { |
|
273 | |||
274 | /** |
||
275 | * Takes a result returned from a parser function call and prepares it to be |
||
276 | * used as parsed string. |
||
277 | * |
||
278 | * @since 1.0 |
||
279 | * |
||
280 | * @param string|array $parserFunctionResult |
||
281 | * |
||
282 | * @return string |
||
283 | */ |
||
284 | 48 | private function doPostProcessParserFunctionCallResult( $parserFunctionResult ) { |
|
301 | |||
302 | /** |
||
303 | * Returns the LibraryFactory singleton (and creates it first, if not already present) |
||
304 | * |
||
305 | * @since 1.0 |
||
306 | * |
||
307 | * @return LibraryFactory |
||
308 | */ |
||
309 | 59 | private function getLibraryFactory() { |
|
321 | |||
322 | /** |
||
323 | * Tests, if supplied parameter `$queryResult` is a valid {@see QueryResult} |
||
324 | * |
||
325 | * @since 1.0 |
||
326 | * |
||
327 | * @param mixed $queryResult |
||
328 | * |
||
329 | * @return bool |
||
330 | */ |
||
331 | 16 | private function isAQueryResult( $queryResult ) { |
|
334 | |||
335 | /** |
||
336 | * Takes the $arguments passed from lua and pre-processes them: make sure, |
||
337 | * we have a sequence array (not associative) |
||
338 | * |
||
339 | * @since 1.0 |
||
340 | * |
||
341 | * @param string|array $arguments |
||
342 | * |
||
343 | * @return array |
||
344 | */ |
||
345 | 59 | private function processLuaArguments( $arguments ) { |
|
371 | |||
372 | } |
||
373 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.