aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2018-10-11 11:42:00 +0200
committerMario <mario@mariovavti.com>2018-10-11 11:42:00 +0200
commit4756826054fa26b08361437add194b2f97285eb1 (patch)
treeb67b715b56b47429e8e969ff7358fdbee1d644f4
parentea309aa19e454a47762fef942fecaeb16b458dff (diff)
parentbad4ea6e65a45ac2523a9a7c2ec624ad2535b652 (diff)
downloadvolse-hubzilla-4756826054fa26b08361437add194b2f97285eb1.tar.gz
volse-hubzilla-4756826054fa26b08361437add194b2f97285eb1.tar.bz2
volse-hubzilla-4756826054fa26b08361437add194b2f97285eb1.zip
Merge branch 'dev' into 'dev'
Add wiki_preprocess hook and documentation See merge request hubzilla/core!1326
-rw-r--r--Zotlabs/Lib/NativeWikiPage.php2
-rw-r--r--Zotlabs/Module/Wiki.php4
-rw-r--r--doc/hook/wiki_preprocess.bb11
-rw-r--r--doc/hooklist.bb3
4 files changed, 19 insertions, 1 deletions
diff --git a/Zotlabs/Lib/NativeWikiPage.php b/Zotlabs/Lib/NativeWikiPage.php
index 8d21fac5e..dddd26af3 100644
--- a/Zotlabs/Lib/NativeWikiPage.php
+++ b/Zotlabs/Lib/NativeWikiPage.php
@@ -619,7 +619,7 @@ class NativeWikiPage {
$s = str_replace('[observer.webname]', '', $s);
$s = str_replace('[observer.photo]', '', $s);
}
-
+
return $s;
}
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 25823da62..05d6e85cd 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -331,6 +331,10 @@ class Wiki extends Controller {
$sampleContent = t('New page');
$content = (($p['content'] == '') ? $sampleContent : $p['content']);
+
+ $hookinfo = ['content' => $content, 'mimetype' => $mimeType];
+ call_hooks('wiki_preprocess',$hookinfo);
+ $content = $hookinfo['content'];
// Render the Markdown-formatted page content in HTML
if($mimeType == 'text/bbcode') {
diff --git a/doc/hook/wiki_preprocess.bb b/doc/hook/wiki_preprocess.bb
new file mode 100644
index 000000000..913b601ba
--- /dev/null
+++ b/doc/hook/wiki_preprocess.bb
@@ -0,0 +1,11 @@
+[h3]wiki_preprocess[/h3]
+
+Called before markdown/bbcode processors are run for wiki pages
+
+Passed parameter array:
+
+ 'content' => wiki page content
+ 'mimetype' => page mimetype
+
+
+see: Zotlabs/Module/Wiki.php
diff --git a/doc/hooklist.bb b/doc/hooklist.bb
index d493e4feb..d104df380 100644
--- a/doc/hooklist.bb
+++ b/doc/hooklist.bb
@@ -625,6 +625,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/well_known]well_known[/zrl]
Called when accessing the '.well-known' special site addresses
+[zrl=[baseurl]/help/hook/wiki_preprocess]wiki_preprocess[/zrl]
+ Called before markdown/bbcode processors are run for wiki pages
+
[zrl=[baseurl]/help/hook/zot_best_algorithm]zot_best_algorithm[/zrl]
Called when negotiating crypto algorithms with remote sites