Update Addon functions and calls
Update function names and calls for Addon class.
This commit is contained in:
parent
213f6ae1a1
commit
11cf36105c
73 changed files with 544 additions and 464 deletions
|
@ -5,6 +5,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Widget;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Model\Contact;
|
||||
|
@ -32,7 +33,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
|
|||
|
||||
// e.g. 'network_pre_group_deny', 'profile_pre_group_allow'
|
||||
|
||||
call_hooks($a->module . '_pre_' . $selname, $arr);
|
||||
Addon::callHooks($a->module . '_pre_' . $selname, $arr);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $rr) {
|
||||
|
@ -50,7 +51,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
|
|||
}
|
||||
$o .= "</select>\r\n";
|
||||
|
||||
call_hooks($a->module . '_post_' . $selname, $o);
|
||||
Addon::callHooks($a->module . '_post_' . $selname, $o);
|
||||
|
||||
|
||||
return $o;
|
||||
|
@ -111,7 +112,7 @@ function contact_selector($selname, $selclass, $options, $preselected = false)
|
|||
|
||||
$x = ['options' => $options, 'size' => $size, 'single' => $single, 'mutual' => $mutual, 'exclude' => $exclude, 'networks' => $networks];
|
||||
|
||||
call_hooks('contact_select_options', $x);
|
||||
Addon::callHooks('contact_select_options', $x);
|
||||
|
||||
$o = '';
|
||||
|
||||
|
@ -154,7 +155,7 @@ function contact_selector($selname, $selclass, $options, $preselected = false)
|
|||
|
||||
// e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
|
||||
|
||||
call_hooks($a->module . '_pre_' . $selname, $arr);
|
||||
Addon::callHooks($a->module . '_pre_' . $selname, $arr);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
foreach ($r as $rr) {
|
||||
|
@ -173,7 +174,7 @@ function contact_selector($selname, $selclass, $options, $preselected = false)
|
|||
|
||||
$o .= "</select>\r\n";
|
||||
|
||||
call_hooks($a->module . '_post_' . $selname, $o);
|
||||
Addon::callHooks($a->module . '_post_' . $selname, $o);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
@ -232,7 +233,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
|||
|
||||
// e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
|
||||
|
||||
call_hooks($a->module . '_pre_' . $selname, $arr);
|
||||
Addon::callHooks($a->module . '_pre_' . $selname, $arr);
|
||||
|
||||
$receiverlist = [];
|
||||
|
||||
|
@ -263,7 +264,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
|||
$o .= implode(", ", $receiverlist);
|
||||
}
|
||||
|
||||
call_hooks($a->module . '_post_' . $selname, $o);
|
||||
Addon::callHooks($a->module . '_post_' . $selname, $o);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
@ -353,7 +354,7 @@ function populate_acl($user = null, $show_jotnets = false) {
|
|||
$jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> ' . t("Post to Email") . '</div>';
|
||||
}
|
||||
|
||||
call_hooks('jot_networks', $jotnets);
|
||||
Addon::callHooks('jot_networks', $jotnets);
|
||||
} else {
|
||||
$jotnets .= sprintf(t('Connectors disabled, since "%s" is enabled.'),
|
||||
t('Hide your profile details from unknown viewers?'));
|
||||
|
@ -671,7 +672,7 @@ function acl_lookup(App $a, $out_type = 'json')
|
|||
'search' => $search,
|
||||
];
|
||||
|
||||
call_hooks('acl_lookup_end', $results);
|
||||
Addon::callHooks('acl_lookup_end', $results);
|
||||
|
||||
if ($out_type === 'html') {
|
||||
$o = [
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\NotificationsManager;
|
||||
|
@ -166,7 +167,7 @@ function api_login(App $a)
|
|||
list($consumer, $token) = $oauth1->verify_request(OAuthRequest::from_request());
|
||||
if (!is_null($token)) {
|
||||
$oauth1->loginUser($token->uid);
|
||||
call_hooks('logged_in', $a->user);
|
||||
Addon::callHooks('logged_in', $a->user);
|
||||
return;
|
||||
}
|
||||
echo __FILE__.__LINE__.__FUNCTION__ . "<pre>";
|
||||
|
@ -216,7 +217,7 @@ function api_login(App $a)
|
|||
* Plugins should never set 'authenticated' except to indicate success - as hooks may be chained
|
||||
* and later plugins should not interfere with an earlier one that succeeded.
|
||||
*/
|
||||
call_hooks('authenticate', $addon_auth);
|
||||
Addon::callHooks('authenticate', $addon_auth);
|
||||
|
||||
if ($addon_auth['authenticated'] && count($addon_auth['user_record'])) {
|
||||
$record = $addon_auth['user_record'];
|
||||
|
@ -239,7 +240,7 @@ function api_login(App $a)
|
|||
|
||||
$_SESSION["allow_api"] = true;
|
||||
|
||||
call_hooks('logged_in', $a->user);
|
||||
Addon::callHooks('logged_in', $a->user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\Content\Text\Markdown;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Network\Probe;
|
||||
|
@ -218,7 +219,7 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
|
|||
}
|
||||
, $Text);
|
||||
|
||||
call_hooks('bb2diaspora',$Text);
|
||||
Addon::callHooks('bb2diaspora',$Text);
|
||||
|
||||
return $Text;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Content\OEmbed;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
|
@ -1401,7 +1402,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
|||
//$Text = str_replace('<br /><li>', '<li>', $Text);
|
||||
//$Text = str_replace('<br /><ul', '<ul ', $Text);
|
||||
|
||||
call_hooks('bbcode', $Text);
|
||||
Addon::callHooks('bbcode', $Text);
|
||||
|
||||
return trim($Text);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
|
@ -595,7 +596,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
|||
}
|
||||
|
||||
$cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview];
|
||||
call_hooks('conversation_start',$cb);
|
||||
Addon::callHooks('conversation_start',$cb);
|
||||
|
||||
$items = $cb['items'];
|
||||
|
||||
|
@ -731,7 +732,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
|||
}
|
||||
|
||||
$locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
|
||||
call_hooks('render_location',$locate);
|
||||
Addon::callHooks('render_location',$locate);
|
||||
|
||||
$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
|
||||
|
||||
|
@ -820,7 +821,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
|||
];
|
||||
|
||||
$arr = ['item' => $item, 'output' => $tmp_item];
|
||||
call_hooks('display_item', $arr);
|
||||
Addon::callHooks('display_item', $arr);
|
||||
|
||||
$threads[$threadsid]['id'] = $item['item_id'];
|
||||
$threads[$threadsid]['network'] = $item['item_network'];
|
||||
|
@ -864,7 +865,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
|||
continue;
|
||||
}
|
||||
|
||||
call_hooks('display_item', $arr);
|
||||
Addon::callHooks('display_item', $arr);
|
||||
|
||||
$item['pagedrop'] = $page_dropping;
|
||||
|
||||
|
@ -1075,7 +1076,7 @@ function item_photo_menu($item) {
|
|||
|
||||
$args = ['item' => $item, 'menu' => $menu];
|
||||
|
||||
call_hooks('item_photo_menu', $args);
|
||||
Addon::callHooks('item_photo_menu', $args);
|
||||
|
||||
$menu = $args['menu'];
|
||||
|
||||
|
@ -1297,7 +1298,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
|
|||
]);
|
||||
|
||||
$jotplugins = '';
|
||||
call_hooks('jot_tool', $jotplugins);
|
||||
Addon::callHooks('jot_tool', $jotplugins);
|
||||
|
||||
// Private/public post links for the non-JS ACL form
|
||||
$private_post = 1;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* @file include/enotify.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -398,7 +399,7 @@ function notification($params)
|
|||
'itemlink' => $itemlink
|
||||
];
|
||||
|
||||
call_hooks('enotify', $h);
|
||||
Addon::callHooks('enotify', $h);
|
||||
|
||||
$subject = $h['subject'];
|
||||
|
||||
|
@ -440,7 +441,7 @@ function notification($params)
|
|||
$datarray['otype'] = $params['otype'];
|
||||
$datarray['abort'] = false;
|
||||
|
||||
call_hooks('enotify_store', $datarray);
|
||||
Addon::callHooks('enotify_store', $datarray);
|
||||
|
||||
if ($datarray['abort']) {
|
||||
pop_lang();
|
||||
|
@ -576,7 +577,7 @@ function notification($params)
|
|||
$datarray['subject'] = $subject;
|
||||
$datarray['headers'] = $additional_mail_header;
|
||||
|
||||
call_hooks('enotify_mail', $datarray);
|
||||
Addon::callHooks('enotify_mail', $datarray);
|
||||
|
||||
// check whether sending post content in email notifications is allowed
|
||||
// always true for SYSTEM_EMAIL
|
||||
|
@ -667,7 +668,7 @@ function check_user_notification($itemid) {
|
|||
*/
|
||||
function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||
$notification_data = ["uid" => $uid, "profiles" => []];
|
||||
call_hooks('check_item_notification', $notification_data);
|
||||
Addon::callHooks('check_item_notification', $notification_data);
|
||||
|
||||
$profiles = $notification_data["profiles"];
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -328,7 +329,7 @@ function event_store($arr) {
|
|||
$item_id = 0;
|
||||
}
|
||||
|
||||
call_hooks("event_updated", $arr['id']);
|
||||
Addon::callHooks("event_updated", $arr['id']);
|
||||
|
||||
return $item_id;
|
||||
} else {
|
||||
|
@ -406,7 +407,7 @@ function event_store($arr) {
|
|||
);
|
||||
}
|
||||
|
||||
call_hooks("event_created", $event['id']);
|
||||
Addon::callHooks("event_created", $event['id']);
|
||||
|
||||
return $item_id;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Render\ITemplateEngine;
|
||||
|
||||
require_once "include/plugin.php";
|
||||
|
@ -74,7 +75,7 @@ class FriendicaSmartyEngine implements ITemplateEngine
|
|||
"template" => basename($s->filename),
|
||||
"vars" => $r
|
||||
];
|
||||
call_hooks("template_vars", $arr);
|
||||
Addon::callHooks("template_vars", $arr);
|
||||
$r = $arr['vars'];
|
||||
|
||||
foreach ($r as $key => $value) {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* https://github.com/annando/Syncom
|
||||
*/
|
||||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
function node2bbcode(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
||||
|
@ -261,7 +262,7 @@ function html2bbcode($message, $basepath = '')
|
|||
$message = preg_replace('=\r *\r=i', "\n", $message);
|
||||
$message = str_replace("\r", "\n", $message);
|
||||
|
||||
call_hooks('html2bbcode', $message);
|
||||
Addon::callHooks('html2bbcode', $message);
|
||||
|
||||
$message = strip_tags($message);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Worker;
|
||||
|
@ -157,7 +158,7 @@ function title_is_body($title, $body) {
|
|||
}
|
||||
|
||||
function add_page_info_data($data) {
|
||||
call_hooks('page_info_data', $data);
|
||||
Addon::callHooks('page_info_data', $data);
|
||||
|
||||
// It maybe is a rich content, but if it does have everything that a link has,
|
||||
// then treat it that way
|
||||
|
@ -943,9 +944,9 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
|||
put_item_in_cache($arr);
|
||||
|
||||
if ($notify) {
|
||||
call_hooks('post_local', $arr);
|
||||
Addon::callHooks('post_local', $arr);
|
||||
} else {
|
||||
call_hooks('post_remote', $arr);
|
||||
Addon::callHooks('post_remote', $arr);
|
||||
}
|
||||
|
||||
// This array field is used to trigger some automatic reactions
|
||||
|
@ -1086,9 +1087,9 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
|||
$r = q('SELECT * FROM `item` WHERE `id` = %d', intval($current_post));
|
||||
if ((DBM::is_result($r)) && (count($r) == 1)) {
|
||||
if ($notify) {
|
||||
call_hooks('post_local_end', $r[0]);
|
||||
Addon::callHooks('post_local_end', $r[0]);
|
||||
} else {
|
||||
call_hooks('post_remote_end', $r[0]);
|
||||
Addon::callHooks('post_remote_end', $r[0]);
|
||||
}
|
||||
} else {
|
||||
logger('item_store: new item not found in DB, id ' . $current_post);
|
||||
|
@ -1364,7 +1365,7 @@ function tag_deliver($uid, $item_id)
|
|||
|
||||
$arr = ['item' => $item, 'user' => $u[0], 'contact' => $r[0]];
|
||||
|
||||
call_hooks('tagged', $arr);
|
||||
Addon::callHooks('tagged', $arr);
|
||||
|
||||
if ((! $community_page) && (! $prvgroup)) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -254,7 +255,7 @@ EOT;
|
|||
|
||||
$new_item['id'] = $new_item_id;
|
||||
|
||||
call_hooks('post_local_end', $new_item);
|
||||
Addon::callHooks('post_local_end', $new_item);
|
||||
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "like", $new_item_id);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* @file include/network.php
|
||||
*/
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Network\Probe;
|
||||
|
@ -653,7 +654,7 @@ function avatar_img($email)
|
|||
$avatar['url'] = '';
|
||||
$avatar['success'] = false;
|
||||
|
||||
call_hooks('avatar_lookup', $avatar);
|
||||
Addon::callHooks('avatar_lookup', $avatar);
|
||||
|
||||
if (! $avatar['success']) {
|
||||
$avatar['url'] = System::baseUrl() . '/images/person-175.jpg';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
|
@ -157,7 +158,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
|
|||
}
|
||||
|
||||
if ($login_initial) {
|
||||
call_hooks('logged_in', $a->user);
|
||||
Addon::callHooks('logged_in', $a->user);
|
||||
|
||||
if (($a->module !== 'home') && isset($_SESSION['return_url'])) {
|
||||
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
|
||||
|
|
|
@ -6,6 +6,7 @@ use Friendica\App;
|
|||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Smilies;
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
|
@ -969,7 +970,7 @@ function contact_block() {
|
|||
|
||||
$arr = ['contacts' => $r, 'output' => $o];
|
||||
|
||||
call_hooks('contact_block_end', $arr);
|
||||
Addon::callHooks('contact_block_end', $arr);
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
@ -1123,7 +1124,7 @@ function get_poke_verbs() {
|
|||
'finger' => ['fingered', t('finger'), t('fingered')],
|
||||
'rebuff' => ['rebuffed', t('rebuff'), t('rebuffed')],
|
||||
];
|
||||
call_hooks('poke_verbs', $arr);
|
||||
Addon::callHooks('poke_verbs', $arr);
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
@ -1255,7 +1256,7 @@ function put_item_in_cache(&$item, $update = false)
|
|||
function prepare_body(&$item, $attach = false, $preview = false) {
|
||||
|
||||
$a = get_app();
|
||||
call_hooks('prepare_body_init', $item);
|
||||
Addon::callHooks('prepare_body_init', $item);
|
||||
|
||||
$searchpath = System::baseUrl() . "/search?tag=";
|
||||
|
||||
|
@ -1314,7 +1315,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
|
|||
$s = $item["rendered-html"];
|
||||
|
||||
$prep_arr = ['item' => $item, 'html' => $s, 'preview' => $preview];
|
||||
call_hooks('prepare_body', $prep_arr);
|
||||
Addon::callHooks('prepare_body', $prep_arr);
|
||||
$s = $prep_arr['html'];
|
||||
|
||||
if (! $attach) {
|
||||
|
@ -1432,7 +1433,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
|
|||
}
|
||||
|
||||
$prep_arr = ['item' => $item, 'html' => $s];
|
||||
call_hooks('prepare_body_final', $prep_arr);
|
||||
Addon::callHooks('prepare_body_final', $prep_arr);
|
||||
|
||||
return $prep_arr['html'];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue