mirror of
https://github.com/friendica/friendica
synced 2024-12-23 06:00:15 +00:00
Add new put_item_in_cache hook in include/text
This commit is contained in:
parent
d7dc1f6d27
commit
a6eae9adec
3 changed files with 28 additions and 13 deletions
|
@ -357,6 +357,13 @@ Hook data:
|
|||
'item' => item array (input)
|
||||
'html' => converted item body (input/output)
|
||||
|
||||
### 'put_item_in_cache'
|
||||
Called after prepare_text in put_item_in_cache().
|
||||
Hook data:
|
||||
'item' => item array (input)
|
||||
'rendered-html' => final item body HTML (input/output)
|
||||
'rendered-hash' => original item body hash (input/output)
|
||||
|
||||
### 'magic_auth_success'
|
||||
Called when a magic-auth was successful.
|
||||
Hook data:
|
||||
|
@ -417,6 +424,7 @@ Here is a complete list of all hook callbacks with file locations (as of 01-Apr-
|
|||
|
||||
Addon::callHooks('contact_block_end', $arr);
|
||||
Addon::callHooks('poke_verbs', $arr);
|
||||
Addon::callHooks('put_item_in_cache', $hook_data);
|
||||
Addon::callHooks('prepare_body_init', $item);
|
||||
Addon::callHooks('prepare_body_content_filter', $hook_data);
|
||||
Addon::callHooks('prepare_body', $hook_data);
|
||||
|
|
|
@ -234,6 +234,7 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
|
|||
|
||||
Addon::callHooks('contact_block_end', $arr);
|
||||
Addon::callHooks('poke_verbs', $arr);
|
||||
Addon::callHooks('put_item_in_cache', $hook_data);
|
||||
Addon::callHooks('prepare_body_init', $item);
|
||||
Addon::callHooks('prepare_body_content_filter', $hook_data);
|
||||
Addon::callHooks('prepare_body', $hook_data);
|
||||
|
|
|
@ -1173,6 +1173,12 @@ function put_item_in_cache(&$item, $update = false)
|
|||
$item["rendered-html"] = prepare_text($item["body"]);
|
||||
$item["rendered-hash"] = hash("md5", $item["body"]);
|
||||
|
||||
$hook_data = ['item' => $item, 'rendered-html' => $item['rendered-html'], 'rendered-hash' => $item['rendered-hash']];
|
||||
Addon::callHooks('put_item_in_cache', $hook_data);
|
||||
$item['rendered-html'] = $hook_data['rendered-html'];
|
||||
$item['rendered-hash'] = $hook_data['rendered-hash'];
|
||||
unset($hook_data);
|
||||
|
||||
// Force an update if the generated values differ from the existing ones
|
||||
if ($rendered_hash != $item["rendered-hash"]) {
|
||||
$update = true;
|
||||
|
|
Loading…
Reference in a new issue