diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php
index 45ab3f3e0..6925f8168 100644
--- a/advancedcontentfilter/advancedcontentfilter.php
+++ b/advancedcontentfilter/advancedcontentfilter.php
@@ -180,6 +180,11 @@ function advancedcontentfilter_addon_settings(App $a, array &$data)
* Module
*/
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
function advancedcontentfilter_module() {}
function advancedcontentfilter_init(App $a)
diff --git a/birdavatar/birdavatar.php b/birdavatar/birdavatar.php
index d17a455c3..797531102 100644
--- a/birdavatar/birdavatar.php
+++ b/birdavatar/birdavatar.php
@@ -136,9 +136,12 @@ function birdavatar_lookup(App $a, array &$b)
$b['success'] = true;
}
-function birdavatar_module()
-{
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function birdavatar_module() {}
/**
* Returns image for user id
diff --git a/blockem/blockem.php b/blockem/blockem.php
index 79e04c8b5..951385b1c 100644
--- a/blockem/blockem.php
+++ b/blockem/blockem.php
@@ -186,9 +186,12 @@ function blockem_item_photo_menu(App $a, array &$b)
}
}
-function blockem_module()
-{
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function blockem_module() {}
function blockem_init(App $a)
{
diff --git a/calc/calc.php b/calc/calc.php
index 48371dd39..3159bf6af 100644
--- a/calc/calc.php
+++ b/calc/calc.php
@@ -19,10 +19,12 @@ function calc_app_menu(App $a, array &$b)
$b['app_menu'][] = '
';
}
-
-function calc_module()
-{
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function calc_module() {}
function calc_init(App $a)
{
diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php
index 3fe2affbd..ce1fc78bc 100644
--- a/catavatar/catavatar.php
+++ b/catavatar/catavatar.php
@@ -137,6 +137,11 @@ function catavatar_lookup(App $a, array &$b)
$b['success'] = true;
}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
function catavatar_module() {}
/**
diff --git a/convert/convert.php b/convert/convert.php
index 51cc08d89..9c72cbedd 100644
--- a/convert/convert.php
+++ b/convert/convert.php
@@ -21,166 +21,170 @@ function convert_app_menu(App $a, array &$b)
function convert_module() {}
-function convert_content($app) {
+function convert_content(App $a) {
+ // @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';
-include 'UnitConvertor.php';
-
- class TP_Converter extends UnitConvertor {
- function TP_Converter($lang = 'en')
+ class TP_Converter extends UnitConvertor
{
- if ($lang != 'en' ) {
- $dec_point = '.'; $thousand_sep = "'";
- } else {
- $dec_point = '.'; $thousand_sep = ',';
+ public function __construct(string $lang = 'en')
+ {
+ if ($lang == 'en' ) {
+ $dec_point = '.';
+ $thousand_sep = ',';
+ } else {
+ $dec_point = '.';
+ $thousand_sep = "'";
+ }
+
+ parent::UnitConvertor($dec_point, $thousand_sep );
}
- $this->UnitConvertor($dec_point , $thousand_sep );
+ private function findBaseUnit($from, $to)
+ {
+ while (list($skey, $sval) = each($this->bases)) {
+ if ($skey == $from || $to == $skey || in_array($to, $sval) || in_array($from, $sval)) {
+ return $skey;
+ }
+ }
- } // end func UnitConvertor
-
- function find_base_unit($from,$to) {
- while (list($skey,$sval) = each($this->bases)) {
- if ($skey == $from || $to == $skey || in_array($to,$sval) || in_array($from,$sval)) {
- return $skey;
- }
+ return false;
}
- return false;
- }
- function getTable($value, $from_unit, $to_unit, $precision) {
-
- if ($base_unit = $this->find_base_unit($from_unit,$to_unit)) {
-
- // A baseunit was found now lets convert from -> $base_unit
+ public function getTable($value, $from_unit, $to_unit, $precision): string
+ {
+ $string = '';
+ if ($base_unit = $this->findBaseUnit($from_unit, $to_unit)) {
+ // A baseunit was found now lets convert from -> $base_unit
$cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision) . ' ' . $base_unit;
- $cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? 'framedred' : '';
- $cells[] = $cell;
- // We now have the base unit and value now lets produce the table;
- while (list($key,$val) = each($this->bases[$base_unit])) {
- $cell ['value'] = $this->convert($value, $from_unit, $val, $precision) . ' ' . $val;
- $cell ['class'] = ($val == $from_unit || $val == $to_unit) ? 'framedred' : '';
+ $cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? 'framedred' : '';
$cells[] = $cell;
+
+ // We now have the base unit and value now lets produce the table;
+ while (list($key, $val) = each($this->bases[$base_unit])) {
+ $cell ['value'] = $this->convert($value, $from_unit, $val, $precision) . ' ' . $val;
+ $cell ['class'] = ($val == $from_unit || $val == $to_unit) ? 'framedred' : '';
+ $cells[] = $cell;
+ }
+
+ $cc = count($cells);
+ $string = "";
+ $string .= "$value $from_unit | ";
+ $i = 0;
+ foreach ($cells as $cell) {
+ if ($i == 0) {
+ $string .= "" . $cell['value'] . " | ";
+ $i++;
+ } else {
+ $string .= "
" . $cell['value'] . " | ";
+ }
+ }
+ $string .= "
";
}
- $cc = count($cells);
- $string = "";
- $string .= "$value $from_unit | ";
- $i=0;
- foreach ($cells as $cell) {
- if ($i==0) {
- $string .= "".$cell['value']." | ";
- $i++;
- } else {
- $string .= "
".$cell['value']." | ";
- }
- }
- $string .= "
";
return $string;
}
-
}
-}
-$conv = new TP_Converter('en');
+ $conv = new TP_Converter('en');
-$conversions = [
- 'Temperature' => ['base' => 'Celsius',
- 'conv' => [
- 'Fahrenheit' => ['ratio' => 1.8, 'offset' => 32],
- 'Kelvin' => ['ratio' => 1, 'offset' => 273],
- 'Reaumur' => 0.8
+ $conversions = [
+ 'Temperature' => ['base' => 'Celsius',
+ 'conv' => [
+ 'Fahrenheit' => ['ratio' => 1.8, 'offset' => 32],
+ 'Kelvin' => ['ratio' => 1, 'offset' => 273],
+ 'Reaumur' => 0.8
+ ]
+ ],
+ 'Weight' => ['base' => 'kg',
+ 'conv' => [
+ 'g' => 1000,
+ 'mg' => 1000000,
+ 't' => 0.001,
+ 'grain' => 15432,
+ 'oz' => 35.274,
+ 'lb' => 2.2046,
+ 'cwt(UK)' => 0.019684,
+ 'cwt(US)' => 0.022046,
+ 'ton (US)' => 0.0011023,
+ 'ton (UK)' => 0.0009842
+ ]
+ ],
+ 'Distance' => ['base' => 'km',
+ 'conv' => [
+ 'm' => 1000,
+ 'dm' => 10000,
+ 'cm' => 100000,
+ 'mm' => 1000000,
+ 'mile' => 0.62137,
+ 'naut.mile' => 0.53996,
+ 'inch(es)' => 39370,
+ 'ft' => 3280.8,
+ 'yd' => 1093.6,
+ 'furlong' => 4.970969537898672,
+ 'fathom' => 546.8066491688539
+ ]
+ ],
+ 'Area' => ['base' => 'km 2',
+ 'conv' => [
+ 'ha' => 100,
+ 'acre' => 247.105,
+ 'm 2' => pow(1000,2),
+ 'dm 2' => pow(10000,2),
+ 'cm 2' => pow(100000,2),
+ 'mm 2' => pow(1000000,2),
+ 'mile 2' => pow(0.62137,2),
+ 'naut.miles 2' => pow(0.53996,2),
+ 'in 2' => pow(39370,2),
+ 'ft 2' => pow(3280.8,2),
+ 'yd 2' => pow(1093.6,2),
+ ]
+ ],
+ 'Volume' => ['base' => 'm 3',
+ 'conv' => [
+ 'in 3' => 61023.6,
+ 'ft 3' => 35.315,
+ 'cm 3' => pow(10,6),
+ 'dm 3' => 1000,
+ 'litre' => 1000,
+ 'hl' => 10,
+ 'yd 3' => 1.30795,
+ 'gal(US)' => 264.172,
+ 'gal(UK)' => 219.969,
+ 'pint' => 2113.376,
+ 'quart' => 1056.688,
+ 'cup' => 4266.753,
+ 'fl oz' => 33814.02,
+ 'tablespoon' => 67628.04,
+ 'teaspoon' => 202884.1,
+ 'pt (UK)' => 1000/0.56826,
+ 'barrel petroleum' => 1000/158.99,
+ 'Register Tons' => 2.832,
+ 'Ocean Tons' => 1.1327
+ ]
+ ],
+ 'Speed' => ['base' => 'kmph',
+ 'conv' => [
+ 'mps' => 0.0001726031,
+ 'milesph' => 0.62137,
+ 'knots' => 0.53996,
+ 'mach STP' => 0.0008380431,
+ 'c (warp)' => 9.265669e-10
+ ]
]
- ],
- 'Weight' => ['base' => 'kg',
- 'conv' => [
- 'g' => 1000,
- 'mg' => 1000000,
- 't' => 0.001,
- 'grain' => 15432,
- 'oz' => 35.274,
- 'lb' => 2.2046,
- 'cwt(UK)' => 0.019684,
- 'cwt(US)' => 0.022046,
- 'ton (US)' => 0.0011023,
- 'ton (UK)' => 0.0009842
- ]
- ],
- 'Distance' => ['base' => 'km',
- 'conv' => [
- 'm' => 1000,
- 'dm' => 10000,
- 'cm' => 100000,
- 'mm' => 1000000,
- 'mile' => 0.62137,
- 'naut.mile' => 0.53996,
- 'inch(es)' => 39370,
- 'ft' => 3280.8,
- 'yd' => 1093.6,
- 'furlong' => 4.970969537898672,
- 'fathom' => 546.8066491688539
- ]
- ],
- 'Area' => ['base' => 'km 2',
- 'conv' => [
- 'ha' => 100,
- 'acre' => 247.105,
- 'm 2' => pow(1000,2),
- 'dm 2' => pow(10000,2),
- 'cm 2' => pow(100000,2),
- 'mm 2' => pow(1000000,2),
- 'mile 2' => pow(0.62137,2),
- 'naut.miles 2' => pow(0.53996,2),
- 'in 2' => pow(39370,2),
- 'ft 2' => pow(3280.8,2),
- 'yd 2' => pow(1093.6,2),
- ]
- ],
- 'Volume' => ['base' => 'm 3',
- 'conv' => [
- 'in 3' => 61023.6,
- 'ft 3' => 35.315,
- 'cm 3' => pow(10,6),
- 'dm 3' => 1000,
- 'litre' => 1000,
- 'hl' => 10,
- 'yd 3' => 1.30795,
- 'gal(US)' => 264.172,
- 'gal(UK)' => 219.969,
- 'pint' => 2113.376,
- 'quart' => 1056.688,
- 'cup' => 4266.753,
- 'fl oz' => 33814.02,
- 'tablespoon' => 67628.04,
- 'teaspoon' => 202884.1,
- 'pt (UK)' => 1000/0.56826,
- 'barrel petroleum' => 1000/158.99,
- 'Register Tons' => 2.832,
- 'Ocean Tons' => 1.1327
- ]
- ],
- 'Speed' => ['base' => 'kmph',
- 'conv' => [
- 'mps' => 0.0001726031,
- 'milesph' => 0.62137,
- 'knots' => 0.53996,
- 'mach STP' => 0.0008380431,
- 'c (warp)' => 9.265669e-10
- ]
- ]
-];
+ ];
-
-while (list($key,$val) = each($conversions)) {
- $conv->addConversion($val['base'], $val['conv']);
- $list[$key][] = $val['base'];
- while (list($ukey,$uval) = each($val['conv'])) {
- $list[$key][] = $ukey;
+ while (list($key,$val) = each($conversions)) {
+ $conv->addConversion($val['base'], $val['conv']);
+ $list[$key][] = $val['base'];
+ while (list($ukey,$uval) = each($val['conv'])) {
+ $list[$key][] = $ukey;
+ }
}
-}
-
- $o .= 'Unit Conversions
';
+ $o .= 'Unit Conversions
';
if (isset($_POST['from_unit']) && isset($_POST['value'])) {
$_POST['value'] = $_POST['value'] + 0;
diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php
index 25460def5..42cc4c54b 100644
--- a/forumdirectory/forumdirectory.php
+++ b/forumdirectory/forumdirectory.php
@@ -25,10 +25,17 @@ function forumdirectory_install()
Hook::register('app_menu', 'addon/forumdirectory/forumdirectory.php', 'forumdirectory_app_menu');
}
-function forumdirectory_module()
-{
- return;
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function forumdirectory_module() {}
function forumdirectory_app_menu(App $a, array &$b)
{
diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php
index 5962e2ae9..7154178a8 100644
--- a/ifttt/ifttt.php
+++ b/ifttt/ifttt.php
@@ -24,15 +24,14 @@ function ifttt_install()
Hook::register('connector_settings_post', 'addon/ifttt/ifttt.php', 'ifttt_settings_post');
}
-function ifttt_module()
-{
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function ifttt_module() {}
-}
-
-function ifttt_content()
-{
-
-}
+function ifttt_content() {}
function ifttt_settings(App $a, array &$data)
{
diff --git a/impressum/impressum.php b/impressum/impressum.php
index 7d9edfd55..8a0543603 100644
--- a/impressum/impressum.php
+++ b/impressum/impressum.php
@@ -24,9 +24,12 @@ function impressum_install()
Logger::notice("installed impressum Addon");
}
-function impressum_module()
-{
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function impressum_module() {}
function impressum_content()
{
diff --git a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php
index 5f2052b16..ce0c3cdaa 100644
--- a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php
+++ b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php
@@ -20,11 +20,12 @@ function infiniteimprobabilitydrive_app_menu(App $a, array &$b)
$b['app_menu'][] = '';
}
-
-function infiniteimprobabilitydrive_module()
-{
- return;
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function infiniteimprobabilitydrive_module() {}
function infiniteimprobabilitydrive_content(App $a)
diff --git a/irc/irc.php b/irc/irc.php
index 072ec4c5b..104218454 100644
--- a/irc/irc.php
+++ b/irc/irc.php
@@ -64,11 +64,12 @@ function irc_app_menu(App $a, array &$b)
$b['app_menu'][] = '';
}
-
-function irc_module() {
- return;
-}
-
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function irc_module() {}
function irc_content(App $a)
{
diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php
index 9eafaf31f..08fb46a6b 100644
--- a/mailstream/mailstream.php
+++ b/mailstream/mailstream.php
@@ -58,11 +58,11 @@ function mailstream_check_version()
}
/**
- * This function indicates a module that can be wrapped in the LegacyModule class
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
*/
-function mailstream_module()
-{
-}
+function mailstream_module() {}
/**
* Adds an item in "addon features" in the admin menu of the site
@@ -70,7 +70,7 @@ function mailstream_module()
* @param App $a App object (unused)
* @param string $o HTML form data
*/
-function mailstream_addon_admin(App $a, &$o)
+function mailstream_addon_admin(App $a, string &$o)
{
$frommail = DI::config()->get('mailstream', 'frommail');
$template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/');
diff --git a/namethingy/namethingy.php b/namethingy/namethingy.php
index 77931ab4e..8e5b3cea8 100644
--- a/namethingy/namethingy.php
+++ b/namethingy/namethingy.php
@@ -23,9 +23,12 @@ function namethingy_app_menu(App $a, array &$b)
}
-function namethingy_module()
-{
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function namethingy_module() {}
function namethingy_content(App $a)
{
diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php
index b04dfa293..7c852dd8f 100644
--- a/notifyall/notifyall.php
+++ b/notifyall/notifyall.php
@@ -15,6 +15,11 @@ use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\DI;
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
function notifyall_module() {}
function notifyall_addon_admin(App $a, &$o)
diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php
index 774db1728..e1432dd33 100644
--- a/pumpio/pumpio.php
+++ b/pumpio/pumpio.php
@@ -50,6 +50,11 @@ function pumpio_install()
Hook::register('check_item_notification', 'addon/pumpio/pumpio.php', 'pumpio_check_item_notification');
}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
function pumpio_module() {}
function pumpio_content(App $a)
diff --git a/superblock/superblock.php b/superblock/superblock.php
index 3a1422ced..dcc4242ff 100644
--- a/superblock/superblock.php
+++ b/superblock/superblock.php
@@ -130,9 +130,13 @@ function superblock_item_photo_menu(App $a, array &$b)
$b['menu'][DI::l10n()->t('Block Completely')] = 'javascript:superblockBlock(\'' . $author . '\'); return false;';
}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
function superblock_module() {}
-
function superblock_init(App $a)
{
if (!local_user()) {
diff --git a/tictac/tictac.php b/tictac/tictac.php
index fb746f946..3105e2845 100644
--- a/tictac/tictac.php
+++ b/tictac/tictac.php
@@ -20,10 +20,12 @@ function tictac_app_menu(App $a, array &$b)
$b['app_menu'][] = '';
}
-function tictac_module()
-{
- return;
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function tictac_module() {}
function tictac_content(App $a) {
diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php
index 56772b147..74f24099e 100644
--- a/tumblr/tumblr.php
+++ b/tumblr/tumblr.php
@@ -29,9 +29,12 @@ function tumblr_install()
Hook::register('connector_settings_post', 'addon/tumblr/tumblr.php', 'tumblr_settings_post');
}
-function tumblr_module()
-{
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function tumblr_module() {}
function tumblr_content(App $a)
{
diff --git a/twitter/twitter.php b/twitter/twitter.php
index f02c6563c..3ed2a0309 100644
--- a/twitter/twitter.php
+++ b/twitter/twitter.php
@@ -1740,7 +1740,7 @@ function twitter_media_entities($post, array &$postarray, int $uriId = -1)
* @param integer $uriId URI Id used to store tags. 0 = create a new one; -1 = don't store tags for this post.
* @return array item array
*/
-function twitter_createpost(App $a, int $uid, $post, array $self, $create_user, bool $only_existing_contact, $noquote, int $uriId = 0): array
+function twitter_createpost(App $a, int $uid, $post, array $self, $create_user, bool $only_existing_contact, bool $noquote, int $uriId = 0): array
{
$postarray = [];
$postarray['network'] = Protocol::TWITTER;
diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php
index afecefaab..594ebe507 100644
--- a/webrtc/webrtc.php
+++ b/webrtc/webrtc.php
@@ -29,15 +29,19 @@ function webrtc_addon_admin (App $a, &$o)
'$webrtcurl' => ['webrtcurl', DI::l10n()->t('WebRTC Base URL'), DI::config()->get('webrtc','webrtcurl' ), DI::l10n()->t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')],
]);
}
+
function webrtc_addon_admin_post (App $a)
{
$url = trim($_POST['webrtcurl'] ?? '');
DI::config()->set('webrtc', 'webrtcurl', $url);
}
-function webrtc_module() {
- return;
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function webrtc_module() {}
function webrtc_content(App $a)
{
diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php
index fe3f76468..e08cb5a04 100644
--- a/windowsphonepush/windowsphonepush.php
+++ b/windowsphonepush/windowsphonepush.php
@@ -60,10 +60,12 @@ function windowsphonepush_install()
}
/* declare the windowsphonepush function so that /windowsphonepush url requests will land here */
-function windowsphonepush_module()
-{
-
-}
+/**
+ * This is a statement rather than an actual function definition. The simple
+ * existence of this method is checked to figure out if the addon offers a
+ * module.
+ */
+function windowsphonepush_module() {}
/* Callback from the settings post function.
* $post contains the $_POST array.