]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Uncommon logger levels in Friendica (#5453)
[friendica.git] / include / items.php
index ee514c8fc414c37e2f86c1fd21ac3ceab0080297..69472e96f6a9d93984753795e59747c1776fb480 100644 (file)
@@ -9,6 +9,7 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
+use Friendica\Database\DBA;
 use Friendica\Database\DBM;
 use Friendica\Model\Item;
 use Friendica\Protocol\DFRN;
@@ -33,6 +34,8 @@ function add_page_info_data($data, $no_photos = false) {
                $data["type"] = "link";
        }
 
+       $data["title"] = defaults($data, "title", "");
+
        if ((($data["type"] != "link") && ($data["type"] != "video") && ($data["type"] != "photo")) || ($data["title"] == $data["url"])) {
                return "";
        }
@@ -47,19 +50,19 @@ function add_page_info_data($data, $no_photos = false) {
 
        $text = "[attachment type='".$data["type"]."'";
 
-       if ($data["text"] == "") {
+       if (empty($data["text"])) {
                $data["text"] = $data["title"];
        }
 
-       if ($data["text"] == "") {
+       if (empty($data["text"])) {
                $data["text"] = $data["url"];
        }
 
-       if ($data["url"] != "") {
+       if (!empty($data["url"])) {
                $text .= " url='".$data["url"]."'";
        }
 
-       if ($data["title"] != "") {
+       if (!empty($data["title"])) {
                $text .= " title='".$data["title"]."'";
        }
 
@@ -301,7 +304,7 @@ function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') {
        logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: '  . $push_url . ' with verifier ' . $verify_token);
 
        if (!strlen($contact['hub-verify']) || ($contact['hub-verify'] != $verify_token)) {
-               dba::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
+               DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
        }
 
        Network::post($url, $params);
@@ -427,9 +430,11 @@ function list_post_dates($uid, $wall) {
                $start_month = DateTimeFormat::utc($dstart, 'Y-m-d');
                $end_month = DateTimeFormat::utc($dend, 'Y-m-d');
                $str = day_translate(DateTimeFormat::utc($dnow, 'F'));
-               if (!$ret[$dyear]) {
+
+               if (empty($ret[$dyear])) {
                        $ret[$dyear] = [];
                }
+
                $ret[$dyear][] = [$str, $end_month, $start_month];
                $dnow = DateTimeFormat::utc($dnow . ' -1 month', 'Y-m-d');
        }