diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index f29da0cf..2254e587 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -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() ]); diff --git a/birdavatar/birdavatar.php b/birdavatar/birdavatar.php index 44247dae..e389d561 100644 --- a/birdavatar/birdavatar.php +++ b/birdavatar/birdavatar.php @@ -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. diff --git a/blackout/blackout.php b/blackout/blackout.php index c211c914..55fb8d32 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -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'])); diff --git a/blockbot/blockbot.php b/blockbot/blockbot.php index f57498d9..93da4e53 100644 --- a/blockbot/blockbot.php +++ b/blockbot/blockbot.php @@ -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; diff --git a/blockem/blockem.php b/blockem/blockem.php index 39272747..77c8215d 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -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; diff --git a/buglink/buglink.php b/buglink/buglink.php index 517c33e2..78fb8bef 100644 --- a/buglink/buglink.php +++ b/buglink/buglink.php @@ -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 .= ''; } diff --git a/calc/calc.php b/calc/calc.php index 3159bf6a..a8a340c4 100644 --- a/calc/calc.php +++ b/calc/calc.php @@ -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'][] = '
Calculator
'; } @@ -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 diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index bdca4b42..69f71ef6 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -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. diff --git a/convert/convert.php b/convert/convert.php index 53e6d2d3..57ce6ea8 100644 --- a/convert/convert.php +++ b/convert/convert.php @@ -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'][] = '
Units Conversion
'; } @@ -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'; diff --git a/cookienotice/cookienotice.php b/cookienotice/cookienotice.php index 9eb77597..2bd6f9b1 100644 --- a/cookienotice/cookienotice.php +++ b/cookienotice/cookienotice.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 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')); diff --git a/curweather/curweather.php b/curweather/curweather.php index 79aa752e..6b6c53cc 100644 --- a/curweather/curweather.php +++ b/curweather/curweather.php @@ -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; } diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 79c0aba2..2e1b3607 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -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(); diff --git a/discourse/discourse.php b/discourse/discourse.php index 13f73690..3d27c5b0 100644 --- a/discourse/discourse.php +++ b/discourse/discourse.php @@ -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; diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index bfcc504d..6c1742e4 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -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; diff --git a/fancybox/fancybox.php b/fancybox/fancybox.php index b96a90d3..1a9ff634 100644 --- a/fancybox/fancybox.php +++ b/fancybox/fancybox.php @@ -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( '#]*href="([^"]*)"[^>]*>(]*src="[^"]*"[^>]*>)#', '$2', diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index c3b2cff5..61d3efd4 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -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'][] = ''; } -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; diff --git a/fromapp/fromapp.php b/fromapp/fromapp.php index 94aac63b..0d5a5b16 100644 --- a/fromapp/fromapp.php +++ b/fromapp/fromapp.php @@ -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; diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 7830b330..5cb90efd 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -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'] ?? '')); diff --git a/geonames/geonames.php b/geonames/geonames.php index c3ba1ca8..dcbd65f8 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -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; diff --git a/gnot/gnot.php b/gnot/gnot.php index e3594b14..15fb4da0 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -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; diff --git a/googlemaps/googlemaps.php b/googlemaps/googlemaps.php index 5edc4cab..356ce68c 100644 --- a/googlemaps/googlemaps.php +++ b/googlemaps/googlemaps.php @@ -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; diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index c026d863..83a8fbb9 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -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'); diff --git a/group_text/group_text.php b/group_text/group_text.php index b89cd275..8520f696 100644 --- a/group_text/group_text.php +++ b/group_text/group_text.php @@ -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; diff --git a/highlightjs/highlightjs.php b/highlightjs/highlightjs.php index 39f804ae..097d34c7 100644 --- a/highlightjs/highlightjs.php +++ b/highlightjs/highlightjs.php @@ -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'); diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 3906fd0a..d0606fac 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -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; diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 613b4133..55d3fb05 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -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; diff --git a/impressum/impressum.php b/impressum/impressum.php index 52c91de0..f2564a50 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -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 .= '

' . DI::l10n()->t('Impressum') . '

'; $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, [ diff --git a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php index ce0c3cda..b602d4ad 100644 --- a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php +++ b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php @@ -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'][] = ''; } @@ -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 = ''; diff --git a/irc/irc.php b/irc/irc.php index 0cec5622..8bd05fb7 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -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'][] = ''; } @@ -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/' ); diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index e93ce7d6..089cb7e2 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -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; diff --git a/keycloakpassword/keycloakpassword.php b/keycloakpassword/keycloakpassword.php index 7a417805..bfff4ea4 100644 --- a/keycloakpassword/keycloakpassword.php +++ b/keycloakpassword/keycloakpassword.php @@ -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; diff --git a/krynn/krynn.php b/krynn/krynn.php index 48a65fdd..f7e77c26 100644 --- a/krynn/krynn.php +++ b/krynn/krynn.php @@ -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; diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 31efad3b..020a32df 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -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; } diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index 17ff4e47..38e2d6a1 100644 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -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'])) { diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index 0945df0e..f6c65399 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -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'); diff --git a/libertree/libertree.php b/libertree/libertree.php index c4d8ce45..0a909f35 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -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'); diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 141ce737..54594b88 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -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) { $default_avatar = DI::config()->get('libravatar', 'default_avatar'); if (empty($default_avatar)) { @@ -57,7 +56,7 @@ function libravatar_lookup(array $a, array &$b) /** * Display admin settings for this addon */ -function libravatar_addon_admin(App $a, string &$o) +function libravatar_addon_admin(string &$o) { $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/libravatar'); @@ -88,7 +87,7 @@ function libravatar_addon_admin(App $a, string &$o) /** * Save admin settings */ -function libravatar_addon_admin_post(App $a) +function libravatar_addon_admin_post() { DI::config()->set('libravatar', 'default_avatar', trim($_POST['avatar'] ?? 'identicon')); } diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 9f5cd65c..f6f2b79a 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -29,7 +29,7 @@ function ljpost_install() Hook::register('connector_settings_post', 'addon/ljpost/ljpost.php', 'ljpost_settings_post'); } -function ljpost_jot_nets(App &$a, array &$jotnets_fields) +function ljpost_jot_nets(array &$jotnets_fields) { if (!DI::userSession()->getLocalUserId()) { return; @@ -47,7 +47,7 @@ function ljpost_jot_nets(App &$a, array &$jotnets_fields) } } -function ljpost_settings(App &$a, array &$data) +function ljpost_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -74,7 +74,7 @@ function ljpost_settings(App &$a, array &$data) ]; } -function ljpost_settings_post(App $a, array &$b) +function ljpost_settings_post(array &$b) { if (!empty($_POST['ljpost-submit'])) { DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ljpost', 'post', intval($_POST['ljpost'])); @@ -84,7 +84,7 @@ function ljpost_settings_post(App $a, array &$b) } } -function ljpost_post_local(App $a, array &$b) +function ljpost_post_local(array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint if ($b['edit']) { @@ -116,7 +116,7 @@ function ljpost_post_local(App $a, array &$b) $b['postopts'] .= 'ljpost'; } -function ljpost_send(App $a, array &$b) +function ljpost_send(array &$b) { if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return; diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 68ec78b9..bf4c9906 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -67,10 +67,9 @@ function mailstream_module() {} /** * Adds an item in "addon features" in the admin menu of the site * - * @param App $a App object (unused) * @param string $o HTML form data */ -function mailstream_addon_admin(App $a, string &$o) +function mailstream_addon_admin(string &$o) { $frommail = DI::config()->get('mailstream', 'frommail'); $template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/'); @@ -111,7 +110,7 @@ function mailstream_generate_id(string $uri): string return $message_id; } -function mailstream_send_hook(App $a, array $data) +function mailstream_send_hook(array $data) { $criteria = array('uid' => $data['uid'], 'contact-id' => $data['contact-id'], 'uri' => $data['uri']); $item = Post::selectFirst([], $criteria); @@ -139,11 +138,10 @@ function mailstream_send_hook(App $a, array $data) * mailstream is enabled and the necessary data is available, forks a * workerqueue item to send the email. * - * @param App $a App object (unused) * @param array $item content of the item (may or may not already be stored in the item table) * @return void */ -function mailstream_post_hook(App $a, array &$item) +function mailstream_post_hook(array &$item) { mailstream_check_version(); @@ -477,11 +475,10 @@ function mailstream_convert_table_entries() /** * Form for configuring mailstream features for a user * - * @param App $a App object * @param array $data Hook data array * @throws \Friendica\Network\HTTPException\ServiceUnavailableException */ -function mailstream_addon_settings(App &$a, array &$data) +function mailstream_addon_settings(array &$data) { $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled'); $address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address'); @@ -525,11 +522,10 @@ function mailstream_addon_settings(App &$a, array &$data) /** * Process data submitted to user's mailstream features form - * @param App $a * @param array $post POST data * @return void */ -function mailstream_addon_settings_post(App $a, array $post) +function mailstream_addon_settings_post(array $post) { if (!DI::userSession()->getLocalUserId() || empty($post['mailstream-submit'])) { return; diff --git a/markdown/markdown.php b/markdown/markdown.php index ffc46ac5..236fb297 100644 --- a/markdown/markdown.php +++ b/markdown/markdown.php @@ -17,7 +17,7 @@ function markdown_install() { Hook::register('addon_settings_post', __FILE__, 'markdown_addon_settings_post'); } -function markdown_addon_settings(App $a, array &$data) +function markdown_addon_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -37,7 +37,7 @@ function markdown_addon_settings(App $a, array &$data) ]; } -function markdown_addon_settings_post(App $a, array &$b) +function markdown_addon_settings_post(array &$b) { if (!DI::userSession()->getLocalUserId() || empty($_POST['markdown-submit'])) { return; @@ -46,7 +46,7 @@ function markdown_addon_settings_post(App $a, array &$b) DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'markdown', 'enabled', intval($_POST['enabled'])); } -function markdown_post_local_start(App $a, &$request) { +function markdown_post_local_start(&$request) { if (empty($request['body']) || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'markdown', 'enabled')) { return; } diff --git a/mastodoncustomemojis/mastodoncustomemojis.php b/mastodoncustomemojis/mastodoncustomemojis.php index 40dac01f..c84f1a4f 100644 --- a/mastodoncustomemojis/mastodoncustomemojis.php +++ b/mastodoncustomemojis/mastodoncustomemojis.php @@ -27,7 +27,7 @@ function mastodoncustomemojis_install() Hook::register('contacts_mod_init', __FILE__, 'mastodoncustomemojis_css_hook'); } -function mastodoncustomemojis_css_hook(App $a) +function mastodoncustomemojis_css_hook() { DI::page()['htmlhead'] .= << @@ -42,7 +42,7 @@ function mastodoncustomemojis_css_hook(App $a) HTML; } -function mastodoncustomemojis_put_item_in_cache(App $a, array &$hook_data) +function mastodoncustomemojis_put_item_in_cache(array &$hook_data) { // Mastodon uses OStatus and ActivityPub, skipping other network protocols if (empty($hook_data['item']['author-link']) || !in_array($hook_data['item']['network'], [Protocol::OSTATUS, Protocol::ACTIVITYPUB])) { diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index b60254bd..d0046cf7 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -20,7 +20,7 @@ function mathjax_install() Hook::register('addon_settings_post', __FILE__, 'mathjax_settings_post'); } -function mathjax_settings_post(App $a) +function mathjax_settings_post() { if (!DI::userSession()->getLocalUserId() || empty($_POST['mathjax-submit'])) { return; @@ -29,7 +29,7 @@ function mathjax_settings_post(App $a) DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'mathjax', 'use', intval($_POST['mathjax_use'])); } -function mathjax_settings(App $a, array &$data) +function mathjax_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -50,7 +50,7 @@ function mathjax_settings(App $a, array &$data) ]; } -function mathjax_footer(App $a, string &$body) +function mathjax_footer(string &$body) { // if the visitor of the page is not a local_user, use MathJax // otherwise check the users settings. diff --git a/membersince/membersince.php b/membersince/membersince.php index 408de60e..f8128eb7 100644 --- a/membersince/membersince.php +++ b/membersince/membersince.php @@ -17,9 +17,9 @@ function membersince_install() Hook::register('profile_advanced', 'addon/membersince/membersince.php', 'membersince_display'); } -function membersince_display(App $a, array &$b) +function membersince_display(array &$b) { - if ($a->getCurrentTheme() == 'frio') { + if (DI::app()->getCurrentTheme() == 'frio') { // Works in Frio. $doc = new DOMDocument(); $doc->loadHTML(mb_convert_encoding($b, 'HTML-ENTITIES', 'UTF-8')); @@ -39,7 +39,7 @@ function membersince_display(App $a, array &$b) $label->setAttribute('class', 'col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted'); // The div for the register date of the profile owner. - $entry = $doc->createElement('div', DateTimeFormat::local($a->profile['register_date'])); + $entry = $doc->createElement('div', DateTimeFormat::local(DI::app()->profile['register_date'])); $entry->setAttribute('class', 'col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry'); $div->appendChild($hr); @@ -50,6 +50,6 @@ function membersince_display(App $a, array &$b) $b = $doc->saveHTML(); } else { // Works in Vier. - $b = preg_replace('/<\/dl>/', "\n\n\n
\n
" . DI::l10n()->t('Member since:') . "
\n
" . DateTimeFormat::local($a->profile['register_date']) . "
\n
", $b, 1); + $b = preg_replace('/<\/dl>/', "\n\n\n
\n
" . DI::l10n()->t('Member since:') . "
\n
" . DateTimeFormat::local(DI::app()->profile['register_date']) . "
\n
", $b, 1); } } diff --git a/monolog/monolog.php b/monolog/monolog.php index f89feafe..efdcb3fe 100644 --- a/monolog/monolog.php +++ b/monolog/monolog.php @@ -14,7 +14,7 @@ use Psr\Log\LogLevel; require_once __DIR__ . '/vendor/autoload.php'; -function monolog_install(App $a) +function monolog_install() { Hook::register('logger_instance' , __FILE__, 'monolog_instance'); } @@ -24,7 +24,7 @@ function monolog_uninstall() Hook::unregister('logger_instance', __FILE__, 'monolog_instance'); } -function monolog_instance(App $a, array &$data) +function monolog_instance(array &$data) { if ($data['name'] !== 'monolog') { return; diff --git a/morechoice/morechoice.php b/morechoice/morechoice.php index 6ccb3d6d..fe726d27 100644 --- a/morechoice/morechoice.php +++ b/morechoice/morechoice.php @@ -19,7 +19,7 @@ function morechoice_install() { Hook::register('marital_selector', 'addon/morechoice/morechoice.php', 'morechoice_marital_selector'); } -function morechoice_gender_selector(App $a, array &$b) { +function morechoice_gender_selector(array &$b) { $b['Androgyne'] = DI::l10n()->t('Androgyne'); $b['Bear'] = DI::l10n()->t('Bear'); $b['Bigender'] = DI::l10n()->t('Bigender'); @@ -45,7 +45,7 @@ function morechoice_gender_selector(App $a, array &$b) { $b['Hard to tell these days'] = DI::l10n()->t('Hard to tell these days'); } -function morechoice_sexpref_selector(App $a, array &$b) { +function morechoice_sexpref_selector(array &$b) { $b['Girls with big tits'] = DI::l10n()->t('Girls with big tits'); $b['Millionaires'] = DI::l10n()->t('Millionaires'); $b['Guys with big schlongs'] = DI::l10n()->t('Guys with big schlongs'); @@ -98,7 +98,7 @@ function morechoice_sexpref_selector(App $a, array &$b) { $b['I\'d rather just have some chocolate'] = DI::l10n()->t('I\'d rather just have some chocolate'); } -function morechoice_marital_selector(App $a, array &$b) { +function morechoice_marital_selector(array &$b) { $b['Married to my job'] = DI::l10n()->t('Married to my job'); $b['Polygamist'] = DI::l10n()->t('Polygamist'); $b['Half married'] = DI::l10n()->t('Half married'); diff --git a/morepokes/morepokes.php b/morepokes/morepokes.php index 73a1e98c..abe59a6e 100644 --- a/morepokes/morepokes.php +++ b/morepokes/morepokes.php @@ -16,7 +16,7 @@ function morepokes_install() Hook::register('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs'); } -function morepokes_poke_verbs(App $a, array &$b) +function morepokes_poke_verbs(array &$b) { $b['bitchslap'] = ['bitchslapped', DI::l10n()->t('bitchslap'), DI::l10n()->t('bitchslapped')]; $b['shag'] = ['shag', DI::l10n()->t('shag'), DI::l10n()->t('shagged')]; diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index 15fb333d..5689971b 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -19,7 +19,7 @@ function newmemberwidget_install() Logger::notice('newmemberwidget installed'); } -function newmemberwidget_network_mod_init (App $a, $b) +function newmemberwidget_network_mod_init ($b) { if (empty($_SESSION['new_member'])) { return; @@ -46,7 +46,7 @@ function newmemberwidget_network_mod_init (App $a, $b) DI::page()['aside'] = $t . DI::page()['aside']; } -function newmemberwidget_addon_admin_post(App $a) +function newmemberwidget_addon_admin_post() { DI::config()->set('newmemberwidget', 'freetext', (!empty($_POST['freetext']) ? trim($_POST['freetext']) : "")); DI::config()->set('newmemberwidget', 'linkglobalsupport', intval($_POST['linkglobalsupport'])); @@ -54,7 +54,7 @@ function newmemberwidget_addon_admin_post(App $a) DI::config()->set('newmemberwidget', 'localsupport', trim($_POST['localsupportname'] ?? '')); } -function newmemberwidget_addon_admin(App $a, string &$o) +function newmemberwidget_addon_admin(string &$o) { $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget'); diff --git a/nitter/nitter.php b/nitter/nitter.php index 440f199f..e9454c5d 100644 --- a/nitter/nitter.php +++ b/nitter/nitter.php @@ -35,7 +35,7 @@ function nitter_install() /* Handle the send data from the admin settings */ -function nitter_addon_admin_post(App $a) +function nitter_addon_admin_post() { DI::config()->set('nitter', 'server', rtrim(trim($_POST['nitterserver']), '/')); } @@ -43,7 +43,7 @@ function nitter_addon_admin_post(App $a) /* Hook into the admin settings to let the admin choose a * nitter server to use for the replacement. */ -function nitter_addon_admin(App $a, string &$o) +function nitter_addon_admin(string &$o) { $nitterserver = DI::config()->get('nitter', 'server'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nitter/'); @@ -57,7 +57,7 @@ function nitter_addon_admin(App $a, string &$o) /* * replace "twitter.com" with "nitter.net" */ -function nitter_render(App $a, array &$b) +function nitter_render(array &$b) { // this needs to be a system setting $replaced = false; diff --git a/nominatim/nominatim.php b/nominatim/nominatim.php index a660b2ec..6ad4a8a3 100644 --- a/nominatim/nominatim.php +++ b/nominatim/nominatim.php @@ -65,12 +65,12 @@ function nominatim_resolve_item(array &$item) } } -function nominatim_post_hook(App $a, array &$item) +function nominatim_post_hook(array &$item) { nominatim_resolve_item($item); } -function nominatim_addon_admin(App $a, string &$o) +function nominatim_addon_admin(string &$o) { $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nominatim/'); @@ -81,7 +81,7 @@ function nominatim_addon_admin(App $a, string &$o) ]); } -function nominatim_addon_admin_post(App $a) +function nominatim_addon_admin_post() { DI::config()->set('nominatim', 'language', (!empty($_POST['language']) ? trim($_POST['language']) : '')); } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 727290b1..0c291f04 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -22,15 +22,15 @@ use Friendica\DI; */ function notifyall_module() {} -function notifyall_addon_admin(App $a, string &$o) +function notifyall_addon_admin(string &$o) { $o = '
    ' . DI::l10n()->t('Send email to all members') . '
'; } -function notifyall_post(App $a) +function notifyall_post() { - if (!$a->isSiteAdmin()) { + if (!DI::userSession()->isSiteAdmin()) { return; } @@ -67,9 +67,9 @@ function notifyall_post(App $a) DI::baseUrl()->redirect('admin'); } -function notifyall_content(App $a) +function notifyall_content() { - if (!$a->isSiteAdmin()) { + if (!DI::userSession()->isSiteAdmin()) { return ''; } diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 340cae27..2c8235dd 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -51,7 +51,7 @@ function nsfw_extract_photos($body) return $new_body; } -function nsfw_addon_settings(App &$a, array &$data) +function nsfw_addon_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -74,7 +74,7 @@ function nsfw_addon_settings(App &$a, array &$data) ]; } -function nsfw_addon_settings_post(App $a, array &$b) +function nsfw_addon_settings_post(array &$b) { if (!DI::userSession()->getLocalUserId()) { return; @@ -102,7 +102,7 @@ function nsfw_addon_settings_post(App $a, array &$b) } } -function nsfw_prepare_body_content_filter(App $a, &$hook_data) +function nsfw_prepare_body_content_filter(&$hook_data) { $words = null; if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'nsfw', 'disable')) { diff --git a/numfriends/numfriends.php b/numfriends/numfriends.php index 8532e36d..538a4a3e 100644 --- a/numfriends/numfriends.php +++ b/numfriends/numfriends.php @@ -28,7 +28,7 @@ function numfriends_install() { * and if so set our configuration setting for this person. * */ -function numfriends_settings_post(App $a, $post) { +function numfriends_settings_post($post) { if (! DI::userSession()->getLocalUserId() || empty($_POST['numfriends-submit'])) { return; } @@ -43,7 +43,7 @@ function numfriends_settings_post(App $a, $post) { * Add our own settings info to the page. * */ -function numfriends_settings(App &$a, array &$data) +function numfriends_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index cb3ae5de..3c21a51f 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -35,12 +35,12 @@ function openstreetmap_install() Logger::notice("installed openstreetmap"); } -function openstreetmap_load_config(App $a, ConfigFileManager $loader) +function openstreetmap_load_config(ConfigFileManager $loader) { - $a->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } -function openstreetmap_alterheader(App $a, &$navHtml) +function openstreetmap_alterheader(&$navHtml) { $addScriptTag = '' . "\r\n"; DI::page()['htmlhead'] .= $addScriptTag; @@ -52,10 +52,9 @@ function openstreetmap_alterheader(App $a, &$navHtml) * If an item has coordinates add link to a tile map server, e.g. openstreetmap.org. * If an item has a location open it with the help of OSM's Nominatim reverse geocode search. * - * @param mixed $a * @param array& $item */ -function openstreetmap_location(App $a, &$item) +function openstreetmap_location(array &$item) { if (!(strlen($item['location']) || strlen($item['coord']))) { return; @@ -105,7 +104,7 @@ function openstreetmap_location(App $a, &$item) $item['html'] = '' . $title . ''; } -function openstreetmap_get_coordinates(App $a, array &$b) +function openstreetmap_get_coordinates(array &$b) { $nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM); @@ -133,16 +132,16 @@ function openstreetmap_get_coordinates(App $a, array &$b) } } -function openstreetmap_generate_named_map(App $a, array &$b) +function openstreetmap_generate_named_map(array &$b) { - openstreetmap_get_coordinates($a, $b); + openstreetmap_get_coordinates($b); if (!empty($b['lat']) && !empty($b['lon'])) { - openstreetmap_generate_map($a, $b); + openstreetmap_generate_map($b); } } -function openstreetmap_generate_map(App $a, array &$b) +function openstreetmap_generate_map(array &$b) { $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS); @@ -178,7 +177,7 @@ function openstreetmap_generate_map(App $a, array &$b) Logger::debug('generate_map: ' . $b['html']); } -function openstreetmap_addon_admin(App $a, string &$o) +function openstreetmap_addon_admin(string &$o) { $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/openstreetmap/'); $tmsserver = DI::config()->get('openstreetmap', 'tmsserver', OSM_TMS); @@ -200,7 +199,7 @@ function openstreetmap_addon_admin(App $a, string &$o) ]); } -function openstreetmap_addon_admin_post(App $a) +function openstreetmap_addon_admin_post() { DI::config()->set('openstreetmap', 'tmsserver', ($_POST['tmsserver'] ?? '') ?: OSM_TMS); DI::config()->set('openstreetmap', 'nomserver', ($_POST['nomserver'] ?? '') ?: OSM_NOM); diff --git a/opmlexport/opmlexport.php b/opmlexport/opmlexport.php index e8d7157d..fdfacc3e 100644 --- a/opmlexport/opmlexport.php +++ b/opmlexport/opmlexport.php @@ -26,7 +26,7 @@ function opmlexport_install() } -function opmlexport(App $a) +function opmlexport() { $condition = [ 'uid' => DI::userSession()->getLocalUserId(), @@ -68,7 +68,7 @@ function opmlexport(App $a) } -function opmlexport_addon_settings(App $a, array &$data) +function opmlexport_addon_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -82,11 +82,11 @@ function opmlexport_addon_settings(App $a, array &$data) } -function opmlexport_addon_settings_post(App $a, array &$b) +function opmlexport_addon_settings_post(array &$b) { if (!DI::userSession()->getLocalUserId() || empty($_POST['opmlexport-submit'])) { return; } - opmlexport($a); + opmlexport(); } diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index 0f369268..057bb863 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -17,9 +17,9 @@ function pageheader_install() { Hook::register('page_content_top', __FILE__, 'pageheader_fetch'); } -function pageheader_addon_admin(App &$a, string &$s) +function pageheader_addon_admin(string &$s) { - if (!$a->isSiteAdmin()) { + if (!DI::userSession()->isSiteAdmin()) { return; } @@ -39,9 +39,9 @@ function pageheader_addon_admin(App &$a, string &$s) return; } -function pageheader_addon_admin_post(App $a) +function pageheader_addon_admin_post() { - if (!$a->isSiteAdmin()) { + if (!DI::userSession()->isSiteAdmin()) { return; } @@ -52,7 +52,7 @@ function pageheader_addon_admin_post(App $a) } } -function pageheader_fetch(App $a, string &$b) +function pageheader_fetch(string &$b) { if (file_exists('pageheader.html')) { $s = file_get_contents('pageheader.html'); diff --git a/phpmailer/phpmailer.php b/phpmailer/phpmailer.php index 46ae1df3..4c12709d 100644 --- a/phpmailer/phpmailer.php +++ b/phpmailer/phpmailer.php @@ -23,16 +23,15 @@ function phpmailer_install() Hook::register('emailer_send_prepare', __FILE__, 'phpmailer_emailer_send_prepare', 5); } -function phpmailer_load_config(App $a, ConfigFileManager $loader) +function phpmailer_load_config(ConfigFileManager $loader) { - $a->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } /** - * @param App $a * @param IEmail $email */ -function phpmailer_emailer_send_prepare(App $a, IEmail &$email) +function phpmailer_emailer_send_prepare(IEmail &$email) { // Passing `true` enables exceptions $mailer = new PHPMailer(true); diff --git a/piwik/piwik.php b/piwik/piwik.php index 23255c18..ad2bed75 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -48,12 +48,12 @@ function piwik_install() { Logger::notice("installed piwik addon"); } -function piwik_load_config(App $a, ConfigFileManager $loader) +function piwik_load_config(ConfigFileManager $loader) { - $a->getConfigCache()->load($loader->loadAddonConfig('piwik'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('piwik'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } -function piwik_analytics(App $a, string &$b) +function piwik_analytics(string &$b) { /* * styling of every HTML block added by this addon is done in the @@ -94,7 +94,7 @@ function piwik_analytics(App $a, string &$b) $b .= ""; } } -function piwik_addon_admin (App $a, string &$o) +function piwik_addon_admin (string &$o) { $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" ); @@ -107,7 +107,7 @@ function piwik_addon_admin (App $a, string &$o) ]); } -function piwik_addon_admin_post(App $a) +function piwik_addon_admin_post() { DI::config()->set('piwik', 'baseurl', trim($_POST['baseurl'] ?? '')); DI::config()->set('piwik', 'siteid', trim($_POST['siteid'] ?? '')); diff --git a/planets/planets.php b/planets/planets.php index 35a677ae..8a206fb5 100644 --- a/planets/planets.php +++ b/planets/planets.php @@ -38,7 +38,7 @@ function planets_install() * - A status post by a profile owner * - The profile owner must have allowed our addon */ -function planets_post_hook(App $a, &$item) +function planets_post_hook(&$item) { Logger::notice('planets invoked'); @@ -93,7 +93,7 @@ function planets_post_hook(App $a, &$item) * */ -function planets_settings_post(App $a, $post) +function planets_settings_post($post) { if (!DI::userSession()->getLocalUserId()) { return; @@ -113,7 +113,7 @@ function planets_settings_post(App $a, $post) -function planets_settings(App &$a, array &$data) +function planets_settings(array &$data) { if(!DI::userSession()->getLocalUserId()) { return; diff --git a/public_server/public_server.php b/public_server/public_server.php index 5bc08821..79201007 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -27,12 +27,12 @@ function public_server_install() Hook::register('logged_in', 'addon/public_server/public_server.php', 'public_server_login'); } -function public_server_load_config(App $a, ConfigFileManager $loader) +function public_server_load_config(ConfigFileManager $loader) { - $a->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } -function public_server_register_account(App $a, $b) +function public_server_register_account($b) { $uid = $b; @@ -46,7 +46,7 @@ function public_server_register_account(App $a, $b) DBA::update('user', $fields, ['uid' => $uid]); } -function public_server_cron(App $a, $b) +function public_server_cron($b) { Logger::notice("public_server: cron start"); @@ -100,7 +100,7 @@ function public_server_cron(App $a, $b) Logger::notice("public_server: cron end"); } -function public_server_enotify(App $a, array &$b) +function public_server_enotify(array &$b) { if (!empty($b['params']) && $b['params']['type'] == Notification\Type::SYSTEM && !empty($b['params']['system_type']) && $b['params']['system_type'] === 'public_server_expire') { @@ -111,7 +111,7 @@ function public_server_enotify(App $a, array &$b) } } -function public_server_login(App $a, $b) +function public_server_login($b) { $days = DI::config()->get('public_server', 'expiredays'); if (!$days) { @@ -123,7 +123,7 @@ function public_server_login(App $a, $b) DBA::update('user', $fields, $condition); } -function public_server_addon_admin_post(App $a) +function public_server_addon_admin_post() { BaseModule::checkFormSecurityTokenRedirectOnError('/admin/addons/publicserver', 'publicserver'); @@ -135,7 +135,7 @@ function public_server_addon_admin_post(App $a) DI::config()->set('public_server', 'flagpostsexpire', trim($_POST['flagpostsexpire'] ?? '')); } -function public_server_addon_admin(App $a, string &$o) +function public_server_addon_admin(string &$o) { $token = BaseModule::getFormSecurityToken('publicserver'); $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/public_server'); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 6ff7a12e..11cac8cd 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -56,7 +56,7 @@ function pumpio_install() */ function pumpio_module() {} -function pumpio_content(App $a) +function pumpio_content() { if (!DI::userSession()->getLocalUserId()) { DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); @@ -66,7 +66,7 @@ function pumpio_content(App $a) if (isset(DI::args()->getArgv()[1])) { switch (DI::args()->getArgv()[1]) { case 'connect': - $o = pumpio_connect($a); + $o = pumpio_connect(); break; default: @@ -74,12 +74,12 @@ function pumpio_content(App $a) break; } } else { - $o = pumpio_connect($a); + $o = pumpio_connect(); } return $o; } -function pumpio_check_item_notification(App $a, array &$notification_data) +function pumpio_check_item_notification(array &$notification_data) { $hostname = DI::pConfig()->get($notification_data['uid'], 'pumpio', 'host'); $username = DI::pConfig()->get($notification_data['uid'], 'pumpio', 'user'); @@ -87,7 +87,7 @@ function pumpio_check_item_notification(App $a, array &$notification_data) $notification_data['profiles'][] = 'https://' . $hostname . '/' . $username; } -function pumpio_registerclient(App $a, $host) +function pumpio_registerclient($host) { $url = 'https://' . $host . '/api/client/register'; @@ -131,7 +131,7 @@ function pumpio_registerclient(App $a, $host) } -function pumpio_connect(App $a) +function pumpio_connect() { // Define the needed keys $consumer_key = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key'); @@ -140,7 +140,7 @@ function pumpio_connect(App $a) if ((($consumer_key == '') || ($consumer_secret == '')) && ($hostname != '')) { Logger::notice('pumpio_connect: register client'); - $clientdata = pumpio_registerclient($a, $hostname); + $clientdata = pumpio_registerclient($hostname); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key', $clientdata->client_id); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_secret', $clientdata->client_secret); @@ -203,7 +203,7 @@ function pumpio_connect(App $a) return $o; } -function pumpio_jot_nets(App $a, array &$jotnets_fields) +function pumpio_jot_nets(array &$jotnets_fields) { if (!DI::userSession()->getLocalUserId()) { return; @@ -221,7 +221,7 @@ function pumpio_jot_nets(App $a, array &$jotnets_fields) } } -function pumpio_settings(App $a, array &$data) +function pumpio_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -272,7 +272,7 @@ function pumpio_settings(App $a, array &$data) ]; } -function pumpio_settings_post(App $a, array &$b) +function pumpio_settings_post(array &$b) { if (!empty($_POST['pumpio_delete'])) { DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key' , ''); @@ -318,12 +318,12 @@ function pumpio_settings_post(App $a, array &$b) } } -function pumpio_load_config(App $a, ConfigFileManager $loader) +function pumpio_load_config(ConfigFileManager $loader) { - $a->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } -function pumpio_hook_fork(App $a, array &$b) +function pumpio_hook_fork(array &$b) { if ($b['name'] != 'notifier_normal') { return; @@ -359,7 +359,7 @@ function pumpio_hook_fork(App $a, array &$b) } } -function pumpio_post_local(App $a, array &$b) +function pumpio_post_local(array &$b) { if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) { return; @@ -384,7 +384,7 @@ function pumpio_post_local(App $a, array &$b) $b['postopts'] .= 'pumpio'; } -function pumpio_send(App $a, array &$b) +function pumpio_send(array &$b) { if (!DI::pConfig()->get($b['uid'], 'pumpio', 'import') && ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))) { return; @@ -408,7 +408,7 @@ function pumpio_send(App $a, array &$b) } else { $iscomment = false; - $receiver = pumpio_getreceiver($a, $b); + $receiver = pumpio_getreceiver($b); Logger::notice('pumpio_send: receiver ', $receiver); @@ -426,9 +426,9 @@ function pumpio_send(App $a, array &$b) if ($b['verb'] == Activity::LIKE) { if ($b['deleted']) { - pumpio_action($a, $b['uid'], $b['thr-parent'], 'unlike'); + pumpio_action($b['uid'], $b['thr-parent'], 'unlike'); } else { - pumpio_action($a, $b['uid'], $b['thr-parent'], 'like'); + pumpio_action($b['uid'], $b['thr-parent'], 'like'); } return; } @@ -438,11 +438,11 @@ function pumpio_send(App $a, array &$b) } if (($b['verb'] == Activity::POST) && ($b['created'] !== $b['edited']) && !$b['deleted']) { - pumpio_action($a, $b['uid'], $b['uri'], 'update', $b['body']); + pumpio_action($b['uid'], $b['uri'], 'update', $b['body']); } if (($b['verb'] == Activity::POST) && $b['deleted']) { - pumpio_action($a, $b['uid'], $b['uri'], 'delete'); + pumpio_action($b['uid'], $b['uri'], 'delete'); } if ($b['deleted'] || ($b['created'] !== $b['edited'])) { @@ -556,7 +556,7 @@ function pumpio_send(App $a, array &$b) } } -function pumpio_action(App $a, int $uid, string $uri, string $action, string $content = '') +function pumpio_action(int $uid, string $uri, string $action, string $content = '') { // Don't do likes and other stuff if you don't import the timeline if (!DI::pConfig()->get($uid, 'pumpio', 'import')) { @@ -625,7 +625,7 @@ function pumpio_action(App $a, int $uid, string $uri, string $action, string $co } } -function pumpio_sync(App $a) +function pumpio_sync() { if (!Addon::isEnabled('pumpio')) { return; @@ -647,7 +647,7 @@ function pumpio_sync(App $a) $pconfigs = DBA::selectToArray('pconfig', ['uid'], ['cat' => 'pumpio', 'k' => 'mirror', 'v' => '1']); foreach ($pconfigs as $rr) { Logger::notice('pumpio: mirroring user '.$rr['uid']); - pumpio_fetchtimeline($a, $rr['uid']); + pumpio_fetchtimeline($rr['uid']); } $abandon_days = intval(DI::config()->get('system', 'account_abandon_days')); @@ -667,7 +667,7 @@ function pumpio_sync(App $a) } Logger::notice('pumpio: importing timeline from user '.$rr['uid']); - pumpio_fetchinbox($a, $rr['uid']); + pumpio_fetchinbox($rr['uid']); // check for new contacts once a day $last_contact_check = DI::pConfig()->get($rr['uid'], 'pumpio', 'contact_check'); @@ -678,7 +678,7 @@ function pumpio_sync(App $a) } if ($next_contact_check <= time()) { - pumpio_getallusers($a, $rr['uid']); + pumpio_getallusers($rr['uid']); DI::pConfig()->set($rr['uid'], 'pumpio', 'contact_check', time()); } } @@ -688,12 +688,12 @@ function pumpio_sync(App $a) DI::keyValue()->set('pumpio_last_poll', time()); } -function pumpio_cron(App $a, $b) +function pumpio_cron($b) { Worker::add(Worker::PRIORITY_MEDIUM, 'addon/pumpio/pumpio_sync.php'); } -function pumpio_fetchtimeline(App $a, int $uid) +function pumpio_fetchtimeline(int $uid) { $ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key'); $csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret'); @@ -814,7 +814,7 @@ function pumpio_fetchtimeline(App $a, int $uid) } } -function pumpio_dounlike(App $a, int $uid, array $self, $post, string $own_id) +function pumpio_dounlike(int $uid, array $self, $post, string $own_id) { // Searching for the unliked post // Two queries for speed issues @@ -850,7 +850,7 @@ function pumpio_dounlike(App $a, int $uid, array $self, $post, string $own_id) } } -function pumpio_dolike(App $a, int $uid, array $self, $post, string $own_id, $threadcompletion = true) +function pumpio_dolike(int $uid, array $self, $post, string $own_id, $threadcompletion = true) { if (empty($post->object->id)) { Logger::info('Got empty like: '.print_r($post, true)); @@ -869,7 +869,7 @@ function pumpio_dolike(App $a, int $uid, array $self, $post, string $own_id, $th // thread completion if ($threadcompletion) { - pumpio_fetchallcomments($a, $uid, $post->object->id); + pumpio_fetchallcomments($uid, $post->object->id); } $contactid = 0; @@ -988,7 +988,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) return $contact_id; } -function pumpio_dodelete(App $a, int $uid, array $self, $post, string $own_id) +function pumpio_dodelete(int $uid, array $self, $post, string $own_id) { // Two queries for speed issues $condition = ['uri' => $post->object->id, 'uid' => $uid]; @@ -1005,18 +1005,18 @@ function pumpio_dodelete(App $a, int $uid, array $self, $post, string $own_id) return false; } -function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $own_id, bool $threadcompletion = true) +function pumpio_dopost($client, int $uid, array $self, $post, string $own_id, bool $threadcompletion = true) { if (($post->verb == 'like') || ($post->verb == 'favorite')) { - return pumpio_dolike($a, $uid, $self, $post, $own_id); + return pumpio_dolike($uid, $self, $post, $own_id); } if (($post->verb == 'unlike') || ($post->verb == 'unfavorite')) { - return pumpio_dounlike($a, $uid, $self, $post, $own_id); + return pumpio_dounlike($uid, $self, $post, $own_id); } if ($post->verb == 'delete') { - return pumpio_dodelete($a, $uid, $self, $post, $own_id); + return pumpio_dodelete($uid, $self, $post, $own_id); } if ($post->verb != 'update') { @@ -1110,7 +1110,7 @@ function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $ow $reply->generator->displayName = 'pumpio'; $reply->published = $post->object->inReplyTo->published; $reply->received = $post->object->inReplyTo->updated; - pumpio_dopost($a, $client, $uid, $self, $reply, $own_id, false); + pumpio_dopost($client, $uid, $self, $reply, $own_id, false); $postarray['thr-parent'] = $post->object->inReplyTo->id; } @@ -1195,13 +1195,13 @@ function pumpio_dopost(App $a, $client, int $uid, array $self, $post, string $ow } if (($post->object->objectType == 'comment') && $threadcompletion) { - pumpio_fetchallcomments($a, $uid, $postarray['thr-parent']); + pumpio_fetchallcomments($uid, $postarray['thr-parent']); } return $top_item; } -function pumpio_fetchinbox(App $a, int $uid) +function pumpio_fetchinbox(int $uid) { $ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key'); $csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret'); @@ -1254,20 +1254,20 @@ function pumpio_fetchinbox(App $a, int $uid) if (count($posts)) { foreach ($posts as $post) { $last_id = $post->id; - pumpio_dopost($a, $client, $uid, $self, $post, $own_id, true); + pumpio_dopost($client, $uid, $self, $post, $own_id, true); } } } while ($item = DBA::fetch($lastitems)) { - pumpio_fetchallcomments($a, $uid, $item['uri']); + pumpio_fetchallcomments($uid, $item['uri']); } DBA::close($lastitems); DI::pConfig()->set($uid, 'pumpio', 'last_id', $last_id); } -function pumpio_getallusers(App &$a, int $uid) +function pumpio_getallusers(int $uid) { $ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key'); $csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret'); @@ -1315,7 +1315,7 @@ function pumpio_getallusers(App &$a, int $uid) } } -function pumpio_getreceiver(App $a, array $b) +function pumpio_getreceiver(array $b) { $receiver = []; @@ -1394,7 +1394,7 @@ function pumpio_getreceiver(App $a, array $b) return $receiver; } -function pumpio_fetchallcomments(App $a, $uid, $id) +function pumpio_fetchallcomments($uid, $id) { $ckey = DI::pConfig()->get($uid, 'pumpio', 'consumer_key'); $csecret = DI::pConfig()->get($uid, 'pumpio', 'consumer_secret'); @@ -1454,7 +1454,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) $like->actor->url = $item->url; $like->generator = new stdClass; $like->generator->displayName = 'pumpio'; - pumpio_dolike($a, $uid, $self, $post, $own_id, false); + pumpio_dolike($uid, $self, $post, $own_id, false); } } @@ -1492,7 +1492,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) $post->object = $item; Logger::notice('pumpio_fetchallcomments: posting comment ' . $post->object->id . ' ', json_decode(json_encode($post), true)); - pumpio_dopost($a, $client, $uid, $self, $post, $own_id, false); + pumpio_dopost($client, $uid, $self, $post, $own_id, false); } } diff --git a/pumpio/pumpio_sync.php b/pumpio/pumpio_sync.php index 892b6ad4..beaf6e81 100644 --- a/pumpio/pumpio_sync.php +++ b/pumpio/pumpio_sync.php @@ -3,8 +3,6 @@ use Friendica\Core\Logger; use Friendica\DI; function pumpio_sync_run(array $argv, int $argc) { - $a = Friendica\DI::app(); - require_once 'addon/pumpio/pumpio.php'; if (function_exists('sys_getloadavg')) { @@ -15,5 +13,5 @@ function pumpio_sync_run(array $argv, int $argc) { } } - pumpio_sync($a); + pumpio_sync(); } diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index d4d88e8e..1b8bfcbf 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -31,12 +31,12 @@ function qcomment_install() Hook::register('footer' , __FILE__, 'qcomment_footer'); } -function qcomment_footer(App $a, string &$body) +function qcomment_footer(string &$body) { DI::page()->registerFooterScript('addon/qcomment/qcomment.js'); } -function qcomment_addon_settings(App &$a, array &$data) +function qcomment_addon_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -57,7 +57,7 @@ function qcomment_addon_settings(App &$a, array &$data) ]; } -function qcomment_addon_settings_post(App $a, array &$b) +function qcomment_addon_settings_post(array &$b) { if (!DI::userSession()->getLocalUserId()) { return; diff --git a/randplace/randplace.php b/randplace/randplace.php index badc1c9e..34f48c6c 100644 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -54,7 +54,7 @@ function randplace_uninstall() Logger::notice("removed randplace"); } -function randplace_post_hook(App $a, &$item) +function randplace_post_hook(&$item) { /* * An item was posted on the local system. @@ -120,7 +120,7 @@ function randplace_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 randplace_settings_post(App $a, $post) +function randplace_settings_post($post) { if (!DI::userSession()->getLocalUserId()) { return; @@ -136,7 +136,7 @@ function randplace_settings_post(App $a, $post) * Called from the Addon Setting form. * Add our own settings info to the page. */ -function randplace_settings(App &$a, array &$data) +function randplace_settings(array &$data) { if(!DI::userSession()->getLocalUserId()) { return; diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index 3d08a740..731cf003 100644 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -22,11 +22,11 @@ function rendertime_uninstall() DI::config()->delete('system', 'profiler'); } -function rendertime_init_1(App $a) +function rendertime_init_1() { } -function rendertime_addon_admin(App $a, string &$o) +function rendertime_addon_admin(string &$o) { $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/rendertime/'); @@ -37,17 +37,16 @@ function rendertime_addon_admin(App $a, string &$o) ]); } -function rendertime_addon_admin_post(App $a) +function rendertime_addon_admin_post() { DI::config()->set('rendertime', 'callstack', $_POST['callstack'] ?? false); DI::config()->set('rendertime', 'minimal_time', $_POST['minimal_time'] ?? 0); } /** - * @param App $a * @param string $o */ -function rendertime_page_end(App $a, string &$o) +function rendertime_page_end(string &$o) { $profiler = DI::profiler(); @@ -59,7 +58,7 @@ function rendertime_page_end(App $a, string &$o) ]; $ignored = in_array(DI::router()->getModuleClass(), $ignored_modules); - if ($a->isSiteAdmin() && (($_GET['mode'] ?? '') != 'minimal') && !DI::mode()->isMobile() && !DI::mode()->isMobile() && !$ignored) { + if (DI::userSession()->isSiteAdmin() && (($_GET['mode'] ?? '') != 'minimal') && !DI::mode()->isMobile() && !DI::mode()->isMobile() && !$ignored) { $o = $o . '
' . DI::l10n()->t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s", round($profiler->get('database') - $profiler->get('database_write'), 3), diff --git a/s3_storage/s3_storage.php b/s3_storage/s3_storage.php index c4f68da9..361577be 100644 --- a/s3_storage/s3_storage.php +++ b/s3_storage/s3_storage.php @@ -14,7 +14,7 @@ use Friendica\DI; require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; -function s3_storage_install(App $a) +function s3_storage_install() { Hook::register('storage_instance' , __FILE__, 's3_storage_instance'); Hook::register('storage_config' , __FILE__, 's3_storage_config'); @@ -26,7 +26,7 @@ function s3_storage_uninstall() DI::storageManager()->unregister(S3Client::class); } -function s3_storage_instance(App $a, array &$data) +function s3_storage_instance(array &$data) { if ($data['name'] == S3Client::getName()) { $config = new S3Config(DI::l10n(), DI::config()); @@ -34,7 +34,7 @@ function s3_storage_instance(App $a, array &$data) } } -function s3_storage_config(App $a, array &$data) +function s3_storage_config(array &$data) { if ($data['name'] == S3Client::getName()) { $data['storage_config'] = new S3Config(DI::l10n(), DI::config()); diff --git a/saml/saml.php b/saml/saml.php index 95f751aa..050ac00f 100755 --- a/saml/saml.php +++ b/saml/saml.php @@ -21,11 +21,9 @@ require_once(__DIR__ . '/vendor/autoload.php'); define('PW_LEN', 32); // number of characters to use for random passwords -function saml_module($a) -{ -} +function saml_module() {} -function saml_init(App $a) +function saml_init() { if (DI::args()->getArgc() < 2) { return; @@ -41,7 +39,7 @@ function saml_init(App $a) saml_metadata(); break; case 'sso': - saml_sso_reply($a); + saml_sso_reply(); break; case 'slo': saml_slo_reply(); @@ -79,12 +77,12 @@ function saml_install() Hook::register('footer', __FILE__, 'saml_footer'); } -function saml_head(App $a, string &$body) +function saml_head(string &$body) { DI::page()->registerStylesheet(__DIR__ . '/saml.css'); } -function saml_footer(App $a, string &$body) +function saml_footer(string &$body) { $fragment = addslashes(BBCode::convert(DI::config()->get('saml', 'settings_statement'))); $body .= <<get('saml', 'idp_cert'); } -function saml_sso_initiate(App $a, string &$body) +function saml_sso_initiate(string &$body) { if (!saml_is_configured()) { Logger::warning('SAML SSO tried to trigger, but the SAML addon is not configured yet!'); @@ -124,7 +122,7 @@ function saml_sso_initiate(App $a, string &$body) exit(); } -function saml_sso_reply(App $a) +function saml_sso_reply() { $auth = new \OneLogin\Saml2\Auth(saml_settings()); $requestID = null; @@ -165,7 +163,7 @@ function saml_sso_reply(App $a) } if (!empty($user['uid'])) { - DI::auth()->setForUser($a, $user); + DI::auth()->setForUser($user); } if (isset($_POST['RelayState']) && Utils::getSelfURL() != $_POST['RelayState']) { @@ -173,7 +171,7 @@ function saml_sso_reply(App $a) } } -function saml_slo_initiate(App $a) +function saml_slo_initiate() { if (!saml_is_configured()) { Logger::warning('SAML SLO tried to trigger, but the SAML addon is not configured yet!'); @@ -224,7 +222,7 @@ function saml_input($key, $label, $description) ]; } -function saml_addon_admin(App $a, string &$o) +function saml_addon_admin(string &$o) { $form = saml_input( @@ -280,7 +278,7 @@ function saml_addon_admin(App $a, string &$o) $o = Renderer::replaceMacros($t, $form); } -function saml_addon_admin_post(App $a) +function saml_addon_admin_post() { $set = function ($key) { $val = (!empty($_POST[$key]) ? trim($_POST[$key]) : ''); diff --git a/securemail/SecureTestEmail.php b/securemail/SecureTestEmail.php index 975c7fda..2832adba 100644 --- a/securemail/SecureTestEmail.php +++ b/securemail/SecureTestEmail.php @@ -34,7 +34,7 @@ use Friendica\Object\Email; */ class SecureTestEmail extends Email { - public function __construct(App $a, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, BaseURL $baseUrl) + public function __construct(IManageConfigValues $config, IManagePersonalConfigValues $pConfig, BaseURL $baseUrl) { $sitename = $config->get('config', 'sitename'); diff --git a/securemail/securemail.php b/securemail/securemail.php index 470db0e4..5390ebd1 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -31,12 +31,11 @@ function securemail_install() * * @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#addon_settings 'addon_settings' hook * - * @param App $a App instance - * @param string $s output html + * @param array $data * * @see App */ -function securemail_settings(App &$a, array &$data) +function securemail_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -67,12 +66,11 @@ function securemail_settings(App &$a, array &$data) * * @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#addon_settings_post 'addon_settings_post' hook * - * @param App $a App instance * @param array $b hook data * * @see App */ -function securemail_settings_post(App &$a, array &$b) +function securemail_settings_post(array &$b) { if (!DI::userSession()->getLocalUserId()) { return; @@ -103,12 +101,11 @@ function securemail_settings_post(App &$a, array &$b) * * @link https://github.com/friendica/friendica/blob/develop/doc/Addons.md#emailer_send_prepare 'emailer_send_prepare' hook * - * @param App $a App instance * @param IEmail $email Email * * @see App */ -function securemail_emailer_send_prepare(App &$a, IEmail &$email) +function securemail_emailer_send_prepare(IEmail &$email) { if (empty($email->getRecipientUid())) { return; diff --git a/showmore/showmore.php b/showmore/showmore.php index aed11520..8e85925a 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -21,7 +21,7 @@ function showmore_install() Hook::register('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post'); } -function showmore_addon_settings(App &$a, array &$data) +function showmore_addon_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -45,7 +45,7 @@ function showmore_addon_settings(App &$a, array &$data) ]; } -function showmore_addon_settings_post(App $a, array &$b) +function showmore_addon_settings_post(array &$b) { if (!DI::userSession()->getLocalUserId()) { return; @@ -93,7 +93,7 @@ function get_body_length($body) return strlen($string); } -function showmore_prepare_body(App $a, &$hook_data) +function showmore_prepare_body(&$hook_data) { // No combination with content filters if (!empty($hook_data['filter_reasons'])) { diff --git a/showmore_dyn/showmore_dyn.php b/showmore_dyn/showmore_dyn.php index 5fc07722..7cb64bcc 100644 --- a/showmore_dyn/showmore_dyn.php +++ b/showmore_dyn/showmore_dyn.php @@ -24,12 +24,12 @@ function showmore_dyn_install() Hook::register('addon_settings_post', __FILE__, 'showmore_dyn_settings_post'); } -function showmore_dyn_head(App $a, string &$body) +function showmore_dyn_head(string &$body) { DI::page()->registerStylesheet(__DIR__ . '/showmore_dyn.css'); } -function showmore_dyn_footer(App $a, string &$body) +function showmore_dyn_footer(string &$body) { DI::page()->registerFooterScript(__DIR__ . '/showmore_dyn.js'); } @@ -45,7 +45,7 @@ function showmore_dyn_settings_post() } } -function showmore_dyn_settings(App &$a, array &$data) +function showmore_dyn_settings(array &$data) { if(!DI::userSession()->getLocalUserId()) { return; diff --git a/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php b/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php index 34ee7697..b76033f4 100644 --- a/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php +++ b/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php @@ -15,7 +15,7 @@ function smiley_pack_es_install() { Hook::register('smilie', 'addon/smiley_pack_es/smiley_pack_es.php', 'smiley_pack_smilies_es'); } -function smiley_pack_smilies_es(App $a, array &$b) { +function smiley_pack_smilies_es(array &$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php b/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php index 9bdce46e..feceab26 100644 --- a/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php +++ b/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php @@ -18,7 +18,7 @@ function smiley_pack_fr_install() Hook::register('smilie', 'addon/smiley_pack_fr/smiley_pack_fr.php', 'smiley_pack_fr_smilies'); } -function smiley_pack_fr_smilies(App $a, array &$b) +function smiley_pack_fr_smilies(array &$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/smiley_pack/smiley_pack.php b/smiley_pack/smiley_pack.php index d457ea8c..7892eac4 100644 --- a/smiley_pack/smiley_pack.php +++ b/smiley_pack/smiley_pack.php @@ -16,7 +16,7 @@ function smiley_pack_install() { Hook::register('smilie', 'addon/smiley_pack/smiley_pack.php', 'smiley_pack_smilies'); } -function smiley_pack_smilies(App $a, array &$b) +function smiley_pack_smilies(array &$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index dd68a8e2..1f931099 100644 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -17,11 +17,10 @@ function smileybutton_install() Hook::register('jot_tool', 'addon/smileybutton/smileybutton.php', 'smileybutton_jot_tool'); } -function smileybutton_jot_tool(App $a, string &$body) +function smileybutton_jot_tool(string &$body) { // Disable if theme is quattro - // TODO add style for quattro - if ($a->getCurrentTheme() == 'quattro') { + if (DI::app()->getCurrentTheme() == 'quattro') { return; } @@ -98,7 +97,7 @@ function smileybutton_jot_tool(App $a, string &$body) $s .= ''; //Add css to header - $css_file = __DIR__ . '/view/' . $a->getCurrentTheme() . '.css'; + $css_file = __DIR__ . '/view/' . DI::app()->getCurrentTheme() . '.css'; if (!file_exists($css_file)) { $css_file = __DIR__ . '/view/default.css'; } @@ -106,7 +105,7 @@ function smileybutton_jot_tool(App $a, string &$body) DI::page()->registerStylesheet($css_file); //Get the correct image for the theme - $image = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.png'; + $image = 'addon/smileybutton/view/' . DI::app()->getCurrentTheme() . '.png'; if (!file_exists($image)) { $image = 'addon/smileybutton/view/default.png'; } diff --git a/smilies_adult/smilies_adult.php b/smilies_adult/smilies_adult.php index 1994d915..a7e0c383 100644 --- a/smilies_adult/smilies_adult.php +++ b/smilies_adult/smilies_adult.php @@ -17,7 +17,7 @@ function smilies_adult_install() { Hook::register('smilie', 'addon/smilies_adult/smilies_adult.php', 'smilies_adult_smilies'); } -function smilies_adult_smilies(App $a, array &$b) +function smilies_adult_smilies(array &$b) { $b['texts'][] = '(o)(o)'; $b['icons'][] = '' . '(o)(o)' . ''; diff --git a/startpage/startpage.php b/startpage/startpage.php index 99a2e3fa..e4d80c0c 100644 --- a/startpage/startpage.php +++ b/startpage/startpage.php @@ -18,7 +18,7 @@ function startpage_install() { Hook::register('addon_settings_post', 'addon/startpage/startpage.php', 'startpage_settings_post'); } -function startpage_home_init(App $a, $b) +function startpage_home_init($b) { if (!DI::userSession()->getLocalUserId()) { return; @@ -39,7 +39,7 @@ function startpage_home_init(App $a, $b) * */ -function startpage_settings_post(App $a, $post) +function startpage_settings_post($post) { if (!DI::userSession()->getLocalUserId()) { return; @@ -56,7 +56,7 @@ function startpage_settings_post(App $a, $post) * Add our own settings info to the page. * */ -function startpage_settings(App &$a, array &$data) +function startpage_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 74ac36cb..c168d612 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -62,7 +62,7 @@ function statusnet_install() Logger::notice('installed GNU Social'); } -function statusnet_jot_nets(App $a, array &$jotnets_fields) +function statusnet_jot_nets(array &$jotnets_fields) { if (!DI::userSession()->getLocalUserId()) { return; @@ -80,7 +80,7 @@ function statusnet_jot_nets(App $a, array &$jotnets_fields) } } -function statusnet_settings_post(App $a, $post) +function statusnet_settings_post($post) { if (!DI::userSession()->getLocalUserId()) { return; @@ -178,7 +178,7 @@ function statusnet_settings_post(App $a, $post) } } -function statusnet_settings(App $a, array &$data) +function statusnet_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -288,7 +288,7 @@ function statusnet_settings(App $a, array &$data) ]; } -function statusnet_hook_fork(App $a, array &$b) +function statusnet_hook_fork(array &$b) { if ($b['name'] != 'notifier_normal') { return; @@ -302,7 +302,7 @@ function statusnet_hook_fork(App $a, array &$b) } } -function statusnet_post_local(App $a, array &$b) +function statusnet_post_local(array &$b) { if ($b['edit']) { return; @@ -331,7 +331,7 @@ function statusnet_post_local(App $a, array &$b) $b['postopts'] .= 'statusnet'; } -function statusnet_post_hook(App $a, array &$b) +function statusnet_post_hook(array &$b) { /** * Post to GNU Social @@ -426,7 +426,7 @@ function statusnet_post_hook(App $a, array &$b) } } -function statusnet_addon_admin_post(App $a) +function statusnet_addon_admin_post() { $sites = []; @@ -458,7 +458,7 @@ function statusnet_addon_admin_post(App $a) $sites = DI::config()->set('statusnet', 'sites', $sites); } -function statusnet_addon_admin(App $a, string &$o) +function statusnet_addon_admin(string &$o) { $sites = DI::config()->get('statusnet', 'sites'); $sitesform = []; diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index 27ef45e7..d9bc0b3b 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -25,17 +25,17 @@ function testdrive_install() Hook::register('globaldir_update','addon/testdrive/testdrive.php', 'testdrive_globaldir_update'); } -function testdrive_load_config(App $a, ConfigFileManager $loader) +function testdrive_load_config(ConfigFileManager $loader) { - $a->getConfigCache()->load($loader->loadAddonConfig('testdrive'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('testdrive'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } -function testdrive_globaldir_update(App $a, array &$b) +function testdrive_globaldir_update(array &$b) { $b['url'] = ''; } -function testdrive_register_account(App $a, $b) +function testdrive_register_account($b) { $uid = $b; @@ -48,7 +48,7 @@ function testdrive_register_account(App $a, $b) } -function testdrive_cron(App $a, $b) +function testdrive_cron($b) { $users = DBA::selectToArray('user', [], ["`account_expires_on` < ? AND `expire_notification_sent` <= ?", DateTimeFormat::utc('now + 5 days'), DBA::NULL_DATETIME]); @@ -72,7 +72,7 @@ function testdrive_cron(App $a, $b) } } -function testdrive_enotify(App $a, array &$b) +function testdrive_enotify(array &$b) { if (!empty($b['params']) && $b['params']['type'] == Notification\Type::SYSTEM && !empty($b['params']['system_type']) && $b['params']['system_type'] === 'testdrive_expire') { diff --git a/tictac/tictac.php b/tictac/tictac.php index 7a00349e..0f9f4fb6 100644 --- a/tictac/tictac.php +++ b/tictac/tictac.php @@ -16,7 +16,7 @@ function tictac_install() Hook::register('app_menu', 'addon/tictac/tictac.php', 'tictac_app_menu'); } -function tictac_app_menu(App $a, array &$b) +function tictac_app_menu(array &$b) { $b['app_menu'][] = ''; } @@ -28,7 +28,7 @@ function tictac_app_menu(App $a, array &$b) */ function tictac_module() {} -function tictac_content(App $a) { +function tictac_content() { $o = ''; diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index c3a5561f..6cf47fbe 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -36,7 +36,7 @@ function tumblr_install() */ function tumblr_module() {} -function tumblr_content(App $a) +function tumblr_content() { if (!DI::userSession()->getLocalUserId()) { DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); @@ -46,11 +46,11 @@ function tumblr_content(App $a) if (isset(DI::args()->getArgv()[1])) { switch (DI::args()->getArgv()[1]) { case "connect": - $o = tumblr_connect($a); + $o = tumblr_connect(); break; case "callback": - $o = tumblr_callback($a); + $o = tumblr_callback(); break; default: @@ -58,13 +58,13 @@ function tumblr_content(App $a) break; } } else { - $o = tumblr_connect($a); + $o = tumblr_connect(); } return $o; } -function tumblr_addon_admin(App $a, string &$o) +function tumblr_addon_admin(string &$o) { $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/tumblr/" ); @@ -76,13 +76,13 @@ function tumblr_addon_admin(App $a, string &$o) ]); } -function tumblr_addon_admin_post(App $a) +function tumblr_addon_admin_post() { DI::config()->set('tumblr', 'consumer_key', trim($_POST['consumer_key'] ?? '')); DI::config()->set('tumblr', 'consumer_secret', trim($_POST['consumer_secret'] ?? '')); } -function tumblr_connect(App $a) +function tumblr_connect() { // Start a session. This is necessary to hold on to a few keys the callback script will also need session_start(); @@ -137,7 +137,7 @@ function tumblr_connect(App $a) return $o; } -function tumblr_callback(App $a) +function tumblr_callback() { // Start a session, load the library session_start(); @@ -180,7 +180,7 @@ function tumblr_callback(App $a) return $o; } -function tumblr_jot_nets(App $a, array &$jotnets_fields) +function tumblr_jot_nets(array &$jotnets_fields) { if (!DI::userSession()->getLocalUserId()) { return; @@ -198,7 +198,7 @@ function tumblr_jot_nets(App $a, array &$jotnets_fields) } } -function tumblr_settings(App $a, array &$data) +function tumblr_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -248,7 +248,7 @@ function tumblr_settings(App $a, array &$data) ]; } -function tumblr_settings_post(App $a, array &$b) +function tumblr_settings_post(array &$b) { if (!empty($_POST['tumblr-submit'])) { DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'tumblr', 'post', intval($_POST['tumblr'])); @@ -257,7 +257,7 @@ function tumblr_settings_post(App $a, array &$b) } } -function tumblr_hook_fork(App $a, array &$b) +function tumblr_hook_fork(array &$b) { if ($b['name'] != 'notifier_normal') { return; @@ -272,7 +272,7 @@ function tumblr_hook_fork(App $a, array &$b) } } -function tumblr_post_local(App $a, array &$b) +function tumblr_post_local(array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint @@ -310,7 +310,7 @@ function tumblr_post_local(App $a, array &$b) -function tumblr_send(App $a, array &$b) { +function tumblr_send(array &$b) { if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return; diff --git a/twitter/twitter.php b/twitter/twitter.php index 83e10459..d7cce96a 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -124,12 +124,12 @@ function twitter_install() // Hook functions -function twitter_load_config(App $a, ConfigFileManager $loader) +function twitter_load_config(ConfigFileManager $loader) { - $a->getConfigCache()->load($loader->loadAddonConfig('twitter'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::app()->getConfigCache()->load($loader->loadAddonConfig('twitter'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } -function twitter_check_item_notification(App $a, array &$notification_data) +function twitter_check_item_notification(array &$notification_data) { $own_id = DI::pConfig()->get($notification_data['uid'], 'twitter', 'own_id'); @@ -139,14 +139,14 @@ function twitter_check_item_notification(App $a, array &$notification_data) } } -function twitter_support_follow(App $a, array &$data) +function twitter_support_follow(array &$data) { if ($data['protocol'] == Protocol::TWITTER) { $data['result'] = true; } } -function twitter_follow(App $a, array &$contact) +function twitter_follow(array &$contact) { Logger::info('Check if contact is twitter contact', ['url' => $contact['url']]); @@ -158,7 +158,7 @@ function twitter_follow(App $a, array &$contact) $nickname = preg_replace("=https?://twitter.com/(.*)=ism", "$1", $contact['url']); $nickname = str_replace('@twitter.com', '', $nickname); - $uid = $a->getLoggedInUserId(); + $uid = DI::userSession()->getLocalUserId(); if (!twitter_api_contact('friendships/create', ['network' => Protocol::TWITTER, 'nick' => $nickname], $uid)) { $contact = null; @@ -176,12 +176,12 @@ function twitter_follow(App $a, array &$contact) } } -function twitter_unfollow(App $a, array &$hook_data) +function twitter_unfollow(array &$hook_data) { $hook_data['result'] = twitter_api_contact('friendships/destroy', $hook_data['contact'], $hook_data['uid']); } -function twitter_block(App $a, array &$hook_data) +function twitter_block(array &$hook_data) { $hook_data['result'] = twitter_api_contact('blocks/create', $hook_data['contact'], $hook_data['uid']); @@ -191,7 +191,7 @@ function twitter_block(App $a, array &$hook_data) } } -function twitter_unblock(App $a, array &$hook_data) +function twitter_unblock(array &$hook_data) { $hook_data['result'] = twitter_api_contact('blocks/destroy', $hook_data['contact'], $hook_data['uid']); } @@ -205,7 +205,7 @@ function twitter_api_contact(string $apiPath, array $contact, int $uid): ?bool return (bool)twitter_api_call($uid, $apiPath, ['screen_name' => $contact['nick']]); } -function twitter_jot_nets(App $a, array &$jotnets_fields) +function twitter_jot_nets(array &$jotnets_fields) { if (!DI::userSession()->getLocalUserId()) { return; @@ -224,7 +224,7 @@ function twitter_jot_nets(App $a, array &$jotnets_fields) } -function twitter_settings_post(App $a) +function twitter_settings_post() { if (!DI::userSession()->getLocalUserId()) { return; @@ -295,7 +295,7 @@ function twitter_settings_post(App $a) } } -function twitter_settings(App $a, array &$data) +function twitter_settings(array &$data) { if (!DI::userSession()->getLocalUserId()) { return; @@ -414,7 +414,7 @@ function twitter_settings(App $a, array &$data) ]; } -function twitter_hook_fork(App $a, array &$b) +function twitter_hook_fork(array &$b) { DI::logger()->debug('twitter_hook_fork', $b); @@ -466,7 +466,7 @@ function twitter_hook_fork(App $a, array &$b) } } -function twitter_post_local(App $a, array &$b) +function twitter_post_local(array &$b) { if ($b['edit']) { return; @@ -495,7 +495,7 @@ function twitter_post_local(App $a, array &$b) $b['postopts'] .= 'twitter'; } -function twitter_probe_detect(App $a, array &$hookData) +function twitter_probe_detect(array &$hookData) { // Don't overwrite an existing result if (isset($hookData['result'])) { @@ -529,7 +529,7 @@ function twitter_probe_detect(App $a, array &$hookData) } } -function twitter_item_by_link(App $a, array &$hookData) +function twitter_item_by_link(array &$hookData) { // Don't overwrite an existing result if (isset($hookData['item_id'])) { @@ -569,7 +569,7 @@ function twitter_item_by_link(App $a, array &$hookData) return; } - $item = twitter_createpost($a, $hookData['uid'], $status, [], true, false, false); + $item = twitter_createpost($hookData['uid'], $status, [], true, false, false); if (!empty($item)) { $hookData['item_id'] = Item::insert($item); } @@ -635,7 +635,7 @@ function twitter_get_id(string $uri) return (int)$id; } -function twitter_post_hook(App $a, array &$b) +function twitter_post_hook(array &$b) { DI::logger()->debug('Invoke post hook', $b); @@ -736,7 +736,7 @@ function twitter_post_hook(App $a, array &$b) Logger::info('We have customer key and oauth stuff, going to send.'); // If it's a repeated message from twitter then do a native retweet and exit - if (twitter_is_retweet($a, $b['uid'], $b['body'])) { + if (twitter_is_retweet($b['uid'], $b['body'])) { return; } @@ -979,13 +979,13 @@ function twitter_delete_item(array $item) } } -function twitter_addon_admin_post(App $a) +function twitter_addon_admin_post() { DI::config()->set('twitter', 'consumerkey', trim($_POST['consumerkey'] ?? '')); DI::config()->set('twitter', 'consumersecret', trim($_POST['consumersecret'] ?? '')); } -function twitter_addon_admin(App $a, string &$o) +function twitter_addon_admin(string &$o) { $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/twitter/'); @@ -997,7 +997,7 @@ function twitter_addon_admin(App $a, string &$o) ]); } -function twitter_cron(App $a) +function twitter_cron() { $last = DI::keyValue()->get('twitter_last_poll'); @@ -1049,7 +1049,7 @@ function twitter_cron(App $a) $next_contact_check = 0; if($next_contact_check <= time()) { - pumpio_getallusers($a, $rr["uid"]); + pumpio_getallusers($rr["uid"]); DI::pConfig()->set($rr['uid'],'pumpio','contact_check',time()); } */ @@ -1060,7 +1060,7 @@ function twitter_cron(App $a) DI::keyValue()->set('twitter_last_poll', time()); } -function twitter_expire(App $a) +function twitter_expire() { $days = DI::config()->get('twitter', 'expire'); @@ -1090,7 +1090,7 @@ function twitter_expire(App $a) Logger::notice('End expiry'); } -function twitter_prepare_body(App $a, array &$b) +function twitter_prepare_body(array &$b) { if ($b['item']['network'] != Protocol::TWITTER) { return; @@ -1149,7 +1149,6 @@ function twitter_statuses_show(string $id, TwitterOAuth $twitterOAuth = null) /** * Parse Twitter status URLs since Twitter removed OEmbed * - * @param App $a * @param array $b Expected format: * [ * 'url' => [URL to parse], @@ -1158,7 +1157,7 @@ function twitter_statuses_show(string $id, TwitterOAuth $twitterOAuth = null) * ] * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ -function twitter_parse_link(App $a, array &$b) +function twitter_parse_link(array &$b) { // Only handle Twitter status URLs if (!preg_match('#^https?://(?:mobile\.|www\.)?twitter.com/[^/]+/status/(\d+).*#', $b['url'], $matches)) { @@ -1171,7 +1170,7 @@ function twitter_parse_link(App $a, array &$b) return; } - $item = twitter_createpost($a, 0, $status, [], true, false, true); + $item = twitter_createpost(0, $status, [], true, false, true); if (empty($item)) { return; } @@ -1222,13 +1221,12 @@ function twitter_parse_link(App $a, array &$b) /** * @brief Build the item array for the mirrored post * - * @param App $a Application class * @param integer $uid User id * @param object $post Twitter object with the post * * @return array item data to be posted */ -function twitter_do_mirrorpost(App $a, int $uid, $post) +function twitter_do_mirrorpost(int $uid, $post) { $datarray['uid'] = $uid; $datarray['extid'] = 'twitter::' . $post->id; @@ -1236,7 +1234,7 @@ function twitter_do_mirrorpost(App $a, int $uid, $post) if (!empty($post->retweeted_status)) { // We don't support nested shares, so we mustn't show quotes as shares on retweets - $item = twitter_createpost($a, $uid, $post->retweeted_status, ['id' => 0], false, false, true, -1); + $item = twitter_createpost($uid, $post->retweeted_status, ['id' => 0], false, false, true, -1); if (empty($item)) { return []; @@ -1252,7 +1250,7 @@ function twitter_do_mirrorpost(App $a, int $uid, $post) $datarray['body'] .= $item['body'] . '[/share]'; } else { - $item = twitter_createpost($a, $uid, $post, ['id' => 0], false, false, false, -1); + $item = twitter_createpost($uid, $post, ['id' => 0], false, false, false, -1); if (empty($item)) { return []; @@ -1278,12 +1276,11 @@ function twitter_do_mirrorpost(App $a, int $uid, $post) /** * Fetches the Twitter user's own posts * - * @param App $a * @param int $uid * @return void * @throws Exception */ -function twitter_fetchtimeline(App $a, int $uid): void +function twitter_fetchtimeline(int $uid): void { $ckey = DI::config()->get('twitter', 'consumerkey'); $csecret = DI::config()->get('twitter', 'consumersecret'); @@ -1301,7 +1298,7 @@ function twitter_fetchtimeline(App $a, int $uid): void // Ensure to have the own contact try { - twitter_fetch_own_contact($a, $uid); + twitter_fetch_own_contact($uid); } catch (TwitterOAuthException $e) { Logger::notice('Error fetching own contact', ['uid' => $uid, 'message' => $e->getMessage()]); return; @@ -1356,7 +1353,7 @@ function twitter_fetchtimeline(App $a, int $uid): void } Logger::info('Preparing mirror post', ['twitter-id' => $post->id_str, 'uid' => $uid]); - $mirrorpost = twitter_do_mirrorpost($a, $uid, $post); + $mirrorpost = twitter_do_mirrorpost($uid, $post); if (empty($mirrorpost['body'])) { Logger::notice('Body is empty', ['post' => $post, 'mirrorpost' => $mirrorpost]); @@ -1898,7 +1895,6 @@ function twitter_media_entities($post, array &$postarray, int $uriId = -1) /** * Undocumented function * - * @param App $a * @param integer $uid User ID * @param object $post Incoming Twitter post * @param array $self @@ -1908,7 +1904,7 @@ function twitter_media_entities($post, array &$postarray, int $uriId = -1) * @param integer $uriId URI Id used to store tags. 0 = create a new one; -1 = don't store tags for this post. * @return array item array */ -function twitter_createpost(App $a, int $uid, $post, array $self, $create_user, bool $only_existing_contact, bool $noquote, int $uriId = 0): array +function twitter_createpost(int $uid, $post, array $self, $create_user, bool $only_existing_contact, bool $noquote, int $uriId = 0): array { $postarray = []; $postarray['network'] = Protocol::TWITTER; @@ -2045,7 +2041,7 @@ function twitter_createpost(App $a, int $uid, $post, array $self, $create_user, $postarray['coord'] = $post->coordinates->coordinates[1] . ' ' . $post->coordinates->coordinates[0]; } if (!empty($post->retweeted_status)) { - $retweet = twitter_createpost($a, $uid, $post->retweeted_status, $self, false, false, $noquote); + $retweet = twitter_createpost($uid, $post->retweeted_status, $self, false, false, $noquote); if (empty($retweet)) { return []; @@ -2081,7 +2077,7 @@ function twitter_createpost(App $a, int $uid, $post, array $self, $create_user, // To avoid recursive share blocks we just provide the link to avoid removing quote context. $postarray['body'] .= "\n\nhttps://twitter.com/" . $post->quoted_status->user->screen_name . "/status/" . $post->quoted_status->id_str; } else { - $quoted = twitter_createpost($a, 0, $post->quoted_status, $self, false, false, true); + $quoted = twitter_createpost(0, $post->quoted_status, $self, false, false, true); if (!empty($quoted)) { Item::insert($quoted); $post = Post::selectFirst(['guid', 'uri-id'], ['uri' => $quoted['uri'], 'uid' => 0]); @@ -2121,7 +2117,7 @@ function twitter_store_tags(int $uriId, array $taglist) } } -function twitter_fetchparentposts(App $a, int $uid, $post, TwitterOAuth $connection, array $self) +function twitter_fetchparentposts(int $uid, $post, TwitterOAuth $connection, array $self) { Logger::info('Fetching parent posts', ['user' => $uid, 'post' => $post->id_str]); @@ -2158,7 +2154,7 @@ function twitter_fetchparentposts(App $a, int $uid, $post, TwitterOAuth $connect if (!empty($posts)) { foreach ($posts as $post) { - $postarray = twitter_createpost($a, $uid, $post, $self, false, !DI::pConfig()->get($uid, 'twitter', 'create_user'), false); + $postarray = twitter_createpost($uid, $post, $self, false, !DI::pConfig()->get($uid, 'twitter', 'create_user'), false); if (empty($postarray)) { continue; @@ -2176,12 +2172,11 @@ function twitter_fetchparentposts(App $a, int $uid, $post, TwitterOAuth $connect /** * Fetches the posts received by the Twitter user * - * @param App $a * @param int $uid * @return void * @throws Exception */ -function twitter_fetchhometimeline(App $a, int $uid): void +function twitter_fetchhometimeline(int $uid): void { $ckey = DI::config()->get('twitter', 'consumerkey'); $csecret = DI::config()->get('twitter', 'consumersecret'); @@ -2201,7 +2196,7 @@ function twitter_fetchhometimeline(App $a, int $uid): void $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret); try { - $own_contact = twitter_fetch_own_contact($a, $uid); + $own_contact = twitter_fetch_own_contact($uid); } catch (TwitterOAuthException $e) { Logger::notice('Error fetching own contact', ['uid' => $uid, 'message' => $e->getMessage()]); return; @@ -2283,12 +2278,12 @@ function twitter_fetchhometimeline(App $a, int $uid): void } if ($post->in_reply_to_status_id_str != '') { - twitter_fetchparentposts($a, $uid, $post, $connection, $self); + twitter_fetchparentposts($uid, $post, $connection, $self); } Logger::info('Preparing post ' . $post->id_str . ' for user ' . $uid); - $postarray = twitter_createpost($a, $uid, $post, $self, $create_user, true, false); + $postarray = twitter_createpost($uid, $post, $self, $create_user, true, false); if (empty($postarray)) { Logger::info('Empty post ' . $post->id_str . ' and user ' . $uid); @@ -2352,10 +2347,10 @@ function twitter_fetchhometimeline(App $a, int $uid): void } if ($post->in_reply_to_status_id_str != '') { - twitter_fetchparentposts($a, $uid, $post, $connection, $self); + twitter_fetchparentposts($uid, $post, $connection, $self); } - $postarray = twitter_createpost($a, $uid, $post, $self, false, !$create_user, false); + $postarray = twitter_createpost($uid, $post, $self, false, !$create_user, false); if (empty($postarray)) { continue; @@ -2372,7 +2367,7 @@ function twitter_fetchhometimeline(App $a, int $uid): void Logger::info('Last mentions ID for user ' . $uid . ' is now ' . $lastid); } -function twitter_fetch_own_contact(App $a, int $uid) +function twitter_fetch_own_contact(int $uid) { $ckey = DI::config()->get('twitter', 'consumerkey'); $csecret = DI::config()->get('twitter', 'consumersecret'); @@ -2408,7 +2403,7 @@ function twitter_fetch_own_contact(App $a, int $uid) return $contact_id; } -function twitter_is_retweet(App $a, int $uid, string $body): bool +function twitter_is_retweet(int $uid, string $body): bool { $body = trim($body); diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index 092a61ed..073793e2 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -5,8 +5,6 @@ use Friendica\DI; function twitter_sync_run($argv, $argc) { - $a = Friendica\DI::app(); - require_once 'addon/twitter/twitter.php'; if (function_exists('sys_getloadavg')) { @@ -26,8 +24,8 @@ function twitter_sync_run($argv, $argc) $uid = intval($argv[2]); if ($mode == 1) { - twitter_fetchtimeline($a, $uid); + twitter_fetchtimeline($uid); } elseif ($mode == 2) { - twitter_fetchhometimeline($a, $uid); + twitter_fetchhometimeline($uid); } } diff --git a/unicode_smilies/unicode_smilies.php b/unicode_smilies/unicode_smilies.php index 1ff405ba..3bd30644 100644 --- a/unicode_smilies/unicode_smilies.php +++ b/unicode_smilies/unicode_smilies.php @@ -15,7 +15,7 @@ function unicode_smilies_install() { Hook::register('smilie', 'addon/unicode_smilies/unicode_smilies.php', 'unicode_smilies_smilies'); } -function unicode_smilies_smilies(App $a, array &$b) +function unicode_smilies_smilies(array &$b) { Smilies::add($b, ':-)', '😀'); Smilies::add($b, ':)', '😀'); diff --git a/viewsrc/viewsrc.php b/viewsrc/viewsrc.php index c203bd51..eefb7105 100644 --- a/viewsrc/viewsrc.php +++ b/viewsrc/viewsrc.php @@ -17,7 +17,7 @@ function viewsrc_install() Hook::register('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end'); } -function viewsrc_page_end(App $a, string &$o) +function viewsrc_page_end(string &$o) { DI::page()['htmlhead'] .= <<< EOS