You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Show explicit ExtensionRegistry setup instead of claiming auto-registration
- Document generate_canonical_url requires XOOPS_URL (no HTTP_HOST fallback)
- Fix xo_module_url example to show full URL when XOOPS_URL is set
- Add base64_encode_file section with web-root restriction note
- Add HTML-output warnings for nl2p, highlight_text, linkify, breadcrumbs,
pagination, and render_alert (avoid double-escaping)
- Add defensive <{if}> patterns for functions that return empty: parse_url,
canonical URL, embed_pdf, session data, avatar
- Rewrite hashing section: checksums only, not passwords; drop md5 example
- Add xo_render_block example with block interface note
If XOOPS Core performs this registration in its bootstrap, all plugins will be available in every `.tpl` template without any additional setup in your module code.
51
+
52
+
### Plugin types
23
53
24
54
There are three types of Smarty plugins:
25
55
@@ -64,7 +94,9 @@ Use `truncate_words` to limit by word count:
64
94
65
95
### Converting newlines to paragraphs
66
96
67
-
The `nl2p` modifier converts double newlines into `<p>` tags and single newlines into `<br>`:
97
+
The `nl2p` modifier converts double newlines into `<p>` tags and single newlines into `<br>`.
98
+
99
+
> **HTML output warning**: `nl2p` returns raw HTML markup. The input is not escaped, so pass only trusted or pre-sanitized content. Do not apply `|escape` after `nl2p` or the tags will be visible as text.
68
100
69
101
```smarty
70
102
<{$userBio|nl2p}>
@@ -75,6 +107,8 @@ Output: `<p>First paragraph.</p><p>Second paragraph.<br>With a line break.</p>`
75
107
76
108
### Highlighting search terms
77
109
110
+
> **HTML output warning**: `highlight_text` wraps matches in `<span>` tags and returns raw HTML. Ensure the source text is already escaped or trusted. Do not apply `|escape` after this modifier.
Builds a full URL by prepending `XOOPS_URL`. Returns an empty string if `XOOPS_URL` is not defined (it will not fall back to `HTTP_HOST` to prevent host-header poisoning). Always check the result before using it:
@@ -263,6 +299,8 @@ Works with `youtube.com/watch?v=`, `youtu.be/`, `youtube.com/embed/`, and `youtu
263
299
264
300
### Making URLs clickable
265
301
302
+
> **HTML output warning**: `linkify` returns raw HTML with `<a>` tags. The surrounding text is not escaped. Pass only trusted or pre-sanitized content to avoid XSS. Do not apply `|escape` after this modifier.
> **HTML output note**: `render_breadcrumbs`, `render_pagination`, and `render_alert` all return Bootstrap 5 HTML markup. Do not apply `|escape` to their output. Their parameters are escaped internally.
349
+
306
350
Renders Bootstrap 5 breadcrumb navigation:
307
351
308
352
```smarty
@@ -390,6 +434,19 @@ Also works with JSON strings (decodes, then re-encodes with formatting).
390
434
<{$htmlContent|strip_html_comments}>
391
435
```
392
436
437
+
### Base64-encoding files
438
+
439
+
Encode a file as a base64 string, for example to inline images in emails or data URIs. For security, this function only reads files under `XOOPS_ROOT_PATH` (or `DOCUMENT_ROOT` outside XOOPS). If neither is set, the function returns an empty string.
@@ -686,6 +765,19 @@ Only renders when XOOPS debug mode is active:
686
765
687
766
Renders as an expandable `<details>` element with a `<pre>` dump.
688
767
768
+
### Rendering blocks
769
+
770
+
Renders a XOOPS block from its options array. This is primarily used by theme templates and the block system; most module developers will not call it directly.
0 commit comments