[various] Remove App dependency from hook functions

pull/1351/head
Hypolite Petovan 2 months ago
parent b53914ee11
commit 39c654da00

@ -55,7 +55,7 @@ use Symfony\Component\ExpressionLanguage;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
function advancedcontentfilter_install(App $a)
function advancedcontentfilter_install()
{
Hook::register('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition');
Hook::register('prepare_body_content_filter', __FILE__, 'advancedcontentfilter_prepare_body_content_filter');
@ -71,7 +71,7 @@ function advancedcontentfilter_install(App $a)
* Hooks
*/
function advancedcontentfilter_dbstructure_definition(App $a, &$database)
function advancedcontentfilter_dbstructure_definition(&$database)
{
$database['advancedcontentfilter_rules'] = [
'comment' => 'Advancedcontentfilter addon rules',
@ -115,7 +115,7 @@ function advancedcontentfilter_get_filter_fields(array $item)
return $vars;
}
function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
function advancedcontentfilter_prepare_body_content_filter(&$hook_data)
{
static $expressionLanguage;
@ -163,7 +163,7 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
}
function advancedcontentfilter_addon_settings(App $a, array &$data)
function advancedcontentfilter_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -187,7 +187,7 @@ function advancedcontentfilter_addon_settings(App $a, array &$data)
*/
function advancedcontentfilter_module() {}
function advancedcontentfilter_init(App $a)
function advancedcontentfilter_init()
{
if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') {
$slim = new \Slim\App();
@ -201,7 +201,7 @@ function advancedcontentfilter_init(App $a)
}
}
function advancedcontentfilter_content(App $a)
function advancedcontentfilter_content()
{
if (!DI::userSession()->getLocalUserId()) {
return Login::form('/' . implode('/', DI::args()->getArgv()));
@ -252,7 +252,7 @@ function advancedcontentfilter_content(App $a)
'rule_expression' => DI::l10n()->t('Rule Expression'),
'cancel' => DI::l10n()->t('Cancel'),
],
'$current_theme' => $a->getCurrentTheme(),
'$current_theme' => DI::app()->getCurrentTheme(),
'$rules' => advancedcontentfilter_get_rules(),
'$form_security_token' => BaseModule::getFormSecurityToken()
]);

@ -34,7 +34,7 @@ function birdavatar_install()
/**
* Bird avatar user settings page
*/
function birdavatar_addon_settings(App $a, array &$data)
function birdavatar_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -62,7 +62,7 @@ function birdavatar_addon_settings(App $a, array &$data)
/**
* Bird avatar user settings POST handle
*/
function birdavatar_addon_settings_post(App $a, &$s)
function birdavatar_addon_settings_post(&$s)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -114,10 +114,9 @@ function birdavatar_addon_settings_post(App $a, &$s)
/**
* Returns the URL to the bird avatar
*
* @param $a array
* @param &$b array
*/
function birdavatar_lookup(App $a, array &$b)
function birdavatar_lookup(array &$b)
{
$user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]);
if (DBA::isResult($user)) {
@ -149,7 +148,7 @@ function birdavatar_module() {}
* @throws NotFoundException
*
*/
function birdavatar_content(App $a)
function birdavatar_content()
{
if (DI::args()->getArgc() < 2 || DI::args()->getArgc() > 3) {
throw new NotFoundException(); // this should be catched on index and show default "not found" page.

@ -55,7 +55,7 @@ function blackout_install() {
Hook::register('page_header', 'addon/blackout/blackout.php', 'blackout_redirect');
}
function blackout_redirect (App $a, $b)
function blackout_redirect ($b)
{
// if we have a logged in user, don't throw her out
if (DI::userSession()->getLocalUserId()) {
@ -83,7 +83,7 @@ function blackout_redirect (App $a, $b)
}
}
function blackout_addon_admin(App $a, string &$o)
function blackout_addon_admin(string &$o)
{
$mystart = DI::config()->get('blackout','begindate');
if (! is_string($mystart)) { $mystart = 'YYYY-MM-DD hh:mm'; }
@ -112,7 +112,7 @@ function blackout_addon_admin(App $a, string &$o)
]);
}
function blackout_addon_admin_post (App $a)
function blackout_addon_admin_post ()
{
DI::config()->set('blackout', 'begindate', trim($_POST['startdate']));
DI::config()->set('blackout', 'enddate', trim($_POST['enddate']));

@ -24,7 +24,7 @@ function blockbot_install()
Hook::register('init_1', __FILE__, 'blockbot_init_1');
}
function blockbot_addon_admin(App $a, string &$o)
function blockbot_addon_admin(string &$o)
{
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/blockbot/');
@ -36,14 +36,14 @@ function blockbot_addon_admin(App $a, string &$o)
]);
}
function blockbot_addon_admin_post(App $a)
function blockbot_addon_admin_post()
{
DI::config()->set('blockbot', 'good_crawlers', $_POST['good_crawlers'] ?? false);
DI::config()->set('blockbot', 'block_gab', $_POST['block_gab'] ?? false);
DI::config()->set('blockbot', 'training', $_POST['training'] ?? false);
}
function blockbot_init_1(App $a)
function blockbot_init_1()
{
if (empty($_SERVER['HTTP_USER_AGENT'])) {
return;

@ -27,7 +27,7 @@ function blockem_install()
Hook::register('enotify_store' , 'addon/blockem/blockem.php', 'blockem_enotify_store');
}
function blockem_addon_settings(App $a, array &$data)
function blockem_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -48,7 +48,7 @@ function blockem_addon_settings(App $a, array &$data)
];
}
function blockem_addon_settings_post(App $a, array &$b)
function blockem_addon_settings_post(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -59,7 +59,7 @@ function blockem_addon_settings_post(App $a, array &$b)
}
}
function blockem_enotify_store(App $a, array &$b)
function blockem_enotify_store(array &$b)
{
$words = DI::pConfig()->get($b['uid'], 'blockem', 'words');
@ -90,7 +90,7 @@ function blockem_enotify_store(App $a, array &$b)
}
}
function blockem_prepare_body_content_filter(App $a, array &$hook_data)
function blockem_prepare_body_content_filter(array &$hook_data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -122,14 +122,14 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data)
}
}
function blockem_display_item(App $a, array &$b = null)
function blockem_display_item(array &$b = null)
{
if (!empty($b['output']['body']) && strstr($b['output']['body'], 'id="blockem-wrap-')) {
$b['output']['thumb'] = DI::baseUrl()->get() . "/images/person-80.jpg";
}
}
function blockem_conversation_start(App $a, array &$b)
function blockem_conversation_start(array &$b)
{
global $blockem_words;
@ -161,7 +161,7 @@ function blockemUnblock(author) {
EOT;
}
function blockem_item_photo_menu(App $a, array &$b)
function blockem_item_photo_menu(array &$b)
{
global $blockem_words;
@ -194,7 +194,7 @@ function blockem_item_photo_menu(App $a, array &$b)
*/
function blockem_module() {}
function blockem_init(App $a)
function blockem_init()
{
if (!DI::userSession()->getLocalUserId()) {
return;

@ -15,7 +15,7 @@ function buglink_install()
Hook::register('page_end', 'addon/buglink/buglink.php', 'buglink_active');
}
function buglink_active(App $a, string &$b)
function buglink_active(string &$b)
{
$b .= '<div id="buglink_wrapper" style="position: fixed; bottom: 5px; left: 5px;"><a href="https://github.com/friendica/friendica/issues" target="_blank" rel="noopener noreferrer" title="' . DI::l10n()->t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . DI::l10n()->t('Report Bug') . '" /></a></div>';
}

@ -14,7 +14,7 @@ function calc_install() {
Hook::register('app_menu', 'addon/calc/calc.php', 'calc_app_menu');
}
function calc_app_menu(App $a, array &$b)
function calc_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="calc">Calculator</a></div>';
}
@ -26,7 +26,7 @@ function calc_app_menu(App $a, array &$b)
*/
function calc_module() {}
function calc_init(App $a)
function calc_init()
{
$x = <<< EOT

@ -35,7 +35,7 @@ function catavatar_install()
/**
* Cat avatar user settings page
*/
function catavatar_addon_settings(App $a, array &$data)
function catavatar_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -63,7 +63,7 @@ function catavatar_addon_settings(App $a, array &$data)
/**
* Cat avatar user settings POST handle
*/
function catavatar_addon_settings_post(App $a, &$s)
function catavatar_addon_settings_post(&$s)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -115,10 +115,9 @@ function catavatar_addon_settings_post(App $a, &$s)
/**
* Returns the URL to the cat avatar
*
* @param $a array
* @param &$b array
*/
function catavatar_lookup(App $a, array &$b)
function catavatar_lookup(array &$b)
{
$user = DBA::selectFirst('user', ['uid'], ['email' => $b['email']]);
if (DBA::isResult($user)) {
@ -150,7 +149,7 @@ function catavatar_module() {}
* @throws NotFoundException
*
*/
function catavatar_content(App $a)
function catavatar_content()
{
if (DI::args()->getArgc() < 2 || DI::args()->getArgc() > 3) {
throw new NotFoundException(); // this should be catched on index and show default "not found" page.

@ -13,7 +13,7 @@ function convert_install() {
Hook::register('app_menu', 'addon/convert/convert.php', 'convert_app_menu');
}
function convert_app_menu(App $a, array &$b)
function convert_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>';
}
@ -21,7 +21,7 @@ function convert_app_menu(App $a, array &$b)
function convert_module() {}
function convert_content(App $a) {
function convert_content() {
// @TODO UnitConverter uses a deprecated constructor with the class' name
// @TODO Let's one day rewrite this to a modern composer package
include 'UnitConvertor.php';

@ -28,14 +28,13 @@ function cookienotice_install()
* cookienotice_addon_admin
* creates the admins config panel
*
* @param App $a
* @param string $s The existing config panel html so far
*
* @return void
*/
function cookienotice_addon_admin(App $a, &$s)
function cookienotice_addon_admin(&$s)
{
if (!$a->isSiteAdmin()) {
if (!DI::userSession()->isSiteAdmin()) {
return;
}
@ -57,12 +56,11 @@ function cookienotice_addon_admin(App $a, &$s)
* cookienotice_addon_admin_post
* handles the post request from the admin panel
*
* @param App $a
* @return void
*/
function cookienotice_addon_admin_post(App $a)
function cookienotice_addon_admin_post()
{
if (!$a->isSiteAdmin()) {
if (!DI::userSession()->isSiteAdmin()) {
return;
}
@ -77,12 +75,11 @@ function cookienotice_addon_admin_post(App $a)
* page_content_top hook
* adds css and scripts to the <head> section of the html
*
* @param App $a
* @param string $b unused - the header html incl. nav
*
* @return void
*/
function cookienotice_page_content_top(App $a, string &$b)
function cookienotice_page_content_top(string &$b)
{
DI::page()->registerStylesheet(__DIR__ . '/cookienotice.css');
DI::page()->registerFooterScript(__DIR__ . '/cookienotice.js');
@ -93,12 +90,11 @@ function cookienotice_page_content_top(App $a, string &$b)
* page_end hook
* ads our cookienotice box to the end of the html
*
* @param App $a
* @param string $b the page html
*
* @return void
*/
function cookienotice_page_end(App $a, string &$b)
function cookienotice_page_end(string &$b)
{
$text = (string)DI::config()->get('cookienotice', 'text', DI::l10n()->t('This website uses cookies to recognize revisiting and logged in users. You accept the usage of these cookies by continue browsing this website.'));
$oktext = (string)DI::config()->get('cookienotice', 'oktext', DI::l10n()->t('OK'));

@ -86,7 +86,7 @@ function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cacheti
return $r;
}
function curweather_network_mod_init(App $a, string &$body)
function curweather_network_mod_init(string &$body)
{
if (!intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'curweather', 'curweather_enable'))) {
return;
@ -152,7 +152,7 @@ function curweather_network_mod_init(App $a, string &$body)
DI::page()['aside'] = $curweather . DI::page()['aside'];
}
function curweather_addon_settings_post(App $a, $post)
function curweather_addon_settings_post($post)
{
if (!DI::userSession()->getLocalUserId() || empty($_POST['curweather-settings-submit'])) {
return;
@ -163,7 +163,7 @@ function curweather_addon_settings_post(App $a, $post)
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'curweather', 'curweather_units' , trim($_POST['curweather_units']));
}
function curweather_addon_settings(App $a, array &$data)
function curweather_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -199,9 +199,9 @@ function curweather_addon_settings(App $a, array &$data)
// Config stuff for the admin panel to let the admin of the node set a APPID
// for accessing the API of openweathermap
function curweather_addon_admin_post(App $a)
function curweather_addon_admin_post()
{
if (!$a->isSiteAdmin()) {
if (!DI::userSession()->isSiteAdmin()) {
return;
}
@ -211,9 +211,9 @@ function curweather_addon_admin_post(App $a)
}
}
function curweather_addon_admin(App $a, string &$o)
function curweather_addon_admin(string &$o)
{
if (!$a->isSiteAdmin()) {
if (!DI::userSession()->isSiteAdmin()) {
return;
}

@ -29,7 +29,7 @@ function diaspora_install()
Hook::register('connector_settings_post', 'addon/diaspora/diaspora.php', 'diaspora_settings_post');
}
function diaspora_jot_nets(App $a, array &$jotnets_fields)
function diaspora_jot_nets(array &$jotnets_fields)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -47,7 +47,7 @@ function diaspora_jot_nets(App $a, array &$jotnets_fields)
}
}
function diaspora_settings(App $a, array &$data)
function diaspora_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -117,7 +117,7 @@ function diaspora_settings(App $a, array &$data)
}
function diaspora_settings_post(App $a, array &$b)
function diaspora_settings_post(array &$b)
{
if (!empty($_POST['diaspora-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(),'diaspora', 'post' , intval($_POST['enabled']));
@ -136,7 +136,7 @@ function diaspora_settings_post(App $a, array &$b)
}
}
function diaspora_hook_fork(App $a, array &$b)
function diaspora_hook_fork(array &$b)
{
if ($b['name'] != 'notifier_normal') {
return;
@ -151,7 +151,7 @@ function diaspora_hook_fork(App $a, array &$b)
}
}
function diaspora_post_local(App $a, array &$b)
function diaspora_post_local(array &$b)
{
if ($b['edit']) {
return;
@ -184,7 +184,7 @@ function diaspora_post_local(App $a, array &$b)
$b['postopts'] .= 'diaspora';
}
function diaspora_send(App $a, array &$b)
function diaspora_send(array &$b)
{
$hostname = DI::baseUrl()->getHostname();

@ -36,7 +36,7 @@ function discourse_install()
Hook::register('connector_settings_post', __FILE__, 'discourse_settings_post');
}
function discourse_settings(App $a, array &$data)
function discourse_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -58,7 +58,7 @@ function discourse_settings(App $a, array &$data)
];
}
function discourse_settings_post(App $a)
function discourse_settings_post()
{
if (!DI::userSession()->getLocalUserId() || empty($_POST['discourse-submit'])) {
return;
@ -67,7 +67,7 @@ function discourse_settings_post(App $a)
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'discourse', 'enabled', intval($_POST['enabled']));
}
function discourse_email_getmessage(App $a, &$message)
function discourse_email_getmessage(&$message)
{
if (empty($message['item']['uid'])) {
return;

@ -29,7 +29,7 @@ function dwpost_install()
Hook::register('connector_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post');
}
function dwpost_jot_nets(App $a, array &$jotnets_fields)
function dwpost_jot_nets(array &$jotnets_fields)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -48,7 +48,7 @@ function dwpost_jot_nets(App $a, array &$jotnets_fields)
}
function dwpost_settings(App $a, array &$data)
function dwpost_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -76,7 +76,7 @@ function dwpost_settings(App $a, array &$data)
}
function dwpost_settings_post(App $a, array &$b)
function dwpost_settings_post(array &$b)
{
if (!empty($_POST['dwpost-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'dwpost', 'post', intval($_POST['dwpost']));
@ -86,7 +86,7 @@ function dwpost_settings_post(App $a, array &$b)
}
}
function dwpost_post_local(App $a, array &$b)
function dwpost_post_local(array &$b)
{
// This can probably be changed to allow editing by pointing to a different API endpoint
if ($b['edit']) {
@ -120,7 +120,7 @@ function dwpost_post_local(App $a, array &$b)
$b['postopts'] .= 'dwpost';
}
function dwpost_send(App $a, array &$b)
function dwpost_send(array &$b)
{
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;

@ -17,18 +17,18 @@ function fancybox_install()
Hook::register('prepare_body_final', __FILE__, 'fancybox_render');
}
function fancybox_head(App $a, string &$b)
function fancybox_head(string &$b)
{
DI::page()->registerStylesheet(__DIR__ . '/asset/fancybox/jquery.fancybox.min.css');
}
function fancybox_footer(App $a, string &$str)
function fancybox_footer(string &$str)
{
DI::page()->registerFooterScript(__DIR__ . '/asset/fancybox/jquery.fancybox.min.js');
DI::page()->registerFooterScript(__DIR__ . '/asset/fancybox/fancybox.config.js');
}
function fancybox_render(App $a, array &$b){
function fancybox_render(array &$b){
$gallery = 'gallery-' . $b['item']['uri-id'] ?? random_int(1000000, 10000000);
// performWithEscapedBlocks escapes block defined with 2nd par pattern that won't be processed.
@ -39,7 +39,7 @@ function fancybox_render(App $a, array &$b){
function ($text) use ($gallery) {
// This processes images inlined in posts
// Frio / Vier hooks für lightbox are un-hooked in fancybox-config.js. So this works for them, too!
//if (!in_array($a->getCurrentTheme(),['vier','frio']))
//if (!in_array(DI::app()->getCurrentTheme(),['vier','frio']))
$text = preg_replace(
'#<a[^>]*href="([^"]*)"[^>]*>(<img[^>]*src="[^"]*"[^>]*>)</a>#',
'<a data-fancybox="' . $gallery . '" href="$1">$2</a>',

@ -36,19 +36,19 @@ function forumdirectory_install()
*/
function forumdirectory_module() {}
function forumdirectory_app_menu(App $a, array &$b)
function forumdirectory_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="forumdirectory">' . DI::l10n()->t('Forum Directory') . '</a></div>';
}
function forumdirectory_init(App $a)
function forumdirectory_init()
{
if (DI::userSession()->getLocalUserId()) {
DI::page()['aside'] .= Widget::findPeople();
}
}
function forumdirectory_post(App $a)
function forumdirectory_post()
{
global $forumdirectory_search;
@ -57,7 +57,7 @@ function forumdirectory_post(App $a)
}
}
function forumdirectory_content(App $a)
function forumdirectory_content()
{
global $forumdirectory_search;

@ -21,7 +21,7 @@ function fromapp_install()
Logger::notice("installed fromapp");
}
function fromapp_settings_post(App $a, $post)
function fromapp_settings_post($post)
{
if (!DI::userSession()->getLocalUserId() || empty($_POST['fromapp-submit'])) {
return;
@ -31,7 +31,7 @@ function fromapp_settings_post(App $a, $post)
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'fromapp', 'force', intval($_POST['fromapp-force']));
}
function fromapp_settings(App &$a, array &$data)
function fromapp_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -53,7 +53,7 @@ function fromapp_settings(App &$a, array &$data)
];
}
function fromapp_post_hook(App $a, &$item)
function fromapp_post_hook(&$item)
{
if (!DI::userSession()->getLocalUserId()) {
return;

@ -77,12 +77,12 @@ function geocoordinates_resolve_item(array &$item)
}
}
function geocoordinates_post_hook(App $a, &$item)
function geocoordinates_post_hook(&$item)
{
geocoordinates_resolve_item($item);
}
function geocoordinates_addon_admin(App $a, string &$o)
function geocoordinates_addon_admin(string &$o)
{
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/geocoordinates/');
@ -93,7 +93,7 @@ function geocoordinates_addon_admin(App $a, string &$o)
]);
}
function geocoordinates_addon_admin_post(App $a)
function geocoordinates_addon_admin_post()
{
DI::config()->set('geocoordinates', 'api_key', trim($_POST['api_key'] ?? ''));
DI::config()->set('geocoordinates', 'language', trim($_POST['language'] ?? ''));

@ -33,12 +33,12 @@ function geonames_install()
Hook::register('addon_settings_post', __FILE__, 'geonames_addon_settings_post');
}
function geonames_load_config(App $a, ConfigFileManager $loader)
function geonames_load_config(ConfigFileManager $loader)
{
$a->getConfigCache()->load($loader->loadAddonConfig('geonames'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
DI::app()->getConfigCache()->load($loader->loadAddonConfig('geonames'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
}
function geonames_post_hook(App $a, array &$item)
function geonames_post_hook(array &$item)
{
/* An item was posted on the local system.
* We are going to look for specific items:
@ -97,10 +97,9 @@ function geonames_post_hook(App $a, array &$item)
* We will make sure we've got a valid user account
* and if so set our configuration setting for this person.
*
* @param App $a
* @param array $post The $_POST array
*/
function geonames_addon_settings_post(App $a, array $post)
function geonames_addon_settings_post(array $post)
{
if (!DI::userSession()->getLocalUserId() || empty($_POST['geonames-submit'])) {
return;
@ -113,11 +112,10 @@ function geonames_addon_settings_post(App $a, array $post)
* Called from the Addon Setting form.
* Add our own settings info to the page.
*
* @param App $a
* @param array $data
* @throws Exception
*/
function geonames_addon_settings(App $a, array &$data)
function geonames_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;

@ -30,7 +30,7 @@ function gnot_install()
* We will make sure we've got a valid user account
* and if so set our configuration setting for this person.
*/
function gnot_settings_post(App $a, $post) {
function gnot_settings_post($post) {
if(! DI::userSession()->getLocalUserId() || empty($_POST['gnot-submit']))
return;
@ -41,7 +41,7 @@ function gnot_settings_post(App $a, $post) {
* Called from the Addon Setting form.
* Add our own settings info to the page.
*/
function gnot_settings(App &$a, array &$data)
function gnot_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -62,7 +62,7 @@ function gnot_settings(App &$a, array &$data)
];
}
function gnot_enotify_mail(App $a, array &$b)
function gnot_enotify_mail(array &$b)
{
if ((!$b['uid']) || (! intval(DI::pConfig()->get($b['uid'], 'gnot','enable')))) {
return;

@ -18,7 +18,7 @@ function googlemaps_install()
Logger::notice('installed googlemaps');
}
function googlemaps_location(App $a, &$item)
function googlemaps_location(&$item)
{
if (!(strlen($item['location']) || strlen($item['coord']))) {
return;

@ -26,18 +26,17 @@ function gravatar_install() {
Logger::notice("registered gravatar in avatar_lookup hook");
}
function gravatar_load_config(App $a, ConfigFileManager $loader)
function gravatar_load_config(ConfigFileManager $loader)
{
$a->getConfigCache()->load($loader->loadAddonConfig('gravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
DI::app()->getConfigCache()->load($loader->loadAddonConfig('gravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
}
/**
* Looks up the avatar at gravatar.com and returns the URL.
*
* @param $a array
* @param &$b array
*/
function gravatar_lookup(App $a, array &$b)
function gravatar_lookup(array &$b)
{
$default_avatar = DI::config()->get('gravatar', 'default_avatar');
$rating = DI::config()->get('gravatar', 'rating');
@ -62,7 +61,7 @@ function gravatar_lookup(App $a, array &$b)
/**
* Display admin settings for this addon
*/
function gravatar_addon_admin (App $a, string &$o)
function gravatar_addon_admin (string &$o)
{
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/gravatar/" );
@ -109,7 +108,7 @@ function gravatar_addon_admin (App $a, string &$o)
/**
* Save admin settings
*/
function gravatar_addon_admin_post (App $a)
function gravatar_addon_admin_post ()
{
BaseModule::checkFormSecurityToken('gravatarsave');

@ -27,7 +27,7 @@ function group_text_install()
*
*/
function group_text_settings_post(App $a, array $post)
function group_text_settings_post(array $post)
{
if (!DI::userSession()->getLocalUserId() || empty($post['group_text-submit'])) {
return;
@ -44,7 +44,7 @@ function group_text_settings_post(App $a, array $post)
*
*/
function group_text_settings(App &$a, array &$data)
function group_text_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;

@ -16,9 +16,9 @@ function highlightjs_install()
Hook::register('footer', __FILE__, 'highlightjs_footer');
}
function highlightjs_head(App $a, string &$str)
function highlightjs_head(string &$str)
{
if ($a->getCurrentTheme() == 'frio') {
if (DI::app()->getCurrentTheme() == 'frio') {
$style = 'bootstrap';
} else {
$style = 'default';
@ -27,7 +27,7 @@ function highlightjs_head(App $a, string &$str)
DI::page()->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css');
}
function highlightjs_footer(App $a, string &$str)
function highlightjs_footer(string &$str)
{
DI::page()->registerFooterScript(__DIR__ . '/asset/highlight.pack.js');
DI::page()->registerFooterScript(__DIR__ . '/highlightjs.js');

@ -32,7 +32,7 @@ function ifttt_module() {}
function ifttt_content() {}
function ifttt_settings(App $a, array &$data)
function ifttt_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -55,7 +55,7 @@ function ifttt_settings(App $a, array &$data)
'new_photo_upload_body' => DI::l10n()->t('Body for "new photo upload"'),
'new_link_post_body' => DI::l10n()->t('Body for "new link post"'),
],
'$url' => DI::baseUrl()->get() . '/ifttt/' . $a->getLoggedInUserNickname(),
'$url' => DI::baseUrl()->get() . '/ifttt/' . DI::userSession()->getLocalUserNickname(),
'$new_status_message_body' => 'key=' . $key . '&type=status&msg=<<<{{Message}}>>>&date=<<<{{UpdatedAt}}>>>&url=<<<{{PageUrl}}>>>',
'$new_photo_upload_body' => 'key=' . $key . '&type=photo&link=<<<{{Link}}>>>&image=<<<{{ImageSource}}>>>&msg=<<<{{Caption}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>',
'$new_link_post_body' => 'key=' . $key . '&type=link&link=<<<{{Link}}>>>&title=<<<{{Title}}>>>&msg=<<<{{Message}}>>>&description=<<<{{Description}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>',
@ -77,7 +77,7 @@ function ifttt_settings_post()
}
}
function ifttt_post(App $a)
function ifttt_post()
{
if (DI::args()->getArgc() != 2) {
return;

@ -28,7 +28,7 @@ function ijpost_install()
Hook::register('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post');
}
function ijpost_jot_nets(App &$a, array &$jotnets_fields)
function ijpost_jot_nets(array &$jotnets_fields)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -46,7 +46,7 @@ function ijpost_jot_nets(App &$a, array &$jotnets_fields)
}
}
function ijpost_settings(App &$a, array &$data)
function ijpost_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -73,7 +73,7 @@ function ijpost_settings(App &$a, array &$data)
];
}
function ijpost_settings_post(App $a, array &$b)
function ijpost_settings_post(array &$b)
{
if (!empty($_POST['ijpost-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ijpost', 'post', intval($_POST['ijpost']));
@ -83,7 +83,7 @@ function ijpost_settings_post(App $a, array &$b)
}
}
function ijpost_post_local(App $a, array &$b)
function ijpost_post_local(array &$b)
{
// This can probably be changed to allow editing by pointing to a different API endpoint
@ -118,7 +118,7 @@ function ijpost_post_local(App $a, array &$b)
$b['postopts'] .= 'ijpost';
}
function ijpost_send(App $a, array &$b)
function ijpost_send(array &$b)
{
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;

@ -43,7 +43,7 @@ function obfuscate_email (string $s): string
return $s;
}
function impressum_footer(App $a, string &$body)
function impressum_footer(string &$body)
{
$text = ProxyUtils::proxifyHtml(BBCode::convert(DI::config()->get('impressum', 'footer_text')));
@ -54,12 +54,12 @@ function impressum_footer(App $a, string &$body)
}
}
function impressum_load_config(App $a, ConfigFileManager $loader)
function impressum_load_config(ConfigFileManager $loader)
{
$a->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
DI::app()->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
}
function impressum_show(App $a, string &$body)
function impressum_show(string &$body)
{
$body .= '<h3>' . DI::l10n()->t('Impressum') . '</h3>';
$owner = DI::config()->get('impressum', 'owner');
@ -92,7 +92,7 @@ function impressum_show(App $a, string &$body)
}
}
function impressum_addon_admin_post (App $a)
function impressum_addon_admin_post ()
{
DI::config()->set('impressum', 'owner', strip_tags(trim($_POST['owner'] ?? '')));
DI::config()->set('impressum', 'ownerprofile', strip_tags(trim($_POST['ownerprofile'] ?? '')));
@ -102,7 +102,7 @@ function impressum_addon_admin_post (App $a)
DI::config()->set('impressum', 'footer_text', strip_tags(trim($_POST['footer_text'] ?? '')));
}
function impressum_addon_admin (App $a, string &$o)
function impressum_addon_admin (string &$o)
{
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/impressum/' );
$o = Renderer::replaceMacros($t, [

@ -15,7 +15,7 @@ function infiniteimprobabilitydrive_install()
Hook::register('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu');
}
function infiniteimprobabilitydrive_app_menu(App $a, array &$b)
function infiniteimprobabilitydrive_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="infiniteimprobabilitydrive">' . DI::l10n()->t('Infinite Improbability Drive') . '</a></div>';
}
@ -28,7 +28,7 @@ function infiniteimprobabilitydrive_app_menu(App $a, array &$b)
function infiniteimprobabilitydrive_module() {}
function infiniteimprobabilitydrive_content(App $a)
function infiniteimprobabilitydrive_content()
{
$baseurl = DI::baseUrl()->get() . '/addon/infiniteimprobabilitydrive';
$o = '';

@ -19,7 +19,7 @@ function irc_install()
Hook::register('addon_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post');
}
function irc_addon_settings(App &$a, array &$data)
function irc_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -42,7 +42,7 @@ function irc_addon_settings(App &$a, array &$data)
];
}
function irc_addon_settings_post(App $a, array &$b)
function irc_addon_settings_post(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -59,7 +59,7 @@ function irc_addon_settings_post(App $a, array &$b)
}
}
function irc_app_menu(App $a, array &$b)
function irc_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="irc">' . DI::l10n()->t('IRC Chatroom') . '</a></div>';
}
@ -71,7 +71,7 @@ function irc_app_menu(App $a, array &$b)
*/
function irc_module() {}
function irc_content(App $a)
function irc_content()
{
$baseurl = DI::baseUrl()->get() . '/addon/irc';
$o = '';
@ -124,9 +124,9 @@ EOT;
return $o;
}
function irc_addon_admin_post (App $a)
function irc_addon_admin_post ()
{
if (!$a->isSiteAdmin()) {
if (!DI::userSession()->isSiteAdmin()) {
return;
}
@ -135,7 +135,7 @@ function irc_addon_admin_post (App $a)
DI::config()->set('irc', 'sitechats', trim($_POST['sitechats']));
}
}
function irc_addon_admin (App $a, string &$o) {
function irc_addon_admin (string &$o) {
$sitechats = DI::config()->get('irc', 'sitechats'); /* popular channels */
$autochans = DI::config()->get('irc', 'autochans'); /* auto connect chans */
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/irc/' );

@ -25,7 +25,7 @@ function js_upload_install()
Hook::register('photo_post_end', __FILE__, 'js_upload_post_end');
}
function js_upload_form(App $a, array &$b)
function js_upload_form(array &$b)
{
$b['default_upload'] = false;
@ -43,7 +43,7 @@ function js_upload_form(App $a, array &$b)
]);
}
function js_upload_post_init(App $a, array &$b)
function js_upload_post_init(array &$b)
{
global $js_upload_result, $js_upload_jsonresponse;
@ -69,7 +69,7 @@ function js_upload_post_init(App $a, array &$b)
$js_upload_result = $result;
}
function js_upload_post_file(App $a, array &$b)
function js_upload_post_file(array &$b)
{
global $js_upload_result;
@ -81,7 +81,7 @@ function js_upload_post_file(App $a, array &$b)
}
function js_upload_post_end(App $a, int &$b)
function js_upload_post_end(int &$b)
{
global $js_upload_jsonresponse;

@ -45,7 +45,7 @@ function keycloakpassword_request($client_id, $secret, $url, $params = [])
return $res;
}
function keycloakpassword_authenticate(App $a, array &$b)
function keycloakpassword_authenticate(array &$b)
{
if (empty($b['password'])) {
return;
@ -110,7 +110,7 @@ function keycloakpassword_admin_input($key, $label, $description)
];
}
function keycloakpassword_addon_admin(App $a, string &$o)
function keycloakpassword_addon_admin(string &$o)
{
$form =
keycloakpassword_admin_input(
@ -140,7 +140,7 @@ function keycloakpassword_addon_admin(App $a, string &$o)
$o = Renderer::replaceMacros($t, $form);
}
function keycloakpassword_addon_admin_post(App $a)
function keycloakpassword_addon_admin_post()
{
if (!DI::userSession()->getLocalUserId()) {
return;

@ -35,7 +35,7 @@ function krynn_install()
Logger::notice("installed krynn");
}
function krynn_post_hook(App $a, &$item)
function krynn_post_hook(&$item)
{
/**
* An item was posted on the local system.
@ -88,7 +88,7 @@ function krynn_post_hook(App $a, &$item)
* We will make sure we've got a valid user account
* and if so set our configuration setting for this person.
*/
function krynn_settings_post(App $a, $post)
function krynn_settings_post($post)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -103,7 +103,7 @@ function krynn_settings_post(App $a, $post)
* Called from the addon Setting form.
* Add our own settings info to the page.
*/
function krynn_settings(App &$a, array &$data)
function krynn_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;

@ -31,7 +31,7 @@ function langfilter_install()
* 3rd parse a SMARTY3 template, replacing some translateable strings for the form
*/
function langfilter_addon_settings(App $a, array &$data)
function langfilter_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -67,7 +67,7 @@ function langfilter_addon_settings(App $a, array &$data)
* 3rd save the settings to the DB for later usage
*/
function langfilter_addon_settings_post(App $a, array &$b)
function langfilter_addon_settings_post(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -98,7 +98,7 @@ function langfilter_addon_settings_post(App $a, array &$b)
* expand it again.
*/
function langfilter_prepare_body_content_filter(App $a, &$hook_data)
function langfilter_prepare_body_content_filter(&$hook_data)
{
$logged_user = DI::userSession()->getLocalUserId();
if (!$logged_user) {
@ -107,7 +107,7 @@ function langfilter_prepare_body_content_filter(App $a, &$hook_data)
// Never filter own messages
// TODO: find a better way to extract this
$logged_user_profile = DI::baseUrl()->get() . '/profile/' . $a->getLoggedInUserNickname();
$logged_user_profile = DI::baseUrl()->get() . '/profile/' . DI::userSession()->getLocalUserNickname();
if ($logged_user_profile == $hook_data['item']['author-link']) {
return;
}

@ -43,12 +43,12 @@ function ldapauth_install()
Hook::register('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate');
}
function ldapauth_load_config(App $a, ConfigFileManager $loader)
function ldapauth_load_config(ConfigFileManager $loader)
{
$a->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
DI::app()->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
}
function ldapauth_hook_authenticate(App $a, array &$b)
function ldapauth_hook_authenticate(array &$b)
{
$user = ldapauth_authenticate($b['username'], $b['password']);
if (!empty($user['uid'])) {

@ -18,7 +18,7 @@ function leistungsschutzrecht_install()
Hook::register('page_info_data', 'addon/leistungsschutzrecht/leistungsschutzrecht.php', 'leistungsschutzrecht_getsiteinfo');
}
function leistungsschutzrecht_getsiteinfo(App $a, array &$siteinfo) {
function leistungsschutzrecht_getsiteinfo(array &$siteinfo) {
if (!isset($siteinfo['url']) || empty($siteinfo['type'])) {
return;
}
@ -162,7 +162,7 @@ function leistungsschutzrecht_is_member_site(string $url): bool
return isset($sites[$site]);
}
function leistungsschutzrecht_cron(App $a, $b)
function leistungsschutzrecht_cron($b)
{
$last = DI::keyValue()->get('leistungsschutzrecht_last_poll');

@ -25,7 +25,7 @@ function libertree_install()
Hook::register('connector_settings_post', 'addon/libertree/libertree.php', 'libertree_settings_post');
}
function libertree_jot_nets(App &$a, array &$jotnets_fields)
function libertree_jot_nets(array &$jotnets_fields)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -43,7 +43,7 @@ function libertree_jot_nets(App &$a, array &$jotnets_fields)
}
}
function libertree_settings(App $a, array &$data)
function libertree_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
@ -71,7 +71,7 @@ function libertree_settings(App $a, array &$data)
];
}
function libertree_settings_post(App $a, array &$b)
function libertree_settings_post(array &$b)
{
if (!empty($_POST['libertree-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(),'libertree','post',intval($_POST['libertree']));
@ -83,7 +83,7 @@ function libertree_settings_post(App $a, array &$b)
}
function libertree_hook_fork(App &$a, array &$b)
function libertree_hook_fork(array &$b)
{
if ($b['name'] != 'notifier_normal') {
return;
@ -98,7 +98,7 @@ function libertree_hook_fork(App &$a, array &$b)
}
}
function libertree_post_local(App $a, array &$b)
function libertree_post_local(array &$b)
{
// This can probably be changed to allow editing by pointing to a different API endpoint
@ -134,7 +134,7 @@ function libertree_post_local(App $a, array &$b)
$b['postopts'] .= 'libertree';
}
function libertree_send(App $a, array &$b)
function libertree_send(array &$b)
{
Logger::notice('libertree_send: invoked');

@ -24,18 +24,17 @@ function libravatar_install()
Logger::notice("registered libravatar in avatar_lookup hook");
}
function libravatar_load_config(App $a, ConfigFileManager $loader)
function libravatar_load_config(ConfigFileManager $loader)
{
$a->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
DI::app()->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
}
/**
* Looks up the avatar at Libravatar and returns the URL.
*
* @param $a array
* @param &$b array
*/
function libravatar_lookup(array $a, array &$b)
function libravatar_lookup(array &$b)
{