1*da933f89SLORTET# Pagesicon 2*da933f89SLORTET 3*da933f89SLORTETI really like DokuWiki, but I always found it a bit sad: there was no simple way to add nice icons to pages. 4*da933f89SLORTETWith **pagesicon**, this is now possible. 5*da933f89SLORTET 6*da933f89SLORTET`pagesicon` is both: 7*da933f89SLORTET- a **plugin** (icon display and management), 8*da933f89SLORTET- a **helper** (reusable API for other plugins like `catmenu` and `visualindex`). 9*da933f89SLORTET 10*da933f89SLORTET## What The Plugin Does 11*da933f89SLORTET 12*da933f89SLORTET- Displays an icon at the top of the page (`show`), when enabled. 13*da933f89SLORTET- Can use the page icon as browser tab favicon (`show_as_favicon`). 14*da933f89SLORTET- Provides a per-page icon management page: `?do=pagesicon`. 15*da933f89SLORTET- Supports `big` and `small` icon variants. 16*da933f89SLORTET- Notifies other plugins when an icon changes through `PLUGIN_PAGESICON_UPDATED`. 17*da933f89SLORTET 18*da933f89SLORTET## Configuration 19*da933f89SLORTET 20*da933f89SLORTETIn the `Configuration Manager`: 21*da933f89SLORTET 22*da933f89SLORTET- `icon_name`: candidate names for the `big` icon (separated by `;`). 23*da933f89SLORTET Supports `~pagename~`. 24*da933f89SLORTET 25*da933f89SLORTET- `icon_thumbnail_name`: candidate names for the `small` icon (separated by `;`). 26*da933f89SLORTET Supports `~pagename~`. 27*da933f89SLORTET 28*da933f89SLORTET- `icon_size`: size (px) of the icon shown at the top of pages. 29*da933f89SLORTET 30*da933f89SLORTET- `extensions`: allowed file extensions (separated by `;`), for example `svg;png;jpg;jpeg`. 31*da933f89SLORTET 32*da933f89SLORTET- `show_on_top`: enable/disable icon display at the top of pages. 33*da933f89SLORTET 34*da933f89SLORTET- `show_as_favicon`: use the page icon as favicon. 35*da933f89SLORTET 36*da933f89SLORTET## Usage 37*da933f89SLORTET 38*da933f89SLORTETFrom a page, use the `Gérer l'icône` action, then upload/delete. 39*da933f89SLORTET 40*da933f89SLORTETThe plugin works on the **current page** (`$ID`), not on an external target parameter. 41*da933f89SLORTET 42*da933f89SLORTET## Helper API 43*da933f89SLORTET 44*da933f89SLORTETLoad helper: 45*da933f89SLORTET 46*da933f89SLORTET```php 47*da933f89SLORTET$pagesicon = plugin_load('helper', 'pagesicon'); 48*da933f89SLORTET``` 49*da933f89SLORTET 50*da933f89SLORTET### mediaID Resolution 51*da933f89SLORTET 52*da933f89SLORTET- `getPageImage(string $namespace, string $pageID, string $size = 'bigorsmall')` 53*da933f89SLORTET Returns a mediaID (`ns:file.ext`) or `false`. 54*da933f89SLORTET 55*da933f89SLORTET- `getMediaImage(string $mediaID, string $size = 'bigorsmall')` 56*da933f89SLORTET Returns the icon mediaID for a media item, or `false`. 57*da933f89SLORTET 58*da933f89SLORTET`size` supports: `big`, `small`, `bigorsmall`, `smallorbig`. 59*da933f89SLORTET 60*da933f89SLORTET### Versioned URL Resolution 61*da933f89SLORTET 62*da933f89SLORTET- `getImageIcon(string $namespace, string $pageID, string $size = 'bigorsmall', array $params = ['width' => 55], ?int &$mtime = null)` 63*da933f89SLORTET Returns an icon URL (with `pi_ts=<filemtime>`) or `false`. 64*da933f89SLORTET Also fills `$mtime`. 65*da933f89SLORTET 66*da933f89SLORTET- `getMediaIcon(string $mediaID, string $size = 'bigorsmall', array $params = ['width' => 55], ?int &$mtime = null)` 67*da933f89SLORTET Returns a media icon URL (with `pi_ts=<filemtime>`) or `false`. 68*da933f89SLORTET Also fills `$mtime`. 69*da933f89SLORTET 70*da933f89SLORTET### Management URLs 71*da933f89SLORTET 72*da933f89SLORTET- `getUploadIconPage(string $targetPage = '')` 73*da933f89SLORTET Returns the page URL with `?do=pagesicon`, or `null` when not authorized. 74*da933f89SLORTET 75*da933f89SLORTET- `getUploadMediaIconPage(string $mediaID = '')` 76*da933f89SLORTET Returns the icon management URL associated with a media item. 77*da933f89SLORTET 78*da933f89SLORTET### Notification 79*da933f89SLORTET 80*da933f89SLORTET- `notifyIconUpdated(string $targetPage, string $action = 'update', string $mediaID = '')` 81*da933f89SLORTET 82*da933f89SLORTETEffects: 83*da933f89SLORTET- updates `purgefile`, 84*da933f89SLORTET- triggers `PLUGIN_PAGESICON_UPDATED`. 85*da933f89SLORTET 86*da933f89SLORTETPayload: 87*da933f89SLORTET- `target_page`, 88*da933f89SLORTET- `action`, 89*da933f89SLORTET- `media_id`. 90*da933f89SLORTET 91*da933f89SLORTETEach consumer plugin remains responsible for its own cache invalidation strategy. 92