1*da933f89SLORTET# Pagesicon 2*da933f89SLORTET 3*da933f89SLORTETJ'aime beaucoup DokuWiki, mais je l'ai toujours trouvé un peu triste : il manquait une façon simple de mettre de belles icônes sur les pages. 4*da933f89SLORTETAvec **pagesicon**, c'est possible. 5*da933f89SLORTET 6*da933f89SLORTET`pagesicon` est à la fois : 7*da933f89SLORTET- un **plugin** (affichage et gestion des icônes), 8*da933f89SLORTET- un **helper** (API réutilisable par d'autres plugins, comme `catmenu` et `visualindex`). 9*da933f89SLORTET 10*da933f89SLORTET## Ce Que Fait Le Plugin 11*da933f89SLORTET 12*da933f89SLORTET- Affiche une icône en haut de la page (`show`), si activé. 13*da933f89SLORTET- Peut utiliser l'icône de la page comme favicon d'onglet (`show_as_favicon`). 14*da933f89SLORTET- Fournit une page de gestion d'icône par page : `?do=pagesicon`. 15*da933f89SLORTET- Gère les variantes `big` et `small`. 16*da933f89SLORTET- Notifie les autres plugins quand une icône change via `PLUGIN_PAGESICON_UPDATED`. 17*da933f89SLORTET 18*da933f89SLORTET## Paramètres De Configuration 19*da933f89SLORTET 20*da933f89SLORTETDans le `Configuration Manager` : 21*da933f89SLORTET 22*da933f89SLORTET- `icon_name` : noms candidats pour l'icône `big` (séparés par `;`). 23*da933f89SLORTET Supporte `~pagename~`. 24*da933f89SLORTET 25*da933f89SLORTET- `icon_thumbnail_name` : noms candidats pour l'icône `small` (séparés par `;`). 26*da933f89SLORTET Supporte `~pagename~`. 27*da933f89SLORTET 28*da933f89SLORTET- `icon_size` : taille (px) de l'icône affichée en haut de page. 29*da933f89SLORTET 30*da933f89SLORTET- `extensions` : extensions autorisées (séparées par `;`), par exemple `svg;png;jpg;jpeg`. 31*da933f89SLORTET 32*da933f89SLORTET- `show_on_top` : activer/désactiver l'affichage en haut de page. 33*da933f89SLORTET 34*da933f89SLORTET- `show_as_favicon` : utiliser l'icône de la page comme favicon. 35*da933f89SLORTET 36*da933f89SLORTET## Usage 37*da933f89SLORTET 38*da933f89SLORTETDepuis une page, utiliser l'action `Gérer l'icône` puis uploader/supprimer. 39*da933f89SLORTET 40*da933f89SLORTETLe plugin travaille sur la **page courante** (`$ID`), pas sur une cible passée en paramètre. 41*da933f89SLORTET 42*da933f89SLORTET## API Helper 43*da933f89SLORTET 44*da933f89SLORTETCharger le helper : 45*da933f89SLORTET 46*da933f89SLORTET```php 47*da933f89SLORTET$pagesicon = plugin_load('helper', 'pagesicon'); 48*da933f89SLORTET``` 49*da933f89SLORTET 50*da933f89SLORTET### Résolution En mediaID 51*da933f89SLORTET 52*da933f89SLORTET- `getPageImage(string $namespace, string $pageID, string $size = 'bigorsmall')` 53*da933f89SLORTET Retourne un mediaID (`ns:file.ext`) ou `false`. 54*da933f89SLORTET 55*da933f89SLORTET- `getMediaImage(string $mediaID, string $size = 'bigorsmall')` 56*da933f89SLORTET Retourne le mediaID d'icône pour un média, ou `false`. 57*da933f89SLORTET 58*da933f89SLORTET`size` accepte : `big`, `small`, `bigorsmall`, `smallorbig`. 59*da933f89SLORTET 60*da933f89SLORTET### Résolution En URL Versionnée 61*da933f89SLORTET 62*da933f89SLORTET- `getImageIcon(string $namespace, string $pageID, string $size = 'bigorsmall', array $params = ['width' => 55], ?int &$mtime = null)` 63*da933f89SLORTET Retourne une URL d'icône (avec `pi_ts=<filemtime>`) ou `false`. 64*da933f89SLORTET Renseigne aussi `$mtime`. 65*da933f89SLORTET 66*da933f89SLORTET- `getMediaIcon(string $mediaID, string $size = 'bigorsmall', array $params = ['width' => 55], ?int &$mtime = null)` 67*da933f89SLORTET Retourne une URL d'icône de média (avec `pi_ts=<filemtime>`) ou `false`. 68*da933f89SLORTET Renseigne aussi `$mtime`. 69*da933f89SLORTET 70*da933f89SLORTET### URLs De Gestion 71*da933f89SLORTET 72*da933f89SLORTET- `getUploadIconPage(string $targetPage = '')` 73*da933f89SLORTET Retourne l'URL `?do=pagesicon` d'une page, ou `null` si non autorisé. 74*da933f89SLORTET 75*da933f89SLORTET- `getUploadMediaIconPage(string $mediaID = '')` 76*da933f89SLORTET Retourne l'URL de gestion d'icône associée à un média. 77*da933f89SLORTET 78*da933f89SLORTET### Notification 79*da933f89SLORTET 80*da933f89SLORTET- `notifyIconUpdated(string $targetPage, string $action = 'update', string $mediaID = '')` 81*da933f89SLORTET 82*da933f89SLORTETEffets : 83*da933f89SLORTET- met à jour `purgefile`, 84*da933f89SLORTET- déclenche l'événement `PLUGIN_PAGESICON_UPDATED`. 85*da933f89SLORTET 86*da933f89SLORTETPayload : 87*da933f89SLORTET- `target_page`, 88*da933f89SLORTET- `action`, 89*da933f89SLORTET- `media_id`. 90*da933f89SLORTET 91*da933f89SLORTETChaque plugin consommateur est responsable de sa propre invalidation de cache. 92