From 5f02272cf9118d24262ec0d7621b550d4d3a3e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Thu, 10 May 2018 15:13:30 +0200 Subject: [PATCH 01/29] Continued: - added App (and imported it) as type-hint for $a - also avoided & here as $a should not be modified within the function - $b is 99.999% an array, let's add type-hint here MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- blockem/blockem.php | 17 ++-- blogger/blogger.php | 9 +- buffer/buffer.php | 2 +- buglink/buglink.php | 4 +- dwpost/dwpost.php | 11 ++- fortunate/fortunate.php | 4 +- forumdirectory/forumdirectory.php | 3 +- fromgplus/fromgplus.php | 71 ++++++++------ geocoordinates/geocoordinates.php | 16 +++- geonames/geonames.php | 4 +- googlemaps/googlemaps.php | 10 +- gravatar/gravatar.php | 4 +- group_text/group_text.php | 4 +- impressum/impressum.php | 3 +- .../infiniteimprobabilitydrive.php | 4 +- irc/irc.php | 6 +- jappixmini/jappixmini.php | 4 +- js_upload/js_upload.php | 10 +- krynn/krynn.php | 4 +- langfilter/langfilter.php | 5 +- ldapauth/ldapauth.php | 6 +- libravatar/libravatar.php | 4 +- mailstream/mailstream.php | 94 ++++++++++++------- mathjax/mathjax.php | 3 +- membersince/membersince.php | 7 +- morepokes/morepokes.php | 4 +- nsfw/nsfw.php | 8 +- openstreetmap/openstreetmap.php | 12 ++- pageheader/pageheader.php | 6 +- public_server/public_server.php | 3 +- pumpio/pumpio.php | 4 +- securemail/securemail.php | 6 +- smileybutton/smileybutton.php | 8 +- smilies_adult/smilies_adult.php | 4 +- statusnet/statusnet.php | 8 +- testdrive/testdrive.php | 8 +- tumblr/tumblr.php | 26 ++--- twitter/twitter.php | 10 +- unicode_smilies/unicode_smilies.php | 4 +- viewsrc/viewsrc.php | 4 +- wppost/wppost.php | 3 +- xmpp/xmpp.php | 1 + 42 files changed, 261 insertions(+), 167 deletions(-) diff --git a/blockem/blockem.php b/blockem/blockem.php index 3de7be40..7c1c4292 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -6,6 +6,8 @@ * Author: Mike Macgirvin * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -68,7 +70,7 @@ function blockem_addon_settings(&$a, &$s) } -function blockem_addon_settings_post(&$a,&$b) { +function blockem_addon_settings_post(App $a, $b) { if(! local_user()) return; @@ -79,7 +81,7 @@ function blockem_addon_settings_post(&$a,&$b) { } } -function blockem_enotify_store(&$a,&$b) { +function blockem_enotify_store(App $a, $b) { $words = PConfig::get($b['uid'],'blockem','words'); if($words) { @@ -107,7 +109,7 @@ function blockem_enotify_store(&$a,&$b) { } } -function blockem_prepare_body_content_filter(\Friendica\App $a, &$hook_data) +function blockem_prepare_body_content_filter(App $a, array &$hook_data) { if (!local_user()) { return; @@ -137,16 +139,17 @@ function blockem_prepare_body_content_filter(\Friendica\App $a, &$hook_data) } } -function blockem_display_item(&$a,&$b) { +function blockem_display_item(App $a, array &$b) { if (empty($b['output']['body'])) { return; } - if(strstr($b['output']['body'],'id="blockem-wrap-')) + if (strstr($b['output']['body'],'id="blockem-wrap-')) { $b['output']['thumb'] = $a->get_baseurl() . "/images/person-80.jpg"; + } } -function blockem_conversation_start(&$a,&$b) { +function blockem_conversation_start(App $a, $b) { if(! local_user()) return; @@ -174,7 +177,7 @@ EOT; } -function blockem_item_photo_menu(&$a,&$b) { +function blockem_item_photo_menu(App $a, $b) { if((! local_user()) || ($b['item']['self'])) return; diff --git a/blogger/blogger.php b/blogger/blogger.php index 30c450bd..1ca74e0c 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -6,6 +6,7 @@ * */ +use Friencia\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; @@ -36,7 +37,7 @@ function blogger_uninstall() } -function blogger_jot_nets(&$a, &$b) +function blogger_jot_nets(App $a, array &$b) { if (!local_user()) { return; @@ -115,7 +116,7 @@ function blogger_settings(&$a, &$s) } -function blogger_settings_post(&$a, &$b) +function blogger_settings_post(App $a, array &$b) { if (x($_POST, 'blogger-submit')) { PConfig::set(local_user(), 'blogger', 'post', intval($_POST['blogger'])); @@ -126,7 +127,7 @@ function blogger_settings_post(&$a, &$b) } } -function blogger_post_local(&$a, &$b) +function blogger_post_local(App $a, array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint @@ -164,7 +165,7 @@ function blogger_post_local(&$a, &$b) -function blogger_send(&$a, &$b) +function blogger_send(App $a, array &$b) { if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return; diff --git a/buffer/buffer.php b/buffer/buffer.php index ef95f1d7..399d37a7 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -244,7 +244,7 @@ function buffer_post_local(&$a,&$b) { $b['postopts'] .= 'buffer'; } -function buffer_send(App $a, &$b) +function buffer_send(App $a, array &$b) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return; diff --git a/buglink/buglink.php b/buglink/buglink.php index 71c22a67..4088cf8c 100644 --- a/buglink/buglink.php +++ b/buglink/buglink.php @@ -5,6 +5,8 @@ * Version: 1.0 * Author: Mike Macgirvin */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\L10n; @@ -18,7 +20,7 @@ function buglink_uninstall() Addon::unregisterHook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); } -function buglink_active(&$a, &$b) +function buglink_active(App $a, array &$b) { $b .= ''; } diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index a46f55b2..d95a97a5 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.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 dwpost_uninstall() { } -function dwpost_jot_nets(&$a,&$b) { +function dwpost_jot_nets(App $a, $b) { if(! local_user()) return; @@ -47,7 +48,7 @@ function dwpost_jot_nets(&$a,&$b) { } -function dwpost_settings(&$a,&$s) { +function dwpost_settings(App $a, $s) { if(! local_user()) return; @@ -107,7 +108,7 @@ function dwpost_settings(&$a,&$s) { } -function dwpost_settings_post(&$a,&$b) { +function dwpost_settings_post(App $a, $b) { if(x($_POST,'dwpost-submit')) { @@ -120,7 +121,7 @@ function dwpost_settings_post(&$a,&$b) { } -function dwpost_post_local(&$a,&$b) { +function dwpost_post_local(App $a, $b) { // This can probably be changed to allow editing by pointing to a different API endpoint @@ -151,7 +152,7 @@ function dwpost_post_local(&$a,&$b) { -function dwpost_send(&$a,&$b) { +function dwpost_send(App $a, $b) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) return; diff --git a/fortunate/fortunate.php b/fortunate/fortunate.php index ebece489..96cf34a3 100644 --- a/fortunate/fortunate.php +++ b/fortunate/fortunate.php @@ -6,6 +6,8 @@ * Author: Mike Macgirvin * Status: Unsupported */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Util\Network; @@ -27,7 +29,7 @@ function fortunate_uninstall() } -function fortunate_fetch(&$a, &$b) +function fortunate_fetch(App $a, array &$b) { $a->page['htmlhead'] .= '' . "\r\n"; diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index a72c45ba..4c7f5d6c 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -6,6 +6,7 @@ * Author: Thomas Willingham */ +use Friencia\App; use Friendica\Content\Nav; use Friendica\Content\Widget; use Friendica\Core\Addon; @@ -34,7 +35,7 @@ function forumdirectory_module() return; } -function forumdirectory_app_menu($a, &$b) +function forumdirectory_app_menu(App $a, array &$b) { $b['app_menu'][] = ''; } diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 0f208037..9bb64970 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -9,6 +9,7 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -38,7 +39,7 @@ function fromgplus_uninstall() { Addon::unregisterHook('addon_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post'); } -function fromgplus_addon_settings(&$a,&$s) { +function fromgplus_addon_settings(App $a, $s) { if(! local_user()) return; @@ -79,7 +80,7 @@ class="settings-submit" value="' . L10n::t('Save Settings') . '" />'; return; } -function fromgplus_addon_settings_post(&$a,&$b) { +function fromgplus_addon_settings_post(App $a, $b) { if(! local_user()) return; @@ -213,11 +214,10 @@ function fromgplus_html2bbcode($html) { $bbcode = str_ireplace(["
"], ["\n"], $bbcode); $bbcode = trim(strip_tags($bbcode)); - return($bbcode); + return $bbcode; } -function fromgplus_parse_query($var) - { +function fromgplus_parse_query($var) { /** * Use this function to parse out the query array element from * the output of parse_url(). @@ -246,38 +246,47 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) { //$image = str_replace(array($preview, $preview2), array("/", "/"), $image->url); $image = $image->url; - $cleaned = []; + $cleaned = []; $queryvar = fromgplus_parse_query($fullImage); - if ($queryvar['url'] != "") - $cleaned["full"] = urldecode($queryvar['url']); - else + + if ($queryvar['url'] != "") { + $cleaned["full"] = urldecode($queryvar['url']); + } else { $cleaned["full"] = $fullImage; - if (@exif_imagetype($cleaned["full"]) == 0) + } + + if (exif_imagetype($cleaned["full"]) == 0) { $cleaned["full"] = ""; + } $queryvar = fromgplus_parse_query($image); - if ($queryvar['url'] != "") - $cleaned["preview"] = urldecode($queryvar['url']); - else + if ($queryvar['url'] != "") { + $cleaned["preview"] = urldecode($queryvar['url']); + } else { $cleaned["preview"] = $image; - if (@exif_imagetype($cleaned["preview"]) == 0) + } + + if (exif_imagetype($cleaned["preview"]) == 0) { $cleaned["preview"] = ""; + } if ($cleaned["full"] == "") { $cleaned["full"] = $cleaned["preview"]; $cleaned["preview"] = ""; } - if ($cleaned["full"] != "") + if ($cleaned["full"] != "") { $infoFull = Image::getInfoFromURL($cleaned["full"]); - else + } else { $infoFull = ["0" => 0, "1" => 0]; + } - if ($cleaned["preview"] != "") + if ($cleaned["preview"] != "") { $infoPreview = Image::getInfoFromURL($cleaned["preview"]); - else + } else { $infoFull = ["0" => 0, "1" => 0]; + } if (($infoPreview[0] >= $infoFull[0]) && ($infoPreview[1] >= $infoFull[1])) { $temp = $cleaned["full"]; @@ -285,21 +294,22 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) { $cleaned["preview"] = $temp; } - if (($cleaned["full"] == $cleaned["preview"]) || (($infoPreview[0] == $infoFull[0]) && ($infoPreview[1] == $infoFull[1]))) + if (($cleaned["full"] == $cleaned["preview"]) || (($infoPreview[0] == $infoFull[0]) && ($infoPreview[1] == $infoFull[1]))) { $cleaned["preview"] = ""; + } - if ($cleaned["full"] == "") - if (@exif_imagetype($fullImage) != 0) - $cleaned["full"] = $fullImage; + if ($cleaned["full"] == "" && exif_imagetype($fullImage) != 0) { + $cleaned["full"] = $fullImage; + } - if ($cleaned["full"] == "") - if (@exif_imagetype($image) != 0) - $cleaned["full"] = $image; + if ($cleaned["full"] == "" && exif_imagetype($image) != 0) + $cleaned["full"] = $image; + } // Could be changed in the future to a link to the album $cleaned["page"] = $cleaned["full"]; - return($cleaned); + return $cleaned; } function fromgplus_cleantext($text) { @@ -311,7 +321,7 @@ function fromgplus_cleantext($text) { $text = html_entity_decode($text, ENT_QUOTES); $text = trim($text); $text = str_replace(["\n", "\r", " ", $trash], ["", "", "", ""], $text); - return($text); + return $text; } function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) { @@ -427,10 +437,11 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) { } } - if ($pagedata["type"] != "") - return(add_page_info_data($pagedata)); + if ($pagedata["type"] != "") { + return add_page_info_data($pagedata); + } - return($post.$quote); + return ($post . $quote); } function fromgplus_fetch($a, $uid) { diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index 89ccd883..065f1b24 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -26,26 +26,32 @@ function geocoordinates_uninstall() function geocoordinates_resolve_item(&$item) { - if((!$item["coord"]) || ($item["location"])) + if((!x($item, 'coord')) || (x($item, 'location'))) return; $key = Config::get("geocoordinates", "api_key"); - if ($key == "") + + if ($key == "") { return; + } $language = Config::get("geocoordinates", "language"); - if ($language == "") + + if ($language == "") { $language = "de"; + } $coords = explode(' ',$item["coord"]); - if (count($coords) < 2) + if (count($coords) < 2) { return; + } $coords[0] = round($coords[0], 5); $coords[1] = round($coords[1], 5); $result = Cache::get("geocoordinates:".$language.":".$coords[0]."-".$coords[1]); + if (!is_null($result)) { $item["location"] = $result; return; @@ -53,7 +59,7 @@ function geocoordinates_resolve_item(&$item) $s = Network::fetchUrl("https://api.opencagedata.com/geocode/v1/json?q=".$coords[0].",".$coords[1]."&key=".$key."&language=".$language); - if (!$s) { + if ($s === FALSE) { logger("API could not be queried", LOGGER_DEBUG); return; } diff --git a/geonames/geonames.php b/geonames/geonames.php index 4cd1b27c..754e59e7 100644 --- a/geonames/geonames.php +++ b/geonames/geonames.php @@ -21,6 +21,8 @@ * system will call the name_uninstall() function. * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -166,7 +168,7 @@ function geonames_addon_admin_post($a,$post) { -function geonames_addon_admin(&$a,&$s) { +function geonames_addon_admin(App $a, $s) { if(! local_user()) return; diff --git a/googlemaps/googlemaps.php b/googlemaps/googlemaps.php index e294c8e0..54de7dee 100644 --- a/googlemaps/googlemaps.php +++ b/googlemaps/googlemaps.php @@ -6,6 +6,8 @@ * Author: Michael Vogel * */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\Cache; @@ -23,20 +25,20 @@ function googlemaps_uninstall() logger("removed googlemaps"); } -function googlemaps_location($a, &$item) +function googlemaps_location(App $a, array &$item) { - if(! (strlen($item['location']) || strlen($item['coord']))) { + if (! (strlen($item['location']) || strlen($item['coord']))) { return; } - if ($item['coord'] != ""){ + if (x($item, 'coord')) { $target = "http://maps.google.com/?q=".urlencode($item['coord']); } else { $target = "http://maps.google.com/?q=".urlencode($item['location']); } - if ($item['location'] != "") { + if (x($item, 'location')) { $title = $item['location']; } else { $title = $item['coord']; diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index 7e5a918b..37e88462 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -5,6 +5,8 @@ * Version: 1.1 * Author: Klaus Weidenbach */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -40,7 +42,7 @@ function gravatar_load_config(\Friendica\App $a) * @param $a array * @param &$b array */ -function gravatar_lookup($a, &$b) { +function gravatar_lookup(App $a, array &$b) { $default_avatar = Config::get('gravatar', 'default_avatar'); $rating = Config::get('gravatar', 'rating'); diff --git a/group_text/group_text.php b/group_text/group_text.php index 4c0cb14a..e7ef92fa 100644 --- a/group_text/group_text.php +++ b/group_text/group_text.php @@ -5,6 +5,8 @@ * Version: 1.0 * Author: Thomas Willingham */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -56,7 +58,7 @@ function group_text_settings_post($a,$post) { -function group_text_settings(&$a,&$s) { +function group_text_settings(App $a, $s) { if(! local_user()) return; diff --git a/impressum/impressum.php b/impressum/impressum.php index 149b1395..310bfc7a 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -9,6 +9,7 @@ require_once 'mod/proxy.php'; +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; @@ -40,7 +41,7 @@ function obfuscate_email ($s) { $s = str_replace('.','(dot)',$s); return $s; } -function impressum_footer($a, &$b) { +function impressum_footer(App $a, array &$b) { $text = proxy_parse_html(BBCode::convert(Config::get('impressum','footer_text'))); if (! $text == '') { $a->page['htmlhead'] .= ''; diff --git a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php index e92d3440..288b16bb 100644 --- a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php +++ b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php @@ -5,6 +5,8 @@ * Version: 1.0 * Author: Thomas Willingham */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\L10n; @@ -18,7 +20,7 @@ function infiniteimprobabilitydrive_uninstall() Addon::unregisterHook('app_menu', 'addon/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php', 'infiniteimprobabilitydrive_app_menu'); } -function infiniteimprobabilitydrive_app_menu($a, &$b) +function infiniteimprobabilitydrive_app_menu(App $a, array &$b) { $b['app_menu'][] = ''; } diff --git a/irc/irc.php b/irc/irc.php index 6aeacbe6..f2d0c684 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -6,6 +6,8 @@ * Author: tony baldwin * Author: Tobias Diekershoff */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -24,7 +26,7 @@ function irc_uninstall() { } -function irc_addon_settings(&$a,&$s) { +function irc_addon_settings(App $a, $s) { if(! local_user()) return; @@ -50,7 +52,7 @@ function irc_addon_settings(&$a,&$s) { } -function irc_addon_settings_post(&$a,&$b) { +function irc_addon_settings_post(App $a, $b) { if(! local_user()) return; diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 372193fb..fcb49e42 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -419,7 +419,7 @@ function jappixmini_settings(App $a, &$s) "; } -function jappixmini_settings_post(App $a, &$b) +function jappixmini_settings_post(App $a, array &$b) { // save addon settings for a user if (!local_user()) { @@ -693,7 +693,7 @@ function jappixmini_cron(App $a, $d) } } -function jappixmini_download_source(App $a, &$b) +function jappixmini_download_source(App $a, array &$b) { // Jappix Mini source download link on About page $b .= '

Jappix Mini

'; diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index b1373ffc..6317bf48 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -14,6 +14,8 @@ * Module Author: Chris Case * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -34,7 +36,7 @@ function js_upload_uninstall() { } -function js_upload_form(&$a,&$b) { +function js_upload_form(App $a, $b) { $b['default_upload'] = false; @@ -134,7 +136,7 @@ EOT; } -function js_upload_post_init(&$a,&$b) { +function js_upload_post_init(App $a, $b) { // list of valid extensions, ex. array("jpeg", "xml", "bmp") @@ -162,7 +164,7 @@ function js_upload_post_init(&$a,&$b) { } -function js_upload_post_file(&$a,&$b) { +function js_upload_post_file(App $a, $b) { $result = $a->data['upload_result']; @@ -173,7 +175,7 @@ function js_upload_post_file(&$a,&$b) { } -function js_upload_post_end(&$a,&$b) { +function js_upload_post_end(App $a, $b) { logger('upload_post_end'); if(x($a->data,'upload_jsonresponse')) { diff --git a/krynn/krynn.php b/krynn/krynn.php index 47372926..34b3f762 100644 --- a/krynn/krynn.php +++ b/krynn/krynn.php @@ -9,6 +9,8 @@ * *"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -134,7 +136,7 @@ function krynn_settings_post($a,$post) { -function krynn_settings(&$a,&$s) { +function krynn_settings(App $a, $s) { if(! local_user()) return; diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index f22034e2..7d1963e6 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -70,7 +70,7 @@ function langfilter_addon_settings(App $a, &$s) * 3rd save the settings to the DB for later usage */ -function langfilter_addon_settings_post(App $a, &$b) +function langfilter_addon_settings_post(App $a, array &$b) { if (!local_user()) { return; @@ -112,8 +112,7 @@ function langfilter_addon_settings_post(App $a, &$b) * expand it again. */ -function langfilter_prepare_body_content_filter(App $a, &$hook_data) -{ +function langfilter_prepare_body_content_filter(App $a, &$hook_data) { $logged_user = local_user(); if (!$logged_user) { return; diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index 514fb1d1..7ed5e49d 100644 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -53,6 +53,8 @@ * * ...etc. */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Model\User; @@ -69,12 +71,12 @@ function ldapauth_uninstall() Addon::unregisterHook('authenticate', 'addon/ldapauth/ldapauth.php', 'ldapauth_hook_authenticate'); } -function ldapauth_load_config(\Friendica\App $a) +function ldapauth_load_config(App $a) { $a->loadConfigFile(__DIR__. '/config/ldapauth.ini.php'); } -function ldapauth_hook_authenticate($a, &$b) +function ldapauth_hook_authenticate(App $a, array &$b) { if (ldapauth_authenticate($b['username'], $b['password'])) { $results = get_existing_account($b['username']); diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 14bc0358..7c3d25df 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -5,6 +5,8 @@ * Version: 1.1 * Author: Klaus Weidenbach */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -40,7 +42,7 @@ function libravatar_load_config(\Friendica\App $a) * @param $a array * @param &$b array */ -function libravatar_lookup($a, &$b) +function libravatar_lookup(App $a, array &$b) { $default_avatar = Config::get('libravatar', 'default_avatar'); diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 66b43303..1e3e2e47 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -6,6 +6,7 @@ * Author: Matthew Exon */ +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; @@ -71,7 +72,7 @@ function mailstream_uninstall() { function mailstream_module() {} -function mailstream_addon_admin(&$a,&$o) { +function mailstream_addon_admin(App $a, &$o) { $frommail = Config::get('mailstream', 'frommail'); $template = get_markup_template('admin.tpl', 'addon/mailstream/'); $config = ['frommail', @@ -83,13 +84,13 @@ function mailstream_addon_admin(&$a,&$o) { '$submit' => L10n::t('Save Settings')]); } -function mailstream_addon_admin_post ($a) { +function mailstream_addon_admin_post (App $a) { if (x($_POST, 'frommail')) { Config::set('mailstream', 'frommail', $_POST['frommail']); } } -function mailstream_generate_id($a, $uri) { +function mailstream_generate_id(App $a, $uri) { // http://www.jwz.org/doc/mid.html $host = $a->get_hostname(); $resource = hash('md5', $uri); @@ -98,56 +99,58 @@ function mailstream_generate_id($a, $uri) { return $message_id; } -function mailstream_post_hook(&$a, &$item) { +function mailstream_post_hook(App $a, array &$item) { if (!PConfig::get($item['uid'], 'mailstream', 'enabled')) { return; } - if (!$item['uid']) { + + if (!x($item, 'uid') || !x($item, 'contact-id') || !x($item, 'uri')) { return; } - if (!$item['contact-id']) { + + if (PConfig::get($item['uid'], 'mailstream', 'nolikes') && $item['verb'] == ACTIVITY_LIKE) { return; } - if (!$item['uri']) { - return; - } - if (PConfig::get($item['uid'], 'mailstream', 'nolikes')) { - if ($item['verb'] == ACTIVITY_LIKE) { - return; - } - } $message_id = mailstream_generate_id($a, $item['uri']); q("INSERT INTO `mailstream_item` (`uid`, `contact-id`, `uri`, `message-id`) " . "VALUES (%d, '%s', '%s', '%s')", intval($item['uid']), intval($item['contact-id']), dbesc($item['uri']), dbesc($message_id)); $r = q('SELECT * FROM `mailstream_item` WHERE `uid` = %d AND `contact-id` = %d AND `uri` = "%s"', intval($item['uid']), intval($item['contact-id']), dbesc($item['uri'])); - if (count($r) != 1) { + + if (!DBM::is_result($r)) { logger('mailstream_post_remote_hook: Unexpected number of items returned from mailstream_item', LOGGER_NORMAL); return; } + $ms_item = $r[0]; + logger('mailstream_post_remote_hook: created mailstream_item ' . $ms_item['id'] . ' for item ' . $item['uri'] . ' ' . $item['uid'] . ' ' . $item['contact-id'], LOGGER_DATA); + $user = mailstream_get_user($item['uid']); + if (!$user) { logger('mailstream_post_remote_hook: no user ' . $item['uid'], LOGGER_NORMAL); return; } + mailstream_send($a, $ms_item['message-id'], $item, $user); } function mailstream_get_user($uid) { $r = q('SELECT * FROM `user` WHERE `uid` = %d', intval($uid)); - if (count($r) != 1) { + + if (!DBM::is_result($r)) { logger('mailstream_post_remote_hook: Unexpected number of users returned', LOGGER_NORMAL); return; } + return $r[0]; } -function mailstream_do_images($a, &$item, &$attachments) { +function mailstream_do_images(App $a, array &$item, &$attachments) { if (!PConfig::get($item['uid'], 'mailstream', 'attachimg')) { return; } @@ -162,7 +165,9 @@ function mailstream_do_images($a, &$item, &$attachments) { 'data' => Network::fetchUrl($url, true, $redirects, 0, null, $cookiejar), 'guid' => hash("crc32", $url), 'filename' => basename($url), - 'type' => $a->get_curl_content_type()]; + 'type' => $a->get_curl_content_type() + ]; + if (strlen($attachments[$url]['data'])) { $item['body'] = str_replace($url, 'cid:' . $attachments[$url]['guid'], $item['body']); continue; @@ -171,43 +176,54 @@ function mailstream_do_images($a, &$item, &$attachments) { return $attachments; } -function mailstream_sender($item) { +function mailstream_sender(array $item) { $r = q('SELECT * FROM `contact` WHERE `id` = %d', $item['contact-id']); + if (DBM::is_result($r)) { - $contact = $r[0]; - if ($contact['name'] != $item['author-name']) { - return $contact['name'] . ' - ' . $item['author-name']; + if ($r[0]['name'] != $item['author-name']) { + return $r[0]['name'] . ' - ' . $item['author-name']; } } + return $item['author-name']; } function mailstream_decode_subject($subject) { $html = BBCode::convert($subject); + if (!$html) { return $subject; } + $notags = strip_tags($html); + if (!$notags) { return $subject; } + $noentity = html_entity_decode($notags); + if (!$noentity) { return $notags; } + $nocodes = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $noentity); + if (!$nocodes) { return $noentity; } + $trimmed = trim($nocodes); + if (!$trimmed) { return $nocodes; } + return $trimmed; } -function mailstream_subject($item) { - if ($item['title']) { +function mailstream_subject(array $item) { + if (x($item, 'title')) { return mailstream_decode_subject($item['title']); } $parent = $item['thr-parent']; @@ -250,8 +266,8 @@ function mailstream_subject($item) { return L10n::t("Friendica Item"); } -function mailstream_send($a, $message_id, $item, $user) { - if (!$item['visible']) { +function mailstream_send(App $a, $message_id, array $item, $user) { + if (!x($item, 'visible')) { return; } if (!$message_id) { @@ -350,7 +366,7 @@ function mailstream_cron($a, $b) { mailstream_tidy(); } -function mailstream_addon_settings(&$a,&$s) { +function mailstream_addon_settings(App $a, &$s) { $enabled = PConfig::get(local_user(), 'mailstream', 'enabled'); $address = PConfig::get(local_user(), 'mailstream', 'address'); $nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes'); @@ -380,37 +396,43 @@ function mailstream_addon_settings(&$a,&$s) { '$submit' => L10n::t('Save Settings')]); } -function mailstream_addon_settings_post($a,$post) { +function mailstream_addon_settings_post(App $a, $post) { if ($_POST['mailstream_address'] != "") { PConfig::set(local_user(), 'mailstream', 'address', $_POST['mailstream_address']); - } - else { + } else { PConfig::delete(local_user(), 'mailstream', 'address'); } + if ($_POST['mailstream_nolikes']) { PConfig::set(local_user(), 'mailstream', 'nolikes', $_POST['mailstream_enabled']); - } - else { + } else { PConfig::delete(local_user(), 'mailstream', 'nolikes'); } + if ($_POST['mailstream_enabled']) { PConfig::set(local_user(), 'mailstream', 'enabled', $_POST['mailstream_enabled']); - } - else { + } else { PConfig::delete(local_user(), 'mailstream', 'enabled'); } + if ($_POST['mailstream_attachimg']) { PConfig::set(local_user(), 'mailstream', 'attachimg', $_POST['mailstream_attachimg']); - } - else { + } else { PConfig::delete(local_user(), 'mailstream', 'attachimg'); } } function mailstream_tidy() { $r = q("SELECT id FROM mailstream_item WHERE completed IS NOT NULL AND completed < DATE_SUB(NOW(), INTERVAL 1 YEAR)"); + + if (!DBM::is_result($r)) { + logger('Cannot load records from mailstream_item or none are returned.', LOGGER_DEBUG); + return; + } + foreach ($r as $rr) { q('DELETE FROM mailstream_item WHERE id = %d', intval($rr['id'])); } + logger('mailstream_tidy: deleted ' . count($r) . ' old items', LOGGER_DEBUG); } diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index c85068ea..30ace80e 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -6,6 +6,7 @@ * Author: Tobias Diekershoff * License: 3-clause BSD license */ + use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; @@ -73,7 +74,7 @@ function mathjax_settings (&$a, &$s) { /* we need to add one JavaScript include command to the html output * note that you have to check the jsmath/easy/load.js too. */ -function mathjax_page_header($a, &$b) { +function mathjax_page_header(App $a, array &$b) { // if the visitor of the page is not a local_user, use MathJax // otherwise check the users settings. $url = Config::get ('mathjax','baseurl'); diff --git a/membersince/membersince.php b/membersince/membersince.php index c11f9b53..5e935a8c 100644 --- a/membersince/membersince.php +++ b/membersince/membersince.php @@ -7,6 +7,7 @@ * Status: Unsupported */ +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Util\DateTimeFormat; @@ -16,13 +17,11 @@ function membersince_install() Addon::registerHook('profile_advanced', 'addon/membersince/membersince.php', 'membersince_display'); } -function membersince_uninstall() -{ +function membersince_uninstall() { Addon::unregisterHook('profile_advanced', 'addon/membersince/membersince.php', 'membersince_display'); } -function membersince_display(Friendica\App $a, &$b) -{ +function membersince_display(App $a, array &$b) { if ($a->getCurrentTheme() == 'frio') { // Works in Frio. $doc = new DOMDocument(); diff --git a/morepokes/morepokes.php b/morepokes/morepokes.php index e0caaa52..8b63bd1e 100644 --- a/morepokes/morepokes.php +++ b/morepokes/morepokes.php @@ -6,6 +6,8 @@ * Author: Thomas Willingham * */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\L10n; @@ -19,7 +21,7 @@ function morepokes_uninstall() Addon::unregisterHook('poke_verbs', 'addon/morepokes/morepokes.php', 'morepokes_poke_verbs'); } -function morepokes_poke_verbs($a, &$b) +function morepokes_poke_verbs(App $a, array &$b) { $b['bitchslap'] = ['bitchslapped', L10n::t('bitchslap'), L10n::t('bitchslapped')]; $b['shag'] = ['shag', L10n::t('shag'), L10n::t('shagged')]; diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 2ea20b4a..dd86f630 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -7,6 +7,8 @@ * Author: Mike Macgirvin * */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; @@ -95,8 +97,7 @@ function nsfw_addon_settings(&$a, &$s) return; } -function nsfw_addon_settings_post(&$a, &$b) -{ +function nsfw_addon_settings_post(App $a, array &$b) { if (!local_user()) { return; } @@ -110,8 +111,7 @@ function nsfw_addon_settings_post(&$a, &$b) } } -function nsfw_prepare_body_content_filter(\Friendica\App $a, &$hook_data) -{ +function nsfw_prepare_body_content_filter(App $a, &$hook_data) { $words = null; if (PConfig::get(local_user(), 'nsfw', 'disable')) { return; diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 26d51e1a..7ae356c2 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -8,6 +8,8 @@ * Author: Klaus Weidenbach * */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; @@ -88,7 +90,7 @@ function openstreetmap_location($a, &$item) $nomserver = OSM_NOM; } - if ($item['coord'] != "") { + if (x($item, 'coord')) { $coords = explode(' ', $item['coord']); if (count($coords) > 1) { $lat = urlencode(round($coords[0], 5)); @@ -105,7 +107,7 @@ function openstreetmap_location($a, &$item) $target = $nomserver.'?q='.urlencode($item['location']); } - if ($item['location'] != "") { + if (x($item, 'location')) { $title = $item['location']; } else { $title = $item['coord']; @@ -114,7 +116,7 @@ function openstreetmap_location($a, &$item) $item['html'] = ''.$title.''; } -function openstreetmap_get_coordinates($a, &$b) +function openstreetmap_get_coordinates(App $a, array &$b) { $nomserver = Config::get('openstreetmap', 'nomserver', OSM_NOM); @@ -142,7 +144,7 @@ function openstreetmap_get_coordinates($a, &$b) } } -function openstreetmap_generate_named_map(&$a, &$b) +function openstreetmap_generate_named_map(App $a, array &$b) { openstreetmap_get_coordinates($a, $b); @@ -151,7 +153,7 @@ function openstreetmap_generate_named_map(&$a, &$b) } } -function openstreetmap_generate_map(&$a, &$b) +function openstreetmap_generate_map(App $a, array &$b) { $tmsserver = Config::get('openstreetmap', 'tmsserver', OSM_TMS); diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index eb121fb5..034f5cae 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -7,6 +7,8 @@ * Hauke Altmann * */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -33,7 +35,7 @@ function pageheader_uninstall() { -function pageheader_addon_settings(&$a,&$s) { +function pageheader_addon_settings(App $a, $s) { if(! is_site_admin()) @@ -59,7 +61,7 @@ function pageheader_addon_settings(&$a,&$s) { } -function pageheader_addon_settings_post(&$a,&$b) { +function pageheader_addon_settings_post(App $a, $b) { if(! is_site_admin()) return; diff --git a/public_server/public_server.php b/public_server/public_server.php index a30d3303..b5cf6377 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -6,6 +6,7 @@ * Author: Keith Fernie */ +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -118,7 +119,7 @@ function public_server_cron($a, $b) logger("public_server: cron end"); } -function public_server_enotify(&$a, &$b) +function public_server_enotify(App $a, array &$b) { if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM && x($b['params'], 'system_type') && $b['params']['system_type'] === 'public_server_expire') { diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 191f8505..3886f720 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -6,6 +6,7 @@ * Author: Michael Vogel */ +use Friencia\App; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Core\Addon; @@ -375,12 +376,11 @@ function pumpio_settings_post(&$a, &$b) } } -function pumpio_load_config(\Friendica\App $a) { $a->loadConfigFile(__DIR__. '/config/pumpio.ini.php'); } -function pumpio_post_local(&$a, &$b) +function pumpio_post_local(App $a, array &$b) { if (!local_user() || (local_user() != $b['uid'])) { return; diff --git a/securemail/securemail.php b/securemail/securemail.php index 87941e79..649aca9d 100644 --- a/securemail/securemail.php +++ b/securemail/securemail.php @@ -53,7 +53,7 @@ function securemail_uninstall() { * * @see App */ -function securemail_settings(App &$a, &$s){ +function securemail_settings(App $a, &$s){ if (!local_user()) { return; } @@ -82,7 +82,7 @@ function securemail_settings(App &$a, &$s){ * * @see App */ -function securemail_settings_post(App &$a, array &$b){ +function securemail_settings_post(App $a, array &$b){ if (!local_user()) { return; @@ -147,7 +147,7 @@ function securemail_settings_post(App &$a, array &$b){ * * @see App */ -function securemail_emailer_send_prepare(App &$a, array &$b) { +function securemail_emailer_send_prepare(App $a, array &$b) { if (!x($b, 'uid')) { return; } diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index f613d290..16847438 100644 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -5,6 +5,8 @@ * Version: 0.2 * Author: Johannes Schwab */ + +use Friencia\App; use Friendica\Core\Addon; function smileybutton_install() { @@ -24,15 +26,17 @@ function smileybutton_uninstall() { -function show_button(Friendica\App $a, &$b) { +function show_button(App $a, &$b) { // Disable if theme is quattro // TODO add style for quattro if ($a->getCurrentTheme() == 'quattro') return; + } // Disable for mobile because most mobiles have a smiley key for ther own - if ($a->is_mobile || $a->is_tablet) + if ($a->is_mobile || $a->is_tablet) { return; + } /** * diff --git a/smilies_adult/smilies_adult.php b/smilies_adult/smilies_adult.php index bb673f23..2a7dbebb 100644 --- a/smilies_adult/smilies_adult.php +++ b/smilies_adult/smilies_adult.php @@ -8,6 +8,8 @@ * This is a template for how to extend the "smily" code. * */ + +use Friendica\App; use Friendica\Core\Addon; function smilies_adult_install() { @@ -20,7 +22,7 @@ function smilies_adult_uninstall() { -function smilies_adult_smilies(&$a,&$b) { +function smilies_adult_smilies(App $a, $b) { $b['texts'][] = '(o)(o)'; $b['icons'][] = '' . '(o)(o)' . ''; diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 9af2c6d1..d9d0f5b9 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -94,7 +94,7 @@ function statusnet_check_item_notification(App $a, &$notification_data) $notification_data["profiles"][] = PConfig::get($notification_data["uid"], 'statusnet', 'own_url'); } -function statusnet_jot_nets(App $a, &$b) +function statusnet_jot_nets(App $a, array &$b) { if (!local_user()) { return; @@ -385,7 +385,7 @@ function statusnet_settings(App $a, &$s) $s .= '
'; } -function statusnet_post_local(App $a, &$b) +function statusnet_post_local(App $a, array &$b) { if ($b['edit']) { return; @@ -440,7 +440,7 @@ function statusnet_action(App $a, $uid, $pid, $action) logger("statusnet_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); } -function statusnet_post_hook(App $a, &$b) +function statusnet_post_hook(App $a, array &$b) { /** * Post to GNU Social @@ -669,7 +669,7 @@ function statusnet_addon_admin(App $a, &$o) ]); } -function statusnet_prepare_body(App $a, &$b) +function statusnet_prepare_body(App $a, array &$b) { if ($b["item"]["network"] != NETWORK_STATUSNET) { return; diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index 8e71103f..25b19686 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -6,6 +6,7 @@ * Author: Mike Macgirvin */ +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -64,7 +65,7 @@ function testdrive_cron($a,$b) { $r = q("select * from user where account_expires_on < UTC_TIMESTAMP() + INTERVAL 5 DAY and expire_notification_sent = '0000-00-00 00:00:00' "); - if(count($r)) { + if (DBM::is_result($r)) { foreach($r as $rr) { notification([ 'uid' => $rr['uid'], @@ -87,14 +88,15 @@ function testdrive_cron($a,$b) { } $r = q("select * from user where account_expired = 1 and account_expires_on < UTC_TIMESTAMP() - INTERVAL 5 DAY "); - if(count($r)) { + + if (DBM::is_result($r)) { foreach($r as $rr) { User::remove($rr['uid']); } } } -function testdrive_enotify(&$a, &$b) { +function testdrive_enotify(App $a, array &$b) { if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM && x($b['params'], 'system_type') && $b['params']['system_type'] === 'testdrive_expire') { $b['itemlink'] = $a->get_baseurl(); diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 7ed91175..f86382e2 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -9,6 +9,7 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'tumblroauth.php'; +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; @@ -126,7 +127,7 @@ function tumblr_connect($a) { // Give an error message $o = 'Could not connect to Tumblr. Refresh the page or try again later.'; } - return($o); + return $o; } function tumblr_callback($a) { @@ -168,15 +169,17 @@ function tumblr_callback($a) { $o = L10n::t("You are now authenticated to tumblr."); $o .= '
'.L10n::t("return to the connector page").''; - return($o); + return $o; } -function tumblr_jot_nets(&$a,&$b) { - if(! local_user()) +function tumblr_jot_nets(App $a, $b) { + if (! local_user()) { return; + } - $tmbl_post = PConfig::get(local_user(),'tumblr','post'); - if(intval($tmbl_post) == 1) { + $tmbl_post = PConfig::get(local_user(), 'tumblr', 'post'); + + if (intval($tmbl_post) == 1) { $tmbl_defpost = PConfig::get(local_user(),'tumblr','post_by_default'); $selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' @@ -185,10 +188,11 @@ function tumblr_jot_nets(&$a,&$b) { } -function tumblr_settings(&$a,&$s) { +function tumblr_settings(App $a, $s) { - if(! local_user()) + if (! local_user()) { return; + } /* Add our stylesheet to the page so we can make our settings look nice */ @@ -266,7 +270,7 @@ function tumblr_settings(&$a,&$s) { } -function tumblr_settings_post(&$a,&$b) { +function tumblr_settings_post(App $a, $b) { if(x($_POST,'tumblr-submit')) { @@ -278,7 +282,7 @@ function tumblr_settings_post(&$a,&$b) { } -function tumblr_post_local(&$a, &$b) { +function tumblr_post_local(App $a, array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint @@ -316,7 +320,7 @@ function tumblr_post_local(&$a, &$b) { -function tumblr_send(&$a,&$b) { +function tumblr_send(App $a, $b) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return; diff --git a/twitter/twitter.php b/twitter/twitter.php index aa0adfb8..0338da40 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -190,7 +190,7 @@ function twitter_follow(App $a, &$contact) } } -function twitter_jot_nets(App $a, &$b) +function twitter_jot_nets(App $a, array &$b) { if (!local_user()) { return; @@ -386,7 +386,7 @@ function twitter_settings(App $a, &$s) $s .= '
'; } -function twitter_post_local(App $a, &$b) +function twitter_post_local(App $a, array &$b) { if ($b['edit']) { return; @@ -446,7 +446,7 @@ function twitter_action(App $a, $uid, $pid, $action) logger("twitter_action '" . $action . "' send, result: " . print_r($result, true), LOGGER_DEBUG); } -function twitter_post_hook(App $a, &$b) +function twitter_post_hook(App $a, array &$b) { // Post to Twitter if (!PConfig::get($b["uid"], 'twitter', 'import') @@ -761,7 +761,7 @@ function twitter_expire(App $a, $b) logger('twitter_expire: expire_end'); } -function twitter_prepare_body(App $a, &$b) +function twitter_prepare_body(App $a, array &$b) { if ($b["item"]["network"] != NETWORK_TWITTER) { return; @@ -920,7 +920,7 @@ function twitter_fetchtimeline(App $a, $uid) PConfig::set($uid, 'twitter', 'lastid', $lastid); } -function twitter_queue_hook(App $a, &$b) +function twitter_queue_hook(App $a, array &$b) { $qi = q("SELECT * FROM `queue` WHERE `network` = '%s'", dbesc(NETWORK_TWITTER) diff --git a/unicode_smilies/unicode_smilies.php b/unicode_smilies/unicode_smilies.php index faa553cc..db8d098d 100644 --- a/unicode_smilies/unicode_smilies.php +++ b/unicode_smilies/unicode_smilies.php @@ -5,6 +5,8 @@ * Version: 1.0 * Author: Michael Vogel */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Content\Smilies; @@ -16,7 +18,7 @@ function unicode_smilies_uninstall() { Addon::unregisterHook('smilie', 'addon/unicode_smilies/unicode_smilies.php', 'unicode_smilies_smilies'); } -function unicode_smilies_smilies(&$a,&$b) { +function unicode_smilies_smilies(App $a, $b) { Smilies::add($b, ':-)', '😀'); Smilies::add($b, ':)', '😀'); Smilies::add($b, ':-(', '🙁'); diff --git a/viewsrc/viewsrc.php b/viewsrc/viewsrc.php index 9ffa0b8c..89c9b28e 100644 --- a/viewsrc/viewsrc.php +++ b/viewsrc/viewsrc.php @@ -6,6 +6,8 @@ * Author: Mike Macgirvin * */ + +use Friencia\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Model\Item; @@ -35,7 +37,7 @@ function viewsrc_page_end(&$a, &$o){ EOS; } -function viewsrc_item_photo_menu(&$a, &$b) +function viewsrc_item_photo_menu(App $a, array &$b) { if (!local_user()) { return; diff --git a/wppost/wppost.php b/wppost/wppost.php index 45b48993..0c023187 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -6,6 +6,7 @@ * Author: Mike Macgirvin */ +use Friencia\App; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Core\Addon; @@ -156,7 +157,7 @@ function wppost_settings_post(&$a,&$b) { } -function wppost_post_local(&$a, &$b) { +function wppost_post_local(App $a, array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index bef31fed..eee4ea75 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -5,6 +5,7 @@ * Version: 0.1 * Author: Michael Vogel */ + use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; 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 02/29] 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; From 39421cf1a47a49c1ef8a639bd6f480d5adb6a779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Thu, 10 May 2018 15:31:19 +0200 Subject: [PATCH 03/29] Continued: - added array as type-hint - don't forget & (call-by-reference) here as $b is maybe being modified in the function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- blockem/blockem.php | 12 ++++-------- dwpost/dwpost.php | 8 ++++---- fromgplus/fromgplus.php | 2 +- irc/irc.php | 2 +- js_upload/js_upload.php | 8 ++++---- pageheader/pageheader.php | 2 +- smilies_adult/smilies_adult.php | 4 ++-- statusnet/statusnet.php | 2 +- tumblr/tumblr.php | 6 +++--- twitter/twitter.php | 4 ++-- unicode_smilies/unicode_smilies.php | 2 +- 11 files changed, 24 insertions(+), 28 deletions(-) diff --git a/blockem/blockem.php b/blockem/blockem.php index 7c1c4292..2510e042 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -70,7 +70,7 @@ function blockem_addon_settings(&$a, &$s) } -function blockem_addon_settings_post(App $a, $b) { +function blockem_addon_settings_post(App $a, array &$b) { if(! local_user()) return; @@ -81,7 +81,7 @@ function blockem_addon_settings_post(App $a, $b) { } } -function blockem_enotify_store(App $a, $b) { +function blockem_enotify_store(App $a, array &$b) { $words = PConfig::get($b['uid'],'blockem','words'); if($words) { @@ -140,16 +140,12 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data) } function blockem_display_item(App $a, array &$b) { - if (empty($b['output']['body'])) { - return; - } - if (strstr($b['output']['body'],'id="blockem-wrap-')) { $b['output']['thumb'] = $a->get_baseurl() . "/images/person-80.jpg"; } } -function blockem_conversation_start(App $a, $b) { +function blockem_conversation_start(App $a, array &$b) { if(! local_user()) return; @@ -177,7 +173,7 @@ EOT; } -function blockem_item_photo_menu(App $a, $b) { +function blockem_item_photo_menu(App $a, array &$b) { if((! local_user()) || ($b['item']['self'])) return; diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index d95a97a5..3c2156ba 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -34,7 +34,7 @@ function dwpost_uninstall() { } -function dwpost_jot_nets(App $a, $b) { +function dwpost_jot_nets(App $a, array &$b) { if(! local_user()) return; @@ -108,7 +108,7 @@ function dwpost_settings(App $a, $s) { } -function dwpost_settings_post(App $a, $b) { +function dwpost_settings_post(App $a, array &$b) { if(x($_POST,'dwpost-submit')) { @@ -121,7 +121,7 @@ function dwpost_settings_post(App $a, $b) { } -function dwpost_post_local(App $a, $b) { +function dwpost_post_local(App $a, array &$b) { // This can probably be changed to allow editing by pointing to a different API endpoint @@ -152,7 +152,7 @@ function dwpost_post_local(App $a, $b) { -function dwpost_send(App $a, $b) { +function dwpost_send(App $a, array &$b) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) return; diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index 9bb64970..c48155f2 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -80,7 +80,7 @@ class="settings-submit" value="' . L10n::t('Save Settings') . '" />'; return; } -function fromgplus_addon_settings_post(App $a, $b) { +function fromgplus_addon_settings_post(App $a, array &$b) { if(! local_user()) return; diff --git a/irc/irc.php b/irc/irc.php index f2d0c684..41f857ea 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -52,7 +52,7 @@ function irc_addon_settings(App $a, $s) { } -function irc_addon_settings_post(App $a, $b) { +function irc_addon_settings_post(App $a, array &$b) { if(! local_user()) return; diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index 6317bf48..cb46c191 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -36,7 +36,7 @@ function js_upload_uninstall() { } -function js_upload_form(App $a, $b) { +function js_upload_form(App $a, array &$b) { $b['default_upload'] = false; @@ -136,7 +136,7 @@ EOT; } -function js_upload_post_init(App $a, $b) { +function js_upload_post_init(App $a, array &$b) { // list of valid extensions, ex. array("jpeg", "xml", "bmp") @@ -164,7 +164,7 @@ function js_upload_post_init(App $a, $b) { } -function js_upload_post_file(App $a, $b) { +function js_upload_post_file(App $a, array &$b) { $result = $a->data['upload_result']; @@ -175,7 +175,7 @@ function js_upload_post_file(App $a, $b) { } -function js_upload_post_end(App $a, $b) { +function js_upload_post_end(App $a, array &$b) { logger('upload_post_end'); if(x($a->data,'upload_jsonresponse')) { diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index 034f5cae..958249f8 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -61,7 +61,7 @@ function pageheader_addon_settings(App $a, $s) { } -function pageheader_addon_settings_post(App $a, $b) { +function pageheader_addon_settings_post(App $a, array &$b) { if(! is_site_admin()) return; diff --git a/smilies_adult/smilies_adult.php b/smilies_adult/smilies_adult.php index 2a7dbebb..6e81b424 100644 --- a/smilies_adult/smilies_adult.php +++ b/smilies_adult/smilies_adult.php @@ -22,7 +22,7 @@ function smilies_adult_uninstall() { -function smilies_adult_smilies(App $a, $b) { +function smilies_adult_smilies(App $a, array &$b) { $b['texts'][] = '(o)(o)'; $b['icons'][] = '' . '(o)(o)' . ''; @@ -42,4 +42,4 @@ function smilies_adult_smilies(App $a, $b) { $b['texts'][] = ':finger'; $b['icons'][] = '' . ':finger' . ''; -} \ No newline at end of file +} diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index d9d0f5b9..253021a6 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -712,7 +712,7 @@ function statusnet_prepare_body(App $a, array &$b) } } -function statusnet_cron(App $a, $b) +function statusnet_cron(App $a, array &$b) { $last = Config::get('statusnet', 'last_poll'); diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index f86382e2..368b62f0 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -172,7 +172,7 @@ function tumblr_callback($a) { return $o; } -function tumblr_jot_nets(App $a, $b) { +function tumblr_jot_nets(App $a, array &$b) { if (! local_user()) { return; } @@ -270,7 +270,7 @@ function tumblr_settings(App $a, $s) { } -function tumblr_settings_post(App $a, $b) { +function tumblr_settings_post(App $a, array &$b) { if(x($_POST,'tumblr-submit')) { @@ -320,7 +320,7 @@ function tumblr_post_local(App $a, array &$b) { -function tumblr_send(App $a, $b) { +function tumblr_send(App $a, array &$b) { if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { return; diff --git a/twitter/twitter.php b/twitter/twitter.php index 0338da40..328c2c80 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -658,7 +658,7 @@ function twitter_addon_admin(App $a, &$o) ]); } -function twitter_cron(App $a, $b) +function twitter_cron(App $a, array &$b) { $last = Config::get('twitter', 'last_poll'); @@ -726,7 +726,7 @@ function twitter_cron(App $a, $b) Config::set('twitter', 'last_poll', time()); } -function twitter_expire(App $a, $b) +function twitter_expire(App $a, array &$b) { $days = Config::get('twitter', 'expire'); diff --git a/unicode_smilies/unicode_smilies.php b/unicode_smilies/unicode_smilies.php index db8d098d..93eefc3e 100644 --- a/unicode_smilies/unicode_smilies.php +++ b/unicode_smilies/unicode_smilies.php @@ -18,7 +18,7 @@ function unicode_smilies_uninstall() { Addon::unregisterHook('smilie', 'addon/unicode_smilies/unicode_smilies.php', 'unicode_smilies_smilies'); } -function unicode_smilies_smilies(App $a, $b) { +function unicode_smilies_smilies(App $a, array &$b) { Smilies::add($b, ':-)', '😀'); Smilies::add($b, ':)', '😀'); Smilies::add($b, ':-(', '🙁'); From f9ab3741e653fbfaf8dffc1b907f8e1a8b808be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Thu, 10 May 2018 15:35:27 +0200 Subject: [PATCH 04/29] Fixed "import" line (ops) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- blogger/blogger.php | 2 +- buglink/buglink.php | 2 +- fortunate/fortunate.php | 2 +- forumdirectory/forumdirectory.php | 2 +- googlemaps/googlemaps.php | 2 +- gravatar/gravatar.php | 2 +- infiniteimprobabilitydrive/infiniteimprobabilitydrive.php | 2 +- ldapauth/ldapauth.php | 2 +- libravatar/libravatar.php | 2 +- membersince/membersince.php | 2 +- morepokes/morepokes.php | 2 +- nsfw/nsfw.php | 2 +- openstreetmap/openstreetmap.php | 2 +- public_server/public_server.php | 2 +- pumpio/pumpio.php | 2 +- smileybutton/smileybutton.php | 2 +- testdrive/testdrive.php | 2 +- viewsrc/viewsrc.php | 2 +- wppost/wppost.php | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index 1ca74e0c..20e13075 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -6,7 +6,7 @@ * */ -use Friencia\App; +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\L10n; diff --git a/buglink/buglink.php b/buglink/buglink.php index 4088cf8c..7b8d7836 100644 --- a/buglink/buglink.php +++ b/buglink/buglink.php @@ -6,7 +6,7 @@ * Author: Mike Macgirvin */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; diff --git a/fortunate/fortunate.php b/fortunate/fortunate.php index 96cf34a3..73306219 100644 --- a/fortunate/fortunate.php +++ b/fortunate/fortunate.php @@ -7,7 +7,7 @@ * Status: Unsupported */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Util\Network; diff --git a/forumdirectory/forumdirectory.php b/forumdirectory/forumdirectory.php index 4c7f5d6c..3337f720 100644 --- a/forumdirectory/forumdirectory.php +++ b/forumdirectory/forumdirectory.php @@ -6,7 +6,7 @@ * Author: Thomas Willingham */ -use Friencia\App; +use Friendica\App; use Friendica\Content\Nav; use Friendica\Content\Widget; use Friendica\Core\Addon; diff --git a/googlemaps/googlemaps.php b/googlemaps/googlemaps.php index 54de7dee..7011b935 100644 --- a/googlemaps/googlemaps.php +++ b/googlemaps/googlemaps.php @@ -7,7 +7,7 @@ * */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Cache; diff --git a/gravatar/gravatar.php b/gravatar/gravatar.php index 37e88462..0f0aeffc 100644 --- a/gravatar/gravatar.php +++ b/gravatar/gravatar.php @@ -6,7 +6,7 @@ * Author: Klaus Weidenbach */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; diff --git a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php index 288b16bb..c02ed7b5 100644 --- a/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php +++ b/infiniteimprobabilitydrive/infiniteimprobabilitydrive.php @@ -6,7 +6,7 @@ * Author: Thomas Willingham */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index 7ed5e49d..c92995c7 100644 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -54,7 +54,7 @@ * ...etc. */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Model\User; diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 7c3d25df..2fe26119 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -6,7 +6,7 @@ * Author: Klaus Weidenbach */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; diff --git a/membersince/membersince.php b/membersince/membersince.php index 5e935a8c..18754958 100644 --- a/membersince/membersince.php +++ b/membersince/membersince.php @@ -7,7 +7,7 @@ * Status: Unsupported */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Util\DateTimeFormat; diff --git a/morepokes/morepokes.php b/morepokes/morepokes.php index 8b63bd1e..da14025e 100644 --- a/morepokes/morepokes.php +++ b/morepokes/morepokes.php @@ -7,7 +7,7 @@ * */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index dd86f630..6dc24773 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -8,7 +8,7 @@ * */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Core\PConfig; diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 7ae356c2..670ee729 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -9,7 +9,7 @@ * */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; diff --git a/public_server/public_server.php b/public_server/public_server.php index b5cf6377..d5911fa2 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -6,7 +6,7 @@ * Author: Keith Fernie */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index a1f59c7e..71287fb6 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -6,7 +6,7 @@ * Author: Michael Vogel */ -use Friencia\App; +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Core\Addon; diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index 16847438..291ec50d 100644 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -6,7 +6,7 @@ * Author: Johannes Schwab */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; function smileybutton_install() { diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php index 25b19686..df8d733c 100644 --- a/testdrive/testdrive.php +++ b/testdrive/testdrive.php @@ -6,7 +6,7 @@ * Author: Mike Macgirvin */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; diff --git a/viewsrc/viewsrc.php b/viewsrc/viewsrc.php index 89c9b28e..875b60e1 100644 --- a/viewsrc/viewsrc.php +++ b/viewsrc/viewsrc.php @@ -7,7 +7,7 @@ * */ -use Friencia\App; +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\L10n; use Friendica\Model\Item; diff --git a/wppost/wppost.php b/wppost/wppost.php index 14bb2934..31bb2da1 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -6,7 +6,7 @@ * Author: Mike Macgirvin */ -use Friencia\App; +use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Core\Addon; From 0e0ce23af5cdb721c58fce724033684ca479847e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Thu, 10 May 2018 15:41:52 +0200 Subject: [PATCH 05/29] Ops, to much array ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- blogger/blogger.php | 3 +-- buffer/buffer.php | 4 ++-- buglink/buglink.php | 2 +- diaspora/diaspora.php | 2 +- dwpost/dwpost.php | 7 ++++--- fortunate/fortunate.php | 2 +- ijpost/ijpost.php | 2 +- impressum/impressum.php | 8 ++++---- jappixmini/jappixmini.php | 2 +- libertree/libertree.php | 4 ++-- ljpost/ljpost.php | 2 +- mathjax/mathjax.php | 2 +- pageheader/pageheader.php | 2 +- piwik/piwik.php | 6 ++++-- pledgie/pledgie.php | 4 ++-- pumpio/pumpio.php | 2 +- statusnet/statusnet.php | 2 +- tumblr/tumblr.php | 2 +- twitter/twitter.php | 2 +- wppost/wppost.php | 4 ++-- 20 files changed, 33 insertions(+), 31 deletions(-) diff --git a/blogger/blogger.php b/blogger/blogger.php index 20e13075..3652db52 100644 --- a/blogger/blogger.php +++ b/blogger/blogger.php @@ -37,8 +37,7 @@ function blogger_uninstall() } -function blogger_jot_nets(App $a, array &$b) -{ +function blogger_jot_nets(App $a, &$b) { if (!local_user()) { return; } diff --git a/buffer/buffer.php b/buffer/buffer.php index 8e89f289..89b2e12c 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -109,7 +109,7 @@ function buffer_connect(&$a) { return($o); } -function buffer_jot_nets(App $a, array &$b) { +function buffer_jot_nets(App $a, &$b) { if(! local_user()) return; @@ -122,7 +122,7 @@ function buffer_jot_nets(App $a, array &$b) { } } -function buffer_settings(&$a,&$s) { +function buffer_settings(App $a, &$s) { if(! local_user()) return; diff --git a/buglink/buglink.php b/buglink/buglink.php index 7b8d7836..91d860cd 100644 --- a/buglink/buglink.php +++ b/buglink/buglink.php @@ -20,7 +20,7 @@ function buglink_uninstall() Addon::unregisterHook('page_end', 'addon/buglink/buglink.php', 'buglink_active'); } -function buglink_active(App $a, array &$b) +function buglink_active(App $a, &$b) { $b .= ''; } diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 0589b1a0..cb921c41 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -36,7 +36,7 @@ function diaspora_uninstall() { } -function diaspora_jot_nets(App $a, array &$b) { +function diaspora_jot_nets(App $a, &$b) { if(! local_user()) return; diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 3c2156ba..24bdcdbb 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -34,12 +34,13 @@ function dwpost_uninstall() { } -function dwpost_jot_nets(App $a, array &$b) { - if(! local_user()) +function dwpost_jot_nets(App $a, &$b) { + if (! local_user()) { return; + } $dw_post = PConfig::get(local_user(),'dwpost','post'); - if(intval($dw_post) == 1) { + if (intval($dw_post) == 1) { $dw_defpost = PConfig::get(local_user(),'dwpost','post_by_default'); $selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' diff --git a/fortunate/fortunate.php b/fortunate/fortunate.php index 73306219..24bdb3ec 100644 --- a/fortunate/fortunate.php +++ b/fortunate/fortunate.php @@ -29,7 +29,7 @@ function fortunate_uninstall() } -function fortunate_fetch(App $a, array &$b) +function fortunate_fetch(App $a, &$b) { $a->page['htmlhead'] .= '' . "\r\n"; diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index fbcb529f..0957bb91 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -34,7 +34,7 @@ function ijpost_uninstall() { } -function ijpost_jot_nets(App $a, array &$b) { +function ijpost_jot_nets(App $a, &$b) { if(! local_user()) return; diff --git a/impressum/impressum.php b/impressum/impressum.php index 310bfc7a..bb9da5c9 100644 --- a/impressum/impressum.php +++ b/impressum/impressum.php @@ -41,7 +41,7 @@ function obfuscate_email ($s) { $s = str_replace('.','(dot)',$s); return $s; } -function impressum_footer(App $a, array &$b) { +function impressum_footer(App $a, &$b) { $text = proxy_parse_html(BBCode::convert(Config::get('impressum','footer_text'))); if (! $text == '') { $a->page['htmlhead'] .= ''; @@ -50,12 +50,12 @@ function impressum_footer(App $a, array &$b) { } } -function impressum_load_config(\Friendica\App $a) +function impressum_load_config(App $a) { - $a->loadConfigFile(__DIR__. '/config/impressum.ini.php'); + $a->loadConfigFile(__DIR__. '/config/impressum.ini.php'); } -function impressum_show($a,&$b) { +function impressum_show(App $a,&$b) { $b .= '

'.L10n::t('Impressum').'

'; $owner = Config::get('impressum', 'owner'); $owner_profile = Config::get('impressum','ownerprofile'); diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index fcb49e42..ea6d97e5 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -693,7 +693,7 @@ function jappixmini_cron(App $a, $d) } } -function jappixmini_download_source(App $a, array &$b) +function jappixmini_download_source(App $a, &$b) { // Jappix Mini source download link on About page $b .= '

Jappix Mini

'; diff --git a/libertree/libertree.php b/libertree/libertree.php index 7459dd52..e45e9694 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -31,7 +31,7 @@ function libertree_uninstall() { } -function libertree_jot_nets(App $a, array &$b) { +function libertree_jot_nets(App $a, &$b) { if(! local_user()) return; @@ -45,7 +45,7 @@ function libertree_jot_nets(App $a, array &$b) { } -function libertree_settings(&$a,&$s) { +function libertree_settings(App $a,&$s) { if(! local_user()) return; diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 4b962495..cb4f3f23 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -34,7 +34,7 @@ function ljpost_uninstall() { } -function ljpost_jot_nets(App $a, array &$b) { +function ljpost_jot_nets(App $a, &$b) { if(! local_user()) return; diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index 30ace80e..3250f24c 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -74,7 +74,7 @@ function mathjax_settings (&$a, &$s) { /* we need to add one JavaScript include command to the html output * note that you have to check the jsmath/easy/load.js too. */ -function mathjax_page_header(App $a, array &$b) { +function mathjax_page_header(App $a, &$b) { // if the visitor of the page is not a local_user, use MathJax // otherwise check the users settings. $url = Config::get ('mathjax','baseurl'); diff --git a/pageheader/pageheader.php b/pageheader/pageheader.php index 958249f8..a3665d75 100644 --- a/pageheader/pageheader.php +++ b/pageheader/pageheader.php @@ -72,7 +72,7 @@ function pageheader_addon_settings_post(App $a, array &$b) { } } -function pageheader_fetch($a,&$b) { +function pageheader_fetch(App $a, &$b) { if(file_exists('pageheader.html')){ $s = file_get_contents('pageheader.html'); diff --git a/piwik/piwik.php b/piwik/piwik.php index 5e34e098..1a35300d 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -30,6 +30,8 @@ * about http/https but beware to put the trailing / at the end of your * setting. */ + +use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -48,12 +50,12 @@ function piwik_uninstall() { logger("uninstalled piwik addon"); } -function piwik_load_config(\Friendica\App $a) +function piwik_load_config(App $a) { $a->loadConfigFile(__DIR__. '/config/piwik.ini.php'); } -function piwik_analytics($a,&$b) { +function piwik_analytics(App $a, &$b) { /* * styling of every HTML block added by this addon is done in the diff --git a/pledgie/pledgie.php b/pledgie/pledgie.php index 58579793..c549872b 100644 --- a/pledgie/pledgie.php +++ b/pledgie/pledgie.php @@ -24,7 +24,7 @@ function pledgie_uninstall() { Addon::unregisterHook('addon_settings_post', 'addon/pledgie/pledgie.php', 'pledgie_addon_settings_post'); } -function pledgie_addon_settings(&$a,&$s) { +function pledgie_addon_settings(App $a,&$s) { if(! is_site_admin()) return; @@ -71,7 +71,7 @@ function pledgie_addon_settings_post(App $a, array &$b) { } } -function pledgie_active(App $a, array &$b) { +function pledgie_active(App $a, &$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 71287fb6..083a1c94 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -212,7 +212,7 @@ function pumpio_connect(&$a) return $o; } -function pumpio_jot_nets(App $a, array &$b) +function pumpio_jot_nets(App $a, &$b) { if(! local_user()) return; diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 253021a6..86a1d0a4 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -94,7 +94,7 @@ function statusnet_check_item_notification(App $a, &$notification_data) $notification_data["profiles"][] = PConfig::get($notification_data["uid"], 'statusnet', 'own_url'); } -function statusnet_jot_nets(App $a, array &$b) +function statusnet_jot_nets(App $a, &$b) { if (!local_user()) { return; diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 368b62f0..4f3676b5 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -172,7 +172,7 @@ function tumblr_callback($a) { return $o; } -function tumblr_jot_nets(App $a, array &$b) { +function tumblr_jot_nets(App $a, &$b) { if (! local_user()) { return; } diff --git a/twitter/twitter.php b/twitter/twitter.php index 328c2c80..da0abf90 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -190,7 +190,7 @@ function twitter_follow(App $a, &$contact) } } -function twitter_jot_nets(App $a, array &$b) +function twitter_jot_nets(App $a, &$b) { if (!local_user()) { return; diff --git a/wppost/wppost.php b/wppost/wppost.php index 31bb2da1..4266beb8 100644 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -38,7 +38,7 @@ function wppost_uninstall() { } -function wppost_jot_nets(App $a, array &$b) { +function wppost_jot_nets(App $a, &$b) { if(! local_user()) return; @@ -52,7 +52,7 @@ function wppost_jot_nets(App $a, array &$b) { } -function wppost_settings(&$a,&$s) { +function wppost_settings(App &$a,&$s) { if(! local_user()) return; From ffeb70a0317abc2d1b64db3de5af353e7c5e9449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Thu, 10 May 2018 15:46:10 +0200 Subject: [PATCH 06/29] Allow NULL here, fixing error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- blockem/blockem.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/blockem/blockem.php b/blockem/blockem.php index 2510e042..32af096d 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -139,7 +139,7 @@ function blockem_prepare_body_content_filter(App $a, array &$hook_data) } } -function blockem_display_item(App $a, array &$b) { +function blockem_display_item(App $a, array &$b = NULL) { if (strstr($b['output']['body'],'id="blockem-wrap-')) { $b['output']['thumb'] = $a->get_baseurl() . "/images/person-80.jpg"; } @@ -147,13 +147,16 @@ function blockem_display_item(App $a, array &$b) { function blockem_conversation_start(App $a, array &$b) { - if(! local_user()) + if (! local_user()) { return; - - $words = PConfig::get(local_user(),'blockem','words'); - if($words) { - $a->data['blockem'] = explode(',',$words); } + + $words = PConfig::get(local_user(), 'blockem', 'words'); + + if ($words) { + $a->data['blockem'] = explode(',', $words); + } + $a->page['htmlhead'] .= <<< EOT