- *
+ *
*/
use Friendica\Core\PConfig;
@@ -141,7 +141,7 @@ function blockem_prepare_body(&$a,&$b) {
}
if($found) {
$rnd = random_string(8);
- $b['html'] = '' . sprintf( t('Blocked %s - Click to open/close'),$word ) . '
' . $b['html'] . '
';
+ $b['html'] = '' . sprintf( t('Blocked %s - Click to open/close'),$word ) . '
' . $b['html'] . '
';
}
}
@@ -218,7 +218,7 @@ function blockem_init(&$a) {
}
if(array_key_exists('unblock',$_GET) && $_GET['unblock']) {
$arr = explode(',',$words);
- $newarr = array();
+ $newarr = [];
if(count($arr)) {
foreach($arr as $x) {
diff --git a/buffer/buffer.php b/buffer/buffer.php
index 932789da..b90d9090 100644
--- a/buffer/buffer.php
+++ b/buffer/buffer.php
@@ -57,12 +57,12 @@ function buffer_content(&$a) {
function buffer_plugin_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/buffer/" );
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Save Settings'),
// name, label, value, help, [extra values]
- '$client_id' => array('client_id', t('Client ID'), Config::get('buffer', 'client_id' ), ''),
- '$client_secret' => array('client_secret', t('Client Secret'), Config::get('buffer', 'client_secret' ), ''),
- ));
+ '$client_id' => ['client_id', t('Client ID'), Config::get('buffer', 'client_id' ), ''],
+ '$client_secret' => ['client_secret', t('Client Secret'), Config::get('buffer', 'client_secret' ), ''],
+ ]);
}
function buffer_plugin_admin_post(&$a){
$client_id = ((x($_POST,'client_id')) ? notags(trim($_POST['client_id'])) : '');
@@ -369,7 +369,7 @@ function buffer_send(App $a, &$b)
elseif ($profile->service == "google")
$post["text"] .= html_entity_decode(" ", ENT_QUOTES, 'UTF-8'); // Send a special blank to identify the post through the "fromgplus" addon
- $message = array();
+ $message = [];
$message["text"] = $post["text"];
$message["profile_ids[]"] = $profile->id;
$message["shorten"] = false;
diff --git a/buffer/bufferapp.php b/buffer/bufferapp.php
index 7215175d..a222b23e 100644
--- a/buffer/bufferapp.php
+++ b/buffer/bufferapp.php
@@ -12,7 +12,7 @@
public $ok = false;
- private $endpoints = array(
+ private $endpoints = [
'/user' => 'get',
'/profiles' => 'get',
@@ -37,9 +37,9 @@
'/info/configuration' => 'get',
- );
+ ];
- public $errors = array(
+ public $errors = [
'invalid-endpoint' => 'The endpoint you supplied does not appear to be valid.',
'403' => 'Permission denied.',
@@ -77,7 +77,7 @@
'1042' => 'User did not save successfully.',
'1050' => 'Client could not be found.',
'1051' => 'No authorization to access client.',
- );
+ ];
function __construct($client_id = '', $client_secret = '', $callback_url = '', $access_token = '') {
if ($client_id) $this->set_client_id($client_id);
@@ -110,7 +110,7 @@
if (!$ok) return $this->error('invalid-endpoint');
}
- if (!$data || !is_array($data)) $data = array();
+ if (!$data || !is_array($data)) $data = [];
$data['access_token'] = $this->access_token;
$method = $this->endpoints[$done_endpoint]; //get() or post()
@@ -130,17 +130,17 @@
}
function error($error) {
- return (object) array('error' => $this->errors[$error]);
+ return (object) ['error' => $this->errors[$error]];
}
function create_access_token_url() {
- $data = array(
+ $data = [
'code' => $this->code,
'grant_type' => 'authorization_code',
'client_id' => $this->client_id,
'client_secret' => $this->client_secret,
'redirect_uri' => $this->callback_url,
- );
+ ];
$obj = $this->post($this->access_token_url, $data);
$this->access_token = $obj->access_token;
@@ -150,15 +150,15 @@
function req($url = '', $data = '', $post = true) {
if (!$url) return false;
- if (!$data || !is_array($data)) $data = array();
+ if (!$data || !is_array($data)) $data = [];
- $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false);
+ $options = [CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false];
if ($post) {
- $options += array(
+ $options += [
CURLOPT_POST => $post,
CURLOPT_POSTFIELDS => $data
- );
+ ];
} else {
$url .= '?' . http_build_query($data);
}
diff --git a/communityhome/communityhome.php b/communityhome/communityhome.php
index 288bf7a8..7cfb3d23 100644
--- a/communityhome/communityhome.php
+++ b/communityhome/communityhome.php
@@ -62,27 +62,27 @@ function communityhome_home(&$a, &$o){
$a->page['htmlhead'] .= ' ';
if (!Config::get('communityhome','hidelogin')){
- $aside = array(
+ $aside = [
'$tab_1' => t('Login'),
'$tab_2' => t('OpenID'),
'$noOid' => Config::get('system','no_openid'),
- );
+ ];
// login form
$aside['$login_title'] = t('Login');
$aside['$login_form'] = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true);
} else {
- $aside = array(
+ $aside = [
//'$tab_1' => t('Login'),
//'$tab_2' => t('OpenID'),
//'$noOid' => Config::get('system','no_openid'),
- );
+ ];
}
// last 12 users
if (Config::get('communityhome','showlastusers')){
$aside['$lastusers_title'] = t('Latest users');
- $aside['$lastusers_items'] = array();
+ $aside['$lastusers_items'] = [];
$sql_extra = "";
$publish = (Config::get('system','publish_all') ? '' : " AND `publish` = 1 " );
$order = " ORDER BY `register_date` DESC ";
@@ -99,12 +99,12 @@ function communityhome_home(&$a, &$o){
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
- $entry = replace_macros($tpl,array(
+ $entry = replace_macros($tpl,[
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $a->get_cached_avatar_image($rr[$photo]),
'$alt_text' => $rr['name'],
- ));
+ ]);
$aside['$lastusers_items'][] = $entry;
}
}
@@ -127,17 +127,17 @@ function communityhome_home(&$a, &$o){
LIMIT 0,10");
if($r && count($r)) {
$aside['$activeusers_title'] = t('Most active users');
- $aside['$activeusers_items'] = array();
+ $aside['$activeusers_items'] = [];
$photo = 'thumb';
foreach($r as $rr) {
$profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
- $entry = replace_macros($tpl,array(
+ $entry = replace_macros($tpl,[
'$id' => $rr['id'],
'$profile_link' => $profile_link,
'$photo' => $rr[$photo],
'$photo_user' => sprintf("%s (%s posts, %s contacts)",$rr['name'], ($rr['items']?$rr['items']:'0'), ($rr['contacts']?$rr['contacts']:'0'))
- ));
+ ]);
$aside['$activeusers_items'][] = $entry;
}
}
@@ -145,7 +145,7 @@ function communityhome_home(&$a, &$o){
// last 12 photos
if (Config::get('communityhome','showlastphotos')){
$aside['$photos_title'] = t('Latest photos');
- $aside['$photos_items'] = array();
+ $aside['$photos_items'] = [];
$r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM
(SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo`
WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
@@ -169,13 +169,13 @@ function communityhome_home(&$a, &$o){
$photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
$photo_url = $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
- $entry = replace_macros($tpl,array(
+ $entry = replace_macros($tpl,[
'$id' => $rr['id'],
'$profile_link' => $photo_page,
'$photo' => $photo_url,
'$photo_user' => $rr['username'],
'$photo_title' => $rr['desc']
- ));
+ ]);
$aside['$photos_items'][] = $entry;
}
@@ -185,7 +185,7 @@ function communityhome_home(&$a, &$o){
// last 10 liked items
if (Config::get('communityhome','showlastlike')){
$aside['$like_title'] = t('Latest likes');
- $aside['$like_items'] = array();
+ $aside['$like_items'] = [];
$r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM
(SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link`
FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
@@ -215,7 +215,7 @@ function communityhome_home(&$a, &$o){
default:
if ($rr['resource-id']){
$post_type = t('photo');
- $m=array(); preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
+ $m=[]; preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
$rr['plink'] = $m[1];
} else {
$post_type = t('status');
diff --git a/convert/convert.php b/convert/convert.php
index 75131650..03b1e9d5 100644
--- a/convert/convert.php
+++ b/convert/convert.php
@@ -15,7 +15,7 @@ function convert_uninstall() {
}
function convert_app_menu($a,&$b) {
- $b['app_menu'][] = '';
+ $b['app_menu'][] = '';
}
@@ -30,7 +30,7 @@ function convert_module() {}
function convert_content($app) {
include("UnitConvertor.php");
-
+
class TP_Converter extends UnitConvertor {
function TP_Converter($lang = "en")
{
@@ -39,7 +39,7 @@ include("UnitConvertor.php");
} else {
$dec_point = '.'; $thousand_sep = ",";
}
-
+
$this->UnitConvertor($dec_point , $thousand_sep );
} // end func UnitConvertor
@@ -47,24 +47,24 @@ include("UnitConvertor.php");
function find_base_unit($from,$to) {
while (list($skey,$sval) = each($this->bases)) {
if ($skey == $from || $to == $skey || in_array($to,$sval) || in_array($from,$sval)) {
- return $skey;
+ return $skey;
}
}
- return false;
+ return false;
}
function getTable($value, $from_unit, $to_unit, $precision) {
-
+
if ($base_unit = $this->find_base_unit($from_unit,$to_unit)) {
-
- // A baseunit was found now lets convert from -> $base_unit
-
- $cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit;
+
+ // A baseunit was found now lets convert from -> $base_unit
+
+ $cell ['value'] = $this->convert($value, $from_unit, $base_unit, $precision)." ".$base_unit;
$cell ['class'] = ($base_unit == $from_unit || $base_unit == $to_unit) ? "framedred": "";
$cells[] = $cell;
// We now have the base unit and value now lets produce the table;
while (list($key,$val) = each($this->bases[$base_unit])) {
- $cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val;
+ $cell ['value'] = $this->convert($value, $from_unit, $val, $precision)." ".$val;
$cell ['class'] = ($val == $from_unit || $val == $to_unit) ? "framedred": "";
$cells[] = $cell;
}
@@ -83,8 +83,8 @@ include("UnitConvertor.php");
}
$string .= "";
return $string;
- }
-
+ }
+
}
}
@@ -92,16 +92,16 @@ include("UnitConvertor.php");
$conv = new TP_Converter('en');
-$conversions = array(
- 'Temperature'=>array('base' =>'Celsius',
- 'conv'=>array(
- 'Fahrenheit'=>array('ratio'=>1.8, 'offset'=>32),
- 'Kelvin'=>array('ratio'=>1, 'offset'=>273),
+$conversions = [
+ 'Temperature'=>['base' =>'Celsius',
+ 'conv'=>[
+ 'Fahrenheit'=>['ratio'=>1.8, 'offset'=>32],
+ 'Kelvin'=>['ratio'=>1, 'offset'=>273],
'Reaumur'=>0.8
- )
- ),
- 'Weight' => array('base' =>'kg',
- 'conv'=>array(
+ ]
+ ],
+ 'Weight' => ['base' =>'kg',
+ 'conv'=>[
'g'=>1000,
'mg'=>1000000,
't'=>0.001,
@@ -109,13 +109,13 @@ $conversions = array(
'oz'=>35.274,
'lb'=>2.2046,
'cwt(UK)' => 0.019684,
- 'cwt(US)' => 0.022046,
+ 'cwt(US)' => 0.022046,
'ton (US)' => 0.0011023,
'ton (UK)' => 0.0009842
- )
- ),
- 'Distance' => array('base' =>'km',
- 'conv'=>array(
+ ]
+ ],
+ 'Distance' => ['base' =>'km',
+ 'conv'=>[
'm'=>1000,
'dm'=>10000,
'cm'=>100000,
@@ -127,25 +127,25 @@ $conversions = array(
'yd'=>1093.6,
'furlong'=>4.970969537898672,
'fathom'=>546.8066491688539
- )
- ),
- 'Area' => array('base' =>'km 2',
- 'conv'=>array(
+ ]
+ ],
+ 'Area' => ['base' =>'km 2',
+ 'conv'=>[
'ha'=>100,
'acre'=>247.105,
'm 2'=>pow(1000,2),
'dm 2'=>pow(10000,2),
'cm 2'=>pow(100000,2),
- 'mm 2'=>pow(1000000,2),
+ 'mm 2'=>pow(1000000,2),
'mile 2'=>pow(0.62137,2),
'naut.miles 2'=>pow(0.53996,2),
'in 2'=>pow(39370,2),
'ft 2'=>pow(3280.8,2),
'yd 2'=>pow(1093.6,2),
- )
- ),
- 'Volume' => array('base' =>'m 3',
- 'conv'=>array(
+ ]
+ ],
+ 'Volume' => ['base' =>'m 3',
+ 'conv'=>[
'in 3'=>61023.6,
'ft 3'=>35.315,
'cm 3'=>pow(10,6),
@@ -161,22 +161,22 @@ $conversions = array(
'fl oz' => 33814.02,
'tablespoon' => 67628.04,
'teaspoon' => 202884.1,
- 'pt (UK)'=>1000/0.56826,
+ 'pt (UK)'=>1000/0.56826,
'barrel petroleum'=>1000/158.99,
- 'Register Tons'=>2.832,
+ 'Register Tons'=>2.832,
'Ocean Tons'=>1.1327
- )
- ),
- 'Speed' =>array('base' =>'kmph',
- 'conv'=>array(
+ ]
+ ],
+ 'Speed' =>['base' =>'kmph',
+ 'conv'=>[
'mps'=>0.0001726031,
'milesph'=>0.62137,
'knots'=>0.53996,
'mach STP'=>0.0008380431,
'c (warp)'=>9.265669e-10
- )
- )
-);
+ ]
+ ]
+];
while (list($key,$val) = each($conversions)) {
@@ -223,6 +223,6 @@ while (list($key,$val) = each($conversions)) {
$o .= '';
$o .= ' ';
-
+
return $o;
}
diff --git a/curweather/curweather.php b/curweather/curweather.php
index 6197c961..7b8b89e3 100644
--- a/curweather/curweather.php
+++ b/curweather/curweather.php
@@ -1,6 +1,6 @@
@@ -47,7 +47,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
} else {
$desc = (string)$res->weather['value'].', '.(string)$res->clouds['name'];
}
- $r = array(
+ $r = [
'city'=> (string) $res->city['name'][0],
'country' => (string) $res->city->country[0],
'lat' => (string) $res->city->coord['lat'],
@@ -59,7 +59,7 @@ function getWeather( $loc, $units='metric', $lang='en', $appid='', $cachetime=0)
'wind' => (string)$res->wind->speed['name'].' ('.(string)$res->wind->speed['value'].$wunit.')',
'update' => (string)$res->lastupdate['value'],
'icon' => (string)$res->weather['icon']
- );
+ ];
PConfig::set(local_user(), 'curweather', 'last', $now->getTimestamp());
Cache::set('curweather'.md5($url), serialize($r), CACHE_HOUR);
return $r;
@@ -111,7 +111,7 @@ function curweather_network_mod_init(&$fk_app,&$b) {
if ($ok) {
$t = get_markup_template("widget.tpl", "addon/curweather/" );
- $curweather = replace_macros ($t, array(
+ $curweather = replace_macros ($t, [
'$title' => t("Current Weather"),
'$icon' => proxy_url('http://openweathermap.org/img/w/'.$res['icon'].'.png'),
'$city' => $res['city'],
@@ -119,20 +119,20 @@ function curweather_network_mod_init(&$fk_app,&$b) {
'$lat' => $res['lat'],
'$description' => $res['descripion'],
'$temp' => $res['temperature'],
- '$relhumidity' => array('caption'=>t('Relative Humidity'), 'val'=>$res['humidity']),
- '$pressure' => array('caption'=>t('Pressure'), 'val'=>$res['pressure']),
- '$wind' => array('caption'=>t('Wind'), 'val'=> $res['wind']),
+ '$relhumidity' => ['caption'=>t('Relative Humidity'), 'val'=>$res['humidity']],
+ '$pressure' => ['caption'=>t('Pressure'), 'val'=>$res['pressure']],
+ '$wind' => ['caption'=>t('Wind'), 'val'=> $res['wind']],
'$lastupdate' => t('Last Updated').': '.$res['update'].'UTC',
'$databy' => t('Data by'),
'$showonmap' => t('Show on map')
- ));
+ ]);
} else {
$t = get_markup_template('widget-error.tpl', 'addon/curweather/');
- $curweather = replace_macros( $t, array(
+ $curweather = replace_macros( $t, [
'$problem' => t('There was a problem accessing the weather data. But have a look'),
'$rpt' => $rpt,
'$atOWM' => t('at OpenWeatherMap')
- ));
+ ]);
}
$fk_app->page['aside'] = $curweather.$fk_app->page['aside'];
@@ -161,25 +161,25 @@ function curweather_plugin_settings(&$a,&$s) {
$curweather_loc = PConfig::get(local_user(), 'curweather', 'curweather_loc');
$curweather_units = PConfig::get(local_user(), 'curweather', 'curweather_units');
$appid = Config::get('curweather','appid');
- if ($appid=="") {
+ if ($appid=="") {
$noappidtext = t('No APPID found, please contact your admin to obtain one.');
} else {
$noappidtext = '';
}
$enable = intval(PConfig::get(local_user(),'curweather','curweather_enable'));
$enable_checked = (($enable) ? ' checked="checked" ' : '');
-
+
// load template and replace the macros
$t = get_markup_template("settings.tpl", "addon/curweather/" );
- $s = replace_macros ($t, array(
- '$submit' => t('Save Settings'),
+ $s = replace_macros ($t, [
+ '$submit' => t('Save Settings'),
'$header' => t('Current Weather').' '.t('Settings'),
'$noappidtext' => $noappidtext,
'$info' => t('Enter either the name of your location or the zip code.'),
- '$curweather_loc' => array( 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. Berlin,DE or 14476,DE .') ),
- '$curweather_units' => array( 'curweather_units', t('Units'), $curweather_units, t('select if the temperature should be displayed in °C or °F'), array('metric'=>'°C', 'imperial'=>'°F')),
- '$enabled' => array( 'curweather_enable', t('Show weather data'), $enable, '')
- ));
+ '$curweather_loc' => [ 'curweather_loc', t('Your Location'), $curweather_loc, t('Identifier of your location (name or zip code), e.g. Berlin,DE or 14476,DE .') ],
+ '$curweather_units' => [ 'curweather_units', t('Units'), $curweather_units, t('select if the temperature should be displayed in °C or °F'), ['metric'=>'°C', 'imperial'=>'°F']],
+ '$enabled' => [ 'curweather_enable', t('Show weather data'), $enable, '']
+ ]);
return;
}
@@ -200,9 +200,9 @@ function curweather_plugin_admin (&$a, &$o) {
$appid = Config::get('curweather','appid');
$cachetime = Config::get('curweather','cachetime');
$t = get_markup_template("admin.tpl", "addon/curweather/" );
- $o = replace_macros ($t, array(
+ $o = replace_macros ($t, [
'$submit' => t('Save Settings'),
- '$cachetime' => array('cachetime', t('Caching Interval'), $cachetime, t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), array('0'=>t('no cache'), '300'=>'5 '.t('minutes'), '900'=>'15 '.t('minutes'), '1800'=>'30 '.t('minutes'), '3600'=>'60 '.t('minutes'))),
- '$appid' => array('appid', t('Your APPID'), $appid, t('Your API key provided by OpenWeatherMap'))
- ));
+ '$cachetime' => ['cachetime', t('Caching Interval'), $cachetime, t('For how long should the weather data be cached? Choose according your OpenWeatherMap account type.'), ['0'=>t('no cache'), '300'=>'5 '.t('minutes'), '900'=>'15 '.t('minutes'), '1800'=>'30 '.t('minutes'), '3600'=>'60 '.t('minutes')]],
+ '$appid' => ['appid', t('Your APPID'), $appid, t('Your API key provided by OpenWeatherMap')]
+ ]);
}
diff --git a/dav/friendica/calendar.friendica.fnk.php b/dav/friendica/calendar.friendica.fnk.php
index 60dd9c6b..b5d9082e 100644
--- a/dav/friendica/calendar.friendica.fnk.php
+++ b/dav/friendica/calendar.friendica.fnk.php
@@ -16,13 +16,13 @@ define("CALDAV_NAMESPACE_PRIVATE", 1);
define("CALDAV_FRIENDICA_MINE", "friendica-mine");
define("CALDAV_FRIENDICA_CONTACTS", "friendica-contacts");
-$GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"] = array(CALDAV_FRIENDICA_MINE, CALDAV_FRIENDICA_CONTACTS);
-$GLOBALS["CALDAV_PRIVATE_SYSTEM_BACKENDS"] = array("Sabre_CalDAV_Backend_Friendica");
+$GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"] = [CALDAV_FRIENDICA_MINE, CALDAV_FRIENDICA_CONTACTS];
+$GLOBALS["CALDAV_PRIVATE_SYSTEM_BACKENDS"] = ["Sabre_CalDAV_Backend_Friendica"];
define("CARDDAV_NAMESPACE_PRIVATE", 1);
define("CARDDAV_FRIENDICA_CONTACT", "friendica");
-$GLOBALS["CARDDAV_PRIVATE_SYSTEM_ADDRESSBOOKS"] = array(CARDDAV_FRIENDICA_CONTACT);
-$GLOBALS["CARDDAV_PRIVATE_SYSTEM_BACKENDS"] = array("Sabre_CardDAV_Backend_Friendica");
+$GLOBALS["CARDDAV_PRIVATE_SYSTEM_ADDRESSBOOKS"] = [CARDDAV_FRIENDICA_CONTACT];
+$GLOBALS["CARDDAV_PRIVATE_SYSTEM_BACKENDS"] = ["Sabre_CardDAV_Backend_Friendica"];
$GLOBALS["CALDAV_ACL_PLUGIN_CLASS"] = "Sabre_DAVACL_Plugin_Friendica";
@@ -106,7 +106,7 @@ function dav_compat_principal2namespace($principalUri = "")
if (strpos($principalUri, "principals/users/") !== 0) return null;
$username = substr($principalUri, strlen("principals/users/"));
- return array("namespace" => CALDAV_NAMESPACE_PRIVATE, "namespace_id" => dav_compat_username2id($username));
+ return ["namespace" => CALDAV_NAMESPACE_PRIVATE, "namespace_id" => dav_compat_username2id($username)];
}
@@ -200,13 +200,13 @@ function wdcal_calendar_factory_by_id($calendar_id)
*/
function wdcal_create_std_calendars_get_statements($user_id, $withcheck = true)
{
- $stms = array();
+ $stms = [];
$a = get_app();
- $uris = array(
+ $uris = [
'private' => t("Private Calendar"),
CALDAV_FRIENDICA_MINE => t("Friendica Events: Mine"),
CALDAV_FRIENDICA_CONTACTS => t("Friendica Events: Contacts"),
- );
+ ];
foreach ($uris as $uri => $name) {
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($user_id), dbesc($uri));
@@ -242,12 +242,12 @@ function wdcal_create_std_calendars()
*/
function wdcal_create_std_addressbooks_get_statements($user_id, $withcheck = true)
{
- $stms = array();
+ $stms = [];
$a = get_app();
- $uris = array(
+ $uris = [
'private' => t("Private Addresses"),
CARDDAV_FRIENDICA_CONTACT => t("Friendica Contacts"),
- );
+ ];
foreach ($uris as $uri => $name) {
$cals = q("SELECT * FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CALDAV_NAMESPACE_PRIVATE, IntVal($user_id), dbesc($uri));
diff --git a/dav/friendica/database-init.inc.php b/dav/friendica/database-init.inc.php
index e172b44d..d8ef96eb 100644
--- a/dav/friendica/database-init.inc.php
+++ b/dav/friendica/database-init.inc.php
@@ -7,7 +7,7 @@
*/
function dav_get_update_statements($from_version)
{
- $stms = array();
+ $stms = [];
if ($from_version == 1) {
$stms[] = "ALTER TABLE `dav_calendarobjects`
@@ -30,7 +30,7 @@ function dav_get_update_statements($from_version)
`dav_locks` ,
`dav_notifications` ;";
- $stms = array_merge($stms, dav_get_create_statements(array("dav_calendarobjects")));
+ $stms = array_merge($stms, dav_get_create_statements(["dav_calendarobjects"]));
$user_ids = q("SELECT DISTINCT `uid` FROM %s%scalendars", CALDAV_SQL_DB, CALDAV_SQL_PREFIX);
foreach ($user_ids as $user) $stms = array_merge($stms, wdcal_create_std_calendars_get_statements($user["uid"], false));
@@ -43,7 +43,7 @@ function dav_get_update_statements($from_version)
}
- if (in_array($from_version, array(1, 2))) {
+ if (in_array($from_version, [1, 2])) {
$stms[] = "CREATE TABLE IF NOT EXISTS `dav_addressbooks` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`namespace` mediumint(9) NOT NULL,
@@ -80,9 +80,9 @@ function dav_get_update_statements($from_version)
* @param array $except
* @return array
*/
-function dav_get_create_statements($except = array())
+function dav_get_create_statements($except = [])
{
- $arr = array();
+ $arr = [];
if (!in_array("dav_caldav_log", $except)) $arr[] = "CREATE TABLE IF NOT EXISTS `dav_caldav_log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
@@ -240,7 +240,7 @@ function dav_check_tables()
function dav_create_tables()
{
$stms = dav_get_create_statements();
- $errors = array();
+ $errors = [];
foreach ($stms as $st) { // @TODO Friendica-dependent
dba::e($st);
@@ -258,10 +258,10 @@ function dav_create_tables()
function dav_upgrade_tables()
{
$ver = dav_check_tables();
- if (!in_array($ver, array(1, 2))) return array("Unknown error");
+ if (!in_array($ver, [1, 2])) return ["Unknown error"];
$stms = dav_get_update_statements($ver);
- $errors = array();
+ $errors = [];
foreach ($stms as $st) { // @TODO Friendica-dependent
dba::e($st);
diff --git a/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php b/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php
index 0afc03bd..169c5bcb 100644
--- a/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php
+++ b/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php
@@ -124,7 +124,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
$summary = (($row["summary"]) ? $row["summary"] : substr(preg_replace("/\[[^\]]*\]/", "", $row["desc"]), 0, 100));
- return array(
+ return [
"jq_id" => $row["id"],
"ev_id" => $row["id"],
"summary" => escape_tags($summary),
@@ -142,7 +142,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
"url_detail" => $base_path . "/events/event/" . $row["id"],
"url_edit" => "",
"special_type" => ($row["type"] == "birthday" ? "birthday" : ""),
- );
+ ];
}
@@ -179,7 +179,7 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date("Y-m-d H:i:s", $date_to) . "'";
else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'";
}
- $ret = array();
+ $ret = [];
$r = q("SELECT * FROM `event` WHERE `uid` = %d " . $sql_where . " ORDER BY `start`", IntVal($calendar["namespace_id"]));
@@ -214,21 +214,21 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual
public function getCalendarsForUser($principalUri)
{
$n = dav_compat_principal2namespace($principalUri);
- if ($n["namespace"] != $this->getNamespace()) return array();
+ if ($n["namespace"] != $this->getNamespace()) return [];
$cals = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->getNamespace(), IntVal($n["namespace_id"]));
- $ret = array();
+ $ret = [];
foreach ($cals as $cal) {
if (!in_array($cal["uri"], $GLOBALS["CALDAV_PRIVATE_SYSTEM_CALENDARS"])) continue;
- $dat = array(
+ $dat = [
"id" => $cal["id"],
"uri" => $cal["uri"],
"principaluri" => $principalUri,
'{' . Sabre_CalDAV_Plugin::NS_CALENDARSERVER . '}getctag' => $cal['ctag'] ? $cal['ctag'] : '0',
- '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array("VEVENT")),
+ '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(["VEVENT"]),
"calendar_class" => "Sabre_CalDAV_Calendar_Virtual",
- );
+ ];
foreach ($this->propertyMap as $key=> $field) $dat[$key] = $cal[$field];
$ret[] = $dat;
diff --git a/dav/friendica/dav_carddav_backend_virtual_friendica.inc.php b/dav/friendica/dav_carddav_backend_virtual_friendica.inc.php
index 3a06d042..8d51022d 100644
--- a/dav/friendica/dav_carddav_backend_virtual_friendica.inc.php
+++ b/dav/friendica/dav_carddav_backend_virtual_friendica.inc.php
@@ -46,13 +46,13 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
{
$uid = dav_compat_principal2uid($principalUri);
- $addressBooks = array();
+ $addressBooks = [];
$books = q("SELECT id, ctag FROM %s%saddressbooks WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, CARDDAV_NAMESPACE_PRIVATE, IntVal($uid), dbesc(CARDDAV_FRIENDICA_CONTACT));
$ctag = $books[0]["ctag"];
- $addressBooks[] = array(
+ $addressBooks[] = [
'id' => $books[0]["id"],
'uri' => "friendica",
'principaluri' => $principalUri,
@@ -61,7 +61,7 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
'{http://calendarserver.org/ns/}getctag' => $ctag,
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
new Sabre_CardDAV_Property_SupportedAddressData(),
- );
+ ];
return $addressBooks;
@@ -76,7 +76,7 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
{
$name = explode(" ", $contact["name"]);
$first_name = $last_name = "";
- $middle_name = array();
+ $middle_name = [];
$num = count($name);
for ($i = 0; $i < $num && $first_name == ""; $i++) if ($name[$i] != "") {
$first_name = $name[$i];
@@ -114,14 +114,14 @@ class Sabre_CardDAV_Backend_Friendica extends Sabre_CardDAV_Backend_Virtual
}
$vcard = vcard_source_compile($vcarddata);
- return array(
+ return [
"id" => $contact["id"],
"carddata" => $vcard,
"uri" => $contact["id"] . ".vcf",
"lastmodified" => wdcal_mySql2PhpTime($vcarddata->last_update),
"etag" => md5($vcard),
"size" => strlen($vcard),
- );
+ ];
}
diff --git a/dav/friendica/dav_friendica_auth.inc.php b/dav/friendica/dav_friendica_auth.inc.php
index 9b42ab8a..88b8cf01 100644
--- a/dav/friendica/dav_friendica_auth.inc.php
+++ b/dav/friendica/dav_friendica_auth.inc.php
@@ -26,7 +26,7 @@ class Sabre_DAV_Auth_Backend_Std extends Sabre_DAV_Auth_Backend_AbstractBasic
*/
public function getUsers()
{
- return array($this->currentUser);
+ return [$this->currentUser];
}
/**
diff --git a/dav/friendica/dav_friendica_principal.inc.php b/dav/friendica/dav_friendica_principal.inc.php
index 780bcd24..d23619ec 100644
--- a/dav/friendica/dav_friendica_principal.inc.php
+++ b/dav/friendica/dav_friendica_principal.inc.php
@@ -61,16 +61,16 @@ class Sabre_DAVACL_PrincipalBackend_Std implements Sabre_DAVACL_IPrincipalBacken
{
// This backend only support principals in one collection
- if ($prefixPath !== $this->prefix) return array();
+ if ($prefixPath !== $this->prefix) return [];
- $users = array();
+ $users = [];
$r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($this->authBackend->getCurrentUser()) );
foreach ($r as $t) {
- $users[] = array(
+ $users[] = [
'uri' => $this->prefix . '/' . strtolower($t['nickname']),
'{DAV:}displayname' => $t['nickname'],
- );
+ ];
}
return $users;
@@ -94,24 +94,24 @@ class Sabre_DAVACL_PrincipalBackend_Std implements Sabre_DAVACL_IPrincipalBacken
if ($prefixPath !== $this->prefix) return null;
$r = q("SELECT `nickname` FROM `user` WHERE `nickname` = '%s'", escape_tags($userName) );
- if (count($r) == 0) return array();
+ if (count($r) == 0) return [];
- return array(
+ return [
'uri' => $this->prefix . '/' . strtolower($r[0]['nickname']),
'{DAV:}displayname' => $r[0]['nickname'],
- );
+ ];
}
function getGroupMemberSet($principal)
{
- return array();
+ return [];
}
function getGroupMembership($principal)
{
- return array();
+ return [];
}
diff --git a/dav/friendica/layout.fnk.php b/dav/friendica/layout.fnk.php
index 6e49aa92..f384c50c 100644
--- a/dav/friendica/layout.fnk.php
+++ b/dav/friendica/layout.fnk.php
@@ -91,7 +91,7 @@ function wdcal_import_user_ics($calendar_id) {
/** @var Sabre\VObject\Component\VCalendar $vObject */
$vObject = Sabre\VObject\Reader::read($text);
$comp = $vObject->getComponents();
- $imported = array();
+ $imported = [];
foreach ($comp as $c) try {
/** @var Sabre\VObject\Component\VEvent $c */
$uid = $c->__get("UID")->value;
@@ -171,18 +171,18 @@ function wdcal_import_user_ics($calendar_id) {
* @param bool $show_nav
* @return string
*/
-function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $view = "week", $theme = 0, $height_diff = 175, $readonly = false, $curr_day = "", $add_params = array(), $show_nav = true)
+function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $view = "week", $theme = 0, $height_diff = 175, $readonly = false, $curr_day = "", $add_params = [], $show_nav = true)
{
$a = get_app();
$localization = wdcal_local::getInstanceByUser($a->user["uid"]);
if (count($calendars_selected) == 0) foreach ($calendars as $c) {
- $prop = $c->getProperties(array("id"));
+ $prop = $c->getProperties(["id"]);
$calendars_selected[] = $prop["id"];
}
- $opts = array(
+ $opts = [
"view" => $view,
"theme" => $theme,
"readonly" => $readonly,
@@ -194,7 +194,7 @@ function wdcal_printCalendar($calendars, $calendars_selected, $data_feed_url, $v
"date_format_dm3" => $localization->dateformat_js_dm3(),
"date_format_full" => $localization->dateformat_datepicker_js(),
"baseurl" => $a->get_baseurl() . "/dav/wdcal/",
- );
+ ];
$x = '
';
-
+
$upload_msg = t('Upload a file');
$drop_msg = t('Drop files here to upload');
$cancel = t('Cancel');
@@ -50,16 +50,16 @@ function js_upload_form(&$a,&$b) {
$maximagesize = intval(Config::get('system','maximagesize'));
$b['addon_text'] .= <<< EOT
-
-
-
+
+
+
Please enable JavaScript to use file uploader.
-
+
-
+
EOT;
@@ -139,7 +139,7 @@ function js_upload_post_init(&$a,&$b) {
// list of valid extensions, ex. array("jpeg", "xml", "bmp")
- $allowedExtensions = array("jpeg","gif","png","jpg");
+ $allowedExtensions = ["jpeg","gif","png","jpg"];
// max file size in bytes
@@ -196,7 +196,7 @@ class qqUploadedFileXhr {
* Save the file in the temp dir.
* @return boolean TRUE on success
*/
- function save() {
+ function save() {
$input = fopen("php://input", "r");
$upload_dir = Config::get('system','tempdir');
@@ -210,8 +210,8 @@ class qqUploadedFileXhr {
fclose($input);
fclose($temp);
-
- if ($realSize != $this->getSize()){
+
+ if ($realSize != $this->getSize()){
return false;
}
return true;
@@ -227,18 +227,18 @@ class qqUploadedFileXhr {
function getSize() {
if (isset($_SERVER["CONTENT_LENGTH"])){
- return (int)$_SERVER["CONTENT_LENGTH"];
+ return (int)$_SERVER["CONTENT_LENGTH"];
} else {
throw new Exception('Getting content length is not supported.');
- }
- }
+ }
+ }
}
/**
* Handle file uploads via regular form post (uses the $_FILES array)
*/
-class qqUploadedFileForm {
+class qqUploadedFileForm {
/**
@@ -264,63 +264,63 @@ class qqUploadedFileForm {
}
class qqFileUploader {
- private $allowedExtensions = array();
+ private $allowedExtensions = [];
private $sizeLimit = 10485760;
private $file;
- function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){
+ function __construct(array $allowedExtensions = [], $sizeLimit = 10485760){
$allowedExtensions = array_map("strtolower", $allowedExtensions);
-
- $this->allowedExtensions = $allowedExtensions;
+
+ $this->allowedExtensions = $allowedExtensions;
$this->sizeLimit = $sizeLimit;
-
+
if (isset($_GET['qqfile'])) {
$this->file = new qqUploadedFileXhr();
} elseif (isset($_FILES['qqfile'])) {
$this->file = new qqUploadedFileForm();
} else {
- $this->file = false;
+ $this->file = false;
}
}
-
-
+
+
private function toBytes($str){
$val = trim($str);
$last = strtolower($str[strlen($str)-1]);
switch($last) {
case 'g': $val *= 1024;
case 'm': $val *= 1024;
- case 'k': $val *= 1024;
+ case 'k': $val *= 1024;
}
return $val;
}
-
+
/**
* Returns array('success'=>true) or array('error'=>'error message')
*/
function handleUpload(){
-
+
if (!$this->file){
- return array('error' => t('No files were uploaded.'));
+ return ['error' => t('No files were uploaded.')];
}
-
+
$size = $this->file->getSize();
-
+
if ($size == 0) {
- return array('error' => t('Uploaded file is empty'));
+ return ['error' => t('Uploaded file is empty')];
}
-
+
// if ($size > $this->sizeLimit) {
// return array('error' => t('Uploaded file is too large'));
// }
-
+
$maximagesize = Config::get('system','maximagesize');
if(($maximagesize) && ($size > $maximagesize)) {
- return array('error' => t('Image exceeds size limit of ') . $maximagesize );
+ return ['error' => t('Image exceeds size limit of ') . $maximagesize ];
}
@@ -331,22 +331,22 @@ class qqFileUploader {
if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
$these = implode(', ', $this->allowedExtensions);
- return array('error' => t('File has an invalid extension, it should be one of ') . $these . '.');
+ return ['error' => t('File has an invalid extension, it should be one of ') . $these . '.'];
}
-
+
if ($this->file->save()){
- return array(
+ return [
'success'=>true,
- 'path' => $this->file->getPath(),
+ 'path' => $this->file->getPath(),
'filename' => $filename . '.' . $ext
- );
+ ];
} else {
- return array(
+ return [
'error'=> t('Upload was cancelled, or server error encountered'),
- 'path' => $this->file->getPath(),
+ 'path' => $this->file->getPath(),
'filename' => $filename . '.' . $ext
- );
+ ];
}
-
- }
+
+ }
}
diff --git a/krynn/krynn.php b/krynn/krynn.php
index ca2c426d..17e7d2b4 100644
--- a/krynn/krynn.php
+++ b/krynn/krynn.php
@@ -15,7 +15,7 @@ use Friendica\Core\PConfig;
function krynn_install() {
/**
- *
+ *
* Our demo plugin will attach in three places.
* The first is just prior to storing a local post.
*
@@ -25,7 +25,7 @@ function krynn_install() {
/**
*
- * Then we'll attach into the plugin settings page, and also the
+ * Then we'll attach into the plugin settings page, and also the
* settings post hook so that we can create and update
* user preferences.
*
@@ -96,7 +96,7 @@ function krynn_post_hook($a, &$item) {
*
*/
- $krynn = array('Ansalon','Abanasinia','Solace','Haven','Gateway','Qualinost','Ankatavaka','Pax Tharkas','Ergoth','Newsea','Straights of Schallsea','Plains of Dust','Tarsis','Barren Hills','Que Shu','Citadel of Light','Solinari','Hedge Maze','Tower of High Sorcery','Inn of the Last Home','Last Heroes Tomb','Academy of Sorcery','Gods Row','Temple of Majere','Temple of Kiri-Jolith','Temple of Mishakal','Temple of Zeboim','The Trough','Sad Town','Xak Tsaroth','Zhaman','Skullcap','Saifhum','Karthay','Mithas','Kothas','Silver Dragon Mountain','Silvanesti');
+ $krynn = ['Ansalon','Abanasinia','Solace','Haven','Gateway','Qualinost','Ankatavaka','Pax Tharkas','Ergoth','Newsea','Straights of Schallsea','Plains of Dust','Tarsis','Barren Hills','Que Shu','Citadel of Light','Solinari','Hedge Maze','Tower of High Sorcery','Inn of the Last Home','Last Heroes Tomb','Academy of Sorcery','Gods Row','Temple of Majere','Temple of Kiri-Jolith','Temple of Mishakal','Temple of Zeboim','The Trough','Sad Town','Xak Tsaroth','Zhaman','Skullcap','Saifhum','Karthay','Mithas','Kothas','Silver Dragon Mountain','Silvanesti'];
$planet = array_rand($krynn,1);
$item['location'] = $krynn[$planet];
@@ -126,7 +126,7 @@ function krynn_settings_post($a,$post) {
/**
*
- * Called from the Plugin Setting form.
+ * Called from the Plugin Setting form.
* Add our own settings info to the page.
*
*/
diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php
index dcf12dfd..e8e90975 100644
--- a/langfilter/langfilter.php
+++ b/langfilter/langfilter.php
@@ -52,15 +52,15 @@ function langfilter_addon_settings(App $a, &$s)
}
$t = get_markup_template("settings.tpl", "addon/langfilter/");
- $s .= replace_macros($t, array(
+ $s .= replace_macros($t, [
'$title' => t("Language Filter"),
'$intro' => t('This addon tries to identify the language of a postings. If it does not match any language spoken by you (see below) the posting will be collapsed. Remember detecting the language is not perfect, especially with short postings.'),
- '$enabled' => array('langfilter_enable', t('Use the language filter'), $enable_checked, ''),
- '$languages' => array('langfilter_languages', t('I speak'), $languages, t('List of abbreviations (iso2 codes) for languages you speak, comma separated. For example "de,it".')),
- '$minconfidence' => array('langfilter_minconfidence', t('Minimum confidence in language detection'), $minconfidence, t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.')),
- '$minlength' => array('langfilter_minlength', t('Minimum length of message body'), $minlength, t('Minimum length of message body for language filter to be used. Posts shorter than this number of characters will not be filtered.')),
+ '$enabled' => ['langfilter_enable', t('Use the language filter'), $enable_checked, ''],
+ '$languages' => ['langfilter_languages', t('I speak'), $languages, t('List of abbreviations (iso2 codes) for languages you speak, comma separated. For example "de,it".')],
+ '$minconfidence' => ['langfilter_minconfidence', t('Minimum confidence in language detection'), $minconfidence, t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.')],
+ '$minlength' => ['langfilter_minlength', t('Minimum length of message body'), $minlength, t('Minimum length of message body for language filter to be used. Posts shorter than this number of characters will not be filtered.')],
'$submit' => t('Save Settings'),
- ));
+ ]);
return;
}
diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php
index 63ccbe91..f6cb42b6 100644
--- a/ldapauth/ldapauth.php
+++ b/ldapauth/ldapauth.php
@@ -176,7 +176,7 @@ function ldap_autocreateaccount($ldap_autocreateaccount, $username, $password, $
$results = get_existing_account($username);
if (empty($results)) {
if (strlen($email) > 0 && strlen($name) > 0) {
- $arr = array('username' => $name, 'nickname' => $username, 'email' => $email, 'password' => $password, 'verified' => 1);
+ $arr = ['username' => $name, 'nickname' => $username, 'email' => $email, 'password' => $password, 'verified' => 1];
try {
User::create($arr);
diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php
index e22c2b62..91d35834 100644
--- a/leistungsschutzrecht/leistungsschutzrecht.php
+++ b/leistungsschutzrecht/leistungsschutzrecht.php
@@ -36,7 +36,7 @@ function leistungsschutzrecht_getsiteinfo($a, &$siteinfo) {
}
function leistungsschutzrecht_cuttext($text) {
- $text = str_replace(array("\r", "\n"), array(" ", " "), $text);
+ $text = str_replace(["\r", "\n"], [" ", " "], $text);
do {
$oldtext = $text;
@@ -73,9 +73,9 @@ function leistungsschutzrecht_fetchsites() {
$sitelist = fetch_url($url);
$siteurls = explode(',', $sitelist);
- $whitelist = array('tagesschau.de', 'heute.de', 'wdr.de');
+ $whitelist = ['tagesschau.de', 'heute.de', 'wdr.de'];
- $sites = array();
+ $sites = [];
foreach ($siteurls AS $site) {
if (!in_array($site, $whitelist)) {
$sites[$site] = $site;
diff --git a/libertree/libertree.php b/libertree/libertree.php
index f5a157ec..0b9f839b 100644
--- a/libertree/libertree.php
+++ b/libertree/libertree.php
@@ -185,7 +185,7 @@ function libertree_send(&$a,&$b) {
if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) {
require_once('include/bb2diaspora.php');
- $tag_arr = array();
+ $tag_arr = [];
$tags = '';
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
@@ -223,11 +223,11 @@ function libertree_send(&$a,&$b) {
$body = "## ".html_entity_decode($title)."\n\n".$body;
- $params = array(
+ $params = [
'text' => $body,
'source' => $ltree_source
// 'token' => $ltree_api_token
- );
+ ];
$result = post_url($ltree_blog,$params);
logger('libertree: ' . $result);
diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php
index 4b87799f..891b0b47 100644
--- a/libravatar/libravatar.php
+++ b/libravatar/libravatar.php
@@ -71,13 +71,13 @@ function libravatar_plugin_admin (&$a, &$o) {
$default_avatar = 'identicon'; // pseudo-random geometric pattern based on email hash
// Available options for the select boxes
- $default_avatars = array(
+ $default_avatars = [
'mm' => t('generic profile image'),
'identicon' => t('random geometric pattern'),
'monsterid' => t('monster face'),
'wavatar' => t('computer generated face'),
'retro' => t('retro arcade style face'),
- );
+ ];
// Show warning if PHP version is too old
if (! version_compare(PHP_VERSION, '5.3.0', '>=')) {
@@ -97,10 +97,10 @@ function libravatar_plugin_admin (&$a, &$o) {
// output Libravatar settings
$o .= ' ';
- $o .= replace_macros( $t, array(
+ $o .= replace_macros( $t, [
'$submit' => t('Save Settings'),
- '$default_avatar' => array('avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found. See README'), $default_avatars),
- ));
+ '$default_avatar' => ['avatar', t('Default avatar image'), $default_avatar, t('Select default avatar image if none was found. See README'), $default_avatars],
+ ]);
}
/**
diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php
index 9f3af043..1d5703e1 100644
--- a/ljpost/ljpost.php
+++ b/ljpost/ljpost.php
@@ -152,7 +152,7 @@ function ljpost_send(&$a,&$b) {
if($b['parent'] != $b['id'])
return;
- // LiveJournal post in the LJ user's timezone.
+ // LiveJournal post in the LJ user's timezone.
// Hopefully the person's Friendica account
// will be set to the same thing.
@@ -162,7 +162,7 @@ function ljpost_send(&$a,&$b) {
intval($b['uid'])
);
if($x && strlen($x[0]['timezone']))
- $tz = $x[0]['timezone'];
+ $tz = $x[0]['timezone'];
$lj_username = xmlify(PConfig::get($b['uid'],'ljpost','lj_username'));
$lj_password = xmlify(PConfig::get($b['uid'],'ljpost','lj_password'));
@@ -234,7 +234,7 @@ EOT;
logger('ljpost: data: ' . $xml, LOGGER_DATA);
if($lj_blog !== 'test')
- $x = post_url($lj_blog,$xml,array("Content-Type: text/xml"));
+ $x = post_url($lj_blog,$xml,["Content-Type: text/xml"]);
logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG);
}
diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php
index 13241480..67364365 100644
--- a/mailstream/mailstream.php
+++ b/mailstream/mailstream.php
@@ -69,13 +69,13 @@ function mailstream_module() {}
function mailstream_plugin_admin(&$a,&$o) {
$frommail = Config::get('mailstream', 'frommail');
$template = get_markup_template('admin.tpl', 'addon/mailstream/');
- $config = array('frommail',
+ $config = ['frommail',
t('From Address'),
$frommail,
- t('Email address that stream items will appear to be from.'));
- $o .= replace_macros($template, array(
+ t('Email address that stream items will appear to be from.')];
+ $o .= replace_macros($template, [
'$frommail' => $config,
- '$submit' => t('Save Settings')));
+ '$submit' => t('Save Settings')]);
}
function mailstream_plugin_admin_post ($a) {
@@ -146,18 +146,18 @@ function mailstream_do_images($a, &$item, &$attachments) {
if (!PConfig::get($item['uid'], 'mailstream', 'attachimg')) {
return;
}
- $attachments = array();
+ $attachments = [];
$baseurl = $a->get_baseurl();
preg_match_all("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", $item["body"], $matches1);
preg_match_all("/\[img\](.*?)\[\/img\]/ism", $item["body"], $matches2);
foreach (array_merge($matches1[3], $matches2[1]) as $url) {
$redirects;
$cookiejar = tempnam(get_temppath(), 'cookiejar-mailstream-');
- $attachments[$url] = array(
+ $attachments[$url] = [
'data' => fetch_url($url, true, $redirects, 0, Null, $cookiejar),
'guid' => hash("crc32", $url),
'filename' => basename($url),
- 'type' => $a->get_curl_content_type());
+ 'type' => $a->get_curl_content_type()];
if (strlen($attachments[$url]['data'])) {
$item['body'] = str_replace($url, 'cid:' . $attachments[$url]['guid'], $item['body']);
continue;
@@ -254,7 +254,7 @@ function mailstream_send($a, $message_id, $item, $user) {
}
require_once(dirname(__file__).'/phpmailer/class.phpmailer.php');
require_once('include/bbcode.php');
- $attachments = array();
+ $attachments = [];
mailstream_do_images($a, $item, $attachments);
$frommail = Config::get('mailstream', 'frommail');
if ($frommail == "") {
@@ -285,10 +285,10 @@ function mailstream_send($a, $message_id, $item, $user) {
$template = get_markup_template('mail.tpl', 'addon/mailstream/');
$item['body'] = bbcode($item['body']);
$item['url'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $item['id'];
- $mail->Body = replace_macros($template, array(
+ $mail->Body = replace_macros($template, [
'$upstream' => t('Upstream'),
'$local' => t('Local'),
- '$item' => $item));
+ '$item' => $item]);
mailstream_html_wrap($mail->Body);
if (!$mail->Send()) {
throw new Exception($mail->ErrorInfo);
@@ -352,28 +352,28 @@ function mailstream_plugin_settings(&$a,&$s) {
$nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes');
$attachimg= PConfig::get(local_user(), 'mailstream', 'attachimg');
$template = get_markup_template('settings.tpl', 'addon/mailstream/');
- $s .= replace_macros($template, array(
- '$enabled' => array(
+ $s .= replace_macros($template, [
+ '$enabled' => [
'mailstream_enabled',
t('Enabled'),
- $enabled),
- '$address' => array(
+ $enabled],
+ '$address' => [
'mailstream_address',
t('Email Address'),
$address,
- t("Leave blank to use your account email address")),
- '$nolikes' => array(
+ t("Leave blank to use your account email address")],
+ '$nolikes' => [
'mailstream_nolikes',
t('Exclude Likes'),
$nolikes,
- t("Check this to omit mailing \"Like\" notifications")),
- '$attachimg' => array(
+ t("Check this to omit mailing \"Like\" notifications")],
+ '$attachimg' => [
'mailstream_attachimg',
t('Attach Images'),
$attachimg,
- t("Download images in posts and attach them to the email. Useful for reading email while offline.")),
+ t("Download images in posts and attach them to the email. Useful for reading email while offline.")],
'$title' => t('Mail Stream Settings'),
- '$submit' => t('Save Settings')));
+ '$submit' => t('Save Settings')]);
}
function mailstream_plugin_settings_post($a,$post) {
diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php
index 695022e6..2a7bc89c 100644
--- a/mathjax/mathjax.php
+++ b/mathjax/mathjax.php
@@ -13,13 +13,13 @@ use Friendica\Core\PConfig;
function mathjax_install() {
register_hook('page_header', 'addon/mathjax/mathjax.php', 'mathjax_page_header');
- register_hook('plugin_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
+ register_hook('plugin_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
register_hook('plugin_settings_post', 'addon/mathjax/mathjax.php', 'mathjax_settings_post');
logger('installed js_math plugin');
}
function mathjax_uninstall() {
unregister_hook('page_header', 'addon/mathjax/mathjax.php', 'mathjax_page_header');
- unregister_hook('plugin_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
+ unregister_hook('plugin_settings', 'addon/mathjax/mathjax.php', 'mathjax_settings');
unregister_hook('plugin_settings_post', 'addon/mathjax/mathjax.php', 'mathjax_settings_post');
}
function mathjax_settings_post ($a, $post) {
@@ -63,7 +63,7 @@ function mathjax_page_header($a, &$b) {
$b .= '';
} else {
$use = PConfig::get(local_user(),'mathjax','use');
- if ($use) {
+ if ($use) {
$b .= '';
}
}
@@ -79,8 +79,8 @@ function mathjax_plugin_admin (&$a, &$o) {
Config::set('mathjax','baseurl','http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML');
}
- $o = replace_macros( $t, array(
+ $o = replace_macros( $t, [
'$submit' => t('Save Settings'),
- '$baseurl' => array('baseurl', t('MathJax Base URL'), Config::get('mathjax','baseurl' ), t('The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax.')),
- ));
+ '$baseurl' => ['baseurl', t('MathJax Base URL'), Config::get('mathjax','baseurl' ), t('The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax.')],
+ ]);
}
diff --git a/morepokes/morepokes.php b/morepokes/morepokes.php
index 717643ec..9fd1a43e 100644
--- a/morepokes/morepokes.php
+++ b/morepokes/morepokes.php
@@ -16,22 +16,22 @@ function morepokes_uninstall() {
}
function morepokes_poke_verbs($a,&$b) {
- $b['bitchslap'] = array('bitchslapped', t('bitchslap'), t('bitchslapped'));
- $b['shag'] = array('shag', t('shag'), t('shagged'));
- $b['somethingobscenelybiological'] = array('something obscenely biological', t('do something obscenely biological to'), t('did something obscenely biological to'));
- $b['newpokefeature'] = array('pointed out the poke feature to', t('point out the poke feature to'), t('pointed out the poke feature to'));
- $b['declareundyinglove'] = array('declared undying love for', t('declare undying love for'), t('declared undying love for'));
- $b['patent'] = array('patented', t('patent'), t('patented'));
- $b['strokebeard'] = array('stroked their beard at', t('stroke beard'), t('stroked their beard at'));
- $b['bemoan'] = array('bemoaned the declining standards of modern secondary and tertiary education to', t('bemoan the declining standards of modern secondary and tertiary education to'), t('bemoans the declining standards of modern secondary and tertiary education to'));
- $b['hugs'] = array('hugged', t('hug'), t('hugged'));
- $b['kiss'] = array('kissed', t('kiss'), t('kissed'));
- $b['raiseeyebrows'] = array('raised their eyebrows at', t('raise eyebrows at'), t('raised their eyebrows at'));
- $b['insult'] = array('insulted', t('insult'), t('insulted'));
- $b['praise'] = array('praised', t('praise'), t('praised'));
- $b['bedubiousof'] = array('was dubious of', t('be dubious of'), t('was dubious of'));
- $b['eat'] = array('ate', t('eat'), t('ate'));
- $b['giggleandfawn'] = array('giggled and fawned at', t('giggle and fawn at'), t('giggled and fawned at'));
- $b['doubt'] = array('doubted', t('doubt'), t('doubted'));
- $b['glare'] = array('glared at', t('glare'), t('glared at'));
+ $b['bitchslap'] = ['bitchslapped', t('bitchslap'), t('bitchslapped')];
+ $b['shag'] = ['shag', t('shag'), t('shagged')];
+ $b['somethingobscenelybiological'] = ['something obscenely biological', t('do something obscenely biological to'), t('did something obscenely biological to')];
+ $b['newpokefeature'] = ['pointed out the poke feature to', t('point out the poke feature to'), t('pointed out the poke feature to')];
+ $b['declareundyinglove'] = ['declared undying love for', t('declare undying love for'), t('declared undying love for')];
+ $b['patent'] = ['patented', t('patent'), t('patented')];
+ $b['strokebeard'] = ['stroked their beard at', t('stroke beard'), t('stroked their beard at')];
+ $b['bemoan'] = ['bemoaned the declining standards of modern secondary and tertiary education to', t('bemoan the declining standards of modern secondary and tertiary education to'), t('bemoans the declining standards of modern secondary and tertiary education to')];
+ $b['hugs'] = ['hugged', t('hug'), t('hugged')];
+ $b['kiss'] = ['kissed', t('kiss'), t('kissed')];
+ $b['raiseeyebrows'] = ['raised their eyebrows at', t('raise eyebrows at'), t('raised their eyebrows at')];
+ $b['insult'] = ['insulted', t('insult'), t('insulted')];
+ $b['praise'] = ['praised', t('praise'), t('praised')];
+ $b['bedubiousof'] = ['was dubious of', t('be dubious of'), t('was dubious of')];
+ $b['eat'] = ['ate', t('eat'), t('ate')];
+ $b['giggleandfawn'] = ['giggled and fawned at', t('giggle and fawn at'), t('giggled and fawned at')];
+ $b['doubt'] = ['doubted', t('doubt'), t('doubted')];
+ $b['glare'] = ['glared at', t('glare'), t('glared at')];
;}
diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php
index 13663336..41e4e0d5 100644
--- a/newmemberwidget/newmemberwidget.php
+++ b/newmemberwidget/newmemberwidget.php
@@ -49,12 +49,12 @@ function newmemberwidget_plugin_admin_post( &$a ) {
function newmemberwidget_plugin_admin(&$a, &$o){
$t = get_markup_template('admin.tpl','addon/newmemberwidget');
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Save Settings'),
- '$freetext' => array( "freetext", t("Message"), Config::get( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")),
- '$linkglobalsupport' => array( "linkglobalsupport", t('Add a link to global support forum'), Config::get( 'newmemberwidget', 'linkglobalsupport'), t('Should a link to the global support forum be displayed?')." (@helpers )"),
- '$linklocalsupport' => array( "linklocalsupport", t('Add a link to the local support forum'), Config::get( 'newmemberwidget', 'linklocalsupport'), t('If you have a local support forum and want to have a link displayed in the widget, check this box.')),
- '$localsupportname' => array( "localsupportname", t('Name of the local support group'), Config::get( 'newmemberwidget', 'localsupport'), t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')),
- ));
+ '$freetext' => [ "freetext", t("Message"), Config::get( "newmemberwidget", "freetext" ), t("Your message for new members. You can use bbcode here.")],
+ '$linkglobalsupport' => [ "linkglobalsupport", t('Add a link to global support forum'), Config::get( 'newmemberwidget', 'linkglobalsupport'), t('Should a link to the global support forum be displayed?')." (@helpers )"],
+ '$linklocalsupport' => [ "linklocalsupport", t('Add a link to the local support forum'), Config::get( 'newmemberwidget', 'linklocalsupport'), t('If you have a local support forum and want to have a link displayed in the widget, check this box.')],
+ '$localsupportname' => [ "localsupportname", t('Name of the local support group'), Config::get( 'newmemberwidget', 'localsupport'), t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')],
+ ]);
}
diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php
index 594a7540..a667f6a6 100644
--- a/notifyall/notifyall.php
+++ b/notifyall/notifyall.php
@@ -42,7 +42,7 @@ function notifyall_post(&$a) {
$sender_name = sprintf(t('%s Administrator'), $sitename);
else
$sender_name = sprintf(t('%1$s, %2$s Administrator'), $a->config['admin_name'], $sitename);
-
+
if (! x($a->config['sender_email']))
$sender_email = 'noreply@' . $a->get_hostname();
else
@@ -51,15 +51,15 @@ function notifyall_post(&$a) {
$subject = $_REQUEST['subject'];
- $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(array("\\r", "\\n"),array( "", "\n"), $text))),ENT_QUOTES,'UTF-8'));
+ $textversion = strip_tags(html_entity_decode(bbcode(stripslashes(str_replace(["\\r", "\\n"],[ "", "\n"], $text))),ENT_QUOTES,'UTF-8'));
+
+ $htmlversion = bbcode(stripslashes(str_replace(["\\r","\\n"], [""," \n"],$text)));
- $htmlversion = bbcode(stripslashes(str_replace(array("\\r","\\n"), array(""," \n"),$text)));
-
// if this is a test, send it only to the admin(s)
// admin_email might be a comma separated list, but we need "a@b','c@d','e@f
if ( intval($_REQUEST['test'])) {
$email = $a->config['admin_email'];
- $email = "'" . str_replace(array(" ",","), array("","','"), $email) . "'";
+ $email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
}
$sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');
@@ -73,7 +73,7 @@ function notifyall_post(&$a) {
foreach($recips as $recip) {
- Emailer::send(array(
+ Emailer::send([
'fromName' => $sender_name,
'fromEmail' => $sender_email,
'replyTo' => $sender_email,
@@ -81,7 +81,7 @@ function notifyall_post(&$a) {
'messageSubject' => $subject,
'htmlVersion' => $htmlversion,
'textVersion' => $textversion
- ));
+ ]);
}
notice( t('Emails sent'));
@@ -94,13 +94,13 @@ function notifyall_content(&$a) {
$title = t('Send email to all members of this Friendica instance.');
- $o = replace_macros(get_markup_template('notifyall_form.tpl','addon/notifyall/'),array(
+ $o = replace_macros(get_markup_template('notifyall_form.tpl','addon/notifyall/'),[
'$title' => $title,
'$text' => htmlspecialchars($_REQUEST['text']),
- '$subject' => array('subject',t('Message subject'),$_REQUEST['subject'],''),
- '$test' => array('test',t('Test mode (only send to administrator)'), 0,''),
+ '$subject' => ['subject',t('Message subject'),$_REQUEST['subject'],''],
+ '$test' => ['test',t('Test mode (only send to administrator)'), 0,''],
'$submit' => t('Submit')
- ));
+ ]);
return $o;
diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php
index 6d8acbf0..6592738d 100644
--- a/nsfw/nsfw.php
+++ b/nsfw/nsfw.php
@@ -6,7 +6,7 @@
* Description: Collapse posts with inappropriate content
* Version: 1.0
* Author: Mike Macgirvin
- *
+ *
*/
use Friendica\Core\PConfig;
@@ -26,15 +26,15 @@ function nsfw_uninstall() {
}
-// This function isn't perfect and isn't trying to preserve the html structure - it's just a
-// quick and dirty filter to pull out embedded photo blobs because 'nsfw' seems to come up
+// This function isn't perfect and isn't trying to preserve the html structure - it's just a
+// quick and dirty filter to pull out embedded photo blobs because 'nsfw' seems to come up
// inside them quite often. We don't need anything fancy, just pull out the data blob so we can
-// check against the rest of the body.
-
+// check against the rest of the body.
+
function nsfw_extract_photos($body) {
$new_body = '';
-
+
$img_start = strpos($body,'src="data:');
$img_end = (($img_start !== false) ? strpos(substr($body,$img_start),'>') : false);
@@ -43,7 +43,7 @@ function nsfw_extract_photos($body) {
while($img_end !== false) {
$img_end += $img_start;
$new_body = $new_body . substr($body,0,$img_start);
-
+
$cnt ++;
$body = substr($body,0,$img_end);
@@ -128,7 +128,7 @@ function nsfw_prepare_body(&$a,&$b) {
$arr = explode(',',$words);
}
else {
- $arr = array('nsfw');
+ $arr = ['nsfw'];
}
$found = false;
@@ -160,11 +160,11 @@ function nsfw_prepare_body(&$a,&$b) {
}
}
}
- }
- }
+ }
+ }
}
if($found) {
$rnd = random_string(8);
- $b['html'] = '' . sprintf( t('%s - Click to open/close'),$word ) . '
' . $b['html'] . '
';
+ $b['html'] = '' . sprintf( t('%s - Click to open/close'),$word ) . '
' . $b['html'] . '
';
}
}
diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php
index 8335f38e..ae9cb480 100644
--- a/openstreetmap/openstreetmap.php
+++ b/openstreetmap/openstreetmap.php
@@ -8,7 +8,7 @@
* Author: Klaus Weidenbach
*
*/
-
+
use Friendica\Core\Cache;
use Friendica\Core\Config;
@@ -44,7 +44,7 @@ function openstreetmap_alterheader($a, &$navHtml)
*
* If an item has coordinates add link to a tile map server, e.g. openstreetmap.org.
* If an item has a location open it with the help of OSM's Nominatim reverse geocode search.
- *
+ *
* @param mixed $a
* @param array& $item
*/
@@ -120,7 +120,7 @@ function openstreetmap_generate_named_map(&$a, &$b)
$j = json_decode($x['body'],true);
if($j && is_array($j) && $j[0]['lat'] && $j[0]['lon']) {
- $arr = array('lat' => $j[0]['lat'],'lon' => $j[0]['lon'],'location' => $b['location'], 'html' => '');
+ $arr = ['lat' => $j[0]['lat'],'lon' => $j[0]['lon'],'location' => $b['location'], 'html' => ''];
openstreetmap_generate_map($a,$arr);
$b['html'] = $arr['html'];
}
@@ -183,13 +183,13 @@ function openstreetmap_plugin_admin(&$a, &$o)
$marker = 0;
}
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Submit'),
- '$tmsserver' => array('tmsserver', t('Tile Server URL'), $tmsserver, t('A list of public tile servers ')),
- '$nomserver' => array('nomserver', t('Nominatim (reverse geocoding) Server URL'), $nomserver, t('A list of Nominatim servers ')),
- '$zoom' => array('zoom', t('Default zoom'), $zoom, t('The default zoom level. (1:world, 18:highest, also depends on tile server)')),
- '$marker' => array('marker', t('Include marker on map'), $marker, t('Include a marker on the map.')),
- ));
+ '$tmsserver' => ['tmsserver', t('Tile Server URL'), $tmsserver, t('A list of public tile servers ')],
+ '$nomserver' => ['nomserver', t('Nominatim (reverse geocoding) Server URL'), $nomserver, t('A list of Nominatim servers ')],
+ '$zoom' => ['zoom', t('Default zoom'), $zoom, t('The default zoom level. (1:world, 18:highest, also depends on tile server)')],
+ '$marker' => ['marker', t('Include marker on map'), $marker, t('Include a marker on the map.')],
+ ]);
}
function openstreetmap_plugin_admin_post(&$a)
diff --git a/piwik/piwik.php b/piwik/piwik.php
index c6c8ea9e..8253f4a7 100644
--- a/piwik/piwik.php
+++ b/piwik/piwik.php
@@ -87,13 +87,13 @@ function piwik_analytics($a,&$b) {
}
function piwik_plugin_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/piwik/" );
- $o = replace_macros( $t, array(
+ $o = replace_macros( $t, [
'$submit' => t('Save Settings'),
- '$piwikbaseurl' => array('baseurl', t('Piwik Base URL'), Config::get('piwik','baseurl' ), t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')),
- '$siteid' => array('siteid', t('Site ID'), Config::get('piwik','siteid' ), ''),
- '$optout' => array('optout', t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''),
- '$async' => array('async', t('Asynchronous tracking'), Config::get('piwik','async' ), ''),
- ));
+ '$piwikbaseurl' => ['baseurl', t('Piwik Base URL'), Config::get('piwik','baseurl' ), t('Absolute path to your Piwik installation. (without protocol (http/s), with trailing slash)')],
+ '$siteid' => ['siteid', t('Site ID'), Config::get('piwik','siteid' ), ''],
+ '$optout' => ['optout', t('Show opt-out cookie link?'), Config::get('piwik','optout' ), ''],
+ '$async' => ['async', t('Asynchronous tracking'), Config::get('piwik','async' ), ''],
+ ]);
}
function piwik_plugin_admin_post (&$a) {
$url = ((x($_POST, 'baseurl')) ? notags(trim($_POST['baseurl'])) : '');
diff --git a/planets/planets.php b/planets/planets.php
index a8371c85..0d88e21d 100644
--- a/planets/planets.php
+++ b/planets/planets.php
@@ -12,7 +12,7 @@ use Friendica\Core\PConfig;
function planets_install() {
/**
- *
+ *
* Our demo plugin will attach in three places.
* The first is just prior to storing a local post.
*
@@ -22,7 +22,7 @@ function planets_install() {
/**
*
- * Then we'll attach into the plugin settings page, and also the
+ * Then we'll attach into the plugin settings page, and also the
* settings post hook so that we can create and update
* user preferences.
*
@@ -93,7 +93,7 @@ function planets_post_hook($a, &$item) {
*
*/
- $planets = array('Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin');
+ $planets = ['Alderaan','Tatooine','Dagobah','Polis Massa','Coruscant','Hoth','Endor','Kamino','Rattatak','Mustafar','Iego','Geonosis','Felucia','Dantooine','Ansion','Artaru','Bespin','Boz Pity','Cato Neimoidia','Christophsis','Kashyyyk','Kessel','Malastare','Mygeeto','Nar Shaddaa','Ord Mantell','Saleucami','Subterrel','Death Star','Teth','Tund','Utapau','Yavin'];
$planet = array_rand($planets,1);
$item['location'] = $planets[$planet];
@@ -123,7 +123,7 @@ function planets_settings_post($a,$post) {
/**
*
- * Called from the Plugin Setting form.
+ * Called from the Plugin Setting form.
* Add our own settings info to the page.
*
*/
diff --git a/public_server/public_server.php b/public_server/public_server.php
index fd19c8f4..0ea029b3 100644
--- a/public_server/public_server.php
+++ b/public_server/public_server.php
@@ -55,7 +55,7 @@ function public_server_cron($a,$b) {
if(count($r)) {
foreach($r as $rr) {
- notification(array(
+ notification([
'uid' => $rr['uid'],
'type' => NOTIFY_SYSTEM,
'system_type' => 'public_server_expire',
@@ -65,7 +65,7 @@ function public_server_cron($a,$b) {
'source_name' => t('Administrator'),
'source_link' => $a->get_baseurl(),
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
- ));
+ ]);
q("update user set expire_notification_sent = '%s' where uid = %d",
dbesc(datetime_convert()),
@@ -161,16 +161,16 @@ function public_server_plugin_admin_post ( &$a ) {
function public_server_plugin_admin ( &$a, &$o) {
$token = get_form_security_token("publicserver");
$t = get_markup_template( "admin.tpl", "addon/public_server");
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Save Settings'),
'$form_security_token' => $token,
'$infotext' => t('Set any of these options to 0 to deactivate it.'),
- '$expiredays' => Array( "expiredays","Expire Days", intval(Config::get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "),
- '$expireposts' => Array( "expireposts", "Expire Posts", intval(Config::get('public_server','expireposts')), "Set the default days for posts to expire here"),
- '$nologin' => Array( "nologin", "No Login", intval(Config::get('public_server','nologin')), "Remove users who have never logged in after nologin days "),
- '$flagusers' => Array( "flagusers", "Flag users", intval(Config::get('public_server','flagusers')), "Remove users who last logged in over flagusers days ago"),
- '$flagposts' => Array( "flagposts", "Flag posts", intval(Config::get('public_server','flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "),
- '$flagpostsexpire' => Array( "flagpostsexpire", "Flag posts expire", intval(Config::get('public_server','flagpostsexpire'))),
- ));
+ '$expiredays' => [ "expiredays","Expire Days", intval(Config::get('public_server', 'expiredays')), "When an account is created on the site, it is given a hard "],
+ '$expireposts' => [ "expireposts", "Expire Posts", intval(Config::get('public_server','expireposts')), "Set the default days for posts to expire here"],
+ '$nologin' => [ "nologin", "No Login", intval(Config::get('public_server','nologin')), "Remove users who have never logged in after nologin days "],
+ '$flagusers' => [ "flagusers", "Flag users", intval(Config::get('public_server','flagusers')), "Remove users who last logged in over flagusers days ago"],
+ '$flagposts' => [ "flagposts", "Flag posts", intval(Config::get('public_server','flagposts')), "For users who last logged in over flagposts days ago set post expiry days to flagpostsexpire "],
+ '$flagpostsexpire' => [ "flagpostsexpire", "Flag posts expire", intval(Config::get('public_server','flagpostsexpire'))],
+ ]);
}
diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php
index 3f6f8a87..d8538dcc 100644
--- a/pumpio/pumpio.php
+++ b/pumpio/pumpio.php
@@ -81,7 +81,7 @@ function pumpio_registerclient(&$a, $host) {
$url = "https://".$host."/api/client/register";
- $params = array();
+ $params = [];
$application_name = Config::get('pumpio', 'application_name');
@@ -337,7 +337,7 @@ function pumpio_settings_post(&$a,&$b) {
// Filtering the hostname if someone is entering it with "http"
$host = $_POST['pumpio_host'];
$host = trim($host);
- $host = str_replace(array("https://", "http://"), array("", ""), $host);
+ $host = str_replace(["https://", "http://"], ["", ""], $host);
PConfig::set(local_user(),'pumpio','post',intval($_POST['pumpio']));
PConfig::set(local_user(),'pumpio','import',$_POST['pumpio_import']);
@@ -470,14 +470,14 @@ function pumpio_send(&$a,&$b) {
$content = bbcode($b['body'], false, false, 4);
- $params = array();
+ $params = [];
$params["verb"] = "post";
if (!$iscomment) {
- $params["object"] = array(
+ $params["object"] = [
'objectType' => "note",
- 'content' => $content);
+ 'content' => $content];
if ($title != "")
$params["object"]["displayName"] = $title;
@@ -495,16 +495,16 @@ function pumpio_send(&$a,&$b) {
$params["bcc"] = $receiver["bcc"];
} else {
- $inReplyTo = array("id" => $orig_post["uri"],
- "objectType" => "note");
+ $inReplyTo = ["id" => $orig_post["uri"],
+ "objectType" => "note"];
if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA)))
$inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
- $params["object"] = array(
+ $params["object"] = [
'objectType' => "comment",
'content' => $content,
- 'inReplyTo' => $inReplyTo);
+ 'inReplyTo' => $inReplyTo];
if ($title != "")
$params["object"]["displayName"] = $title;
@@ -523,7 +523,7 @@ function pumpio_send(&$a,&$b) {
$url = 'https://'.$host.'/api/user/'.$user.'/feed';
if (pumpio_reachable($url))
- $success = $client->CallAPI($url, 'POST', $params, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
+ $success = $client->CallAPI($url, 'POST', $params, ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
else
$success = false;
@@ -548,7 +548,7 @@ function pumpio_send(&$a,&$b) {
if (count($r))
$a->contact = $r[0]["id"];
- $s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $params));
+ $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $params]);
require_once('include/queue_fn.php');
add_to_queue($a->contact,NETWORK_PUMPIO,$s);
notice(t('Pump.io post failed. Queued for retry.').EOL);
@@ -595,9 +595,9 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
$objectType = "image";
$params["verb"] = $action;
- $params["object"] = array('id' => $uri,
+ $params["object"] = ['id' => $uri,
"objectType" => $objectType,
- "content" => $content);
+ "content" => $content];
$client = new oauth_client_class;
$client->oauth_version = '1.0a';
@@ -612,7 +612,7 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
$url = 'https://'.$hostname.'/api/user/'.$username.'/feed';
if (pumpio_reachable($url))
- $success = $client->CallAPI($url, 'POST', $params, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
+ $success = $client->CallAPI($url, 'POST', $params, ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
else
$success = false;
@@ -625,7 +625,7 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
if (count($r))
$a->contact = $r[0]["id"];
- $s = serialize(array('url' => $url, 'item' => $orig_post["id"], 'post' => $params));
+ $s = serialize(['url' => $url, 'item' => $orig_post["id"], 'post' => $params]);
require_once('include/queue_fn.php');
add_to_queue($a->contact,NETWORK_PUMPIO,$s);
notice(t('Pump.io like failed. Queued for retry.').EOL);
@@ -742,7 +742,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
$username = $user.'@'.$host;
if (pumpio_reachable($url))
- $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $user);
+ $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $user);
else
$success = false;
@@ -767,7 +767,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
if ($first_time)
continue;
- $receiptians = array();
+ $receiptians = [];
if (@is_array($post->cc))
$receiptians = array_merge($receiptians, $post->cc);
@@ -945,7 +945,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
return;
}
- $likedata = array();
+ $likedata = [];
$likedata['parent'] = $orig_post['id'];
$likedata['verb'] = ACTIVITY_LIKE;
$likedata['gravity'] = 3;
@@ -977,10 +977,10 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
function pumpio_get_contact($uid, $contact, $no_insert = false) {
- GContact::update(array("url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2,
+ GContact::update(["url" => $contact->url, "network" => NETWORK_PUMPIO, "generation" => 2,
"photo" => $contact->image->url, "name" => $contact->displayName, "hide" => true,
"nick" => $contact->preferredUsername, "location" => $contact->location->displayName,
- "about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id)));
+ "about" => $contact->summary, "addr" => str_replace("acct:", "", $contact->id)]);
$cid = Contact::getIdForURL($contact->url, $uid);
if ($no_insert)
@@ -1101,7 +1101,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
if (!strstr("post|share|update", $post->verb))
return false;
- $receiptians = array();
+ $receiptians = [];
if (@is_array($post->cc))
$receiptians = array_merge($receiptians, $post->cc);
@@ -1113,7 +1113,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
if ($receiver->id == "http://activityschema.org/collection/public")
$public = true;
- $postarray = array();
+ $postarray = [];
$postarray['network'] = NETWORK_PUMPIO;
$postarray['gravity'] = 0;
$postarray['uid'] = $uid;
@@ -1294,7 +1294,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
$conv_parent = $conv['parent'];
- notification(array(
+ notification([
'type' => NOTIFY_COMMENT,
'notify_flags' => $user[0]['notify-flags'],
'language' => $user[0]['language'],
@@ -1309,7 +1309,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $conv_parent,
- ));
+ ]);
// only send one notification
break;
@@ -1362,7 +1362,7 @@ function pumpio_fetchinbox(&$a, $uid) {
$url .= '?since='.urlencode($last_id);
if (pumpio_reachable($url))
- $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $user);
+ $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $user);
else
$success = false;
@@ -1403,7 +1403,7 @@ function pumpio_getallusers(&$a, $uid) {
$url = 'https://'.$hostname.'/api/user/'.$username.'/following';
if (pumpio_reachable($url))
- $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $users);
+ $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $users);
else
$success = false;
@@ -1411,7 +1411,7 @@ function pumpio_getallusers(&$a, $uid) {
$url = 'https://'.$hostname.'/api/user/'.$username.'/following?count='.$users->totalItems;
if (pumpio_reachable($url))
- $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $users);
+ $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $users);
else
$success = false;
}
@@ -1478,7 +1478,7 @@ function pumpio_queue_hook(&$a,&$b) {
$client->client_secret = $consumer_secret;
if (pumpio_reachable($z['url']))
- $success = $client->CallAPI($z['url'], 'POST', $z['post'], array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user);
+ $success = $client->CallAPI($z['url'], 'POST', $z['post'], ['FailOnAccessError'=>true, 'RequestContentType'=>'application/json'], $user);
else
$success = false;
@@ -1507,7 +1507,7 @@ function pumpio_queue_hook(&$a,&$b) {
function pumpio_getreceiver(&$a, $b) {
- $receiver = array();
+ $receiver = [];
if (!$b["private"]) {
@@ -1517,9 +1517,9 @@ function pumpio_getreceiver(&$a, $b) {
$public = PConfig::get($b['uid'], "pumpio", "public");
if ($public)
- $receiver["to"][] = Array(
+ $receiver["to"][] = [
"objectType" => "collection",
- "id" => "http://activityschema.org/collection/public");
+ "id" => "http://activityschema.org/collection/public"];
} else {
$cids = explode("><", $b["allow_cid"]);
$gids = explode("><", $b["allow_gid"]);
@@ -1534,11 +1534,11 @@ function pumpio_getreceiver(&$a, $b) {
);
if (count($r)) {
- $receiver["bcc"][] = Array(
+ $receiver["bcc"][] = [
"displayName" => $r[0]["name"],
"objectType" => "person",
"preferredUsername" => $r[0]["nick"],
- "url" => $r[0]["url"]);
+ "url" => $r[0]["url"]];
}
}
foreach ($gids AS $gid) {
@@ -1552,11 +1552,11 @@ function pumpio_getreceiver(&$a, $b) {
);
foreach ($r AS $row)
- $receiver["bcc"][] = Array(
+ $receiver["bcc"][] = [
"displayName" => $row["name"],
"objectType" => "person",
"preferredUsername" => $row["nick"],
- "url" => $row["url"]);
+ "url" => $row["url"]];
}
}
@@ -1577,11 +1577,11 @@ function pumpio_getreceiver(&$a, $b) {
);
if (count($r)) {
- $receiver["to"][] = Array(
+ $receiver["to"][] = [
"displayName" => $r[0]["name"],
"objectType" => "person",
"preferredUsername" => $r[0]["nick"],
- "url" => $r[0]["url"]);
+ "url" => $r[0]["url"]];
}
}
}
@@ -1628,7 +1628,7 @@ function pumpio_fetchallcomments(&$a, $uid, $id) {
logger("pumpio_fetchallcomments: fetching comment for user ".$uid." url ".$url);
if (pumpio_reachable($url))
- $success = $client->CallAPI($url, 'GET', array(), array('FailOnAccessError'=>true), $item);
+ $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError'=>true], $item);
else
$success = false;
@@ -1697,7 +1697,7 @@ function pumpio_fetchallcomments(&$a, $uid, $id) {
function pumpio_reachable($url) {
- $data = z_fetch_url($url, false, $redirects, array('timeout'=>10));
+ $data = z_fetch_url($url, false, $redirects, ['timeout'=>10]);
return(intval($data['return_code']) != 0);
}
diff --git a/randplace/randplace.php b/randplace/randplace.php
index 96e5d3b2..b696bed2 100644
--- a/randplace/randplace.php
+++ b/randplace/randplace.php
@@ -4,9 +4,9 @@
* Description: Sample Friendica plugin/addon. Set a random place when posting.
* Version: 1.0
* Author: Mike Macgirvin
- *
- *
- *
+ *
+ *
+ *
*
* Addons are registered with the system through the admin
* panel.
@@ -14,7 +14,7 @@
* When registration is detected, the system calls the plugin
* name_install() function, located in 'addon/name/name.php',
* where 'name' is the name of the addon.
- * If the addon is removed from the configuration list, the
+ * If the addon is removed from the configuration list, the
* system will call the name_uninstall() function.
*
*/
@@ -24,7 +24,7 @@ use Friendica\Core\PConfig;
function randplace_install() {
/**
- *
+ *
* Our demo plugin will attach in three places.
* The first is just prior to storing a local post.
*
@@ -34,7 +34,7 @@ function randplace_install() {
/**
*
- * Then we'll attach into the plugin settings page, and also the
+ * Then we'll attach into the plugin settings page, and also the
* settings post hook so that we can create and update
* user preferences.
*
@@ -105,7 +105,7 @@ function randplace_post_hook($a, &$item) {
*
*/
- $cities = array();
+ $cities = [];
$zones = timezone_identifiers_list();
foreach($zones as $zone) {
if((strpos($zone,'/')) && (! stristr($zone,'US/')) && (! stristr($zone,'Etc/')))
@@ -142,7 +142,7 @@ function randplace_settings_post($a,$post) {
/**
*
- * Called from the Plugin Setting form.
+ * Called from the Plugin Setting form.
* Add our own settings info to the page.
*
*/
diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php
index a1d1a8ec..c7e51286 100644
--- a/remote_permissions/remote_permissions.php
+++ b/remote_permissions/remote_permissions.php
@@ -4,7 +4,7 @@
* Description: Allow the recipients of private posts to see who else can see the post by clicking the lock icon
* Version: 1.0
* Author: Zach
- *
+ *
*/
use Friendica\Core\Config;
@@ -38,17 +38,17 @@ function remote_permissions_settings(&$a,&$o) {
/* Get the current state of our config variable */
$remote_perms = PConfig::get(local_user(),'remote_perms','show');
-
+
/* Add some HTML to the existing form */
// $t = file_get_contents("addon/remote_permissions/settings.tpl" );
$t = get_markup_template("settings.tpl", "addon/remote_permissions/" );
- $o .= replace_macros($t, array(
+ $o .= replace_macros($t, [
'$remote_perms_title' => t('Remote Permissions Settings'),
'$remote_perms_label' => t('Allow recipients of your private posts to see the other recipients of the posts'),
'$checked' => (($remote_perms == 1) ? 'checked="checked"' : ''),
'$submit' => t('Save Settings')
- ));
+ ]);
}
@@ -71,7 +71,7 @@ function remote_permissions_content($a, $item_copy) {
$r = q("SELECT nick, url FROM contact WHERE id = %d LIMIT 1",
intval($item_copy['contact-id'])
);
- if(! $r)
+ if(! $r)
return;
// Find out if the contact lives here
@@ -95,7 +95,7 @@ function remote_permissions_content($a, $item_copy) {
if(($item_copy['private'] == 1) && (! strlen($item_copy['allow_cid'])) && (! strlen($item_copy['allow_gid']))
&& (! strlen($item_copy['deny_cid'])) && (! strlen($item_copy['deny_gid']))) {
- $allow_names = array();
+ $allow_names = [];
// Check for the original post here -- that's the only way
// to definitely get all of the recipients
@@ -124,14 +124,14 @@ function remote_permissions_content($a, $item_copy) {
$deny_groups = expand_acl($item['deny_gid']);
$o = t('Visible to:') . ' ';
- $allow = array();
- $deny = array();
+ $allow = [];
+ $deny = [];
if(count($allowed_groups)) {
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
dbesc(implode(', ', $allowed_groups))
);
- foreach($r as $rr)
+ foreach($r as $rr)
$allow[] = $rr['contact-id'];
}
$allow = array_unique($allow + $allowed_users);
@@ -140,7 +140,7 @@ function remote_permissions_content($a, $item_copy) {
$r = q("SELECT DISTINCT `contact-id` FROM group_member WHERE gid IN ( %s )",
dbesc(implode(', ', $deny_groups))
);
- foreach($r as $rr)
+ foreach($r as $rr)
$deny[] = $rr['contact-id'];
}
$deny = $deny + $deny_users;
@@ -167,7 +167,7 @@ function remote_permissions_content($a, $item_copy) {
if(! $r)
return;
- $allow = array();
+ $allow = [];
foreach($r as $rr)
$allow[] = $rr['uid'];
@@ -194,11 +194,11 @@ function remote_permissions_content($a, $item_copy) {
function remote_permissions_plugin_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/remote_permissions/" );
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Save Settings'),
- '$global' => array('remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1),
- '$individual' => array('remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0)
- ));
+ '$global' => ['remotepermschoice', t('Global'), 1, t('The posts of every user on this server show the post recipients'), Config::get('remote_perms', 'global') == 1],
+ '$individual' => ['remotepermschoice', t('Individual'), 2, t('Each user chooses whether his/her posts show the post recipients'), Config::get('remote_perms', 'global') == 0]
+ ]);
}
function remote_permissions_plugin_admin_post(&$a){
diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php
index 534568ca..1a2a962f 100644
--- a/rendertime/rendertime.php
+++ b/rendertime/rendertime.php
@@ -28,7 +28,7 @@ function rendertime_page_end(&$a, &$o) {
$duration = microtime(true)-$a->performance["start"];
- $ignored_modules = array("fbrowser");
+ $ignored_modules = ["fbrowser"];
$ignored = in_array($a->module, $ignored_modules);
if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) {
diff --git a/securemail/securemail.php b/securemail/securemail.php
index 011e60da..68fc24ff 100644
--- a/securemail/securemail.php
+++ b/securemail/securemail.php
@@ -60,13 +60,13 @@ function securemail_settings(App &$a, &$s){
$t = get_markup_template('admin.tpl', 'addon/securemail/');
- $s .= replace_macros($t, array(
+ $s .= replace_macros($t, [
'$title' => t('"Secure Mail" Settings'),
'$submit' => t('Save Settings'),
'$test' => t('Save and send test'), //NOTE: update also in 'post'
- '$enable' => array('securemail-enable', t('Enable Secure Mail'), $enable, ''),
- '$publickey' => array('securemail-pkey', t('Public key'), $publickey, t('Your public PGP key, ascii armored format'), 'rows="10"')
- ));
+ '$enable' => ['securemail-enable', t('Enable Secure Mail'), $enable, ''],
+ '$publickey' => ['securemail-pkey', t('Public key'), $publickey, t('Your public PGP key, ascii armored format'), 'rows="10"']
+ ]);
}
/**
@@ -107,7 +107,7 @@ function securemail_settings_post(App &$a, array &$b){
$subject = 'Friendica - Secure Mail - Test';
$message = 'This is a test message from your Friendica Secure Mail addon.';
- $params = array(
+ $params = [
'uid' => local_user(),
'fromName' => $sitename,
'fromEmail' => $sender_email,
@@ -115,7 +115,7 @@ function securemail_settings_post(App &$a, array &$b){
'messageSubject' => $subject,
'htmlVersion' => "{$message}
",
'textVersion' => $message,
- );
+ ];
// enable addon for test
PConfig::set(local_user(), 'securemail', 'enable', 1);
@@ -164,11 +164,11 @@ function securemail_emailer_send_prepare(App &$a, array &$b) {
$key = OpenPGP_Message::parse($public_key);
- $data = new OpenPGP_LiteralDataPacket($b['textVersion'], array(
+ $data = new OpenPGP_LiteralDataPacket($b['textVersion'], [
'format' => 'u',
'filename' => 'encrypted.gpg'
- ));
- $encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message(array($data)));
+ ]);
+ $encrypted = OpenPGP_Crypt_Symmetric::encrypt($key, new OpenPGP_Message([$data]));
$armored_encrypted = wordwrap(
OpenPGP::enarmor($encrypted->to_bytes(), 'PGP MESSAGE'),
64,
diff --git a/showmore/showmore.php b/showmore/showmore.php
index af158a55..9bddab63 100644
--- a/showmore/showmore.php
+++ b/showmore/showmore.php
@@ -156,7 +156,7 @@ function showmore_cutitem($text, $limit) {
@$doc->loadHTML($doctype."".$text."");
$text = $doc->saveHTML();
- $text = str_replace(array("", "", $doctype), array("", "", ""), $text);
+ $text = str_replace(["", "", $doctype], ["", "", ""], $text);
return($text);
}
diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php
index d8c15330..d922a6b1 100644
--- a/smileybutton/smileybutton.php
+++ b/smileybutton/smileybutton.php
@@ -8,16 +8,16 @@
function smileybutton_install() {
- //Register hooks
+ //Register hooks
register_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button');
-
+
logger("installed smileybutton");
}
function smileybutton_uninstall() {
//Delet registered hooks
- unregister_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button');
+ unregister_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button');
logger("removed smileybutton");
}
@@ -41,34 +41,34 @@ function show_button($a, &$b) {
*
*/
- $texts = array(
- '<3',
- '</3',
- ':-)',
- ';-)',
- ':-(',
- ':-P',
- ':-X',
- ':-D',
- ':-O',
- '\\\\o/',
- 'O_o',
- ":\'(",
- ":-!",
- ":-/",
- ":-[",
+ $texts = [
+ '<3',
+ '</3',
+ ':-)',
+ ';-)',
+ ':-(',
+ ':-P',
+ ':-X',
+ ':-D',
+ ':-O',
+ '\\\\o/',
+ 'O_o',
+ ":\'(",
+ ":-!",
+ ":-/",
+ ":-[",
"8-)",
- ':beer',
- ':coffee',
+ ':beer',
+ ':coffee',
':facepalm',
':like',
':dislike',
'~friendica',
'red#'
- );
+ ];
- $icons = array(
+ $icons = [
' ',
' ',
' ',
@@ -77,7 +77,7 @@ function show_button($a, &$b) {
' ',
' ',
' ',
- ' ',
+ ' ',
' ',
' ',
' ',
@@ -92,10 +92,10 @@ function show_button($a, &$b) {
' ',
' ',
' '
- );
-
+ ];
+
// Call hooks to get aditional smileies from other addons
- $params = array('texts' => $texts, 'icons' => $icons, 'string' => ""); //changed
+ $params = ['texts' => $texts, 'icons' => $icons, 'string' => ""]; //changed
call_hooks('smilie', $params);
//Generate html for smiley list
@@ -113,16 +113,16 @@ function show_button($a, &$b) {
//Add css to header
$css_file = 'addon/smileybutton/view/'.current_theme().'.css';
- if (! file_exists($css_file))
+ if (! file_exists($css_file))
$css_file = 'addon/smileybutton/view/default.css';
$css_url = $a->get_baseurl().'/'.$css_file;
$a->page['htmlhead'] .= ' '."\r\n";
-
+
//Get the correct image for the theme
$image = 'addon/smileybutton/view/'.current_theme().'.png';
- if (! file_exists($image))
+ if (! file_exists($image))
$image = 'addon/smileybutton/view/default.png';
$image_url = $a->get_baseurl().'/'.$image;
diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php
index 34bbf20c..9158052a 100644
--- a/statusnet/statusnet.php
+++ b/statusnet/statusnet.php
@@ -97,7 +97,7 @@ class StatusNetOAuth extends TwitterOAuth
*/
function http($url, $method, $postfields = NULL)
{
- $this->http_info = array();
+ $this->http_info = [];
$ci = curl_init();
/* Curl settings */
$prx = Config::get('system', 'proxy');
@@ -113,9 +113,9 @@ class StatusNetOAuth extends TwitterOAuth
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout);
curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:'));
+ curl_setopt($ci, CURLOPT_HTTPHEADER, ['Expect:']);
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer);
- curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader'));
+ curl_setopt($ci, CURLOPT_HEADERFUNCTION, [$this, 'getHeader']);
curl_setopt($ci, CURLOPT_HEADER, FALSE);
switch ($method) {
@@ -331,7 +331,7 @@ function statusnet_settings(App $a, &$s)
$mirrorenabled = PConfig::get(local_user(), 'statusnet', 'mirror_posts');
$mirrorchecked = (($mirrorenabled) ? ' checked="checked" ' : '');
$import = PConfig::get(local_user(), 'statusnet', 'import');
- $importselected = array("", "", "");
+ $importselected = ["", "", ""];
$importselected[$import] = ' selected="selected"';
//$importenabled = PConfig::get(local_user(),'statusnet','import');
//$importchecked = (($importenabled) ? ' checked="checked" ' : '');
@@ -662,9 +662,9 @@ function statusnet_post_hook(App $a, &$b)
$img_str = fetch_url($image);
$tempfile = tempnam(get_temppath(), "cache");
file_put_contents($tempfile, $img_str);
- $postdata = array("status" => $msg, "media[]" => $tempfile);
+ $postdata = ["status" => $msg, "media[]" => $tempfile];
} else {
- $postdata = array("status" => $msg);
+ $postdata = ["status" => $msg];
}
// and now dent it :-)
@@ -708,7 +708,7 @@ function statusnet_post_hook(App $a, &$b)
function statusnet_plugin_admin_post(App $a)
{
- $sites = array();
+ $sites = [];
foreach ($_POST['sitename'] as $id => $sitename) {
$sitename = trim($sitename);
@@ -725,13 +725,13 @@ function statusnet_plugin_admin_post(App $a)
$key != "" &&
!x($_POST['delete'][$id])) {
- $sites[] = Array(
+ $sites[] = [
'sitename' => $sitename,
'apiurl' => $apiurl,
'consumersecret' => $secret,
'consumerkey' => $key,
//'applicationname' => $applicationname
- );
+ ];
}
}
@@ -741,34 +741,34 @@ function statusnet_plugin_admin_post(App $a)
function statusnet_plugin_admin(App $a, &$o)
{
$sites = Config::get('statusnet', 'sites');
- $sitesform = array();
+ $sitesform = [];
if (is_array($sites)) {
foreach ($sites as $id => $s) {
- $sitesform[] = Array(
- 'sitename' => Array("sitename[$id]", "Site name", $s['sitename'], ""),
- 'apiurl' => Array("apiurl[$id]", "Api url", $s['apiurl'], t("Base API Path \x28remember the trailing /\x29")),
- 'secret' => Array("secret[$id]", "Secret", $s['consumersecret'], ""),
- 'key' => Array("key[$id]", "Key", $s['consumerkey'], ""),
+ $sitesform[] = [
+ 'sitename' => ["sitename[$id]", "Site name", $s['sitename'], ""],
+ 'apiurl' => ["apiurl[$id]", "Api url", $s['apiurl'], t("Base API Path \x28remember the trailing /\x29")],
+ 'secret' => ["secret[$id]", "Secret", $s['consumersecret'], ""],
+ 'key' => ["key[$id]", "Key", $s['consumerkey'], ""],
//'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""),
- 'delete' => Array("delete[$id]", "Delete", False, "Check to delete this preset"),
- );
+ 'delete' => ["delete[$id]", "Delete", False, "Check to delete this preset"],
+ ];
}
}
/* empty form to add new site */
$id++;
- $sitesform[] = Array(
- 'sitename' => Array("sitename[$id]", t("Site name"), "", ""),
- 'apiurl' => Array("apiurl[$id]", "Api url", "", t("Base API Path \x28remember the trailing /\x29")),
- 'secret' => Array("secret[$id]", t("Consumer Secret"), "", ""),
- 'key' => Array("key[$id]", t("Consumer Key"), "", ""),
+ $sitesform[] = [
+ 'sitename' => ["sitename[$id]", t("Site name"), "", ""],
+ 'apiurl' => ["apiurl[$id]", "Api url", "", t("Base API Path \x28remember the trailing /\x29")],
+ 'secret' => ["secret[$id]", t("Consumer Secret"), "", ""],
+ 'key' => ["key[$id]", t("Consumer Key"), "", ""],
//'applicationname' => Array("applicationname[$id]", t("Application name"), "", ""),
- );
+ ];
$t = get_markup_template("admin.tpl", "addon/statusnet/");
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Save Settings'),
'$sites' => $sitesform,
- ));
+ ]);
}
function statusnet_prepare_body(App $a, &$b)
@@ -902,7 +902,7 @@ function statusnet_fetchtimeline(App $a, $uid)
$connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
- $parameters = array("exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false);
+ $parameters = ["exclude_replies" => true, "trim_user" => true, "contributor_details" => false, "include_rts" => false];
$first_time = ($lastid == "");
@@ -1006,11 +1006,11 @@ function statusnet_fetch_contact($uid, $contact, $create_user)
return -1;
}
- GContact::update(array("url" => $contact->statusnet_profile_url,
+ GContact::update(["url" => $contact->statusnet_profile_url,
"network" => NETWORK_STATUSNET, "photo" => $contact->profile_image_url,
"name" => $contact->name, "nick" => $contact->screen_name,
"location" => $contact->location, "about" => $contact->description,
- "addr" => statusnet_address($contact), "generation" => 3));
+ "addr" => statusnet_address($contact), "generation" => 3]);
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
@@ -1143,7 +1143,7 @@ function statusnet_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
return;
}
- $parameters = array();
+ $parameters = [];
if ($screen_name != "") {
$parameters["screen_name"] = $screen_name;
@@ -1174,7 +1174,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$api = PConfig::get($uid, 'statusnet', 'baseapi');
$hostname = preg_replace("=https?://([\w\.]*)/.*=ism", "$1", $api);
- $postarray = array();
+ $postarray = [];
$postarray['network'] = NETWORK_STATUSNET;
$postarray['gravity'] = 0;
$postarray['uid'] = $uid;
@@ -1195,7 +1195,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
);
if (count($r)) {
- return array();
+ return [];
}
$contactid = 0;
@@ -1244,7 +1244,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
$postarray['owner-link'] = $r[0]["url"];
$postarray['owner-avatar'] = $r[0]["photo"];
} else {
- return array();
+ return [];
}
}
// Don't create accounts of people who just comment something
@@ -1263,7 +1263,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex
if (($contactid == 0) && !$only_existing_contact) {
$contactid = $self['id'];
} elseif ($contactid <= 0) {
- return array();
+ return [];
}
$postarray['contact-id'] = $contactid;
@@ -1361,7 +1361,7 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
$conv_parent = $conv['parent'];
- notification(array(
+ notification([
'type' => NOTIFY_COMMENT,
'notify_flags' => $user[0]['notify-flags'],
'language' => $user[0]['language'],
@@ -1376,7 +1376,7 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $conv_parent,
- ));
+ ]);
// only send one notification
break;
@@ -1386,7 +1386,7 @@ function statusnet_checknotification(App $a, $uid, $own_url, $top_item, $postarr
function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
{
- $conversations = array();
+ $conversations = [];
$ckey = PConfig::get($uid, 'statusnet', 'consumerkey');
$csecret = PConfig::get($uid, 'statusnet', 'consumersecret');
@@ -1435,7 +1435,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
return;
}
- $parameters = array("exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true);
+ $parameters = ["exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true];
//$parameters["count"] = 200;
if ($mode == 1) {
@@ -1569,7 +1569,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
if (($item != 0) && !function_exists("check_item_notification")) {
require_once 'include/enotify.php';
- notification(array(
+ notification([
'type' => NOTIFY_TAGSELF,
'notify_flags' => $u[0]['notify-flags'],
'language' => $u[0]['language'],
@@ -1584,7 +1584,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
'verb' => ACTIVITY_TAG,
'otype' => 'item',
'parent' => $parent_id,
- ));
+ ]);
}
}
}
@@ -1711,7 +1711,7 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
}
if ($no_tags) {
- return array("body" => $body, "tags" => "");
+ return ["body" => $body, "tags" => ""];
}
$str_tags = '';
@@ -1739,7 +1739,7 @@ function statusnet_convertmsg(App $a, $body, $no_tags = false)
}
}
- return array("body" => $body, "tags" => $str_tags);
+ return ["body" => $body, "tags" => $str_tags];
}
function statusnet_fetch_own_contact(App $a, $uid)
diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php
index 9c1a0c04..6203f3cd 100644
--- a/testdrive/testdrive.php
+++ b/testdrive/testdrive.php
@@ -58,7 +58,7 @@ function testdrive_cron($a,$b) {
if(count($r)) {
foreach($r as $rr) {
- notification(array(
+ notification([
'uid' => $rr['uid'],
'type' => NOTIFY_SYSTEM,
'system_type' => 'testdrive_expire',
@@ -68,7 +68,7 @@ function testdrive_cron($a,$b) {
'source_name' => t('Administrator'),
'source_link' => $a->get_baseurl(),
'source_photo' => $a->get_baseurl() . '/images/person-80.jpg',
- ));
+ ]);
q("update user set expire_notification_sent = '%s' where uid = %d",
dbesc(datetime_convert()),
diff --git a/tictac/tictac.php b/tictac/tictac.php
index 1dd1ccb0..99737841 100644
--- a/tictac/tictac.php
+++ b/tictac/tictac.php
@@ -17,7 +17,7 @@ function tictac_uninstall() {
}
function tictac_app_menu($a,&$b) {
- $b['app_menu'][] = '';
+ $b['app_menu'][] = '';
}
@@ -39,7 +39,7 @@ function tictac_content(&$a) {
$dimen = $a->argv[3];
$yours = $a->argv[4];
$mine = $a->argv[5];
-
+
$yours .= $_POST['move'];
}
elseif($a->argc > 1) {
@@ -59,7 +59,7 @@ function tictac_content(&$a) {
$o .= '' . t('New game with handicap') . ' ';
$o .= '' . t('Three dimensional tic-tac-toe is just like the traditional game except that it is played on multiple levels simultaneously. ');
$o .= t('In this case there are three levels. You win by getting three in a row on any level, as well as up, down, and diagonally across the different levels.');
- $o .= '
';
+ $o .= '
';
$o .= t('The handicap game disables the center position on the middle level because the player claiming this square often has an unfair advantage.');
$o .= '
';
@@ -73,11 +73,11 @@ class tictac {
private $handicap = 0;
private $yours;
private $mine;
- private $winning_play;
+ private $winning_play;
private $you;
private $me;
private $debug = 1;
- private $crosses = array('011','101','110','112','121','211');
+ private $crosses = ['011','101','110','112','121','211'];
/*
'001','010','011','012','021',
@@ -85,82 +85,82 @@ class tictac {
'201','210','211','212','221');
*/
- private $corners = array(
+ private $corners = [
'000','002','020','022',
- '200','202','220','222');
+ '200','202','220','222'];
- private $planes = array(
- array('000','001','002','010','011','012','020','021','022'), // horiz 1
- array('100','101','102','110','111','112','120','121','122'), // 2
- array('200','201','202','210','211','212','220','221','222'), // 3
- array('000','010','020','100','110','120','200','210','220'), // vert left
- array('000','001','002','100','101','102','200','201','202'), // vert top
- array('002','012','022','102','112','122','202','212','222'), // vert right
- array('020','021','022','120','121','122','220','221','222'), // vert bot
- array('010','011','012','110','111','112','210','211','212'), // left vertx
- array('001','011','021','101','111','221','201','211','221'), // top vertx
- array('000','001','002','110','111','112','220','221','222'), // diag top
- array('020','021','022','110','111','112','200','201','202'), // diag bot
- array('000','010','020','101','111','121','202','212','222'), // diag left
- array('002','012','022','101','111','121','200','210','220'), // diag right
- array('002','011','020','102','111','120','202','211','220'), // diag x
- array('000','011','022','100','111','122','200','211','222') // diag x
-
- );
+ private $planes = [
+ ['000','001','002','010','011','012','020','021','022'], // horiz 1
+ ['100','101','102','110','111','112','120','121','122'], // 2
+ ['200','201','202','210','211','212','220','221','222'], // 3
+ ['000','010','020','100','110','120','200','210','220'], // vert left
+ ['000','001','002','100','101','102','200','201','202'], // vert top
+ ['002','012','022','102','112','122','202','212','222'], // vert right
+ ['020','021','022','120','121','122','220','221','222'], // vert bot
+ ['010','011','012','110','111','112','210','211','212'], // left vertx
+ ['001','011','021','101','111','221','201','211','221'], // top vertx
+ ['000','001','002','110','111','112','220','221','222'], // diag top
+ ['020','021','022','110','111','112','200','201','202'], // diag bot
+ ['000','010','020','101','111','121','202','212','222'], // diag left
+ ['002','012','022','101','111','121','200','210','220'], // diag right
+ ['002','011','020','102','111','120','202','211','220'], // diag x
+ ['000','011','022','100','111','122','200','211','222'] // diag x
+
+ ];
- private $winner = array(
- array('000','001','002'), // board 0 winners - left corner across
- array('000','010','020'), // down
- array('000','011','022'), // diag
- array('001','011','021'), // middle-top down
- array('010','011','012'), // middle-left across
- array('002','011','020'), // right-top diag
- array('002','012','022'), // right-top down
- array('020','021','022'), // bottom-left across
- array('100','101','102'), // board 1 winners
- array('100','110','120'),
- array('100','111','122'),
- array('101','111','121'),
- array('110','111','112'),
- array('102','111','120'),
- array('102','112','122'),
- array('120','121','122'),
- array('200','201','202'), // board 2 winners
- array('200','210','220'),
- array('200','211','222'),
- array('201','211','221'),
- array('210','211','212'),
- array('202','211','220'),
- array('202','212','222'),
- array('220','221','222'),
- array('000','100','200'), // top-left corner 3d
- array('000','101','202'),
- array('000','110','220'),
- array('000','111','222'),
- array('001','101','201'), // top-middle 3d
- array('001','111','221'),
- array('002','102','202'), // top-right corner 3d
- array('002','101','200'),
- array('002','112','222'),
- array('002','111','220'),
- array('010','110','210'), // left-middle 3d
- array('010','111','212'),
- array('011','111','211'), // middle-middle 3d
- array('012','112','212'), // right-middle 3d
- array('012','111','210'),
- array('020','120','220'), // bottom-left corner 3d
- array('020','110','200'),
- array('020','121','222'),
- array('020','111','202'),
- array('021','121','221'), // bottom-middle 3d
- array('021','111','201'),
- array('022','122','222'), // bottom-right corner 3d
- array('022','121','220'),
- array('022','112','202'),
- array('022','111','200')
+ private $winner = [
+ ['000','001','002'], // board 0 winners - left corner across
+ ['000','010','020'], // down
+ ['000','011','022'], // diag
+ ['001','011','021'], // middle-top down
+ ['010','011','012'], // middle-left across
+ ['002','011','020'], // right-top diag
+ ['002','012','022'], // right-top down
+ ['020','021','022'], // bottom-left across
+ ['100','101','102'], // board 1 winners
+ ['100','110','120'],
+ ['100','111','122'],
+ ['101','111','121'],
+ ['110','111','112'],
+ ['102','111','120'],
+ ['102','112','122'],
+ ['120','121','122'],
+ ['200','201','202'], // board 2 winners
+ ['200','210','220'],
+ ['200','211','222'],
+ ['201','211','221'],
+ ['210','211','212'],
+ ['202','211','220'],
+ ['202','212','222'],
+ ['220','221','222'],
+ ['000','100','200'], // top-left corner 3d
+ ['000','101','202'],
+ ['000','110','220'],
+ ['000','111','222'],
+ ['001','101','201'], // top-middle 3d
+ ['001','111','221'],
+ ['002','102','202'], // top-right corner 3d
+ ['002','101','200'],
+ ['002','112','222'],
+ ['002','111','220'],
+ ['010','110','210'], // left-middle 3d
+ ['010','111','212'],
+ ['011','111','211'], // middle-middle 3d
+ ['012','112','212'], // right-middle 3d
+ ['012','111','210'],
+ ['020','120','220'], // bottom-left corner 3d
+ ['020','110','200'],
+ ['020','121','222'],
+ ['020','111','202'],
+ ['021','121','221'], // bottom-middle 3d
+ ['021','111','201'],
+ ['022','122','222'], // bottom-right corner 3d
+ ['022','121','220'],
+ ['022','112','202'],
+ ['022','111','200']
- );
+ ];
function __construct($dimen,$handicap,$mefirst,$yours,$mine) {
$this->dimen = 3;
@@ -209,7 +209,7 @@ class tictac {
$this->mine .= $move;
$this->me = $this->parse_moves('me');
}
- else {
+ else {
$move = $this->offensive_move();
if(strlen($move)) {
$this->mine .= $move;
@@ -231,7 +231,7 @@ class tictac {
$str = $this->mine;
if($player == 'you')
$str = $this->yours;
- $ret = array();
+ $ret = [];
while(strlen($str)) {
$ret[] = substr($str,0,3);
$str = substr($str,3);
@@ -299,7 +299,7 @@ function winning_move() {
if($this->handicap) {
$p = $this->uncontested_plane();
foreach($this->corners as $c)
- if((in_array($c,$p))
+ if((in_array($c,$p))
&& (! $this->is_yours($c)) && (! $this->is_mine($c)))
return($c);
}
@@ -320,11 +320,11 @@ function winning_move() {
if(in_array($this->me[0],$this->corners)) {
$p = $this->my_best_plane();
foreach($this->winner as $w) {
- if((in_array($w[0],$this->you))
+ if((in_array($w[0],$this->you))
|| (in_array($w[1],$this->you))
|| (in_array($w[2],$this->you)))
- continue;
- if(in_array($w[0],$this->corners)
+ continue;
+ if(in_array($w[0],$this->corners)
&& in_array($w[2],$this->corners)
&& in_array($w[0],$p) && in_array($w[2],$p)) {
if($this->me[0] == $w[0])
@@ -338,7 +338,7 @@ function winning_move() {
else {
$r = $this->get_corners($this->me);
if(count($r) > 1) {
- $w1 = array(); $w2 = array();
+ $w1 = []; $w2 = [];
foreach($this->winner as $w) {
if(in_array('111',$w))
continue;
@@ -350,13 +350,13 @@ function winning_move() {
if(count($w1) && count($w2)) {
foreach($w1 as $a) {
foreach($w2 as $b) {
- if((in_array($a[0],$this->you))
+ if((in_array($a[0],$this->you))
|| (in_array($a[1],$this->you))
|| (in_array($a[2],$this->you))
|| (in_array($b[0],$this->you))
|| (in_array($b[1],$this->you))
|| (in_array($b[2],$this->you)))
- continue;
+ continue;
if(($a[0] == $b[0]) && ! $this->is_mine($a[0])) {
return $a[0];
}
@@ -375,8 +375,8 @@ function winning_move() {
// && in_array($this->you[0],$this->corners)
// && $this->is_neighbor($this->me[0],$this->you[0])) {
- // Yuck. You foiled my plan. Since you obviously aren't playing to win,
- // I'll try again. You may keep me busy for a few rounds, but I'm
+ // Yuck. You foiled my plan. Since you obviously aren't playing to win,
+ // I'll try again. You may keep me busy for a few rounds, but I'm
// gonna' get you eventually.
// $p = $this->uncontested_plane();
@@ -388,14 +388,14 @@ function winning_move() {
// find all the winners containing my points.
- $mywinners = array();
+ $mywinners = [];
foreach($this->winner as $w)
foreach($this->me as $m)
if((in_array($m,$w)) && (! in_array($w,$mywinners)))
$mywinners[] = $w;
// find all the rules where my points are in the center.
- $trythese = array();
+ $trythese = [];
if(count($mywinners)) {
foreach($mywinners as $w) {
foreach($this->me as $m) {
@@ -406,19 +406,19 @@ function winning_move() {
}
}
- $myplanes = array();
+ $myplanes = [];
for($p = 0; $p < count($this->planes); $p ++) {
if($this->handicap && in_array('111',$this->planes[$p]))
continue;
foreach($this->me as $m)
- if((in_array($m,$this->planes[$p]))
+ if((in_array($m,$this->planes[$p]))
&& (! in_array($this->planes[$p],$myplanes)))
$myplanes[] = $this->planes[$p];
}
shuffle($myplanes);
// find all winners which share an endpoint, and which are uncontested
- $candidates = array();
+ $candidates = [];
if(count($trythese) && count($myplanes)) {
foreach($trythese as $t) {
foreach($this->winner as $w) {
@@ -436,7 +436,7 @@ function winning_move() {
// Find out if we are about to force a win.
// Looking for two winning vectors with a common endpoint
- // and where we own the middle of both - we are now going to
+ // and where we own the middle of both - we are now going to
// grab the endpoint. The game isn't yet over but we've already won.
if(count($candidates)) {
@@ -452,7 +452,7 @@ function winning_move() {
}
// find opponents planes
- $yourplanes = array();
+ $yourplanes = [];
for($p = 0; $p < count($this->planes); $p ++) {
if($this->handicap && in_array('111',$this->planes[$p]))
continue;
@@ -466,7 +466,7 @@ function winning_move() {
// We now have a list of winning strategy vectors for our second point
// Pick one that will force you into defensive mode.
// Pick a point close to you so we don't risk giving you two
- // in a row when you block us. That would force *us* into
+ // in a row when you block us. That would force *us* into
// defensive mode.
// We want: or: not:
// X|O| X| | X| |
@@ -475,41 +475,41 @@ function winning_move() {
if(count($this->you) == 1) {
foreach($this->winner as $w) {
- if(in_array($this->me[0], $w) && in_array($c[1],$w)
- && $this->uncontested_winner($w)
+ if(in_array($this->me[0], $w) && in_array($c[1],$w)
+ && $this->uncontested_winner($w)
&& $this->is_neighbor($this->you[0],$c[1])) {
return($c[1]);
- }
+ }
}
}
- }
+ }
- // You're somewhere else entirely or have made more than one move
+ // You're somewhere else entirely or have made more than one move
// - any strategy vector which puts you on the defense will have to do
foreach($candidates as $c) {
foreach($this->winner as $w) {
- if(in_array($this->me[0], $w) && in_array($c[1],$w)
+ if(in_array($this->me[0], $w) && in_array($c[1],$w)
&& $this->uncontested_winner($w)) {
return($c[1]);
- }
+ }
}
}
}
- // worst case scenario, no strategy we can play,
+ // worst case scenario, no strategy we can play,
// just find an empty space and take it
for($x = 0; $x < $this->dimen; $x ++)
for($y = 0; $y < $this->dimen; $y ++)
for($z = 0; $z < $this->dimen; $z ++)
- if((! $this->marked_yours($x,$y,$z))
+ if((! $this->marked_yours($x,$y,$z))
&& (! $this->marked_mine($x,$y,$z))) {
if($this->handicap && $x == 1 && $y == 1 && $z == 1)
continue;
return(sprintf("%d%d%d",$x,$y,$z));
}
-
+
return '';
}
@@ -540,7 +540,7 @@ function winning_move() {
}
function get_corners($a) {
- $total = array();
+ $total = [];
if(count($a))
foreach($a as $b)
if(in_array($b,$this->corners))
@@ -575,7 +575,7 @@ function winning_move() {
function my_best_plane() {
- $second_choice = array();
+ $second_choice = [];
shuffle($this->planes);
for($p = 0; $p < count($this->planes); $p ++ ) {
$contested = 0;
@@ -585,7 +585,7 @@ function winning_move() {
continue;
foreach($this->you as $m) {
if(in_array($m,$this->planes[$p]))
- $contested ++;
+ $contested ++;
}
if(! $contested)
return($this->planes[$p]);
@@ -610,8 +610,8 @@ function winning_move() {
if($this->handicap && in_array('111',$pl[$p]))
continue;
foreach($this->you as $m) {
- if(in_array($m,$pl[$p]))
- $freeplane = false;
+ if(in_array($m,$pl[$p]))
+ $freeplane = false;
}
if(! $freeplane) {
$freeplane = true;
@@ -620,7 +620,7 @@ function winning_move() {
if($freeplane)
return($pl[$p]);
}
- return array();
+ return [];
}
function fullboard() {
@@ -641,7 +641,7 @@ function winning_move() {
$bordertop = (($y != 0) ? " border-top: 2px solid #000;" : "");
$borderleft = (($z != 0) ? " border-left: 2px solid #000;" : "");
if($this->handicap && $x == 1 && $y == 1 && $z == 1)
- $o .= " ";
+ $o .= " ";
elseif($this->marked_yours($x,$y,$z))
$o .= "X ";
elseif($this->marked_mine($x,$y,$z))
diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php
index 78c12a5f..a056bd09 100644
--- a/tumblr/tumblr.php
+++ b/tumblr/tumblr.php
@@ -60,12 +60,12 @@ function tumblr_content(&$a) {
function tumblr_plugin_admin(&$a, &$o){
$t = get_markup_template( "admin.tpl", "addon/tumblr/" );
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Save Settings'),
// name, label, value, help, [extra values]
- '$consumer_key' => array('consumer_key', t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''),
- '$consumer_secret' => array('consumer_secret', t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''),
- ));
+ '$consumer_key' => ['consumer_key', t('Consumer Key'), Config::get('tumblr', 'consumer_key' ), ''],
+ '$consumer_secret' => ['consumer_secret', t('Consumer Secret'), Config::get('tumblr', 'consumer_secret' ), ''],
+ ]);
}
function tumblr_plugin_admin_post(&$a){
@@ -240,12 +240,12 @@ function tumblr_settings(&$a,&$s) {
$userinfo = $tum_oauth->get('user/info');
- $blogs = array();
+ $blogs = [];
$s .= '' . t('Post to page:') . ' ';
$s .= '';
foreach($userinfo->response->user->blogs as $blog) {
- $blogurl = substr(str_replace(array("http://", "https://"), array("", ""), $blog->url), 0, -1);
+ $blogurl = substr(str_replace(["http://", "https://"], ["", ""], $blog->url), 0, -1);
if ($page == $blogurl)
$s .= "".$blogurl." ";
else
@@ -344,7 +344,7 @@ function tumblr_send(&$a,&$b) {
require_once('include/bbcode.php');
- $tag_arr = array();
+ $tag_arr = [];
$tags = '';
$x = preg_match_all('/\#\[(.*?)\](.*?)\[/',$b['tag'],$matches,PREG_SET_ORDER);
@@ -361,11 +361,11 @@ function tumblr_send(&$a,&$b) {
$siteinfo = get_attached_data($b["body"]);
- $params = array(
+ $params = [
'state' => 'published',
'tags' => $tags,
'tweet' => 'off',
- 'format' => 'html');
+ 'format' => 'html'];
if (!isset($siteinfo["type"]))
$siteinfo["type"] = "";
diff --git a/twitter/twitter.php b/twitter/twitter.php
index ccfdeb1f..807445b6 100644
--- a/twitter/twitter.php
+++ b/twitter/twitter.php
@@ -151,7 +151,7 @@ function twitter_follow(App $a, &$contact)
$cb->setConsumerKey($ckey, $csecret);
$cb->setToken($otoken, $osecret);
- $parameters = array();
+ $parameters = [];
$parameters["screen_name"] = $nickname;
$user = $cb->friendships_create($parameters);
@@ -331,24 +331,24 @@ function twitter_settings(App $a, &$s)
';
$s .= '
';
- $s .= replace_macros($field_checkbox, array(
- '$field' => array('twitter-enable', t('Allow posting to Twitter'), $enabled, t('If enabled all your public postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.'))
- ));
+ $s .= replace_macros($field_checkbox, [
+ '$field' => ['twitter-enable', t('Allow posting to Twitter'), $enabled, t('If enabled all your public postings can be posted to the associated Twitter account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.')]
+ ]);
if ($a->user['hidewall']) {
$s .= '' . t('Note : Due to your privacy settings (Hide your profile details from unknown viewers? ) the link potentially included in public postings relayed to Twitter will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '
';
}
- $s .= replace_macros($field_checkbox, array(
- '$field' => array('twitter-default', t('Send public postings to Twitter by default'), $defenabled, '')
- ));
- $s .= replace_macros($field_checkbox, array(
- '$field' => array('twitter-mirror', t('Mirror all posts from twitter that are no replies'), $mirrorenabled, '')
- ));
- $s .= replace_macros($field_checkbox, array(
- '$field' => array('twitter-import', t('Import the remote timeline'), $importenabled, '')
- ));
- $s .= replace_macros($field_checkbox, array(
- '$field' => array('twitter-create_user', t('Automatically create contacts'), $create_userenabled, '')
- ));
+ $s .= replace_macros($field_checkbox, [
+ '$field' => ['twitter-default', t('Send public postings to Twitter by default'), $defenabled, '']
+ ]);
+ $s .= replace_macros($field_checkbox, [
+ '$field' => ['twitter-mirror', t('Mirror all posts from twitter that are no replies'), $mirrorenabled, '']
+ ]);
+ $s .= replace_macros($field_checkbox, [
+ '$field' => ['twitter-import', t('Import the remote timeline'), $importenabled, '']
+ ]);
+ $s .= replace_macros($field_checkbox, [
+ '$field' => ['twitter-create_user', t('Automatically create contacts'), $create_userenabled, '']
+ ]);
$s .= '
';
$s .= '
';
@@ -399,7 +399,7 @@ function twitter_action(App $a, $uid, $pid, $action)
$cb->setConsumerKey($ckey, $csecret);
$cb->setToken($otoken, $osecret);
- $post = array('id' => $pid);
+ $post = ['id' => $pid];
logger("twitter_action '" . $action . "' ID: " . $pid . " data: " . print_r($post, true), LOGGER_DATA);
@@ -557,7 +557,7 @@ function twitter_post_hook(App $a, &$b)
$cb->setConsumerKey($ckey, $csecret);
$cb->setToken($otoken, $osecret);
- $post = array('status' => $msg, 'media[]' => $tempfile);
+ $post = ['status' => $msg, 'media[]' => $tempfile];
if ($iscomment) {
$post["in_reply_to_status_id"] = substr($orig_post["uri"], 9);
@@ -604,7 +604,7 @@ function twitter_post_hook(App $a, &$b)
}
// -----------------
$url = 'statuses/update';
- $post = array('status' => $msg, 'weighted_character_count' => 'true');
+ $post = ['status' => $msg, 'weighted_character_count' => 'true'];
if ($iscomment) {
$post["in_reply_to_status_id"] = substr($orig_post["uri"], 9);
@@ -625,7 +625,7 @@ function twitter_post_hook(App $a, &$b)
$a->contact = $r[0]["id"];
}
- $s = serialize(array('url' => $url, 'item' => $b['id'], 'post' => $post));
+ $s = serialize(['url' => $url, 'item' => $b['id'], 'post' => $post]);
require_once 'include/queue_fn.php';
add_to_queue($a->contact, NETWORK_TWITTER, $s);
notice(t('Twitter post failed. Queued for retry.') . EOL);
@@ -653,12 +653,12 @@ function twitter_plugin_admin(App $a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/twitter/");
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Save Settings'),
// name, label, value, help, [extra values]
- '$consumerkey' => array('consumerkey', t('Consumer key'), Config::get('twitter', 'consumerkey'), ''),
- '$consumersecret' => array('consumersecret', t('Consumer secret'), Config::get('twitter', 'consumersecret'), ''),
- ));
+ '$consumerkey' => ['consumerkey', t('Consumer key'), Config::get('twitter', 'consumerkey'), ''],
+ '$consumersecret' => ['consumersecret', t('Consumer secret'), Config::get('twitter', 'consumersecret'), ''],
+ ]);
}
function twitter_cron(App $a, $b)
@@ -737,9 +737,9 @@ function twitter_expire(App $a, $b)
}
if (method_exists('dba', 'delete')) {
- $r = dba::select('item', array('id'), array('deleted' => true, 'network' => NETWORK_TWITTER));
+ $r = dba::select('item', ['id'], ['deleted' => true, 'network' => NETWORK_TWITTER]);
while ($row = dba::fetch($r)) {
- dba::delete('item', array('id' => $row['id']));
+ dba::delete('item', ['id' => $row['id']]);
}
dba::close($r);
} else {
@@ -825,13 +825,13 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
if (is_object($post->retweeted_status)) {
// We don't support nested shares, so we mustn't show quotes as shares on retweets
- $item = twitter_createpost($a, $uid, $post->retweeted_status, array('id' => 0), false, false, true);
+ $item = twitter_createpost($a, $uid, $post->retweeted_status, ['id' => 0], false, false, true);
$datarray['body'] = "\n" . share_header($item['author-name'], $item['author-link'], $item['author-avatar'], "", $item['created'], $item['plink']);
$datarray['body'] .= $item['body'] . '[/share]';
} else {
- $item = twitter_createpost($a, $uid, $post, array('id' => 0), false, false, false);
+ $item = twitter_createpost($a, $uid, $post, ['id' => 0], false, false, false);
$datarray['body'] = $item['body'];
}
@@ -873,7 +873,7 @@ function twitter_fetchtimeline(App $a, $uid)
require_once 'library/twitteroauth.php';
$connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
- $parameters = array("exclude_replies" => true, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended");
+ $parameters = ["exclude_replies" => true, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended"];
$first_time = ($lastid == "");
@@ -1004,11 +1004,11 @@ function twitter_fetch_contact($uid, $contact, $create_user)
$avatar = twitter_fix_avatar($contact->profile_image_url_https);
- GContact::update(array("url" => "https://twitter.com/" . $contact->screen_name,
+ GContact::update(["url" => "https://twitter.com/" . $contact->screen_name,
"network" => NETWORK_TWITTER, "photo" => $avatar, "hide" => true,
"name" => $contact->name, "nick" => $contact->screen_name,
"location" => $contact->location, "about" => $contact->description,
- "addr" => $contact->screen_name . "@twitter.com", "generation" => 2));
+ "addr" => $contact->screen_name . "@twitter.com", "generation" => 2]);
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("twitter::" . $contact->id_str));
@@ -1149,7 +1149,7 @@ function twitter_fetchuser(App $a, $uid, $screen_name = "", $user_id = "")
return;
}
- $parameters = array();
+ $parameters = [];
if ($screen_name != "") {
$parameters["screen_name"] = $screen_name;
@@ -1261,10 +1261,10 @@ function twitter_expand_entities(App $a, $body, $item, $no_tags = false, $pictur
}
if ($no_tags) {
- return array("body" => $body, "tags" => "", "plain" => $plain);
+ return ["body" => $body, "tags" => "", "plain" => $plain];
}
- $tags_arr = array();
+ $tags_arr = [];
foreach ($item->entities->hashtags AS $hashtag) {
$url = "#[url=" . $a->get_baseurl() . "/search?tag=" . rawurlencode($hashtag->text) . "]" . $hashtag->text . "[/url]";
@@ -1319,7 +1319,7 @@ function twitter_expand_entities(App $a, $body, $item, $no_tags = false, $pictur
$tags = implode($tags_arr, ",");
}
- return array("body" => $body, "tags" => $tags, "plain" => $plain);
+ return ["body" => $body, "tags" => $tags, "plain" => $plain];
}
/**
@@ -1351,7 +1351,7 @@ function twitter_media_entities($post, &$postarray)
}
// This is a pure media post, first search for all media urls
- $media = array();
+ $media = [];
foreach ($post->extended_entities->media AS $medium) {
switch ($medium->type) {
case 'photo':
@@ -1388,7 +1388,7 @@ function twitter_media_entities($post, &$postarray)
function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_existing_contact, $noquote)
{
- $postarray = array();
+ $postarray = [];
$postarray['network'] = NETWORK_TWITTER;
$postarray['gravity'] = 0;
$postarray['uid'] = $uid;
@@ -1404,7 +1404,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
if (count($r)) {
logger("Item with extid " . $postarray['uri'] . " found.", LOGGER_DEBUG);
- return array();
+ return [];
}
$contactid = 0;
@@ -1453,7 +1453,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
$postarray['owner-avatar'] = $r[0]["photo"];
} else {
logger("No self contact for user " . $uid, LOGGER_DEBUG);
- return array();
+ return [];
}
}
// Don't create accounts of people who just comment something
@@ -1475,7 +1475,7 @@ function twitter_createpost(App $a, $uid, $post, $self, $create_user, $only_exis
$contactid = $self['id'];
} elseif ($contactid <= 0) {
logger("Contact ID is zero or less than zero.", LOGGER_DEBUG);
- return array();
+ return [];
}
$postarray['contact-id'] = $contactid;
@@ -1599,7 +1599,7 @@ function twitter_checknotification(App $a, $uid, $own_id, $top_item, $postarray)
$conv_parent = $conv['parent'];
- notification(array(
+ notification([
'type' => NOTIFY_COMMENT,
'notify_flags' => $user[0]['notify-flags'],
'language' => $user[0]['language'],
@@ -1614,7 +1614,7 @@ function twitter_checknotification(App $a, $uid, $own_id, $top_item, $postarray)
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $conv_parent,
- ));
+ ]);
// only send one notification
break;
@@ -1626,10 +1626,10 @@ function twitter_fetchparentposts(App $a, $uid, $post, $connection, $self, $own_
{
logger("twitter_fetchparentposts: Fetching for user " . $uid . " and post " . $post->id_str, LOGGER_DEBUG);
- $posts = array();
+ $posts = [];
while ($post->in_reply_to_status_id_str != "") {
- $parameters = array("trim_user" => false, "tweet_mode" => "extended", "id" => $post->in_reply_to_status_id_str);
+ $parameters = ["trim_user" => false, "tweet_mode" => "extended", "id" => $post->in_reply_to_status_id_str];
$post = $connection->get('statuses/show', $parameters);
@@ -1725,7 +1725,7 @@ function twitter_fetchhometimeline(App $a, $uid)
return;
}
- $parameters = array("exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended");
+ $parameters = ["exclude_replies" => false, "trim_user" => false, "contributor_details" => true, "include_rts" => true, "tweet_mode" => "extended"];
//$parameters["count"] = 200;
// Fetching timeline
$lastid = PConfig::get($uid, 'twitter', 'lasthometimelineid');
@@ -1857,7 +1857,7 @@ function twitter_fetchhometimeline(App $a, $uid)
if (($item != 0) && !function_exists("check_item_notification")) {
require_once 'include/enotify.php';
- notification(array(
+ notification([
'type' => NOTIFY_TAGSELF,
'notify_flags' => $u[0]['notify-flags'],
'language' => $u[0]['language'],
@@ -1872,7 +1872,7 @@ function twitter_fetchhometimeline(App $a, $uid)
'verb' => ACTIVITY_TAG,
'otype' => 'item',
'parent' => $parent_id
- ));
+ ]);
}
}
}
diff --git a/viewsrc/viewsrc.php b/viewsrc/viewsrc.php
index 687d9253..623ed89d 100644
--- a/viewsrc/viewsrc.php
+++ b/viewsrc/viewsrc.php
@@ -6,7 +6,7 @@
* Description: Add "View Source" link to item context
* Version: 1.0
* Author: Mike Macgirvin
- *
+ *
*/
function viewsrc_install() {
@@ -49,7 +49,7 @@ function viewsrc_item_photo_menu(&$a,&$b) {
} else
$item_id = $b['item']['id'];
- $b['menu'] = array_merge( array( t('View Source') => $a->get_baseurl() . '/viewsrc/'. $item_id), $b['menu']);
+ $b['menu'] = array_merge( [ t('View Source') => $a->get_baseurl() . '/viewsrc/'. $item_id], $b['menu']);
//if((! local_user()) || (local_user() != $b['item']['uid']))
// return;
diff --git a/webrtc/webrtc.php b/webrtc/webrtc.php
index 4ea17f47..1588847d 100644
--- a/webrtc/webrtc.php
+++ b/webrtc/webrtc.php
@@ -24,10 +24,10 @@ function webrtc_app_menu($a,&$b) {
function webrtc_plugin_admin (&$a, &$o) {
$t = get_markup_template( "admin.tpl", "addon/webrtc/" );
- $o = replace_macros( $t, array(
+ $o = replace_macros( $t, [
'$submit' => t('Save Settings'),
- '$webrtcurl' => array('webrtcurl', t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')),
- ));
+ '$webrtcurl' => ['webrtcurl', t('WebRTC Base URL'), Config::get('webrtc','webrtcurl' ), t('Page your users will create a WebRTC chat room on. For example you could use https://live.mayfirst.org .')],
+ ]);
}
function webrtc_plugin_admin_post (&$a) {
$url = ((x($_POST, 'webrtcurl')) ? notags(trim($_POST['webrtcurl'])) : '');
diff --git a/widgets/widget_friendheader.php b/widgets/widget_friendheader.php
index 20a84e25..f9a8acec 100644
--- a/widgets/widget_friendheader.php
+++ b/widgets/widget_friendheader.php
@@ -8,17 +8,17 @@ function friendheader_widget_help() {
}
function friendheader_widget_args(){
- return Array();
+ return [];
}
function friendheader_widget_size(){
- return Array('780px','140px');
+ return ['780px','140px'];
}
function friendheader_widget_content(&$a, $conf){
- $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile`
+ $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile`
LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`uid` = %s AND `profile`.`is-default` = 1 LIMIT 1",
intval($conf['uid'])
@@ -34,10 +34,10 @@ function friendheader_widget_content(&$a, $conf){
.allcontact-link { float: right; margin: 0px; }
.contact-block-content { clear:both; }
.contact-block-div { display: block !important; float: left!important; width: 50px!important; height: 50px!important; margin: 2px!important;}
-
+
";
$o .= _abs_url(contact_block());
$o .= "profile['nickname']."' target=new>". t('Get added to this list!') ." ";
-
+
return $o;
}
diff --git a/widgets/widget_friends.php b/widgets/widget_friends.php
index 195667e8..25e20180 100644
--- a/widgets/widget_friends.php
+++ b/widgets/widget_friends.php
@@ -8,17 +8,17 @@ function friends_widget_help() {
}
function friends_widget_args(){
- return Array();
+ return [];
}
function friends_widget_size(){
- return Array('100%','200px');
+ return ['100%','200px'];
}
function friends_widget_content(&$a, $conf){
- $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile`
+ $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `user`.* FROM `profile`
LEFT JOIN `user` ON `profile`.`uid` = `user`.`uid`
WHERE `user`.`uid` = %s AND `profile`.`is-default` = 1 LIMIT 1",
intval($conf['uid'])
@@ -34,7 +34,7 @@ function friends_widget_content(&$a, $conf){
.allcontact-link { float: right; margin: 0px; }
.contact-block-content { clear:both; }
.contact-block-div { display: block !important; float: left!important; width: 50px!important; height: 50px!important; margin: 2px!important;}
-
+
";
$o .= _abs_url(contact_block());
$o .= "profile['nickname']."'>". t('Connect on Friendica!') ." ";
diff --git a/widgets/widget_like.php b/widgets/widget_like.php
index 8f356da9..a67f0bd8 100644
--- a/widgets/widget_like.php
+++ b/widgets/widget_like.php
@@ -8,30 +8,30 @@ function like_widget_help() {
}
function like_widget_args(){
- return Array("KEY");
+ return ["KEY"];
}
function like_widget_size(){
- return Array('60px','20px');
+ return ['60px','20px'];
}
function like_widget_content(&$a, $conf){
$args = explode(",",$_GET['a']);
-
-
+
+
$baseq="SELECT COUNT(`item`.`id`) as `c`, `p`.`id`
- FROM `item`,
- (SELECT `i`.`id` FROM `item` as `i` WHERE
+ FROM `item`,
+ (SELECT `i`.`id` FROM `item` as `i` WHERE
`i`.`visible` = 1 AND `i`.`deleted` = 0
- AND (( `i`.`wall` = 1 AND `i`.`allow_cid` = ''
- AND `i`.`allow_gid` = ''
- AND `i`.`deny_cid` = ''
- AND `i`.`deny_gid` = '' )
+ AND (( `i`.`wall` = 1 AND `i`.`allow_cid` = ''
+ AND `i`.`allow_gid` = ''
+ AND `i`.`deny_cid` = ''
+ AND `i`.`deny_gid` = '' )
OR `i`.`uid` = %d )
AND `i`.`body` LIKE '%%%s%%' LIMIT 1) as `p`
WHERE `item`.`parent` = `p`.`id` ";
-
+
// count likes
$r = q( $baseq . "AND `item`.`verb` = 'http://activitystrea.ms/schema/1.0/like'",
intval($conf['uid']),
@@ -39,30 +39,30 @@ function like_widget_content(&$a, $conf){
);
$likes = $r[0]['c'];
$iid = $r[0]['id'];
-
+
// count dislikes
$r = q( $baseq . "AND `item`.`verb` = 'http://purl.org/macgirvin/dfrn/1.0/dislike'",
intval($conf['uid']),
dbesc($args[0])
);
$dislikes = $r[0]['c'];
-
-
+
+
require_once("include/conversation.php");
-
+
$o = "";
-
+
# $t = file_get_contents( dirname(__file__). "/widget_like.tpl" );
$t = get_markup_template("widget_like.tpl", "addon/widgets/");
- $o .= replace_macros($t, array(
+ $o .= replace_macros($t, [
'$like' => $likes,
'$strlike' => sprintf( tt("%d person likes this", "%d people like this", $likes), $likes),
-
+
'$dislike' => $dislikes,
'$strdislike'=> sprintf( tt("%d person doesn't like this", "%d people don't like this", $dislikes), $dislikes),
-
+
'$baseurl' => $a->get_baseurl(),
- ));
-
+ ]);
+
return $o;
}
diff --git a/widgets/widgets.php b/widgets/widgets.php
index a232d9e6..502278a2 100644
--- a/widgets/widgets.php
+++ b/widgets/widgets.php
@@ -9,12 +9,12 @@
use Friendica\Core\PConfig;
function widgets_install() {
- register_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings');
+ register_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings');
register_hook('plugin_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post');
logger("installed widgets");
}
function widgets_uninstall() {
- unregister_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings');
+ unregister_hook('plugin_settings', 'addon/widgets/widgets.php', 'widgets_settings');
unregister_hook('plugin_settings_post', 'addon/widgets/widgets.php', 'widgets_settings_post');
}
@@ -24,19 +24,19 @@ function widgets_settings_post(){
return;
if (isset($_POST['widgets-submit'])){
PConfig::delete(local_user(), 'widgets', 'key');
-
+
}
}
function widgets_settings(&$a,&$o) {
if(! local_user())
- return;
-
-
+ return;
+
+
$key = PConfig::get(local_user(), 'widgets', 'key' );
if ($key=='') { $key = mt_rand(); PConfig::set(local_user(), 'widgets', 'key', $key); }
- $widgets = array();
+ $widgets = [];
$d = dir(dirname(__file__));
while(false !== ($f = $d->read())) {
if(substr($f,0,7)=="widget_") {
@@ -44,17 +44,17 @@ function widgets_settings(&$a,&$o) {
$w=$m[1];
if ($w!=""){
require_once($f);
- $widgets[] = array($w, call_user_func($w."_widget_name"));
+ $widgets[] = [$w, call_user_func($w."_widget_name")];
}
}
}
-
-
+
+
# $t = file_get_contents( dirname(__file__). "/settings.tpl" );
$t = get_markup_template("settings.tpl", "addon/widgets/");
- $o .= replace_macros($t, array(
+ $o .= replace_macros($t, [
'$submit' => t('Generate new key'),
'$baseurl' => $a->get_baseurl(),
'$title' => "Widgets",
@@ -62,8 +62,8 @@ function widgets_settings(&$a,&$o) {
'$key' => $key,
'$widgets_h' => t('Widgets available'),
'$widgets' => $widgets,
- ));
-
+ ]);
+
}
function widgets_module() {
@@ -77,7 +77,7 @@ function _abs_url($s){
function _randomAlphaNum($length){
return substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',$length)),0,$length);
-}
+}
function widgets_content(&$a) {
@@ -93,12 +93,12 @@ function widgets_content(&$a) {
if (!count($r)){
if($a->argv[2]=="cb"){header('HTTP/1.0 400 Bad Request'); killme();}
return;
- }
- $conf = array();
+ }
+ $conf = [];
$conf['uid'] = $r[0]['uid'];
foreach($r as $e) { $conf[$e['k']]=$e['v']; }
-
- $o = "";
+
+ $o = "";
$widgetfile =dirname(__file__)."/widget_".$a->argv[1].".php";
if (file_exists($widgetfile)){
@@ -106,8 +106,8 @@ function widgets_content(&$a) {
} else {
if($a->argv[2]=="cb"){header('HTTP/1.0 400 Bad Request'); killme();}
return;
- }
-
+ }
+
@@ -115,10 +115,10 @@ function widgets_content(&$a) {
if ($a->argv[2]=="cb"){
/*header('Access-Control-Allow-Origin: *');*/
$o .= call_user_func($a->argv[1].'_widget_content',$a, $conf);
-
+
} else {
-
+
if (isset($_GET['p']) && local_user()==$conf['uid'] ) {
$o .= "";
$o .= "Preview Widget ";
@@ -131,13 +131,13 @@ function widgets_content(&$a) {
} else {
header("content-type: application/x-javascript");
}
-
-
-
+
+
+
$widget_size = call_user_func($a->argv[1].'_widget_size');
-
+
$script = file_get_contents(dirname(__file__)."/widgets.js");
- $o .= replace_macros($script, array(
+ $o .= replace_macros($script, [
'$entrypoint' => $a->get_baseurl()."/widgets/".$a->argv[1]."/cb/",
'$key' => $conf['key'],
'$widget_id' => 'f9a_'.$a->argv[1]."_"._randomAlphaNum(6),
@@ -146,35 +146,35 @@ function widgets_content(&$a) {
'$width' => $widget_size[0],
'$height' => $widget_size[1],
'$type' => $a->argv[1],
- ));
+ ]);
+
-
if (isset($_GET['p'])) {
$wargs = call_user_func($a->argv[1].'_widget_args');
$jsargs = implode(",", $wargs);
if ($jsargs!='') $jsargs = "&a=".$jsargs." ";
-
+
$o .= "
Copy and paste this code
"
-
+
.htmlspecialchars('')
."
";
-
+
return $o;
- }
-
- }
-
+ }
+
+ }
+
echo $o;
killme();
}
-
+
?>
diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php
index ca615205..66b23a7c 100644
--- a/windowsphonepush/windowsphonepush.php
+++ b/windowsphonepush/windowsphonepush.php
@@ -247,10 +247,10 @@ function send_tile_update($device_url, $image_url, $count, $title, $priority = 1
" " .
"";
- $result = send_push($device_url, array(
+ $result = send_push($device_url, [
'X-WindowsPhone-Target: token',
'X-NotificationClass: ' . $priority,
- ), $msg);
+ ], $msg);
return $result;
}
@@ -269,10 +269,10 @@ function send_toast($device_url, $title, $message, $priority = 2)
"" .
"";
- $result = send_push($device_url, array(
+ $result = send_push($device_url, [
'X-WindowsPhone-Target: toast',
'X-NotificationClass: ' . $priority,
- ), $msg);
+ ], $msg);
return $result;
}
@@ -284,11 +284,11 @@ function send_push($device_url, $headers, $msg)
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HEADER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers + array(
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers + [
'Content-Type: text/xml',
'charset=utf-8',
'Accept: application/*',
- )
+ ]
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $msg);
@@ -336,13 +336,13 @@ function windowsphonepush_content(App $a)
case "update_settings":
$ret = windowsphonepush_updatesettings($a);
header("Content-Type: application/json; charset=utf-8");
- echo json_encode(array('status' => $ret));
+ echo json_encode(['status' => $ret]);
killme();
break;
case "update_counterunseen":
$ret = windowsphonepush_updatecounterunseen();
header("Content-Type: application/json; charset=utf-8");
- echo json_encode(array('status' => $ret));
+ echo json_encode(['status' => $ret]);
killme();
break;
default:
@@ -374,13 +374,13 @@ function windowsphonepush_showsettings()
}
header("Content-Type: application/json");
- echo json_encode(array('uid' => local_user(),
+ echo json_encode(['uid' => local_user(),
'enable' => $enable,
'device_url' => $device_url,
'senditemtext' => $senditemtext,
'lastpushid' => $lastpushid,
'counterunseen' => $counterunseen,
- 'addonversion' => $addonversion));
+ 'addonversion' => $addonversion]);
}
/* update_settings is used to transfer the device_url from WP device to the Friendica server
diff --git a/wppost/wppost.php b/wppost/wppost.php
index 323fcef0..22032c90 100644
--- a/wppost/wppost.php
+++ b/wppost/wppost.php
@@ -233,7 +233,7 @@ function wppost_send(&$a,&$b) {
// Is it a link to an aricle, a video or a photo?
if (isset($siteinfo["type"])) {
- if (in_array($siteinfo["type"], array("link", "audio", "video", "photo"))) {
+ if (in_array($siteinfo["type"], ["link", "audio", "video", "photo"])) {
$postentry = true;
}
}
diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php
index d9335483..ba8c27c7 100644
--- a/xmpp/xmpp.php
+++ b/xmpp/xmpp.php
@@ -103,11 +103,11 @@ function xmpp_plugin_admin(App $a, &$o)
{
$t = get_markup_template("admin.tpl", "addon/xmpp/");
- $o = replace_macros($t, array(
+ $o = replace_macros($t, [
'$submit' => t('Save Settings'),
- '$bosh_proxy' => array('bosh_proxy', t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''),
- '$central_userbase' => array('central_userbase', t('Use central userbase'), Config::get('xmpp', 'central_userbase'), t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')),
- ));
+ '$bosh_proxy' => ['bosh_proxy', t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''],
+ '$central_userbase' => ['central_userbase', t('Use central userbase'), Config::get('xmpp', 'central_userbase'), t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')],
+ ]);
}
function xmpp_plugin_admin_post()
@@ -142,7 +142,7 @@ function xmpp_converse(App $a)
return;
}
- if (in_array($a->query_string, array("admin/federation/"))) {
+ if (in_array($a->query_string, ["admin/federation/"])) {
return;
}
@@ -176,7 +176,7 @@ function xmpp_converse(App $a)
return;
}
- if (in_array($a->argv[0], array("manage", "logout"))) {
+ if (in_array($a->argv[0], ["manage", "logout"])) {
$additional_commands = "converse.user.logout();\n";
} else {
$additional_commands = "";