Jump to content

Extension:WSArrays/dtp

From mediawiki.org
This page is a translated version of the page Extension:WSArrays and the translation is 20% complete.
Outdated translations are marked like this.
Warning Warning: This extension is incompatible with plans to parallelize parsing, as is intended by the use of Parsoid . Therefore, the future of this extension is uncertain, and it is expected to become incompatible with the standard MediaWiki parser within a few years. For further information, see task T250963 and No support for sequential, in-order processing of extension tags .
MediaWiki extensions manual
WSArrays
Release status: unmaintained
Implementation Parser function
Description Adds parser functions to allow the creation and traversing of associative and multidimensional arrays.
Author(s) Wikibase Solutions
Latest version 5.5.4 (2022-09-12)
MediaWiki 1.31+
PHP 5.3+
Database changes No
License GNU General Public License 2.0 or later
Download
  • $wfSkipVersionControl
  • $wfEnableResultPrinter

The WSArrays (or ComplexArrays) extension creates an additional set of parser functions that operate on multidimensional and associative arrays.

Functions

This extension defines over 20 parser functions:

Function name Aliases
#complexarraydefine #cadefine
#complexarrayprint #caprint
#complexarraypush #capush
#complexarraysize #casize
#complexarrayaddvalue #caaddvalue, #caadd, #caaddv, #caset
#complexarrayreset #careset, #caclear
#complexarraysort #casort
#complexarraymap #camap
#complexarraymaptemplate #camaptemplate, #camapt, #catemplate
#complexarrayextract #caextract
#complexarrayunique #caunique
#complexarraymerge #camerge
#complexarraypusharray #capusharray
#complexarrayslice #caslice
#complexarraysearch #casearch
#complexarraysearcharray #casearcharray, #casearcha
#complexarraydefinedarrays #cadefinedarrays, #cadefined, #cad
#complexarrayarraymap #caamap, #camapa
#complexarrayparent #caparent, #capapa, #camama
#complexarrayunset #caunset, #caremove
#complexarraydiff #cadiff

Constructing arrays

complexarraydefine

This function creates a new array, identified by 'key'.

Syntax

{{#complexarraydefine:key|array|delimiter|noparse}}

Explanation

  • key (required)The name of the array;
  • array (required)The array as WSON, or using a delimiter.
  • delimiter (optional, default: ,)The delimiter used when defining a simple array.
  • noparse (optional)Arguments to tell the parser what to parse in the 'array' (see #Manipulation of the parser).

Examples

Define a multidimensional array called 'baz'
{{#cadefine:baz|(("foo":(("bar":"baz"))))}}
Define a simple array called 'bex' (note, sometimes WSArrays does not properly recognise delimiter-separated arrays; try adding a delimiter instead of using the default (,))
{{#cadefine:bex|foo; bar; baz|;}}

complexarraydefinedarrays

This debug function creates a new array containing the keys of all currently defined arrays.

Syntax

{{#complexarraydefinedarrays: key}}

Explanation

  • key (required)The name of the array that will contain the keys of the currently defined arrays


Working with arrays

Extraction

complexarrayprint

This function prints the values of the array in a custom format.

Syntax
{{#complexarrayprint:key|options|noparse}}
Explanation
  • key (required)The name of the (sub)array that should be printed;
  • options (optional):
    • markup – Print the result as WSON.
  • noparse (optional)Set to "true" to tell the parser not treat the output as wiki syntax.


Examples

We have an array called 'foobar':

  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
  • 3
    • baz: {{SomeTemplate|Test}}. ?UNIQ347fb3f0c7f3d9c-5
If you defined the array with noparse, the behavior is different.
Function Result
{{#caprint: foobar}}
  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
  • 3
    • baz: Test. {{SomeTemplate|Test}}
{{#caprint: foobar[0]}}
  • foo: bar
  • baz: quz
{{#caprint: foobar[3]}}
  • Test. {{SomeTemplate|Test}}
{{#caprint: foobar[0][foo]}}
bar

complexarraysize

This parser function returns the size of a (sub)array.

Syntax
{{#complexarraysize:key|options}}
Explanation
  • key (required)The name of the (sub)array;
  • options (optional):
    • top – Only count the number of items in the top array (not recursively).


Examples

We have an array called 'foobar':

  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
Function Result
{{#casize: foobar}}
9
{{#casize: foobar[1]}}
2
{{#casize: foobar|top}}
3

complexarrayslice

This parser function can extract a slice from an array.

Syntax
{{#complexarrayslice:new_key|key|offset|length}}
Explanation
  • new_key (required)The name of the array that is going to be created;
  • key (required)The name of the array that needs to be sliced;
  • offset (required)For a positive offset, the new array will start at that offset in the first array. For a negative offset, the new array will start that far from the end of the first array;
  • length (optional)The length of the new array.


Examples

We have an array called foobar:

  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar
  • 2
    • boo: bar
    • far: quz
  • 3
    • foo: quux
    • bar: bar
Function Result
{{#caslice: boofar | foobar | 2 | 1 }}

This gives the third element of the array.

boofar:

  • 0
    • boo: bar
    • far: quz
{{#caslice: boofar | foobar | -1 }}

This gives the last element of the array:

boofar:

  • 0
    • foo: quux
    • bar: bar

complexarraysearch

This parser function searches through an array for a keyword and returns the corresponding key of the first match. If there are no matches, it will return 0.

Syntax
{{#complexarraysearch:key|keyword}}
Explanation
  • key (required)The name of the array that is going to be searched;
  • keyword (required)The keyword that is going to get searched for.


Examples

We have an array called foobar:

  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar
  • 2
    • boo: bar
    • far: quz
  • 3
    • foo: quux
    • bar: bar
Function Result
{{#casearch: foobar | quux }}
WSArray[3][foo]
{{#casearch: foobar | bar }}
WSArray[0][foo]

complexarraysearcharray

This parser function searches through an array for a keyword and creates a new array with the corresponding keys of the matches. If there are no matches, it will return 0.

Syntax
{{#complexarraysearcharray:new_key|key|keyword}}
Explanation
  • new_key (required)The name of the array that is going to be created containing all the keys;
  • key (required)The name of the array that is going to be searched;
  • keyword (required)The keyword that is going to get searched for.


Examples

We have an array called foobar:

  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar
  • 2
    • boo: bar
    • far: quz
  • 3
    • foo: quux
    • bar: bar
Function Result
{{#casearcha: boofar | foobar | bar }}

boofar:

  • foobar[0][foo]
  • foobar[1][baz]
  • foobar[1][foo]
  • foobar[2][boo]
  • foobar[3][bar]
{{#casearcha: boofar | foobar | quux }}

boofar:

foobar[3][foo]

Alteration

complexarrayunset

This function unsets the given key.

Syntax
{{#complexarrayunset: key }}
Explanation
  • key (required)The key which should be unset


Examples

Suppose we have an array called "foobar":

  • foo
    • bar
    • qux
  • baz
Function Result
{{#caunset: foobar[foo][1] }}

foobar:

  • foo
    • bar
  • baz

complexarrayaddvalue

This parser function adds a value or subarray to an existing array or replaces an existing subarray with that value.

Syntax
{{#complexarrayaddvalue:key|value}}
Explanation
  • key (required)The name of the subarray that will be created;
  • value (required)A value in plaintext or a subarray in any supported markup language.


Examples

We have an array called 'foobar':

  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
Function Result
{{#caadd: foobar[0][bex]|["abc","123"]}}
  • 0
    • foo: bar
    • baz: quz
    • bex
      • abc
      • 123
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
{{#caadd: foobar[3][foo][bar][baz]|bex}}
  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
  • 3
    • foo
      • bar
        • baz: bex
{{#caadd: foobar[0]|["abc","123"]}}
  • 0
    • abc
    • 123
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar

complexarrayreset

This parser function resets all arrays or one array.

Syntax
{{#complexarrayreset:key}}
Explanation
  • key (optional)The name of the array that must be unset, when empty, all arrays will be unset.

complexarraysort

This parser function sorts an array.

Syntax
{{#complexarraysort:key|options|sortingkey}}
Explanation
  • key (required)The array that needs to be sorted;
  • options (optional):
    • multisort – Sort the array using multisort;
    • asort – Sort the array using asort;
    • arsort – Sort the array using arsort;
    • krsort – Sort the array using krsort;
    • natcasesort – Sort the array using natcasesort;
    • natsort – Sort the array using natsort;
    • rsort – Sort the array using rsort;
    • shuffle – Shuffle the array;
    • keysort – Sort a two-dimensional array according to the values of a key in the second array. You can change the order to descending by appending ",desc" in options (so "keysort,desc").
  • sortingkey (optional, required when using keysort)The key with which the array must be sorted when using keysort.

See the PHP documentation for the sorting algorithms.


Examples

We have an array called 'foobar':

  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
Function Result
{{#casort: foobar|keysort|foo}}
  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar
  • 2
    • foo: quz
    • baz: bar
{{#casort: foobar|keysort,desc|foo}}
  • 0
    • foo: quz
    • baz: bar
  • 1
    • foo: bar
    • baz: quz
  • 2
    • baz: bar
    • foo: bar
{{#casort: foobar|shuffle}}
  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar

complexarrayunique

This parser function removes duplicate keys and values from a array.

Syntax
{{#complexarrayunique:key}}
Explanation
  • key (required)The name of the array.


Interaction

complexarraypush

This parser function pushes a new value or subarray to the end of an existing (sub)array.

Syntax
{{#complexarraypush:key|value|noparse}}
Explanation
  • key (required)The name of the (sub)array;
  • value (required)A value in plaintext or any supported markup language.
  • noparse (optional)Arguments to tell the parser what to parse in the 'subject' (see #Manipulation of the parser).


Examples

We have an array called 'foobar':

  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
Function Result
{{#capush: foobar|bex}}
  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
  • 2
    • baz: bar
    • foo: bar
  • test
{{#capush: foobar[1]|bex}}
  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
    • bex
  • 2
    • baz: bar
    • foo: bar
{{#capush: foobar | (("bex":"baz")) }}
  • 0
    • foo: bar
    • baz: quz
  • 1
    • foo: quz
    • baz: bar
    • bex
  • 2
    • baz: bar
    • foo: bar
  • 3
    • bex: baz

complexarrayextract

This parser function creates a new array from a subarray.

Syntax
{{#complexarrayextract: new_key | subarray }}
Explanation
  • new_key (required)The name of the array that is going to be created;
  • subarray (required)The subarray that needs to be extracted.


Examples

We have an array called 'foobar':

  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar
Function Result
{{#caextract: boofar | foobar[0] }}

boofar:

  • 0
    • foo: bar
    • baz: quz

complexarraymerge

This parser function creates a new array by merging two or more arrays.

Syntax
{{#complexarraymerge: new_key | key1 | key2 | ... | keyn | options }}
Explanation
  • new_key (required)The name of the array that is going to be created;
  • key1 (required)The name of the first array;
  • key2 (required)The name of the second array;
  • ...
  • keyn (optional)The name of the n'th array;
  • options
    • recursive – Merge recursively


Examples

We have an array called 'foobar':

  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar

and an array called 'boofar':

  • 0
    • boo: bar
    • far: quz
  • 1
    • foo: quux
    • bar: bar
Function Result
{{#camerge: farboo | foobar | boofar}}

farboo:

  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar
  • 2
    • boo: bar
    • far: quz
  • 3
    • foo: quux
    • bar: bar

complexarraydiff

This parser function calculates the difference between two or more arrays and stores that in a new array. It shadows the PHP function array_diff_assoc().

Syntax
{{#complexarraydiff: new_key | key1 | key2 | ... | keyn }}
Explanation
  • new_key (required)The name of the array that is going to be created;
  • key1 (required)The name of the first array;
  • key2 (required)The name of the second array;
  • ...
  • keyn (optional)The name of the n'th array;

complexarraypusharray

This parser function creates a new array by pushing one or more arrays to the end of another array.

Syntax
{{#complexarraypusharray:new_key|key1|key2|...|keyn}}
Explanation
  • new_key (required)The name of the array that is going to be created;
  • key1 (required)The name of the first array;
  • key2 (required)

The name of the second array;

  • ...
  • keyn (optional)The name of the n'th array;


Examples

We have an array called 'foobar':

  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar

and an array called 'boofar':

  • 0
    • boo: bar
    • far: quz
  • 1
    • foo: quux
    • bar: bar
Function Result
{{#capusharray: farboo | foobar | boofar}}

farboo:

  • 0
    • 0
      • foo: bar
      • baz: quz
    • 1
      • baz: bar
      • foo: bar
  • 1
    • 0
      • boo: bar
      • far: quz
    • 1
      • foo: quux
      • bar: bar

Iteration

complexarraymap

This parser function iterates over an array and maps the values of the array onto a mapping key.

Syntax
{{#complexarraymap:key|mapping_key|subject|delimiter|show}}
Explanation
  • key (required)The name of the array that is going to be mapped;
  • mapping_key (required)The keyword that will be replaced in the subject;
  • subject (required)The string on which the mapping will be applied;
  • delimiter (optional)The delimiter appended to every line, except the last;
  • show (optional)Set this to true in order to show the mapping key when no string value for it exists.


Examples

We have an array called foobar:

  • 0
    • bar
    • quz
  • 1
    • bar
    • bar
  • 2
    • bar
    • quz
  • 3
    • quux
Function Result
{{#camap: foobar | @@@ | What the @@@[0] is this @@@[1]<br/> }}

What the bar is this quz
What the bar is this bar
What the bar is this quz
What the quux is this

{{#camap: foobar | @@@ | What the @@@[0] is this @@@[1]<br/> | true }}

What the bar is this quz
What the bar is this bar
What the bar is this quz
What the quux is this @@@[1]

{{#camap: foobar | @@@ | What the @@@[0] is this @@@[1] | <br/> | true }}

What the bar is this quz
What the bar is this bar
What the bar is this quz
What the quux is this @@@[1]

complexarraymaptemplate

This parser function maps the contents of an array in a template.

Syntax
{{#complexarraymaptemplate:key|template}}
Explanation
  • key (required)The name of the array that needs to be mapped;
  • template (required)The name of the template the array must be mapped to.


Examples

We have an array called 'foobar', an array called 'boofar' and an array called 'bazbar', resp.:

foobar:

  • 0
    • foo: bar
    • baz: quz
  • 1
    • baz: bar
    • foo: bar
  • 2
    • foo: quz
    • baz: bar
    • bar
      • bex
      • box

boofar:

  • foobar
  • bazbar
  • boofar

bazbar:

  • foo: bar
  • boo: far
Function Result
{{#catemplate: foobar|Template}}
{{Template|foo=bar|baz=quz}}
{{Template|baz=bar|foo=bar}}
{{Template|foo=quz|baz=bar|bar=["bex","box"]}}
{{#catemplate: boofar|Template}}
{{Template|foobar|bazbar|boofar}}
{{#catemplate: bazbar|Template}}
{{Template|foo=bar|boo=far}}

Anonymous

These functions use anonymous arrays. The function handles both the definition and output of the array. You do not have to define an array beforehand.

complexarrayarraymap

This parser function is very similar to #complexarraymap, but the input and output is handled in the same function (which makes it anonymous).

Syntax
{{#complexarrayarraymap: value | delimiter | variable | formula | new_delimiter }}
Explanation
  • value (required)The value to be split;
  • delimiter (required)The delimiter to split value on;
  • variable (required)String to be replaced in 'formula';
  • formula (required)String where 'variable' is replaced;
  • new_delimiter (required)The delimiter between results.


Examples
Function Result
{{#caamap: a, b, c | , | @@ | Current variable: @@ | !<br/>}}
Current variable: a!<br/>
Current variable: b!<br/>
Current variable: c
{{#caamap: a; b; c | ; | ! | Just ! test | <br/>}}
Just a test<br/>
Just b test<br/>
Just c test

complexarrayparent

This function returns the key of the parent of the given key.

Syntax
{{#complexarrayparent: key }}
Explanation
  • key (required)The key from which the parent key should be returned


Examples
Function Result
{{#caparent: foobar[0][1][test] }}
foobar[0][1]


Wairudokado operator

The Wairudokado operator (Japanese: ワイルドカード, pronounced Wairudokādo, meaning wildcard; a tribute to the Scope Resolution Operator in PHP) is a powerful operator that gives users the ability to use wildcards when manipulating or printing subarrays.


Example

This operator can be used on every parser function that supports subarrays (such as #complexarrayprint).

Suppose we have the array foobar:

  • 0
    • name: Foo
  • 1
    • name: Bar
  • 2
    • name: Baz
  • 3
    • name: Bex

And we want to print every value of "name". We could use a #complexarraymap to iterate over the array and print each value seperately, but we can also use a Wairudokado operator in the #complexarrayprint function.

Function Result
{{#caprint: foobar[*][name]}}
  • Foo
  • Bar
  • Baz
  • Bex
When a Wairudokado operator is at the end of the pointer, it is ignored. Sequential Wairudokado operators are interpreted as one.


Semantic MediaWiki

This result printer requires Semantic MediaWiki 3.0 or higher.

This extension introduces a new format for displaying Semantic MediaWiki results. In order to use the new format, use format=complexarray. Because the result printer defines a new complexarray, you need to provide a name for that array using name=<name>; if name is left empty, the result printer will print the array as WSON.

Semantic variables

A list of semantic variables is included in the complexarray when you query a list of pages. The following variables are included:

catitle
The title of the page
cafullurl
The full URL of the page
canamespace
The namespace the page lives in
caexists
Whether or not the page exists (0/1)
cadisplaytitle
The displaytitle of the page

Additional parameters

WSArrays defines two new parameters:

name
The name of the array that is going to be created
simple
Option to hide Semantic variables from page results as well as hiding mailto: prefixes on email results (yes/no, default: yes)

Seeing tables instead of complex arrays

In case Semantic MediaWiki renders a table when format is complexarray, you must first check if you have set $wfEnableResultPrinter to true.

If this is the case and it still does not work, WSArrays might not have been able to create a symbolic link from the SemanticMediaWiki folder to the WSArrays folder. This link can be manually created by copying the file ComplexArrayPrinter.php from the extension's root folder to SemanticMediaWiki/src/Query/ResultPrinters.

Writing extensions

While WSArrays provides many functions for manipulating and showing arrays, sometimes these are not enough.

For this reason, we provide an interface to easily extend the functionality of WSArrays with new parser functions.

Extensions are placed in the extensions/ directory. Monikid lolombus popootus sabaagi kalas di naanu mantad Extension.php. Ngaran do fail id suang kalas diti maan powili'o, minog do kopiagal ngaran kalas (kiis-sensetif). pomitanan montok do kalas ExampleClass kosiliu do ExampleClass.php. Kalas diti nuru do popootus au koruri ko kaida sumusuhut.

<?php

class ExampleClass extends Extension {
    /**
     * Popoguli kawagu ngaran momomonguyad guguno diti.
     *
     * @return string
     */
    public function getName() {
        return 'exampleclass';
    }

    /**
     * Osonong daa do popogulu momomongulud kitonsi alias do momomonguyad guguno diti.
     *
     * @return array
     */
    public function getAliases() {
        return [
            'caexample',
            'caexampleclass'
        ];
    }

    /** 
     * Minag maan pogulio samaada ''sfh' toi ko' 'normal'. 
     * Soira 'shf' gumuli, setFunctionHook guguno lohowon miampai momomonguyad:: SFH_OBJECT_ARGS
     * sabaagi parameter, papasaga do interasi di taralom miamapi momomonguyad.
     *
     * @return string
     */
    public function getType() {
        return 'sfh';
    }

    /**
     * Kogunoon diti lohowon do kouyadan.
     *
     * @return mixed
     */
    public static function getResult( Parser $parser, $arg1, $arg2, ...) {
        return 'Foobar';
    }
}

?>

Popoguli do asil

getResult() minaan pootuso di hook momomoguno. Milo ko mambasa poingkuro monuat kouyadan guno hiti. Dokumentasi siriba nopo nga spesifik montok WSArrays.

Manipulasi kouludan

Koinsanai kouludan id WSArrays minog maan poopio' sabaagi objek ComplexArray. Nung manu ko momanipulasi kouludan di hato mantad, minog ko popoundalu objek ComplexArray kumaa kouludan, momanipulasi kouludan dii om poundolihon ndo kawagu kumaa objek ComplexArray.

public static function getResult( Parser $parser, $arg1, $arg2, $arg3 ) {
    // $arg1 kitonsi do ngaran kouludan di haro mantad;
    // getArray() popoguli kawagu kouludan.
    $array = WSArrays::$arrays[$arg1]->getArray();

    // Manipulasi kouludan...

    // Kouludan nopo nga poingopi suang do mogikakawo $arrays, poinwiliu id suang do kalas WSArrays.
    // Nung au ko popoopi kouludan sabaagi ComplexArray, momomonguyad di haro mantad au ndo kumaraja miampai kouludan diti.
    WSArrays::$arrays[$arg1] = new ComplexArray( $array );

    return null;
}

toi ko' soira mmomoguno SFH_OBJECT_ARGS:

public static function getResult( Parser $parser, $frame, $args ) {
    // Simbanai elemen di timpunon id kouludan $args suang do kakang.
    // Iduanai PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES nung manu ko popotolinahas montok koimpuunan banta kotolinahasan.
    // Milo ko nogi momoguno GlobalFunctions::getSFHValue() om GlobalFunctions::rawValue().
    if ( isset( $args[0] ) ) {
        $arg1 = trim( $frame->expand( $args[0], PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES ) );
    }

    // $arg1 kitonsi do ngaran kouludan di haro mantad.
    $array = WSArrays::$arrays[$arg1]->getArray();

    // Manipulasi kouludan...

    // Kouludan nopo nga poingopi suang do mogikakawo $arrays, poinwiliu id suang do kalas WSArrays.
    // Nung au ko popoopi kouludan sabaagi ComplexArray, momomonguyad di haro mantad au nda kumaraja miampai kouludan diti.
    WSArrays::$arrays[$arg1] = new ComplexArray($array);

    return null;
}

Dumafatar do lolombus

Maya goos do papasaga lolombus, minog ko do momoruhang ngaran lolombus om alisa kumaa WSArrays.i18n.php.

Ruhangai sumusuhut kumaa $magicWords['en']

'<extensionname>' => [ 0, '<extensionname>' ],
'<alias1>' => [ 0, '<alias1>' ],
'<alias2>' => [ 0, '<alias2>' ],
...


Momanipulasi momomonguyad

WSArrays momanipulasi Momomoguno id waya pointongkop. Sabaagi goos do momoguno kumaa di poinhali kopio, oponsol kopio do mangarati diti. Iti milo no mangaplai montok momomonguyad kiguno sumusuhut:

Poingkuro WSArrays momanipulasi momomonguyad

WSArrays popomanilpulasi ii momomonguyad maya pomogunaan SFH_OBJECT_ARGS. Maya diti, momomonguyad banta kolipantai sabagii PPNode objek om okon ko teks aiso. Iti papasaga pongungkayaan kihinta do guas kouyadan (intangai doc.wikimedia.org montok koilaan suai) Momoguno SFH_OBJECT_ARGS, milo tokou momoros do ii momomonguyad kumaa okon ko kouyadan elemen om gumuli id teks mantad noimput mantad di momomoguno, di milo ndo maan tokou uyado suang WSArrays.

Pongkuro manamong manipulasi

Sopisuai tulun sopisuai kabagalan, iti no sabab papasaga yahai dika do mongontrol om momanipulasi kouyadan dii. Kawagu, dokumentasi diti papaaplai do kouyadan guno di pintayad id sawat no.

Maya ladtak, koinsanai input automati do auyad mantad momomohuyad pogulu po katalib id WSArrays (suai ko mantad 'map' id #complexarraymap om #complexarrayprint.) Iti papasaga di do momoguno templat parameto di tosonong miaga boros magik om templat soira momanipulasi toi ko' papatantu kouludan. Iti nopo nga okon ko ndo nunu ii korohian nu kasari. For instance, when you want to use a very complex template inside of an array, and you don't want to completely break when you use #complexarrayprint on it, you can tell WSArrays to not parse the input. Nung momprint nu kouludan, tamplate di prinin sabaagi poinsompon miampai nowiki tag.

Poingkuro ndo nung maan ku uyado iri tamplat kawaagu?

Au pointongkop do popotolinahas tamplat nopo nga okon ko ahal di korohian nu. WSArrays sunudai i popotolinahas do momoguno kotolinahasan do elemen soira minog gunoon, miagal do soira momoguno do map toi ko' soira momprint tu kigatang.

Banta

Milo ko pohompit do banta diti sabaagi koma-pinopoinsuai katayadan id 'noparse'-hinonggo nopo guno parameto di milo gunoon.

Banta Asil
NO_IGNORE Pohompito' konstan PPFrame::NO_IGNORE id suang koburon dingkai.
NO_ARGS Pohompito' konstan PPFrame::NO_ARGS id suang koburon dingkai.
NO_TEMPLATES Kohompit do tatap PPFrame::NO_TEMPLATES id suang koburuan dingkai, di poposunud momongintalang do au popotolinahas templat.
NO_TAGS Kohompit do tatap PPFrame::NO_TAGS id suang koburuan dingkai, di poposunud momongintalang do au popotolinahas tag.

Momoguno WSArrays id lolombus suai

WSArrays popotounda do intofas mooi do osonong gunoon, manipulasi om momonosi kouludan mantad honggo nopo lolombus id wiki.

koimpuunan

Suang goos do momoguno intofas, kohompit do kalas ComplexArrayWrapper id suang lolombus nu, miagal.

include_once "/dir/to/ComplexArrayWrapper.php";

$interface = new ComplexArrayWrapper();

Manganu tonsi do kouludan

Tonsi kouludan "foobar" milo maan onuo kawagi miagal:

$array = $interface->on("foobar")->get();

Manganu tonsi do subkouludan

Tonsi foobar[Foo][Bar] milo maan onuo kawagu miagal:

$array = $interface->on("foobar")->in(["Foo", "Bar"])->get();

Simbanai tonsi kouludan

Tonsi kouludan "foobar" milo maan simbanai miagal:

$interface->on("foobar")->set(["foo", "bar" => ["baz", "bar"]]);

Tonsi di kigatang pointantu toi ko subkouludan milo maan simbanai miagal:

$interface->on("foobar")->in(["Foo", "Bar"])->set("Specific value");

// nung

$interface->on("foobar")->in(["Foo", "Bar"])->set(["sub", "array"]);
Nung kouludan toi ko subkouludan dii aiharo, sondii owonsoi wagu. Iti nga iso laang di hontolon do momonsoi kouludan wagu.

Au pointatap kouludan

Kouludan milo au maan tatapon miagal:

$interface->on("foobar")->unsetArray();

Installation

  • Download and place the file(s) in a directory called WSArrays in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'WSArrays' );
    
  • Configure as required.
  • Yes DoneNavigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

WSArrays has several configuration parameters.

$wfSkipVersionControl
Pilion do manalib kawo kontrol om sasagan papadakat do WSArrays, romito boolean (ladtak: false). Iti milo mamaraag wiki nu.
$wfEnableResultPrinter
Pilion do papasaga Semantic MediaWiki aasil printo, romito boolean (ladtak : false). Tatapo' diti kumaa true nung au koontok padakatan nu do aasil printo (intangai #Installation) kootus do au mamanau wiki nu.

Intangai po