mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-09 18:08:49 +00:00
Use short form array syntax everywhere
This commit is contained in:
parent
4ee41c64a3
commit
27b60e003f
68 changed files with 869 additions and 869 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue