aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Dent <dentm42@gmail.com>2018-09-29 20:22:27 +0200
committerM. Dent <dentm42@gmail.com>2018-09-29 20:22:27 +0200
commitff20370d0bd8c08942c062ab105bc839969a3902 (patch)
tree9b0f7404da31898da98d295f0686c252050f763c
parentcc9ca8bbffaceb7273b4999e538a3d211ae3cf09 (diff)
downloadvolse-hubzilla-ff20370d0bd8c08942c062ab105bc839969a3902.tar.gz
volse-hubzilla-ff20370d0bd8c08942c062ab105bc839969a3902.tar.bz2
volse-hubzilla-ff20370d0bd8c08942c062ab105bc839969a3902.zip
Status editor hook
-rw-r--r--Zotlabs/Module/Article_edit.php2
-rw-r--r--Zotlabs/Module/Articles.php2
-rw-r--r--Zotlabs/Module/Blocks.php2
-rw-r--r--Zotlabs/Module/Card_edit.php2
-rw-r--r--Zotlabs/Module/Cards.php2
-rw-r--r--Zotlabs/Module/Channel.php2
-rw-r--r--Zotlabs/Module/Display.php2
-rw-r--r--Zotlabs/Module/Editblock.php2
-rw-r--r--Zotlabs/Module/Editlayout.php2
-rw-r--r--Zotlabs/Module/Editpost.php2
-rw-r--r--Zotlabs/Module/Editwebpage.php2
-rw-r--r--Zotlabs/Module/Hq.php2
-rw-r--r--Zotlabs/Module/Layouts.php2
-rw-r--r--Zotlabs/Module/Network.php2
-rw-r--r--Zotlabs/Module/Pubstream.php2
-rw-r--r--Zotlabs/Module/Rpost.php2
-rw-r--r--Zotlabs/Module/Webpages.php2
-rw-r--r--doc/hook/status_editor.bb31
-rw-r--r--doc/hooklist.bb3
-rw-r--r--include/conversation.php16
20 files changed, 66 insertions, 18 deletions
diff --git a/Zotlabs/Module/Article_edit.php b/Zotlabs/Module/Article_edit.php
index 89abccc40..d3cce343f 100644
--- a/Zotlabs/Module/Article_edit.php
+++ b/Zotlabs/Module/Article_edit.php
@@ -122,7 +122,7 @@ class Article_edit extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
- $editor = status_editor($a, $x);
+ $editor = status_editor($a, $x, false, 'Article_edit');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Article'),
diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php
index ad4d67c4e..58c16be45 100644
--- a/Zotlabs/Module/Articles.php
+++ b/Zotlabs/Module/Articles.php
@@ -132,7 +132,7 @@ class Articles extends Controller {
$x['title'] = $_REQUEST['title'];
if($_REQUEST['body'])
$x['body'] = $_REQUEST['body'];
- $editor = status_editor($a,$x);
+ $editor = status_editor($a,$x,false,'Articles');
}
else {
diff --git a/Zotlabs/Module/Blocks.php b/Zotlabs/Module/Blocks.php
index e6a97794d..fde30a6dd 100644
--- a/Zotlabs/Module/Blocks.php
+++ b/Zotlabs/Module/Blocks.php
@@ -109,7 +109,7 @@ class Blocks extends \Zotlabs\Web\Controller {
if($_REQUEST['pagetitle'])
$x['pagetitle'] = $_REQUEST['pagetitle'];
- $editor = status_editor($a,$x);
+ $editor = status_editor($a,$x,false,'Blocks');
$r = q("select iconfig.iid, iconfig.k, iconfig.v, mid, title, body, mimetype, created, edited from iconfig
diff --git a/Zotlabs/Module/Card_edit.php b/Zotlabs/Module/Card_edit.php
index 694bdc4ea..e01e70fdb 100644
--- a/Zotlabs/Module/Card_edit.php
+++ b/Zotlabs/Module/Card_edit.php
@@ -122,7 +122,7 @@ class Card_edit extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
- $editor = status_editor($a, $x);
+ $editor = status_editor($a, $x, false, 'Card_edit');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Card'),
diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php
index 3656860a5..b66de158b 100644
--- a/Zotlabs/Module/Cards.php
+++ b/Zotlabs/Module/Cards.php
@@ -133,7 +133,7 @@ class Cards extends Controller {
if($_REQUEST['body'])
$x['body'] = $_REQUEST['body'];
- $editor = status_editor($a, $x);
+ $editor = status_editor($a, $x, false, 'Cards');
}
else {
$editor = '';
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 74fdc1cb4..8b2e35709 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -168,7 +168,7 @@ class Channel extends Controller {
'reset' => t('Reset form')
);
- $o .= status_editor($a,$x);
+ $o .= status_editor($a,$x,false,'Channel');
}
}
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 1d21b64ac..8b46ebb79 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -81,7 +81,7 @@ class Display extends \Zotlabs\Web\Controller {
);
$o = '<div id="jot-popup">';
- $o .= status_editor($a,$x);
+ $o .= status_editor($a,$x,false,'Display');
$o .= '</div>';
}
diff --git a/Zotlabs/Module/Editblock.php b/Zotlabs/Module/Editblock.php
index 563ad9ca2..c031f32a1 100644
--- a/Zotlabs/Module/Editblock.php
+++ b/Zotlabs/Module/Editblock.php
@@ -132,7 +132,7 @@ class Editblock extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
- $editor = status_editor($a, $x);
+ $editor = status_editor($a, $x, false, 'Editblock');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Block'),
diff --git a/Zotlabs/Module/Editlayout.php b/Zotlabs/Module/Editlayout.php
index 67e0bcd32..50096f1a1 100644
--- a/Zotlabs/Module/Editlayout.php
+++ b/Zotlabs/Module/Editlayout.php
@@ -131,7 +131,7 @@ class Editlayout extends \Zotlabs\Web\Controller {
'profile_uid' => intval($owner),
);
- $editor = status_editor($a, $x);
+ $editor = status_editor($a, $x, false, 'Editlayout');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Layout'),
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index 45d8e7644..1c9068e07 100644
--- a/Zotlabs/Module/Editpost.php
+++ b/Zotlabs/Module/Editpost.php
@@ -102,7 +102,7 @@ class Editpost extends \Zotlabs\Web\Controller {
'bbcode' => true
);
- $editor = status_editor($a, $x);
+ $editor = status_editor($a, $x, false, 'Editpost');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'),
diff --git a/Zotlabs/Module/Editwebpage.php b/Zotlabs/Module/Editwebpage.php
index b67421cd5..785eeb4ec 100644
--- a/Zotlabs/Module/Editwebpage.php
+++ b/Zotlabs/Module/Editwebpage.php
@@ -160,7 +160,7 @@ class Editwebpage extends \Zotlabs\Web\Controller {
'bbcode' => (($mimetype == 'text/bbcode') ? true : false)
);
- $editor = status_editor($a, $x);
+ $editor = status_editor($a, $x, false, 'Editwebpage');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit Webpage'),
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index fee4246c0..3535ac71a 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -138,7 +138,7 @@ class Hq extends \Zotlabs\Web\Controller {
[
'$no_messages' => (($target_item) ? false : true),
'$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen posts...') ],
- '$editor' => status_editor($a,$x)
+ '$editor' => status_editor($a,$x,false,'Hq')
]
);
diff --git a/Zotlabs/Module/Layouts.php b/Zotlabs/Module/Layouts.php
index 19efb37fd..25e27d226 100644
--- a/Zotlabs/Module/Layouts.php
+++ b/Zotlabs/Module/Layouts.php
@@ -141,7 +141,7 @@ class Layouts extends \Zotlabs\Web\Controller {
if($_REQUEST['pagetitle'])
$x['pagetitle'] = $_REQUEST['pagetitle'];
- $editor = status_editor($a,$x);
+ $editor = status_editor($a,$x,false,'Layouts');
$r = q("select iconfig.iid, iconfig.v, mid, title, body, mimetype, created, edited, item_type from iconfig
left join item on iconfig.iid = item.id
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 21507752d..919996943 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -196,7 +196,7 @@ class Network extends \Zotlabs\Web\Controller {
$x['pretext'] = $deftag;
- $status_editor = status_editor($a,$x);
+ $status_editor = status_editor($a,$x,false,'Network');
$o .= $status_editor;
$static = channel_manual_conv_update(local_channel());
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 7b80a3978..19cb72b5b 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -81,7 +81,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
);
$o = '<div id="jot-popup">';
- $o .= status_editor($a,$x);
+ $o .= status_editor($a,$x,false,'Pubstream');
$o .= '</div>';
}
diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php
index 86ee296ec..f03dae2bf 100644
--- a/Zotlabs/Module/Rpost.php
+++ b/Zotlabs/Module/Rpost.php
@@ -138,7 +138,7 @@ class Rpost extends \Zotlabs\Web\Controller {
'jotnets' => true
);
- $editor = status_editor($a,$x);
+ $editor = status_editor($a,$x,false,'Rpost');
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
'$title' => t('Edit post'),
diff --git a/Zotlabs/Module/Webpages.php b/Zotlabs/Module/Webpages.php
index c9b2264bf..787ed5850 100644
--- a/Zotlabs/Module/Webpages.php
+++ b/Zotlabs/Module/Webpages.php
@@ -208,7 +208,7 @@ class Webpages extends Controller {
if(! $r)
$x['pagetitle'] = 'home';
- $editor = status_editor($a,$x);
+ $editor = status_editor($a,$x,false,'Webpages');
$pages = null;
diff --git a/doc/hook/status_editor.bb b/doc/hook/status_editor.bb
new file mode 100644
index 000000000..00e97a7c9
--- /dev/null
+++ b/doc/hook/status_editor.bb
@@ -0,0 +1,31 @@
+[h2]status_editor[/h2]
+
+Replace the default status_editor (jot).
+
+Allow plugins to replace the default status editor in a context dependent manner.
+
+It is fed an array of ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module].
+
+All calls to the status_editor at the time of the creation of this hook have been updated
+to set $module at invocation. This allows addon developers to have a context dependent editor
+based on the Hubzilla module/addon.
+
+Calls to status_editor() are in the form of:
+ status_editor($a, $x, $popup, $module).
+
+Future module/addon developers are encouraged to set $popup and $module when invoking the
+status_editor.
+
+
+[code]
+ $hook_info = ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module];
+ call_hooks('status_editor',$hook_info);
+ if ($hook_info['editor_html'] == '') {
+ return hz_status_editor($a, $x, $popup);
+ } else {
+ return $hook_info['editor_html'];
+ }
+
+[/code]
+
+see: include/conversation.php
diff --git a/doc/hooklist.bb b/doc/hooklist.bb
index b71a28e63..aab4aff33 100644
--- a/doc/hooklist.bb
+++ b/doc/hooklist.bb
@@ -595,6 +595,9 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/smilie]smilie[/zrl]
Called when translating emoticons
+[zrl=[baseurl]/help/hook/status_editor]status_editor[/zrl]
+ Called when generating the status_editor.
+
[zrl=[baseurl]/help/hook/stream_item]stream_item[/zrl]
Called for each item which is rendered for viewing via conversation()
diff --git a/include/conversation.php b/include/conversation.php
index dc3f45e45..c8a3f1824 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -1232,13 +1232,27 @@ function format_like($cnt, $arr, $type, $id) {
return $o;
}
+
+/**
+ * Wrapper to allow addons to replace the status editor if desired.
+ */
+function status_editor($a, $x, $popup = false, $module='') {
+ $hook_info = ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module];
+ call_hooks('status_editor',$hook_info);
+ if ($hook_info['editor_html'] == '') {
+ return hz_status_editor($a, $x, $popup);
+ } else {
+ return $hook_info['editor_html'];
+ }
+}
+
/**
* This is our general purpose content editor.
* It was once nicknamed "jot" and you may see references to "jot" littered throughout the code.
* They are referring to the content editor or components thereof.
*/
-function status_editor($a, $x, $popup = false) {
+function hz_status_editor($a, $x, $popup = false) {
$o = '';