From 6c3a37efda78ed24d62c9566ff0a0579ca4360ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Thu, 10 May 2018 15:25:59 +0200 Subject: [PATCH] Continued: - even more App and array as type-hints added (cleaner code) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- buffer/buffer.php | 6 +++--- diaspora/diaspora.php | 11 ++++++----- gnot/gnot.php | 6 +++--- ijpost/ijpost.php | 9 +++++---- libertree/libertree.php | 9 +++++---- ljpost/ljpost.php | 9 +++++---- pledgie/pledgie.php | 7 ++++--- pumpio/pumpio.php | 17 +++++++++-------- qcomment/qcomment.php | 5 +++-- showmore/showmore.php | 5 +++-- .../lang/smiley_pack_es/smiley_pack_es.php | 4 +++- .../lang/smiley_pack_fr/smiley_pack_fr.php | 6 +++--- smiley_pack/smiley_pack.php | 3 ++- superblock/superblock.php | 12 ++++++------ wppost/wppost.php | 6 +++--- 15 files changed, 63 insertions(+), 52 deletions(-) diff --git a/buffer/buffer.php b/buffer/buffer.php index 399d37a7..8e89f289 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -109,7 +109,7 @@ function buffer_connect(&$a) { return($o); } -function buffer_jot_nets(&$a,&$b) { +function buffer_jot_nets(App $a, array &$b) { if(! local_user()) return; @@ -205,7 +205,7 @@ function buffer_settings(&$a,&$s) { } -function buffer_settings_post(&$a,&$b) { +function buffer_settings_post(App $a, array &$b) { if(x($_POST,'buffer-submit')) { if(x($_POST,'buffer_delete')) { @@ -219,7 +219,7 @@ function buffer_settings_post(&$a,&$b) { } } -function buffer_post_local(&$a,&$b) { +function buffer_post_local(App $a, array &$b) { if (!local_user() || (local_user() != $b['uid'])) { return; diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 2f8c13fe..0589b1a0 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -9,6 +9,7 @@ require_once 'addon/diaspora/Diaspora_Connection.php'; +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; @@ -35,7 +36,7 @@ function diaspora_uninstall() { } -function diaspora_jot_nets(&$a,&$b) { +function diaspora_jot_nets(App $a, array &$b) { if(! local_user()) return; @@ -48,7 +49,7 @@ function diaspora_jot_nets(&$a,&$b) { } } -function diaspora_queue_hook(&$a,&$b) { +function diaspora_queue_hook(App $a, array &$b) { $hostname = $a->get_hostname(); $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'", @@ -225,7 +226,7 @@ function diaspora_settings(&$a,&$s) { } -function diaspora_settings_post(&$a,&$b) { +function diaspora_settings_post(App $a, array &$b) { if(x($_POST,'diaspora-submit')) { @@ -238,7 +239,7 @@ function diaspora_settings_post(&$a,&$b) { } -function diaspora_post_local(&$a,&$b) { +function diaspora_post_local(App $a, array &$b) { if ($b['edit']) { return; @@ -274,7 +275,7 @@ function diaspora_post_local(&$a,&$b) { -function diaspora_send(&$a,&$b) { +function diaspora_send(App $a, array &$b) { $hostname = $a->get_hostname(); logger('diaspora_send: invoked'); diff --git a/gnot/gnot.php b/gnot/gnot.php index c7678a21..61cf4dc4 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -4,9 +4,9 @@ * Description: Thread email comment notifications on Gmail and anonymise them * Version: 1.0 * Author: Mike Macgirvin - * - * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -92,7 +92,7 @@ function gnot_settings(&$a,&$s) { } -function gnot_enotify_mail(&$a,&$b) { +function gnot_enotify_mail(App $a, array &$b) { if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable')))) return; if($b['type'] == NOTIFY_COMMENT) diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 8d529085..fbcb529f 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -8,6 +8,7 @@ * Author: Cat Gray */ +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; @@ -33,7 +34,7 @@ function ijpost_uninstall() { } -function ijpost_jot_nets(&$a,&$b) { +function ijpost_jot_nets(App $a, array &$b) { if(! local_user()) return; @@ -106,7 +107,7 @@ function ijpost_settings(&$a,&$s) { } -function ijpost_settings_post(&$a,&$b) { +function ijpost_settings_post(App $a, array &$b) { if(x($_POST,'ijpost-submit')) { @@ -119,7 +120,7 @@ function ijpost_settings_post(&$a,&$b) { } -function ijpost_post_local(&$a,&$b) { +function ijpost_post_local(App $a, array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint @@ -150,7 +151,7 @@ function ijpost_post_local(&$a,&$b) { -function ijpost_send(&$a,&$b) { +function ijpost_send(App $a, array &$b) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) return; diff --git a/libertree/libertree.php b/libertree/libertree.php index 7fce4b4e..7459dd52 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -6,6 +6,7 @@ * Author: Tony Baldwin */ +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; @@ -30,7 +31,7 @@ function libertree_uninstall() { } -function libertree_jot_nets(&$a,&$b) { +function libertree_jot_nets(App $a, array &$b) { if(! local_user()) return; @@ -104,7 +105,7 @@ function libertree_settings(&$a,&$s) { } -function libertree_settings_post(&$a,&$b) { +function libertree_settings_post(App $a, array &$b) { if(x($_POST,'libertree-submit')) { @@ -117,7 +118,7 @@ function libertree_settings_post(&$a,&$b) { } -function libertree_post_local(&$a,&$b) { +function libertree_post_local(App $a, array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint @@ -155,7 +156,7 @@ function libertree_post_local(&$a,&$b) { -function libertree_send(&$a,&$b) { +function libertree_send(App $a, array &$b) { logger('libertree_send: invoked'); diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index ec99f9ba..4b962495 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -8,6 +8,7 @@ * Author: Cat Gray */ +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; @@ -33,7 +34,7 @@ function ljpost_uninstall() { } -function ljpost_jot_nets(&$a,&$b) { +function ljpost_jot_nets(App $a, array &$b) { if(! local_user()) return; @@ -101,7 +102,7 @@ function ljpost_settings(&$a,&$s) { } -function ljpost_settings_post(&$a,&$b) { +function ljpost_settings_post(App $a, array &$b) { if(x($_POST,'ljpost-submit')) { @@ -114,7 +115,7 @@ function ljpost_settings_post(&$a,&$b) { } -function ljpost_post_local(&$a,&$b) { +function ljpost_post_local(App $a, array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint @@ -145,7 +146,7 @@ function ljpost_post_local(&$a,&$b) { -function ljpost_send(&$a,&$b) { +function ljpost_send(App $a, array &$b) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) return; diff --git a/pledgie/pledgie.php b/pledgie/pledgie.php index 8b736d8b..58579793 100644 --- a/pledgie/pledgie.php +++ b/pledgie/pledgie.php @@ -5,8 +5,9 @@ * Version: 1.1 * Author: tony baldwin * Hauke Altmann - * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -58,7 +59,7 @@ function pledgie_addon_settings(&$a,&$s) { return; } -function pledgie_addon_settings_post(&$a,&$b) { +function pledgie_addon_settings_post(App $a, array &$b) { if(! is_site_admin()) return; @@ -70,7 +71,7 @@ function pledgie_addon_settings_post(&$a,&$b) { } } -function pledgie_active(&$a,&$b) { +function pledgie_active(App $a, array &$b) { $campaign = Config::get('pledgie-campaign','text'); $describe = Config::get('pledgie-describe','text'); $b .= '
'; diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 3886f720..a1f59c7e 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -212,9 +212,9 @@ function pumpio_connect(&$a) return $o; } -function pumpio_jot_nets(&$a, &$b) +function pumpio_jot_nets(App $a, array &$b) { - if (!local_user()) { + if(! local_user()) return; } @@ -327,10 +327,10 @@ function pumpio_settings(&$a, &$s) $s .= '
'; } -function pumpio_settings_post(&$a, &$b) -{ - if (x($_POST, 'pumpio-submit')) { - if (x($_POST, 'pumpio_delete')) { +function pumpio_settings_post(App $a, array &$b) { + + if (x($_POST,'pumpio-submit')) { + if (x($_POST,'pumpio_delete')) { PConfig::set(local_user(), 'pumpio', 'consumer_key', ''); PConfig::set(local_user(), 'pumpio', 'consumer_secret', ''); PConfig::set(local_user(), 'pumpio', 'oauth_token', ''); @@ -405,7 +405,7 @@ function pumpio_post_local(App $a, array &$b) $b['postopts'] .= 'pumpio'; } -function pumpio_send(&$a, &$b) +function pumpio_send(App $a, array &$b) { if (!PConfig::get($b["uid"], 'pumpio', 'import')) { if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { @@ -1398,11 +1398,12 @@ function pumpio_getallusers(&$a, $uid) } } -function pumpio_queue_hook(&$a, &$b) +function pumpio_queue_hook(App $a, array &$b) { $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'", dbesc(NETWORK_PUMPIO) ); + if (!DBM::is_result($qi)) { return; } diff --git a/qcomment/qcomment.php b/qcomment/qcomment.php index c499fb86..9053f3f7 100644 --- a/qcomment/qcomment.php +++ b/qcomment/qcomment.php @@ -15,8 +15,9 @@ * you wish to use them. On some themes they may be visible. * Wave the mouse around near the comment input box and the qcomments will show up. Click on any of * them to open the comment window fully and insert the qcomment. Then "Submit" will submit it. - * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -59,7 +60,7 @@ function qcomment_addon_settings(&$a, &$s) return; } -function qcomment_addon_settings_post(&$a,&$b) { +function qcomment_addon_settings_post(App $a, array &$b) { if(! local_user()) return; diff --git a/showmore/showmore.php b/showmore/showmore.php index 3673c956..4ae66e85 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -5,8 +5,9 @@ * Version: 1.0 * Author: Michael Vogel * based upon NSFW from Mike Macgirvin - * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -61,7 +62,7 @@ function showmore_addon_settings(&$a,&$s) { return; } -function showmore_addon_settings_post(&$a,&$b) { +function showmore_addon_settings_post(App $a, array &$b) { if(! local_user()) return; diff --git a/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php b/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php index 47566380..c19f840f 100644 --- a/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php +++ b/smiley_pack/lang/smiley_pack_es/smiley_pack_es.php @@ -6,6 +6,8 @@ * Author: Thomas Willingham (based on Mike Macgirvin's Adult Smile template) * All smileys from sites offering them as Public Domain */ + +use Friendica\App; use Friendica\Core\Addon; function smiley_pack_es_install() { @@ -18,7 +20,7 @@ function smiley_pack_es_uninstall() { -function smiley_pack_smilies_es(&$a,&$b) { +function smiley_pack_smilies_es(App $a, array &$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php b/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php index 282c0dde..143d0dd2 100644 --- a/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php +++ b/smiley_pack/lang/smiley_pack_fr/smiley_pack_fr.php @@ -5,9 +5,9 @@ * Version: 1.01 * Author: Thomas Willingham (based on Mike Macgirvin's Adult Smile template) * All smileys from sites offering them as Public Domain - * - * */ + +use Friendica\App; use Friendica\Core\Addon; function smiley_pack_fr_install() { @@ -20,7 +20,7 @@ function smiley_pack_fr_uninstall() { -function smiley_pack_fr_smilies(&$a,&$b) { +function smiley_pack_fr_smilies(App $a, array &$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/smiley_pack/smiley_pack.php b/smiley_pack/smiley_pack.php index ea3490eb..7695629d 100644 --- a/smiley_pack/smiley_pack.php +++ b/smiley_pack/smiley_pack.php @@ -7,6 +7,7 @@ * All smileys from sites offering them as Public Domain */ +use Friendica\App; use Friendica\Core\Addon; function smiley_pack_install() { @@ -19,7 +20,7 @@ function smiley_pack_uninstall() { -function smiley_pack_smilies(&$a,&$b) { +function smiley_pack_smilies(App $a, array &$b) { #Smileys are split into various directories by the intended range of emotions. This is in case we get too big and need to modularise things. We can then cut and paste the right lines, move the right directory, and just change the name of the addon to happy_smilies or whatever. diff --git a/superblock/superblock.php b/superblock/superblock.php index 24111486..aa4d99a0 100644 --- a/superblock/superblock.php +++ b/superblock/superblock.php @@ -1,6 +1,4 @@ * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -69,7 +69,7 @@ function superblock_addon_settings(&$a,&$s) { return; } -function superblock_addon_settings_post(&$a,&$b) { +function superblock_addon_settings_post(App $a, array &$b) { if(! local_user()) return; @@ -80,7 +80,7 @@ function superblock_addon_settings_post(&$a,&$b) { } } -function superblock_enotify_store(&$a,&$b) { +function superblock_enotify_store(App $a, array &$b) { $words = PConfig::get($b['uid'],'system','blocked'); if($words) { @@ -109,7 +109,7 @@ function superblock_enotify_store(&$a,&$b) { } -function superblock_conversation_start(&$a,&$b) { +function superblock_conversation_start(App $a, array &$b) { if(! local_user()) return; @@ -132,7 +132,7 @@ EOT; } -function superblock_item_photo_menu(&$a,&$b) { +function superblock_item_photo_menu(App $a, array &$b) { if((! local_user()) || ($b['item']['self'])) return; diff --git a/wppost/wppost.php b/wppost/wppost.php index 0c023187..14bb2934 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -38,7 +38,7 @@ function wppost_uninstall() { } -function wppost_jot_nets(&$a,&$b) { +function wppost_jot_nets(App $a, array &$b) { if(! local_user()) return; @@ -137,7 +137,7 @@ function wppost_settings(&$a,&$s) { } -function wppost_settings_post(&$a,&$b) { +function wppost_settings_post(App $a, array &$b) { if(x($_POST,'wppost-submit')) { @@ -195,7 +195,7 @@ function wppost_post_local(App $a, array &$b) { -function wppost_send(&$a,&$b) { +function wppost_send(App $a, array &$b) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return;