Use short form array syntax everywhere

- Add short form array syntax to po2php.php generation
This commit is contained in:
Hypolite Petovan 2018-01-15 08:05:12 -05:00
parent 77dfbaa0bf
commit e36f2bb1fb
212 changed files with 5160 additions and 5160 deletions

View file

@ -49,14 +49,14 @@ class ContactSelector
$o = '';
$o .= "<select id=\"contact-poll-interval\" name=\"poll\" $dis />" . "\r\n";
$rep = array(
$rep = [
0 => t('Frequently'),
1 => t('Hourly'),
2 => t('Twice daily'),
3 => t('Daily'),
4 => t('Weekly'),
5 => t('Monthly')
);
];
foreach ($rep as $k => $v) {
$selected = (($k == $current) ? " selected=\"selected\" " : "");
@ -73,7 +73,7 @@ class ContactSelector
*/
public static function networkToName($s, $profile = "")
{
$nets = array(
$nets = [
NETWORK_DFRN => t('Friendica'),
NETWORK_OSTATUS => t('OStatus'),
NETWORK_FEED => t('RSS/Atom'),
@ -91,7 +91,7 @@ class ContactSelector
NETWORK_STATUSNET => t('GNU Social Connector'),
NETWORK_PNUT => t('pnut'),
NETWORK_APPNET => t('App.net')
);
];
call_hooks('network_to_name', $nets);
@ -100,7 +100,7 @@ class ContactSelector
$networkname = str_replace($search, $replace, $s);
if ((in_array($s, array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) && ($profile != "")) {
if ((in_array($s, [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) && ($profile != "")) {
$r = dba::fetch_first("SELECT `gserver`.`platform` FROM `gcontact`
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));

View file

@ -35,7 +35,7 @@ class Feature
$x = self::getDefault($feature);
}
$arr = array('uid' => $uid, 'feature' => $feature, 'enabled' => $x);
$arr = ['uid' => $uid, 'feature' => $feature, 'enabled' => $x];
call_hooks('isEnabled', $arr);
return($arr['enabled']);
}
@ -72,62 +72,62 @@ class Feature
*/
public static function get($filtered = true)
{
$arr = array(
$arr = [
// General
'general' => array(
'general' => [
t('General Features'),
//array('expire', t('Content Expiration'), t('Remove old posts/comments after a period of time')),
array('multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles'), false, Config::get('feature_lock', 'multi_profiles', false)),
array('photo_location', t('Photo Location'), t('Photo metadata is normally stripped. This extracts the location (if present) prior to stripping metadata and links it to a map.'), false, Config::get('feature_lock', 'photo_location', false)),
array('export_calendar', t('Export Public Calendar'), t('Ability for visitors to download the public calendar'), false, Config::get('feature_lock', 'export_calendar', false)),
),
['multi_profiles', t('Multiple Profiles'), t('Ability to create multiple profiles'), false, Config::get('feature_lock', 'multi_profiles', false)],
['photo_location', t('Photo Location'), t('Photo metadata is normally stripped. This extracts the location (if present) prior to stripping metadata and links it to a map.'), false, Config::get('feature_lock', 'photo_location', false)],
['export_calendar', t('Export Public Calendar'), t('Ability for visitors to download the public calendar'), false, Config::get('feature_lock', 'export_calendar', false)],
],
// Post composition
'composition' => array(
'composition' => [
t('Post Composition Features'),
array('preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them'), false, Config::get('feature_lock', 'preview', false)),
array('aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, Config::get('feature_lock', 'aclautomention', false)),
),
['preview', t('Post Preview'), t('Allow previewing posts and comments before publishing them'), false, Config::get('feature_lock', 'preview', false)],
['aclautomention', t('Auto-mention Forums'), t('Add/remove mention when a forum page is selected/deselected in ACL window.'), false, Config::get('feature_lock', 'aclautomention', false)],
],
// Network sidebar widgets
'widgets' => array(
'widgets' => [
t('Network Sidebar Widgets'),
array('archives', t('Search by Date'), t('Ability to select posts by date ranges'), false, Config::get('feature_lock', 'archives', false)),
array('forumlist_widget', t('List Forums'), t('Enable widget to display the forums your are connected with'), true, Config::get('feature_lock', 'forumlist_widget', false)),
array('groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group'), false, Config::get('feature_lock', 'groups', false)),
array('networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network'), false, Config::get('feature_lock', 'networks', false)),
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'), false, Config::get('feature_lock', 'savedsearch', false)),
),
['archives', t('Search by Date'), t('Ability to select posts by date ranges'), false, Config::get('feature_lock', 'archives', false)],
['forumlist_widget', t('List Forums'), t('Enable widget to display the forums your are connected with'), true, Config::get('feature_lock', 'forumlist_widget', false)],
['groups', t('Group Filter'), t('Enable widget to display Network posts only from selected group'), false, Config::get('feature_lock', 'groups', false)],
['networks', t('Network Filter'), t('Enable widget to display Network posts only from selected network'), false, Config::get('feature_lock', 'networks', false)],
['savedsearch', t('Saved Searches'), t('Save search terms for re-use'), false, Config::get('feature_lock', 'savedsearch', false)],
],
// Network tabs
'net_tabs' => array(
'net_tabs' => [
t('Network Tabs'),
array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'), false, Config::get('feature_lock', 'personal_tab', false)),
array('new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)'), false, Config::get('feature_lock', 'new_tab', false)),
array('link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them'), false, Config::get('feature_lock', 'link_tab', false)),
),
['personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'), false, Config::get('feature_lock', 'personal_tab', false)],
['new_tab', t('Network New Tab'), t('Enable tab to display only new Network posts (from the last 12 hours)'), false, Config::get('feature_lock', 'new_tab', false)],
['link_tab', t('Network Shared Links Tab'), t('Enable tab to display only Network posts with links in them'), false, Config::get('feature_lock', 'link_tab', false)],
],
// Item tools
'tools' => array(
'tools' => [
t('Post/Comment Tools'),
array('multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once'), false, Config::get('feature_lock', 'multi_delete', false)),
array('edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending'), false, Config::get('feature_lock', 'edit_posts', false)),
array('commtag', t('Tagging'), t('Ability to tag existing posts'), false, Config::get('feature_lock', 'commtag', false)),
array('categories', t('Post Categories'), t('Add categories to your posts'), false, Config::get('feature_lock', 'categories', false)),
array('filing', t('Saved Folders'), t('Ability to file posts under folders'), false, Config::get('feature_lock', 'filing', false)),
array('dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'), false, Config::get('feature_lock', 'dislike', false)),
array('star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'), false, Config::get('feature_lock', 'star_posts', false)),
array('ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread'), false, Config::get('feature_lock', 'ignore_posts', false)),
),
['multi_delete', t('Multiple Deletion'), t('Select and delete multiple posts/comments at once'), false, Config::get('feature_lock', 'multi_delete', false)],
['edit_posts', t('Edit Sent Posts'), t('Edit and correct posts and comments after sending'), false, Config::get('feature_lock', 'edit_posts', false)],
['commtag', t('Tagging'), t('Ability to tag existing posts'), false, Config::get('feature_lock', 'commtag', false)],
['categories', t('Post Categories'), t('Add categories to your posts'), false, Config::get('feature_lock', 'categories', false)],
['filing', t('Saved Folders'), t('Ability to file posts under folders'), false, Config::get('feature_lock', 'filing', false)],
['dislike', t('Dislike Posts'), t('Ability to dislike posts/comments'), false, Config::get('feature_lock', 'dislike', false)],
['star_posts', t('Star Posts'), t('Ability to mark special posts with a star indicator'), false, Config::get('feature_lock', 'star_posts', false)],
['ignore_posts', t('Mute Post Notifications'), t('Ability to mute notifications for a thread'), false, Config::get('feature_lock', 'ignore_posts', false)],
],
// Advanced Profile Settings
'advanced_profile' => array(
'advanced_profile' => [
t('Advanced Profile Settings'),
array('forumlist_profile', t('List Forums'), t('Show visitors public community forums at the Advanced Profile Page'), false, Config::get('feature_lock', 'forumlist_profile', false)),
array('tagadelic', t('Tag Cloud'), t('Provide a personal tag cloud on your profile page'), false, Config::get('feature_lock', 'tagadelic', false)),
),
);
['forumlist_profile', t('List Forums'), t('Show visitors public community forums at the Advanced Profile Page'), false, Config::get('feature_lock', 'forumlist_profile', false)],
['tagadelic', t('Tag Cloud'), t('Provide a personal tag cloud on your profile page'), false, Config::get('feature_lock', 'tagadelic', false)],
],
];
// removed any locked features and remove the entire category if this makes it empty

View file

@ -35,7 +35,7 @@ class ForumManager
*/
public static function getList($uid, $lastitem, $showhidden = true, $showprivate = false)
{
$forumlist = array();
$forumlist = [];
$order = (($showhidden) ? '' : ' AND NOT `hidden` ');
$order .= (($lastitem) ? ' ORDER BY `last-item` DESC ' : ' ORDER BY `name` ASC ');
@ -59,13 +59,13 @@ class ForumManager
}
while ($contact = dba::fetch($contacts)) {
$forumlist[] = array(
$forumlist[] = [
'url' => $contact['url'],
'name' => $contact['name'],
'id' => $contact['id'],
'micro' => $contact['micro'],
'thumb' => $contact['thumb'],
);
];
}
dba::close($contacts);
@ -104,7 +104,7 @@ class ForumManager
foreach ($contacts as $contact) {
$selected = (($cid == $contact['id']) ? ' forum-selected' : '');
$entry = array(
$entry = [
'url' => 'network?f=&cid=' . $contact['id'],
'external_url' => 'redir/' . $contact['id'],
'name' => $contact['name'],
@ -112,7 +112,7 @@ class ForumManager
'selected' => $selected,
'micro' => System::removedBaseUrl(proxy_url($contact['micro'], false, PROXY_SIZE_MICRO)),
'id' => ++$id,
);
];
$entries[] = $entry;
}
@ -120,13 +120,13 @@ class ForumManager
$o .= replace_macros(
$tpl,
array(
[
'$title' => t('Forums'),
'$forums' => $entries,
'$link_desc' => t('External link to forum'),
'$total' => $total,
'$visible_forums' => $visible_forums,
'$showmore' => t('show more'))
'$showmore' => t('show more')]
);
}

View file

@ -67,7 +67,7 @@ class OEmbed
// These media files should now be caught in bbcode.php
// left here as a fallback in case this is called from another source
$noexts = array("mp3", "mp4", "ogg", "ogv", "oga", "ogm", "webm");
$noexts = ["mp3", "mp4", "ogg", "ogv", "oga", "ogm", "webm"];
$ext = pathinfo(strtolower($embedurl), PATHINFO_EXTENSION);
@ -125,7 +125,7 @@ class OEmbed
// Always embed the SSL version
if (isset($j->html)) {
$j->html = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"), array("https://www.youtube.com/", "https://player.vimeo.com/"), $j->html);
$j->html = str_replace(["http://www.youtube.com/", "http://player.vimeo.com/"], ["https://www.youtube.com/", "https://player.vimeo.com/"], $j->html);
}
$j->embedurl = $embedurl;
@ -175,14 +175,14 @@ class OEmbed
$th = 120;
$tw = $th * $tr;
$tpl = get_markup_template('oembed_video.tpl');
$ret .= replace_macros($tpl, array(
$ret .= replace_macros($tpl, [
'$baseurl' => System::baseUrl(),
'$embedurl' => $embedurl,
'$escapedhtml' => base64_encode($jhtml),
'$tw' => $tw,
'$th' => $th,
'$turl' => $j->thumbnail_url,
));
]);
} else {
$ret = $jhtml;
}
@ -317,8 +317,8 @@ class OEmbed
public static function getHTML($url, $title = null)
{
// Always embed the SSL version
$url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"),
array("https://www.youtube.com/", "https://player.vimeo.com/"), $url);
$url = str_replace(["http://www.youtube.com/", "http://player.vimeo.com/"],
["https://www.youtube.com/", "https://player.vimeo.com/"], $url);
$o = self::fetchURL($url, !self::isAllowedURL($url));

View file

@ -61,7 +61,7 @@ class Smilies
*/
public static function getList()
{
$texts = array(
$texts = [
'&lt;3',
'&lt;/3',
'&lt;\\3',
@ -98,9 +98,9 @@ class Smilies
'red#',
'red#matrix'
);
];
$icons = array(
$icons = [
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-heart.gif" alt="&lt;3" title="&lt;3" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-brokenheart.gif" alt="&lt;/3" title="&lt;/3" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-brokenheart.gif" alt="&lt;\\3" title="&lt;\\3" />',
@ -136,9 +136,9 @@ class Smilies
'<a href="https://friendi.ca">~friendica <img class="smiley" src="' . System::baseUrl() . '/images/friendica-16.png" alt="~friendica" title="~friendica" /></a>',
'<a href="http://redmatrix.me/">red<img class="smiley" src="' . System::baseUrl() . '/images/rm-16.png" alt="red#" title="red#" />matrix</a>',
'<a href="http://redmatrix.me/">red<img class="smiley" src="' . System::baseUrl() . '/images/rm-16.png" alt="red#matrix" title="red#matrix" />matrix</a>'
);
];
$params = array('texts' => $texts, 'icons' => $icons);
$params = ['texts' => $texts, 'icons' => $icons];
call_hooks('smilie', $params);
return $params;
@ -175,7 +175,7 @@ class Smilies
$params = self::getList();
if ($no_images) {
$cleaned = array('texts' => array(), 'icons' => array());
$cleaned = ['texts' => [], 'icons' => []];
$icons = $params['icons'];
foreach ($icons as $key => $icon) {
if (!strstr($icon, '<img ')) {