Versions
in package
NacoWiki Versions
Tags
Table of Contents
Constants
Methods
- calcVersion() : string
- calculate specific version
- compareVers() : bool|null
- Compare versions
- diffStr() : string
- Create diff between two strings
- diffVers() : bool|null
- Diff versions
- getVersion() : bool|null
- get a specific version
- load() : void
- Loading entry point for this class
- navtools() : bool|null
- Add navigation tools
- patchStr() : string|null
- apply patches to string
- path() : path
- Return this plugin's path
- rawVersion() : bool|null
- This is the event handler that handles the `do:rawv` event.
- readVerData() : array<string|int, mixed>|null
- Read versioning data
- saveVerData() : bool
- Save versioning data
- viewVers() : bool|null
- View versions
Constants
FPREFIX
public
mixed
FPREFIX
= '/.ver;'
VERSION
var string
public
mixed
VERSION
= '0.0.0'
Methods
calcVersion()
calculate specific version
public
static calcVersion(NanoWikiApp $wiki, string $page, int $tvid) : string
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $page : string
- $tvid : int
Return values
string —calculated version
compareVers()
Compare versions
public
static compareVers(NanoWikiApp $wiki, array<string|int, mixed> &$ev) : bool|null
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $ev : array<string|int, mixed>
Tags
Return values
bool|nulldiffStr()
Create diff between two strings
public
static diffStr(string $a, string $b) : string
Will compare string $a and string $b line by line and create a patch string that can be used by patchStr to bring the $a to be like $b.
Parameters
- $a : string
-
source string to compare
- $b : string
-
dest string to compare
Return values
string —containing patch or NULL in case of error
diffVers()
Diff versions
public
static diffVers(NanoWikiApp $wiki, array<string|int, mixed> &$ev) : bool|null
Create a new file version before saving to file.
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $ev : array<string|int, mixed>
Tags
Return values
bool|nullgetVersion()
get a specific version
public
static getVersion(NanoWikiApp $wiki, array<string|int, mixed> &$ev) : bool|null
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $ev : array<string|int, mixed>
Tags
Return values
bool|nullload()
Loading entry point for this class
public
static load(array<string|int, mixed> $cfg) : void
Adds event hooks implemented by this class
Parameters
- $cfg : array<string|int, mixed>
navtools()
Add navigation tools
public
static navtools(NanoWikiApp $wiki, array<string|int, mixed> &$ev) : bool|null
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $ev : array<string|int, mixed>
Tags
Return values
bool|nullpatchStr()
apply patches to string
public
static patchStr(string $orig, string $diff) : string|null
Applies patches to a string so that you can recreate a file.
Parameters
- $orig : string
-
Original string that will be patched
- $diff : string
-
string contains patches to be applied
Return values
string|null —updated string or NULL in case of error.
path()
Return this plugin's path
public
static path([string $f = '' ]) : path
Parameters
- $f : string = ''
-
optional item
Return values
path —to filesystem for $f
rawVersion()
This is the event handler that handles the `do:rawv` event.
public
static rawVersion(NanoWikiApp $wiki, array<string|int, mixed> &$data) : bool|null
Will serve version without rendering i.e. raw source code.
Parameters
- $wiki : NanoWikiApp
-
current wiki instance
- $data : array<string|int, mixed>
-
ignored
Tags
Return values
bool|nullreadVerData()
Read versioning data
public
static readVerData(string $pgfile) : array<string|int, mixed>|null
Parameters
- $pgfile : string
-
File path to document. Usually
$wiki->filePath()
.
Return values
array<string|int, mixed>|null —NULL on Error, otherwise an array structure.
The returned array structure has the following components:
-
vfile
- name of the version file. -
vs
- version data (delta's or rewrites) -
root
- root entry. Delta's would start from this root.
saveVerData()
Save versioning data
public
static saveVerData(array<string|int, mixed> $vdata) : bool
Save versioning data to a file.
Parameters
- $vdata : array<string|int, mixed>
-
versioning data to save (same structure as returned by readVerData)
Return values
bool —True on success, False on failure
viewVers()
View versions
public
static viewVers(NanoWikiApp $wiki, array<string|int, mixed> &$ev) : bool|null
Parameters
- $wiki : NanoWikiApp
-
running wiki instance
- $ev : array<string|int, mixed>