Table des matières
traduction en cours
Environnement
Cette page devrait vous donner un bref aperçu des variables et constantes disponibles que vous pouvez utiliser dans le développement d'extensions: greffon ou thème.
Variables globales
$ACT
Maintient l'action en cours, voir Modes d'action. (référence)
$ACT
peut également être un tableau au lieu d'une chaîne de caractères, selon le moment où il est utilisé. Ainsi, si vous le comparez en utilisant une fonction de comparaison de chaînes de caractères (par exemple strcmp()
, strncmp()
), vous devez vous assurer qu'il ne s'agit pas d'un tableau utilisant !is_array($ACT)
. Sinon, le résultat risque d'être indéfini.
:! : Si vous gérez un événement ACTION_ACT_PREPROCESS, utilisez $event->data
au lieu de $ACT
.
$auth
L'objet $auth
disponible globalement représente une instance du connecteur d'authentication utilisé. (référence)
$conf
Le tableau $conf
, disponible globalement, contient tous les paramètres de configuration de DokuWiki. En général, il suit la structure suivante :
$conf[<setting_name>]
— paramètres DokuWiki (se référer à la configuration)$conf[<setting_group>][<setting_name>]
— Certains paramètres de DokuWiki utilisent ce format, par exemple les paramètres ftp, proxy et target.$conf['tpl'][<template_name>][<setting_name>]
— Paramètres de configuration du thème, voir la documentation du thème.$conf['plugin'][<plugin_name>][<setting_name>]
— Paramètres de configuration du greffon, voir la documentation du greffon.$conf['plugin'][<auth_plugin_name>][<setting_name>]
— Paramètres d'authentification du greffon, voir la documentation du greffon d'authentification.
Normalement, vous n'avez pas besoin d'accéder directement à ce tableau. Les deux, greffons et thèmes, ont leurs propres méthodes pour accéder à leurs paramètres de configuration respectifs.
$ID
Holds the pagename of the currently rendered page. This page is usually the currently viewed page, but not necessarily - see the $INFO['id']
below. (reference)
$INFO
This is an associative array, populated with information provided by inc/common.php
function pageinfo().
Current elements are:
id
— pagename of main page currently viewed. Usually the same as$ID
but might sometimes be different. See 1320 for some detail.rev
— revision of the main page currently viewed, usually the same as $REV.userinfo
— only set for a logged user, an associative array…pass
— password, encryptedname
— full namemail
— email addressgrps
— groups the user belongs to (Array )buid
— a special id constructed from details of the user's browser and IP address
perm
— the user's permissions related to the current page ($ID)subscribed
— true if the user has subscribed to this page, false otherwisenamespace
— the namespace the current page ($ID) belongs tolocked
— true if the page is locked, false otherwisefilepath
— the file system path to the raw wiki data for the current page ($ID+$REV)exists
— true if the raw wiki data for the current page exists ($ID+$REV), false otherwiserev
— the revision id for the current page ($ID), an empty string if the current revisionwritable
— true if for the current page ($ID+$REV) the combination of file existence, file permissions and the user's ACL permissions allow them to, write to an existing file or to create a nonexistent file. False otherwise.editable
— true if the current page ($ID+$REV) is writable and not currently locked.lastmod
— timestamp of the last modification to the current page ($ID+$REV)meta
— metadata for the current page ($ID)ip
— IP address of the last editor of the current page ($ID+$REV)user
— username of the last editor of the current page ($ID+$REV)sum
— edit summary annotation for the current page ($ID+$REV)editor
— user name (or IP address if user name is unknown) of the last editor of the current page ($ID+$REV)isadmin
— true if the currently logged in user is a superuserismanager
— true if the currently logged in user is a managerdraft
— contains the file name of a draft file if it exists for the current user and pageismobile
— true if the page is browsed from a mobile device or phoneclient
— name of a user currently logged in
On $INFO array is an example array dumped.
$lang
An associative array which hold all translation strings of the interface, plugins and templates. (reference)
$REV
Holds the revision timestamp of the currently rendered page. This is false
when the most current page is meant. (reference)
$_SERVER['REMOTE_USER']
This variable is explicitly set by DokuWiki's authentication mechanism when a user logs in and holds the users name.
$userid = $INPUT->server->str('REMOTE_USER');
$TEXT
On save
and preview
this global variable holds the text submitted via the edit form. (reference)
$TOC
This variable will, if populated, be used by tpl_toc() to build the TOC of a page. Normally this variable is empty and tpl_toc() builds the TOC from the page metadata. (reference)
$USERINFO
An globally available associative array which hold some information of a authenticated user.
- pass - hash of the users' password
- name - the users' full name
- mail - the users' mail address
- grps - array of groups the user is part of
(reference )
$JSINFO
This array contained information that is passed to the JavaScript as global variable.
Read more:
- Javascript devel docs: JSINFO
Constants
Here follows a list of the most important constants.
AUTH_<*>
The AUTH_<*>
type constants represent the permission levels, as integer value, used in DokuWiki's ACL system. They can be used to let ACL checks for a given page/namespace look a little bit more verbose.
if (auth_quickaclcheck($ID) >= AUTH_READ) { // do sth. }
AUTH_NONE
- Type: Integer
- Value: 0
AUTH_READ
- Type: Integer
- Value: 1
AUTH_EDIT
- Type: Integer
- Value: 2
AUTH_CREATE
- Type: Integer
- Value: 4
AUTH_UPLOAD
- Type: Integer
- Value: 8
AUTH_DELETE
- Type: Integer
- Value: 16
AUTH_ADMIN
- Type: Integer
- Value: 255
DOKU_<*>
The DOKU_<*>
type constants hold information about various system information for DokuWiki's internal use.
DOKU_BASE
The URL base of the DokuWiki install. (reference)
/dokuwiki/
Or if canonical is set:
http://domain.org/dokuwiki/
DOKU_REL
The URL base path to the DokuWiki install. (reference)
/dokuwiki/
DOKU_URL
The absolute URL to the DokuWiki install. (reference)
http://domain.org/dokuwiki/
DOKU_INC
The server side include path of the DokuWiki install. (reference)
/var/www/dokuwiki/
DOKU_CONF
The server side conf path of the DokuWiki install. (reference)
/var/www/dokuwiki/conf/
DOKU_TPL
The URL base path to the current used template. (reference)
/dokuwiki/lib/tpl/<template>/
Or if canonical is set:
http://domain.org/lib/tpl/<template>/
Note: this define is deprecated and should be replaced by call to tpl_basedir().
DOKU_TPLINC
The server side include path of the current used template. (reference)
/var/www/dokuwiki/lib/tpl/<template>/
Note: this define is deprecated and should be replaced by call to tpl_incdir().
DOKU_PLUGIN
The server side include path of the plugins install. (reference)
/var/www/dokuwiki/lib/plugins/
Request Variables
Since 2012-09-10 “Adora Belle”, request variables are accessible through the Input class. For further information please have a look at request_vars.