Continued:

- x() is deprecated, use proper isset()/empty() (MrPetovan)

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2018-05-10 23:06:25 +02:00
parent d05a92370a
commit 3a9a5fcde8
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
4 changed files with 14 additions and 9 deletions

View file

@ -26,8 +26,9 @@ function geocoordinates_uninstall()
function geocoordinates_resolve_item(&$item) function geocoordinates_resolve_item(&$item)
{ {
if((!x($item, 'coord')) || (x($item, 'location'))) if (!isset($item['coord']) || isset($item['location'])) {
return; return;
}
$key = Config::get("geocoordinates", "api_key"); $key = Config::get("geocoordinates", "api_key");

View file

@ -32,13 +32,13 @@ function googlemaps_location(App $a, array &$item)
return; return;
} }
if (x($item, 'coord')) { if (isset($item['coord']) {
$target = "http://maps.google.com/?q=".urlencode($item['coord']); $target = "http://maps.google.com/?q=".urlencode($item['coord']);
} else { } else {
$target = "http://maps.google.com/?q=".urlencode($item['location']); $target = "http://maps.google.com/?q=".urlencode($item['location']);
} }
if (x($item, 'location')) { if (isset($item['location'])) {
$title = $item['location']; $title = $item['location'];
} else { } else {
$title = $item['coord']; $title = $item['coord'];

View file

@ -104,7 +104,7 @@ function mailstream_post_hook(App $a, array &$item) {
return; return;
} }
if (!x($item, 'uid') || !x($item, 'contact-id') || !x($item, 'uri')) { if (!isset($item['uid']) || !isset($item['contact-id']) || !isset($item['uri'])) {
return; return;
} }
@ -223,9 +223,10 @@ function mailstream_decode_subject($subject) {
} }
function mailstream_subject(array $item) { function mailstream_subject(array $item) {
if (x($item, 'title')) { if (isset($item['title'])) {
return mailstream_decode_subject($item['title']); return mailstream_decode_subject($item['title']);
} }
$parent = $item['thr-parent']; $parent = $item['thr-parent'];
// Don't look more than 100 levels deep for a subject, in case of loops // Don't look more than 100 levels deep for a subject, in case of loops
for ($i = 0; ($i < 100) && $parent; $i++) { for ($i = 0; ($i < 100) && $parent; $i++) {
@ -267,13 +268,16 @@ function mailstream_subject(array $item) {
} }
function mailstream_send(App $a, $message_id, array $item, $user) { function mailstream_send(App $a, $message_id, array $item, $user) {
if (!x($item, 'visible')) { if (!isset($item['visible'])) {
return; return;
} }
if (!$message_id) { if (!$message_id) {
return; return;
} }
require_once(dirname(__file__).'/phpmailer/class.phpmailer.php');
// @TODO Isn't there a better way?
require_once dirname(__FILE__) . '/phpmailer/class.phpmailer.php';
$attachments = []; $attachments = [];
mailstream_do_images($a, $item, $attachments); mailstream_do_images($a, $item, $attachments);

View file

@ -90,7 +90,7 @@ function openstreetmap_location($a, &$item)
$nomserver = OSM_NOM; $nomserver = OSM_NOM;
} }
if (x($item, 'coord')) { if (isset($item['coord'])) {
$coords = explode(' ', $item['coord']); $coords = explode(' ', $item['coord']);
if (count($coords) > 1) { if (count($coords) > 1) {
$lat = urlencode(round($coords[0], 5)); $lat = urlencode(round($coords[0], 5));
@ -107,7 +107,7 @@ function openstreetmap_location($a, &$item)
$target = $nomserver.'?q='.urlencode($item['location']); $target = $nomserver.'?q='.urlencode($item['location']);
} }
if (x($item, 'location')) { if (isset($item['location'])) {
$title = $item['location']; $title = $item['location'];
} else { } else {
$title = $item['coord']; $title = $item['coord'];