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');
* Hooks
*/
-function advancedcontentfilter_dbstructure_definition(App $a, &$database)
+function advancedcontentfilter_dbstructure_definition(&$database)
{
$database['advancedcontentfilter_rules'] = [
'comment' => 'Advancedcontentfilter addon rules',
return $vars;
}
-function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
+function advancedcontentfilter_prepare_body_content_filter(&$hook_data)
{
static $expressionLanguage;
}
-function advancedcontentfilter_addon_settings(App $a, array &$data)
+function advancedcontentfilter_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
*/
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();
}
}
-function advancedcontentfilter_content(App $a)
+function advancedcontentfilter_content()
{
if (!DI::userSession()->getLocalUserId()) {
return Login::form('/' . implode('/', DI::args()->getArgv()));
'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()
]);
/**
* Bird avatar user settings page
*/
-function birdavatar_addon_settings(App $a, array &$data)
+function birdavatar_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
/**
* 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;
/**
* 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)) {
* @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.
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()) {
}
}
-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'; }
]);
}
-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']));
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/');
]);
}
-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;
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;
];
}
-function blockem_addon_settings_post(App $a, array &$b)
+function blockem_addon_settings_post(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
}
-function blockem_enotify_store(App $a, array &$b)
+function blockem_enotify_store(array &$b)
{
$words = DI::pConfig()->get($b['uid'], 'blockem', 'words');
}
}
-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;
}
}
-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;
EOT;
}
-function blockem_item_photo_menu(App $a, array &$b)
+function blockem_item_photo_menu(array &$b)
{
global $blockem_words;
*/
function blockem_module() {}
-function blockem_init(App $a)
+function blockem_init()
{
if (!DI::userSession()->getLocalUserId()) {
return;
Hook::register('page_end', 'addon/buglink/buglink.php', 'buglink_active');
}
-function buglink_active(App $a, string &$b)
+function buglink_active(string &$b)
{
$b .= '<div id="buglink_wrapper" style="position: fixed; bottom: 5px; left: 5px;"><a href="https://github.com/friendica/friendica/issues" target="_blank" rel="noopener noreferrer" title="' . DI::l10n()->t('Report Bug') . '"><img src="addon/buglink/bug-x.gif" alt="' . DI::l10n()->t('Report Bug') . '" /></a></div>';
}
Hook::register('app_menu', 'addon/calc/calc.php', 'calc_app_menu');
}
-function calc_app_menu(App $a, array &$b)
+function calc_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="calc">Calculator</a></div>';
}
*/
function calc_module() {}
-function calc_init(App $a)
+function calc_init()
{
$x = <<< EOT
/**
* Cat avatar user settings page
*/
-function catavatar_addon_settings(App $a, array &$data)
+function catavatar_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
/**
* 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;
/**
* 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)) {
* @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.
Hook::register('app_menu', 'addon/convert/convert.php', 'convert_app_menu');
}
-function convert_app_menu(App $a, array &$b)
+function convert_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="convert">Units Conversion</a></div>';
}
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';
* 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;
}
* 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;
}
* page_content_top hook
* adds css and scripts to the <head> section of the html
*
- * @param App $a
* @param string $b unused - the header html incl. nav
*
* @return void
*/
-function cookienotice_page_content_top(App $a, string &$b)
+function cookienotice_page_content_top(string &$b)
{
DI::page()->registerStylesheet(__DIR__ . '/cookienotice.css');
DI::page()->registerFooterScript(__DIR__ . '/cookienotice.js');
* 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'));
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;
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;
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;
// 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;
}
}
}
-function curweather_addon_admin(App $a, string &$o)
+function curweather_addon_admin(string &$o)
{
- if (!$a->isSiteAdmin()) {
+ if (!DI::userSession()->isSiteAdmin()) {
return;
}
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;
}
}
-function diaspora_settings(App $a, array &$data)
+function diaspora_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
-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']));
}
}
-function diaspora_hook_fork(App $a, array &$b)
+function diaspora_hook_fork(array &$b)
{
if ($b['name'] != 'notifier_normal') {
return;
}
}
-function diaspora_post_local(App $a, array &$b)
+function diaspora_post_local(array &$b)
{
if ($b['edit']) {
return;
$b['postopts'] .= 'diaspora';
}
-function diaspora_send(App $a, array &$b)
+function diaspora_send(array &$b)
{
$hostname = DI::baseUrl()->getHostname();
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;
];
}
-function discourse_settings_post(App $a)
+function discourse_settings_post()
{
if (!DI::userSession()->getLocalUserId() || empty($_POST['discourse-submit'])) {
return;
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;
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;
}
-function dwpost_settings(App $a, array &$data)
+function dwpost_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
-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']));
}
}
-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']) {
$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;
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.
function ($text) use ($gallery) {
// This processes images inlined in posts
// Frio / Vier hooks für lightbox are un-hooked in fancybox-config.js. So this works for them, too!
- //if (!in_array($a->getCurrentTheme(),['vier','frio']))
+ //if (!in_array(DI::app()->getCurrentTheme(),['vier','frio']))
$text = preg_replace(
'#<a[^>]*href="([^"]*)"[^>]*>(<img[^>]*src="[^"]*"[^>]*>)</a>#',
'<a data-fancybox="' . $gallery . '" href="$1">$2</a>',
*/
function forumdirectory_module() {}
-function forumdirectory_app_menu(App $a, array &$b)
+function forumdirectory_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="forumdirectory">' . DI::l10n()->t('Forum Directory') . '</a></div>';
}
-function forumdirectory_init(App $a)
+function forumdirectory_init()
{
if (DI::userSession()->getLocalUserId()) {
DI::page()['aside'] .= Widget::findPeople();
}
}
-function forumdirectory_post(App $a)
+function forumdirectory_post()
{
global $forumdirectory_search;
}
}
-function forumdirectory_content(App $a)
+function forumdirectory_content()
{
global $forumdirectory_search;
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;
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;
];
}
-function fromapp_post_hook(App $a, &$item)
+function fromapp_post_hook(&$item)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
}
-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/');
]);
}
-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'] ?? ''));
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:
* 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;
* 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;
* 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;
* 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;
];
}
-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;
Logger::notice('installed googlemaps');
}
-function googlemaps_location(App $a, &$item)
+function googlemaps_location(&$item)
{
if (!(strlen($item['location']) || strlen($item['coord']))) {
return;
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');
/**
* 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/" );
/**
* Save admin settings
*/
-function gravatar_addon_admin_post (App $a)
+function gravatar_addon_admin_post ()
{
BaseModule::checkFormSecurityToken('gravatarsave');
*
*/
-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;
*
*/
-function group_text_settings(App &$a, array &$data)
+function group_text_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
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';
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');
function ifttt_content() {}
-function ifttt_settings(App $a, array &$data)
+function ifttt_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
'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}}>>>',
}
}
-function ifttt_post(App $a)
+function ifttt_post()
{
if (DI::args()->getArgc() != 2) {
return;
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;
}
}
-function ijpost_settings(App &$a, array &$data)
+function ijpost_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
];
}
-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']));
}
}
-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
$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;
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')));
}
}
-function impressum_load_config(App $a, ConfigFileManager $loader)
+function impressum_load_config(ConfigFileManager $loader)
{
- $a->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
+ DI::app()->getConfigCache()->load($loader->loadAddonConfig('impressum'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC);
}
-function impressum_show(App $a, string &$body)
+function impressum_show(string &$body)
{
$body .= '<h3>' . DI::l10n()->t('Impressum') . '</h3>';
$owner = DI::config()->get('impressum', 'owner');
}
}
-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'] ?? '')));
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, [
Hook::register('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu');
}
-function infiniteimprobabilitydrive_app_menu(App $a, array &$b)
+function infiniteimprobabilitydrive_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="infiniteimprobabilitydrive">' . DI::l10n()->t('Infinite Improbability Drive') . '</a></div>';
}
function infiniteimprobabilitydrive_module() {}
-function infiniteimprobabilitydrive_content(App $a)
+function infiniteimprobabilitydrive_content()
{
$baseurl = DI::baseUrl()->get() . '/addon/infiniteimprobabilitydrive';
$o = '';
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;
];
}
-function irc_addon_settings_post(App $a, array &$b)
+function irc_addon_settings_post(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
}
-function irc_app_menu(App $a, array &$b)
+function irc_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="irc">' . DI::l10n()->t('IRC Chatroom') . '</a></div>';
}
*/
function irc_module() {}
-function irc_content(App $a)
+function irc_content()
{
$baseurl = DI::baseUrl()->get() . '/addon/irc';
$o = '';
return $o;
}
-function irc_addon_admin_post (App $a)
+function irc_addon_admin_post ()
{
- if (!$a->isSiteAdmin()) {
+ if (!DI::userSession()->isSiteAdmin()) {
return;
}
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/' );
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;
]);
}
-function js_upload_post_init(App $a, array &$b)
+function js_upload_post_init(array &$b)
{
global $js_upload_result, $js_upload_jsonresponse;
$js_upload_result = $result;
}
-function js_upload_post_file(App $a, array &$b)
+function js_upload_post_file(array &$b)
{
global $js_upload_result;
}
-function js_upload_post_end(App $a, int &$b)
+function js_upload_post_end(int &$b)
{
global $js_upload_jsonresponse;
return $res;
}
-function keycloakpassword_authenticate(App $a, array &$b)
+function keycloakpassword_authenticate(array &$b)
{
if (empty($b['password'])) {
return;
];
}
-function keycloakpassword_addon_admin(App $a, string &$o)
+function keycloakpassword_addon_admin(string &$o)
{
$form =
keycloakpassword_admin_input(
$o = Renderer::replaceMacros($t, $form);
}
-function keycloakpassword_addon_admin_post(App $a)
+function keycloakpassword_addon_admin_post()
{
if (!DI::userSession()->getLocalUserId()) {
return;
Logger::notice("installed krynn");
}
-function krynn_post_hook(App $a, &$item)
+function krynn_post_hook(&$item)
{
/**
* An item was posted on the local system.
* 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;
* 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;
* 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;
* 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;
* 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) {
// 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;
}
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'])) {
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;
}
return isset($sites[$site]);
}
-function leistungsschutzrecht_cron(App $a, $b)
+function leistungsschutzrecht_cron($b)
{
$last = DI::keyValue()->get('leistungsschutzrecht_last_poll');
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;
}
}
-function libertree_settings(App $a, array &$data)
+function libertree_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
];
}
-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']));
}
-function libertree_hook_fork(App &$a, array &$b)
+function libertree_hook_fork(array &$b)
{
if ($b['name'] != 'notifier_normal') {
return;
}
}
-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
$b['postopts'] .= 'libertree';
}
-function libertree_send(App $a, array &$b)
+function libertree_send(array &$b)
{
Logger::notice('libertree_send: invoked');
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)) {
/**
* 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');
/**
* 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'));
}
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;
}
}
-function ljpost_settings(App &$a, array &$data)
+function ljpost_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
];
}
-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']));
}
}
-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']) {
$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;
/**
* 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/');
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);
* 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();
/**
* 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');
/**
* 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;
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;
];
}
-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;
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;
}
Hook::register('contacts_mod_init', __FILE__, 'mastodoncustomemojis_css_hook');
}
-function mastodoncustomemojis_css_hook(App $a)
+function mastodoncustomemojis_css_hook()
{
DI::page()['htmlhead'] .= <<<HTML
<!-- Style added by mastodoncustomemojis -->
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])) {
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;
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;
];
}
-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.
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'));
$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);
$b = $doc->saveHTML();
} else {
// Works in Vier.
- $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local($a->profile['register_date']) . "</dd>\n</dl>", $b, 1);
+ $b = preg_replace('/<\/dl>/', "</dl>\n\n\n<dl id=\"aprofile-membersince\" class=\"aprofile\">\n<dt>" . DI::l10n()->t('Member since:') . "</dt>\n<dd>" . DateTimeFormat::local(DI::app()->profile['register_date']) . "</dd>\n</dl>", $b, 1);
}
}
require_once __DIR__ . '/vendor/autoload.php';
-function monolog_install(App $a)
+function monolog_install()
{
Hook::register('logger_instance' , __FILE__, 'monolog_instance');
}
Hook::unregister('logger_instance', __FILE__, 'monolog_instance');
}
-function monolog_instance(App $a, array &$data)
+function monolog_instance(array &$data)
{
if ($data['name'] !== 'monolog') {
return;
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');
$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');
$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');
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')];
Logger::notice('newmemberwidget installed');
}
-function newmemberwidget_network_mod_init (App $a, $b)
+function newmemberwidget_network_mod_init ($b)
{
if (empty($_SESSION['new_member'])) {
return;
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']));
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');
/* 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']), '/'));
}
/* 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/');
/*
* 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;
}
}
-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/');
]);
}
-function nominatim_addon_admin_post(App $a)
+function nominatim_addon_admin_post()
{
DI::config()->set('nominatim', 'language', (!empty($_POST['language']) ? trim($_POST['language']) : ''));
}
*/
function notifyall_module() {}
-function notifyall_addon_admin(App $a, string &$o)
+function notifyall_addon_admin(string &$o)
{
$o = '<div></div> <a href="' . DI::baseUrl()->get() . '/notifyall">' . DI::l10n()->t('Send email to all members') . '</a></br/>';
}
-function notifyall_post(App $a)
+function notifyall_post()
{
- if (!$a->isSiteAdmin()) {
+ if (!DI::userSession()->isSiteAdmin()) {
return;
}
DI::baseUrl()->redirect('admin');
}
-function notifyall_content(App $a)
+function notifyall_content()
{
- if (!$a->isSiteAdmin()) {
+ if (!DI::userSession()->isSiteAdmin()) {
return '';
}
return $new_body;
}
-function nsfw_addon_settings(App &$a, array &$data)
+function nsfw_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
];
}
-function nsfw_addon_settings_post(App $a, array &$b)
+function nsfw_addon_settings_post(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
}
-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')) {
* 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;
}
* 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;
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 = '<script type="text/javascript" src="' . DI::baseUrl()->get() . '/addon/openstreetmap/openstreetmap.js"></script>' . "\r\n";
DI::page()['htmlhead'] .= $addScriptTag;
* 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;
$item['html'] = '<a target="map" title="' . $title . '" href= "' . $target . '">' . $title . '</a>';
}
-function openstreetmap_get_coordinates(App $a, array &$b)
+function openstreetmap_get_coordinates(array &$b)
{
$nomserver = DI::config()->get('openstreetmap', 'nomserver', OSM_NOM);
}
}
-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);
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);
]);
}
-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);
}
-function opmlexport(App $a)
+function opmlexport()
{
$condition = [
'uid' => DI::userSession()->getLocalUserId(),
}
-function opmlexport_addon_settings(App $a, array &$data)
+function opmlexport_addon_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
-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();
}
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;
}
return;
}
-function pageheader_addon_admin_post(App $a)
+function pageheader_addon_admin_post()
{
- if (!$a->isSiteAdmin()) {
+ if (!DI::userSession()->isSiteAdmin()) {
return;
}
}
}
-function pageheader_fetch(App $a, string &$b)
+function pageheader_fetch(string &$b)
{
if (file_exists('pageheader.html')) {
$s = file_get_contents('pageheader.html');
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);
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
$b .= "</div>";
}
}
-function piwik_addon_admin (App $a, string &$o)
+function piwik_addon_admin (string &$o)
{
$t = Renderer::getMarkupTemplate( "admin.tpl", "addon/piwik/" );
]);
}
-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'] ?? ''));
* - 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');
*
*/
-function planets_settings_post(App $a, $post)
+function planets_settings_post($post)
{
if (!DI::userSession()->getLocalUserId()) {
return;
-function planets_settings(App &$a, array &$data)
+function planets_settings(array &$data)
{
if(!DI::userSession()->getLocalUserId()) {
return;
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;
DBA::update('user', $fields, ['uid' => $uid]);
}
-function public_server_cron(App $a, $b)
+function public_server_cron($b)
{
Logger::notice("public_server: cron start");
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') {
}
}
-function public_server_login(App $a, $b)
+function public_server_login($b)
{
$days = DI::config()->get('public_server', 'expiredays');
if (!$days) {
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');
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');
*/
function pumpio_module() {}
-function pumpio_content(App $a)
+function pumpio_content()
{
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
if (isset(DI::args()->getArgv()[1])) {
switch (DI::args()->getArgv()[1]) {
case 'connect':
- $o = pumpio_connect($a);
+ $o = pumpio_connect();
break;
default:
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');
$notification_data['profiles'][] = 'https://' . $hostname . '/' . $username;
}
-function pumpio_registerclient(App $a, $host)
+function pumpio_registerclient($host)
{
$url = 'https://' . $host . '/api/client/register';
}
-function pumpio_connect(App $a)
+function pumpio_connect()
{
// Define the needed keys
$consumer_key = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key');
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);
return $o;
}
-function pumpio_jot_nets(App $a, array &$jotnets_fields)
+function pumpio_jot_nets(array &$jotnets_fields)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
}
-function pumpio_settings(App $a, array &$data)
+function pumpio_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
];
}
-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' , '');
}
}
-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;
}
}
-function pumpio_post_local(App $a, array &$b)
+function pumpio_post_local(array &$b)
{
if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) {
return;
$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;
} else {
$iscomment = false;
- $receiver = pumpio_getreceiver($a, $b);
+ $receiver = pumpio_getreceiver($b);
Logger::notice('pumpio_send: receiver ', $receiver);
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;
}
}
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'])) {
}
}
-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')) {
}
}
-function pumpio_sync(App $a)
+function pumpio_sync()
{
if (!Addon::isEnabled('pumpio')) {
return;
$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'));
}
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');
}
if ($next_contact_check <= time()) {
- pumpio_getallusers($a, $rr['uid']);
+ pumpio_getallusers($rr['uid']);
DI::pConfig()->set($rr['uid'], 'pumpio', 'contact_check', time());
}
}
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');
}
}
-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
}
}
-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));
// thread completion
if ($threadcompletion) {
- pumpio_fetchallcomments($a, $uid, $post->object->id);
+ pumpio_fetchallcomments($uid, $post->object->id);
}
$contactid = 0;
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];
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') {
$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;
}
}
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');
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');
}
}
-function pumpio_getreceiver(App $a, array $b)
+function pumpio_getreceiver(array $b)
{
$receiver = [];
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');
$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);
}
}
$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);
}
}
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')) {
}
}
- pumpio_sync($a);
+ pumpio_sync();
}
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;
];
}
-function qcomment_addon_settings_post(App $a, array &$b)
+function qcomment_addon_settings_post(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
Logger::notice("removed randplace");
}
-function randplace_post_hook(App $a, &$item)
+function randplace_post_hook(&$item)
{
/*
* An item was posted on the local system.
* 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;
* 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;
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/');
]);
}
-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();
];
$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 . '<div class="renderinfo">' . 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),
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');
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());
}
}
-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());
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;
saml_metadata();
break;
case 'sso':
- saml_sso_reply($a);
+ saml_sso_reply();
break;
case 'slo':
saml_slo_reply();
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 .= <<<EOL
DI::config()->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!');
exit();
}
-function saml_sso_reply(App $a)
+function saml_sso_reply()
{
$auth = new \OneLogin\Saml2\Auth(saml_settings());
$requestID = null;
}
if (!empty($user['uid'])) {
- DI::auth()->setForUser($a, $user);
+ DI::auth()->setForUser($user);
}
if (isset($_POST['RelayState']) && Utils::getSelfURL() != $_POST['RelayState']) {
}
}
-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!');
];
}
-function saml_addon_admin(App $a, string &$o)
+function saml_addon_admin(string &$o)
{
$form =
saml_input(
$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]) : '');
*/
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');
*
* @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;
*
* @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;
*
* @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;
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;
];
}
-function showmore_addon_settings_post(App $a, array &$b)
+function showmore_addon_settings_post(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
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'])) {
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');
}
}
}
-function showmore_dyn_settings(App &$a, array &$data)
+function showmore_dyn_settings(array &$data)
{
if(!DI::userSession()->getLocalUserId()) {
return;
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.
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.
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.
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;
}
$s .= '</tr></table>';
//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';
}
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';
}
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'][] = '<img class="smiley" src="' . DI::baseUrl()->get() . '/addon/smilies_adult/icons/tits.gif' . '" alt="' . '(o)(o)' . '" />';
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;
*
*/
-function startpage_settings_post(App $a, $post)
+function startpage_settings_post($post)
{
if (!DI::userSession()->getLocalUserId()) {
return;
* 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;
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;
}
}
-function statusnet_settings_post(App $a, $post)
+function statusnet_settings_post($post)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
}
-function statusnet_settings(App $a, array &$data)
+function statusnet_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
];
}
-function statusnet_hook_fork(App $a, array &$b)
+function statusnet_hook_fork(array &$b)
{
if ($b['name'] != 'notifier_normal') {
return;
}
}
-function statusnet_post_local(App $a, array &$b)
+function statusnet_post_local(array &$b)
{
if ($b['edit']) {
return;
$b['postopts'] .= 'statusnet';
}
-function statusnet_post_hook(App $a, array &$b)
+function statusnet_post_hook(array &$b)
{
/**
* Post to GNU Social
}
}
-function statusnet_addon_admin_post(App $a)
+function statusnet_addon_admin_post()
{
$sites = [];
$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 = [];
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;
}
-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]);
}
}
-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') {
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'][] = '<div class="app-title"><a href="tictac">' . DI::l10n()->t('Three Dimensional Tic-Tac-Toe') . '</a></div>';
}
*/
function tictac_module() {}
-function tictac_content(App $a) {
+function tictac_content() {
$o = '';
*/
function tumblr_module() {}
-function tumblr_content(App $a)
+function tumblr_content()
{
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
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:
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/" );
]);
}
-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();
return $o;
}
-function tumblr_callback(App $a)
+function tumblr_callback()
{
// Start a session, load the library
session_start();
return $o;
}
-function tumblr_jot_nets(App $a, array &$jotnets_fields)
+function tumblr_jot_nets(array &$jotnets_fields)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
}
-function tumblr_settings(App $a, array &$data)
+function tumblr_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
];
}
-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']));
}
}
-function tumblr_hook_fork(App $a, array &$b)
+function tumblr_hook_fork(array &$b)
{
if ($b['name'] != 'notifier_normal') {
return;
}
}
-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
-function tumblr_send(App $a, array &$b) {
+function tumblr_send(array &$b) {
if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;
// 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');
}
}
-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']]);
$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;
}
}
-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']);
}
}
-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']);
}
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;
}
-function twitter_settings_post(App $a)
+function twitter_settings_post()
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
}
-function twitter_settings(App $a, array &$data)
+function twitter_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
];
}
-function twitter_hook_fork(App $a, array &$b)
+function twitter_hook_fork(array &$b)
{
DI::logger()->debug('twitter_hook_fork', $b);
}
}
-function twitter_post_local(App $a, array &$b)
+function twitter_post_local(array &$b)
{
if ($b['edit']) {
return;
$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'])) {
}
}
-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'])) {
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);
}
return (int)$id;
}
-function twitter_post_hook(App $a, array &$b)
+function twitter_post_hook(array &$b)
{
DI::logger()->debug('Invoke post hook', $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;
}
}
}
-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/');
]);
}
-function twitter_cron(App $a)
+function twitter_cron()
{
$last = DI::keyValue()->get('twitter_last_poll');
$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());
}
*/
DI::keyValue()->set('twitter_last_poll', time());
}
-function twitter_expire(App $a)
+function twitter_expire()
{
$days = DI::config()->get('twitter', 'expire');
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;
/**
* Parse Twitter status URLs since Twitter removed OEmbed
*
- * @param App $a
* @param array $b Expected format:
* [
* 'url' => [URL to parse],
* ]
* @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)) {
return;
}
- $item = twitter_createpost($a, 0, $status, [], true, false, true);
+ $item = twitter_createpost(0, $status, [], true, false, true);
if (empty($item)) {
return;
}
/**
* @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;
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 [];
$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 [];
/**
* 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');
// 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;
}
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]);
/**
* Undocumented function
*
- * @param App $a
* @param integer $uid User ID
* @param object $post Incoming Twitter post
* @param array $self
* @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;
$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 [];
// 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]);
}
}
-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]);
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;
/**
* 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');
$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;
}
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);
}
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;
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');
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);
function twitter_sync_run($argv, $argc)
{
- $a = Friendica\DI::app();
-
require_once 'addon/twitter/twitter.php';
if (function_exists('sys_getloadavg')) {
$uid = intval($argv[2]);
if ($mode == 1) {
- twitter_fetchtimeline($a, $uid);
+ twitter_fetchtimeline($uid);
} elseif ($mode == 2) {
- twitter_fetchhometimeline($a, $uid);
+ twitter_fetchhometimeline($uid);
}
}
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, ':)', '😀');
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
<script>
EOS;
}
-function viewsrc_item_photo_menu(App $a, array &$b)
+function viewsrc_item_photo_menu(array &$b)
{
if (!DI::userSession()->getLocalUserId()) {
return;
DI::storageManager()->unregister(WebDav::class);
}
-function webdav_storage_instance(App $a, array &$data)
+function webdav_storage_instance(array &$data)
{
if ($data['name'] == WebDav::getName()) {
$config = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
}
}
-function webdav_storage_config(App $a, array &$data)
+function webdav_storage_config(array &$data)
{
if ($data['name'] == WebDav::getName()) {
$data['storage_config'] = new WebDavConfig(DI::l10n(), DI::config(), DI::httpClient());
Hook::register('app_menu', 'addon/webrtc/webrtc.php', 'webrtc_app_menu');
}
-function webrtc_app_menu(App $a, array &$b)
+function webrtc_app_menu(array &$b)
{
$b['app_menu'][] = '<div class="app-title"><a href="webrtc">' . DI::l10n()->t('WebRTC Videochat') . '</a></div>';
}
-function webrtc_addon_admin (App $a, string &$o)
+function webrtc_addon_admin (string &$o)
{
$t = Renderer::getMarkupTemplate('admin.tpl', 'addon/webrtc/' );
$o = Renderer::replaceMacros($t, [
]);
}
-function webrtc_addon_admin_post (App $a)
+function webrtc_addon_admin_post ()
{
DI::config()->set('webrtc', 'webrtcurl', trim($_POST['webrtcurl'] ?? ''));
}
*/
function webrtc_module() {}
-function webrtc_content(App $a): string
+function webrtc_content(): string
{
$o = '';
Hook::register('connector_settings_post', 'addon/wppost/wppost.php', 'wppost_settings_post');
}
-function wppost_jot_nets(App &$a, array &$jotnets_fields)
+function wppost_jot_nets(array &$jotnets_fields)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
-function wppost_settings(App &$a, array &$data)
+function wppost_settings(array &$data)
{
if (!DI::userSession()->getLocalUserId()) {
return;
}
-function wppost_settings_post(App $a, array &$b)
+function wppost_settings_post(array &$b)
{
if(!empty($_POST['wppost-submit'])) {
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'wppost', 'post' , intval($_POST['wppost']));
}
}
-function wppost_hook_fork(App $a, array &$b)
+function wppost_hook_fork(array &$b)
{
if ($b['name'] != 'notifier_normal') {
return;
}
}
-function wppost_post_local(App $a, array &$b) {
+function wppost_post_local(array &$b) {
// This can probably be changed to allow editing by pointing to a different API endpoint
-function wppost_send(App $a, array &$b)
+function wppost_send(array &$b)
{
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) {
return;