namespace Friendica\Core;
use Friendica\BaseObject;
+use Friendica\Content\Text\BBCode;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
-use Friendica\Util\Network;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Temporal;
+use Friendica\Util\XML;
require_once 'include/dba.php';
require_once 'include/html2plain.php';
-require_once 'include/datetime.php';
-require_once 'include/bbcode.php';
/**
* @brief Methods for read and write notifications from/to database
{
$rets = [];
foreach ($notes as $n) {
- $local_time = datetime_convert('UTC', date_default_timezone_get(), $n['date']);
+ $local_time = DateTimeFormat::local($n['date']);
$n['timestamp'] = strtotime($local_time);
- $n['date_rel'] = relative_date($n['date']);
- $n['msg_html'] = bbcode($n['msg'], false, false, false, false);
- $n['msg_plain'] = explode("\n", trim(html2plain($n['msg_html'], 0)))[0];
+ $n['date_rel'] = Temporal::getRelativeDate($n['date']);
+ $n['msg_html'] = BBCode::convert($n['msg'], false);
+ $n['msg_plain'] = explode("\n", trim(Friendica\Content\Text\HTML::toPlaintext($n['msg_html'], 0)))[0];
$rets[] = $n;
}
$default_item_link = System::baseUrl(true) . '/notify/view/' . $it['id'];
$default_item_image = proxy_url($it['photo'], false, PROXY_SIZE_MICRO);
$default_item_url = $it['url'];
- $default_item_text = strip_tags(bbcode($it['msg']));
- $default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['date'], 'r');
- $default_item_ago = relative_date($it['date']);
+ $default_item_text = strip_tags(BBCode::convert($it['msg']));
+ $default_item_when = DateTimeFormat::local($it['date'], 'r');
+ $default_item_ago = Temporal::getRelativeDate($it['date']);
break;
case 'home':
$default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO);
$default_item_url = $it['author-link'];
$default_item_text = L10n::t("%s commented on %s's post", $it['author-name'], $it['pname']);
- $default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['created'], 'r');
- $default_item_ago = relative_date($it['created']);
+ $default_item_when = DateTimeFormat::local($it['created'], 'r');
+ $default_item_ago = Temporal::getRelativeDate($it['created']);
break;
default:
$default_item_text = (($it['id'] == $it['parent'])
? L10n::t("%s created a new post", $it['author-name'])
: L10n::t("%s commented on %s's post", $it['author-name'], $it['pname']));
- $default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['created'], 'r');
- $default_item_ago = relative_date($it['created']);
+ $default_item_when = DateTimeFormat::local($it['created'], 'r');
+ $default_item_ago = Temporal::getRelativeDate($it['created']);
}
// Transform the different types of notification in an usable array
case ACTIVITY_FRIEND:
$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
- $obj = Network::parseXmlString($xmlhead . $it['object']);
+ $obj = XML::parseString($xmlhead . $it['object']);
$it['fname'] = $obj->title;
$notif = [
'contact_id' => $it['contact-id'],
'photo' => ((x($it, 'photo')) ? proxy_url($it['photo'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"),
'name' => $it['name'],
- 'location' => bbcode($it['glocation'], false, false),
- 'about' => bbcode($it['gabout'], false, false),
+ 'location' => BBCode::convert($it['glocation'], false),
+ 'about' => BBCode::convert($it['gabout'], false),
'keywords' => $it['gkeywords'],
'gender' => $it['ggender'],
'hidden' => $it['hidden'] == 1,