From e36f2bb1fb3439e9993c7568e57140c4f954b772 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 15 Jan 2018 08:05:12 -0500 Subject: [PATCH] Use short form array syntax everywhere - Add short form array syntax to po2php.php generation --- boot.php | 24 +- htconfig.php | 2 +- include/acl_selectors.php | 96 +- include/api.php | 464 ++--- include/bb2diaspora.php | 10 +- include/bbcode.php | 52 +- include/conversation.php | 100 +- include/datetime.php | 48 +- include/dba.php | 40 +- include/enotify.php | 36 +- include/event.php | 42 +- include/friendica_smarty.php | 10 +- include/html2bbcode.php | 126 +- include/html2plain.php | 56 +- include/items.php | 168 +- include/like.php | 6 +- include/nav.php | 102 +- include/network.php | 46 +- include/pgettext.php | 10 +- include/plaintext.php | 8 +- include/plugin.php | 62 +- include/post_update.php | 16 +- include/queue_fn.php | 2 +- include/security.php | 18 +- include/session.php | 10 +- include/tags.php | 12 +- include/text.php | 170 +- include/threads.php | 16 +- index.php | 22 +- mod/_well_known.php | 8 +- mod/admin.php | 474 ++--- mod/allfriends.php | 16 +- mod/api.php | 8 +- mod/apps.php | 4 +- mod/bookmarklet.php | 4 +- mod/cal.php | 28 +- mod/common.php | 14 +- mod/community.php | 22 +- mod/contactgroup.php | 2 +- mod/contacts.php | 172 +- mod/crepair.php | 36 +- mod/dfrn_poll.php | 12 +- mod/dfrn_request.php | 20 +- mod/directory.php | 16 +- mod/dirfind.php | 20 +- mod/display.php | 24 +- mod/editpost.php | 16 +- mod/events.php | 48 +- mod/fbrowser.php | 22 +- mod/fetch.php | 2 +- mod/filer.php | 6 +- mod/follow.php | 12 +- mod/friendica.php | 16 +- mod/fsuggest.php | 2 +- mod/group.php | 42 +- mod/hcard.php | 4 +- mod/help.php | 6 +- mod/home.php | 2 +- mod/hostxrd.php | 4 +- mod/hovercard.php | 8 +- mod/install.php | 56 +- mod/invite.php | 6 +- mod/item.php | 42 +- mod/lockview.php | 4 +- mod/lostpass.php | 16 +- mod/maintenance.php | 4 +- mod/manage.php | 6 +- mod/manifest.php | 4 +- mod/match.php | 18 +- mod/message.php | 66 +- mod/msearch.php | 10 +- mod/network.php | 112 +- mod/nodeinfo.php | 30 +- mod/nogroup.php | 8 +- mod/noscrape.php | 12 +- mod/notes.php | 8 +- mod/notifications.php | 38 +- mod/notify.php | 12 +- mod/oexchange.php | 4 +- mod/opensearch.php | 4 +- mod/parse_url.php | 8 +- mod/photo.php | 4 +- mod/photos.php | 184 +- mod/ping.php | 76 +- mod/poco.php | 26 +- mod/poke.php | 14 +- mod/pretheme.php | 2 +- mod/probe.php | 4 +- mod/profile.php | 20 +- mod/profile_photo.php | 12 +- mod/profiles.php | 112 +- mod/profperm.php | 4 +- mod/proxy.php | 10 +- mod/register.php | 18 +- mod/regmod.php | 4 +- mod/removeme.php | 4 +- mod/robots_txt.php | 4 +- mod/salmon.php | 2 +- mod/search.php | 34 +- mod/settings.php | 358 ++-- mod/share.php | 12 +- mod/smilies.php | 4 +- mod/statistics_json.php | 6 +- mod/subthread.php | 2 +- mod/suggest.php | 28 +- mod/tagger.php | 4 +- mod/uexport.php | 26 +- mod/uimport.php | 10 +- mod/unfollow.php | 12 +- mod/videos.php | 40 +- mod/viewcontacts.php | 10 +- mod/wall_attach.php | 22 +- mod/wall_upload.php | 24 +- mod/wallmessage.php | 12 +- mod/webfinger.php | 4 +- mod/xrd.php | 36 +- src/App.php | 70 +- src/Content/ContactSelector.php | 10 +- src/Content/Feature.php | 76 +- src/Content/ForumManager.php | 14 +- src/Content/OEmbed.php | 12 +- src/Content/Smilies.php | 12 +- src/Core/Cache.php | 36 +- src/Core/Config.php | 6 +- src/Core/NotificationsManager.php | 88 +- src/Core/PConfig.php | 6 +- src/Core/System.php | 8 +- src/Core/UserImport.php | 16 +- src/Core/Worker.php | 66 +- src/Database/DBM.php | 8 +- src/Database/DBStructure.php | 2168 +++++++++++------------ src/Model/Contact.php | 78 +- src/Model/GContact.php | 58 +- src/Model/Group.php | 6 +- src/Model/Photo.php | 12 +- src/Model/Profile.php | 154 +- src/Model/User.php | 12 +- src/Module/Login.php | 16 +- src/Module/Oembed.php | 2 +- src/Network/FKOAuthDataStore.php | 14 +- src/Network/Probe.php | 92 +- src/Object/Image.php | 32 +- src/Object/Post.php | 64 +- src/Object/Thread.php | 4 +- src/Protocol/DFRN.php | 138 +- src/Protocol/Diaspora.php | 260 +-- src/Protocol/Email.php | 32 +- src/Protocol/Feed.php | 14 +- src/Protocol/OStatus.php | 180 +- src/Protocol/PortableContact.php | 50 +- src/Protocol/Salmon.php | 38 +- src/Util/Crypto.php | 10 +- src/Util/Emailer.php | 4 +- src/Util/ExAuth.php | 4 +- src/Util/Lock.php | 10 +- src/Util/Map.php | 6 +- src/Util/ParseUrl.php | 30 +- src/Util/XML.php | 36 +- src/Worker/Cron.php | 8 +- src/Worker/CronJobs.php | 8 +- src/Worker/DBClean.php | 20 +- src/Worker/Delivery.php | 10 +- src/Worker/Directory.php | 2 +- src/Worker/DiscoverPoCo.php | 8 +- src/Worker/Expire.php | 8 +- src/Worker/GProbe.php | 4 +- src/Worker/Notifier.php | 20 +- src/Worker/OnePoll.php | 64 +- src/Worker/PubSubPublish.php | 6 +- src/Worker/Queue.php | 6 +- src/Worker/RemoveContact.php | 4 +- src/Worker/UpdateGContact.php | 4 +- update.php | 2 +- util/docblox_errorchecker.php | 34 +- util/extract.php | 10 +- util/fpostit/fpostit.php | 26 +- util/global_community_silence.php | 4 +- util/php2po.php | 12 +- util/po2php.php | 10 +- util/strings.php | 52 +- view/lang/bg/strings.php | 72 +- view/lang/ca/strings.php | 72 +- view/lang/cs/strings.php | 72 +- view/lang/de/strings.php | 72 +- view/lang/en-gb/strings.php | 72 +- view/lang/en-us/strings.php | 72 +- view/lang/eo/strings.php | 72 +- view/lang/es/strings.php | 72 +- view/lang/fr/strings.php | 72 +- view/lang/is/strings.php | 72 +- view/lang/it/strings.php | 72 +- view/lang/nb-no/strings.php | 52 +- view/lang/nl/strings.php | 72 +- view/lang/pl/strings.php | 72 +- view/lang/pt-br/strings.php | 72 +- view/lang/ro/strings.php | 52 +- view/lang/ru/strings.php | 72 +- view/lang/sv/strings.php | 72 +- view/lang/zh-cn/strings.php | 72 +- view/theme/duepuntozero/config.php | 10 +- view/theme/frio/config.php | 30 +- view/theme/frio/php/Image.php | 24 +- view/theme/frio/php/PHPColors/Color.php | 16 +- view/theme/frio/php/frio_boot.php | 8 +- view/theme/frio/php/schema.php | 14 +- view/theme/frio/style.php | 6 +- view/theme/frio/theme.php | 36 +- view/theme/frost/theme.php | 2 +- view/theme/quattro/config.php | 16 +- view/theme/vier/config.php | 30 +- view/theme/vier/style.php | 2 +- view/theme/vier/theme.php | 90 +- 212 files changed, 5171 insertions(+), 5171 deletions(-) diff --git a/boot.php b/boot.php index 2fe73bc812..4bfa5c0985 100644 --- a/boot.php +++ b/boot.php @@ -288,7 +288,7 @@ define('NETWORK_PHANTOM', 'unkn'); // Place holder * and existing allocations MUST NEVER BE CHANGED * OR RE-ASSIGNED! You may only add to them. */ -$netgroup_ids = array( +$netgroup_ids = [ NETWORK_DFRN => (-1), NETWORK_ZOT => (-2), NETWORK_OSTATUS => (-3), @@ -310,7 +310,7 @@ $netgroup_ids = array( NETWORK_PNUT => (-20), NETWORK_PHANTOM => (-127), -); +]; /** * Maximum number of "people who like (or don't like) this" that we will list by name @@ -504,7 +504,7 @@ function startup() ini_set('pcre.backtrack_limit', 500000); if (get_magic_quotes_gpc()) { - $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); + $process = [&$_GET, &$_POST, &$_COOKIE, &$_REQUEST]; while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); @@ -817,11 +817,11 @@ function check_plugins(App $a) if (DBM::is_result($r)) { $installed = $r; } else { - $installed = array(); + $installed = []; } $plugins = Config::get('system', 'addon'); - $plugins_arr = array(); + $plugins_arr = []; if ($plugins) { $plugins_arr = explode(',', str_replace(' ', '', $plugins)); @@ -829,7 +829,7 @@ function check_plugins(App $a) $a->plugins = $plugins_arr; - $installed_arr = array(); + $installed_arr = []; if (count($installed)) { foreach ($installed as $i) { @@ -966,7 +966,7 @@ function notice($s) { $a = get_app(); if (!x($_SESSION, 'sysmsg')) { - $_SESSION['sysmsg'] = array(); + $_SESSION['sysmsg'] = []; } if ($a->interactive) { $_SESSION['sysmsg'][] = $s; @@ -989,7 +989,7 @@ function info($s) } if (!x($_SESSION, 'sysmsg_info')) { - $_SESSION['sysmsg_info'] = array(); + $_SESSION['sysmsg_info'] = []; } if ($a->interactive) { $_SESSION['sysmsg_info'][] = $s; @@ -1010,7 +1010,7 @@ function get_max_import_size() function current_theme() { - $app_base_themes = array('duepuntozero', 'dispy', 'quattro'); + $app_base_themes = ['duepuntozero', 'dispy', 'quattro']; $a = get_app(); @@ -1238,10 +1238,10 @@ function explode_querystring($query) $args = array_values($args); } - return array( + return [ 'base' => $base, 'args' => $args, - ); + ]; } /** @@ -1571,7 +1571,7 @@ function infinite_scroll_data($module) $reload_uri .= "&offset=" . urlencode($a->page_offset); } - $arr = array("pageno" => $pageno, "reload_uri" => $reload_uri); + $arr = ["pageno" => $pageno, "reload_uri" => $reload_uri]; return $arr; } diff --git a/htconfig.php b/htconfig.php index ada7a130b1..67db66e86f 100644 --- a/htconfig.php +++ b/htconfig.php @@ -86,7 +86,7 @@ $a->config['system']['no_regfullname'] = true; $a->config['system']['directory'] = 'https://dir.friendica.social'; // Allowed protocols in link URLs; HTTP protocols always are accepted -$a->config['system']['allowed_link_protocols'] = array('ftp', 'ftps', 'mailto', 'cid', 'gopher'); +$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher']; // Authentication cookie lifetime, in days $a->config['system']['auth_cookie_lifetime'] = 7; diff --git a/include/acl_selectors.php b/include/acl_selectors.php index a93393d80f..5be3fd1f3f 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -28,7 +28,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) { ); - $arr = array('group' => $r, 'entry' => $o); + $arr = ['group' => $r, 'entry' => $o]; // e.g. 'network_pre_group_deny', 'profile_pre_group_allow' @@ -87,20 +87,20 @@ function contact_selector($selname, $selclass, $options, $preselected = false) if (x($options, 'networks')) { switch ($options['networks']) { case 'DFRN_ONLY': - $networks = array(NETWORK_DFRN); + $networks = [NETWORK_DFRN]; break; case 'PRIVATE': if (is_array($a->user) && $a->user['prvnets']) { - $networks = array(NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA); + $networks = [NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA]; } else { - $networks = array(NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA); + $networks = [NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA]; } break; case 'TWO_WAY': if (is_array($a->user) && $a->user['prvnets']) { - $networks = array(NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA); + $networks = [NETWORK_DFRN, NETWORK_MAIL, NETWORK_DIASPORA]; } else { - $networks = array(NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA, NETWORK_OSTATUS); + $networks = [NETWORK_DFRN, NETWORK_FACEBOOK, NETWORK_MAIL, NETWORK_DIASPORA, NETWORK_OSTATUS]; } break; default: /// @TODO Maybe log this call? @@ -109,7 +109,7 @@ function contact_selector($selname, $selclass, $options, $preselected = false) } } - $x = array('options' => $options, 'size' => $size, 'single' => $single, 'mutual' => $mutual, 'exclude' => $exclude, 'networks' => $networks); + $x = ['options' => $options, 'size' => $size, 'single' => $single, 'mutual' => $mutual, 'exclude' => $exclude, 'networks' => $networks]; call_hooks('contact_select_options', $x); @@ -150,7 +150,7 @@ function contact_selector($selname, $selclass, $options, $preselected = false) ); - $arr = array('contact' => $r, 'entry' => $o); + $arr = ['contact' => $r, 'entry' => $o]; // e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow' @@ -228,13 +228,13 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p ); - $arr = array('contact' => $r, 'entry' => $o); + $arr = ['contact' => $r, 'entry' => $o]; // e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow' call_hooks($a->module . '_pre_' . $selname, $arr); - $receiverlist = array(); + $receiverlist = []; if (DBM::is_result($r)) { foreach ($r as $rr) { @@ -270,7 +270,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p function fixacl(&$item) { - $item = intval(str_replace(array('<', '>'), array('', ''), $item)); + $item = intval(str_replace(['<', '>'], ['', ''], $item)); } function prune_deadguys($arr) { @@ -284,14 +284,14 @@ function prune_deadguys($arr) { $r = q("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 "); if (DBM::is_result($r)) { - $ret = array(); + $ret = []; foreach ($r as $rr) { $ret[] = intval($rr['id']); } return $ret; } - return array(); + return []; } @@ -300,13 +300,13 @@ function get_acl_permissions($user = null) { if (is_array($user)) { $allow_cid = ((strlen($user['allow_cid'])) - ? explode('><', $user['allow_cid']) : array() ); + ? explode('><', $user['allow_cid']) : [] ); $allow_gid = ((strlen($user['allow_gid'])) - ? explode('><', $user['allow_gid']) : array() ); + ? explode('><', $user['allow_gid']) : [] ); $deny_cid = ((strlen($user['deny_cid'])) - ? explode('><', $user['deny_cid']) : array() ); + ? explode('><', $user['deny_cid']) : [] ); $deny_gid = ((strlen($user['deny_gid'])) - ? explode('><', $user['deny_gid']) : array() ); + ? explode('><', $user['deny_gid']) : [] ); array_walk($allow_cid,'fixacl'); array_walk($allow_gid,'fixacl'); array_walk($deny_cid,'fixacl'); @@ -315,12 +315,12 @@ function get_acl_permissions($user = null) { $allow_cid = prune_deadguys($allow_cid); - return array( + return [ 'allow_cid' => $allow_cid, 'allow_gid' => $allow_gid, 'deny_cid' => $deny_cid, 'deny_gid' => $deny_gid, - ); + ]; } @@ -361,7 +361,7 @@ function populate_acl($user = null, $show_jotnets = false) { } $tpl = get_markup_template("acl_selector.tpl"); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$showall'=> t("Visible to everybody"), '$show' => t("show"), '$hide' => t("don't show"), @@ -375,10 +375,10 @@ function populate_acl($user = null, $show_jotnets = false) { '$jotnets' => $jotnets, '$aclModalTitle' => t('Permissions'), '$aclModalDismiss' => t('Close'), - '$features' => array( + '$features' => [ 'aclautomention' => (Feature::isEnabled($user['uid'], "aclautomention") ? "true" : "false") - ), - )); + ], + ]); return $o; @@ -475,8 +475,8 @@ function acl_lookup(App $a, $out_type = 'json') $tot = $group_count + $contact_count; - $groups = array(); - $contacts = array(); + $groups = []; + $contacts = []; if ($type == '' || $type == 'g') { /// @todo We should cache this query. @@ -495,7 +495,7 @@ function acl_lookup(App $a, $out_type = 'json') ); foreach ($r as $g) { - $groups[] = array( + $groups[] = [ "type" => "g", "photo" => "images/twopeople.png", "name" => htmlentities($g['name']), @@ -503,10 +503,10 @@ function acl_lookup(App $a, $out_type = 'json') "uids" => array_map("intval", explode(",",$g['uids'])), "link" => '', "forum" => '0' - ); + ]; } if ((count($groups) > 0) && ($search == "")) { - $groups[] = array("separator" => true); + $groups[] = ["separator" => true]; } } @@ -558,34 +558,34 @@ function acl_lookup(App $a, $out_type = 'json') } elseif ($type == 'x') { // autocomplete for global contact search (e.g. navbar search) $r = navbar_complete($a); - $contacts = array(); + $contacts = []; if ($r) { foreach ($r as $g) { - $contacts[] = array( + $contacts[] = [ 'photo' => proxy_url($g['photo'], false, PROXY_SIZE_MICRO), 'name' => $g['name'], 'nick' => (x($g['addr']) ? $g['addr'] : $g['url']), 'network' => $g['network'], 'link' => $g['url'], 'forum' => (x($g['community']) ? 1 : 0), - ); + ]; } } - $o = array( + $o = [ 'start' => $start, 'count' => $count, 'items' => $contacts, - ); + ]; echo json_encode($o); killme(); } else { - $r = array(); + $r = []; } if (DBM::is_result($r)) { - $forums = array(); + $forums = []; foreach ($r as $g) { - $entry = array( + $entry = [ 'type' => 'c', 'photo' => proxy_url($g['micro'], false, PROXY_SIZE_MICRO), 'name' => htmlentities($g['name']), @@ -595,7 +595,7 @@ function acl_lookup(App $a, $out_type = 'json') 'nick' => htmlentities(($g['attag']) ? $g['attag'] : $g['nick']), 'addr' => htmlentities(($g['addr']) ? $g['addr'] : $g['url']), 'forum' => ((x($g, 'forum') || x($g, 'prv')) ? 1 : 0), - ); + ]; if ($entry['forum']) { $forums[] = $entry; } else { @@ -604,7 +604,7 @@ function acl_lookup(App $a, $out_type = 'json') } if (count($forums) > 0) { if ($search == "") { - $forums[] = array("separator" => true); + $forums[] = ["separator" => true]; } $contacts = array_merge($forums, $contacts); } @@ -623,7 +623,7 @@ function acl_lookup(App $a, $out_type = 'json') } , $contacts); - $unknown_contacts = array(); + $unknown_contacts = []; $r = q("SELECT `author-link` FROM `item` WHERE `parent` = %d AND (`author-name` LIKE '%%%s%%' OR `author-link` LIKE '%%%s%%') @@ -641,7 +641,7 @@ function acl_lookup(App $a, $out_type = 'json') $contact = Contact::getDetailsByURL($row['author-link']); if (count($contact) > 0) { - $unknown_contacts[] = array( + $unknown_contacts[] = [ 'type' => 'c', 'photo' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO), 'name' => htmlentities($contact['name']), @@ -651,7 +651,7 @@ function acl_lookup(App $a, $out_type = 'json') 'nick' => htmlentities($contact['nick'] ? : $contact['addr']), 'addr' => htmlentities(($contact['addr']) ? $contact['addr'] : $contact['url']), 'forum' => $contact['forum'] - ); + ]; } } } @@ -660,7 +660,7 @@ function acl_lookup(App $a, $out_type = 'json') $tot += count($unknown_contacts); } - $results = array( + $results = [ 'tot' => $tot, 'start' => $start, 'count' => $count, @@ -669,27 +669,27 @@ function acl_lookup(App $a, $out_type = 'json') 'items' => $items, 'type' => $type, 'search' => $search, - ); + ]; call_hooks('acl_lookup_end', $results); if ($out_type === 'html') { - $o = array( + $o = [ 'tot' => $results['tot'], 'start' => $results['start'], 'count' => $results['count'], 'groups' => $results['groups'], 'contacts' => $results['contacts'], - ); + ]; return $o; } - $o = array( + $o = [ 'tot' => $results['tot'], 'start' => $results['start'], 'count' => $results['count'], 'items' => $results['items'], - ); + ]; echo json_encode($o); @@ -717,7 +717,7 @@ function navbar_complete(App $a) { // don't search if search term has less than 2 characters if (! $search || mb_strlen($search) < 2) { - return array(); + return []; } if (substr($search,0,1) === '@') { diff --git a/include/api.php b/include/api.php index da7a83f51c..21db40433a 100644 --- a/include/api.php +++ b/include/api.php @@ -51,7 +51,7 @@ define('API_METHOD_GET', 'GET'); define('API_METHOD_POST', 'POST,PUT'); define('API_METHOD_DELETE', 'POST,DELETE'); -$API = array(); +$API = []; $called_api = null; /** @@ -125,20 +125,20 @@ function api_register_func($path, $func, $auth = false, $method = API_METHOD_ANY { global $API; - $API[$path] = array( + $API[$path] = [ 'func' => $func, 'auth' => $auth, 'method' => $method, - ); + ]; // Workaround for hotot $path = str_replace("api/", "api/1.1/", $path); - $API[$path] = array( + $API[$path] = [ 'func' => $func, 'auth' => $auth, 'method' => $method, - ); + ]; } /** @@ -203,12 +203,12 @@ function api_login(App $a) // next code from mod/auth.php. needs better solution $record = null; - $addon_auth = array( + $addon_auth = [ 'username' => trim($user), 'password' => trim($password), 'authenticated' => 0, 'user_record' => null, - ); + ]; /* * A plugin indicates successful login by setting 'authenticated' to non-zero value and returning a user record @@ -409,11 +409,11 @@ function api_error($type, $e) $error = ($e->getMessage() !== "" ? $e->getMessage() : $e->httpdesc); /// @TODO: https://dev.twitter.com/overview/api/response-codes - $error = array("error" => $error, + $error = ["error" => $error, "code" => $e->httpcode . " " . $e->httpdesc, - "request" => $a->query_string); + "request" => $a->query_string]; - $return = api_format_data('status', $type, array('status' => $error)); + $return = api_format_data('status', $type, ['status' => $error]); switch ($type) { case "xml": @@ -450,7 +450,7 @@ function api_rss_extra(App $a, $arr, $user_info) } $arr['$user'] = $user_info; - $arr['$rss'] = array( + $arr['$rss'] = [ 'alternate' => $user_info['url'], 'self' => System::baseUrl() . "/" . $a->query_string, 'base' => System::baseUrl(), @@ -458,7 +458,7 @@ function api_rss_extra(App $a, $arr, $user_info) 'atom_updated' => datetime_convert('UTC', 'UTC', 'now', ATOM_TIME), 'language' => $user_info['language'], 'logo' => System::baseUrl() . "/images/friendica-32.png", - ); + ]; return $arr; } @@ -473,7 +473,7 @@ function api_rss_extra(App $a, $arr, $user_info) */ function api_unique_id_to_nurl($id) { - $r = dba::selectFirst('contact', array('nurl'), array('uid' => 0, 'id' => $id)); + $r = dba::selectFirst('contact', ['nurl'], ['uid' => 0, 'id' => $id]); if (DBM::is_result($r)) { return $r["nurl"]; @@ -603,7 +603,7 @@ function api_get_user(App $a, $contact_id = null) // if the contact wasn't found, fetch it from the contacts with uid = 0 if (!DBM::is_result($uinfo)) { - $r = array(); + $r = []; if ($url != "") { $r = q("SELECT * FROM `contact` WHERE `uid` = 0 AND `nurl` = '%s' LIMIT 1", dbesc(normalise_link($url))); @@ -617,7 +617,7 @@ function api_get_user(App $a, $contact_id = null) $r[0]['nick'] = api_get_nick($r[0]["url"]); } - $ret = array( + $ret = [ 'id' => $r[0]["id"], 'id_str' => (string) $r[0]["id"], 'name' => $r[0]["name"], @@ -651,7 +651,7 @@ function api_get_user(App $a, $contact_id = null) 'cid' => Contact::getIdForURL($r[0]["url"], api_user(), true), 'self' => 0, 'network' => $r[0]["network"], - ); + ]; return $ret; } else { @@ -752,7 +752,7 @@ function api_get_user(App $a, $contact_id = null) $location = $network_name; } - $ret = array( + $ret = [ 'id' => intval($pcontact_id), 'id_str' => (string) intval($pcontact_id), 'name' => (($uinfo[0]['name']) ? $uinfo[0]['name'] : $uinfo[0]['nick']), @@ -788,7 +788,7 @@ function api_get_user(App $a, $contact_id = null) 'cid' => intval($uinfo[0]['cid']), 'self' => $uinfo[0]['self'], 'network' => $uinfo[0]['network'], - ); + ]; // If this is a local user and it uses Frio, we can get its color preferences. if ($ret['self']) { @@ -847,7 +847,7 @@ function api_item_get_user(App $a, $item) $owner_user = $status_user; } - return (array($status_user, $owner_user)); + return ([$status_user, $owner_user]); } /** @@ -860,7 +860,7 @@ function api_item_get_user(App $a, $item) */ function api_walk_recursive(array &$array, callable $callback) { - $new_array = array(); + $new_array = []; foreach ($array as $k => $v) { if (is_array($v)) { @@ -918,14 +918,14 @@ function api_create_xml($data, $root_element) $data2 = array_pop($data); $key = key($data2); - $namespaces = array("" => "http://api.twitter.com", + $namespaces = ["" => "http://api.twitter.com", "statusnet" => "http://status.net/schema/api/1/", "friendica" => "http://friendi.ca/schema/api/1/", - "georss" => "http://www.georss.org/georss"); + "georss" => "http://www.georss.org/georss"]; /// @todo Auto detection of needed namespaces - if (in_array($root_element, array("ok", "hash", "config", "version", "ids", "notes", "photos"))) { - $namespaces = array(); + if (in_array($root_element, ["ok", "hash", "config", "version", "ids", "notes", "photos"])) { + $namespaces = []; } if (is_array($data2)) { @@ -933,7 +933,7 @@ function api_create_xml($data, $root_element) } if ($key == "0") { - $data4 = array(); + $data4 = []; $i = 1; foreach ($data2 as $item) { @@ -943,7 +943,7 @@ function api_create_xml($data, $root_element) $data2 = $data4; } - $data3 = array($root_element => $data2); + $data3 = [$root_element => $data2]; $ret = XML::fromArray($data3, $xml, false, $namespaces); return $ret; @@ -1021,7 +1021,7 @@ function api_account_verify_credentials($type) unset($user_info["uid"]); unset($user_info["self"]); - return api_format_data("user", $type, array('user' => $user_info)); + return api_format_data("user", $type, ['user' => $user_info]); } /// @TODO move to top of file or somewhere better @@ -1301,17 +1301,17 @@ function api_media_upload() throw new InternalServerErrorException(); } - $returndata = array(); + $returndata = []; $returndata["media_id"] = $media["id"]; $returndata["media_id_string"] = (string)$media["id"]; $returndata["size"] = $media["size"]; - $returndata["image"] = array("w" => $media["width"], + $returndata["image"] = ["w" => $media["width"], "h" => $media["height"], - "image_type" => $media["type"]); + "image_type" => $media["type"]]; logger("Media uploaded: " . print_r($returndata, true), LOGGER_DEBUG); - return array("media" => $returndata); + return ["media" => $returndata]; } /// @TODO move to top of file or somewhere better @@ -1367,7 +1367,7 @@ function api_status_show($type) $geo = "geo"; } - $status_info = array( + $status_info = [ 'created_at' => api_date($lastwall['created']), 'id' => intval($lastwall['id']), 'id_str' => (string) $lastwall['id'], @@ -1394,7 +1394,7 @@ function api_status_show($type) 'statusnet_html' => $converted["html"], 'statusnet_conversation_id' => $lastwall['parent'], 'external_url' => System::baseUrl() . "/display/" . $lastwall['guid'], - ); + ]; if (count($converted["attachments"]) > 0) { $status_info["attachments"] = $converted["attachments"]; @@ -1421,7 +1421,7 @@ function api_status_show($type) return $status_info; } - return api_format_data("statuses", $type, array('status' => $status_info)); + return api_format_data("statuses", $type, ['status' => $status_info]); } /** @@ -1468,7 +1468,7 @@ function api_users_show($type) $geo = "geo"; } - $user_info['status'] = array( + $user_info['status'] = [ 'text' => $converted["text"], 'truncated' => false, 'created_at' => api_date($lastwall['created']), @@ -1485,7 +1485,7 @@ function api_users_show($type) 'statusnet_html' => $converted["html"], 'statusnet_conversation_id' => $lastwall['parent'], 'external_url' => System::baseUrl() . "/display/" . $lastwall['guid'], - ); + ]; if (count($converted["attachments"]) > 0) { $user_info["status"]["attachments"] = $converted["attachments"]; @@ -1508,7 +1508,7 @@ function api_users_show($type) unset($user_info["uid"]); unset($user_info["self"]); - return api_format_data("user", $type, array('user' => $user_info)); + return api_format_data("user", $type, ['user' => $user_info]); } /// @TODO move to top of file or somewhere better @@ -1527,7 +1527,7 @@ function api_users_search($type) { $a = get_app(); - $userlist = array(); + $userlist = []; if (x($_GET, 'q')) { $r = q("SELECT id FROM `contact` WHERE `uid` = 0 AND `name` = '%s'", dbesc($_GET["q"])); @@ -1547,7 +1547,7 @@ function api_users_search($type) $userlist[] = $user_info; } } - $userlist = array("users" => $userlist); + $userlist = ["users" => $userlist]; } else { throw new BadRequestException("User not found."); } @@ -1573,7 +1573,7 @@ api_register_func('api/users/search', 'api_users_search'); */ function api_users_lookup($type) { - $users = array(); + $users = []; if (x($_REQUEST['user_id'])) { foreach (explode(',', $_REQUEST['user_id']) as $id) { @@ -1587,7 +1587,7 @@ function api_users_lookup($type) throw new NotFoundException; } - return api_format_data("users", $type, array('users' => $users)); + return api_format_data("users", $type, ['users' => $users]); } /// @TODO move to top of file or somewhere better @@ -1605,7 +1605,7 @@ api_register_func('api/users/lookup', 'api_users_lookup', true); */ function api_search($type) { - $data = array(); + $data = []; if (!x($_REQUEST, 'q')) { throw new BadRequestException("q parameter is required."); @@ -1726,7 +1726,7 @@ function api_statuses_home_timeline($type) $ret = api_format_items($r, $user_info, false, $type); // Set all posts from the query above to seen - $idarray = array(); + $idarray = []; foreach ($r as $item) { $idarray[] = intval($item["id"]); } @@ -1741,7 +1741,7 @@ function api_statuses_home_timeline($type) } } - $data = array('status' => $ret); + $data = ['status' => $ret]; switch ($type) { case "atom": case "rss": @@ -1848,7 +1848,7 @@ function api_statuses_public_timeline($type) $ret = api_format_items($r, $user_info, false, $type); - $data = array('status' => $ret); + $data = ['status' => $ret]; switch ($type) { case "atom": case "rss": @@ -1920,7 +1920,7 @@ function api_statuses_networkpublic_timeline($type) $ret = api_format_items($r, $user_info, false, $type); - $data = array('status' => $ret); + $data = ['status' => $ret]; switch ($type) { case "atom": case "rss": @@ -1998,10 +1998,10 @@ function api_statuses_show($type) $ret = api_format_items($r, $user_info, false, $type); if ($conversation) { - $data = array('status' => $ret); + $data = ['status' => $ret]; return api_format_data("statuses", $type, $data); } else { - $data = array('status' => $ret[0]); + $data = ['status' => $ret[0]]; return api_format_data("status", $type, $data); } } @@ -2091,7 +2091,7 @@ function api_conversation_show($type) $ret = api_format_items($r, $user_info, false, $type); - $data = array('status' => $ret); + $data = ['status' => $ret]; return api_format_data("statuses", $type, $data); } @@ -2294,7 +2294,7 @@ function api_statuses_mentions($type) $ret = api_format_items($r, $user_info, false, $type); - $data = array('status' => $ret); + $data = ['status' => $ret]; switch ($type) { case "atom": case "rss": @@ -2390,7 +2390,7 @@ function api_statuses_user_timeline($type) $ret = api_format_items($r, $user_info, true, $type); - $data = array('status' => $ret); + $data = ['status' => $ret]; switch ($type) { case "atom": case "rss": @@ -2468,7 +2468,7 @@ function api_favorites_create_destroy($type) $rets = api_format_items($item, $user_info, false, $type); $ret = $rets[0]; - $data = array('status' => $ret); + $data = ['status' => $ret]; switch ($type) { case "atom": case "rss": @@ -2499,7 +2499,7 @@ function api_favorites($type) throw new ForbiddenException(); } - $called_api = array(); + $called_api = []; $user_info = api_get_user($a); @@ -2508,7 +2508,7 @@ function api_favorites($type) logger('api_favorites: self:' . $user_info['self']); if ($user_info['self'] == 0) { - $ret = array(); + $ret = []; } else { $sql_extra = ""; @@ -2550,7 +2550,7 @@ function api_favorites($type) $ret = api_format_items($r, $user_info, false, $type); } - $data = array('status' => $ret); + $data = ['status' => $ret]; switch ($type) { case "atom": case "rss": @@ -2574,7 +2574,7 @@ api_register_func('api/favorites', 'api_favorites', true); function api_format_messages($item, $recipient, $sender) { // standard meta information - $ret = array( + $ret = [ 'id' => $item['id'], 'sender_id' => $sender['id'] , 'text' => "", @@ -2587,7 +2587,7 @@ function api_format_messages($item, $recipient, $sender) 'title' => "", 'friendica_seen' => $item['seen'], 'friendica_parent_uri' => $item['parent-uri'], - ); + ]; // "uid" and "self" are only needed for some internal stuff, so remove it from here unset($ret["sender"]["uid"]); @@ -2648,14 +2648,14 @@ function api_convert_item($item) $statushtml = trim(bbcode($body, false, false)); // Workaround for clients with limited HTML parser functionality - $search = array("
", "
", "
", + $search = ["
", "
", "
", "

", "

", "

", "

", "

", "

", "

", "

", - "
", "
", "
", "
"); - $replace = array("
", "
", "

", + "
", "
", "
", "
"]; + $replace = ["
", "
", "

", "

", "


", "

", "


", "

", "


", "

", "


", - "
", "

", "
", "

"); + "
", "

", "
", "

"]; $statushtml = str_replace($search, $replace, $statushtml); if ($item['title'] != "") { @@ -2682,12 +2682,12 @@ function api_convert_item($item) $entities = api_get_entitities($statustext, $body); - return array( + return [ "text" => $statustext, "html" => $statushtml, "attachments" => $attachments, "entities" => $entities - ); + ]; } /** @@ -2708,13 +2708,13 @@ function api_get_attachments(&$body) return false; } - $attachments = array(); + $attachments = []; foreach ($images[1] as $image) { $imagedata = Image::getInfoFromURL($image); if ($imagedata) { - $attachments[] = array("url" => $image, "mimetype" => $imagedata["mime"], "size" => $imagedata["size"]); + $attachments[] = ["url" => $image, "mimetype" => $imagedata["mime"], "size" => $imagedata["size"]]; } } @@ -2746,7 +2746,7 @@ function api_get_entitities(&$text, $bbcode) $replace = proxy_url($image); $text = str_replace($image, $replace, $text); } - return array(); + return []; } $bbcode = bb_CleanPictureLinks($bbcode); @@ -2754,11 +2754,11 @@ function api_get_entitities(&$text, $bbcode) // Change pure links in text to bbcode uris $bbcode = preg_replace("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2]$2[/url]', $bbcode); - $entities = array(); - $entities["hashtags"] = array(); - $entities["symbols"] = array(); - $entities["urls"] = array(); - $entities["user_mentions"] = array(); + $entities = []; + $entities["hashtags"] = []; + $entities["symbols"] = []; + $entities["urls"] = []; + $entities["user_mentions"] = []; $URLSearchString = "^\[\]"; @@ -2787,12 +2787,12 @@ function api_get_entitities(&$text, $bbcode) //preg_match_all("/\[url\]([$URLSearchString]*)\[\/url\]/ism", $bbcode, $urls1); preg_match_all("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $bbcode, $urls); - $ordered_urls = array(); + $ordered_urls = []; foreach ($urls[1] as $id => $url) { //$start = strpos($text, $url, $offset); $start = iconv_strpos($text, $url, 0, "UTF-8"); if (!($start === false)) { - $ordered_urls[$start] = array("url" => $url, "title" => $urls[2][$id]); + $ordered_urls[$start] = ["url" => $url, "title" => $urls[2][$id]]; } } @@ -2806,8 +2806,8 @@ function api_get_entitities(&$text, $bbcode) ) { $display_url = $url["title"]; } else { - $display_url = str_replace(array("http://www.", "https://www."), array("", ""), $url["url"]); - $display_url = str_replace(array("http://", "https://"), array("", ""), $display_url); + $display_url = str_replace(["http://www.", "https://www."], ["", ""], $url["url"]); + $display_url = str_replace(["http://", "https://"], ["", ""], $display_url); if (strlen($display_url) > 26) { $display_url = substr($display_url, 0, 25)."…"; @@ -2817,16 +2817,16 @@ function api_get_entitities(&$text, $bbcode) //$start = strpos($text, $url, $offset); $start = iconv_strpos($text, $url["url"], $offset, "UTF-8"); if (!($start === false)) { - $entities["urls"][] = array("url" => $url["url"], + $entities["urls"][] = ["url" => $url["url"], "expanded_url" => $url["url"], "display_url" => $display_url, - "indices" => array($start, $start+strlen($url["url"]))); + "indices" => [$start, $start+strlen($url["url"])]]; $offset = $start + 1; } } preg_match_all("/\[img](.*?)\[\/img\]/ism", $bbcode, $images); - $ordered_images = array(); + $ordered_images = []; foreach ($images[1] as $image) { //$start = strpos($text, $url, $offset); $start = iconv_strpos($text, $image, 0, "UTF-8"); @@ -2838,8 +2838,8 @@ function api_get_entitities(&$text, $bbcode) $offset = 0; foreach ($ordered_images as $url) { - $display_url = str_replace(array("http://www.", "https://www."), array("", ""), $url); - $display_url = str_replace(array("http://", "https://"), array("", ""), $display_url); + $display_url = str_replace(["http://www.", "https://www."], ["", ""], $url); + $display_url = str_replace(["http://", "https://"], ["", ""], $display_url); if (strlen($display_url) > 26) { $display_url = substr($display_url, 0, 25)."…"; @@ -2854,38 +2854,38 @@ function api_get_entitities(&$text, $bbcode) if (!Config::get("system", "proxy_disabled")) { $media_url = proxy_url($url); - $sizes = array(); + $sizes = []; $scale = Image::getScalingDimensions($image[0], $image[1], 150); - $sizes["thumb"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit"); + $sizes["thumb"] = ["w" => $scale["width"], "h" => $scale["height"], "resize" => "fit"]; if (($image[0] > 150) || ($image[1] > 150)) { $scale = Image::getScalingDimensions($image[0], $image[1], 340); - $sizes["small"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit"); + $sizes["small"] = ["w" => $scale["width"], "h" => $scale["height"], "resize" => "fit"]; } $scale = Image::getScalingDimensions($image[0], $image[1], 600); - $sizes["medium"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit"); + $sizes["medium"] = ["w" => $scale["width"], "h" => $scale["height"], "resize" => "fit"]; if (($image[0] > 600) || ($image[1] > 600)) { $scale = Image::getScalingDimensions($image[0], $image[1], 1024); - $sizes["large"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit"); + $sizes["large"] = ["w" => $scale["width"], "h" => $scale["height"], "resize" => "fit"]; } } else { $media_url = $url; - $sizes["medium"] = array("w" => $image[0], "h" => $image[1], "resize" => "fit"); + $sizes["medium"] = ["w" => $image[0], "h" => $image[1], "resize" => "fit"]; } - $entities["media"][] = array( + $entities["media"][] = [ "id" => $start+1, "id_str" => (string)$start+1, - "indices" => array($start, $start+strlen($url)), + "indices" => [$start, $start+strlen($url)], "media_url" => normalise_link($media_url), "media_url_https" => $media_url, "url" => $url, "display_url" => $display_url, "expanded_url" => $url, "type" => "photo", - "sizes" => $sizes); + "sizes" => $sizes]; } $offset = $start + 1; } @@ -2923,18 +2923,18 @@ function api_format_items_embeded_images($item, $text) */ function api_contactlink_to_array($txt) { - $match = array(); + $match = []; $r = preg_match_all('|([^<]*)|', $txt, $match); if ($r && count($match)==3) { - $res = array( + $res = [ 'name' => $match[2], 'url' => $match[1] - ); + ]; } else { - $res = array( + $res = [ 'name' => $text, 'url' => "" - ); + ]; } return $res; } @@ -2954,13 +2954,13 @@ function api_format_items_activities(&$item, $type = "json") { $a = get_app(); - $activities = array( - 'like' => array(), - 'dislike' => array(), - 'attendyes' => array(), - 'attendno' => array(), - 'attendmaybe' => array(), - ); + $activities = [ + 'like' => [], + 'dislike' => [], + 'attendyes' => [], + 'attendno' => [], + 'attendmaybe' => [], + ]; $items = q( 'SELECT * FROM item @@ -2997,7 +2997,7 @@ function api_format_items_activities(&$item, $type = "json") } if ($type == "xml") { - $xml_activities = array(); + $xml_activities = []; foreach ($activities as $k => $v) { // change xml element from "like" to "friendica:like" $xml_activities["friendica:".$k] = $v; @@ -3022,7 +3022,7 @@ function api_format_items_activities(&$item, $type = "json") */ function api_format_items_profiles($profile_row) { - $profile = array( + $profile = [ 'profile_id' => $profile_row['id'], 'profile_name' => $profile_row['profile-name'], 'is_default' => $profile_row['is-default'] ? true : false, @@ -3062,7 +3062,7 @@ function api_format_items_profiles($profile_row) 'social_networks' => bbcode(api_clean_plain_items($profile_row['contact']) , false, false, 2, false), 'homepage' => $profile_row['homepage'], 'users' => null - ); + ]; return $profile; } @@ -3078,7 +3078,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json") { $a = get_app(); - $ret = array(); + $ret = []; foreach ($r as $item) { localize_item($item); @@ -3099,7 +3099,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json") $geo = "geo"; } - $status = array( + $status = [ 'text' => $converted["text"], 'truncated' => false, 'created_at'=> api_date($item['created']), @@ -3120,7 +3120,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json") 'statusnet_conversation_id' => $item['parent'], 'external_url' => System::baseUrl() . "/display/" . $item['guid'], 'friendica_activities' => api_format_items_activities($item, $type), - ); + ]; if (count($converted["attachments"]) > 0) { $status["attachments"] = $converted["attachments"]; @@ -3153,7 +3153,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json") } catch (BadRequestException $e) { // user not found. should be found? /// @todo check if the user should be always found - $retweeted_status["user"] = array(); + $retweeted_status["user"] = []; } $rt_converted = api_convert_item($retweeted_item); @@ -3174,9 +3174,9 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json") $coords = explode(' ', $item["coord"]); if (count($coords) == 2) { if ($type == "json") { - $status["geo"] = array('type' => 'Point', - 'coordinates' => array((float) $coords[0], - (float) $coords[1])); + $status["geo"] = ['type' => 'Point', + 'coordinates' => [(float) $coords[0], + (float) $coords[1]]]; } else {// Not sure if this is the official format - if someone founds a documentation we can check $status["georss:point"] = $item["coord"]; } @@ -3197,26 +3197,26 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json") function api_account_rate_limit_status($type) { if ($type == "xml") { - $hash = array( + $hash = [ 'remaining-hits' => '150', - '@attributes' => array("type" => "integer"), + '@attributes' => ["type" => "integer"], 'hourly-limit' => '150', - '@attributes2' => array("type" => "integer"), + '@attributes2' => ["type" => "integer"], 'reset-time' => datetime_convert('UTC', 'UTC', 'now + 1 hour', ATOM_TIME), - '@attributes3' => array("type" => "datetime"), + '@attributes3' => ["type" => "datetime"], 'reset_time_in_seconds' => strtotime('now + 1 hour'), - '@attributes4' => array("type" => "integer"), - ); + '@attributes4' => ["type" => "integer"], + ]; } else { - $hash = array( + $hash = [ 'reset_time_in_seconds' => strtotime('now + 1 hour'), 'remaining_hits' => '150', 'hourly_limit' => '150', 'reset_time' => api_date(datetime_convert('UTC', 'UTC', 'now + 1 hour', ATOM_TIME)), - ); + ]; } - return api_format_data('hash', $type, array('hash' => $hash)); + return api_format_data('hash', $type, ['hash' => $hash]); } /// @TODO move to top of file or somewhere better @@ -3237,7 +3237,7 @@ function api_help_test($type) $ok = "ok"; } - return api_format_data('ok', $type, array("ok" => $ok)); + return api_format_data('ok', $type, ["ok" => $ok]); } /// @TODO move to top of file or somewhere better @@ -3251,9 +3251,9 @@ api_register_func('api/help/test', 'api_help_test', false); */ function api_lists($type) { - $ret = array(); + $ret = []; /// @TODO $ret is not filled here? - return api_format_data('lists', $type, array("lists_list" => $ret)); + return api_format_data('lists', $type, ["lists_list" => $ret]); } /// @TODO move to top of file or somewhere better @@ -3269,9 +3269,9 @@ api_register_func('api/lists', 'api_lists', true); */ function api_lists_list($type) { - $ret = array(); + $ret = []; /// @TODO $ret is not filled here? - return api_format_data('lists', $type, array("lists_list" => $ret)); + return api_format_data('lists', $type, ["lists_list" => $ret]); } /// @TODO move to top of file or somewhere better @@ -3350,7 +3350,7 @@ function api_statuses_f($qtype) intval($count) ); - $ret = array(); + $ret = []; foreach ($r as $cid) { $user = api_get_user($a, $cid['nurl']); // "uid" and "self" are only needed for some internal stuff, so remove it from here @@ -3362,7 +3362,7 @@ function api_statuses_f($qtype) } } - return array('user' => $ret); + return ['user' => $ret]; } @@ -3445,12 +3445,12 @@ function api_friendships_incoming($type) return false; } - $ids = array(); + $ids = []; foreach ($data['user'] as $user) { $ids[] = $user['id']; } - return api_format_data("ids", $type, array('id' => $ids)); + return api_format_data("ids", $type, ['id' => $ids]); } /// @TODO move to top of file or somewhere better @@ -3480,22 +3480,22 @@ function api_statusnet_config($type) $ssl = ((Config::get('system', 'have_ssl')) ? 'true' : 'false'); $sslserver = (($ssl === 'true') ? str_replace('http:', 'https:', System::baseUrl()) : ''); - $config = array( - 'site' => array('name' => $name,'server' => $server, 'theme' => 'default', 'path' => '', + $config = [ + 'site' => ['name' => $name,'server' => $server, 'theme' => 'default', 'path' => '', 'logo' => $logo, 'fancy' => true, 'language' => 'en', 'email' => $email, 'broughtby' => '', 'broughtbyurl' => '', 'timezone' => 'UTC', 'closed' => $closed, 'inviteonly' => false, 'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl, 'shorturllength' => '30', - 'friendica' => array( + 'friendica' => [ 'FRIENDICA_PLATFORM' => FRIENDICA_PLATFORM, 'FRIENDICA_VERSION' => FRIENDICA_VERSION, 'DFRN_PROTOCOL_VERSION' => DFRN_PROTOCOL_VERSION, 'DB_UPDATE_VERSION' => DB_UPDATE_VERSION - ) - ), - ); + ] + ], + ]; - return api_format_data('config', $type, array('config' => $config)); + return api_format_data('config', $type, ['config' => $config]); } /// @TODO move to top of file or somewhere better @@ -3513,7 +3513,7 @@ function api_statusnet_version($type) // liar $fake_statusnet_version = "0.9.7"; - return api_format_data('version', $type, array('version' => $fake_statusnet_version)); + return api_format_data('version', $type, ['version' => $fake_statusnet_version]); } /// @TODO move to top of file or somewhere better @@ -3546,7 +3546,7 @@ function api_ff_ids($type) return; } - $ids = array(); + $ids = []; foreach ($r as $rr) { if ($stringify_ids) { $ids[] = $rr['id']; @@ -3555,7 +3555,7 @@ function api_ff_ids($type) } } - return api_format_data("ids", $type, array('id' => $ids)); + return api_format_data("ids", $type, ['id' => $ids]); } /** @@ -3650,10 +3650,10 @@ function api_direct_messages_new($type) $r = q("SELECT * FROM `mail` WHERE id=%d", intval($id)); $ret = api_format_messages($r[0], $recipient, $sender); } else { - $ret = array("error"=>$id); + $ret = ["error"=>$id]; } - $data = array('direct_message'=>$ret); + $data = ['direct_message'=>$ret]; switch ($type) { case "atom": @@ -3696,8 +3696,8 @@ function api_direct_messages_destroy($type) $uid = $user_info['uid']; // error if no id or parenturi specified (for clients posting parent-uri as well) if ($verbose == "true" && ($id == 0 || $parenturi == "")) { - $answer = array('result' => 'error', 'message' => 'message id or parenturi not specified'); - return api_format_data("direct_messages_delete", $type, array('$result' => $answer)); + $answer = ['result' => 'error', 'message' => 'message id or parenturi not specified']; + return api_format_data("direct_messages_delete", $type, ['$result' => $answer]); } // BadRequestException if no id specified (for clients using Twitter API) @@ -3718,8 +3718,8 @@ function api_direct_messages_destroy($type) // error message if specified id is not in database if (!DBM::is_result($r)) { if ($verbose == "true") { - $answer = array('result' => 'error', 'message' => 'message id not in database'); - return api_format_data("direct_messages_delete", $type, array('$result' => $answer)); + $answer = ['result' => 'error', 'message' => 'message id not in database']; + return api_format_data("direct_messages_delete", $type, ['$result' => $answer]); } /// @todo BadRequestException ok for Twitter API clients? throw new BadRequestException('message id not in database'); @@ -3735,11 +3735,11 @@ function api_direct_messages_destroy($type) if ($verbose == "true") { if ($result) { // return success - $answer = array('result' => 'ok', 'message' => 'message deleted'); - return api_format_data("direct_message_delete", $type, array('$result' => $answer)); + $answer = ['result' => 'ok', 'message' => 'message deleted']; + return api_format_data("direct_message_delete", $type, ['$result' => $answer]); } else { - $answer = array('result' => 'error', 'message' => 'unknown error'); - return api_format_data("direct_messages_delete", $type, array('$result' => $answer)); + $answer = ['result' => 'error', 'message' => 'unknown error']; + return api_format_data("direct_messages_delete", $type, ['$result' => $answer]); } } /// @todo return JSON data like Twitter API not yet implemented @@ -3819,11 +3819,11 @@ function api_direct_messages_box($type, $box, $verbose) intval($count) ); if ($verbose == "true" && !DBM::is_result($r)) { - $answer = array('result' => 'error', 'message' => 'no mails available'); - return api_format_data("direct_messages_all", $type, array('$result' => $answer)); + $answer = ['result' => 'error', 'message' => 'no mails available']; + return api_format_data("direct_messages_all", $type, ['$result' => $answer]); } - $ret = array(); + $ret = []; foreach ($r as $item) { if ($box == "inbox" || $item['from-url'] != $profile_url) { $recipient = $user_info; @@ -3837,7 +3837,7 @@ function api_direct_messages_box($type, $box, $verbose) } - $data = array('direct_message' => $ret); + $data = ['direct_message' => $ret]; switch ($type) { case "atom": case "rss": @@ -3991,12 +3991,12 @@ function api_fr_photoalbum_delete($type) } // now let's delete all photos from the album - $result = dba::delete('photo', array('uid' => api_user(), 'album' => $album)); + $result = dba::delete('photo', ['uid' => api_user(), 'album' => $album]); // return success of deletion or error message if ($result) { - $answer = array('result' => 'deleted', 'message' => 'album `' . $album . '` with all containing photos has been deleted.'); - return api_format_data("photoalbum_delete", $type, array('$result' => $answer)); + $answer = ['result' => 'deleted', 'message' => 'album `' . $album . '` with all containing photos has been deleted.']; + return api_format_data("photoalbum_delete", $type, ['$result' => $answer]); } else { throw new InternalServerErrorException("unknown error - deleting from database failed"); } @@ -4043,8 +4043,8 @@ function api_fr_photoalbum_update($type) // return success of updating or error message if ($result) { - $answer = array('result' => 'updated', 'message' => 'album `' . $album . '` with all containing photos has been renamed to `' . $album_new . '`.'); - return api_format_data("photoalbum_update", $type, array('$result' => $answer)); + $answer = ['result' => 'updated', 'message' => 'album `' . $album . '` with all containing photos has been renamed to `' . $album_new . '`.']; + return api_format_data("photoalbum_update", $type, ['$result' => $answer]); } else { throw new InternalServerErrorException("unknown error - updating in database failed"); } @@ -4068,15 +4068,15 @@ function api_fr_photos_list($type) WHERE `uid` = %d AND `album` != 'Contact Photos' GROUP BY `resource-id`", intval(local_user()) ); - $typetoext = array( + $typetoext = [ 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/gif' => 'gif' - ); - $data = array('photo'=>array()); + ]; + $data = ['photo'=>[]]; if (DBM::is_result($r)) { foreach ($r as $rr) { - $photo = array(); + $photo = []; $photo['id'] = $rr['resource-id']; $photo['album'] = $rr['album']; $photo['filename'] = $rr['filename']; @@ -4087,7 +4087,7 @@ function api_fr_photos_list($type) $photo['desc'] = $rr['desc']; if ($type == "xml") { - $data['photo'][] = array("@attributes" => $photo, "1" => $thumb); + $data['photo'][] = ["@attributes" => $photo, "1" => $thumb]; } else { $photo['thumb'] = $thumb; $data['photo'][] = $photo; @@ -4231,12 +4231,12 @@ function api_fr_photo_create_update($type) // return success of updating or error message if ($result) { - $answer = array('result' => 'updated', 'message' => 'Image id `' . $photo_id . '` has been updated.'); - return api_format_data("photo_update", $type, array('$result' => $answer)); + $answer = ['result' => 'updated', 'message' => 'Image id `' . $photo_id . '` has been updated.']; + return api_format_data("photo_update", $type, ['$result' => $answer]); } else { if ($nothingtodo) { - $answer = array('result' => 'cancelled', 'message' => 'Nothing to update for image id `' . $photo_id . '`.'); - return api_format_data("photo_update", $type, array('$result' => $answer)); + $answer = ['result' => 'cancelled', 'message' => 'Nothing to update for image id `' . $photo_id . '`.']; + return api_format_data("photo_update", $type, ['$result' => $answer]); } throw new InternalServerErrorException("unknown error - update photo entry in database failed"); } @@ -4274,7 +4274,7 @@ function api_fr_photo_delete($type) throw new BadRequestException("photo not available"); } // now we can perform on the deletion of the photo - $result = dba::delete('photo', array('uid' => api_user(), 'resource-id' => $photo_id)); + $result = dba::delete('photo', ['uid' => api_user(), 'resource-id' => $photo_id]); // return success of deletion or error message if ($result) { @@ -4292,8 +4292,8 @@ function api_fr_photo_delete($type) // to the user and the contacts of the users (drop_items() do all the necessary magic to avoid orphans in database and federate deletion) drop_item($photo_item[0]['id'], false); - $answer = array('result' => 'deleted', 'message' => 'photo with id `' . $photo_id . '` has been deleted from server.'); - return api_format_data("photo_delete", $type, array('$result' => $answer)); + $answer = ['result' => 'deleted', 'message' => 'photo with id `' . $photo_id . '` has been deleted from server.']; + return api_format_data("photo_delete", $type, ['$result' => $answer]); } else { throw new InternalServerErrorException("unknown error on deleting photo from database table"); } @@ -4692,7 +4692,7 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f $uri = item_new_uri(get_app()->get_hostname(), intval(api_user())); $owner_record = q("SELECT * FROM `contact` WHERE `uid`= %d AND `self` LIMIT 1", intval(api_user())); - $arr = array(); + $arr = []; $arr['guid'] = get_guid(32); $arr['uid'] = intval(api_user()); $arr['uri'] = $uri; @@ -4716,11 +4716,11 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f $arr['visible'] = $visibility; $arr['origin'] = 1; - $typetoext = array( + $typetoext = [ 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/gif' => 'gif' - ); + ]; // adds link to the thumbnail scale photo $arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record[0]['nick'] . '/image/' . $hash . ']' @@ -4757,15 +4757,15 @@ function prepare_photo_data($type, $scale, $photo_id) $scale_sql ); - $typetoext = array( + $typetoext = [ 'image/jpeg' => 'jpg', 'image/png' => 'png', 'image/gif' => 'gif' - ); + ]; // prepare output data for photo if (DBM::is_result($r)) { - $data = array('photo' => $r[0]); + $data = ['photo' => $r[0]]; $data['photo']['id'] = $data['photo']['resource-id']; if ($scale !== false) { $data['photo']['data'] = base64_encode($data['photo']['data']); @@ -4773,14 +4773,14 @@ function prepare_photo_data($type, $scale, $photo_id) unset($data['photo']['datasize']); //needed only with scale param } if ($type == "xml") { - $data['photo']['links'] = array(); + $data['photo']['links'] = []; for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) { - $data['photo']['links'][$k . ":link"]["@attributes"] = array("type" => $data['photo']['type'], + $data['photo']['links'][$k . ":link"]["@attributes"] = ["type" => $data['photo']['type'], "scale" => $k, - "href" => System::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]); + "href" => System::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]]; } } else { - $data['photo']['link'] = array(); + $data['photo']['link'] = []; // when we have profile images we could have only scales from 4 to 6, but index of array always needs to start with 0 $i = 0; for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) { @@ -4822,7 +4822,7 @@ function prepare_photo_data($type, $scale, $photo_id) // prepare output of comments $commentData = api_format_items($r, api_get_user(get_app()), false, $type); - $comments = array(); + $comments = []; if ($type == "xml") { $k = 0; foreach ($commentData as $comment) { @@ -5104,7 +5104,7 @@ function api_get_nick($profile) */ function api_in_reply_to($item) { - $in_reply_to = array(); + $in_reply_to = []; $in_reply_to['status_id'] = null; $in_reply_to['user_id'] = null; @@ -5223,7 +5223,7 @@ function api_clean_attachments($body) */ function api_best_nickname(&$contacts) { - $best_contact = array(); + $best_contact = []; if (count($contact) == 0) { return; @@ -5232,14 +5232,14 @@ function api_best_nickname(&$contacts) foreach ($contacts as $contact) { if ($contact["network"] == "") { $contact["network"] = "dfrn"; - $best_contact = array($contact); + $best_contact = [$contact]; } } if (sizeof($best_contact) == 0) { foreach ($contacts as $contact) { if ($contact["network"] == "dfrn") { - $best_contact = array($contact); + $best_contact = [$contact]; } } } @@ -5247,7 +5247,7 @@ function api_best_nickname(&$contacts) if (sizeof($best_contact) == 0) { foreach ($contacts as $contact) { if ($contact["network"] == "dspr") { - $best_contact = array($contact); + $best_contact = [$contact]; } } } @@ -5255,7 +5255,7 @@ function api_best_nickname(&$contacts) if (sizeof($best_contact) == 0) { foreach ($contacts as $contact) { if ($contact["network"] == "stat") { - $best_contact = array($contact); + $best_contact = [$contact]; } } } @@ -5263,7 +5263,7 @@ function api_best_nickname(&$contacts) if (sizeof($best_contact) == 0) { foreach ($contacts as $contact) { if ($contact["network"] == "pump") { - $best_contact = array($contact); + $best_contact = [$contact]; } } } @@ -5271,7 +5271,7 @@ function api_best_nickname(&$contacts) if (sizeof($best_contact) == 0) { foreach ($contacts as $contact) { if ($contact["network"] == "twit") { - $best_contact = array($contact); + $best_contact = [$contact]; } } } @@ -5279,7 +5279,7 @@ function api_best_nickname(&$contacts) if (sizeof($best_contact) == 1) { $contacts = $best_contact; } else { - $contacts = array($contacts[0]); + $contacts = [$contacts[0]]; } } @@ -5324,7 +5324,7 @@ function api_friendica_group_show($type) // loop through all groups and retrieve all members for adding data in the user array foreach ($r as $rr) { $members = Contact::getByGroupId($rr['id']); - $users = array(); + $users = []; if ($type == "xml") { $user_element = "users"; @@ -5340,9 +5340,9 @@ function api_friendica_group_show($type) $users[] = $user; } } - $grps[] = array('name' => $rr['name'], 'gid' => $rr['id'], $user_element => $users); + $grps[] = ['name' => $rr['name'], 'gid' => $rr['id'], $user_element => $users]; } - return api_format_data("groups", $type, array('group' => $grps)); + return api_format_data("groups", $type, ['group' => $grps]); } api_register_func('api/friendica/group_show', 'api_friendica_group_show', true); @@ -5400,8 +5400,8 @@ function api_friendica_group_delete($type) $ret = Group::removeByName($uid, $name); if ($ret) { // return success - $success = array('success' => $ret, 'gid' => $gid, 'name' => $name, 'status' => 'deleted', 'wrong users' => array()); - return api_format_data("group_delete", $type, array('result' => $success)); + $success = ['success' => $ret, 'gid' => $gid, 'name' => $name, 'status' => 'deleted', 'wrong users' => []]; + return api_format_data("group_delete", $type, ['result' => $success]); } else { throw new BadRequestException('other API error'); } @@ -5468,7 +5468,7 @@ function api_friendica_group_create($type) // add members $erroraddinguser = false; - $errorusers = array(); + $errorusers = []; foreach ($users as $user) { $cid = $user['cid']; // check if user really exists as contact @@ -5487,8 +5487,8 @@ function api_friendica_group_create($type) // return success message incl. missing users in array $status = ($erroraddinguser ? "missing user" : ($reactivate_group ? "reactivated" : "ok")); - $success = array('success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers); - return api_format_data("group_create", $type, array('result' => $success)); + $success = ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers]; + return api_format_data("group_create", $type, ['result' => $success]); } api_register_func('api/friendica/group_create', 'api_friendica_group_create', true, API_METHOD_POST); @@ -5540,7 +5540,7 @@ function api_friendica_group_update($type) // add members $erroraddinguser = false; - $errorusers = array(); + $errorusers = []; foreach ($users as $user) { $cid = $user['cid']; // check if user really exists as contact @@ -5560,8 +5560,8 @@ function api_friendica_group_update($type) // return success message incl. missing users in array $status = ($erroraddinguser ? "missing user" : "ok"); - $success = array('success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers); - return api_format_data("group_update", $type, array('result' => $success)); + $success = ['success' => true, 'gid' => $gid, 'name' => $name, 'status' => $status, 'wrong users' => $errorusers]; + return api_format_data("group_update", $type, ['result' => $success]); } api_register_func('api/friendica/group_update', 'api_friendica_group_update', true, API_METHOD_POST); @@ -5592,7 +5592,7 @@ function api_friendica_activity($type) } else { $ok = "ok"; } - return api_format_data('ok', $type, array('ok' => $ok)); + return api_format_data('ok', $type, ['ok' => $ok]); } else { throw new BadRequestException('Error adding activity'); } @@ -5628,18 +5628,18 @@ function api_friendica_notification($type) } $nm = new NotificationsManager(); - $notes = $nm->getAll(array(), "+seen -date", 50); + $notes = $nm->getAll([], "+seen -date", 50); if ($type == "xml") { - $xmlnotes = array(); + $xmlnotes = []; foreach ($notes as $note) { - $xmlnotes[] = array("@attributes" => $note); + $xmlnotes[] = ["@attributes" => $note]; } $notes = $xmlnotes; } - return api_format_data("notes", $type, array('note' => $notes)); + return api_format_data("notes", $type, ['note' => $notes]); } /** @@ -5681,12 +5681,12 @@ function api_friendica_notification_seen($type) // we found the item, return it to the user $user_info = api_get_user($a); $ret = api_format_items($r, $user_info, false, $type); - $data = array('status' => $ret); + $data = ['status' => $ret]; return api_format_data("status", $type, $data); } // the item can't be found, but we set the note as seen, so we count this as a success } - return api_format_data('result', $type, array('result' => "success")); + return api_format_data('result', $type, ['result' => "success"]); } /// @TODO move to top of file or somewhere better @@ -5713,8 +5713,8 @@ function api_friendica_direct_messages_setseen($type) // return error if id is zero if ($id == "") { - $answer = array('result' => 'error', 'message' => 'message id not specified'); - return api_format_data("direct_messages_setseen", $type, array('$result' => $answer)); + $answer = ['result' => 'error', 'message' => 'message id not specified']; + return api_format_data("direct_messages_setseen", $type, ['$result' => $answer]); } // get data of the specified message id @@ -5726,8 +5726,8 @@ function api_friendica_direct_messages_setseen($type) // error message if specified id is not in database if (!DBM::is_result($r)) { - $answer = array('result' => 'error', 'message' => 'message id not in database'); - return api_format_data("direct_messages_setseen", $type, array('$result' => $answer)); + $answer = ['result' => 'error', 'message' => 'message id not in database']; + return api_format_data("direct_messages_setseen", $type, ['$result' => $answer]); } // update seen indicator @@ -5739,11 +5739,11 @@ function api_friendica_direct_messages_setseen($type) if ($result) { // return success - $answer = array('result' => 'ok', 'message' => 'message set to seen'); - return api_format_data("direct_message_setseen", $type, array('$result' => $answer)); + $answer = ['result' => 'ok', 'message' => 'message set to seen']; + return api_format_data("direct_message_setseen", $type, ['$result' => $answer]); } else { - $answer = array('result' => 'error', 'message' => 'unknown error'); - return api_format_data("direct_messages_setseen", $type, array('$result' => $answer)); + $answer = ['result' => 'error', 'message' => 'unknown error']; + return api_format_data("direct_messages_setseen", $type, ['$result' => $answer]); } } @@ -5773,8 +5773,8 @@ function api_friendica_direct_messages_search($type) // error if no searchstring specified if ($searchstring == "") { - $answer = array('result' => 'error', 'message' => 'searchstring not specified'); - return api_format_data("direct_messages_search", $type, array('$result' => $answer)); + $answer = ['result' => 'error', 'message' => 'searchstring not specified']; + return api_format_data("direct_messages_search", $type, ['$result' => $answer]); } // get data for the specified searchstring @@ -5788,11 +5788,11 @@ function api_friendica_direct_messages_search($type) // message if nothing was found if (!DBM::is_result($r)) { - $success = array('success' => false, 'search_results' => 'problem with query'); + $success = ['success' => false, 'search_results' => 'problem with query']; } elseif (count($r) == 0) { - $success = array('success' => false, 'search_results' => 'nothing found'); + $success = ['success' => false, 'search_results' => 'nothing found']; } else { - $ret = array(); + $ret = []; foreach ($r as $item) { if ($box == "inbox" || $item['from-url'] != $profile_url) { $recipient = $user_info; @@ -5804,10 +5804,10 @@ function api_friendica_direct_messages_search($type) $ret[] = api_format_messages($item, $recipient, $sender); } - $success = array('success' => true, 'search_results' => $ret); + $success = ['success' => true, 'search_results' => $ret]; } - return api_format_data("direct_message_search", $type, array('$result' => $success)); + return api_format_data("direct_message_search", $type, ['$result' => $success]); } /// @TODO move to top of file or somewhere better @@ -5858,7 +5858,7 @@ function api_friendica_profile_show($type) $profile = api_format_items_profiles($rr); // select all users from contact table, loop and prepare standard return for user data - $users = array(); + $users = []; $r = q( "SELECT `id`, `nurl` FROM `contact` WHERE `uid`= %d AND `profile-id` = %d", intval(api_user()), @@ -5882,11 +5882,11 @@ function api_friendica_profile_show($type) // return settings, authenticated user and profiles data $self = q("SELECT `nurl` FROM `contact` WHERE `uid`= %d AND `self` LIMIT 1", intval(api_user())); - $result = array('multi_profiles' => $multi_profiles ? true : false, + $result = ['multi_profiles' => $multi_profiles ? true : false, 'global_dir' => $directory, 'friendica_owner' => api_get_user($a, $self[0]['nurl']), - 'profiles' => $profiles); - return api_format_data("friendica_profiles", $type, array('$result' => $result)); + 'profiles' => $profiles]; + return api_format_data("friendica_profiles", $type, ['$result' => $result]); } api_register_func('api/friendica/profile/show', 'api_friendica_profile_show', true, API_METHOD_GET); @@ -5901,21 +5901,21 @@ api_register_func('api/friendica/profile/show', 'api_friendica_profile_show', tr */ function api_saved_searches_list($type) { - $terms = dba::select('search', array('id', 'term'), array('uid' => local_user())); + $terms = dba::select('search', ['id', 'term'], ['uid' => local_user()]); - $result = array(); + $result = []; while ($term = $terms->fetch()) { - $result[] = array( + $result[] = [ 'name' => $term['term'], 'query' => $term['term'], 'id_str' => $term['id'], 'id' => intval($term['id']) - ); + ]; } dba::close($terms); - return api_format_data("terms", $type, array('terms' => $result)); + return api_format_data("terms", $type, ['terms' => $result]); } /// @TODO move to top of file or somewhere better diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 73210860d2..fc25a584a9 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -51,7 +51,7 @@ function diaspora2bb($s) { $s = preg_replace('/^([^\*]+)\*([^\*]*)$/im', '$1\*$2', $s); // The parser cannot handle paragraphs correctly - $s = str_replace(array('

', '

', '

'), array('
', '
', '
'), $s); + $s = str_replace(['

', '

', '

'], ['
', '
', '
'], $s); // Escaping the hash tags $s = preg_replace('/\#([^\s\#])/', '#$1', $s); @@ -178,11 +178,11 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) { } // mask some special HTML chars from conversation to markdown - $Text = str_replace(array('<', '>', '&'), array('&_lt_;', '&_gt_;', '&_amp_;'), $Text); + $Text = str_replace(['<', '>', '&'], ['&_lt_;', '&_gt_;', '&_amp_;'], $Text); // If a link is followed by a quote then there should be a newline before it // Maybe we should make this newline at every time before a quote. - $Text = str_replace(array("

"), array("
"), $Text); + $Text = str_replace(["
"], ["
"], $Text); $stamp1 = microtime(true); @@ -191,12 +191,12 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) { $Text = $converter->convert($Text); // unmask the special chars back to HTML - $Text = str_replace(array('&\_lt\_;', '&\_gt\_;', '&\_amp\_;'), array('<', '>', '&'), $Text); + $Text = str_replace(['&\_lt\_;', '&\_gt\_;', '&\_amp\_;'], ['<', '>', '&'], $Text); $a->save_timestamp($stamp1, "parser"); // Libertree has a problem with escaped hashtags. - $Text = str_replace(array('\#'), array('#'), $Text); + $Text = str_replace(['\#'], ['#'], $Text); // Remove any leading or trailing whitespace, as this will mess up // the Diaspora signature verification and cause the item to disappear diff --git a/include/bbcode.php b/include/bbcode.php index 47c4018212..a6ffc39c18 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -60,7 +60,7 @@ function bb_attachment($return, $simplehtml = false, $tryoembed = true) if (isset($data["title"])) { $data["title"] = strip_tags($data["title"]); - $data["title"] = str_replace(array("http://", "https://"), "", $data["title"]); + $data["title"] = str_replace(["http://", "https://"], "", $data["title"]); } if (((strpos($data["text"], "[img=") !== false) || (strpos($data["text"], "[img]") !== false) || Config::get('system', 'always_show_preview')) && ($data["image"] != "")) { @@ -280,7 +280,7 @@ function bb_find_open_close($s, $open, $close, $occurence = 1) { return false; } - $res = array( 'start' => $start_pos, 'end' => $end_pos ); + $res = [ 'start' => $start_pos, 'end' => $end_pos ]; return $res; } @@ -316,16 +316,16 @@ function get_bb_tag_pos($s, $name, $occurence = 1) { return false; } - $res = array( - 'start' => array( + $res = [ + 'start' => [ 'open' => $start_open, 'close' => $start_close - ), - 'end' => array( + ], + 'end' => [ 'open' => $end_open, 'close' => $end_open + strlen('[/' . $name . ']') - ), - ); + ], + ]; if ($start_equal !== false) { $res['start']['equal'] = $start_equal + 1; @@ -360,7 +360,7 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) { function bb_extract_images($body) { - $saved_image = array(); + $saved_image = []; $orig_body = $body; $new_body = ''; @@ -398,7 +398,7 @@ function bb_extract_images($body) { $new_body = $new_body . $orig_body; - return array('body' => $new_body, 'images' => $saved_image); + return ['body' => $new_body, 'images' => $saved_image]; } function bb_replace_images($body, $images) { @@ -595,14 +595,14 @@ function bb_ShareAttributes($share, $simplehtml) $avatar = proxy_url($avatar, false, PROXY_SIZE_THUMB); $tpl = get_markup_template('shared_content.tpl'); - $text .= replace_macros($tpl, array( + $text .= replace_macros($tpl, [ '$profile' => $profile, '$avatar' => $avatar, '$author' => $author, '$link' => $link, '$posted' => $posted, '$content' => trim($share[3]) - )); + ]); } break; } @@ -752,7 +752,7 @@ function bb_RemovePictureLinks($match) { $xpath = new DomXPath($doc); $list = $xpath->query("//meta[@name]"); foreach ($list as $node) { - $attr = array(); + $attr = []; if ($node->attributes->length) foreach ($node->attributes as $attribute) @@ -809,7 +809,7 @@ function bb_CleanPictureLinksSub($match) { $xpath = new DomXPath($doc); $list = $xpath->query("//meta[@name]"); foreach ($list as $node) { - $attr = array(); + $attr = []; if ($node->attributes->length) foreach ($node->attributes as $attribute) @@ -951,10 +951,10 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa // removing multiplicated newlines if (Config::get("system", "remove_multiplicated_lines")) { - $search = array("\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n", - "\n[h1]", "[/h1]\n", "\n[h2]", "[/h2]\n", "\n[h3]", "[/h3]\n", "\n[h4]", "[/h4]\n", "\n[h5]", "[/h5]\n", "\n[h6]", "[/h6]\n"); - $replace = array("\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ", "[/attachment]", - "[h1]", "[/h1]", "[h2]", "[/h2]", "[h3]", "[/h3]", "[h4]", "[/h4]", "[h5]", "[/h5]", "[h6]", "[/h6]"); + $search = ["\n\n\n", "\n ", " \n", "[/quote]\n\n", "\n[/quote]", "[/li]\n", "\n[li]", "\n[ul]", "[/ul]\n", "\n\n[share ", "[/attachment]\n", + "\n[h1]", "[/h1]\n", "\n[h2]", "[/h2]\n", "\n[h3]", "[/h3]\n", "\n[h4]", "[/h4]\n", "\n[h5]", "[/h5]\n", "\n[h6]", "[/h6]\n"]; + $replace = ["\n\n", "\n", "\n", "[/quote]\n", "[/quote]", "[/li]", "[li]", "[ul]", "[/ul]", "\n[share ", "[/attachment]", + "[h1]", "[/h1]", "[h2]", "[/h2]", "[h3]", "[/h3]", "[h4]", "[/h4]", "[h5]", "[/h5]", "[h6]", "[/h6]"]; do { $oldtext = $Text; $Text = str_replace($search, $replace, $Text); @@ -986,14 +986,14 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa // Handle attached links or videos $Text = bb_attachment($Text, $simplehtml, $tryoembed); - $Text = str_replace(array("\r","\n"), array('
', '
'), $Text); + $Text = str_replace(["\r","\n"], ['
', '
'], $Text); if ($preserve_nl) { - $Text = str_replace(array("\n", "\r"), array('', ''), $Text); + $Text = str_replace(["\n", "\r"], ['', ''], $Text); } // Remove all hashtag addresses - if ((!$tryoembed || $simplehtml) && !in_array($simplehtml, array(3, 7))) { + if ((!$tryoembed || $simplehtml) && !in_array($simplehtml, [3, 7])) { $Text = preg_replace("/([#@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text); } elseif ($simplehtml == 3) { $Text = preg_replace("/([@!])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", @@ -1015,7 +1015,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa $Text = preg_replace("/#\[url\=[$URLSearchString]*\]\^\[\/url\]\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/i", "[bookmark=$1]$2[/bookmark]", $Text); - if (in_array($simplehtml, array(2, 6, 7, 8, 9))) { + if (in_array($simplehtml, [2, 6, 7, 8, 9])) { $Text = preg_replace_callback("/([^#@!])\[url\=([^\]]*)\](.*?)\[\/url\]/ism", "bb_expand_links", $Text); //$Text = preg_replace("/[^#@!]\[url\=([^\]]*)\](.*?)\[\/url\]/ism", ' $2 [url]$1[/url]', $Text); $Text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", ' $2 [url]$1[/url]',$Text); @@ -1353,13 +1353,13 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa $Text = preg_replace('/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism', '<$1$2=$3&$4>', $Text); // sanitizes src attributes (http and redir URLs for displaying in a web page, cid used for inline images in emails) - static $allowed_src_protocols = array('http', 'redir', 'cid'); + static $allowed_src_protocols = ['http', 'redir', 'cid']; $Text = preg_replace('#<([^>]*?)(src)="(?!' . implode('|', $allowed_src_protocols) . ')(.*?)"(.*?)>#ism', '<$1$2=""$4 data-original-src="$3" class="invalid-src" title="' . t('Invalid source protocol') . '">', $Text); // sanitize href attributes (only whitelisted protocols URLs) // default value for backward compatibility - $allowed_link_protocols = Config::get('system', 'allowed_link_protocols', array('ftp', 'mailto', 'gopher', 'cid')); + $allowed_link_protocols = Config::get('system', 'allowed_link_protocols', ['ftp', 'mailto', 'gopher', 'cid']); // Always allowed protocol even if config isn't set or not including it $allowed_link_protocols[] = 'http'; @@ -1386,7 +1386,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa @$doc->loadHTML($encoding.$doctype."".$Text.""); $doc->encoding = 'UTF-8'; $Text = $doc->saveHTML(); - $Text = str_replace(array("", "", $doctype, $encoding), array("", "", "", ""), $Text); + $Text = str_replace(["", "", $doctype, $encoding], ["", "", "", ""], $Text); $Text = str_replace('
', '', $Text); @@ -1427,7 +1427,7 @@ function remove_abstract($text) { */ function fetch_abstract($text, $addon = "") { $abstract = ""; - $abstracts = array(); + $abstracts = []; $addon = strtolower($addon); if (preg_match_all("/\[abstract=(.*?)\](.*?)\[\/abstract\]/ism",$text, $results, PREG_SET_ORDER)) diff --git a/include/conversation.php b/include/conversation.php index 80ea6a9002..d93b744d91 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -19,7 +19,7 @@ require_once "include/acl_selectors.php"; function item_extract_images($body) { - $saved_image = array(); + $saved_image = []; $orig_body = $body; $new_body = ''; @@ -57,7 +57,7 @@ function item_extract_images($body) { $new_body = $new_body . $orig_body; - return array('body' => $new_body, 'images' => $saved_image); + return ['body' => $new_body, 'images' => $saved_image]; } function item_redir_and_replace_images($body, $images, $cid) { @@ -145,7 +145,7 @@ function localize_item(&$item) { default: if ($obj['resource-id']) { $post_type = t('photo'); - $m = array(); + $m = []; preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); $rr['plink'] = $m[1]; } else { @@ -283,7 +283,7 @@ function localize_item(&$item) { default: if ($obj['resource-id']) { $post_type = t('photo'); - $m=array(); preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); + $m=[]; preg_match("/\[url=([^]]*)\]/", $obj['body'], $m); $rr['plink'] = $m[1]; } else { $post_type = t('status'); @@ -382,7 +382,7 @@ function visible_activity($item) { * likes (etc.) can apply to other things besides posts. Check if they are post children, * in which case we handle them specially */ - $hidden_activities = array(ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE); + $hidden_activities = [ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE]; foreach ($hidden_activities as $act) { if (activity_match($item['verb'], $act)) { return false; @@ -595,18 +595,18 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $_SESSION['return_url'] = $a->query_string; } - $cb = array('items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview); + $cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview]; call_hooks('conversation_start',$cb); $items = $cb['items']; - $conv_responses = array( - 'like' => array('title' => t('Likes','title')), 'dislike' => array('title' => t('Dislikes','title')), - 'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title')) - ); + $conv_responses = [ + 'like' => ['title' => t('Likes','title')], 'dislike' => ['title' => t('Dislikes','title')], + 'attendyes' => ['title' => t('Attending','title')], 'attendno' => ['title' => t('Not attending','title')], 'attendmaybe' => ['title' => t('Might attend','title')] + ]; // array with html for each thread (parent+comments) - $threads = array(); + $threads = []; $threadsid = -1; $page_template = get_markup_template("conversation.tpl"); @@ -620,7 +620,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $community_readonly = false; $writable = true; } else { - $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN)); + $writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]); } } else { $writable = false; @@ -673,15 +673,15 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $profile_name = $item['author-link']; } - $tags = array(); - $hashtags = array(); - $mentions = array(); + $tags = []; + $hashtags = []; + $mentions = []; $searchpath = System::baseUrl()."/search?tag="; - $taglist = dba::select('term', array('type', 'term', 'url'), - array("`otype` = ? AND `oid` = ? AND `type` IN (?, ?)", TERM_OBJ_POST, $item['id'], TERM_HASHTAG, TERM_MENTION), - array('order' => array('tid'))); + $taglist = dba::select('term', ['type', 'term', 'url'], + ["`otype` = ? AND `oid` = ? AND `type` IN (?, ?)", TERM_OBJ_POST, $item['id'], TERM_HASHTAG, TERM_MENTION], + ['order' => ['tid']]); while ($tag = dba::fetch($taglist)) { if ($tag["url"] == "") { @@ -731,7 +731,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { } } - $locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => ''); + $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => '']; call_hooks('render_location',$locate); $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate)); @@ -743,12 +743,12 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $dropping = false; } - $drop = array( + $drop = [ 'dropping' => $dropping, 'pagedrop' => $page_dropping, 'select' => t('Select'), 'delete' => t('Delete'), - ); + ]; $star = false; $isstarred = "unstarred"; @@ -773,7 +773,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $item['item_network'] = $item['network']; } - $tmp_item = array( + $tmp_item = [ 'template' => $tpl, 'id' => (($preview) ? 'P0' : $item['item_id']), 'guid' => (($preview) ? 'Q0' : $item['guid']), @@ -814,18 +814,18 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { 'like' => '', 'dislike' => '', 'comment' => '', - 'conv' => (($preview) ? '' : array('href'=> 'display/'.$item['guid'], 'title'=> t('View in context'))), + 'conv' => (($preview) ? '' : ['href'=> 'display/'.$item['guid'], 'title'=> t('View in context')]), 'previewing' => $previewing, 'wait' => t('Please wait'), 'thread_level' => 1, - ); + ]; - $arr = array('item' => $item, 'output' => $tmp_item); + $arr = ['item' => $item, 'output' => $tmp_item]; call_hooks('display_item', $arr); $threads[$threadsid]['id'] = $item['item_id']; $threads[$threadsid]['network'] = $item['item_network']; - $threads[$threadsid]['items'] = array($arr['output']); + $threads[$threadsid]['items'] = [$arr['output']]; } } else { @@ -878,12 +878,12 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { $threads = $conv->getTemplateData($conv_responses); if (!$threads) { logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG); - $threads = array(); + $threads = []; } } } - $o = replace_macros($page_template, array( + $o = replace_macros($page_template, [ '$baseurl' => System::baseUrl($ssl_state), '$return_path' => $a->query_string, '$live_update' => $live_update_div, @@ -892,7 +892,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { '$user' => $a->user, '$threads' => $threads, '$dropping' => ($page_dropping && Feature::isEnabled(local_user(), 'multi_delete') ? t('Delete Selected Items') : False), - )); + ]); return $o; } @@ -910,7 +910,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) { function community_add_items($parents) { $max_comments = Config::get("system", "max_comments", 100); - $items = array(); + $items = []; foreach ($parents AS $parent) { $thread_items = dba::p(item_query()." AND `item`.`uid` = ? @@ -932,7 +932,7 @@ function community_add_items($parents) { } } if (!$parent_found) { - $comments = array(); + $comments = []; } } @@ -1046,13 +1046,13 @@ function item_photo_menu($item) { $contact_url = 'contacts/' . $cid; $posts_link = 'contacts/' . $cid . '/posts'; - if (in_array($network, array(NETWORK_DFRN, NETWORK_DIASPORA))) { + if (in_array($network, [NETWORK_DFRN, NETWORK_DIASPORA])) { $pm_url = 'message/new/' . $cid; } } if (local_user()) { - $menu = array( + $menu = [ t('Follow Thread') => $sub_link, t('View Status') => $status_link, t('View Profile') => $profile_link, @@ -1060,21 +1060,21 @@ function item_photo_menu($item) { t('Network Posts') => $posts_link, t('View Contact') => $contact_url, t('Send PM') => $pm_url - ); + ]; if ($network == NETWORK_DFRN) { $menu[t("Poke")] = $poke_link; } if ((($cid == 0) || ($rel == CONTACT_IS_FOLLOWER)) && - in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) { + in_array($item['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])) { $menu[t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']); } } else { - $menu = array(t('View Profile') => $item['author-link']); + $menu = [t('View Profile') => $item['author-link']]; } - $args = array('item' => $item, 'menu' => $menu); + $args = ['item' => $item, 'menu' => $menu]; call_hooks('item_photo_menu', $args); @@ -1142,7 +1142,7 @@ function builtin_activity_puller($item, &$conv_responses) { if (! ((isset($conv_responses[$mode][$item['thr-parent'] . '-l'])) && (is_array($conv_responses[$mode][$item['thr-parent'] . '-l'])))) { - $conv_responses[$mode][$item['thr-parent'] . '-l'] = array(); + $conv_responses[$mode][$item['thr-parent'] . '-l'] = []; } // only list each unique author once @@ -1250,11 +1250,11 @@ function format_like($cnt, array $arr, $type, $id) { } $phrase .= EOL ; - $o .= replace_macros(get_markup_template('voting_fakelink.tpl'), array( + $o .= replace_macros(get_markup_template('voting_fakelink.tpl'), [ '$phrase' => $phrase, '$type' => $type, '$id' => $id - )); + ]); $o .= $expanded; return $o; @@ -1264,10 +1264,10 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) { $o = ''; - $geotag = x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : ''; + $geotag = x($x, 'allow_location') ? replace_macros(get_markup_template('jot_geotag.tpl'), []) : ''; $tpl = get_markup_template('jot-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, array( + $a->page['htmlhead'] .= replace_macros($tpl, [ '$newpost' => 'true', '$baseurl' => System::baseUrl(true), '$geotag' => $geotag, @@ -1280,10 +1280,10 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) '$fileas' => t('Save to Folder:'), '$whereareu' => t('Where are you right now?'), '$delitems' => t('Delete item(s)?') - )); + ]); $tpl = get_markup_template('jot-end.tpl'); - $a->page['end'] .= replace_macros($tpl, array( + $a->page['end'] .= replace_macros($tpl, [ '$newpost' => 'true', '$baseurl' => System::baseUrl(true), '$geotag' => $geotag, @@ -1295,7 +1295,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) '$term' => t('Tag term:'), '$fileas' => t('Save to Folder:'), '$whereareu' => t('Where are you right now?') - )); + ]); $jotplugins = ''; call_hooks('jot_tool', $jotplugins); @@ -1308,7 +1308,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) $query_str = $a->query_string; if (strpos($query_str, 'public=1') !== false) { - $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str); + $query_str = str_replace(['?public=1', '&public=1'], ['', ''], $query_str); } /* @@ -1325,7 +1325,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) // $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); $tpl = get_markup_template("jot.tpl"); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$return_path' => $query_str, '$action' => 'item', '$share' => defaults($x, 'button', t('Share')), @@ -1379,7 +1379,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false) //jot nav tab (used in some themes) '$message' => t('Message'), '$browser' => t('Browser'), - )); + ]); if ($popup == true) { @@ -1636,9 +1636,9 @@ function render_location_dummy($item) { /// @TODO Add type-hint function get_responses($conv_responses, $response_verbs, $ob, $item) { - $ret = array(); + $ret = []; foreach ($response_verbs as $v) { - $ret[$v] = array(); + $ret[$v] = []; $ret[$v]['count'] = defaults($conv_responses[$v], $item['uri'], ''); $ret[$v]['list'] = defaults($conv_responses[$v], $item['uri'] . '-l', ''); $ret[$v]['self'] = defaults($conv_responses[$v], $item['uri'] . '-self', '0'); diff --git a/include/datetime.php b/include/datetime.php index 1c9510c330..0faea8c90e 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -102,9 +102,9 @@ function field_timezone($name='timezone', $label='', $current = 'America/Los_Ang $options = str_replace('','', $options); $tpl = get_markup_template('field_select_raw.tpl'); - return replace_macros($tpl, array( - '$field' => array($name, $label, $current, $help, $options), - )); + return replace_macros($tpl, [ + '$field' => [$name, $label, $current, $help, $options], + ]); } @@ -189,16 +189,16 @@ function dob($dob) $age = ((intval($value)) ? age($value, $a->user["timezone"], $a->user["timezone"]) : ""); - $o = replace_macros(get_markup_template("field_input.tpl"), array( - '$field' => array( + $o = replace_macros(get_markup_template("field_input.tpl"), [ + '$field' => [ 'dob', t('Birthday:'), $value, (((intval($age)) > 0 ) ? t('Age: ') . $age : ""), '', 'placeholder="' . t('YYYY-MM-DD or MM-DD') . '"' - ) - )); + ] + ]); /// @TODO Old-lost code? // if ($dob && $dob > '0001-01-01') @@ -279,7 +279,7 @@ function datetimesel($min, $max, $default, $label, $id = 'datetimepicker', $pick $lang = substr(get_browser_language(), 0, 2); // Check if the detected language is supported by the picker - if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"))) { + if (!in_array($lang, ["ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"])) { $lang = Config::get('system', 'language', 'en'); } @@ -327,9 +327,9 @@ function datetimesel($min, $max, $default, $label, $id = 'datetimepicker', $pick $readable_format = str_replace('i','MM',$readable_format); $tpl = get_markup_template('field_input.tpl'); - $o .= replace_macros($tpl, array( - '$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'), - )); + $o .= replace_macros($tpl, [ + '$field' => [$id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'], + ]); $o .= ""; } else { diff --git a/mod/cal.php b/mod/cal.php index 31ab5976b5..de00feadd2 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -51,13 +51,13 @@ function cal_init(App $a) $tpl = get_markup_template("vcard-widget.tpl"); - $vcard_widget = replace_macros($tpl, array( + $vcard_widget = replace_macros($tpl, [ '$name' => $profile['name'], '$photo' => $profile['photo'], '$addr' => (($profile['addr'] != "") ? $profile['addr'] : ""), '$account_type' => $account_type, '$pdesc' => (($profile['pdesc'] != "") ? $profile['pdesc'] : ""), - )); + ]); $cal_widget = widget_events(); @@ -80,17 +80,17 @@ function cal_content(App $a) $i18n = get_event_strings(); $htpl = get_markup_template('event_head.tpl'); - $a->page['htmlhead'] .= replace_macros($htpl, array( + $a->page['htmlhead'] .= replace_macros($htpl, [ '$baseurl' => System::baseUrl(), '$module_url' => '/cal/' . $a->data['user']['nickname'], '$modparams' => 2, '$i18n' => $i18n, - )); + ]); $etpl = get_markup_template('event_end.tpl'); - $a->page['end'] .= replace_macros($etpl, array( + $a->page['end'] .= replace_macros($etpl, [ '$baseurl' => System::baseUrl(), - )); + ]); $mode = 'view'; $y = 0; @@ -206,14 +206,14 @@ function cal_content(App $a) $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); // put the event parametes in an array so we can better transmit them - $event_params = array( + $event_params = [ 'event_id' => (x($_GET, 'id') ? $_GET["id"] : 0), 'start' => $start, 'finish' => $finish, 'adjust_start' => $adjust_start, 'adjust_finish' => $adjust_finish, 'ignored' => $ignored, - ); + ]; // get events by id or by date if (x($_GET, 'id')) { @@ -222,7 +222,7 @@ function cal_content(App $a) $r = events_by_date($owner_uid, $event_params, $sql_extra); } - $links = array(); + $links = []; if (DBM::is_result($r)) { $r = sort_by_date($r); @@ -255,7 +255,7 @@ function cal_content(App $a) // Get rid of dashes in key names, Smarty3 can't handle them foreach ($events as $key => $event) { - $event_item = array(); + $event_item = []; foreach ($event['item'] as $k => $v) { $k = str_replace('-', '_', $k); $event_item[$k] = $v; @@ -263,13 +263,13 @@ function cal_content(App $a) $events[$key]['item'] = $event_item; } - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$baseurl' => System::baseUrl(), '$tabs' => $tabs, '$title' => t('Events'), '$view' => t('View'), - '$previous' => array(System::baseUrl() . "/events/$prevyear/$prevmonth", t('Previous'), '', ''), - '$next' => array(System::baseUrl() . "/events/$nextyear/$nextmonth", t('Next'), '', ''), + '$previous' => [System::baseUrl() . "/events/$prevyear/$prevmonth", t('Previous'), '', ''], + '$next' => [System::baseUrl() . "/events/$nextyear/$nextmonth", t('Next'), '', ''], '$calendar' => cal($y, $m, $links, ' eventcal'), '$events' => $events, "today" => t("today"), @@ -277,7 +277,7 @@ function cal_content(App $a) "week" => t("week"), "day" => t("day"), "list" => t("list"), - )); + ]); if (x($_GET, 'id')) { echo $o; diff --git a/mod/common.php b/mod/common.php index cfeb531f76..c4f236fad6 100644 --- a/mod/common.php +++ b/mod/common.php @@ -46,12 +46,12 @@ function common_content(App $a) $contact = dba::selectFirst('contact', ['name', 'url', 'photo'], ['self' => true, 'uid' => $uid]); if (DBM::is_result($contact)) { - $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), array( + $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [ '$name' => htmlentities($contact['name']), '$photo' => $contact['photo'], 'url' => 'contacts/' . $cid - )); - + ]); + if (!x($a->page, 'aside')) { $a->page['aside'] = ''; } @@ -115,7 +115,7 @@ function common_content(App $a) $photo_menu = Contact::photoMenu($rr); - $entry = array( + $entry = [ 'url' => $rr['url'], 'itemurl' => defaults($contact_details, 'addr', $rr['url']), 'name' => $contact_details['name'], @@ -128,7 +128,7 @@ function common_content(App $a) 'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']), 'photo_menu' => $photo_menu, 'id' => ++$id, - ); + ]; $entries[] = $entry; } @@ -142,12 +142,12 @@ function common_content(App $a) $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$title' => $title, '$tab_str' => $tab_str, '$contacts' => $entries, '$paginate' => paginate($a), - )); + ]); return $o; } diff --git a/mod/community.php b/mod/community.php index 4b755e18ce..cfd2087d97 100644 --- a/mod/community.php +++ b/mod/community.php @@ -67,35 +67,35 @@ function community_content(App $a, $update = 0) $tabs = []; if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(Config::get('system','singleuser'))) { - $tabs[] = array( + $tabs[] = [ 'label' => t('Community'), 'url' => 'community/local', 'sel' => $content == 'local' ? 'active' : '', 'title' => t('Posts from local users on this server'), 'id' => 'community-local-tab', 'accesskey' => 'l' - ); + ]; } if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) { - $tabs[] = array( + $tabs[] = [ 'label' => t('Global Timeline'), 'url' => 'community/global', 'sel' => $content == 'global' ? 'active' : '', 'title' => t('Posts from users of the federated network'), 'id' => 'community-global-tab', 'accesskey' => 'g' - ); + ]; } $tab_tpl = get_markup_template('common_tabs.tpl'); - $o .= replace_macros($tab_tpl, array('$tabs' => $tabs)); + $o .= replace_macros($tab_tpl, ['$tabs' => $tabs]); nav_set_selected('community'); // We need the editor here to be able to reshare an item. if (local_user()) { - $x = array( + $x = [ 'is_owner' => true, 'allow_location' => $a->user['allow_location'], 'default_location' => $a->user['default-location'], @@ -105,7 +105,7 @@ function community_content(App $a, $update = 0) 'bang' => '', 'visitor' => 'block', 'profile_uid' => local_user(), - ); + ]; $o .= status_editor($a, $x, 0, true); } } @@ -141,7 +141,7 @@ function community_content(App $a, $update = 0) $count = 1; $previousauthor = ""; $numposts = 0; - $s = array(); + $s = []; do { foreach ($r as $item) { @@ -171,12 +171,12 @@ function community_content(App $a, $update = 0) } $t = get_markup_template("community.tpl"); - return replace_macros($t, array( + return replace_macros($t, [ '$content' => $o, '$header' => '', '$show_global_community_hint' => ($content == 'global') && Config::get('system', 'show_global_community_hint'), '$global_community_hint' => t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.") - )); + ]); } function community_getitems($start, $itemspage, $content) @@ -204,5 +204,5 @@ function community_getitems($start, $itemspage, $content) } // Should never happen - return array(); + return []; } diff --git a/mod/contactgroup.php b/mod/contactgroup.php index 13f8b492b5..388725c006 100644 --- a/mod/contactgroup.php +++ b/mod/contactgroup.php @@ -33,7 +33,7 @@ function contactgroup_content(App $a) $group = $r[0]; $members = Contact::getByGroupId($group['id']); - $preselected = array(); + $preselected = []; if (count($members)) { foreach ($members as $member) { $preselected[] = $member['id']; diff --git a/mod/contacts.php b/mod/contacts.php index 7089cf05a5..ae0edb3cce 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -48,7 +48,7 @@ function contacts_init(App $a) } /// @TODO Add nice spaces - $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), array( + $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [ '$name' => htmlentities($a->data['contact']['name']), '$photo' => $a->data['contact']['photo'], '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? "redir/" . $a->data['contact']['id'] : $a->data['contact']['url'], @@ -56,7 +56,7 @@ function contacts_init(App $a) '$network_name' => $networkname, '$network' => t('Network:'), '$account_type' => Contact::getAccountType($a->data['contact']) - )); + ]); $findpeople_widget = ''; $follow_widget = ''; @@ -75,26 +75,26 @@ function contacts_init(App $a) $groups_widget = Group::sidebarWidget('contacts', 'group', 'full', 0, $contact_id); - $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"), array( + $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"), [ '$vcard_widget' => $vcard_widget, '$findpeople_widget' => $findpeople_widget, '$follow_widget' => $follow_widget, '$groups_widget' => $groups_widget, '$networks_widget' => $networks_widget - )); + ]); $base = System::baseUrl(); $tpl = get_markup_template("contacts-head.tpl"); - $a->page['htmlhead'] .= replace_macros($tpl, array( + $a->page['htmlhead'] .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base - )); + ]); $tpl = get_markup_template("contacts-end.tpl"); - $a->page['end'] .= replace_macros($tpl, array( + $a->page['end'] .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base - )); + ]); } function contacts_batch_actions(App $a) @@ -259,13 +259,13 @@ function _contact_update_profile($contact_id) $data = Probe::uri($contact["url"], "", 0, false); // "Feed" or "Unknown" is mostly a sign of communication problems - if ((in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) && ($data["network"] != $contact["network"])) { + if ((in_array($data["network"], [NETWORK_FEED, NETWORK_PHANTOM])) && ($data["network"] != $contact["network"])) { return; } - $updatefields = array("name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm", - "poco", "network", "alias"); - $update = array(); + $updatefields = ["name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm", + "poco", "network", "alias"]; + $update = []; if ($data["network"] == NETWORK_OSTATUS) { $result = Contact::createFromProbe($uid, $data["url"], false); @@ -442,17 +442,17 @@ function contacts_content(App $a) //
can't take arguments in its "action" parameter // so add any arguments as hidden inputs $query = explode_querystring($a->query_string); - $inputs = array(); + $inputs = []; foreach ($query['args'] as $arg) { if (strpos($arg, 'confirm=') === false) { $arg_parts = explode('=', $arg); - $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]); + $inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]]; } } $a->page['aside'] = ''; - return replace_macros(get_markup_template('contact_drop_confirm.tpl'), array( + return replace_macros(get_markup_template('contact_drop_confirm.tpl'), [ '$header' => t('Drop contact'), '$contact' => _contact_detail_for_template($orig_record), '$method' => 'get', @@ -462,7 +462,7 @@ function contacts_content(App $a) '$confirm_url' => $query['base'], '$confirm_name' => 'confirmed', '$cancel' => t('Cancel'), - )); + ]); } // Now check how the user responded to the confirmation query if (x($_REQUEST, 'canceled')) { @@ -493,12 +493,12 @@ function contacts_content(App $a) $contact_id = $a->data['contact']['id']; $contact = $a->data['contact']; - $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array( + $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), [ '$baseurl' => System::baseUrl(true), - )); - $a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), array( + ]); + $a->page['end'] .= replace_macros(get_markup_template('contact_end.tpl'), [ '$baseurl' => System::baseUrl(true), - )); + ]); $dir_icon = ''; $relation_text = ''; @@ -519,7 +519,7 @@ function contacts_content(App $a) break; } - if (!in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) { + if (!in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])) { $relation_text = ""; } @@ -542,7 +542,7 @@ function contacts_content(App $a) } $lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : ''); - $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL)); + $poll_enabled = in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL]); $nettype = t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact["url"])); @@ -553,21 +553,21 @@ function contacts_content(App $a) $fetch_further_information = null; if ($contact['network'] == NETWORK_FEED) { - $fetch_further_information = array( + $fetch_further_information = [ 'fetch_further_information', t('Fetch further information for feeds'), $contact['fetch_further_information'], t("Fetch information like preview pictures, title and teaser from the feed item. You can activate this if the feed doesn't contain much text. Keywords are taken from the meta header in the feed item and are posted as hash tags."), - array('0' => t('Disabled'), + ['0' => t('Disabled'), '1' => t('Fetch information'), '3' => t('Fetch keywords'), '2' => t('Fetch information and keywords') - ) - ); + ] + ]; } $poll_interval = null; - if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL))) { + if (in_array($contact['network'], [NETWORK_FEED, NETWORK_MAIL])) { $poll_interval = ContactSelector::pollInterval($contact['priority'], (!$poll_enabled)); } @@ -578,7 +578,7 @@ function contacts_content(App $a) $follow = ''; $follow_text = ''; - if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS))) { + if (in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS])) { if ($contact['rel'] == CONTACT_IS_FOLLOWER) { $follow = System::baseUrl(true) . "/follow?url=" . urlencode($contact["url"]); $follow_text = t("Connect/Follow"); @@ -592,7 +592,7 @@ function contacts_content(App $a) $contact_actions = contact_actions($contact); $tpl = get_markup_template("contact_edit.tpl"); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$header' => t("Contact"), '$tab_str' => $tab_str, '$submit' => t('Submit'), @@ -626,16 +626,16 @@ function contacts_content(App $a) '$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), '$insecure' => (($contact['network'] !== NETWORK_DFRN && $contact['network'] !== NETWORK_MAIL && $contact['network'] !== NETWORK_FACEBOOK && $contact['network'] !== NETWORK_DIASPORA) ? $insecure : ''), '$info' => $contact['info'], - '$cinfo' => array('info', '', $contact['info'], ''), + '$cinfo' => ['info', '', $contact['info'], ''], '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''), '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''), '$archived' => (($contact['archive']) ? t('Currently archived') : ''), '$pending' => (($contact['pending']) ? t('Awaiting connection acknowledge') : ''), - '$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts may still be visible')), - '$notify' => array('notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')), + '$hidden' => ['hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts may still be visible')], + '$notify' => ['notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')], '$fetch_further_information' => $fetch_further_information, '$ffi_keyword_blacklist' => $contact['ffi_keyword_blacklist'], - '$ffi_keyword_blacklist' => array('ffi_keyword_blacklist', t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')), + '$ffi_keyword_blacklist' => ['ffi_keyword_blacklist', t('Blacklisted keywords'), $contact['ffi_keyword_blacklist'], t('Comma separated list of keywords that should not be converted to hashtags, when "Fetch information and keywords" is selected')], '$photo' => $contact['photo'], '$name' => htmlentities($contact['name']), '$dir_icon' => $dir_icon, @@ -657,9 +657,9 @@ function contacts_content(App $a) '$contact_status' => t("Status"), '$contact_settings_label' => t('Contact Settings'), '$contact_profile_label' => t("Profile"), - )); + ]); - $arr = array('contact' => $contact, 'output' => $o); + $arr = ['contact' => $contact, 'output' => $o]; call_hooks('contact_edit', $arr); @@ -694,67 +694,67 @@ function contacts_content(App $a) $search = x($_GET, 'search') ? notags(trim($_GET['search'])) : ''; $nets = x($_GET, 'nets' ) ? notags(trim($_GET['nets'])) : ''; - $tabs = array( - array( + $tabs = [ + [ 'label' => t('Suggestions'), 'url' => 'suggest', 'sel' => '', 'title' => t('Suggest potential friends'), 'id' => 'suggestions-tab', 'accesskey' => 'g', - ), - array( + ], + [ 'label' => t('All Contacts'), 'url' => 'contacts/all', 'sel' => ($all) ? 'active' : '', 'title' => t('Show all contacts'), 'id' => 'showall-tab', 'accesskey' => 'l', - ), - array( + ], + [ 'label' => t('Unblocked'), 'url' => 'contacts', 'sel' => ((!$all) && (!$blocked) && (!$hidden) && (!$search) && (!$nets) && (!$ignored) && (!$archived)) ? 'active' : '', 'title' => t('Only show unblocked contacts'), 'id' => 'showunblocked-tab', 'accesskey' => 'o', - ), - array( + ], + [ 'label' => t('Blocked'), 'url' => 'contacts/blocked', 'sel' => ($blocked) ? 'active' : '', 'title' => t('Only show blocked contacts'), 'id' => 'showblocked-tab', 'accesskey' => 'b', - ), - array( + ], + [ 'label' => t('Ignored'), 'url' => 'contacts/ignored', 'sel' => ($ignored) ? 'active' : '', 'title' => t('Only show ignored contacts'), 'id' => 'showignored-tab', 'accesskey' => 'i', - ), - array( + ], + [ 'label' => t('Archived'), 'url' => 'contacts/archived', 'sel' => ($archived) ? 'active' : '', 'title' => t('Only show archived contacts'), 'id' => 'showarchived-tab', 'accesskey' => 'y', - ), - array( + ], + [ 'label' => t('Hidden'), 'url' => 'contacts/hidden', 'sel' => ($hidden) ? 'active' : '', 'title' => t('Only show hidden contacts'), 'id' => 'showhidden-tab', 'accesskey' => 'h', - ), - ); + ], + ]; $tab_tpl = get_markup_template('common_tabs.tpl'); - $t = replace_macros($tab_tpl, array('$tabs' => $tabs)); + $t = replace_macros($tab_tpl, ['$tabs' => $tabs]); $total = 0; $searching = false; @@ -783,7 +783,7 @@ function contacts_content(App $a) $sql_extra3 = Widget::unavailableNetworks(); - $contacts = array(); + $contacts = []; $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT %d , %d ", intval($_SESSION['uid']), @@ -797,7 +797,7 @@ function contacts_content(App $a) } $tpl = get_markup_template("contacts-template.tpl"); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(), '$header' => t('Contacts') . (($nets) ? ' - ' . ContactSelector::networkToName($nets) : ''), '$tabs' => $t, @@ -810,16 +810,16 @@ function contacts_content(App $a) '$contacts' => $contacts, '$contact_drop_confirm' => t('Do you really want to delete this contact?'), 'multiselect' => 1, - '$batch_actions' => array( + '$batch_actions' => [ 'contacts_batch_update' => t('Update'), 'contacts_batch_block' => t('Block') . "/" . t("Unblock"), "contacts_batch_ignore" => t('Ignore') . "/" . t("Unignore"), "contacts_batch_archive" => t('Archive') . "/" . t("Unarchive"), "contacts_batch_drop" => t('Delete'), - ), + ], '$h_batch_actions' => t('Batch Actions'), '$paginate' => paginate($a), - )); + ]); return $o; } @@ -838,58 +838,58 @@ function contacts_content(App $a) function contacts_tab($a, $contact_id, $active_tab) { // tabs - $tabs = array( - array( + $tabs = [ + [ 'label' => t('Status'), 'url' => "contacts/" . $contact_id . "/posts", 'sel' => (($active_tab == 1) ? 'active' : ''), 'title' => t('Status Messages and Posts'), 'id' => 'status-tab', 'accesskey' => 'm', - ), - array( + ], + [ 'label' => t('Profile'), 'url' => "contacts/" . $contact_id, 'sel' => (($active_tab == 2) ? 'active' : ''), 'title' => t('Profile Details'), 'id' => 'profile-tab', 'accesskey' => 'o', - ) - ); + ] + ]; // Show this tab only if there is visible friend list $x = GContact::countAllFriends(local_user(), $contact_id); if ($x) { - $tabs[] = array('label' => t('Contacts'), + $tabs[] = ['label' => t('Contacts'), 'url' => "allfriends/" . $contact_id, 'sel' => (($active_tab == 3) ? 'active' : ''), 'title' => t('View all contacts'), 'id' => 'allfriends-tab', - 'accesskey' => 't'); + 'accesskey' => 't']; } // Show this tab only if there is visible common friend list $common = GContact::countCommonFriends(local_user(), $contact_id); if ($common) { - $tabs[] = array('label' => t('Common Friends'), + $tabs[] = ['label' => t('Common Friends'), 'url' => "common/loc/" . local_user() . "/" . $contact_id, 'sel' => (($active_tab == 4) ? 'active' : ''), 'title' => t('View all common friends'), 'id' => 'common-loc-tab', 'accesskey' => 'd' - ); + ]; } - $tabs[] = array('label' => t('Advanced'), + $tabs[] = ['label' => t('Advanced'), 'url' => 'crepair/' . $contact_id, 'sel' => (($active_tab == 5) ? 'active' : ''), 'title' => t('Advanced Contact Settings'), 'id' => 'advanced-tab', 'accesskey' => 'r' - ); + ]; $tab_tpl = get_markup_template('common_tabs.tpl'); - $tab_str = replace_macros($tab_tpl, array('$tabs' => $tabs)); + $tab_str = replace_macros($tab_tpl, ['$tabs' => $tabs]); return $tab_str; } @@ -936,7 +936,7 @@ function _contact_detail_for_template($rr) $sparkle = ''; } - return array( + return [ 'img_hover' => t('Visit %s\'s profile [%s]', $rr['name'], $rr['url']), 'edit_hover' => t('Edit contact'), 'photo_menu' => Contact::photoMenu($rr), @@ -951,7 +951,7 @@ function _contact_detail_for_template($rr) 'itemurl' => (($rr['addr'] != "") ? $rr['addr'] : $rr['url']), 'url' => $url, 'network' => ContactSelector::networkToName($rr['network'], $rr['url']), - ); + ]; } /** @@ -964,61 +964,61 @@ function _contact_detail_for_template($rr) */ function contact_actions($contact) { - $poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL)); - $contact_actions = array(); + $poll_enabled = in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL]); + $contact_actions = []; // Provide friend suggestion only for Friendica contacts if ($contact['network'] === NETWORK_DFRN) { - $contact_actions['suggest'] = array( + $contact_actions['suggest'] = [ 'label' => t('Suggest friends'), 'url' => 'fsuggest/' . $contact['id'], 'title' => '', 'sel' => '', 'id' => 'suggest', - ); + ]; } if ($poll_enabled) { - $contact_actions['update'] = array( + $contact_actions['update'] = [ 'label' => t('Update now'), 'url' => 'contacts/' . $contact['id'] . '/update', 'title' => '', 'sel' => '', 'id' => 'update', - ); + ]; } - $contact_actions['block'] = array( + $contact_actions['block'] = [ 'label' => (intval($contact['blocked']) ? t('Unblock') : t('Block') ), 'url' => 'contacts/' . $contact['id'] . '/block', 'title' => t('Toggle Blocked status'), 'sel' => (intval($contact['blocked']) ? 'active' : ''), 'id' => 'toggle-block', - ); + ]; - $contact_actions['ignore'] = array( + $contact_actions['ignore'] = [ 'label' => (intval($contact['readonly']) ? t('Unignore') : t('Ignore') ), 'url' => 'contacts/' . $contact['id'] . '/ignore', 'title' => t('Toggle Ignored status'), 'sel' => (intval($contact['readonly']) ? 'active' : ''), 'id' => 'toggle-ignore', - ); + ]; - $contact_actions['archive'] = array( + $contact_actions['archive'] = [ 'label' => (intval($contact['archive']) ? t('Unarchive') : t('Archive') ), 'url' => 'contacts/' . $contact['id'] . '/archive', 'title' => t('Toggle Archive status'), 'sel' => (intval($contact['archive']) ? 'active' : ''), 'id' => 'toggle-archive', - ); + ]; - $contact_actions['delete'] = array( + $contact_actions['delete'] = [ 'label' => t('Delete'), 'url' => 'contacts/' . $contact['id'] . '/drop', 'title' => t('Delete contact'), 'sel' => '', 'id' => 'delete', - ); + ]; return $contact_actions; } diff --git a/mod/crepair.php b/mod/crepair.php index cfe0e3e286..57796c44d1 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -120,22 +120,22 @@ function crepair_content(App $a) // Disable remote self for everything except feeds. // There is an issue when you repeat an item from maybe twitter and you got comments from friendica and twitter // Problem is, you couldn't reply to both networks. - if (!in_array($contact['network'], array(NETWORK_FEED, NETWORK_DFRN, NETWORK_DIASPORA))) { + if (!in_array($contact['network'], [NETWORK_FEED, NETWORK_DFRN, NETWORK_DIASPORA])) { $allow_remote_self = false; } if ($contact['network'] == NETWORK_FEED) { - $remote_self_options = array('0' => t('No mirroring'), '1' => t('Mirror as forwarded posting'), '2' => t('Mirror as my own posting')); + $remote_self_options = ['0' => t('No mirroring'), '1' => t('Mirror as forwarded posting'), '2' => t('Mirror as my own posting')]; } else { - $remote_self_options = array('0' => t('No mirroring'), '2' => t('Mirror as my own posting')); + $remote_self_options = ['0' => t('No mirroring'), '2' => t('Mirror as my own posting')]; } - $update_profile = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)); + $update_profile = in_array($contact['network'], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]); $tab_str = contacts_tab($a, $contact['id'], 5); $tpl = get_markup_template('crepair.tpl'); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$tab_str' => $tab_str, '$warning' => $warning, '$info' => $info, @@ -147,23 +147,23 @@ function crepair_content(App $a) '$lbl_submit' => t('Submit'), '$label_remote_self' => t('Remote Self'), '$allow_remote_self' => $allow_remote_self, - '$remote_self' => array('remote_self', + '$remote_self' => ['remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), $remote_self_options - ), - - '$name' => array('name', t('Name') , htmlentities($contact['name'])), - '$nick' => array('nick', t('Account Nickname'), htmlentities($contact['nick'])), - '$attag' => array('attag', t('@Tagname - overrides Name/Nickname'), $contact['attag']), - '$url' => array('url', t('Account URL'), $contact['url']), - '$request' => array('request', t('Friend Request URL'), $contact['request']), - 'confirm' => array('confirm', t('Friend Confirm URL'), $contact['confirm']), - 'notify' => array('notify', t('Notification Endpoint URL'), $contact['notify']), - 'poll' => array('poll', t('Poll/Feed URL'), $contact['poll']), - 'photo' => array('photo', t('New photo from this URL'), ''), - )); + ], + + '$name' => ['name', t('Name') , htmlentities($contact['name'])], + '$nick' => ['nick', t('Account Nickname'), htmlentities($contact['nick'])], + '$attag' => ['attag', t('@Tagname - overrides Name/Nickname'), $contact['attag']], + '$url' => ['url', t('Account URL'), $contact['url']], + '$request' => ['request', t('Friend Request URL'), $contact['request']], + 'confirm' => ['confirm', t('Friend Confirm URL'), $contact['confirm']], + 'notify' => ['notify', t('Notification Endpoint URL'), $contact['notify']], + 'poll' => ['poll', t('Poll/Feed URL'), $contact['poll']], + 'photo' => ['photo', t('New photo from this URL'), ''], + ]); return $o; } diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 6c494128b1..95e2bb0c77 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -107,10 +107,10 @@ function dfrn_poll_init(App $a) if ((int) $xml->status === 1) { $_SESSION['authenticated'] = 1; if (!x($_SESSION, 'remote')) { - $_SESSION['remote'] = array(); + $_SESSION['remote'] = []; } - $_SESSION['remote'][] = array('cid' => $r[0]['id'], 'uid' => $r[0]['uid'], 'url' => $r[0]['url']); + $_SESSION['remote'][] = ['cid' => $r[0]['id'], 'uid' => $r[0]['uid'], 'url' => $r[0]['url']]; $_SESSION['visitor_id'] = $r[0]['id']; $_SESSION['visitor_home'] = $r[0]['url']; @@ -488,13 +488,13 @@ function dfrn_poll_content(App $a) . '&sec=' . $sec ); } else { - $s = post_url($r[0]['poll'], array( + $s = post_url($r[0]['poll'], [ 'dfrn_id' => $encrypted_id, 'type' => 'profile-check', 'dfrn_version' => DFRN_PROTOCOL_VERSION, 'challenge' => $challenge, 'sec' => $sec - )); + ]); } $profile = ((DBM::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname); @@ -529,10 +529,10 @@ function dfrn_poll_content(App $a) if (((int) $xml->status == 0) && ($xml->challenge == $hash) && ($xml->sec == $sec)) { $_SESSION['authenticated'] = 1; if (!x($_SESSION, 'remote')) { - $_SESSION['remote'] = array(); + $_SESSION['remote'] = []; } - $_SESSION['remote'][] = array('cid' => $r[0]['id'], 'uid' => $r[0]['uid'], 'url' => $r[0]['url']); + $_SESSION['remote'][] = ['cid' => $r[0]['id'], 'uid' => $r[0]['uid'], 'url' => $r[0]['url']]; $_SESSION['visitor_id'] = $r[0]['id']; $_SESSION['visitor_home'] = $r[0]['url']; $_SESSION['visitor_visiting'] = $r[0]['uid']; diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index d42e649bf6..a5f18e07a3 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -316,7 +316,7 @@ function dfrn_request_post(App $a) return; } else { $contact_record = $ret[0]; - $parms = array('dfrn-request' => $ret[0]['request']); + $parms = ['dfrn-request' => $ret[0]['request']]; } } @@ -517,7 +517,7 @@ function dfrn_request_content(App $a) } $tpl = get_markup_template("dfrn_req_confirm.tpl"); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$dfrn_url' => $dfrn_url, '$aes_allow' => (($aes_allow) ? '' : "" ), '$hidethem' => t('Hide this contact'), @@ -529,7 +529,7 @@ function dfrn_request_content(App $a) '$uid' => $_SESSION['uid'], '$nickname' => $a->user['nickname'], 'dfrn_rawurl' => $_GET['dfrn_url'] - )); + ]); return $o; } elseif ((x($_GET, 'confirm_key')) && strlen($_GET['confirm_key'])) { // we are the requestee and it is now safe to send our user their introduction, @@ -553,7 +553,7 @@ function dfrn_request_content(App $a) } if (!$auto_confirm) { - notification(array( + notification([ 'type' => NOTIFY_INTRO, 'notify_flags' => $r[0]['notify-flags'], 'language' => $r[0]['language'], @@ -566,19 +566,19 @@ function dfrn_request_content(App $a) 'source_photo' => $r[0]['photo'], 'verb' => ACTIVITY_REQ_FRIEND, 'otype' => 'intro' - )); + ]); } if ($auto_confirm) { require_once 'mod/dfrn_confirm.php'; - $handsfree = array( + $handsfree = [ 'uid' => $r[0]['uid'], 'node' => $r[0]['nickname'], 'dfrn_id' => $r[0]['issued-id'], 'intro_id' => $intro[0]['id'], 'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0), 'activity' => intval(PConfig::get($r[0]['uid'], 'system', 'post_newfriend')) - ); + ]; dfrn_confirm_post($a, $handsfree); } } @@ -642,11 +642,11 @@ function dfrn_request_content(App $a) get_server() ); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$header' => t('Friend/Connection Request'), '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@gnusocial.de'), '$pls_answer' => t('Please answer the following:'), - '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'), $a->profile['name']), false, '', array(t('No'), t('Yes'))), + '$does_know_you' => ['knowyou', sprintf(t('Does %s know you?'), $a->profile['name']), false, '', [t('No'), t('Yes')]], '$add_note' => t('Add a personal note:'), '$page_desc' => $page_desc, '$friendica' => t('Friendica'), @@ -660,7 +660,7 @@ function dfrn_request_content(App $a) '$nickname' => $a->argv[1], '$name' => $a->profile['name'], '$myaddr' => $myaddr - )); + ]); return $o; } diff --git a/mod/directory.php b/mod/directory.php index a711f72314..59a3195b1b 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -146,11 +146,11 @@ function directory_content(App $a) { $location_e = $location; - $photo_menu = array( - 'profile' => array(t("View Profile"), Profile::zrl($profile_link)) - ); + $photo_menu = [ + 'profile' => [t("View Profile"), Profile::zrl($profile_link)] + ]; - $entry = array( + $entry = [ 'id' => $rr['id'], 'url' => $profile_link, 'itemurl' => $itemurl, @@ -169,9 +169,9 @@ function directory_content(App $a) { 'about' => $about, 'photo_menu' => $photo_menu, - ); + ]; - $arr = array('contact' => $rr, 'entry' => $entry); + $arr = ['contact' => $rr, 'entry' => $entry]; call_hooks('directory_item', $arr); @@ -187,7 +187,7 @@ function directory_content(App $a) { $tpl = get_markup_template('directory_header.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$search' => $search, '$globaldir' => t('Global Directory'), '$gdirpath' => $gdirpath, @@ -198,7 +198,7 @@ function directory_content(App $a) { '$title' => t('Site Directory'), '$submit' => t('Find'), '$paginate' => paginate($a), - )); + ]); } else diff --git a/mod/dirfind.php b/mod/dirfind.php index 9a91d0652c..1b538d813a 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -47,7 +47,7 @@ function dirfind_content(App $a, $prefix = "") { if ((valid_email($search) && validate_email($search)) || (substr(normalise_link($search), 0, 7) == "http://")) { $user_data = Probe::uri($search); - $discover_user = (in_array($user_data["network"], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))); + $discover_user = (in_array($user_data["network"], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])); } } @@ -209,20 +209,20 @@ function dirfind_content(App $a, $prefix = "") { $details = _contact_detail_for_template($contact[0]); $alt_text = $details['alt_text']; } else { - $photo_menu = array(); + $photo_menu = []; } } else { $connlnk = System::baseUrl().'/follow/?url='.(($jj->connect) ? $jj->connect : $jj->url); $conntxt = t('Connect'); - $photo_menu = array( - 'profile' => array(t("View Profile"), Profile::zrl($jj->url)), - 'follow' => array(t("Connect/Follow"), $connlnk) - ); + $photo_menu = [ + 'profile' => [t("View Profile"), Profile::zrl($jj->url)], + 'follow' => [t("Connect/Follow"), $connlnk] + ]; } $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo); - $entry = array( + $entry = [ 'alt_text' => $alt_text, 'url' => Profile::zrl($jj->url), 'itemurl' => $itemurl, @@ -238,17 +238,17 @@ function dirfind_content(App $a, $prefix = "") { 'account_type' => Contact::getAccountType($contact_details), 'network' => ContactSelector::networkToName($jj->network, $jj->url), 'id' => ++$id, - ); + ]; $entries[] = $entry; } $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ 'title' => $header, '$contacts' => $entries, '$paginate' => paginate($a), - )); + ]); } else { info( t('No matches') . EOL); diff --git a/mod/display.php b/mod/display.php index 2bd2b9a5d1..5ae8b6f451 100644 --- a/mod/display.php +++ b/mod/display.php @@ -18,7 +18,7 @@ function display_init(App $a) } $nick = (($a->argc > 1) ? $a->argv[1] : ''); - $profiledata = array(); + $profiledata = []; if ($a->argc == 3) { if (substr($a->argv[2], -5) == '.atom') { @@ -102,7 +102,7 @@ function display_init(App $a) } $profiledata["network"] = NETWORK_DFRN; } else { - $profiledata = array(); + $profiledata = []; } } } @@ -111,7 +111,7 @@ function display_init(App $a) } function display_fetchauthor($a, $item) { - $profiledata = array(); + $profiledata = []; $profiledata["uid"] = -1; $profiledata["nickname"] = $item["author-name"]; $profiledata["name"] = $item["author-name"]; @@ -181,7 +181,7 @@ function display_fetchauthor($a, $item) { $profiledata["photo"] = System::removedBaseUrl($profiledata["photo"]); if (local_user()) { - if (in_array($profiledata["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) { + if (in_array($profiledata["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) { $profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]); } } elseif ($profiledata["network"] == NETWORK_DFRN) { @@ -207,7 +207,7 @@ function display_content(App $a, $update = false, $update_uid = 0) { if ($update) { $item_id = $_REQUEST['item_id']; $item = dba::selectFirst('item', ['uid', 'parent'], ['id' => $item_id]); - $a->profile = array('uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])); + $a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])]; $item_parent = $item['parent']; } else { $item_id = (($a->argc > 2) ? $a->argv[2] : 0); @@ -245,7 +245,7 @@ function display_content(App $a, $update = false, $update_uid = 0) { } // We are displaying an "alternate" link if that post was public. See issue 2864 - $is_public = dba::exists('item', array('id' => $item_id, 'private' => false)); + $is_public = dba::exists('item', ['id' => $item_id, 'private' => false]); if ($is_public) { // For the atom feed the nickname doesn't matter at all, we only need the item id. $alternate = System::baseUrl().'/display/feed-item/'.$item_id.'.atom'; @@ -256,10 +256,10 @@ function display_content(App $a, $update = false, $update_uid = 0) { } $a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), - array('$alternate' => $alternate, - '$conversation' => $conversation)); + ['$alternate' => $alternate, + '$conversation' => $conversation]); - $groups = array(); + $groups = []; $contact = null; $remote_contact = false; @@ -307,7 +307,7 @@ function display_content(App $a, $update = false, $update_uid = 0) { // We need the editor here to be able to reshare an item. if ($is_owner) { - $x = array( + $x = [ 'is_owner' => true, 'allow_location' => $a->user['allow_location'], 'default_location' => $a->user['default-location'], @@ -317,7 +317,7 @@ function display_content(App $a, $update = false, $update_uid = 0) { 'bang' => '', 'visitor' => 'block', 'profile_uid' => local_user(), - ); + ]; $o .= status_editor($a, $x, 0, true); } @@ -351,7 +351,7 @@ function display_content(App $a, $update = false, $update_uid = 0) { if (local_user() && (local_user() == $a->profile['uid'])) { $unseen = dba::selectFirst('item', ['id'], ['parent' => $s[0]['parent'], 'unseen' => true]); if (DBM::is_result($unseen)) { - dba::update('item', array('unseen' => false), array('parent' => $s[0]['parent'], 'unseen' => true)); + dba::update('item', ['unseen' => false], ['parent' => $s[0]['parent'], 'unseen' => true]); } } diff --git a/mod/editpost.php b/mod/editpost.php index a9cdfe9bbb..117cb3fb19 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -36,25 +36,25 @@ function editpost_content(App $a) { return; } - $o .= replace_macros(get_markup_template("section_title.tpl"),array( + $o .= replace_macros(get_markup_template("section_title.tpl"),[ '$title' => t('Edit post') - )); + ]); $tpl = get_markup_template('jot-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, array( + $a->page['htmlhead'] .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(), '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => $geotag, '$nickname' => $a->user['nickname'] - )); + ]); $tpl = get_markup_template('jot-end.tpl'); - $a->page['end'] .= replace_macros($tpl, array( + $a->page['end'] .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(), '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => $geotag, '$nickname' => $a->user['nickname'] - )); + ]); $tpl = get_markup_template("jot.tpl"); @@ -100,7 +100,7 @@ function editpost_content(App $a) { //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins)); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$is_edit' => true, '$return_path' => $_SESSION['return_url'], '$action' => 'item', @@ -150,7 +150,7 @@ function editpost_content(App $a) { '$message' => t('Message'), '$browser' => t('Browser'), '$shortpermset' => t('permissions'), - )); + ]); return $o; diff --git a/mod/events.php b/mod/events.php index b64b6a1340..791499515d 100644 --- a/mod/events.php +++ b/mod/events.php @@ -150,7 +150,7 @@ function events_post(App $a) { } - $datarray = array(); + $datarray = []; $datarray['guid'] = get_guid(32); $datarray['start'] = $start; $datarray['finish'] = $finish; @@ -221,17 +221,17 @@ function events_content(App $a) { $i18n = get_event_strings(); $htpl = get_markup_template('event_head.tpl'); - $a->page['htmlhead'] .= replace_macros($htpl, array( + $a->page['htmlhead'] .= replace_macros($htpl, [ '$baseurl' => System::baseUrl(), '$module_url' => '/events', '$modparams' => 1, '$i18n' => $i18n, - )); + ]); $etpl = get_markup_template('event_end.tpl'); - $a->page['end'] .= replace_macros($etpl, array( + $a->page['end'] .= replace_macros($etpl, [ '$baseurl' => System::baseUrl(), - )); + ]); $o = ''; $tabs = ''; @@ -326,14 +326,14 @@ function events_content(App $a) { $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); // put the event parametes in an array so we can better transmit them - $event_params = array( + $event_params = [ 'event_id' => (x($_GET, 'id') ? $_GET['id'] : 0), 'start' => $start, 'finish' => $finish, 'adjust_start' => $adjust_start, 'adjust_finish' => $adjust_finish, 'ignored' => $ignored, - ); + ]; // get events by id or by date if (x($_GET, 'id')) { @@ -342,7 +342,7 @@ function events_content(App $a) { $r = events_by_date(local_user(), $event_params); } - $links = array(); + $links = []; if (DBM::is_result($r)) { $r = sort_by_date($r); @@ -354,7 +354,7 @@ function events_content(App $a) { } } - $events = array(); + $events = []; // transform the event in a usable array if (DBM::is_result($r)) { @@ -375,7 +375,7 @@ function events_content(App $a) { // Get rid of dashes in key names, Smarty3 can't handle them foreach ($events as $key => $event) { - $event_item = array(); + $event_item = []; foreach ($event['item'] as $k => $v) { $k = str_replace('-' ,'_', $k); $event_item[$k] = $v; @@ -383,14 +383,14 @@ function events_content(App $a) { $events[$key]['item'] = $event_item; } - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$baseurl' => System::baseUrl(), '$tabs' => $tabs, '$title' => t('Events'), '$view' => t('View'), - '$new_event' => array(System::baseUrl() . '/events/new', t('Create New Event'), '', ''), - '$previous' => array(System::baseUrl() . '/events/$prevyear/$prevmonth', t('Previous'), '', ''), - '$next' => array(System::baseUrl() . '/events/$nextyear/$nextmonth', t('Next'), '', ''), + '$new_event' => [System::baseUrl() . '/events/new', t('Create New Event'), '', ''], + '$previous' => [System::baseUrl() . '/events/$prevyear/$prevmonth', t('Previous'), '', ''], + '$next' => [System::baseUrl() . '/events/$nextyear/$nextmonth', t('Next'), '', ''], '$calendar' => cal($y, $m, $links, ' eventcal'), '$events' => $events, @@ -400,7 +400,7 @@ function events_content(App $a) { '$week' => t('week'), '$day' => t('day'), '$list' => t('list'), - )); + ]); if (x($_GET, 'id')) { echo $o; @@ -421,8 +421,8 @@ function events_content(App $a) { } // Passed parameters overrides anything found in the DB - if (in_array($mode, array('edit', 'new', 'copy'))) { - if (!x($orig_event)) {$orig_event = array();} + if (in_array($mode, ['edit', 'new', 'copy'])) { + if (!x($orig_event)) {$orig_event = [];} // In case of an error the browser is redirected back here, with these parameters filled in with the previous values if (x($_REQUEST, 'nofinish')) {$orig_event['nofinish'] = $_REQUEST['nofinish'];} if (x($_REQUEST, 'adjust')) {$orig_event['adjust'] = $_REQUEST['adjust'];} @@ -492,7 +492,7 @@ function events_content(App $a) { $tpl = get_markup_template('event_form.tpl'); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$post' => System::baseUrl() . '/events', '$eid' => $eid, '$cid' => $cid, @@ -519,12 +519,12 @@ function events_content(App $a) { '$l_orig' => $l_orig, '$t_text' => t('Title:') . ' *', '$t_orig' => $t_orig, - '$summary' => array('summary', t('Title:'), $t_orig, '', '*'), + '$summary' => ['summary', t('Title:'), $t_orig, '', '*'], '$sh_text' => t('Share this event'), - '$share' => array('share', t('Share this event'), $sh_checked, '', $sh_disabled), + '$share' => ['share', t('Share this event'), $sh_checked, '', $sh_disabled], '$sh_checked' => $sh_checked, - '$nofinish' => array('nofinish', t('Finish date/time is not known or not relevant'), $n_checked), - '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked), + '$nofinish' => ['nofinish', t('Finish date/time is not known or not relevant'), $n_checked], + '$adjust' => ['adjust', t('Adjust for viewer timezone'), $a_checked], '$preview' => t('Preview'), '$acl' => $acl, '$submit' => t('Submit'), @@ -532,7 +532,7 @@ function events_content(App $a) { '$advanced' => t('Advanced'), '$permissions' => t('Permissions'), - )); + ]); return $o; } @@ -541,7 +541,7 @@ function events_content(App $a) { if ($mode === 'drop' && $event_id) { $del = 0; - $params = array('event_id' => ($event_id)); + $params = ['event_id' => ($event_id)]; $ev = event_by_id(local_user(), $params); // Delete only real events (no birthdays) diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 3297dd918b..992f2633ff 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -30,7 +30,7 @@ function fbrowser_content(App $a) { switch ($a->argv[1]) { case "image": - $path = array(array("", t("Photos"))); + $path = [["", t("Photos")]]; $albums = false; $sql_extra = ""; $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10"; @@ -42,7 +42,7 @@ function fbrowser_content(App $a) { dbesc( t('Contact Photos')) ); - function _map_folder1($el){return array(bin2hex($el['album']),$el['album']);}; + function _map_folder1($el){return [bin2hex($el['album']),$el['album']];}; $albums = array_map( "_map_folder1" , $albums); } @@ -52,7 +52,7 @@ function fbrowser_content(App $a) { $album = hex2bin($a->argv[2]); $sql_extra = sprintf("AND `album` = '%s' ",dbesc($album)); $sql_extra2 = ""; - $path[]=array($a->argv[2], $album); + $path[]=[$a->argv[2], $album]; } $r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`, ANY_VALUE(`type`) AS `type`, @@ -78,17 +78,17 @@ function fbrowser_content(App $a) { else $scale = $rr['loq']; - return array( + return [ System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'], $filename_e, System::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext - ); + ]; } $files = array_map("_map_files1", $r); $tpl = get_markup_template($template_file); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$type' => 'image', '$baseurl' => System::baseUrl(), '$path' => $path, @@ -96,7 +96,7 @@ function fbrowser_content(App $a) { '$files' => $files, '$cancel' => t('Cancel'), '$nickname' => $a->user['nickname'], - )); + ]); break; @@ -112,21 +112,21 @@ function fbrowser_content(App $a) { $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip"); $filename_e = $rr['filename']; - return array(System::baseUrl() . '/attach/' . $rr['id'], $filename_e, System::baseUrl() . '/images/icons/16/' . $filetype . '.png'); + return [System::baseUrl() . '/attach/' . $rr['id'], $filename_e, System::baseUrl() . '/images/icons/16/' . $filetype . '.png']; } $files = array_map("_map_files2", $files); $tpl = get_markup_template($template_file); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$type' => 'file', '$baseurl' => System::baseUrl(), - '$path' => array( array( "", t("Files")) ), + '$path' => [ [ "", t("Files")] ], '$folders' => false, '$files' =>$files, '$cancel' => t('Cancel'), '$nickname' => $a->user['nickname'], - )); + ]); } diff --git a/mod/fetch.php b/mod/fetch.php index c097ee4c46..040ef81c84 100644 --- a/mod/fetch.php +++ b/mod/fetch.php @@ -11,7 +11,7 @@ use Friendica\Util\XML; function fetch_init(App $a) { - if (($a->argc != 3) || (!in_array($a->argv[1], array("post", "status_message", "reshare")))) { + if (($a->argc != 3) || (!in_array($a->argv[1], ["post", "status_message", "reshare"]))) { header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); killme(); } diff --git a/mod/filer.php b/mod/filer.php index ea2c70d9ba..f729a78e63 100644 --- a/mod/filer.php +++ b/mod/filer.php @@ -28,10 +28,10 @@ function filer_content(App $a) { $filetags = explode(",", $filetags); $tpl = get_markup_template("filer_dialog.tpl"); - $o = replace_macros($tpl, array( - '$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')), + $o = replace_macros($tpl, [ + '$field' => ['term', t("Save to Folder:"), '', '', $filetags, t('- select -')], '$submit' => t('Save'), - )); + ]); echo $o; } diff --git a/mod/follow.php b/mod/follow.php index f1a53e953f..c60403e54d 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -131,7 +131,7 @@ function follow_content(App $a) { normalise_link($ret["url"])); if (!$r) { - $r = array(array("location" => "", "about" => "", "keywords" => "")); + $r = [["location" => "", "about" => "", "keywords" => ""]]; } else { $gcontact_id = $r[0]["id"]; } @@ -143,12 +143,12 @@ function follow_content(App $a) { $header = t("Connect/Follow"); - $o = replace_macros($tpl,array( + $o = replace_macros($tpl,[ '$header' => htmlentities($header), //'$photo' => proxy_url($ret["photo"], false, PROXY_SIZE_SMALL), '$desc' => "", '$pls_answer' => t('Please answer the following:'), - '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$ret["name"]), false, '', array(t('No'), t('Yes'))), + '$does_know_you' => ['knowyou', sprintf(t('Does %s know you?'),$ret["name"]), false, '', [t('No'), t('Yes')]], '$add_note' => t('Add a personal note:'), '$page_desc' => "", '$friendica' => "", @@ -173,7 +173,7 @@ function follow_content(App $a) { '$about_label' => t("About:"), */ '$keywords' => $r[0]["keywords"], '$keywords_label' => t("Tags:") - )); + ]); $a->page['aside'] = ""; @@ -181,8 +181,8 @@ function follow_content(App $a) { if ($gcontact_id <> 0) { $o .= replace_macros(get_markup_template('section_title.tpl'), - array('$title' => t('Status Messages and Posts') - )); + ['$title' => t('Status Messages and Posts') + ]); // Show last public posts $o .= Contact::getPostsFromUrl($ret["url"]); diff --git a/mod/friendica.php b/mod/friendica.php index 36fb18c0ac..7f48ae3d4a 100644 --- a/mod/friendica.php +++ b/mod/friendica.php @@ -7,7 +7,7 @@ use Friendica\Database\DBM; function friendica_init(App $a) { if ($a->argv[1] == "json"){ - $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); + $register_policy = ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN']; $sql_extra = ''; if (x($a->config,'admin_nickname')) { @@ -17,15 +17,15 @@ function friendica_init(App $a) { $adminlist = explode(",", str_replace(" ", "", $a->config['admin_email'])); $r = q("SELECT `username`, `nickname` FROM `user` WHERE `email` = '%s' $sql_extra", dbesc($adminlist[0])); - $admin = array( + $admin = [ 'name' => $r[0]['username'], 'profile'=> System::baseUrl() . '/profile/' . $r[0]['nickname'], - ); + ]; } else { $admin = false; } - $visible_plugins = array(); + $visible_plugins = []; if (is_array($a->plugins) && count($a->plugins)) { $r = q("SELECT * FROM `addon` WHERE `hidden` = 0"); if (DBM::is_result($r)) { @@ -36,7 +36,7 @@ function friendica_init(App $a) { } Config::load('feature_lock'); - $locked_features = array(); + $locked_features = []; if (is_array($a->config['feature_lock']) && count($a->config['feature_lock'])) { foreach ($a->config['feature_lock'] as $k => $v) { if ($k === 'config_loaded') { @@ -47,7 +47,7 @@ function friendica_init(App $a) { } } - $data = Array( + $data = [ 'version' => FRIENDICA_VERSION, 'url' => System::baseUrl(), 'plugins' => $visible_plugins, @@ -58,7 +58,7 @@ function friendica_init(App $a) { 'platform' => FRIENDICA_PLATFORM, 'info' => ((x($a->config,'info')) ? $a->config['info'] : ''), 'no_scrape_url' => System::baseUrl().'/noscrape' - ); + ]; echo json_encode($data); killme(); @@ -83,7 +83,7 @@ function friendica_content(App $a) { $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com'); $o .= '

' . PHP_EOL; - $visible_plugins = array(); + $visible_plugins = []; if (is_array($a->plugins) && count($a->plugins)) { $r = q("SELECT * FROM `addon` WHERE `hidden` = 0"); if (DBM::is_result($r)) { diff --git a/mod/fsuggest.php b/mod/fsuggest.php index 0d088c02c8..926bb25f07 100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php @@ -111,7 +111,7 @@ function fsuggest_content(App $a) $o .= contact_selector( 'suggest', 'suggest-select', - array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true), + ['size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true], false ); diff --git a/mod/group.php b/mod/group.php index 8a6e9309f1..ce091db8cd 100644 --- a/mod/group.php +++ b/mod/group.php @@ -92,17 +92,17 @@ function group_content(App $a) { $tpl = get_markup_template('group_edit.tpl'); - $context = array( + $context = [ '$submit' => t('Save Group'), - ); + ]; if (($a->argc == 2) && ($a->argv[1] === 'new')) { - return replace_macros($tpl, $context + array( + return replace_macros($tpl, $context + [ '$title' => t('Create a group of contacts/friends.'), - '$gname' => array('groupname', t('Group Name: '), '', ''), + '$gname' => ['groupname', t('Group Name: '), '', ''], '$gid' => 'new', '$form_security_token' => get_form_security_token("group_edit"), - )); + ]); } @@ -160,8 +160,8 @@ function group_content(App $a) { $group = $r[0]; $members = Contact::getByGroupId($group['id']); - $preselected = array(); - $entry = array(); + $preselected = []; + $entry = []; $id = 0; if (count($members)) { @@ -178,7 +178,7 @@ function group_content(App $a) { } $members = Contact::getByGroupId($group['id']); - $preselected = array(); + $preselected = []; if (count($members)) { foreach ($members as $member) { $preselected[] = $member['id']; @@ -187,21 +187,21 @@ function group_content(App $a) { } $drop_tpl = get_markup_template('group_drop.tpl'); - $drop_txt = replace_macros($drop_tpl, array( + $drop_txt = replace_macros($drop_tpl, [ '$id' => $group['id'], '$delete' => t('Delete Group'), '$form_security_token' => get_form_security_token("group_drop"), - )); + ]); - $context = $context + array( + $context = $context + [ '$title' => t('Group Editor'), - '$gname' => array('groupname', t('Group Name: '), $group['name'], ''), + '$gname' => ['groupname', t('Group Name: '), $group['name'], ''], '$gid' => $group['id'], '$drop' => $drop_txt, '$form_security_token' => get_form_security_token('group_edit'), '$edit_name' => t('Edit Group Name') - ); + ]; } @@ -209,13 +209,13 @@ function group_content(App $a) { return; } - $groupeditor = array( + $groupeditor = [ 'label_members' => t('Members'), - 'members' => array(), + 'members' => [], 'label_contacts' => t('All Contacts'), 'group_is_empty' => t('Group is empty'), - 'contacts' => array(), - ); + 'contacts' => [], + ]; $sec_token = addslashes(get_form_security_token('group_member_change')); @@ -225,12 +225,12 @@ function group_content(App $a) { $entry = _contact_detail_for_template($member); $entry['label'] = 'members'; $entry['photo_menu'] = ''; - $entry['change_member'] = array( + $entry['change_member'] = [ 'title' => t("Remove Contact"), 'gid' => $group['id'], 'cid' => $member['id'], 'sec_token' => $sec_token - ); + ]; $groupeditor['members'][] = $entry; } else { @@ -249,12 +249,12 @@ function group_content(App $a) { $entry = _contact_detail_for_template($member); $entry['label'] = 'contacts'; $entry['photo_menu'] = ''; - $entry['change_member'] = array( + $entry['change_member'] = [ 'title' => t("Add Contact"), 'gid' => $group['id'], 'cid' => $member['id'], 'sec_token' => $sec_token - ); + ]; $groupeditor['contacts'][] = $entry; } diff --git a/mod/hcard.php b/mod/hcard.php index 87f5ef3207..1c00743106 100644 --- a/mod/hcard.php +++ b/mod/hcard.php @@ -40,7 +40,7 @@ function hcard_init(App $a) if (!$blocked) { $keywords = ((x($a->profile, 'pub_keywords')) ? $a->profile['pub_keywords'] : ''); - $keywords = str_replace(array(',',' ',',,'), array(' ',',',','), $keywords); + $keywords = str_replace([',',' ',',,'], [' ',',',','], $keywords); if (strlen($keywords)) { $a->page['htmlhead'] .= '' . "\r\n" ; } @@ -52,7 +52,7 @@ function hcard_init(App $a) $a->page['htmlhead'] .= '' . "\r\n"; header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); - $dfrn_pages = array('request', 'confirm', 'notify', 'poll'); + $dfrn_pages = ['request', 'confirm', 'notify', 'poll']; foreach ($dfrn_pages as $dfrn) { $a->page['htmlhead'] .= "\r\n"; } diff --git a/mod/help.php b/mod/help.php index 65221165fd..ab5223a397 100644 --- a/mod/help.php +++ b/mod/help.php @@ -55,9 +55,9 @@ function help_content(App $a) { if (!strlen($text)) { header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . t('Not Found')); $tpl = get_markup_template("404.tpl"); - return replace_macros($tpl, array( + return replace_macros($tpl, [ '$message' => t('Page not found.') - )); + ]); } $html = Markdown::convert($text, false); @@ -67,7 +67,7 @@ function help_content(App $a) { $lines = explode("\n", $html); $toc="

TOC

    "; $lastlevel=1; - $idnum = array(0,0,0,0,0,0,0); + $idnum = [0,0,0,0,0,0,0]; foreach($lines as &$line){ if (substr($line,0,2)=="user['nickname'])) { diff --git a/mod/hostxrd.php b/mod/hostxrd.php index 1da8fda998..16f132fe09 100644 --- a/mod/hostxrd.php +++ b/mod/hostxrd.php @@ -22,11 +22,11 @@ function hostxrd_init(App $a) } $tpl = get_markup_template('xrd_host.tpl'); - echo replace_macros($tpl, array( + echo replace_macros($tpl, [ '$zhost' => $a->get_hostname(), '$zroot' => System::baseUrl(), '$domain' => System::baseUrl(), - '$bigkey' => Salmon::salmonKey(Config::get('system', 'site_pubkey'))) + '$bigkey' => Salmon::salmonKey(Config::get('system', 'site_pubkey'))] ); exit(); diff --git a/mod/hovercard.php b/mod/hovercard.php index 9bf4774056..334bf228ab 100644 --- a/mod/hovercard.php +++ b/mod/hovercard.php @@ -66,7 +66,7 @@ function hovercard_content() } // Move the contact data to the profile array so we can deliver it to - $profile = array( + $profile = [ 'name' => $contact['name'], 'nick' => $contact['nick'], 'addr' => defaults($contact, 'addr', $contact['url']), @@ -81,12 +81,12 @@ function hovercard_content() 'bd' => $contact['birthday'] <= '0001-01-01' ? '' : $contact['birthday'], 'account_type' => Contact::getAccountType($contact), 'actions' => $actions, - ); + ]; if ($datatype == 'html') { $tpl = get_markup_template('hovercard.tpl'); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$profile' => $profile, - )); + ]); return $o; } else { diff --git a/mod/install.php b/mod/install.php index 81e4805b2e..2989f7fbea 100644 --- a/mod/install.php +++ b/mod/install.php @@ -69,7 +69,7 @@ function install_post(App $a) { dba::connect($dbhost, $dbuser, $dbpass, $dbdata, true); $tpl = get_markup_template('htconfig.tpl'); - $txt = replace_macros($tpl,array( + $txt = replace_macros($tpl,[ '$dbhost' => $dbhost, '$dbuser' => $dbuser, '$dbpass' => $dbpass, @@ -80,7 +80,7 @@ function install_post(App $a) { '$phpath' => $phpath, '$adminmail' => $adminmail, '$rino' => $rino - )); + ]); $result = file_put_contents('.htconfig.php', $txt); @@ -138,12 +138,12 @@ function install_content(App $a) { $r = q("SELECT COUNT(*) as `total` FROM `user`"); if (DBM::is_result($r) && $r[0]['total']) { $tpl = get_markup_template('install.tpl'); - return replace_macros($tpl, array( + return replace_macros($tpl, [ '$title' => $install_title, '$pass' => '', '$status' => t('Database already in use.'), '$text' => '', - )); + ]); } } @@ -153,18 +153,18 @@ function install_content(App $a) { if ($db_return_text != "") { $tpl = get_markup_template('install.tpl'); - return replace_macros($tpl, array( + return replace_macros($tpl, [ '$title' => $install_title, '$pass' => "", '$text' => $db_return_text . what_next(), - )); + ]); } switch ($install_wizard_pass) { case 1: { // System check - $checks = array(); + $checks = []; check_funcs($checks); @@ -196,7 +196,7 @@ function install_content(App $a) { $tpl = get_markup_template('install_checks.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$title' => $install_title, '$pass' => t('System check'), '$checks' => $checks, @@ -206,7 +206,7 @@ function install_content(App $a) { '$reload' => t('Check again'), '$phpath' => $phpath, '$baseurl' => System::baseUrl(), - )); + ]); return $o; }; break; @@ -220,7 +220,7 @@ function install_content(App $a) { $tpl = get_markup_template('install_db.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$title' => $install_title, '$pass' => t('Database connection'), '$info_01' => t('In order to install Friendica we need to know how to connect to your database.'), @@ -229,11 +229,11 @@ function install_content(App $a) { '$status' => $wizard_status, - '$dbhost' => array('dbhost', t('Database Server Name'), $dbhost, '', 'required'), - '$dbuser' => array('dbuser', t('Database Login Name'), $dbuser, '', 'required', 'autofocus'), - '$dbpass' => array('dbpass', t('Database Login Password'), $dbpass, t("For security reasons the password must not be empty"), 'required'), - '$dbdata' => array('dbdata', t('Database Name'), $dbdata, '', 'required'), - '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'), + '$dbhost' => ['dbhost', t('Database Server Name'), $dbhost, '', 'required'], + '$dbuser' => ['dbuser', t('Database Login Name'), $dbuser, '', 'required', 'autofocus'], + '$dbpass' => ['dbpass', t('Database Login Password'), $dbpass, t("For security reasons the password must not be empty"), 'required'], + '$dbdata' => ['dbdata', t('Database Name'), $dbdata, '', 'required'], + '$adminmail' => ['adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'], @@ -245,7 +245,7 @@ function install_content(App $a) { '$submit' => t('Submit'), - )); + ]); return $o; }; break; case 3: { // Site settings @@ -262,7 +262,7 @@ function install_content(App $a) { $lang_choices = get_available_languages(); $tpl = get_markup_template('install_settings.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$title' => $install_title, '$pass' => t('Site settings'), @@ -274,18 +274,18 @@ function install_content(App $a) { '$dbdata' => $dbdata, '$phpath' => $phpath, - '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'), + '$adminmail' => ['adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'], '$timezone' => field_timezone('timezone', t('Please select a default timezone for your website'), $timezone, ''), - '$language' => array('language', t('System Language:'), 'en', t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices), + '$language' => ['language', t('System Language:'), 'en', t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices], '$baseurl' => System::baseUrl(), '$submit' => t('Submit'), - )); + ]); return $o; }; break; @@ -300,12 +300,12 @@ function install_content(App $a) { * help : string optional */ function check_add(&$checks, $title, $status, $required, $help) { - $checks[] = array( + $checks[] = [ 'title' => $title, 'status' => $status, 'required' => $required, 'help' => $help, - ); + ]; } function check_php(&$phpath, &$checks) { @@ -322,9 +322,9 @@ function check_php(&$phpath, &$checks) { $help .= t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See 'Setup the worker'") . EOL; $help .= EOL . EOL; $tpl = get_markup_template('field_input.tpl'); - $help .= replace_macros($tpl, array( - '$field' => array('phpath', t('PHP executable path'), $phpath, t('Enter full path to php executable. You can leave this blank to continue the installation.')), - )); + $help .= replace_macros($tpl, [ + '$field' => ['phpath', t('PHP executable path'), $phpath, t('Enter full path to php executable. You can leave this blank to continue the installation.')], + ]); $phpath = ""; } @@ -367,11 +367,11 @@ function check_keys(&$checks) { $res = false; if (function_exists('openssl_pkey_new')) { - $res = openssl_pkey_new(array( + $res = openssl_pkey_new([ 'digest_alg' => 'sha1', 'private_key_bits' => 4096, 'encrypt_key' => false - )); + ]); } // Get private key @@ -386,7 +386,7 @@ function check_keys(&$checks) { function check_funcs(&$checks) { - $ck_funcs = array(); + $ck_funcs = []; check_add($ck_funcs, t('libCurl PHP module'), true, true, ""); check_add($ck_funcs, t('GD graphics PHP module'), true, true, ""); check_add($ck_funcs, t('OpenSSL PHP module'), true, true, ""); diff --git a/mod/invite.php b/mod/invite.php index 06c0df3b84..84426c5784 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -32,7 +32,7 @@ function invite_post(App $a) { } - $recips = ((x($_POST,'recipients')) ? explode("\n",$_POST['recipients']) : array()); + $recips = ((x($_POST,'recipients')) ? explode("\n",$_POST['recipients']) : []); $message = ((x($_POST,'message')) ? notags(trim($_POST['message'])) : ''); $total = 0; @@ -136,7 +136,7 @@ function invite_content(App $a) { } } - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$form_security_token' => get_form_security_token("send_invite"), '$invite' => t('Send invitations'), '$addr_text' => t('Enter email addresses, one per line:'), @@ -147,7 +147,7 @@ function invite_content(App $a) { . "\r\n" . "\r\n" . System::baseUrl() . '/profile/' . $a->user['nickname'] . "\r\n" . "\r\n" . t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n" , '$submit' => t('Submit') - )); + ]); return $o; } diff --git a/mod/item.php b/mod/item.php index f5f698a67c..0ff5eb4fef 100644 --- a/mod/item.php +++ b/mod/item.php @@ -45,7 +45,7 @@ function item_post(App $a) { if (x($_REQUEST, 'dropitems')) { $arr_drop = explode(',', $_REQUEST['dropitems']); drop_items($arr_drop); - $json = array('success' => 1); + $json = ['success' => 1]; echo json_encode($json); killme(); } @@ -455,11 +455,11 @@ function item_post(App $a) { } } - $tagged = array(); + $tagged = []; $private_forum = false; $only_to_forum = false; - $forum_contact = array(); + $forum_contact = []; if (count($tags)) { foreach ($tags as $tag) { @@ -690,7 +690,7 @@ function item_post(App $a) { $parent_uri = $uri; } - $datarray = array(); + $datarray = []; $datarray['uid'] = $profile_uid; $datarray['type'] = $post_type; $datarray['wall'] = $wall; @@ -735,8 +735,8 @@ function item_post(App $a) { $datarray['postopts'] = $postopts; $datarray['origin'] = $origin; $datarray['moderated'] = $allow_moderated; - $datarray['gcontact-id'] = GContact::getId(array("url" => $datarray['author-link'], "network" => $datarray['network'], - "photo" => $datarray['author-avatar'], "name" => $datarray['author-name'])); + $datarray['gcontact-id'] = GContact::getId(["url" => $datarray['author-link'], "network" => $datarray['network'], + "photo" => $datarray['author-avatar'], "name" => $datarray['author-name']]); $datarray['object'] = $object; $datarray['last-child'] = 1; @@ -777,9 +777,9 @@ function item_post(App $a) { // We set the datarray ID to -1 because in preview mode the dataray // doesn't have an ID. $datarray["id"] = -1; - $o = conversation($a,array(array_merge($contact_record,$datarray)),'search', false, true); + $o = conversation($a,[array_merge($contact_record,$datarray)],'search', false, true); logger('preview: ' . $o); - echo json_encode(array('preview' => $o)); + echo json_encode(['preview' => $o]); killme(); } @@ -791,7 +791,7 @@ function item_post(App $a) { goaway($return_path); } - $json = array('cancel' => 1); + $json = ['cancel' => 1]; if (x($_REQUEST, 'jsreload') && strlen($_REQUEST['jsreload'])) { $json['reload'] = System::baseUrl() . '/' . $_REQUEST['jsreload']; } @@ -806,7 +806,7 @@ function item_post(App $a) { // This could be done in Item::update as well - but we have to check for the existance of some fields. put_item_in_cache($datarray); - $fields = array( + $fields = [ 'title' => $datarray['title'], 'body' => $datarray['body'], 'tag' => $datarray['tag'], @@ -815,7 +815,7 @@ function item_post(App $a) { 'rendered-html' => $datarray['rendered-html'], 'rendered-hash' => $datarray['rendered-hash'], 'edited' => datetime_convert(), - 'changed' => datetime_convert()); + 'changed' => datetime_convert()]; Item::update($fields, ['id' => $post_id]); @@ -845,7 +845,7 @@ function item_post(App $a) { // These notifications are sent if someone else is commenting other your wall if ($parent) { if ($contact_record != $author) { - notification(array( + notification([ 'type' => NOTIFY_COMMENT, 'notify_flags' => $user['notify-flags'], 'language' => $user['language'], @@ -861,14 +861,14 @@ function item_post(App $a) { 'otype' => 'item', 'parent' => $parent, 'parent_uri' => $parent_item['uri'] - )); + ]); } // Store the comment signature information in case we need to relay to Diaspora Diaspora::storeCommentSignature($datarray, $author, ($self ? $user['prvkey'] : false), $post_id); } else { if (($contact_record != $author) && !count($forum_contact)) { - notification(array( + notification([ 'type' => NOTIFY_WALL, 'notify_flags' => $user['notify-flags'], 'language' => $user['language'], @@ -882,7 +882,7 @@ function item_post(App $a) { 'source_photo' => $datarray['author-avatar'], 'verb' => ACTIVITY_POST, 'otype' => 'item' - )); + ]); } } @@ -909,7 +909,7 @@ function item_post(App $a) { $html = prepare_body($datarray); $message = '' . $link . $html . $disclaimer . ''; include_once 'include/html2plain.php'; - $params = array ( + $params = [ 'fromName' => $a->user['username'], 'fromEmail' => $a->user['email'], 'toEmail' => $addr, @@ -917,7 +917,7 @@ function item_post(App $a) { 'messageSubject' => $subject, 'htmlVersion' => $message, 'textVersion' => html2plain($html.$disclaimer) - ); + ]; Emailer::send($params); } } @@ -927,7 +927,7 @@ function item_post(App $a) { // We now do it in the background to save some time. // This is important in interactive environments like the frontend or the API. // We don't fork a new process since this is done anyway with the following command - Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "CreateShadowEntry", $post_id); + Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], "CreateShadowEntry", $post_id); // Call the background process that is delivering the item to the receivers Worker::add(PRIORITY_HIGH, "Notifier", $notify_type, $post_id); @@ -949,7 +949,7 @@ function item_post_return($baseurl, $api_source, $return_path) { goaway($return_path); } - $json = array('success' => 1); + $json = ['success' => 1]; if (x($_REQUEST, 'jsreload') && strlen($_REQUEST['jsreload'])) { $json['reload'] = $baseurl . '/' . $_REQUEST['jsreload']; } @@ -975,7 +975,7 @@ function item_content(App $a) { $o = drop_item($a->argv[2], !is_ajax()); if (is_ajax()) { // ajax return: [, 0 (no perm) | ] - echo json_encode(array(intval($a->argv[2]), intval($o))); + echo json_encode([intval($a->argv[2]), intval($o)]); killme(); } } @@ -1206,5 +1206,5 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n } } - return array('replaced' => $replaced, 'contact' => $r[0]); + return ['replaced' => $replaced, 'contact' => $r[0]]; } diff --git a/mod/lockview.php b/mod/lockview.php index a8cccd955c..ced03d1b56 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -16,7 +16,7 @@ function lockview_content(App $a) { if(! $item_id) killme(); - if (!in_array($type, array('item','photo','event'))) + if (!in_array($type, ['item','photo','event'])) killme(); $r = q("SELECT * FROM `%s` WHERE `id` = %d LIMIT 1", @@ -49,7 +49,7 @@ function lockview_content(App $a) { $deny_groups = expand_acl($item['deny_gid']); $o = t('Visible to:') . '
    '; - $l = array(); + $l = []; if(count($allowed_groups)) { $r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )", diff --git a/mod/lostpass.php b/mod/lostpass.php index b3304fda12..3f480ea0f3 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -70,12 +70,12 @@ function lostpass_post(App $a) { $preamble = sprintf($preamble, $username, $sitename); $body = sprintf($body, $resetlink, System::baseUrl(), $email); - notification(array( + notification([ 'type' => SYSTEM_EMAIL, 'to_email' => $email, 'subject'=> sprintf( t('Password reset requested at %s'),$sitename), 'preamble'=> $preamble, - 'body' => $body)); + 'body' => $body]); goaway(System::baseUrl()); @@ -111,7 +111,7 @@ function lostpass_content(App $a) { /// @TODO Is DBM::is_result() okay here? if ($r) { $tpl = get_markup_template('pwdreset.tpl'); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$lbl1' => t('Password Reset'), '$lbl2' => t('Your password has been reset as requested.'), '$lbl3' => t('Your new password is'), @@ -121,7 +121,7 @@ function lostpass_content(App $a) { '$newpass' => $new_password, '$baseurl' => System::baseUrl() - )); + ]); info("Your password has been reset." . EOL); @@ -146,12 +146,12 @@ function lostpass_content(App $a) { $preamble = sprintf($preamble, $username); $body = sprintf($body, System::baseUrl(), $email, $new_password); - notification(array( + notification([ 'type' => SYSTEM_EMAIL, 'to_email' => $email, 'subject'=> sprintf( t('Your password has been changed at %s'),$sitename), 'preamble'=> $preamble, - 'body' => $body)); + 'body' => $body]); return $o; } @@ -160,12 +160,12 @@ function lostpass_content(App $a) { else { $tpl = get_markup_template('lostpass.tpl'); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$title' => t('Forgot your Password?'), '$desc' => t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'), '$name' => t('Nickname or Email: '), '$submit' => t('Reset') - )); + ]); return $o; } diff --git a/mod/maintenance.php b/mod/maintenance.php index 2258fc5ce2..adc9fab166 100644 --- a/mod/maintenance.php +++ b/mod/maintenance.php @@ -17,8 +17,8 @@ function maintenance_content(App $a) { header('Status: 503 Service Temporarily Unavailable'); header('Retry-After: 600'); - return replace_macros(get_markup_template('maintenance.tpl'), array( + return replace_macros(get_markup_template('maintenance.tpl'), [ '$sysdown' => t('System down for maintenance'), '$reason' => $reason - )); + ]); } diff --git a/mod/manage.php b/mod/manage.php index 72de332fc7..f2781f1081 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -90,7 +90,7 @@ function manage_post(App $a) { $_SESSION['submanage'] = $original_id; } - $ret = array(); + $ret = []; call_hooks('home_init',$ret); goaway( System::baseUrl() . "/profile/" . $a->user['nickname'] ); @@ -150,13 +150,13 @@ function manage_content(App $a) { $identities[$key]['notifications'] = $notifications; } - $o = replace_macros(get_markup_template('manage.tpl'), array( + $o = replace_macros(get_markup_template('manage.tpl'), [ '$title' => t('Manage Identities and/or Pages'), '$desc' => t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'), '$choose' => t('Select an identity to manage: '), '$identities' => $identities, '$submit' => t('Submit'), - )); + ]); return $o; diff --git a/mod/manifest.php b/mod/manifest.php index 203f5ab829..a651f51662 100644 --- a/mod/manifest.php +++ b/mod/manifest.php @@ -15,11 +15,11 @@ function manifest_content(App $a) { $touch_icon = 'images/friendica-128.png'; } - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$baseurl' => System::baseUrl(), '$touch_icon' => $touch_icon, '$title' => Config::get('config', 'sitename', 'Friendica'), - )); + ]); echo $o; diff --git a/mod/match.php b/mod/match.php index 9ccf5a955b..8a0c66faf0 100644 --- a/mod/match.php +++ b/mod/match.php @@ -47,7 +47,7 @@ function match_content(App $a) return; } - $params = array(); + $params = []; $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']); if ($tags) { @@ -83,14 +83,14 @@ function match_content(App $a) if (!count($match)) { $jj->photo = str_replace("http:///photo/", get_server()."/photo/", $jj->photo); $connlnk = System::baseUrl() . '/follow/?url=' . $jj->url; - $photo_menu = array( - 'profile' => array(t("View Profile"), Profile::zrl($jj->url)), - 'follow' => array(t("Connect/Follow"), $connlnk) - ); + $photo_menu = [ + 'profile' => [t("View Profile"), Profile::zrl($jj->url)], + 'follow' => [t("Connect/Follow"), $connlnk] + ]; $contact_details = Contact::getDetailsByURL($jj->url, local_user()); - $entry = array( + $entry = [ 'url' => Profile::zrl($jj->url), 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $jj->url), 'name' => $jj->name, @@ -105,7 +105,7 @@ function match_content(App $a) 'img_hover' => $jj->tags, 'photo_menu' => $photo_menu, 'id' => ++$id, - ); + ]; $entries[] = $entry; } } @@ -114,10 +114,10 @@ function match_content(App $a) $o .= replace_macros( $tpl, - array( + [ '$title' => t('Profile Match'), '$contacts' => $entries, - '$paginate' => paginate($a)) + '$paginate' => paginate($a)] ); } else { info(t('No matches') . EOL); diff --git a/mod/message.php b/mod/message.php index 04073139f3..c02e27bef4 100644 --- a/mod/message.php +++ b/mod/message.php @@ -20,31 +20,31 @@ function message_init(App $a) $tabs = render_messages(get_messages(local_user(), 0, 5), 'mail_list.tpl'); } - $new = array( + $new = [ 'label' => t('New Message'), 'url' => 'message/new', 'sel' => $a->argc > 1 && $a->argv[1] == 'new', 'accesskey' => 'm', - ); + ]; $tpl = get_markup_template('message_side.tpl'); - $a->page['aside'] = replace_macros($tpl, array( + $a->page['aside'] = replace_macros($tpl, [ '$tabs' => $tabs, '$new' => $new, - )); + ]); $base = System::baseUrl(); $head_tpl = get_markup_template('message-head.tpl'); - $a->page['htmlhead'] .= replace_macros($head_tpl, array( + $a->page['htmlhead'] .= replace_macros($head_tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base - )); + ]); $end_tpl = get_markup_template('message-end.tpl'); - $a->page['end'] .= replace_macros($end_tpl, array( + $a->page['end'] .= replace_macros($end_tpl, [ '$baseurl' => System::baseUrl(true), '$base' => $base - )); + ]); } function message_post(App $a) @@ -102,9 +102,9 @@ function message_content(App $a) $myprofile = System::baseUrl() . '/profile/' . $a->user['nickname']; $tpl = get_markup_template('mail_head.tpl'); - $header = replace_macros($tpl, array( + $header = replace_macros($tpl, [ '$messages' => t('Messages'), - )); + ]); if (($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) { if (!intval($a->argv[2])) { @@ -116,16 +116,16 @@ function message_content(App $a) // can't take arguments in its "action" parameter // so add any arguments as hidden inputs $query = explode_querystring($a->query_string); - $inputs = array(); + $inputs = []; foreach ($query['args'] as $arg) { if (strpos($arg, 'confirm=') === false) { $arg_parts = explode('=', $arg); - $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]); + $inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]]; } } //$a->page['aside'] = ''; - return replace_macros(get_markup_template('confirm.tpl'), array( + return replace_macros(get_markup_template('confirm.tpl'), [ '$method' => 'get', '$message' => t('Do you really want to delete this message?'), '$extra_inputs' => $inputs, @@ -133,7 +133,7 @@ function message_content(App $a) '$confirm_url' => $query['base'], '$confirm_name' => 'confirmed', '$cancel' => t('Cancel'), - )); + ]); } // Now check how the user responded to the confirmation query if ($_REQUEST['canceled']) { @@ -188,20 +188,20 @@ function message_content(App $a) $o .= $header; $tpl = get_markup_template('msg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, array( + $a->page['htmlhead'] .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], '$linkurl' => t('Please enter a link URL:') - )); + ]); $tpl = get_markup_template('msg-end.tpl'); - $a->page['end'] .= replace_macros($tpl, array( + $a->page['end'] .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], '$linkurl' => t('Please enter a link URL:') - )); + ]); - $preselect = isset($a->argv[2]) ? array($a->argv[2]) : false; + $preselect = isset($a->argv[2]) ? [$a->argv[2]] : false; $prename = $preurl = $preid = ''; @@ -228,7 +228,7 @@ function message_content(App $a) $prename = $r[0]['name']; $preurl = $r[0]['url']; $preid = $r[0]['id']; - $preselect = array($preid); + $preselect = [$preid]; } else { $preselect = false; } @@ -240,7 +240,7 @@ function message_content(App $a) $select = contact_select('messageto', 'message-to-select', $preselect, 4, true, false, false, 10); $tpl = get_markup_template('prv_message.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$header' => t('Send Private Message'), '$to' => t('To:'), '$showinputs' => 'true', @@ -258,7 +258,7 @@ function message_content(App $a) '$insert' => t('Insert web link'), '$wait' => t('Please wait'), '$submit' => t('Submit') - )); + ]); return $o; } @@ -334,20 +334,20 @@ function message_content(App $a) require_once("include/bbcode.php"); $tpl = get_markup_template('msg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, array( + $a->page['htmlhead'] .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], '$linkurl' => t('Please enter a link URL:') - )); + ]); $tpl = get_markup_template('msg-end.tpl'); - $a->page['end'] .= replace_macros($tpl, array( + $a->page['end'] .= replace_macros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], '$linkurl' => t('Please enter a link URL:') - )); + ]); - $mails = array(); + $mails = []; $seen = 0; $unknown = false; @@ -382,7 +382,7 @@ function message_content(App $a) $from_photo = $message['from-photo']; } - $mails[] = array( + $mails[] = [ 'id' => $message['id'], 'from_name' => $from_name_e, 'from_url' => $from_url, @@ -395,7 +395,7 @@ function message_content(App $a) 'to_name' => $to_name_e, 'date' => datetime_convert('UTC', date_default_timezone_get(), $message['created'], 'D, d M Y - g:i A'), 'ago' => relative_date($message['created']), - ); + ]; $seen = $message['seen']; } @@ -404,7 +404,7 @@ function message_content(App $a) $parent = ''; $tpl = get_markup_template('mail_display.tpl'); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$thread_id' => $a->argv[1], '$thread_subject' => $message['title'], '$thread_seen' => $seen, @@ -428,7 +428,7 @@ function message_content(App $a) '$insert' => t('Insert web link'), '$submit' => t('Submit'), '$wait' => t('Please wait') - )); + ]); return $o; } @@ -483,7 +483,7 @@ function render_messages(array $msg, $t) $from_photo = (($rr['thumb']) ? $rr['thumb'] : $rr['from-photo']); } - $rslt .= replace_macros($tpl, array( + $rslt .= replace_macros($tpl, [ '$id' => $rr['id'], '$from_name' => $participants, '$from_url' => (($rr['network'] === NETWORK_DFRN) ? 'redir/' . $rr['contact-id'] : $rr['url']), @@ -498,7 +498,7 @@ function render_messages(array $msg, $t) '$ago' => relative_date($rr['mailcreated']), '$seen' => $rr['mailseen'], '$count' => tt('%d message', '%d messages', $rr['count']), - )); + ]); } return $rslt; diff --git a/mod/msearch.php b/mod/msearch.php index a652bc8ed8..0d7cca4ff1 100644 --- a/mod/msearch.php +++ b/mod/msearch.php @@ -21,7 +21,7 @@ function msearch_post(App $a) { if (DBM::is_result($r)) $total = $r[0]['total']; - $results = array(); + $results = []; $r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ", dbesc($search), @@ -31,15 +31,15 @@ function msearch_post(App $a) { if (DBM::is_result($r)) { foreach($r as $rr) - $results[] = array( + $results[] = [ 'name' => $rr['name'], 'url' => System::baseUrl() . '/profile/' . $rr['nickname'], 'photo' => System::baseUrl() . '/photo/avatar/' . $rr['uid'] . '.jpg', - 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['pub_keywords']) - ); + 'tags' => str_replace([',',' '],[' ',' '],$rr['pub_keywords']) + ]; } - $output = array('total' => $total, 'items_page' => $perpage, 'page' => $page + 1, 'results' => $results); + $output = ['total' => $total, 'items_page' => $perpage, 'page' => $page + 1, 'results' => $results]; echo json_encode($output); diff --git a/mod/network.php b/mod/network.php index ef5437213e..e9d60fd5ca 100644 --- a/mod/network.php +++ b/mod/network.php @@ -32,13 +32,13 @@ function network_init(App $a) { } if (x($_GET, 'save')) { - $exists = dba::exists('search', array('uid' => local_user(), 'term' => $search)); + $exists = dba::exists('search', ['uid' => local_user(), 'term' => $search]); if (!$exists) { - dba::insert('search', array('uid' => local_user(), 'term' => $search)); + dba::insert('search', ['uid' => local_user(), 'term' => $search]); } } if (x($_GET, 'remove')) { - dba::delete('search', array('uid' => local_user(), 'term' => $search)); + dba::delete('search', ['uid' => local_user(), 'term' => $search]); } $is_a_date_query = false; @@ -64,7 +64,7 @@ function network_init(App $a) { } // convert query string to array. remove friendica args - $query_array = array(); + $query_array = []; $query_string = str_replace($a->cmd."?", "", $a->query_string); parse_str($query_string, $query_array); array_shift($query_array); @@ -83,7 +83,7 @@ function network_init(App $a) { $remember_group = ($sel_groups === false && $last_sel_groups && $last_sel_groups != 0); $net_baseurl = '/network'; - $net_args = array(); + $net_args = []; if ($remember_group) { $net_baseurl .= '/' . $last_sel_groups; // Note that the group number must come before the "/new" tab selection @@ -96,7 +96,7 @@ function network_init(App $a) { // last selected tab is _not_ '/network?f=&order=comment'. // and this isn't a date query - $tab_baseurls = array( + $tab_baseurls = [ '', //all '', //postord '', //conv @@ -104,8 +104,8 @@ function network_init(App $a) { '', //starred '', //bookmarked '', //spam - ); - $tab_args = array( + ]; + $tab_args = [ 'f=&order=comment', //all 'f=&order=post', //postord 'f=&conv=1', //conv @@ -113,7 +113,7 @@ function network_init(App $a) { 'f=&star=1', //starred 'f=&bmark=1', //bookmarked 'f=&spam=1', //spam - ); + ]; $k = array_search('active', $last_sel_tabs); @@ -121,7 +121,7 @@ function network_init(App $a) { $net_baseurl .= $tab_baseurls[$k]; // parse out tab queries - $dest_qa = array(); + $dest_qa = []; $dest_qs = $tab_args[$k]; parse_str($dest_qs, $dest_qa); $net_args = array_merge($net_args, $dest_qa); @@ -188,26 +188,26 @@ function saved_searches($search) { $o = ''; - $terms = dba::select('search', array('id', 'term'), array('uid' => local_user())); - $saved = array(); + $terms = dba::select('search', ['id', 'term'], ['uid' => local_user()]); + $saved = []; while ($rr = dba::fetch($terms)) { - $saved[] = array( + $saved[] = [ 'id' => $rr['id'], 'term' => $rr['term'], 'encodedterm' => urlencode($rr['term']), 'delete' => t('Remove term'), 'selected' => ($search==$rr['term']), - ); + ]; } $tpl = get_markup_template("saved_searches_aside.tpl"); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$title' => t('Saved Searches'), '$add' => t('add'), '$searchbox' => search($search,'netsearch-box',$srchurl,true), '$saved' => $saved, - )); + ]); return $o; } @@ -275,7 +275,7 @@ function network_query_get_sel_tab(App $a) { } } - return array($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active); + return [$no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active]; } /** @@ -350,7 +350,7 @@ function networkSetSeen($condition) { $unseen = dba::exists('item', $condition); if ($unseen) { - $r = dba::update('item', array('unseen' => false), $condition); + $r = dba::update('item', ['unseen' => false], $condition); } } @@ -386,7 +386,7 @@ function network_content(App $a, $update = 0) { } /// @TODO Is this really necessary? $a is already available to hooks - $arr = array('query' => $a->query_string); + $arr = ['query' => $a->query_string]; call_hooks('network_content_init', $arr); $nouveau = false; @@ -442,7 +442,7 @@ function networkFlatView(App $a, $update = 0) { nav_set_selected('network'); - $x = array( + $x = [ 'is_owner' => true, 'allow_location' => $a->user['allow_location'], 'default_location' => $a->user['default-location'], @@ -456,7 +456,7 @@ function networkFlatView(App $a, $update = 0) { 'visitor' => 'block', 'profile_uid' => local_user(), 'content' => '', - ); + ]; $o .= status_editor($a, $x); @@ -483,7 +483,7 @@ function networkFlatView(App $a, $update = 0) { intval($_SESSION['uid']) ); - $condition = array('unseen' => true, 'uid' => local_user()); + $condition = ['unseen' => true, 'uid' => local_user()]; networkSetSeen($condition); $mode = 'network-new'; @@ -531,7 +531,7 @@ function networkThreadedView(App $a, $update = 0) { } } elseif (intval($a->argv[$x])) { $gid = intval($a->argv[$x]); - $def_acl = array('allow_gid' => '<' . $gid . '>'); + $def_acl = ['allow_gid' => '<' . $gid . '>']; } } } @@ -546,18 +546,18 @@ function networkThreadedView(App $a, $update = 0) { $nets = ((x($_GET,'nets')) ? $_GET['nets'] : ''); if ($cid) { - $def_acl = array('allow_cid' => '<' . intval($cid) . '>'); + $def_acl = ['allow_cid' => '<' . intval($cid) . '>']; } if ($nets) { - $r = dba::select('contact', array('id'), array('uid' => local_user(), 'network' => $nets), array('self' => false)); + $r = dba::select('contact', ['id'], ['uid' => local_user(), 'network' => $nets], ['self' => false]); $str = ''; while ($rr = dba::fetch($r)) { $str .= '<' . $rr['id'] . '>'; } if (strlen($str)) { - $def_acl = array('allow_cid' => $str); + $def_acl = ['allow_cid' => $str]; } } PConfig::set(local_user(), 'network.view', 'net.selected', ($nets ? $nets : 'all')); @@ -592,7 +592,7 @@ function networkThreadedView(App $a, $update = 0) { } } - $x = array( + $x = [ 'is_owner' => true, 'allow_location' => $a->user['allow_location'], 'default_location' => $a->user['default-location'], @@ -606,7 +606,7 @@ function networkThreadedView(App $a, $update = 0) { 'visitor' => 'block', 'profile_uid' => local_user(), 'content' => $content, - ); + ]; $o .= status_editor($a, $x); } @@ -644,7 +644,7 @@ function networkThreadedView(App $a, $update = 0) { // NOTREACHED } - $contacts = Group::expand(array($gid)); + $contacts = Group::expand([$gid]); if ((is_array($contacts)) && count($contacts)) { $contact_str_self = ""; @@ -663,9 +663,9 @@ function networkThreadedView(App $a, $update = 0) { info(t('Group is empty')); } - $o = replace_macros(get_markup_template("section_title.tpl"),array( + $o = replace_macros(get_markup_template("section_title.tpl"),[ '$title' => t('Group: %s', $group['name']) - )) . $o; + ]) . $o; } elseif ($cid) { $fields = ['id', 'name', 'network', 'writable', 'nurl', @@ -675,20 +675,20 @@ function networkThreadedView(App $a, $update = 0) { if (DBM::is_result($contact)) { $sql_extra = " AND ".$sql_table.".`contact-id` = ".intval($cid); - $entries[0] = array( + $entries[0] = [ 'id' => 'network', 'name' => htmlentities($contact['name']), 'itemurl' => defaults($contact, 'addr', $contact['nurl']), 'thumb' => proxy_url($contact['thumb'], false, PROXY_SIZE_THUMB), 'details' => $contact['location'], - ); + ]; $entries[0]["account_type"] = Contact::getAccountType($contact); - $o = replace_macros(get_markup_template("viewcontact_template.tpl"),array( + $o = replace_macros(get_markup_template("viewcontact_template.tpl"),[ 'contacts' => $entries, 'id' => 'network', - )) . $o; + ]) . $o; if ($contact['network'] === NETWORK_OSTATUS && $contact['writable'] && !PConfig::get(local_user(),'system','nowarn_insecure')) { notice(t('Private messages to this person are at risk of public disclosure.') . EOL); @@ -851,11 +851,11 @@ function networkThreadedView(App $a, $update = 0) { // Then fetch all the children of the parents that are on this page - $parents_arr = array(); + $parents_arr = []; $parents_str = ''; $date_offset = ""; - $items = array(); + $items = []; if (DBM::is_result($r)) { foreach ($r as $rr) { if (!in_array($rr['item_id'], $parents_arr)) { @@ -901,10 +901,10 @@ function networkThreadedView(App $a, $update = 0) { // at the top level network page just mark everything seen. if (!$gid && !$cid && !$star) { - $condition = array('unseen' => true, 'uid' => local_user()); + $condition = ['unseen' => true, 'uid' => local_user()]; networkSetSeen($condition); } elseif ($parents_str) { - $condition = array("`uid` = ? AND `unseen` AND `parent` IN (" . dbesc($parents_str) . ")", local_user()); + $condition = ["`uid` = ? AND `unseen` AND `parent` IN (" . dbesc($parents_str) . ")", local_user()]; networkSetSeen($condition); } @@ -936,80 +936,80 @@ function network_tabs(App $a) $cmd = $a->cmd; // tabs - $tabs = array( - array( + $tabs = [ + [ 'label' => t('Commented Order'), 'url' => str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'sel' => $all_active, 'title' => t('Sort by Comment Date'), 'id' => 'commented-order-tab', 'accesskey' => "e", - ), - array( + ], + [ 'label' => t('Posted Order'), 'url' => str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'sel' => $postord_active, 'title' => t('Sort by Post Date'), 'id' => 'posted-order-tab', 'accesskey' => "t", - ), - ); + ], + ]; if (Feature::isEnabled(local_user(),'personal_tab')) { - $tabs[] = array( + $tabs[] = [ 'label' => t('Personal'), 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1', 'sel' => $conv_active, 'title' => t('Posts that mention or involve you'), 'id' => 'personal-tab', 'accesskey' => "r", - ); + ]; } if (Feature::isEnabled(local_user(),'new_tab')) { - $tabs[] = array( + $tabs[] = [ 'label' => t('New'), 'url' => 'network/new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), 'sel' => $new_active, 'title' => t('Activity Stream - by date'), 'id' => 'activitiy-by-date-tab', 'accesskey' => "w", - ); + ]; } if (Feature::isEnabled(local_user(),'link_tab')) { - $tabs[] = array( + $tabs[] = [ 'label' => t('Shared Links'), 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', 'sel' => $bookmarked_active, 'title' => t('Interesting Links'), 'id' => 'shared-links-tab', 'accesskey' => "b", - ); + ]; } if (Feature::isEnabled(local_user(),'star_posts')) { - $tabs[] = array( + $tabs[] = [ 'label' => t('Starred'), 'url' => str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1', 'sel' => $starred_active, 'title' => t('Favourite Posts'), 'id' => 'starred-posts-tab', 'accesskey' => "m", - ); + ]; } // save selected tab, but only if not in file mode if (!x($_GET,'file')) { - PConfig::set(local_user(), 'network.view','tab.selected',array($all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active)); + PConfig::set(local_user(), 'network.view','tab.selected',[$all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active]); } - $arr = array('tabs' => $tabs); + $arr = ['tabs' => $tabs]; call_hooks('network_tabs', $arr); $tpl = get_markup_template('common_tabs.tpl'); - return replace_macros($tpl, array('$tabs' => $arr['tabs'])); + return replace_macros($tpl, ['$tabs' => $arr['tabs']]); // --- end item filter tabs } diff --git a/mod/nodeinfo.php b/mod/nodeinfo.php index 7a690c15e9..d92335ad13 100644 --- a/mod/nodeinfo.php +++ b/mod/nodeinfo.php @@ -12,8 +12,8 @@ use Friendica\Core\Config; require_once 'include/plugin.php'; function nodeinfo_wellknown(App $a) { - $nodeinfo = array('links' => array(array('rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0', - 'href' => System::baseUrl().'/nodeinfo/1.0'))); + $nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0', + 'href' => System::baseUrl().'/nodeinfo/1.0']]]; header('Content-type: application/json; charset=utf-8'); echo json_encode($nodeinfo, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); @@ -33,13 +33,13 @@ function nodeinfo_init(App $a) { $smtp = (function_exists('imap_open') && !Config::get('system', 'imap_disabled') && !Config::get('system', 'dfrn_only')); - $nodeinfo = array(); + $nodeinfo = []; $nodeinfo['version'] = '1.0'; - $nodeinfo['software'] = array('name' => 'friendica', 'version' => FRIENDICA_VERSION.'-'.DB_UPDATE_VERSION); + $nodeinfo['software'] = ['name' => 'friendica', 'version' => FRIENDICA_VERSION.'-'.DB_UPDATE_VERSION]; - $nodeinfo['protocols'] = array(); - $nodeinfo['protocols']['inbound'] = array(); - $nodeinfo['protocols']['outbound'] = array(); + $nodeinfo['protocols'] = []; + $nodeinfo['protocols']['inbound'] = []; + $nodeinfo['protocols']['outbound'] = []; if (Config::get('system', 'diaspora_enabled')) { $nodeinfo['protocols']['inbound'][] = 'diaspora'; @@ -54,21 +54,21 @@ function nodeinfo_init(App $a) { $nodeinfo['protocols']['outbound'][] = 'gnusocial'; } - $nodeinfo['services'] = array(); - $nodeinfo['services']['inbound'] = array(); - $nodeinfo['services']['outbound'] = array(); + $nodeinfo['services'] = []; + $nodeinfo['services']['inbound'] = []; + $nodeinfo['services']['outbound'] = []; - $nodeinfo['usage'] = array(); + $nodeinfo['usage'] = []; $nodeinfo['openRegistrations'] = ($a->config['register_policy'] != 0); - $nodeinfo['metadata'] = array('nodeName' => $a->config['sitename']); + $nodeinfo['metadata'] = ['nodeName' => $a->config['sitename']]; if (Config::get('system', 'nodeinfo')) { - $nodeinfo['usage']['users'] = array('total' => (int)Config::get('nodeinfo', 'total_users'), + $nodeinfo['usage']['users'] = ['total' => (int)Config::get('nodeinfo', 'total_users'), 'activeHalfyear' => (int)Config::get('nodeinfo', 'active_users_halfyear'), - 'activeMonth' => (int)Config::get('nodeinfo', 'active_users_monthly')); + 'activeMonth' => (int)Config::get('nodeinfo', 'active_users_monthly')]; $nodeinfo['usage']['localPosts'] = (int)Config::get('nodeinfo', 'local_posts'); $nodeinfo['usage']['localComments'] = (int)Config::get('nodeinfo', 'local_comments'); @@ -159,7 +159,7 @@ function nodeinfo_cron() { $plugin = 'statistics_json'; $plugins = Config::get('system', 'addon'); - $plugins_arr = array(); + $plugins_arr = []; if ($plugins) { $plugins_arr = explode(',',str_replace(' ', '',$plugins)); diff --git a/mod/nogroup.php b/mod/nogroup.php index 7ebb5bd1f2..d5da626045 100644 --- a/mod/nogroup.php +++ b/mod/nogroup.php @@ -39,7 +39,7 @@ function nogroup_content(App $a) foreach ($r as $rr) { $contact_details = Contact::getDetailsByURL($rr['url'], local_user(), $rr); - $contacts[] = array( + $contacts[] = [ 'img_hover' => t('Visit %s\'s profile [%s]', $contact_details['name'], $rr['url']), 'edit_hover' => t('Edit contact'), 'photo_menu' => Contact::photoMenu($rr), @@ -53,17 +53,17 @@ function nogroup_content(App $a) 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']), 'url' => $rr['url'], 'network' => ContactSelector::networkToName($rr['network'], $rr['url']), - ); + ]; } } $tpl = get_markup_template("nogroup-template.tpl"); $o = replace_macros( $tpl, - array( + [ '$header' => t('Contacts who are not members of a group'), '$contacts' => $contacts, - '$paginate' => paginate($a)) + '$paginate' => paginate($a)] ); return $o; diff --git a/mod/noscrape.php b/mod/noscrape.php index bbf9020e84..9efaeb2bf1 100644 --- a/mod/noscrape.php +++ b/mod/noscrape.php @@ -25,18 +25,18 @@ function noscrape_init(App $a) if (!$a->profile['net-publish'] || $a->profile['hidewall']) { header('Content-type: application/json; charset=utf-8'); - $json_info = array("hide" => true); + $json_info = ["hide" => true]; echo json_encode($json_info); exit; } $keywords = ((x($a->profile, 'pub_keywords')) ? $a->profile['pub_keywords'] : ''); - $keywords = str_replace(array('#',',',' ',',,'), array('',' ',',',','), $keywords); + $keywords = str_replace(['#',',',' ',',,'], ['',' ',',',','], $keywords); $keywords = explode(',', $keywords); $contactPhoto = dba::selectFirst('contact', ['photo'], ['self' => true, 'uid' => $a->profile['uid']]); - $json_info = array( + $json_info = [ 'fn' => $a->profile['name'], 'addr' => $a->profile['addr'], 'nick' => $which, @@ -46,7 +46,7 @@ function noscrape_init(App $a) 'comm' => (x($a->profile, 'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY), 'photo' => $contactPhoto["photo"], 'tags' => $keywords - ); + ]; if (is_array($a->profile) && !$a->profile['hide-friends']) { /// @todo What should this value tell us? @@ -86,14 +86,14 @@ function noscrape_init(App $a) $json_info["last-activity"] = date("o-W", $last_active); //These are optional fields. - $profile_fields = array('pdesc', 'locality', 'region', 'postal-code', 'country-name', 'gender', 'marital', 'about'); + $profile_fields = ['pdesc', 'locality', 'region', 'postal-code', 'country-name', 'gender', 'marital', 'about']; foreach ($profile_fields as $field) { if (!empty($a->profile[$field])) { $json_info["$field"] = $a->profile[$field]; } } - $dfrn_pages = array('request', 'confirm', 'notify', 'poll'); + $dfrn_pages = ['request', 'confirm', 'notify', 'poll']; foreach ($dfrn_pages as $dfrn) { $json_info["dfrn-{$dfrn}"] = System::baseUrl()."/dfrn_{$dfrn}/{$which}"; } diff --git a/mod/notes.php b/mod/notes.php index dbf84337ef..a98577e546 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -34,7 +34,7 @@ function notes_content(App $a, $update = false) { require_once('include/security.php'); require_once('include/conversation.php'); require_once('include/acl_selectors.php'); - $groups = array(); + $groups = []; $o = ''; @@ -55,7 +55,7 @@ function notes_content(App $a, $update = false) { $commpage = false; $commvisitor = false; - $x = array( + $x = [ 'is_owner' => $is_owner, 'allow_location' => (($a->user['allow_location']) ? true : false), 'default_location' => $a->user['default-location'], @@ -67,7 +67,7 @@ function notes_content(App $a, $update = false) { 'profile_uid' => local_user(), 'button' => t('Save'), 'acl_data' => '', - ); + ]; $o .= status_editor($a,$x,$a->contact['id']); @@ -106,7 +106,7 @@ function notes_content(App $a, $update = false) { ); - $parents_arr = array(); + $parents_arr = []; $parents_str = ''; if (DBM::is_result($r)) { diff --git a/mod/notifications.php b/mod/notifications.php index e2de81e6c7..4d549b46db 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -86,7 +86,7 @@ function notifications_content(App $a) { $o = ''; // Get the nav tabs for the notification pages $tabs = $nm->getTabs(); - $notif_content = array(); + $notif_content = []; // Notification results per page $perpage = 20; @@ -149,10 +149,10 @@ function notifications_content(App $a) { $tpl = get_markup_template("intros.tpl"); // The link to switch between ignored and normal connection requests - $notif_show_lnk = array( + $notif_show_lnk = [ 'href' => (!$all ? 'notifications/intros/all' : 'notifications/intros' ), 'text' => (!$all ? t('Show Ignored Requests') : t('Hide Ignored Requests')) - ); + ]; // Loop through all introduction notifications.This creates an array with the output html for each // introduction @@ -162,7 +162,7 @@ function notifications_content(App $a) { // We have to distinguish between these two because they use different data. switch ($it['label']) { case 'friend_suggestion': - $notif_content[] = replace_macros($sugg, array( + $notif_content[] = replace_macros($sugg, [ '$str_notifytype' => t('Notification type: '), '$notify_type' => $it['notify_type'], '$intro_id' => $it['intro_id'], @@ -171,8 +171,8 @@ function notifications_content(App $a) { '$photo' => $it['photo'], '$fullname' => $it['name'], '$url' => $it['url'], - '$hidden' => array('hidden', t('Hide this contact from others'), ($it['hidden'] == 1), ''), - '$activity' => array('activity', t('Post a new friend activity'), $it['post_newfriend'], t('if applicable')), + '$hidden' => ['hidden', t('Hide this contact from others'), ($it['hidden'] == 1), ''], + '$activity' => ['activity', t('Post a new friend activity'), $it['post_newfriend'], t('if applicable')], '$knowyou' => $it['knowyou'], '$approve' => t('Approve'), @@ -180,7 +180,7 @@ function notifications_content(App $a) { '$request' => $it['request'], '$ignore' => t('Ignore'), '$discard' => t('Discard'), - )); + ]); break; // Normal connection requests @@ -207,7 +207,7 @@ function notifications_content(App $a) { } } - $dfrn_text = replace_macros($dfrn_tpl,array( + $dfrn_text = replace_macros($dfrn_tpl,[ '$intro_id' => $it['intro_id'], '$friend_selected' => $friend_selected, '$fan_selected' => $fan_selected, @@ -216,7 +216,7 @@ function notifications_content(App $a) { '$approve_as3' => $helptext3, '$as_friend' => t('Friend'), '$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Subscriber')) - )); + ]); $header = $it["name"]; @@ -231,7 +231,7 @@ function notifications_content(App $a) { $discard = ''; } - $notif_content[] = replace_macros($tpl, array( + $notif_content[] = replace_macros($tpl, [ '$header' => htmlentities($header), '$str_notifytype' => t('Notification type: '), '$notify_type' => $it['notify_type'], @@ -250,8 +250,8 @@ function notifications_content(App $a) { '$lbl_keywords' => t('Tags:'), '$gender' => $it['gender'], '$lbl_gender' => t('Gender:'), - '$hidden' => array('hidden', t('Hide this contact from others'), ($it['hidden'] == 1), ''), - '$activity' => array('activity', t('Post a new friend activity'), $it['post_newfriend'], t('if applicable')), + '$hidden' => ['hidden', t('Hide this contact from others'), ($it['hidden'] == 1), ''], + '$activity' => ['activity', t('Post a new friend activity'), $it['post_newfriend'], t('if applicable')], '$url' => $it['url'], '$zrl' => $it['zrl'], '$lbl_url' => t('Profile URL'), @@ -265,7 +265,7 @@ function notifications_content(App $a) { '$ignore' => t('Ignore'), '$discard' => $discard, - )); + ]); break; } } @@ -295,7 +295,7 @@ function notifications_content(App $a) { $tpl_var_name = 'tpl_item_'.$it['label']; $tpl_notif = get_markup_template($$tpl_var_name); - $notif_content[] = replace_macros($tpl_notif,array( + $notif_content[] = replace_macros($tpl_notif,[ '$item_label' => $it['label'], '$item_link' => $it['link'], '$item_image' => $it['image'], @@ -304,16 +304,16 @@ function notifications_content(App $a) { '$item_when' => $it['when'], '$item_ago' => $it['ago'], '$item_seen' => $it['seen'], - )); + ]); } // It doesn't make sense to show the Show unread / Show all link visible if the user is on the // "Show all" page and there are no notifications. So we will hide it. if($show == 0 || intval($show) && $notifs['total'] > 0) { - $notif_show_lnk = array( + $notif_show_lnk = [ 'href' => ($show ? 'notifications/'.$notifs['ident'] : 'notifications/'.$notifs['ident'].'?show=all' ), 'text' => ($show ? t('Show unread') : t('Show all')), - ); + ]; } // Output if there aren't any notifications available @@ -321,14 +321,14 @@ function notifications_content(App $a) { $notif_nocontent = sprintf( t('No more %s notifications.'), $notifs['ident']); } - $o .= replace_macros($notif_tpl, array( + $o .= replace_macros($notif_tpl, [ '$notif_header' => $notif_header, '$tabs' => $tabs, '$notif_content' => $notif_content, '$notif_nocontent' => $notif_nocontent, '$notif_show_lnk' => $notif_show_lnk, '$notif_paginate' => paginate($a) - )); + ]); return $o; } diff --git a/mod/notify.php b/mod/notify.php index 913f83f9be..2cb434ae98 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -37,7 +37,7 @@ function notify_init(App $a) { if ($a->argc > 2 && $a->argv[1] === 'mark' && $a->argv[2] === 'all' ) { $r = $nm->setAllSeen(); - $j = json_encode(array('result' => ($r) ? 'success' : 'fail')); + $j = json_encode(['result' => ($r) ? 'success' : 'fail']); echo $j; killme(); } @@ -56,25 +56,25 @@ function notify_content(App $a) { $not_tpl = get_markup_template('notify.tpl'); require_once('include/bbcode.php'); - $r = $nm->getAll(array('seen'=>0)); + $r = $nm->getAll(['seen'=>0]); if (DBM::is_result($r) > 0) { foreach ($r as $it) { - $notif_content .= replace_macros($not_tpl,array( + $notif_content .= replace_macros($not_tpl,[ '$item_link' => System::baseUrl(true).'/notify/view/'. $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date']) - )); + ]); } } else { $notif_content .= t('No more system notifications.'); } - $o .= replace_macros($notif_tpl, array( + $o .= replace_macros($notif_tpl, [ '$notif_header' => t('System Notifications'), '$tabs' => false, // $tabs, '$notif_content' => $notif_content, - )); + ]); return $o; diff --git a/mod/oexchange.php b/mod/oexchange.php index 37dc76545f..19617391dd 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -9,7 +9,7 @@ function oexchange_init(App $a) { if (($a->argc > 1) && ($a->argv[1] === 'xrd')) { $tpl = get_markup_template('oexchange_xrd.tpl'); - $o = replace_macros($tpl, array('$base' => System::baseUrl())); + $o = replace_macros($tpl, ['$base' => System::baseUrl()]); echo $o; killme(); } @@ -44,7 +44,7 @@ function oexchange_content(App $a) { require_once('include/html2bbcode.php'); - $post = array(); + $post = []; $post['profile_uid'] = local_user(); $post['return'] = '/oexchange/done' ; diff --git a/mod/opensearch.php b/mod/opensearch.php index c61f4674b1..8a427908bc 100644 --- a/mod/opensearch.php +++ b/mod/opensearch.php @@ -9,10 +9,10 @@ function opensearch_content(App $a) { header("Content-type: application/opensearchdescription+xml"); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$baseurl' => System::baseUrl(), '$nodename' => $a->get_hostname(), - )); + ]); echo $o; diff --git a/mod/parse_url.php b/mod/parse_url.php index 4fabba6c7e..dbe45aba15 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -59,10 +59,10 @@ function parse_url_content(App $a) { // the URL with the corresponding BBCode media tag $redirects = 0; // Fetch the header of the URL - $result = z_fetch_url($url, false, $redirects, array("novalidate" => true, "nobody" => true)); + $result = z_fetch_url($url, false, $redirects, ["novalidate" => true, "nobody" => true]); if($result["success"]) { // Convert the header fields into an array - $hdrs = array(); + $hdrs = []; $h = explode("\n", $result["header"]); foreach ($h as $l) { list($k,$v) = array_map("trim", explode(":", trim($l), 2)); @@ -89,7 +89,7 @@ function parse_url_content(App $a) { $template = "[bookmark=%s]%s[/bookmark]%s"; - $arr = array("url" => $url, "text" => ""); + $arr = ["url" => $url, "text" => ""]; call_hooks("parse_link", $arr); @@ -102,7 +102,7 @@ function parse_url_content(App $a) { // need to parse the url for content. if ($url && $title && $text) { - $title = str_replace(array("\r","\n"),array("",""),$title); + $title = str_replace(["\r","\n"],["",""],$title); $text = "[quote]" . trim($text) . "[/quote]" . $br; diff --git a/mod/photo.php b/mod/photo.php index dc7d856783..e899d671d6 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -71,7 +71,7 @@ function photo_init(App $a) break; } - $uid = str_replace(array('.jpg', '.png', '.gif'), array('', '', ''), $person); + $uid = str_replace(['.jpg', '.png', '.gif'], ['', '', ''], $person); foreach (Image::supportedTypes() AS $m => $e) { $uid = str_replace('.' . $e, '', $uid); @@ -92,7 +92,7 @@ function photo_init(App $a) } else { // Other photos $resolution = 0; - $photo = str_replace(array('.jpg', '.png', '.gif'), array('', '', ''), $photo); + $photo = str_replace(['.jpg', '.png', '.gif'], ['', '', ''], $photo); foreach (Image::supportedTypes() AS $m => $e) { $photo = str_replace('.' . $e, '', $photo); diff --git a/mod/photos.php b/mod/photos.php index ac1f06f8e8..5714b0e866 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -55,20 +55,20 @@ function photos_init(App $a) { $tpl = get_markup_template("vcard-widget.tpl"); - $vcard_widget = replace_macros($tpl, array( + $vcard_widget = replace_macros($tpl, [ '$name' => $profile['name'], '$photo' => $profile['photo'], '$addr' => defaults($profile, 'addr', ''), '$account_type' => $account_type, '$pdesc' => defaults($profile, 'pdesc', ''), - )); + ]); $albums = Photo::getAlbums($a->data['user']['uid']); $albums_visible = ((intval($a->data['user']['hidewall']) && !local_user() && !remote_user()) ? false : true); // add various encodings to the array so we can just loop through and pick them out in a template - $ret = array('success' => false); + $ret = ['success' => false]; if ($albums) { $a->data['albums'] = $albums; @@ -76,18 +76,18 @@ function photos_init(App $a) { $ret['success'] = true; } - $ret['albums'] = array(); + $ret['albums'] = []; foreach ($albums as $k => $album) { //hide profile photos to others if (!$is_owner && !remote_user() && ($album['album'] == t('Profile Photos'))) continue; - $entry = array( + $entry = [ 'text' => $album['album'], 'total' => $album['total'], 'url' => 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album['album']), 'urlencode' => urlencode($album['album']), 'bin2hex' => bin2hex($album['album']) - ); + ]; $ret['albums'][] = $entry; } } @@ -97,15 +97,15 @@ function photos_init(App $a) { } if ($ret['success']) { - $photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'), array( + $photo_albums_widget = replace_macros(get_markup_template('photo_albums.tpl'), [ '$nick' => $a->data['user']['nickname'], '$title' => t('Photo Albums'), '$recent' => t('Recent Photos'), '$albums' => $ret['albums'], '$baseurl' => System::baseUrl(), - '$upload' => array(t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload'), + '$upload' => [t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload'], '$can_post' => $can_post - )); + ]); } @@ -116,9 +116,9 @@ function photos_init(App $a) { $a->page['aside'] .= $photo_albums_widget; $tpl = get_markup_template("photos_head.tpl"); - $a->page['htmlhead'] .= replace_macros($tpl,array( + $a->page['htmlhead'] .= replace_macros($tpl,[ '$ispublic' => t('everybody') - )); + ]); } return; @@ -229,10 +229,10 @@ function photos_post(App $a) // Check if we should do HTML-based delete confirmation if (x($_REQUEST, 'confirm')) { $drop_url = $a->query_string; - $extra_inputs = array( - array('name' => 'albumname', 'value' => $_POST['albumname']), - ); - $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array( + $extra_inputs = [ + ['name' => 'albumname', 'value' => $_POST['albumname']], + ]; + $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ '$method' => 'post', '$message' => t('Do you really want to delete this photo album and all its photos?'), '$extra_inputs' => $extra_inputs, @@ -240,12 +240,12 @@ function photos_post(App $a) '$confirm_url' => $drop_url, '$confirm_name' => 'dropalbum', // Needed so that confirmation will bring us back into this if statement '$cancel' => t('Cancel'), - )); + ]); $a->error = 1; // Set $a->error so the other module functions don't execute return; } - $res = array(); + $res = []; // get the list of photos we are about to delete @@ -321,15 +321,15 @@ function photos_post(App $a) // Check if we should do HTML-based delete confirmation if (x($_REQUEST, 'confirm')) { $drop_url = $a->query_string; - $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array( + $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ '$method' => 'post', '$message' => t('Do you really want to delete this photo?'), - '$extra_inputs' => array(), + '$extra_inputs' => [], '$confirm' => t('Delete Photo'), '$confirm_url' => $drop_url, '$confirm_name' => 'delete', // Needed so that confirmation will bring us back into this if statement '$cancel' => t('Cancel'), - )); + ]); $a->error = 1; // Set $a->error so the other module functions don't execute return; } @@ -489,7 +489,7 @@ function photos_post(App $a) $title = ''; $uri = item_new_uri($a->get_hostname(),$page_owner_uid); - $arr = array(); + $arr = []; $arr['guid'] = get_guid(32); $arr['uid'] = $page_owner_uid; $arr['uri'] = $uri; @@ -541,7 +541,7 @@ function photos_post(App $a) $rawtags = '#' . $rawtags; } - $taginfo = array(); + $taginfo = []; $tags = get_tags($rawtags); if (count($tags)) { @@ -566,7 +566,7 @@ function photos_post(App $a) } } } - $taginfo[] = array($newname, $profile, $salmon); + $taginfo[] = [$newname, $profile, $salmon]; } else { $newname = $name; $alias = ''; @@ -611,9 +611,9 @@ function photos_post(App $a) } if ($profile) { if (substr($notify, 0, 4) === 'cid:') { - $taginfo[] = array($newname, $profile, $notify, $r[0], '@[url=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/url]'); + $taginfo[] = [$newname, $profile, $notify, $r[0], '@[url=' . str_replace(',','%2c',$profile) . ']' . $newname . '[/url]']; } else { - $taginfo[] = array($newname, $profile, $notify, null, $str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]'); + $taginfo[] = [$newname, $profile, $notify, null, $str_tags .= '@[url=' . $profile . ']' . $newname . '[/url]']; } if (strlen($str_tags)) { $str_tags .= ','; @@ -667,7 +667,7 @@ function photos_post(App $a) foreach ($taginfo as $tagged) { $uri = item_new_uri($a->get_hostname(), $page_owner_uid); - $arr = array(); + $arr = []; $arr['guid'] = get_guid(32); $arr['uid'] = $page_owner_uid; $arr['uri'] = $uri; @@ -769,7 +769,7 @@ function photos_post(App $a) $str_group_deny = perms2str(is_array($group_deny) ? $group_deny : explode(',', $group_deny)); $str_contact_deny = perms2str(is_array($contact_deny) ? $contact_deny : explode(',', $contact_deny)); - $ret = array('src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''); + $ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => '']; call_hooks('photo_post_file', $ret); @@ -899,7 +899,7 @@ function photos_post(App $a) $lon = Photo::getGps($exif['GPS']['GPSLongitude'], $exif['GPS']['GPSLongitudeRef']); } - $arr = array(); + $arr = []; if ($lat && $lon) { $arr['coord'] = $lat . ' ' . $lon; } @@ -1101,16 +1101,16 @@ function photos_content(App $a) $uploader = ''; - $ret = array('post_url' => 'photos/' . $a->data['user']['nickname'], + $ret = ['post_url' => 'photos/' . $a->data['user']['nickname'], 'addon_text' => $uploader, - 'default_upload' => true); + 'default_upload' => true]; call_hooks('photo_upload_form',$ret); - $default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), array()); - $default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), array( + $default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), []); + $default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), [ '$submit' => t('Submit'), - )); + ]); $usage_message = ''; @@ -1118,7 +1118,7 @@ function photos_content(App $a) $aclselect_e = ($visitor ? '' : populate_acl($a->user)); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$pagename' => t('Upload Photos'), '$sessid' => session_id(), '$usage' => $usage_message, @@ -1138,7 +1138,7 @@ function photos_content(App $a) '$group_perms' => t('Show to Groups'), '$contact_perms' => t('Show to Contacts'), '$return_path' => $a->query_string, - )); + ]); return $o; } @@ -1184,29 +1184,29 @@ function photos_content(App $a) $album_e = $album; - $o .= replace_macros($edit_tpl,array( + $o .= replace_macros($edit_tpl,[ '$nametext' => t('New album name: '), '$nickname' => $a->data['user']['nickname'], '$album' => $album_e, '$hexalbum' => bin2hex($album), '$submit' => t('Submit'), '$dropsubmit' => t('Delete Album') - )); + ]); } } } else { if (($album !== t('Profile Photos')) && ($album !== 'Contact Photos') && ($album !== t('Contact Photos')) && $can_post) { - $edit = array(t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit'); + $edit = [t('Edit Album'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '/edit']; } } if ($order_field === 'posted') { - $order = array(t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album)); + $order = [t('Show Newest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album)]; } else { - $order = array(t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted'); + $order = [t('Show Oldest First'), 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($album) . '?f=&order=posted']; } - $photos = array(); + $photos = []; if (DBM::is_result($r)) { // "Twist" is only used for the duepunto theme with style "slackr" @@ -1219,7 +1219,7 @@ function photos_content(App $a) $imgalt_e = $rr['filename']; $desc_e = $rr['desc']; - $photos[] = array( + $photos[] = [ 'id' => $rr['id'], 'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4), 'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'] @@ -1230,20 +1230,20 @@ function photos_content(App $a) 'desc'=> $desc_e, 'ext' => $ext, 'hash'=> $rr['resource-id'], - ); + ]; } } $tpl = get_markup_template('photo_album.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$photos' => $photos, '$album' => $album, '$can_post' => $can_post, - '$upload' => array(t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)), + '$upload' => [t('Upload New Photos'), 'photos/' . $a->data['user']['nickname'] . '/upload/' . bin2hex($album)], '$order' => $order, '$edit' => $edit, '$paginate' => paginate($a), - )); + ]); return $o; @@ -1329,10 +1329,10 @@ function photos_content(App $a) $lock = null; if ($can_post && ($ph[0]['uid'] == $owner_uid)) { - $tools = array( - 'edit' => array('photos/' . $a->data['user']['nickname'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))), - 'profile'=>array('profile_photo/use/'.$ph[0]['resource-id'], t('Use as profile photo')), - ); + $tools = [ + 'edit' => ['photos/' . $a->data['user']['nickname'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))], + 'profile'=>['profile_photo/use/'.$ph[0]['resource-id'], t('Use as profile photo')], + ]; // lock $lock = ( ( ($ph[0]['uid'] == local_user()) && (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid']) @@ -1345,16 +1345,16 @@ function photos_content(App $a) if ( $cmd === 'edit') { $tpl = get_markup_template('photo_edit_head.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl,array( + $a->page['htmlhead'] .= replace_macros($tpl,[ '$prevlink' => $prevlink, '$nextlink' => $nextlink - )); + ]); } if ($prevlink) - $prevlink = array($prevlink, '') ; + $prevlink = [$prevlink, ''] ; - $photo = array( + $photo = [ 'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']], 'title'=> t('View Full Size'), 'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis'), @@ -1362,10 +1362,10 @@ function photos_content(App $a) 'width' => $hires['width'], 'album' => $hires['album'], 'filename' => $hires['filename'], - ); + ]; if ($nextlink) { - $nextlink = array($nextlink, ''); + $nextlink = [$nextlink, '']; } @@ -1447,7 +1447,7 @@ function photos_content(App $a) } $tag_str .= bbcode($t); } - $tags = array(t('Tags: '), $tag_str); + $tags = [t('Tags: '), $tag_str]; if ($cmd === 'edit') { $tags[] = 'tagrm/' . $link_item['id']; $tags[] = t('[Remove any tag]'); @@ -1463,14 +1463,14 @@ function photos_content(App $a) $caption_e = $ph[0]['desc']; $aclselect_e = populate_acl($ph[0]); - $edit = replace_macros($edit_tpl, array( + $edit = replace_macros($edit_tpl, [ '$id' => $ph[0]['id'], - '$album' => array('albname', t('New album name'), $album_e,''), - '$caption' => array('desc', t('Caption'), $caption_e, ''), - '$tags' => array('newtag', t('Add a Tag'), "", t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping')), - '$rotate_none' => array('rotate', t('Do not rotate'),0,'', true), - '$rotate_cw' => array('rotate', t('Rotate CW (right)'),1,''), - '$rotate_ccw' => array('rotate', t('Rotate CCW (left)'),2,''), + '$album' => ['albname', t('New album name'), $album_e,''], + '$caption' => ['desc', t('Caption'), $caption_e, ''], + '$tags' => ['newtag', t('Add a Tag'), "", t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping')], + '$rotate_none' => ['rotate', t('Do not rotate'),0,'', true], + '$rotate_cw' => ['rotate', t('Rotate CW (right)'),1,''], + '$rotate_ccw' => ['rotate', t('Rotate CCW (left)'),2,''], '$nickname' => $a->data['user']['nickname'], '$resource_id' => $ph[0]['resource-id'], @@ -1485,7 +1485,7 @@ function photos_content(App $a) '$group_perms' => t('Show to Groups'), '$contact_perms' => t('Show to Contacts'), '$return_path' => $a->query_string, - )); + ]); } $like = ''; @@ -1502,18 +1502,18 @@ function photos_content(App $a) if ($can_post || can_write_wall($owner_uid)) { $like_tpl = get_markup_template('like_noshare.tpl'); - $likebuttons = replace_macros($like_tpl, array( + $likebuttons = replace_macros($like_tpl, [ '$id' => $link_item['id'], '$likethis' => t("I like this \x28toggle\x29"), '$nolike' => (Feature::isEnabled(local_user(), 'dislike') ? t("I don't like this \x28toggle\x29") : ''), '$wait' => t('Please wait'), '$return_path' => $a->query_string, - )); + ]); } if (!DBM::is_result($r)) { if (($can_post || can_write_wall($owner_uid)) && $link_item['last-child']) { - $comments .= replace_macros($cmnt_tpl, array( + $comments .= replace_macros($cmnt_tpl, [ '$return_path' => '', '$jsreload' => $return_url, '$type' => 'wall-comment', @@ -1529,14 +1529,14 @@ function photos_content(App $a) '$sourceapp' => t($a->sourcename), '$ww' => '', '$rand_num' => random_digits(12) - )); + ]); } } - $conv_responses = array( - 'like' => array('title' => t('Likes','title')),'dislike' => array('title' => t('Dislikes','title')), - 'attendyes' => array('title' => t('Attending','title')), 'attendno' => array('title' => t('Not attending','title')), 'attendmaybe' => array('title' => t('Might attend','title')) - ); + $conv_responses = [ + 'like' => ['title' => t('Likes','title')],'dislike' => ['title' => t('Dislikes','title')], + 'attendyes' => ['title' => t('Attending','title')], 'attendno' => ['title' => t('Not attending','title')], 'attendmaybe' => ['title' => t('Might attend','title')] + ]; // display comments if (DBM::is_result($r)) { @@ -1552,7 +1552,7 @@ function photos_content(App $a) } if (($can_post || can_write_wall($owner_uid)) && $link_item['last-child']) { - $comments .= replace_macros($cmnt_tpl,array( + $comments .= replace_macros($cmnt_tpl,[ '$return_path' => '', '$jsreload' => $return_url, '$type' => 'wall-comment', @@ -1568,7 +1568,7 @@ function photos_content(App $a) '$sourceapp' => t($a->sourcename), '$ww' => '', '$rand_num' => random_digits(12) - )); + ]); } foreach ($r as $item) { @@ -1599,18 +1599,18 @@ function photos_content(App $a) $profile_link = $profile_url; $dropping = (($item['contact-id'] == $contact_id) || ($item['uid'] == local_user())); - $drop = array( + $drop = [ 'dropping' => $dropping, 'pagedrop' => false, 'select' => t('Select'), 'delete' => t('Delete'), - ); + ]; $name_e = $profile_name; $title_e = $item['title']; $body_e = bbcode($item['body']); - $comments .= replace_macros($template,array( + $comments .= replace_macros($template,[ '$id' => $item['item_id'], '$profile_url' => $profile_link, '$name' => $name_e, @@ -1622,10 +1622,10 @@ function photos_content(App $a) '$indent' => (($item['parent'] != $item['item_id']) ? ' comment' : ''), '$drop' => $drop, '$comment' => $comment - )); + ]); if (($can_post || can_write_wall($owner_uid)) && $item['last-child']) { - $comments .= replace_macros($cmnt_tpl, array( + $comments .= replace_macros($cmnt_tpl, [ '$return_path' => '', '$jsreload' => $return_url, '$type' => 'wall-comment', @@ -1641,11 +1641,11 @@ function photos_content(App $a) '$sourceapp' => t($a->sourcename), '$ww' => '', '$rand_num' => random_digits(12) - )); + ]); } } } - $response_verbs = array('like'); + $response_verbs = ['like']; if (Feature::isEnabled($owner_uid, 'dislike')) { $response_verbs[] = 'dislike'; } @@ -1655,7 +1655,7 @@ function photos_content(App $a) } $photo_tpl = get_markup_template('photo_view.tpl'); - $o .= replace_macros($photo_tpl, array( + $o .= replace_macros($photo_tpl, [ '$id' => $ph[0]['id'], '$album' => [$album_link, $ph[0]['album']], '$tools' => $tools, @@ -1674,7 +1674,7 @@ function photos_content(App $a) 'responses' => $responses, '$comments' => $comments, '$paginate' => $paginate, - )); + ]); $a->page['htmlhead'] .= "\n" . '' . "\n"; $a->page['htmlhead'] .= '' . "\n"; @@ -1711,7 +1711,7 @@ function photos_content(App $a) intval($a->pager['itemspage']) ); - $photos = array(); + $photos = []; if (DBM::is_result($r)) { // "Twist" is only used for the duepunto theme with style "slackr" $twist = false; @@ -1727,31 +1727,31 @@ function photos_content(App $a) $alt_e = $rr['filename']; $name_e = $rr['album']; - $photos[] = array( + $photos[] = [ 'id' => $rr['id'], 'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4), 'link' => 'photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'], 'title' => t('View Photo'), 'src' => 'photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext, 'alt' => $alt_e, - 'album' => array( + 'album' => [ 'link' => 'photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']), 'name' => $name_e, 'alt' => t('View Album'), - ), + ], - ); + ]; } } $tpl = get_markup_template('photos_recent.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$title' => t('Recent Photos'), '$can_post' => $can_post, - '$upload' => array(t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'), + '$upload' => [t('Upload New Photos'), 'photos/'.$a->data['user']['nickname'].'/upload'], '$photos' => $photos, '$paginate' => paginate($a), - )); + ]); return $o; } diff --git a/mod/ping.php b/mod/ping.php index d8eaa8126f..9dd6780d01 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -60,15 +60,15 @@ function ping_init(App $a) $format = 'json'; } - $tags = array(); - $comments = array(); - $likes = array(); - $dislikes = array(); - $friends = array(); - $posts = array(); - $regs = array(); - $mails = array(); - $notifications = array(); + $tags = []; + $comments = []; + $likes = []; + $dislikes = []; + $friends = []; + $posts = []; + $regs = []; + $mails = []; + $notifications = []; $intro_count = 0; $mail_count = 0; @@ -76,8 +76,8 @@ function ping_init(App $a) $network_count = 0; $register_count = 0; $sysnotify_count = 0; - $groups_unseen = array(); - $forums_unseen = array(); + $groups_unseen = []; + $forums_unseen = []; $all_events = 0; $all_events_today = 0; @@ -86,7 +86,7 @@ function ping_init(App $a) $birthdays = 0; $birthdays_today = 0; - $data = array(); + $data = []; $data['intro'] = $intro_count; $data['mail'] = $mail_count; $data['net'] = $network_count; @@ -103,7 +103,7 @@ function ping_init(App $a) if (local_user()) { // Different login session than the page that is calling us. if (intval($_GET['uid']) && intval($_GET['uid']) != local_user()) { - $data = array('result' => array('invalid' => 1)); + $data = ['result' => ['invalid' => 1]]; if ($format == 'json') { if (isset($_GET['callback'])) { @@ -137,7 +137,7 @@ function ping_init(App $a) ); if (DBM::is_result($items_unseen)) { - $arr = array('items' => $items_unseen); + $arr = ['items' => $items_unseen]; call_hooks('network_ping', $arr); foreach ($items_unseen as $item) { @@ -278,7 +278,7 @@ function ping_init(App $a) // merge all notification types in one array if (DBM::is_result($intros)) { foreach ($intros as $intro) { - $notif = array( + $notif = [ 'href' => System::baseUrl() . '/notifications/intros/' . $intro['id'], 'name' => $intro['name'], 'url' => $intro['url'], @@ -286,14 +286,14 @@ function ping_init(App $a) 'date' => $intro['datetime'], 'seen' => false, 'message' => t('{0} wants to be your friend'), - ); + ]; $notifs[] = $notif; } } if (DBM::is_result($mails)) { foreach ($mails as $mail) { - $notif = array( + $notif = [ 'href' => System::baseUrl() . '/message/' . $mail['id'], 'name' => $mail['from-name'], 'url' => $mail['from-url'], @@ -301,14 +301,14 @@ function ping_init(App $a) 'date' => $mail['created'], 'seen' => false, 'message' => t('{0} sent you a message'), - ); + ]; $notifs[] = $notif; } } if (DBM::is_result($regs)) { foreach ($regs as $reg) { - $notif = array( + $notif = [ 'href' => System::baseUrl() . '/admin/users/', 'name' => $reg['name'], 'url' => $reg['url'], @@ -316,7 +316,7 @@ function ping_init(App $a) 'date' => $reg['created'], 'seen' => false, 'message' => t('{0} requested registration'), - ); + ]; $notifs[] = $notif; } } @@ -360,7 +360,7 @@ function ping_init(App $a) $local_time = datetime_convert('UTC', date_default_timezone_get(), $notif['date']); - $notifications[] = array( + $notifications[] = [ 'id' => $notif['id'], 'href' => $notif['href'], 'name' => $notif['name'], @@ -370,13 +370,13 @@ function ping_init(App $a) 'message' => $notif['message'], 'seen' => $notif['seen'], 'timestamp' => strtotime($local_time) - ); + ]; } } } - $sysmsgs = array(); - $sysmsgs_info = array(); + $sysmsgs = []; + $sysmsgs_info = []; if (x($_SESSION, 'sysmsg')) { $sysmsgs = $_SESSION['sysmsg']; @@ -393,12 +393,12 @@ function ping_init(App $a) $data['forums'] = $forums_unseen; $data['notify'] = $sysnotify_count + $intro_count + $mail_count + $register_count; $data['notifications'] = $notifications; - $data['sysmsgs'] = array( + $data['sysmsgs'] = [ 'notice' => $sysmsgs, 'info' => $sysmsgs_info - ); + ]; - $json_payload = json_encode(array("result" => $data)); + $json_payload = json_encode(["result" => $data]); if (isset($_GET['callback'])) { // JSONP support @@ -413,7 +413,7 @@ function ping_init(App $a) $data = ping_format_xml_data($data, $sysnotify_count, $notifications, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen); header("Content-type: text/xml"); - echo XML::fromArray(array("result" => $data), $xml); + echo XML::fromArray(["result" => $data], $xml); } killme(); @@ -427,7 +427,7 @@ function ping_init(App $a) */ function ping_get_notifications($uid) { - $result = array(); + $result = []; $offset = 0; $seen = false; $seensql = "NOT"; @@ -523,11 +523,11 @@ function ping_get_notifications($uid) */ function ping_format_xml_data($data, $sysnotify, $notifs, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen) { - $notifications = array(); + $notifications = []; foreach ($notifs as $key => $notif) { $notifications[$key . ':note'] = $notif['message']; - $notifications[$key . ':@attributes'] = array( + $notifications[$key . ':@attributes'] = [ 'id' => $notif['id'], 'href' => $notif['href'], 'name' => $notif['name'], @@ -536,10 +536,10 @@ function ping_format_xml_data($data, $sysnotify, $notifs, $sysmsgs, $sysmsgs_inf 'date' => $notif['date'], 'seen' => $notif['seen'], 'timestamp' => $notif['timestamp'] - ); + ]; } - $sysmsg = array(); + $sysmsg = []; foreach ($sysmsgs as $key => $m) { $sysmsg[$key . ':notice'] = $m; } @@ -548,27 +548,27 @@ function ping_format_xml_data($data, $sysnotify, $notifs, $sysmsgs, $sysmsgs_inf } $data['notif'] = $notifications; - $data['@attributes'] = array('count' => $sysnotify_count + $data['intro'] + $data['mail'] + $data['register']); + $data['@attributes'] = ['count' => $sysnotify_count + $data['intro'] + $data['mail'] + $data['register']]; $data['sysmsgs'] = $sysmsg; if ($data['register'] == 0) { unset($data['register']); } - $groups = array(); + $groups = []; if (count($groups_unseen)) { foreach ($groups_unseen as $key => $item) { $groups[$key . ':group'] = $item['count']; - $groups[$key . ':@attributes'] = array('id' => $item['id']); + $groups[$key . ':@attributes'] = ['id' => $item['id']]; } $data['groups'] = $groups; } - $forums = array(); + $forums = []; if (count($forums_unseen)) { foreach ($forums_unseen as $key => $item) { $forums[$count . ':forum'] = $item['count']; - $forums[$count . ':@attributes'] = array('id' => $item['id']); + $forums[$count . ':@attributes'] = ['id' => $item['id']]; } $data['forums'] = $forums; } diff --git a/mod/poco.php b/mod/poco.php index 2e2791fc1e..761a9c2b80 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -152,7 +152,7 @@ function poco_init(App $a) { } logger("Query done", LOGGER_DEBUG); - $ret = array(); + $ret = []; if (x($_GET, 'sorted')) { $ret['sorted'] = false; } @@ -165,10 +165,10 @@ function poco_init(App $a) { $ret['startIndex'] = (int) $startIndex; $ret['itemsPerPage'] = (int) $itemsPerPage; $ret['totalResults'] = (int) $totalResults; - $ret['entry'] = array(); + $ret['entry'] = []; - $fields_ret = array( + $fields_ret = [ 'id' => false, 'displayName' => false, 'urls' => false, @@ -183,7 +183,7 @@ function poco_init(App $a) { 'address' => false, 'contactType' => false, 'generation' => false - ); + ]; if ((! x($_GET, 'fields')) || ($_GET['fields'] === '@all')) { foreach ($fields_ret as $k => $v) { @@ -254,7 +254,7 @@ function poco_init(App $a) { $contact['gender'] = ""; } - $entry = array(); + $entry = []; if ($fields_ret['id']) { $entry['id'] = (int)$contact['id']; } @@ -274,9 +274,9 @@ function poco_init(App $a) { $entry['generation'] = (int)$contact['generation']; } if ($fields_ret['urls']) { - $entry['urls'] = array(array('value' => $contact['url'], 'type' => 'profile')); + $entry['urls'] = [['value' => $contact['url'], 'type' => 'profile']]; if ($contact['addr'] && ($contact['network'] !== NETWORK_MAIL)) { - $entry['urls'][] = array('value' => 'acct:' . $contact['addr'], 'type' => 'webfinger'); + $entry['urls'][] = ['value' => 'acct:' . $contact['addr'], 'type' => 'webfinger']; } } if ($fields_ret['preferredUsername']) { @@ -301,7 +301,7 @@ function poco_init(App $a) { $entry['updated'] = date("c", strtotime($entry['updated'])); } if ($fields_ret['photos']) { - $entry['photos'] = array(array('value' => $contact['photo'], 'type' => 'profile')); + $entry['photos'] = [['value' => $contact['photo'], 'type' => 'profile']]; } if ($fields_ret['network']) { $entry['network'] = $contact['network']; @@ -316,7 +316,7 @@ function poco_init(App $a) { $tags = str_replace(",", " ", $contact['keywords']); $tags = explode(" ", $tags); - $cleaned = array(); + $cleaned = []; foreach ($tags as $tag) { $tag = trim(strtolower($tag)); if ($tag != "") { @@ -324,10 +324,10 @@ function poco_init(App $a) { } } - $entry['tags'] = array($cleaned); + $entry['tags'] = [$cleaned]; } if ($fields_ret['address']) { - $entry['address'] = array(); + $entry['address'] = []; // Deactivated. It just reveals too much data. (Although its from the default profile) //if (isset($rr['paddress'])) @@ -354,7 +354,7 @@ function poco_init(App $a) { $ret['entry'][] = $entry; } } else { - $ret['entry'][] = array(); + $ret['entry'][] = []; } } else { http_status_exit(500); @@ -363,7 +363,7 @@ function poco_init(App $a) { if ($format === 'xml') { header('Content-type: text/xml'); - echo replace_macros(get_markup_template('poco_xml.tpl'), array_xmlify(array('$response' => $ret))); + echo replace_macros(get_markup_template('poco_xml.tpl'), array_xmlify(['$response' => $ret])); killme(); } if ($format === 'json') { diff --git a/mod/poke.php b/mod/poke.php index 2f989dd7d3..8b36b17dce 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -97,7 +97,7 @@ function poke_init(App $a) { $uri = item_new_uri($a->get_hostname(),$uid); - $arr = array(); + $arr = []; $arr['guid'] = get_guid(32); $arr['uid'] = $uid; @@ -177,10 +177,10 @@ function poke_content(App $a) { $base = System::baseUrl(); $head_tpl = get_markup_template('poke_head.tpl'); - $a->page['htmlhead'] .= replace_macros($head_tpl,array( + $a->page['htmlhead'] .= replace_macros($head_tpl,[ '$baseurl' => System::baseUrl(true), '$base' => $base - )); + ]); $parent = ((x($_GET,'parent')) ? intval($_GET['parent']) : '0'); @@ -188,15 +188,15 @@ function poke_content(App $a) { $verbs = get_poke_verbs(); - $shortlist = array(); + $shortlist = []; foreach($verbs as $k => $v) if($v[1] !== 'NOTRANSLATION') - $shortlist[] = array($k,$v[1]); + $shortlist[] = [$k,$v[1]]; $tpl = get_markup_template('poke_content.tpl'); - $o = replace_macros($tpl,array( + $o = replace_macros($tpl,[ '$title' => t('Poke/Prod'), '$desc' => t('poke, prod or do other things to somebody'), '$clabel' => t('Recipient'), @@ -207,7 +207,7 @@ function poke_content(App $a) { '$submit' => t('Submit'), '$name' => $name, '$id' => $id - )); + ]); return $o; diff --git a/mod/pretheme.php b/mod/pretheme.php index b4eaa05536..be92885b72 100644 --- a/mod/pretheme.php +++ b/mod/pretheme.php @@ -17,7 +17,7 @@ function pretheme_init(App $a) { $version = ''; $credits = ''; } - echo json_encode(array('img' => get_theme_screenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits)); + echo json_encode(['img' => get_theme_screenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits]); } killme(); diff --git a/mod/probe.php b/mod/probe.php index dfd4792c9b..639788aa8b 100644 --- a/mod/probe.php +++ b/mod/probe.php @@ -6,8 +6,8 @@ use Friendica\Network\Probe; function probe_content(App $a) { if (!local_user()) { - http_status_exit(403, array("title" => t("Public access denied."), - "description" => t("Only logged in users are permitted to perform a probing."))); + http_status_exit(403, ["title" => t("Public access denied."), + "description" => t("Only logged in users are permitted to perform a probing.")]); killme(); } diff --git a/mod/profile.php b/mod/profile.php index 77f8e069d3..1982605127 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -61,7 +61,7 @@ function profile_init(App $a) // site block if (!$blocked && !$userblock) { - $keywords = str_replace(array('#', ',', ' ', ',,'), array('', ' ', ',', ','), defaults($a->profile, 'pub_keywords', '')); + $keywords = str_replace(['#', ',', ' ', ',,'], ['', ' ', ',', ','], defaults($a->profile, 'pub_keywords', '')); if (strlen($keywords)) { $a->page['htmlhead'] .= '' . "\r\n"; } @@ -75,7 +75,7 @@ function profile_init(App $a) $a->page['htmlhead'] .= '' . "\r\n"; header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); - $dfrn_pages = array('request', 'confirm', 'notify', 'poll'); + $dfrn_pages = ['request', 'confirm', 'notify', 'poll']; foreach ($dfrn_pages as $dfrn) { $a->page['htmlhead'] .= "\r\n"; } @@ -116,7 +116,7 @@ function profile_content(App $a, $update = 0) require_once 'include/acl_selectors.php'; require_once 'include/items.php'; - $groups = array(); + $groups = []; $tab = 'posts'; $o = ''; @@ -197,7 +197,7 @@ function profile_content(App $a, $update = 0) $a->page['aside'] .= tagcloud_wall_widget(); if (can_write_wall($a->profile['profile_uid'])) { - $x = array( + $x = [ 'is_owner' => $is_owner, 'allow_location' => ($is_owner || $commvisitor) && $a->profile['allow_location'], 'default_location' => $is_owner ? $a->user['default-location'] : '', @@ -212,7 +212,7 @@ function profile_content(App $a, $update = 0) 'bang' => '', 'visitor' => $is_owner || $commvisitor ? 'block' : 'none', 'profile_uid' => $a->profile['profile_uid'], - ); + ]; $o .= status_editor($a, $x); } @@ -319,7 +319,7 @@ function profile_content(App $a, $update = 0) ); } - $parents_arr = array(); + $parents_arr = []; $parents_str = ''; // Set a time stamp for this page. We will make use of it when we @@ -342,7 +342,7 @@ function profile_content(App $a, $update = 0) $items = conv_sort($items, 'created'); } else { - $items = array(); + $items = []; } if ($is_owner && !$update && !Config::get('theme', 'hide_eventlist')) { @@ -352,10 +352,10 @@ function profile_content(App $a, $update = 0) if ($is_owner) { - $unseen = dba::exists('item', array('wall' => true, 'unseen' => true, 'uid' => local_user())); + $unseen = dba::exists('item', ['wall' => true, 'unseen' => true, 'uid' => local_user()]); if ($unseen) { - $r = dba::update('item', array('unseen' => false), - array('wall' => true, 'unseen' => true, 'uid' => local_user())); + $r = dba::update('item', ['unseen' => false], + ['wall' => true, 'unseen' => true, 'uid' => local_user()]); } } diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 8cd1fcb6a3..f52015155d 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -254,7 +254,7 @@ function profile_photo_content(App $a) { $tpl = get_markup_template('profile_photo.tpl'); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$user' => $a->user['nickname'], '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), @@ -263,7 +263,7 @@ function profile_photo_content(App $a) { '$profiles' => $profiles, '$form_security_token' => get_form_security_token("profile_photo"), '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') - )); + ]); return $o; } @@ -271,7 +271,7 @@ function profile_photo_content(App $a) { $filename = $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'] . '.'.$a->config['imagecrop_ext']; $resolution = $a->config['imagecrop_resolution']; $tpl = get_markup_template("cropbody.tpl"); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$filename' => $filename, '$profile' => intval($_REQUEST['profile']), '$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'], @@ -280,7 +280,7 @@ function profile_photo_content(App $a) { '$desc' => t('Please adjust the image cropping for optimum viewing.'), '$form_security_token' => get_form_security_token("profile_photo"), '$done' => t('Done Editing') - )); + ]); return $o; } @@ -333,7 +333,7 @@ function profile_photo_crop_ui_head(App $a, Image $Image) { $a->config['imagecrop'] = $hash; $a->config['imagecrop_resolution'] = $smallest; $a->config['imagecrop_ext'] = $Image->getExt(); - $a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); - $a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), array()); + $a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []); + $a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), []); return; } diff --git a/mod/profiles.php b/mod/profiles.php index 5fcd2d8f17..93571db9cd 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -154,7 +154,7 @@ function profile_clean_keywords($keywords) { $keywords = str_replace(",", " ", $keywords); $keywords = explode(" ", $keywords); - $cleaned = array(); + $cleaned = []; foreach ($keywords as $keyword) { $keyword = trim(strtolower($keyword)); $keyword = trim($keyword, "#"); @@ -207,7 +207,7 @@ function profiles_post(App $a) { } else { $ignore_year = false; } - if (!in_array($dob, array('0000-00-00', '0001-01-01'))) { + if (!in_array($dob, ['0000-00-00', '0001-01-01'])) { if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) { $ignore_year = true; $dob = substr($dob, 5); @@ -331,7 +331,7 @@ function profiles_post(App $a) { PConfig::set(local_user(), 'system', 'detailled_profile', (($_POST['detailled_profile'] == 1) ? 1: 0)); - $changes = array(); + $changes = []; $value = ''; if ($is_default) { if ($marital != $orig[0]['marital']) { @@ -491,7 +491,7 @@ function profiles_post(App $a) { } if ($is_default) { - $location = Profile::formatLocation(array("locality" => $locality, "region" => $region, "country-name" => $country_name)); + $location = Profile::formatLocation(["locality" => $locality, "region" => $region, "country-name" => $country_name]); q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d", dbesc($about), @@ -541,7 +541,7 @@ function profile_activity($changed, $value) { return; } - $arr = array(); + $arr = []; $arr['guid'] = get_guid(32); $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user()); @@ -624,48 +624,48 @@ function profiles_content(App $a) { notice( t('Profile not found.') . EOL); return; } - - $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( + + $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), [ '$baseurl' => System::baseUrl(true), - )); - $a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), array( + ]); + $a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), [ '$baseurl' => System::baseUrl(true), - )); + ]); $opt_tpl = get_markup_template("profile-hide-friends.tpl"); - $hide_friends = replace_macros($opt_tpl,array( - '$yesno' => array( + $hide_friends = replace_macros($opt_tpl,[ + '$yesno' => [ 'hide-friends', //Name t('Hide contacts and friends:'), //Label !!$r[0]['hide-friends'], //Value '', //Help string - array(t('No'), t('Yes')) //Off - On strings - ), + [t('No'), t('Yes')] //Off - On strings + ], '$desc' => t('Hide your contact/friend list from viewers of this profile?'), '$yes_str' => t('Yes'), '$no_str' => t('No'), '$yes_selected' => (($r[0]['hide-friends']) ? " checked=\"checked\" " : ""), '$no_selected' => (($r[0]['hide-friends'] == 0) ? " checked=\"checked\" " : "") - )); + ]); $personal_account = !(in_array($a->user["page-flags"], - array(PAGE_COMMUNITY, PAGE_PRVGROUP))); + [PAGE_COMMUNITY, PAGE_PRVGROUP])); $detailled_profile = (PConfig::get(local_user(), 'system', 'detailled_profile') AND $personal_account); $is_default = (($r[0]['is-default']) ? 1 : 0); $tpl = get_markup_template("profile_edit.tpl"); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$personal_account' => $personal_account, '$detailled_profile' => $detailled_profile, - '$details' => array( + '$details' => [ 'detailled_profile', //Name t('Show more profile fields:'), //Label $detailled_profile, //Value '', //Help string - array(t('No'), t('Yes')) //Off - On strings - ), + [t('No'), t('Yes')] //Off - On strings + ], '$multi_profiles' => Feature::isEnabled(local_user(), 'multi_profiles'), '$form_security_token' => get_form_security_token("profile_edit"), @@ -703,46 +703,46 @@ function profiles_content(App $a) { '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$baseurl' => System::baseUrl(true), '$profile_id' => $r[0]['id'], - '$profile_name' => array('profile_name', t('Profile Name:'), $r[0]['profile-name'], t('Required'), '*'), + '$profile_name' => ['profile_name', t('Profile Name:'), $r[0]['profile-name'], t('Required'), '*'], '$is_default' => $is_default, '$default' => (($is_default) ? '

    ' . t('This is your public profile.
    It may be visible to anybody using the internet.') . '

    ' : ""), - '$name' => array('name', t('Your Full Name:'), $r[0]['name']), - '$pdesc' => array('pdesc', t('Title/Description:'), $r[0]['pdesc']), + '$name' => ['name', t('Your Full Name:'), $r[0]['name']], + '$pdesc' => ['pdesc', t('Title/Description:'), $r[0]['pdesc']], '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, - '$address' => array('address', t('Street Address:'), $r[0]['address']), - '$locality' => array('locality', t('Locality/City:'), $r[0]['locality']), - '$region' => array('region', t('Region/State:'), $r[0]['region']), - '$postal_code' => array('postal_code', t('Postal/Zip Code:'), $r[0]['postal-code']), - '$country_name' => array('country_name', t('Country:'), $r[0]['country-name']), + '$address' => ['address', t('Street Address:'), $r[0]['address']], + '$locality' => ['locality', t('Locality/City:'), $r[0]['locality']], + '$region' => ['region', t('Region/State:'), $r[0]['region']], + '$postal_code' => ['postal_code', t('Postal/Zip Code:'), $r[0]['postal-code']], + '$country_name' => ['country_name', t('Country:'), $r[0]['country-name']], '$age' => ((intval($r[0]['dob'])) ? '(' . t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''), '$gender' => ContactSelector::gender($r[0]['gender']), '$marital' => ContactSelector::maritalStatus($r[0]['marital']), - '$with' => array('with', t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), t('Examples: cathy123, Cathy Williams, cathy@example.com')), - '$howlong' => array('howlong', t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))), + '$with' => ['with', t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), t('Examples: cathy123, Cathy Williams, cathy@example.com')], + '$howlong' => ['howlong', t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))], '$sexual' => ContactSelector::sexualPreference($r[0]['sexual']), - '$about' => array('about', t('Tell us about yourself...'), $r[0]['about']), - '$xmpp' => array('xmpp', t('XMPP (Jabber) address:'), $r[0]['xmpp'], t("The XMPP address will be propagated to your contacts so that they can follow you.")), - '$homepage' => array('homepage', t('Homepage URL:'), $r[0]['homepage']), - '$hometown' => array('hometown', t('Hometown:'), $r[0]['hometown']), - '$politic' => array('politic', t('Political Views:'), $r[0]['politic']), - '$religion' => array('religion', t('Religious Views:'), $r[0]['religion']), - '$pub_keywords' => array('pub_keywords', t('Public Keywords:'), $r[0]['pub_keywords'], t("\x28Used for suggesting potential friends, can be seen by others\x29")), - '$prv_keywords' => array('prv_keywords', t('Private Keywords:'), $r[0]['prv_keywords'], t("\x28Used for searching profiles, never shown to others\x29")), - '$likes' => array('likes', t('Likes:'), $r[0]['likes']), - '$dislikes' => array('dislikes', t('Dislikes:'), $r[0]['dislikes']), - '$music' => array('music', t('Musical interests'), $r[0]['music']), - '$book' => array('book', t('Books, literature'), $r[0]['book']), - '$tv' => array('tv', t('Television'), $r[0]['tv']), - '$film' => array('film', t('Film/dance/culture/entertainment'), $r[0]['film']), - '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']), - '$romance' => array('romance', t('Love/romance'), $r[0]['romance']), - '$work' => array('work', t('Work/employment'), $r[0]['work']), - '$education' => array('education', t('School/education'), $r[0]['education']), - '$contact' => array('contact', t('Contact information and Social Networks'), $r[0]['contact']), - )); - - $arr = array('profile' => $r[0], 'entry' => $o); + '$about' => ['about', t('Tell us about yourself...'), $r[0]['about']], + '$xmpp' => ['xmpp', t('XMPP (Jabber) address:'), $r[0]['xmpp'], t("The XMPP address will be propagated to your contacts so that they can follow you.")], + '$homepage' => ['homepage', t('Homepage URL:'), $r[0]['homepage']], + '$hometown' => ['hometown', t('Hometown:'), $r[0]['hometown']], + '$politic' => ['politic', t('Political Views:'), $r[0]['politic']], + '$religion' => ['religion', t('Religious Views:'), $r[0]['religion']], + '$pub_keywords' => ['pub_keywords', t('Public Keywords:'), $r[0]['pub_keywords'], t("\x28Used for suggesting potential friends, can be seen by others\x29")], + '$prv_keywords' => ['prv_keywords', t('Private Keywords:'), $r[0]['prv_keywords'], t("\x28Used for searching profiles, never shown to others\x29")], + '$likes' => ['likes', t('Likes:'), $r[0]['likes']], + '$dislikes' => ['dislikes', t('Dislikes:'), $r[0]['dislikes']], + '$music' => ['music', t('Musical interests'), $r[0]['music']], + '$book' => ['book', t('Books, literature'), $r[0]['book']], + '$tv' => ['tv', t('Television'), $r[0]['tv']], + '$film' => ['film', t('Film/dance/culture/entertainment'), $r[0]['film']], + '$interest' => ['interest', t('Hobbies/Interests'), $r[0]['interest']], + '$romance' => ['romance', t('Love/romance'), $r[0]['romance']], + '$work' => ['work', t('Work/employment'), $r[0]['work']], + '$education' => ['education', t('School/education'), $r[0]['education']], + '$contact' => ['contact', t('Contact information and Social Networks'), $r[0]['contact']], + ]); + + $arr = ['profile' => $r[0], 'entry' => $o]; call_hooks('profile_edit', $arr); return $o; @@ -767,24 +767,24 @@ function profiles_content(App $a) { $profiles = ''; foreach ($r as $rr) { - $profiles .= replace_macros($tpl, array( + $profiles .= replace_macros($tpl, [ '$photo' => $a->remove_baseurl($rr['thumb']), '$id' => $rr['id'], '$alt' => t('Profile Image'), '$profile_name' => $rr['profile-name'], '$visible' => (($rr['is-default']) ? '' . t('visible to everybody') . '' : '' . t('Edit visibility') . '') - )); + ]); } $tpl_header = get_markup_template('profile_listing_header.tpl'); - $o .= replace_macros($tpl_header,array( + $o .= replace_macros($tpl_header,[ '$header' => t('Edit/Manage Profiles'), '$chg_photo' => t('Change profile photo'), '$cr_new' => t('Create New Profile'), '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"), '$profiles' => $profiles - )); + ]); } return $o; } diff --git a/mod/profperm.php b/mod/profperm.php index ee51906601..015260d54d 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -69,7 +69,7 @@ function profperm_content(App $a) { intval($a->argv[1]) ); - $ingroup = array(); + $ingroup = []; if (DBM::is_result($r)) foreach($r as $member) $ingroup[] = $member['id']; @@ -99,7 +99,7 @@ function profperm_content(App $a) { $members = $r; - $ingroup = array(); + $ingroup = []; if (DBM::is_result($r)) foreach($r as $member) $ingroup[] = $member['id']; diff --git a/mod/proxy.php b/mod/proxy.php index db0a615244..538275ef00 100644 --- a/mod/proxy.php +++ b/mod/proxy.php @@ -104,7 +104,7 @@ function proxy_init(App $a) { $url = substr($url, 0, $pos + 1); } - $url = str_replace(array('.jpg', '.jpeg', '.gif', '.png'), array('','','',''), $url); + $url = str_replace(['.jpg', '.jpeg', '.gif', '.png'], ['','','',''], $url); $url = base64_decode(strtr($url, '-_', '+/'), true); @@ -186,10 +186,10 @@ function proxy_init(App $a) { die(); } - $fields = array('uid' => 0, 'contact-id' => 0, 'guid' => get_guid(), 'resource-id' => $urlhash, 'created' => datetime_convert(), 'edited' => datetime_convert(), + $fields = ['uid' => 0, 'contact-id' => 0, 'guid' => get_guid(), 'resource-id' => $urlhash, 'created' => datetime_convert(), 'edited' => datetime_convert(), 'filename' => basename($_REQUEST['url']), 'type' => '', 'album' => '', 'height' => imagesy($image), 'width' => imagesx($image), 'datasize' => 0, 'data' => $img_str, 'scale' => 100, 'profile' => 0, - 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime); + 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime]; dba::insert('photo', $fields); } else { $Image = new Image($img_str, $mime); @@ -286,7 +286,7 @@ function proxy_url($url, $writemode = false, $size = '') { // Extract the URL extension $extension = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION); - $extensions = array('jpg', 'jpeg', 'gif', 'png'); + $extensions = ['jpg', 'jpeg', 'gif', 'png']; if (in_array($extension, $extensions)) { $shortpath .= '.' . $extension; $longpath .= '.' . $extension; @@ -340,7 +340,7 @@ function proxy_parse_query($url) { $query = parse_url($url, PHP_URL_QUERY); $query = html_entity_decode($query); $query_list = explode('&', $query); - $arr = array(); + $arr = []; foreach ($query_list as $key_value) { $key_value_list = explode('=', $key_value); diff --git a/mod/register.php b/mod/register.php index 4edf3ee6a6..56d4e59360 100644 --- a/mod/register.php +++ b/mod/register.php @@ -19,7 +19,7 @@ function register_post(App $a) $verified = 0; $blocked = 1; - $arr = array('post' => $_POST); + $arr = ['post' => $_POST]; call_hooks('register_post', $arr); $max_dailies = intval(Config::get('system', 'max_daily_registrations')); @@ -133,7 +133,7 @@ function register_post(App $a) // send notification to admins foreach ($adminlist as $admin) { - notification(array( + notification([ 'type' => NOTIFY_SYSTEM, 'event' => 'SYSTEM_REGISTER_REQUEST', 'source_name' => $user['username'], @@ -146,7 +146,7 @@ function register_post(App $a) 'uid' => $admin['uid'], 'language' => $admin['language'] ? $admin['language'] : 'en', 'show_in_notification_page' => false - )); + ]); } // send notification to the user, that the registration is pending User::sendRegisterPendingEmail( @@ -222,14 +222,14 @@ function register_content(App $a) $profile_publish = ''; } else { $publish_tpl = get_markup_template("profile_publish.tpl"); - $profile_publish = replace_macros($publish_tpl, array( + $profile_publish = replace_macros($publish_tpl, [ '$instance' => 'reg', '$pubdesc' => t('Include your profile in member directory?'), '$yes_selected' => ' checked="checked" ', '$no_selected' => '', '$str_yes' => t('Yes'), '$str_no' => t('No'), - )); + ]); } $r = q("SELECT COUNT(*) AS `contacts` FROM `contact`"); @@ -239,7 +239,7 @@ function register_content(App $a) $tpl = get_markup_template("register.tpl"); - $arr = array('template' => $tpl); + $arr = ['template' => $tpl]; call_hooks('register_form', $arr); @@ -249,7 +249,7 @@ function register_content(App $a) '$oidhtml' => $oidhtml, '$invitations' => Config::get('system', 'invitation_only'), '$permonly' => $a->config['register_policy'] == REGISTER_APPROVE, - '$permonlybox' => array('permonlybox', t('Note for the admin'), '', t('Leave a message for the admin, why you want to join this node')), + '$permonlybox' => ['permonlybox', t('Note for the admin'), '', t('Leave a message for the admin, why you want to join this node')], '$invite_desc' => t('Membership on this site is by invitation only.'), '$invite_label' => t('Your invitation ID: '), '$invite_id' => $invite_id, @@ -263,8 +263,8 @@ function register_content(App $a) '$namelabel' => t('Your Full Name ' . "\x28" . 'e.g. Joe Smith, real or real-looking' . "\x29" . ': '), '$addrlabel' => t('Your Email Address: (Initial information will be send there, so this has to be an existing address.)'), '$passwords' => $passwords, - '$password1' => array('password1', t('New Password:'), '', t('Leave empty for an auto generated password.')), - '$password2' => array('confirm', t('Confirm:'), '', ''), + '$password1' => ['password1', t('New Password:'), '', t('Leave empty for an auto generated password.')], + '$password2' => ['confirm', t('Confirm:'), '', ''], '$nickdesc' => t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'nickname@%s\'.', $a->get_hostname()), '$nicklabel' => t('Choose a nickname: '), '$photo' => $photo, diff --git a/mod/regmod.php b/mod/regmod.php index 8f08067e21..f5bba6dea0 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -84,8 +84,8 @@ function user_deny($hash) intval($register[0]['uid']) ); - dba::delete('user', array('uid' => $register[0]['uid'])); - dba::delete('register', array('hash' => $register[0]['hash'])); + dba::delete('user', ['uid' => $register[0]['uid']]); + dba::delete('register', ['hash' => $register[0]['hash']]); notice(sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL); return true; diff --git a/mod/removeme.php b/mod/removeme.php index bf5969982a..5912a6e313 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -46,14 +46,14 @@ function removeme_content(App $a) $_SESSION['remove_account_verify'] = $hash; $tpl = get_markup_template('removeme.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$basedir' => System::baseUrl(), '$hash' => $hash, '$title' => t('Remove My Account'), '$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'), '$passwd' => t('Please enter your password for verification:'), '$submit' => t('Remove My Account') - )); + ]); return $o; } diff --git a/mod/robots_txt.php b/mod/robots_txt.php index 8327329bf5..29f520b18c 100644 --- a/mod/robots_txt.php +++ b/mod/robots_txt.php @@ -15,11 +15,11 @@ use Friendica\App; */ function robots_txt_init(App $a) { - $allDisalloweds = array( + $allDisalloweds = [ '/settings/', '/admin/', '/message/', - ); + ]; header('Content-Type: text/plain'); echo 'User-agent: *' . PHP_EOL; diff --git a/mod/salmon.php b/mod/salmon.php index 3a4dececde..d5b0fe2430 100644 --- a/mod/salmon.php +++ b/mod/salmon.php @@ -69,7 +69,7 @@ function salmon_post(App $a) { // unpack the data // strip whitespace so our data element will return to one big base64 blob - $data = str_replace(array(" ","\t","\r","\n"),array("","","",""),$base->data); + $data = str_replace([" ","\t","\r","\n"],["","","",""],$base->data); // stash away some other stuff for later diff --git a/mod/search.php b/mod/search.php index c17b11c5d9..08b21d1e44 100644 --- a/mod/search.php +++ b/mod/search.php @@ -25,26 +25,26 @@ function search_saved_searches() { ); if (DBM::is_result($r)) { - $saved = array(); + $saved = []; foreach ($r as $rr) { - $saved[] = array( + $saved[] = [ 'id' => $rr['id'], 'term' => $rr['term'], 'encodedterm' => urlencode($rr['term']), 'delete' => t('Remove term'), 'selected' => ($search==$rr['term']), - ); + ]; } $tpl = get_markup_template("saved_searches_aside.tpl"); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$title' => t('Saved Searches'), '$add' => '', '$searchbox' => '', '$saved' => $saved, - )); + ]); } return $o; @@ -63,11 +63,11 @@ function search_init(App $a) { dbesc($search) ); if (!DBM::is_result($r)) { - dba::insert('search', array('uid' => local_user(), 'term' => $search)); + dba::insert('search', ['uid' => local_user(), 'term' => $search]); } } if (x($_GET,'remove') && $search) { - dba::delete('search', array('uid' => local_user(), 'term' => $search)); + dba::delete('search', ['uid' => local_user(), 'term' => $search]); } $a->page['aside'] .= search_saved_searches(); @@ -98,8 +98,8 @@ function search_content(App $a) { if (Config::get('system','local_search') && !local_user() && !remote_user()) { http_status_exit(403, - array("title" => t("Public access denied."), - "description" => t("Only logged in users are permitted to perform a search."))); + ["title" => t("Public access denied."), + "description" => t("Only logged in users are permitted to perform a search.")]); killme(); //notice(t('Public access denied.').EOL); //return; @@ -123,13 +123,13 @@ function search_content(App $a) { $resultdata = json_decode($result); if (($resultdata->time > (time() - $crawl_permit_period)) && ($resultdata->accesses > $free_crawls)) { http_status_exit(429, - array("title" => t("Too Many Requests"), - "description" => t("Only one search per minute is permitted for not logged in users."))); + ["title" => t("Too Many Requests"), + "description" => t("Only one search per minute is permitted for not logged in users.")]); killme(); } - Cache::set("remote_search:".$remote, json_encode(array("time" => time(), "accesses" => $resultdata->accesses + 1)), CACHE_HOUR); + Cache::set("remote_search:".$remote, json_encode(["time" => time(), "accesses" => $resultdata->accesses + 1]), CACHE_HOUR); } else - Cache::set("remote_search:".$remote, json_encode(array("time" => time(), "accesses" => 1)), CACHE_HOUR); + Cache::set("remote_search:".$remote, json_encode(["time" => time(), "accesses" => 1]), CACHE_HOUR); } nav_set_selected('search'); @@ -146,12 +146,12 @@ function search_content(App $a) { } // contruct a wrapper for the search header - $o .= replace_macros(get_markup_template("content_wrapper.tpl"),array( + $o .= replace_macros(get_markup_template("content_wrapper.tpl"),[ 'name' => "search-header", '$title' => t("Search"), '$title_size' => 3, '$content' => search($search,'search-box','search',((local_user()) ? true : false), false) - )); + ]); if (strpos($search,'#') === 0) { $tag = true; @@ -228,9 +228,9 @@ function search_content(App $a) { else $title = sprintf( t('Results for: %s'), $search); - $o .= replace_macros(get_markup_template("section_title.tpl"),array( + $o .= replace_macros(get_markup_template("section_title.tpl"),[ '$title' => $title - )); + ]); logger("Start Conversation for '".$search."'", LOGGER_DEBUG); $o .= conversation($a,$r,'search',false); diff --git a/mod/settings.php b/mod/settings.php index 8fd890804f..06ac0794b8 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -38,84 +38,84 @@ function settings_init(App $a) // These lines provide the javascript needed by the acl selector $tpl = get_markup_template('settings/head.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl,array( + $a->page['htmlhead'] .= replace_macros($tpl,[ '$ispublic' => t('everybody') - )); + ]); - $tabs = array( - array( + $tabs = [ + [ 'label' => t('Account'), 'url' => 'settings', 'selected' => (($a->argc == 1) && ($a->argv[0] === 'settings')?'active':''), 'accesskey' => 'o', - ), - ); + ], + ]; if (Feature::get()) { - $tabs[] = array( + $tabs[] = [ 'label' => t('Additional features'), 'url' => 'settings/features', 'selected' => (($a->argc > 1) && ($a->argv[1] === 'features') ? 'active' : ''), 'accesskey' => 't', - ); + ]; } - $tabs[] = array( + $tabs[] = [ 'label' => t('Display'), 'url' => 'settings/display', 'selected' => (($a->argc > 1) && ($a->argv[1] === 'display')?'active':''), 'accesskey' => 'i', - ); + ]; - $tabs[] = array( + $tabs[] = [ 'label' => t('Social Networks'), 'url' => 'settings/connectors', 'selected' => (($a->argc > 1) && ($a->argv[1] === 'connectors')?'active':''), 'accesskey' => 'w', - ); + ]; - $tabs[] = array( + $tabs[] = [ 'label' => t('Plugins'), 'url' => 'settings/addon', 'selected' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''), 'accesskey' => 'l', - ); + ]; - $tabs[] = array( + $tabs[] = [ 'label' => t('Delegations'), 'url' => 'delegate', 'selected' => (($a->argc == 1) && ($a->argv[0] === 'delegate')?'active':''), 'accesskey' => 'd', - ); + ]; - $tabs[] = array( + $tabs[] = [ 'label' => t('Connected apps'), 'url' => 'settings/oauth', 'selected' => (($a->argc > 1) && ($a->argv[1] === 'oauth')?'active':''), 'accesskey' => 'b', - ); + ]; - $tabs[] = array( + $tabs[] = [ 'label' => t('Export personal data'), 'url' => 'uexport', 'selected' => (($a->argc == 1) && ($a->argv[0] === 'uexport')?'active':''), 'accesskey' => 'e', - ); + ]; - $tabs[] = array( + $tabs[] = [ 'label' => t('Remove account'), 'url' => 'removeme', 'selected' => (($a->argc == 1) && ($a->argv[0] === 'removeme')?'active':''), 'accesskey' => 'r', - ); + ]; $tabtpl = get_markup_template("generic_links_widget.tpl"); - $a->page['aside'] = replace_macros($tabtpl, array( + $a->page['aside'] = replace_macros($tabtpl, [ '$title' => t('Settings'), '$class' => 'settings-widget', '$items' => $tabs, - )); + ]); } @@ -231,12 +231,12 @@ function settings_post(App $a) intval(local_user()) ); if (!DBM::is_result($r)) { - dba::insert('mailacct', array('uid' => local_user())); + dba::insert('mailacct', ['uid' => local_user()]); } if (strlen($mail_pass)) { $pass = ''; openssl_public_encrypt($mail_pass, $pass, $a->user['pubkey']); - dba::update('mailacct', array('pass' => bin2hex($pass)), array('uid' => local_user())); + dba::update('mailacct', ['pass' => bin2hex($pass)], ['uid' => local_user()]); } $r = q("UPDATE `mailacct` SET `server` = '%s', `port` = %d, `ssltype` = '%s', `user` = '%s', `action` = %d, `movetofolder` = '%s', @@ -466,13 +466,13 @@ function settings_post(App $a) } // Adjust the page flag if the account type doesn't fit to the page flag. - if (($account_type == ACCOUNT_TYPE_PERSON) && !in_array($page_flags, array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE))) { + if (($account_type == ACCOUNT_TYPE_PERSON) && !in_array($page_flags, [PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE])) { $page_flags = PAGE_NORMAL; - } elseif (($account_type == ACCOUNT_TYPE_ORGANISATION) && !in_array($page_flags, array(PAGE_SOAPBOX))) { + } elseif (($account_type == ACCOUNT_TYPE_ORGANISATION) && !in_array($page_flags, [PAGE_SOAPBOX])) { $page_flags = PAGE_SOAPBOX; - } elseif (($account_type == ACCOUNT_TYPE_NEWS) && !in_array($page_flags, array(PAGE_SOAPBOX))) { + } elseif (($account_type == ACCOUNT_TYPE_NEWS) && !in_array($page_flags, [PAGE_SOAPBOX])) { $page_flags = PAGE_SOAPBOX; - } elseif (($account_type == ACCOUNT_TYPE_COMMUNITY) && !in_array($page_flags, array(PAGE_COMMUNITY, PAGE_PRVGROUP))) { + } elseif (($account_type == ACCOUNT_TYPE_COMMUNITY) && !in_array($page_flags, [PAGE_COMMUNITY, PAGE_PRVGROUP])) { $page_flags = PAGE_COMMUNITY; } @@ -669,17 +669,17 @@ function settings_content(App $a) if (($a->argc > 1) && ($a->argv[1] === 'oauth')) { if (($a->argc > 2) && ($a->argv[2] === 'add')) { $tpl = get_markup_template('settings/oauth_edit.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$form_security_token' => get_form_security_token("settings_oauth"), '$title' => t('Add application'), '$submit' => t('Save Settings'), '$cancel' => t('Cancel'), - '$name' => array('name', t('Name'), '', ''), - '$key' => array('key', t('Consumer Key'), '', ''), - '$secret' => array('secret', t('Consumer Secret'), '', ''), - '$redirect' => array('redirect', t('Redirect'), '', ''), - '$icon' => array('icon', t('Icon url'), '', ''), - )); + '$name' => ['name', t('Name'), '', ''], + '$key' => ['key', t('Consumer Key'), '', ''], + '$secret' => ['secret', t('Consumer Secret'), '', ''], + '$redirect' => ['redirect', t('Redirect'), '', ''], + '$icon' => ['icon', t('Icon url'), '', ''], + ]); return $o; } @@ -695,17 +695,17 @@ function settings_content(App $a) $app = $r[0]; $tpl = get_markup_template('settings/oauth_edit.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$form_security_token' => get_form_security_token("settings_oauth"), '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), - '$name' => array('name', t('Name'), $app['name'] , ''), - '$key' => array('key', t('Consumer Key'), $app['client_id'], ''), - '$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''), - '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''), - '$icon' => array('icon', t('Icon url'), $app['icon'], ''), - )); + '$name' => ['name', t('Name'), $app['name'] , ''], + '$key' => ['key', t('Consumer Key'), $app['client_id'], ''], + '$secret' => ['secret', t('Consumer Secret'), $app['pw'], ''], + '$redirect' => ['redirect', t('Redirect'), $app['redirect_uri'], ''], + '$icon' => ['icon', t('Icon url'), $app['icon'], ''], + ]); return $o; } @@ -729,7 +729,7 @@ function settings_content(App $a) $tpl = get_markup_template('settings/oauth.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$form_security_token' => get_form_security_token("settings_oauth"), '$baseurl' => System::baseUrl(true), '$title' => t('Connected Apps'), @@ -740,7 +740,7 @@ function settings_content(App $a) '$noname' => t('No name'), '$remove' => t('Remove authorization'), '$apps' => $r, - )); + ]); return $o; } @@ -756,33 +756,33 @@ function settings_content(App $a) $tpl = get_markup_template('settings/addons.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$form_security_token' => get_form_security_token("settings_addon"), '$title' => t('Plugin Settings'), '$settings_addons' => $settings_addons - )); + ]); return $o; } if (($a->argc > 1) && ($a->argv[1] === 'features')) { - $arr = array(); + $arr = []; $features = Feature::get(); foreach ($features as $fname => $fdata) { - $arr[$fname] = array(); + $arr[$fname] = []; $arr[$fname][0] = $fdata[0]; foreach (array_slice($fdata,1) as $f) { - $arr[$fname][1][] = array('feature_' .$f[0], $f[1],((intval(Feature::isEnabled(local_user(), $f[0]))) ? "1" : ''), $f[2],array(t('Off'), t('On'))); + $arr[$fname][1][] = ['feature_' .$f[0], $f[1],((intval(Feature::isEnabled(local_user(), $f[0]))) ? "1" : ''), $f[2],[t('Off'), t('On')]]; } } $tpl = get_markup_template('settings/features.tpl'); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$form_security_token' => get_form_security_token("settings_features"), '$title' => t('Additional Features'), '$features' => $arr, '$submit' => t('Save Settings'), - )); + ]); return $o; } @@ -835,7 +835,7 @@ function settings_content(App $a) $mail_disabled_message = (($mail_disabled) ? t('Email access is disabled on this site.') : ''); - $o .= replace_macros($tpl, array( + $o .= replace_macros($tpl, [ '$form_security_token' => get_form_security_token("settings_connectors"), '$title' => t('Social Networks'), @@ -844,10 +844,10 @@ function settings_content(App $a) '$ostat_enabled' => $ostat_enabled, '$general_settings' => t('General Social Media Settings'), - '$no_intelligent_shortening' => array('no_intelligent_shortening', t('Disable intelligent shortening'), $no_intelligent_shortening, t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.')), - '$ostatus_autofriend' => array('snautofollow', t('Automatically follow any GNU Social (OStatus) followers/mentioners'), $ostatus_autofriend, t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')), + '$no_intelligent_shortening' => ['no_intelligent_shortening', t('Disable intelligent shortening'), $no_intelligent_shortening, t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.')], + '$ostatus_autofriend' => ['snautofollow', t('Automatically follow any GNU Social (OStatus) followers/mentioners'), $ostatus_autofriend, t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')], '$default_group' => Group::displayGroupSelection(local_user(), $default_group, t("Default group for OStatus contacts")), - '$legacy_contact' => array('legacy_contact', t('Your legacy GNU Social account'), $legacy_contact, t('If you enter your old GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')), + '$legacy_contact' => ['legacy_contact', t('Your legacy GNU Social account'), $legacy_contact, t('If you enter your old GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')], '$repair_ostatus_url' => System::baseUrl() . '/repair_ostatus', '$repair_ostatus_text' => t('Repair OStatus subscriptions'), @@ -856,19 +856,19 @@ function settings_content(App $a) '$h_imap' => t('Email/Mailbox Setup'), '$imap_desc' => t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."), - '$imap_lastcheck' => array('imap_lastcheck', t('Last successful email check:'), $mail_chk, ''), + '$imap_lastcheck' => ['imap_lastcheck', t('Last successful email check:'), $mail_chk, ''], '$mail_disabled' => $mail_disabled_message, - '$mail_server' => array('mail_server', t('IMAP server name:'), $mail_server, ''), - '$mail_port' => array('mail_port', t('IMAP port:'), $mail_port, ''), - '$mail_ssl' => array('mail_ssl', t('Security:'), strtoupper($mail_ssl), '', array('notls'=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL')), - '$mail_user' => array('mail_user', t('Email login name:'), $mail_user, ''), - '$mail_pass' => array('mail_pass', t('Email password:'), '', ''), - '$mail_replyto' => array('mail_replyto', t('Reply-to address:'), $mail_replyto, 'Optional'), - '$mail_pubmail' => array('mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''), - '$mail_action' => array('mail_action', t('Action after import:'), $mail_action, '', array(0=>t('None'), /*1=>t('Delete'),*/ 2=>t('Mark as seen'), 3=>t('Move to folder'))), - '$mail_movetofolder' => array('mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''), + '$mail_server' => ['mail_server', t('IMAP server name:'), $mail_server, ''], + '$mail_port' => ['mail_port', t('IMAP port:'), $mail_port, ''], + '$mail_ssl' => ['mail_ssl', t('Security:'), strtoupper($mail_ssl), '', ['notls'=>t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL']], + '$mail_user' => ['mail_user', t('Email login name:'), $mail_user, ''], + '$mail_pass' => ['mail_pass', t('Email password:'), '', ''], + '$mail_replyto' => ['mail_replyto', t('Reply-to address:'), $mail_replyto, 'Optional'], + '$mail_pubmail' => ['mail_pubmail', t('Send public posts to all email contacts:'), $mail_pubmail, ''], + '$mail_action' => ['mail_action', t('Action after import:'), $mail_action, '', [0=>t('None'), /*1=>t('Delete'),*/ 2=>t('Mark as seen'), 3=>t('Move to folder')]], + '$mail_movetofolder' => ['mail_movetofolder', t('Move to folder:'), $mail_movetofolder, ''], '$submit' => t('Save Settings'), - )); + ]); call_hooks('display_settings', $o); return $o; @@ -889,7 +889,7 @@ function settings_content(App $a) $allowed_themes_str = Config::get('system', 'allowed_themes'); $allowed_themes_raw = explode(',', $allowed_themes_str); - $allowed_themes = array(); + $allowed_themes = []; if (count($allowed_themes_raw)) { foreach ($allowed_themes_raw as $x) { if (strlen(trim($x)) && is_dir("view/theme/$x")) { @@ -899,8 +899,8 @@ function settings_content(App $a) } - $themes = array(); - $mobile_themes = array("---" => t('No special theme for mobile devices')); + $themes = []; + $mobile_themes = ["---" => t('No special theme for mobile devices')]; if ($allowed_themes) { foreach ($allowed_themes as $theme) { $is_experimental = file_exists('view/theme/' . $theme . '/experimental'); @@ -938,7 +938,7 @@ function settings_content(App $a) $nosmile = PConfig::get(local_user(), 'system', 'no_smilies', 0); $first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week', 0); - $weekdays = array(0 => t("Sunday"), 1 => t("Monday")); + $weekdays = [0 => t("Sunday"), 1 => t("Monday")]; $noinfo = PConfig::get(local_user(), 'system', 'ignore_info', 0); $infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0); @@ -953,39 +953,39 @@ function settings_content(App $a) } $tpl = get_markup_template('settings/display.tpl'); - $o = replace_macros($tpl, array( + $o = replace_macros($tpl, [ '$ptitle' => t('Display Settings'), '$form_security_token' => get_form_security_token("settings_display"), '$submit' => t('Save Settings'), '$baseurl' => System::baseUrl(true), '$uid' => local_user(), - '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes, true), - '$mobile_theme' => array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, false), - '$nowarn_insecure' => array('nowarn_insecure', t('Suppress warning of insecure networks'), $nowarn_insecure, t("Should the system suppress the warning that the current group contains members of networks that can't receive non public postings.")), - '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds. Enter -1 to disable it.')), - '$itemspage_network' => array('itemspage_network', t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')), - '$itemspage_mobile_network' => array('itemspage_mobile_network', t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, t('Maximum of 100 items')), - '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), + '$theme' => ['theme', t('Display Theme:'), $theme_selected, '', $themes, true], + '$mobile_theme' => ['mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, false], + '$nowarn_insecure' => ['nowarn_insecure', t('Suppress warning of insecure networks'), $nowarn_insecure, t("Should the system suppress the warning that the current group contains members of networks that can't receive non public postings.")], + '$ajaxint' => ['browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds. Enter -1 to disable it.')], + '$itemspage_network' => ['itemspage_network', t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')], + '$itemspage_mobile_network' => ['itemspage_mobile_network', t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, t('Maximum of 100 items')], + '$nosmile' => ['nosmile', t("Don't show emoticons"), $nosmile, ''], '$calendar_title' => t('Calendar'), - '$first_day_of_week' => array('first_day_of_week', t('Beginning of week:'), $first_day_of_week, '', $weekdays, false), - '$noinfo' => array('noinfo', t("Don't show notices"), $noinfo, ''), - '$infinite_scroll' => array('infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''), - '$no_auto_update' => array('no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, t('When disabled, the network page is updated all the time, which could be confusing while reading.')), - '$bandwidth_saver' => array('bandwidth_saver', t('Bandwith Saver Mode'), $bandwidth_saver, t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')), - '$smart_threading' => array('smart_threading', t('Smart Threading'), $smart_threading, t('When enabled, suppress extraneous thread indentation while keeping it where it matters. Only works if threading is available and enabled.')), + '$first_day_of_week' => ['first_day_of_week', t('Beginning of week:'), $first_day_of_week, '', $weekdays, false], + '$noinfo' => ['noinfo', t("Don't show notices"), $noinfo, ''], + '$infinite_scroll' => ['infinite_scroll', t("Infinite scroll"), $infinite_scroll, ''], + '$no_auto_update' => ['no_auto_update', t("Automatic updates only at the top of the network page"), $no_auto_update, t('When disabled, the network page is updated all the time, which could be confusing while reading.')], + '$bandwidth_saver' => ['bandwidth_saver', t('Bandwith Saver Mode'), $bandwidth_saver, t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')], + '$smart_threading' => ['smart_threading', t('Smart Threading'), $smart_threading, t('When enabled, suppress extraneous thread indentation while keeping it where it matters. Only works if threading is available and enabled.')], '$d_tset' => t('General Theme Settings'), '$d_ctset' => t('Custom Theme Settings'), '$d_cset' => t('Content Settings'), 'stitle' => t('Theme settings'), '$theme_config' => $theme_config, - )); + ]); $tpl = get_markup_template('settings/display_end.tpl'); - $a->page['end'] .= replace_macros($tpl, array( - '$theme' => array('theme', t('Display Theme:'), $theme_selected, '', $themes) - )); + $a->page['end'] .= replace_macros($tpl, [ + '$theme' => ['theme', t('Display Theme:'), $theme_selected, '', $themes] + ]); return $o; } @@ -1034,13 +1034,13 @@ function settings_content(App $a) // Set the account type to "Community" when the page is a community page but the account type doesn't fit // This is only happening on the first visit after the update - if (in_array($a->user['page-flags'], array(PAGE_COMMUNITY, PAGE_PRVGROUP)) && + if (in_array($a->user['page-flags'], [PAGE_COMMUNITY, PAGE_PRVGROUP]) && ($a->user['account-type'] != ACCOUNT_TYPE_COMMUNITY)) $a->user['account-type'] = ACCOUNT_TYPE_COMMUNITY; $pageset_tpl = get_markup_template('settings/pagetypes.tpl'); - $pagetype = replace_macros($pageset_tpl, array( + $pagetype = replace_macros($pageset_tpl, [ '$account_types' => t("Account Types"), '$user' => t("Personal Page Subtypes"), '$community' => t("Community Forum Subtypes"), @@ -1050,93 +1050,93 @@ function settings_content(App $a) '$type_news' => ACCOUNT_TYPE_NEWS, '$type_community' => ACCOUNT_TYPE_COMMUNITY, - '$account_person' => array('account-type', t('Personal Page'), ACCOUNT_TYPE_PERSON, + '$account_person' => ['account-type', t('Personal Page'), ACCOUNT_TYPE_PERSON, t('Account for a personal profile.'), - ($a->user['account-type'] == ACCOUNT_TYPE_PERSON)), + ($a->user['account-type'] == ACCOUNT_TYPE_PERSON)], - '$account_organisation' => array('account-type', t('Organisation Page'), ACCOUNT_TYPE_ORGANISATION, + '$account_organisation' => ['account-type', t('Organisation Page'), ACCOUNT_TYPE_ORGANISATION, t('Account for an organisation that automatically approves contact requests as "Followers".'), - ($a->user['account-type'] == ACCOUNT_TYPE_ORGANISATION)), + ($a->user['account-type'] == ACCOUNT_TYPE_ORGANISATION)], - '$account_news' => array('account-type', t('News Page'), ACCOUNT_TYPE_NEWS, + '$account_news' => ['account-type', t('News Page'), ACCOUNT_TYPE_NEWS, t('Account for a news reflector that automatically approves contact requests as "Followers".'), - ($a->user['account-type'] == ACCOUNT_TYPE_NEWS)), + ($a->user['account-type'] == ACCOUNT_TYPE_NEWS)], - '$account_community' => array('account-type', t('Community Forum'), ACCOUNT_TYPE_COMMUNITY, + '$account_community' => ['account-type', t('Community Forum'), ACCOUNT_TYPE_COMMUNITY, t('Account for community discussions.'), - ($a->user['account-type'] == ACCOUNT_TYPE_COMMUNITY)), + ($a->user['account-type'] == ACCOUNT_TYPE_COMMUNITY)], - '$page_normal' => array('page-flags', t('Normal Account Page'), PAGE_NORMAL, + '$page_normal' => ['page-flags', t('Normal Account Page'), PAGE_NORMAL, t('Account for a regular personal profile that requires manual approval of "Friends" and "Followers".'), - ($a->user['page-flags'] == PAGE_NORMAL)), + ($a->user['page-flags'] == PAGE_NORMAL)], - '$page_soapbox' => array('page-flags', t('Soapbox Page'), PAGE_SOAPBOX, + '$page_soapbox' => ['page-flags', t('Soapbox Page'), PAGE_SOAPBOX, t('Account for a public profile that automatically approves contact requests as "Followers".'), - ($a->user['page-flags'] == PAGE_SOAPBOX)), + ($a->user['page-flags'] == PAGE_SOAPBOX)], - '$page_community' => array('page-flags', t('Public Forum'), PAGE_COMMUNITY, + '$page_community' => ['page-flags', t('Public Forum'), PAGE_COMMUNITY, t('Automatically approves all contact requests.'), - ($a->user['page-flags'] == PAGE_COMMUNITY)), + ($a->user['page-flags'] == PAGE_COMMUNITY)], - '$page_freelove' => array('page-flags', t('Automatic Friend Page'), PAGE_FREELOVE, + '$page_freelove' => ['page-flags', t('Automatic Friend Page'), PAGE_FREELOVE, t('Account for a popular profile that automatically approves contact requests as "Friends".'), - ($a->user['page-flags'] == PAGE_FREELOVE)), + ($a->user['page-flags'] == PAGE_FREELOVE)], - '$page_prvgroup' => array('page-flags', t('Private Forum [Experimental]'), PAGE_PRVGROUP, + '$page_prvgroup' => ['page-flags', t('Private Forum [Experimental]'), PAGE_PRVGROUP, t('Requires manual approval of contact requests.'), - ($a->user['page-flags'] == PAGE_PRVGROUP)), + ($a->user['page-flags'] == PAGE_PRVGROUP)], - )); + ]); $noid = Config::get('system', 'no_openid'); if ($noid) { $openid_field = false; } else { - $openid_field = array('openid_url', t('OpenID:'), $openid, t("\x28Optional\x29 Allow this OpenID to login to this account."), "", "", "url"); + $openid_field = ['openid_url', t('OpenID:'), $openid, t("\x28Optional\x29 Allow this OpenID to login to this account."), "", "", "url"]; } $opt_tpl = get_markup_template("field_yesno.tpl"); if (Config::get('system', 'publish_all')) { $profile_in_dir = ''; } else { - $profile_in_dir = replace_macros($opt_tpl, array( - '$field' => array('profile_in_directory', t('Publish your default profile in your local site directory?'), $profile['publish'], t("Your profile may be visible in public."), array(t('No'), t('Yes'))) - )); + $profile_in_dir = replace_macros($opt_tpl, [ + '$field' => ['profile_in_directory', t('Publish your default profile in your local site directory?'), $profile['publish'], t("Your profile may be visible in public."), [t('No'), t('Yes')]] + ]); } if (strlen(Config::get('system', 'directory'))) { - $profile_in_net_dir = replace_macros($opt_tpl, array( - '$field' => array('profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', array(t('No'), t('Yes'))) - )); + $profile_in_net_dir = replace_macros($opt_tpl, [ + '$field' => ['profile_in_netdirectory', t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', [t('No'), t('Yes')]] + ]); } else { $profile_in_net_dir = ''; } - $hide_friends = replace_macros($opt_tpl, array( - '$field' => array('hide-friends', t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], '', array(t('No'), t('Yes'))), - )); + $hide_friends = replace_macros($opt_tpl, [ + '$field' => ['hide-friends', t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], '', [t('No'), t('Yes')]], + ]); - $hide_wall = replace_macros($opt_tpl, array( - '$field' => array('hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], t("If enabled, posting public messages to Diaspora and other networks isn't possible."), array(t('No'), t('Yes'))), - )); + $hide_wall = replace_macros($opt_tpl, [ + '$field' => ['hidewall', t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], t("If enabled, posting public messages to Diaspora and other networks isn't possible."), [t('No'), t('Yes')]], + ]); - $blockwall = replace_macros($opt_tpl, array( - '$field' => array('blockwall', t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', array(t('No'), t('Yes'))), - )); + $blockwall = replace_macros($opt_tpl, [ + '$field' => ['blockwall', t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', [t('No'), t('Yes')]], + ]); - $blocktags = replace_macros($opt_tpl, array( - '$field' => array('blocktags', t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', array(t('No'), t('Yes'))), - )); + $blocktags = replace_macros($opt_tpl, [ + '$field' => ['blocktags', t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', [t('No'), t('Yes')]], + ]); - $suggestme = replace_macros($opt_tpl, array( - '$field' => array('suggestme', t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', array(t('No'), t('Yes'))), - )); + $suggestme = replace_macros($opt_tpl, [ + '$field' => ['suggestme', t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', [t('No'), t('Yes')]], + ]); - $unkmail = replace_macros($opt_tpl, array( - '$field' => array('unkmail', t('Permit unknown people to send you private mail?'), $unkmail, '', array(t('No'), t('Yes'))), - )); + $unkmail = replace_macros($opt_tpl, [ + '$field' => ['unkmail', t('Permit unknown people to send you private mail?'), $unkmail, '', [t('No'), t('Yes')]], + ]); if (!$profile['publish'] && !$profile['net-publish']) { info(t('Profile is not published.') . EOL); @@ -1144,23 +1144,23 @@ function settings_content(App $a) $tpl_addr = get_markup_template('settings/nick_set.tpl'); - $prof_addr = replace_macros($tpl_addr,array( + $prof_addr = replace_macros($tpl_addr,[ '$desc' => t("Your Identity Address is '%s' or '%s'.", $nickname . '@' . $a->get_hostname() . $a->get_path(), System::baseUrl() . '/profile/' . $nickname), '$basepath' => $a->get_hostname() - )); + ]); $stpl = get_markup_template('settings/settings.tpl'); - $expire_arr = array( - 'days' => array('expire', t("Automatically expire posts after this many days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')), + $expire_arr = [ + 'days' => ['expire', t("Automatically expire posts after this many days:"), $expire, t('If empty, posts will not expire. Expired posts will be deleted')], 'advanced' => t('Advanced expiration settings'), 'label' => t('Advanced Expiration'), - 'items' => array('expire_items', t("Expire posts:"), $expire_items, '', array(t('No'), t('Yes'))), - 'notes' => array('expire_notes', t("Expire personal notes:"), $expire_notes, '', array(t('No'), t('Yes'))), - 'starred' => array('expire_starred', t("Expire starred posts:"), $expire_starred, '', array(t('No'), t('Yes'))), - 'photos' => array('expire_photos', t("Expire photos:"), $expire_photos, '', array(t('No'), t('Yes'))), - 'network_only' => array('expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', array(t('No'), t('Yes'))), - ); + 'items' => ['expire_items', t("Expire posts:"), $expire_items, '', [t('No'), t('Yes')]], + 'notes' => ['expire_notes', t("Expire personal notes:"), $expire_notes, '', [t('No'), t('Yes')]], + 'starred' => ['expire_starred', t("Expire starred posts:"), $expire_starred, '', [t('No'), t('Yes')]], + 'photos' => ['expire_photos', t("Expire photos:"), $expire_photos, '', [t('No'), t('Yes')]], + 'network_only' => ['expire_network_only', t("Only expire posts by others:"), $expire_network_only, '', [t('No'), t('Yes')]], + ]; $group_select = Group::displayGroupSelection(local_user(), $a->user['def_gid']); @@ -1172,7 +1172,7 @@ function settings_content(App $a) $query_str = $a->query_string; if (strpos($query_str, 'public=1') !== false) { - $query_str = str_replace(array('?public=1', '&public=1'), array('', ''), $query_str); + $query_str = str_replace(['?public=1', '&public=1'], ['', ''], $query_str); } // I think $a->query_string may never have ? in it, but I could be wrong @@ -1188,7 +1188,7 @@ function settings_content(App $a) $lang_choices = get_available_languages(); /// @TODO Fix indending (or so) - $o .= replace_macros($stpl, array( + $o .= replace_macros($stpl, [ '$ptitle' => t('Account Settings'), '$submit' => t('Save Settings'), @@ -1198,25 +1198,25 @@ function settings_content(App $a) '$nickname_block' => $prof_addr, '$h_pass' => t('Password Settings'), - '$password1'=> array('password', t('New Password:'), '', ''), - '$password2'=> array('confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')), - '$password3'=> array('opassword', t('Current Password:'), '', t('Your current password to confirm the changes')), - '$password4'=> array('mpassword', t('Password:'), '', t('Your current password to confirm the changes')), + '$password1'=> ['password', t('New Password:'), '', ''], + '$password2'=> ['confirm', t('Confirm:'), '', t('Leave password fields blank unless changing')], + '$password3'=> ['opassword', t('Current Password:'), '', t('Your current password to confirm the changes')], + '$password4'=> ['mpassword', t('Password:'), '', t('Your current password to confirm the changes')], '$oid_enable' => (!Config::get('system', 'no_openid')), '$openid' => $openid_field, '$h_basic' => t('Basic Settings'), - '$username' => array('username', t('Full Name:'), $username, ''), - '$email' => array('email', t('Email Address:'), $email, '', '', '', 'email'), - '$timezone' => array('timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''), - '$language' => array('language', t('Your Language:'), $language, t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices), - '$defloc' => array('defloc', t('Default Post Location:'), $defloc, ''), - '$allowloc' => array('allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''), + '$username' => ['username', t('Full Name:'), $username, ''], + '$email' => ['email', t('Email Address:'), $email, '', '', '', 'email'], + '$timezone' => ['timezone_select' , t('Your Timezone:'), select_timezone($timezone), ''], + '$language' => ['language', t('Your Language:'), $language, t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices], + '$defloc' => ['defloc', t('Default Post Location:'), $defloc, ''], + '$allowloc' => ['allow_location', t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''], '$h_prv' => t('Security and Privacy Settings'), - '$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), $maxreq , t("\x28to prevent spam abuse\x29")), + '$maxreq' => ['maxreq', t('Maximum Friend Requests/Day:'), $maxreq , t("\x28to prevent spam abuse\x29")], '$permissions' => t('Default Post Permissions'), '$permdesc' => t("\x28click to open/close\x29"), '$visibility' => $profile['net-publish'], @@ -1245,33 +1245,33 @@ function settings_content(App $a) '$hide_friends' => $hide_friends, '$hide_wall' => $hide_wall, '$unkmail' => $unkmail, - '$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), $cntunkmail , t("\x28to prevent spam abuse\x29")), + '$cntunkmail' => ['cntunkmail', t('Maximum private messages per day from unknown people:'), $cntunkmail , t("\x28to prevent spam abuse\x29")], '$h_not' => t('Notification Settings'), '$activity_options' => t('By default post a status message when:'), - '$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, ''), - '$post_joingroup' => array('post_joingroup', t('joining a forum/community'), $post_joingroup, ''), - '$post_profilechange' => array('post_profilechange', t('making an interesting profile change'), $post_profilechange, ''), + '$post_newfriend' => ['post_newfriend', t('accepting a friend request'), $post_newfriend, ''], + '$post_joingroup' => ['post_joingroup', t('joining a forum/community'), $post_joingroup, ''], + '$post_profilechange' => ['post_profilechange', t('making an interesting profile change'), $post_profilechange, ''], '$lbl_not' => t('Send a notification email when:'), - '$notify1' => array('notify1', t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''), - '$notify2' => array('notify2', t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''), - '$notify3' => array('notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''), - '$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''), - '$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''), - '$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''), - '$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''), - '$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''), - - '$desktop_notifications' => array('desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new notifications')), - - '$email_textonly' => array('email_textonly', t('Text-only notification emails'), + '$notify1' => ['notify1', t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''], + '$notify2' => ['notify2', t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''], + '$notify3' => ['notify3', t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''], + '$notify4' => ['notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''], + '$notify5' => ['notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''], + '$notify6' => ['notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''], + '$notify7' => ['notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''], + '$notify8' => ['notify8', t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''], + + '$desktop_notifications' => ['desktop_notifications', t('Activate desktop notifications') , false, t('Show desktop popup on new notifications')], + + '$email_textonly' => ['email_textonly', t('Text-only notification emails'), PConfig::get(local_user(), 'system', 'email_textonly'), - t('Send text only notification emails, without the html part')), + t('Send text only notification emails, without the html part')], - '$detailed_notif' => array('detailed_notif', t('Show detailled notifications'), + '$detailed_notif' => ['detailed_notif', t('Show detailled notifications'), PConfig::get(local_user(), 'system', 'detailed_notif'), - t('Per default the notificiation are condensed to a single notification per item. When enabled, every notification is displayed.')), + t('Per default the notificiation are condensed to a single notification per item. When enabled, every notification is displayed.')], '$h_advn' => t('Advanced Account/Page Type Settings'), '$h_descadvn' => t('Change the behaviour of this account for special situations'), @@ -1281,7 +1281,7 @@ function settings_content(App $a) '$relocate_text' => t("If you have moved this profile from another server, and some of your contacts don't receive your updates, try pushing this button."), '$relocate_button' => t("Resend relocate message to contacts"), - )); + ]); call_hooks('settings_form', $o); diff --git a/mod/share.php b/mod/share.php index e97fa82dc8..f67dd3d200 100644 --- a/mod/share.php +++ b/mod/share.php @@ -34,17 +34,17 @@ function share_init(App $a) { } function share_header($author, $profile, $avatar, $guid, $posted, $link) { - $header = "[share author='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $author). - "' profile='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $profile). - "' avatar='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $avatar); + $header = "[share author='".str_replace(["'", "[", "]"], ["'", "[", "]"], $author). + "' profile='".str_replace(["'", "[", "]"], ["'", "[", "]"], $profile). + "' avatar='".str_replace(["'", "[", "]"], ["'", "[", "]"], $avatar); if ($guid) { - $header .= "' guid='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $guid); + $header .= "' guid='".str_replace(["'", "[", "]"], ["'", "[", "]"], $guid); } if ($posted) { - $header .= "' posted='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $posted); + $header .= "' posted='".str_replace(["'", "[", "]"], ["'", "[", "]"], $posted); } - $header .= "' link='".str_replace(array("'", "[", "]"), array("'", "[", "]"), $link)."']"; + $header .= "' link='".str_replace(["'", "[", "]"], ["'", "[", "]"], $link)."']"; return $header; } diff --git a/mod/smilies.php b/mod/smilies.php index b19ba2e436..d96a4bfc6d 100644 --- a/mod/smilies.php +++ b/mod/smilies.php @@ -14,9 +14,9 @@ function smilies_content(App $a) { if ($a->argv[1] === "json") { $tmp = Smilies::getList(); - $results = array(); + $results = []; for ($i = 0; $i < count($tmp['texts']); $i++) { - $results[] = array('text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]); + $results[] = ['text' => $tmp['texts'][$i], 'icon' => $tmp['icons'][$i]]; } json_return_and_die($results); } else { diff --git a/mod/statistics_json.php b/mod/statistics_json.php index 9b2263da77..21eb10ab48 100644 --- a/mod/statistics_json.php +++ b/mod/statistics_json.php @@ -16,7 +16,7 @@ function statistics_json_init(App $a) { killme(); } - $statistics = array( + $statistics = [ "name" => $a->config["sitename"], "network" => FRIENDICA_PLATFORM, "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION, @@ -25,9 +25,9 @@ function statistics_json_init(App $a) { "active_users_halfyear" => Config::get('nodeinfo', 'active_users_halfyear'), "active_users_monthly" => Config::get('nodeinfo', 'active_users_monthly'), "local_posts" => Config::get('nodeinfo', 'local_posts') - ); + ]; - $statistics["services"] = array(); + $statistics["services"] = []; $statistics["services"]["appnet"] = plugin_enabled("appnet"); $statistics["services"]["blogger"] = plugin_enabled("blogger"); $statistics["services"]["buffer"] = plugin_enabled("buffer"); diff --git a/mod/subthread.php b/mod/subthread.php index 9200c335e1..20405ba2d4 100644 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -110,7 +110,7 @@ EOT; return; } - $arr = array(); + $arr = []; $arr['guid'] = get_guid(32); $arr['uri'] = $uri; diff --git a/mod/suggest.php b/mod/suggest.php index c3986e2555..8a25fb0b21 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -22,15 +22,15 @@ function suggest_init(App $a) { // can't take arguments in its "action" parameter // so add any arguments as hidden inputs $query = explode_querystring($a->query_string); - $inputs = array(); + $inputs = []; foreach ($query['args'] as $arg) { if (strpos($arg, 'confirm=') === false) { $arg_parts = explode('=', $arg); - $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]); + $inputs[] = ['name' => $arg_parts[0], 'value' => $arg_parts[1]]; } } - $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array( + $a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [ '$method' => 'get', '$message' => t('Do you really want to delete this suggestion?'), '$extra_inputs' => $inputs, @@ -38,13 +38,13 @@ function suggest_init(App $a) { '$confirm_url' => $query['base'], '$confirm_name' => 'confirmed', '$cancel' => t('Cancel'), - )); + ]); $a->error = 1; // Set $a->error so the other module functions don't execute return; } // Now check how the user responded to the confirmation query if (!$_REQUEST['canceled']) { - dba::insert('gcign', array('uid' => local_user(), 'gcid' => $_GET['ignore'])); + dba::insert('gcign', ['uid' => local_user(), 'gcid' => $_GET['ignore']]); } } @@ -77,15 +77,15 @@ function suggest_content(App $a) { $connlnk = System::baseUrl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $ignlnk = System::baseUrl() . '/suggest?ignore=' . $rr['id']; - $photo_menu = array( - 'profile' => array(t("View Profile"), Profile::zrl($rr["url"])), - 'follow' => array(t("Connect/Follow"), $connlnk), - 'hide' => array(t('Ignore/Hide'), $ignlnk) - ); + $photo_menu = [ + 'profile' => [t("View Profile"), Profile::zrl($rr["url"])], + 'follow' => [t("Connect/Follow"), $connlnk], + 'hide' => [t('Ignore/Hide'), $ignlnk] + ]; $contact_details = Contact::getDetailsByURL($rr["url"], local_user(), $rr); - $entry = array( + $entry = [ 'url' => Profile::zrl($rr['url']), 'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']), 'img_hover' => $rr['url'], @@ -103,16 +103,16 @@ function suggest_content(App $a) { 'ignore' => t('Ignore/Hide'), 'network' => ContactSelector::networkToName($rr['network'], $rr['url']), 'id' => ++$id, - ); + ]; $entries[] = $entry; } $tpl = get_markup_template('viewcontact_template.tpl'); - $o .= replace_macros($tpl,array( + $o .= replace_macros($tpl,[ '$title' => t('Friend Suggestions'), '$contacts' => $entries, - )); + ]); return $o; } diff --git a/mod/tagger.php b/mod/tagger.php index c7e8a9469a..90fd2414b8 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -17,7 +17,7 @@ function tagger_content(App $a) { $term = notags(trim($_GET['term'])); // no commas allowed - $term = str_replace(array(',',' '),array('','_'),$term); + $term = str_replace([',',' '],['','_'],$term); if(! $term) return; @@ -104,7 +104,7 @@ EOT; $termlink = html_entity_decode('⌗') . '[url=' . System::baseUrl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/url]'; - $arr = array(); + $arr = []; $arr['guid'] = get_guid(32); $arr['uri'] = $uri; diff --git a/mod/uexport.php b/mod/uexport.php index 3960825080..5881817b30 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -36,26 +36,26 @@ function uexport_content(App $a) { * options shown on "Export personal data" page * list of array( 'link url', 'link text', 'help text' ) */ - $options = array( - array('uexport/account', t('Export account'), t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')), - array('uexport/backup', t('Export all'), t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')), - ); + $options = [ + ['uexport/account', t('Export account'), t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')], + ['uexport/backup', t('Export all'), t('Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account (photos are not exported)')], + ]; call_hooks('uexport_options', $options); $tpl = get_markup_template("uexport.tpl"); - return replace_macros($tpl, array( + return replace_macros($tpl, [ '$baseurl' => System::baseUrl(), '$title' => t('Export personal data'), '$options' => $options - )); + ]); } function _uexport_multirow($query) { - $result = array(); + $result = []; $r = q($query); if (DBM::is_result($r)) { foreach ($r as $rr) { - $p = array(); + $p = []; foreach ($rr as $k => $v) { $p[$k] = $v; } @@ -66,7 +66,7 @@ function _uexport_multirow($query) { } function _uexport_row($query) { - $result = array(); + $result = []; $r = q($query); if (DBM::is_result($r)) { foreach ($r as $rr) { @@ -112,7 +112,7 @@ function uexport_account($a) { sprintf("SELECT `group_member`.`gid`, `group_member`.`contact-id` FROM `group_member` INNER JOIN `group` ON `group`.`id` = `group_member`.`gid` WHERE `group`.`uid` = %d", intval(local_user())) ); - $output = array( + $output = [ 'version' => FRIENDICA_VERSION, 'schema' => DB_UPDATE_VERSION, 'baseurl' => System::baseUrl(), @@ -123,7 +123,7 @@ function uexport_account($a) { 'pconfig' => $pconfig, 'group' => $group, 'group_member' => $group_member, - ); + ]; //echo "
    "; var_dump(json_encode($output)); killme();
     	echo json_encode($output, JSON_PARTIAL_OUTPUT_ON_ERROR);
    @@ -146,14 +146,14 @@ function uexport_all(App $a) {
     	// chunk the output to avoid exhausting memory
     
     	for ($x = 0; $x < $total; $x += 500) {
    -		$item = array();
    +		$item = [];
     		$r = q("SELECT * FROM `item` WHERE `uid` = %d LIMIT %d, %d",
     			intval(local_user()),
     			intval($x),
     			intval(500)
     		);
     
    -		$output = array('item' => $r);
    +		$output = ['item' => $r];
     		echo json_encode($output, JSON_PARTIAL_OUTPUT_ON_ERROR). "\n";
     	}
     }
    diff --git a/mod/uimport.php b/mod/uimport.php
    index 114e4d0ab6..8516613410 100644
    --- a/mod/uimport.php
    +++ b/mod/uimport.php
    @@ -64,14 +64,14 @@ function uimport_content(App $a) {
     	}
     
     	$tpl = get_markup_template("uimport.tpl");
    -	return replace_macros($tpl, array(
    +	return replace_macros($tpl, [
     		'$regbutt' => t('Import'),
    -		'$import' => array(
    +		'$import' => [
     			'title' => t("Move account"),
     			'intro' => t("You can import an account from another Friendica server."),
     			'instruct' => t("You need to export your account from the old server and upload it here. We will recreate your old account here with all your contacts. We will try also to inform your friends that you moved here."),
     			'warn' => t("This feature is experimental. We can't import contacts from the OStatus network (GNU Social/Statusnet) or from Diaspora"),
    -			'field' => array('accountfile', t('Account file'), '', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')),
    -		),
    -	));
    +			'field' => ['accountfile', t('Account file'), '', t('To export your account, go to "Settings->Export your personal data" and select "Export account"')],
    +		],
    +	]);
     }
    diff --git a/mod/unfollow.php b/mod/unfollow.php
    index b84e1079d2..246cb8bad0 100644
    --- a/mod/unfollow.php
    +++ b/mod/unfollow.php
    @@ -32,7 +32,7 @@ function unfollow_post(App $a)
     	if (!DBM::is_result($contact)) {
     		notice(t("Contact wasn't found or can't be unfollowed."));
     	} else {
    -		if (in_array($contact['network'], array(NETWORK_OSTATUS, NETWORK_DIASPORA))) {
    +		if (in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA])) {
     			$r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
     				WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
     				intval($uid)
    @@ -41,7 +41,7 @@ function unfollow_post(App $a)
     				Contact::terminateFriendship($r[0], $contact);
     			}
     		}
    -		dba::update('contact', array('rel' => CONTACT_IS_FOLLOWER), array('id' => $contact['id']));
    +		dba::update('contact', ['rel' => CONTACT_IS_FOLLOWER], ['id' => $contact['id']]);
     
     		info(t('Contact unfollowed').EOL);
     		goaway(System::baseUrl().'/contacts/'.$contact['id']);
    @@ -74,7 +74,7 @@ function unfollow_content(App $a) {
     		// NOTREACHED
     	}
     
    -	if (!in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS))) {
    +	if (!in_array($contact['network'], [NETWORK_DIASPORA, NETWORK_OSTATUS])) {
     		notice(t("Unfollowing is currently not supported by your network.").EOL);
     		$submit = "";
     		// NOTREACHED
    @@ -98,7 +98,7 @@ function unfollow_content(App $a) {
     
     	$header = t("Disconnect/Unfollow");
     
    -	$o  = replace_macros($tpl,array(
    +	$o  = replace_macros($tpl,[
     			'$header' => htmlentities($header),
     			'$desc' => "",
     			'$pls_answer' => "",
    @@ -123,12 +123,12 @@ function unfollow_content(App $a) {
     			'$request' => $request,
     			'$keywords' => "",
     			'$keywords_label' => ""
    -	));
    +	]);
     
     	$a->page['aside'] = "";
     	Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
     
    -	$o .= replace_macros(get_markup_template('section_title.tpl'), array('$title' => t('Status Messages and Posts')));
    +	$o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => t('Status Messages and Posts')]);
     
     	// Show last public posts
     	$o .= Contact::getPostsFromUrl($contact["url"]);
    diff --git a/mod/videos.php b/mod/videos.php
    index 1a9f57a396..6dfbb74ed3 100644
    --- a/mod/videos.php
    +++ b/mod/videos.php
    @@ -48,13 +48,13 @@ function videos_init(App $a) {
     
     		$tpl = get_markup_template("vcard-widget.tpl");
     
    -		$vcard_widget = replace_macros($tpl, array(
    +		$vcard_widget = replace_macros($tpl, [
     			'$name' => $profile['name'],
     			'$photo' => $profile['photo'],
     			'$addr' => defaults($profile, 'addr', ''),
     			'$account_type' => $account_type,
     			'$pdesc' => defaults($profile, 'pdesc', ''),
    -		));
    +		]);
     
     
     		/*$sql_extra = permissions_sql($a->data['user']['uid']);
    @@ -97,14 +97,14 @@ function videos_init(App $a) {
     
     
     		$tpl = get_markup_template("videos_head.tpl");
    -		$a->page['htmlhead'] .= replace_macros($tpl,array(
    +		$a->page['htmlhead'] .= replace_macros($tpl,[
     			'$baseurl' => System::baseUrl(),
    -		));
    +		]);
     
     		$tpl = get_markup_template("videos_end.tpl");
    -		$a->page['end'] .= replace_macros($tpl,array(
    +		$a->page['end'] .= replace_macros($tpl,[
     			'$baseurl' => System::baseUrl(),
    -		));
    +		]);
     
     	}
     
    @@ -130,19 +130,19 @@ function videos_post(App $a) {
     			}
     
     			$drop_url = $a->query_string;
    -			$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), array(
    +			$a->page['content'] = replace_macros(get_markup_template('confirm.tpl'), [
     				'$method' => 'post',
     				'$message' => t('Do you really want to delete this video?'),
    -				'$extra_inputs' => array(
    -					array('name'=>'id', 'value'=> $_POST['id']),
    -					array('name'=>'delete', 'value'=>'x')
    -				),
    +				'$extra_inputs' => [
    +					['name'=>'id', 'value'=> $_POST['id']],
    +					['name'=>'delete', 'value'=>'x']
    +				],
     				'$confirm' => t('Delete Video'),
     				'$confirm_url' => $drop_url,
     				'$confirm_name' => 'confirm', // Needed so that confirmation will bring us back into this if statement
     				'$cancel' => t('Cancel'),
     
    -			));
    +			]);
     			$a->error = 1; // Set $a->error so the other module functions don't execute
     			return;
     		}
    @@ -380,37 +380,37 @@ function videos_content(App $a) {
     
     
     
    -	$videos = array();
    +	$videos = [];
     	if (DBM::is_result($r)) {
     		foreach ($r as $rr) {
     			$alt_e = $rr['filename'];
     			$name_e = $rr['album'];
     
    -			$videos[] = array(
    +			$videos[] = [
     				'id'       => $rr['id'],
     				'link'     => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['resource-id'],
     				'title'    => t('View Video'),
     				'src'      => System::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
     				'alt'      => $alt_e,
     				'mime'     => $rr['filetype'],
    -				'album' => array(
    +				'album' => [
     					'link'  => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
     					'name'  => $name_e,
     					'alt'   => t('View Album'),
    -				),
    +				],
     
    -			);
    +			];
     		}
     	}
     
     	$tpl = get_markup_template('videos_recent.tpl');
    -	$o .= replace_macros($tpl, array(
    +	$o .= replace_macros($tpl, [
     		'$title'      => t('Recent Videos'),
     		'$can_post'   => $can_post,
    -		'$upload'     => array(t('Upload New Videos'), System::baseUrl().'/videos/'.$a->data['user']['nickname'].'/upload'),
    +		'$upload'     => [t('Upload New Videos'), System::baseUrl().'/videos/'.$a->data['user']['nickname'].'/upload'],
     		'$videos'     => $videos,
     		'$delete_url' => (($can_post)?System::baseUrl().'/videos/'.$a->data['user']['nickname']:False)
    -	));
    +	]);
     
     
     	$o .= paginate($a);
    diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php
    index 64dd24e16c..a918c1ae57 100644
    --- a/mod/viewcontacts.php
    +++ b/mod/viewcontacts.php
    @@ -83,7 +83,7 @@ function viewcontacts_content(App $a) {
     		return $o;
     	}
     
    -	$contacts = array();
    +	$contacts = [];
     
     	foreach ($r as $rr) {
     		/// @TODO This triggers an E_NOTICE if 'self' is not there
    @@ -104,7 +104,7 @@ function viewcontacts_content(App $a) {
     
     		$contact_details = Contact::getDetailsByURL($rr['url'], $a->profile['uid'], $rr);
     
    -		$contacts[] = array(
    +		$contacts[] = [
     			'id' => $rr['id'],
     			'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $contact_details['name'], $rr['url']),
     			'photo_menu' => Contact::photoMenu($rr),
    @@ -119,16 +119,16 @@ function viewcontacts_content(App $a) {
     			'sparkle' => '',
     			'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
     			'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
    -		);
    +		];
     	}
     
     
     	$tpl = get_markup_template("viewcontact_template.tpl");
    -	$o .= replace_macros($tpl, array(
    +	$o .= replace_macros($tpl, [
     		'$title' => t('Contacts'),
     		'$contacts' => $contacts,
     		'$paginate' => paginate($a),
    -	));
    +	]);
     
     
     	return $o;
    diff --git a/mod/wall_attach.php b/mod/wall_attach.php
    index cfb1558a24..472a807324 100644
    --- a/mod/wall_attach.php
    +++ b/mod/wall_attach.php
    @@ -20,7 +20,7 @@ function wall_attach_post(App $a) {
     		);
     		if (! DBM::is_result($r)) {
     			if ($r_json) {
    -				echo json_encode(array('error'=>t('Invalid request.')));
    +				echo json_encode(['error'=>t('Invalid request.')]);
     				killme();
     			}
     			return;
    @@ -28,7 +28,7 @@ function wall_attach_post(App $a) {
     
     	} else {
     		if ($r_json) {
    -			echo json_encode(array('error'=>t('Invalid request.')));
    +			echo json_encode(['error'=>t('Invalid request.')]);
     			killme();
     		}
     		return;
    @@ -70,7 +70,7 @@ function wall_attach_post(App $a) {
     	}
     	if(! $can_post) {
     		if ($r_json) {
    -			echo json_encode(array('error'=>t('Permission denied.')));
    +			echo json_encode(['error'=>t('Permission denied.')]);
     			killme();
     		}
     		notice( t('Permission denied.') . EOL );
    @@ -79,7 +79,7 @@ function wall_attach_post(App $a) {
     
     	if(! x($_FILES,'userfile')) {
     		if ($r_json) {
    -			echo json_encode(array('error'=>t('Invalid request.')));
    +			echo json_encode(['error'=>t('Invalid request.')]);
     		}
     		killme();
     	}
    @@ -99,7 +99,7 @@ function wall_attach_post(App $a) {
     	if($filesize <=0) {
     		$msg = t('Sorry, maybe your upload is bigger than the PHP configuration allows') . EOL .(t('Or - did you try to upload an empty file?'));
     		if ($r_json) {
    -			echo json_encode(array('error'=>$msg));
    +			echo json_encode(['error'=>$msg]);
     		} else {
     			notice( $msg. EOL );
     		}
    @@ -110,7 +110,7 @@ function wall_attach_post(App $a) {
     	if(($maxfilesize) && ($filesize > $maxfilesize)) {
     		$msg = sprintf(t('File exceeds size limit of %s'), formatBytes($maxfilesize));
     		if ($r_json) {
    -			echo json_encode(array('error'=>$msg));
    +			echo json_encode(['error'=>$msg]);
     		} else {
     			echo  $msg. EOL ;
     		}
    @@ -123,9 +123,9 @@ function wall_attach_post(App $a) {
     	$hash = get_guid(64);
     	$created = datetime_convert();
     
    -	$fields = array('uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype,
    +	$fields = ['uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype,
     		'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created,
    -		'allow_cid' => '<' . $page_owner_cid . '>', 'allow_gid' => '','deny_cid' => '', 'deny_gid' => '');
    +		'allow_cid' => '<' . $page_owner_cid . '>', 'allow_gid' => '','deny_cid' => '', 'deny_gid' => ''];
     
     	$r = dba::insert('attach', $fields);
     
    @@ -134,7 +134,7 @@ function wall_attach_post(App $a) {
     	if(! $r) {
     		$msg =  t('File upload failed.');
     		if ($r_json) {
    -			echo json_encode(array('error'=>$msg));
    +			echo json_encode(['error'=>$msg]);
     		} else {
     			echo  $msg. EOL ;
     		}
    @@ -150,7 +150,7 @@ function wall_attach_post(App $a) {
     	if (! DBM::is_result($r)) {
     		$msg = t('File upload failed.');
     		if ($r_json) {
    -			echo json_encode(array('error'=>$msg));
    +			echo json_encode(['error'=>$msg]);
     		} else {
     			echo  $msg. EOL ;
     		}
    @@ -158,7 +158,7 @@ function wall_attach_post(App $a) {
     	}
     
     	if ($r_json) {
    -		echo json_encode(array('ok'=>true));
    +		echo json_encode(['ok'=>true]);
     		killme();
     	}
     
    diff --git a/mod/wall_upload.php b/mod/wall_upload.php
    index a608743d07..8708390e93 100644
    --- a/mod/wall_upload.php
    +++ b/mod/wall_upload.php
    @@ -35,7 +35,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     
     			if (! DBM::is_result($r)) {
     				if ($r_json) {
    -					echo json_encode(array('error'=>t('Invalid request.')));
    +					echo json_encode(['error'=>t('Invalid request.')]);
     					killme();
     				}
     				return;
    @@ -51,7 +51,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     		}
     	} else {
     		if ($r_json) {
    -			echo json_encode(array('error'=>t('Invalid request.')));
    +			echo json_encode(['error'=>t('Invalid request.')]);
     			killme();
     		}
     		return;
    @@ -100,7 +100,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     
     	if (! $can_post) {
     		if ($r_json) {
    -			echo json_encode(array('error'=>t('Permission denied.')));
    +			echo json_encode(['error'=>t('Permission denied.')]);
     			killme();
     		}
     		notice(t('Permission denied.') . EOL);
    @@ -109,7 +109,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     
     	if (! x($_FILES, 'userfile') && ! x($_FILES, 'media')) {
     		if ($r_json) {
    -			echo json_encode(array('error'=>t('Invalid request.')));
    +			echo json_encode(['error'=>t('Invalid request.')]);
     		}
     		killme();
     	}
    @@ -149,7 +149,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     
     	if ($src=="") {
     		if ($r_json) {
    -			echo json_encode(array('error'=>t('Invalid request.')));
    +			echo json_encode(['error'=>t('Invalid request.')]);
     			killme();
     		}
     		notice(t('Invalid request.').EOL);
    @@ -182,7 +182,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     	if (($maximagesize) && ($filesize > $maximagesize)) {
     		$msg = sprintf(t('Image exceeds size limit of %s'), formatBytes($maximagesize));
     		if ($r_json) {
    -			echo json_encode(array('error'=>$msg));
    +			echo json_encode(['error'=>$msg]);
     		} else {
     			echo  $msg. EOL;
     		}
    @@ -196,7 +196,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     	if (! $Image->isValid()) {
     		$msg = t('Unable to process image.');
     		if ($r_json) {
    -			echo json_encode(array('error'=>$msg));
    +			echo json_encode(['error'=>$msg]);
     		} else {
     			echo  $msg. EOL;
     		}
    @@ -235,7 +235,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     	if (! $r) {
     		$msg = t('Image upload failed.');
     		if ($r_json) {
    -			echo json_encode(array('error'=>$msg));
    +			echo json_encode(['error'=>$msg]);
     		} else {
     			echo  $msg. EOL;
     		}
    @@ -268,12 +268,12 @@ function wall_upload_post(App $a, $desktopmode = true) {
     		);
     		if (!$r) {
     			if ($r_json) {
    -				echo json_encode(array('error'=>''));
    +				echo json_encode(['error'=>'']);
     				killme();
     			}
     			return false;
     		}
    -		$picture = array();
    +		$picture = [];
     
     		$picture["id"]        = $r[0]["id"];
     		$picture["size"]      = $r[0]["datasize"];
    @@ -285,7 +285,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     		$picture["preview"]   = System::baseUrl() . "/photo/{$hash}-{$smallest}." . $Image->getExt();
     
     		if ($r_json) {
    -			echo json_encode(array('picture'=>$picture));
    +			echo json_encode(['picture'=>$picture]);
     			killme();
     		}
     		return $picture;
    @@ -293,7 +293,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
     
     
     	if ($r_json) {
    -		echo json_encode(array('ok'=>true));
    +		echo json_encode(['ok'=>true]);
     		killme();
     	}
     
    diff --git a/mod/wallmessage.php b/mod/wallmessage.php
    index cd43f0e03d..547290ca9a 100644
    --- a/mod/wallmessage.php
    +++ b/mod/wallmessage.php
    @@ -114,21 +114,21 @@ function wallmessage_content(App $a) {
     	}
     
     	$tpl = get_markup_template('wallmsg-header.tpl');
    -	$a->page['htmlhead'] .= replace_macros($tpl, array(
    +	$a->page['htmlhead'] .= replace_macros($tpl, [
     		'$baseurl' => System::baseUrl(true),
     		'$nickname' => $user['nickname'],
     		'$linkurl' => t('Please enter a link URL:')
    -	));
    +	]);
     
     	$tpl = get_markup_template('wallmsg-end.tpl');
    -	$a->page['end'] .= replace_macros($tpl, array(
    +	$a->page['end'] .= replace_macros($tpl, [
     		'$baseurl' => System::baseUrl(true),
     		'$nickname' => $user['nickname'],
     		'$linkurl' => t('Please enter a link URL:')
    -	));
    +	]);
     
     	$tpl = get_markup_template('wallmessage.tpl');
    -	$o .= replace_macros($tpl,array(
    +	$o .= replace_macros($tpl,[
     		'$header' => t('Send Private Message'),
     		'$subheader' => sprintf( t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.'), $user['username']),
     		'$to' => t('To:'),
    @@ -144,7 +144,7 @@ function wallmessage_content(App $a) {
     		'$upload' => t('Upload photo'),
     		'$insert' => t('Insert web link'),
     		'$wait' => t('Please wait')
    -	));
    +	]);
     
     	return $o;
     }
    diff --git a/mod/webfinger.php b/mod/webfinger.php
    index d72315a5b5..85d3b31200 100644
    --- a/mod/webfinger.php
    +++ b/mod/webfinger.php
    @@ -7,8 +7,8 @@ function webfinger_content(App $a) {
     
     	if (!local_user()) {
     		http_status_exit(403,
    -				array("title" => t("Public access denied."),
    -					"description" => t("Only logged in users are permitted to perform a probing.")));
    +				["title" => t("Public access denied."),
    +					"description" => t("Only logged in users are permitted to perform a probing.")]);
     		killme();
     	}
     
    diff --git a/mod/xrd.php b/mod/xrd.php
    index 05b07dc162..e5b537cd97 100644
    --- a/mod/xrd.php
    +++ b/mod/xrd.php
    @@ -64,21 +64,21 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
     	header('Access-Control-Allow-Origin: *');
     	header("Content-type: application/json; charset=utf-8");
     
    -	$json = array('subject' => $uri,
    -			'aliases' => array($alias, $profile_url),
    -			'links' => array(array('rel' => NAMESPACE_DFRN, 'href' => $profile_url),
    -					array('rel' => NAMESPACE_FEED, 'type' => 'application/atom+xml', 'href' => System::baseUrl().'/dfrn_poll/'.$r['nickname']),
    -					array('rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => $profile_url),
    -					array('rel' => 'http://microformats.org/profile/hcard', 'type' => 'text/html', 'href' => System::baseUrl().'/hcard/'.$r['nickname']),
    -					array('rel' => NAMESPACE_POCO, 'href' => System::baseUrl().'/poco/'.$r['nickname']),
    -					array('rel' => 'http://webfinger.net/rel/avatar', 'type' => 'image/jpeg', 'href' => System::baseUrl().'/photo/profile/'.$r['uid'].'.jpg'),
    -					array('rel' => 'http://joindiaspora.com/seed_location', 'type' => 'text/html', 'href' => System::baseUrl()),
    -					array('rel' => 'salmon', 'href' => System::baseUrl().'/salmon/'.$r['nickname']),
    -					array('rel' => 'http://salmon-protocol.org/ns/salmon-replies', 'href' => System::baseUrl().'/salmon/'.$r['nickname']),
    -					array('rel' => 'http://salmon-protocol.org/ns/salmon-mention', 'href' => System::baseUrl().'/salmon/'.$r['nickname'].'/mention'),
    -					array('rel' => 'http://ostatus.org/schema/1.0/subscribe', 'template' => System::baseUrl().'/follow?url={uri}'),
    -					array('rel' => 'magic-public-key', 'href' => 'data:application/magic-public-key,'.$salmon_key)
    -	));
    +	$json = ['subject' => $uri,
    +			'aliases' => [$alias, $profile_url],
    +			'links' => [['rel' => NAMESPACE_DFRN, 'href' => $profile_url],
    +					['rel' => NAMESPACE_FEED, 'type' => 'application/atom+xml', 'href' => System::baseUrl().'/dfrn_poll/'.$r['nickname']],
    +					['rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => $profile_url],
    +					['rel' => 'http://microformats.org/profile/hcard', 'type' => 'text/html', 'href' => System::baseUrl().'/hcard/'.$r['nickname']],
    +					['rel' => NAMESPACE_POCO, 'href' => System::baseUrl().'/poco/'.$r['nickname']],
    +					['rel' => 'http://webfinger.net/rel/avatar', 'type' => 'image/jpeg', 'href' => System::baseUrl().'/photo/profile/'.$r['uid'].'.jpg'],
    +					['rel' => 'http://joindiaspora.com/seed_location', 'type' => 'text/html', 'href' => System::baseUrl()],
    +					['rel' => 'salmon', 'href' => System::baseUrl().'/salmon/'.$r['nickname']],
    +					['rel' => 'http://salmon-protocol.org/ns/salmon-replies', 'href' => System::baseUrl().'/salmon/'.$r['nickname']],
    +					['rel' => 'http://salmon-protocol.org/ns/salmon-mention', 'href' => System::baseUrl().'/salmon/'.$r['nickname'].'/mention'],
    +					['rel' => 'http://ostatus.org/schema/1.0/subscribe', 'template' => System::baseUrl().'/follow?url={uri}'],
    +					['rel' => 'magic-public-key', 'href' => 'data:application/magic-public-key,'.$salmon_key]
    +	]];
     	echo json_encode($json);
     	killme();
     }
    @@ -92,7 +92,7 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r)
     
     	$tpl = get_markup_template('xrd_person.tpl');
     
    -	$o = replace_macros($tpl, array(
    +	$o = replace_macros($tpl, [
     		'$nick'        => $r['nickname'],
     		'$accturi'     => $uri,
     		'$alias'       => $alias,
    @@ -105,10 +105,10 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r)
     		'$salmon'      => System::baseUrl() . '/salmon/'        . $r['nickname'],
     		'$salmen'      => System::baseUrl() . '/salmon/'        . $r['nickname'] . '/mention',
     		'$subscribe'   => System::baseUrl() . '/follow?url={uri}',
    -		'$modexp'      => 'data:application/magic-public-key,'  . $salmon_key)
    +		'$modexp'      => 'data:application/magic-public-key,'  . $salmon_key]
     	);
     
    -	$arr = array('user' => $r, 'xml' => $o);
    +	$arr = ['user' => $r, 'xml' => $o];
     	call_hooks('personal_xrd', $arr);
     
     	echo $arr['xml'];
    diff --git a/src/App.php b/src/App.php
    index cd39604789..fdd928ba1a 100644
    --- a/src/App.php
    +++ b/src/App.php
    @@ -46,7 +46,7 @@ class App {
     	public $contacts;
     	public $page_contact;
     	public $content;
    -	public $data = array();
    +	public $data = [];
     	public $error = false;
     	public $cmd;
     	public $argv;
    @@ -60,15 +60,15 @@ class App {
     	public $timezone;
     	public $interactive = true;
     	public $plugins;
    -	public $plugins_admin = array();
    -	public $apps = array();
    +	public $plugins_admin = [];
    +	public $apps = [];
     	public $identities;
     	public $is_mobile = false;
     	public $is_tablet = false;
     	public $is_friendica_app;
    -	public $performance = array();
    -	public $callstack = array();
    -	public $theme_info = array();
    +	public $performance = [];
    +	public $callstack = [];
    +	public $theme_info = [];
     	public $backend = true;
     	public $nav_sel;
     	public $category;
    @@ -87,34 +87,34 @@ class App {
     	 * Mostly unimplemented yet. Only options 'template_engine' and
     	 * beyond are used.
     	 */
    -	public $theme = array(
    +	public $theme = [
     		'sourcename' => '',
     		'videowidth' => 425,
     		'videoheight' => 350,
     		'force_max_items' => 0,
     		'stylesheet' => '',
     		'template_engine' => 'smarty3',
    -	);
    +	];
     
     	/**
     	 * @brief An array of registered template engines ('name'=>'class name')
     	 */
    -	public $template_engines = array();
    +	public $template_engines = [];
     
     	/**
     	 * @brief An array of instanced template engines ('name'=>'instance')
     	 */
    -	public $template_engine_instance = array();
    +	public $template_engine_instance = [];
     	public $process_id;
     	public $queue;
    -	private $ldelim = array(
    +	private $ldelim = [
     		'internal' => '',
     		'smarty3' => '{{'
    -	);
    -	private $rdelim = array(
    +	];
    +	private $rdelim = [
     		'internal' => '',
     		'smarty3' => '}}'
    -	);
    +	];
     	private $scheme;
     	private $hostname;
     	private $db;
    @@ -160,16 +160,16 @@ class App {
     		$this->performance['marktime'] = 0;
     		$this->performance['markstart'] = microtime(true);
     
    -		$this->callstack['database'] = array();
    -		$this->callstack['database_write'] = array();
    -		$this->callstack['network'] = array();
    -		$this->callstack['file'] = array();
    -		$this->callstack['rendering'] = array();
    -		$this->callstack['parser'] = array();
    +		$this->callstack['database'] = [];
    +		$this->callstack['database_write'] = [];
    +		$this->callstack['network'] = [];
    +		$this->callstack['file'] = [];
    +		$this->callstack['rendering'] = [];
    +		$this->callstack['parser'] = [];
     
    -		$this->config = array();
    -		$this->page = array();
    -		$this->pager = array();
    +		$this->config = [];
    +		$this->page = [];
    +		$this->pager = [];
     
     		$this->query_string = '';
     
    @@ -274,7 +274,7 @@ class App {
     			$this->module = str_replace('-', '_', $this->module);
     		} else {
     			$this->argc = 1;
    -			$this->argv = array('home');
    +			$this->argv = ['home'];
     			$this->module = 'home';
     		}
     
    @@ -517,7 +517,7 @@ class App {
     		$invinite_scroll = infinite_scroll_data($this->module);
     
     		$tpl = get_markup_template('head.tpl');
    -		$this->page['htmlhead'] = replace_macros($tpl, array(
    +		$this->page['htmlhead'] = replace_macros($tpl, [
     				'$baseurl' => $this->get_baseurl(),
     				'$local_user' => local_user(),
     				'$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
    @@ -529,7 +529,7 @@ class App {
     				'$touch_icon' => $touch_icon,
     				'$stylesheet' => $stylesheet,
     				'$infinite_scroll' => $invinite_scroll,
    -			)) . $this->page['htmlhead'];
    +			]) . $this->page['htmlhead'];
     	}
     
     	function init_page_end() {
    @@ -537,9 +537,9 @@ class App {
     			$this->page['end'] = '';
     		}
     		$tpl = get_markup_template('end.tpl');
    -		$this->page['end'] = replace_macros($tpl, array(
    +		$this->page['end'] = replace_macros($tpl, [
     				'$baseurl' => $this->get_baseurl()
    -			)) . $this->page['end'];
    +			]) . $this->page['end'];
     	}
     
     	function set_curl_code($code) {
    @@ -709,7 +709,7 @@ class App {
     
     		$r = q('SELECT `pid` FROM `process` WHERE `pid` = %d', intval(getmypid()));
     		if (!DBM::is_result($r)) {
    -			dba::insert('process', array('pid' => getmypid(), 'command' => $command, 'created' => datetime_convert()));
    +			dba::insert('process', ['pid' => getmypid(), 'command' => $command, 'created' => datetime_convert()]);
     		}
     		dba::commit();
     	}
    @@ -724,7 +724,7 @@ class App {
     		if (DBM::is_result($r)) {
     			foreach ($r AS $process) {
     				if (!posix_kill($process['pid'], 0)) {
    -					dba::delete('process', array('pid' => $process['pid']));
    +					dba::delete('process', ['pid' => $process['pid']]);
     				}
     			}
     		}
    @@ -735,7 +735,7 @@ class App {
     	 * @brief Remove the active process from the "process" table
     	 */
     	function end_process() {
    -		dba::delete('process', array('pid' => getmypid()));
    +		dba::delete('process', ['pid' => getmypid()]);
     	}
     
     	function get_useragent() {
    @@ -760,7 +760,7 @@ class App {
     	 * @return bool Is it a known backend?
     	 */
     	function is_backend() {
    -		static $backends = array();
    +		static $backends = [];
     		$backends[] = '_well_known';
     		$backends[] = 'api';
     		$backends[] = 'dfrn_notify';
    @@ -837,7 +837,7 @@ class App {
     
     		$memdata = explode("\n", file_get_contents('/proc/meminfo'));
     
    -		$meminfo = array();
    +		$meminfo = [];
     		foreach ($memdata as $line) {
     			list($key, $val) = explode(':', $line);
     			$meminfo[$key] = (int) trim(str_replace('kB', '', $val));
    @@ -924,9 +924,9 @@ class App {
     		}
     
     		if (Config::get('system', 'proc_windows')) {
    -			$resource = proc_open('cmd /c start /b ' . $cmdline, array(), $foo, $this->get_basepath());
    +			$resource = proc_open('cmd /c start /b ' . $cmdline, [], $foo, $this->get_basepath());
     		} else {
    -			$resource = proc_open($cmdline . ' &', array(), $foo, $this->get_basepath());
    +			$resource = proc_open($cmdline . ' &', [], $foo, $this->get_basepath());
     		}
     		if (!is_resource($resource)) {
     			logger('We got no resource for command ' . $cmdline, LOGGER_DEBUG);
    diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php
    index 368ec98575..4eb2e74aa2 100644
    --- a/src/Content/ContactSelector.php
    +++ b/src/Content/ContactSelector.php
    @@ -49,14 +49,14 @@ class ContactSelector
     		$o = '';
     		$o .= "