diff --git a/include/bbcode.php b/include/bbcode.php
index 30d0165770..ef7053010d 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -435,60 +435,67 @@ function bb_replace_images($body, $images) {
return $newbody;
}
-function bb_ShareAttributes($share, $simplehtml) {
+function bb_ShareAttributes($share, $simplehtml)
+{
$attributes = $share[2];
$author = "";
preg_match("/author='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "")
- $author = html_entity_decode($matches[1],ENT_QUOTES,'UTF-8');
+ if (x($matches, 1)) {
+ $author = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8');
+ }
preg_match('/author="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$author = $matches[1];
+ }
$profile = "";
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$profile = $matches[1];
+ }
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$profile = $matches[1];
+ }
$avatar = "";
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$avatar = $matches[1];
+ }
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$avatar = $matches[1];
+ }
$link = "";
preg_match("/link='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$link = $matches[1];
+ }
preg_match('/link="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$link = $matches[1];
+ }
$posted = "";
$itemcache = get_itemcachepath();
preg_match("/posted='(.*?)'/ism", $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$posted = $matches[1];
+ }
preg_match('/posted="(.*?)"/ism', $attributes, $matches);
- if ($matches[1] != "")
+ if (x($matches, 1)) {
$posted = $matches[1];
-
- // relative dates only make sense when they aren't cached
- if ($itemcache == "")
- $reldate = (($posted) ? " " . relative_date($posted) : '');
+ }
// We only call this so that a previously unknown contact can be added.
// This is important for the function "get_contact_details_by_url".
@@ -497,99 +504,107 @@ function bb_ShareAttributes($share, $simplehtml) {
$data = Contact::getDetailsByURL($profile);
- if (isset($data["name"]) && ($data["name"] != "") && isset($data["addr"]) && ($data["addr"] != ""))
- $userid_compact = $data["name"]." (".$data["addr"].")";
- else
- $userid_compact = GetProfileUsername($profile,$author, true);
+ if (x($data, "name") && x($data, "addr")) {
+ $userid_compact = $data["name"] . " (" . $data["addr"] . ")";
+ } else {
+ $userid_compact = GetProfileUsername($profile, $author, true);
+ }
- if (isset($data["addr"]) && ($data["addr"] != ""))
+ if (x($data, "addr")) {
$userid = $data["addr"];
- else
- $userid = GetProfileUsername($profile,$author, false);
+ } else {
+ $userid = GetProfileUsername($profile, $author, false);
+ }
- if (isset($data["name"]) && ($data["name"] != ""))
+ if (x($data, "name")) {
$author = $data["name"];
+ }
- if (isset($data["micro"]) && ($data["micro"] != ""))
+ if (x($data, "micro")) {
$avatar = $data["micro"];
+ }
$preshare = trim($share[1]);
- if ($preshare != "")
+ if ($preshare != "") {
$preshare .= "
";
+ }
switch ($simplehtml) {
case 1:
- $text = $preshare.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' '.$userid.":
»".$share[3]."«";
+ $text = $preshare . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' ' . $userid . ":
»" . $share[3] . "«";
break;
case 2:
- $text = $preshare.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').' '.$userid_compact.":
".$share[3];
+ $text = $preshare . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' ' . $userid_compact . ":
" . $share[3];
break;
case 3: // Diaspora
- $headline .= ''.html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').$userid.':
';
+ $headline .= '' . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . $userid . ':
';
$text = trim($share[1]);
- if ($text != "")
+ if ($text != "") {
$text .= "
'.trim($share[3])."
' . trim($share[3]) . "
'.trim($share[3])."
' . trim($share[3]) . "