*/
use Friendica\App;
-use Friendica\BaseObject;
use Friendica\Content\ContactSelector;
use Friendica\Content\Feature;
-use Friendica\Content\Item as ContentItem;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
-use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Profile;
while ($pos !== false && $cnt < 1000) {
$search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is';
- $replace = '[url=' . System::baseUrl() . '/redir/' . $cid
+ $replace = '[url=' . DI::baseUrl() . '/redir/' . $cid
. '?f=1&url=' . '$1' . '][!#saved_image' . '$2' .'#!][/url]';
$newbody .= substr($origbody, 0, $pos['start']['open']);
During the further steps of the database restructuring I would like to address this issue.
*/
- /** @var Activity $activity */
- $activity = BaseObject::getClass(Activity::class);
+ $activity = DI::activity();
$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
if ($activity->match($item['verb'], Activity::LIKE)
function visible_activity($item) {
- /** @var Activity $activity */
- $activity = BaseObject::getClass(Activity::class);
+ $activity = DI::activity();
- if ($activity->isHidden($item['verb'])) {
+ if (empty($item['verb']) || $activity->isHidden($item['verb'])) {
return false;
}
*/
$live_update_div = '<div id="live-network"></div>' . "\r\n"
. "<script> var profile_uid = " . $_SESSION['uid']
- . "; var netargs = '" . substr($a->cmd, 8)
+ . "; var netargs = '" . substr(DI::args()->getCommand(), 8)
. '?f='
. (!empty($_GET['cid']) ? '&cid=' . rawurlencode($_GET['cid']) : '')
. (!empty($_GET['search']) ? '&search=' . rawurlencode($_GET['search']) : '')
if (!$update) {
$live_update_div = '<div id="live-community"></div>' . "\r\n"
- . "<script> var profile_uid = -1; var netargs = '" . substr($a->cmd, 10)
+ . "<script> var profile_uid = -1; var netargs = '" . substr(DI::args()->getCommand(), 10)
."/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
}
} elseif ($mode === 'contacts') {
if (!$update) {
$live_update_div = '<div id="live-contacts"></div>' . "\r\n"
- . "<script> var profile_uid = -1; var netargs = '" . substr($a->cmd, 9)
+ . "<script> var profile_uid = -1; var netargs = '" . substr(DI::args()->getCommand(), 9)
."/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
}
} elseif ($mode === 'search') {
$page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
if (!$update) {
- $_SESSION['return_path'] = $a->query_string;
+ $_SESSION['return_path'] = DI::args()->getQueryString();
}
$cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview];
$body = Item::prepareBody($item, true, $preview);
- /** @var ContentItem $contItem */
- $contItem = BaseObject::getClass(ContentItem::class);
-
- list($categories, $folders) = $contItem->determineCategoriesTerms($item);
+ list($categories, $folders) = DI::contentItem()->determineCategoriesTerms($item);
if (!empty($item['content-warning']) && PConfig::get(local_user(), 'system', 'disable_cw', false)) {
$title = ucfirst($item['content-warning']);
'id' => ($preview ? 'P0' : $item['id']),
'guid' => ($preview ? 'Q0' : $item['guid']),
'network' => $item['network'],
- 'network_name' => ContactSelector::networkToName($item['network'], $item['author-link']),
+ 'network_name' => ContactSelector::networkToName($item['author-network'], $item['author-link'], $item['network']),
'network_icon' => ContactSelector::networkToIcon($item['network'], $item['author-link']),
'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
'profile_url' => $profile_link,
'name' => $profile_name,
'sparkle' => $sparkle,
'lock' => $lock,
- 'thumb' => System::removedBaseUrl(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
+ 'thumb' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
'title' => $title,
'body' => $body,
'tags' => $tags['tags'],
'indent' => '',
'owner_name' => $owner_name,
'owner_url' => $owner_url,
- 'owner_photo' => System::removedBaseUrl(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
+ 'owner_photo' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
'plink' => Item::getPlink($item),
'edpost' => false,
'isstarred' => $isstarred,
}
$o = Renderer::replaceMacros($page_template, [
- '$baseurl' => System::baseUrl($ssl_state),
- '$return_path' => $a->query_string,
+ '$baseurl' => DI::baseUrl()->get($ssl_state),
+ '$return_path' => DI::args()->getQueryString(),
'$live_update' => $live_update_div,
'$remove' => L10n::t('remove'),
'$mode' => $mode,
return;
}
- /** @var Activity $activity */
- $activity = BaseObject::getClass(Activity::class);
-
- if ($activity->match($item['verb'], $verb) && ($item['id'] != $item['parent'])) {
+ if (!empty($item['verb']) && DI::activity()->match($item['verb'], $verb) && ($item['id'] != $item['parent'])) {
$author = ['uid' => 0, 'id' => $item['author-id'],
'network' => $item['author-network'], 'url' => $item['author-link']];
$url = Contact::magicLinkByContact($author);
$geotag = !empty($x['allow_location']) ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : '';
$tpl = Renderer::getMarkupTemplate('jot-header.tpl');
- $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
+ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$newpost' => 'true',
- '$baseurl' => System::baseUrl(true),
+ '$baseurl' => DI::baseUrl()->get(true),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => L10n::t('Visible to <strong>everybody</strong>'),
$private_post = 0;
}
- $query_str = $a->query_string;
+ $query_str = DI::args()->getQueryString();
if (strpos($query_str, 'public=1') !== false) {
$query_str = str_replace(['?public=1', '&public=1'], ['', ''], $query_str);
}
'$posttype' => $notes_cid ? Item::PT_PERSONAL_NOTE : Item::PT_ARTICLE,
'$content' => $x['content'] ?? '',
'$post_id' => $x['post_id'] ?? '',
- '$baseurl' => System::baseUrl(true),
+ '$baseurl' => DI::baseUrl()->get(true),
'$defloc' => $x['default_location'],
'$visitor' => $x['visitor'],
'$pvisit' => $notes_cid ? 'none' : $x['visitor'],
$parents[$i]['children'] = sort_item_children($parents[$i]['children']);
}
- if (PConfig::get(local_user(), 'system', 'smart_threading', 0)) {
+ if (!PConfig::get(local_user(), 'system', 'no_smart_threading', 0)) {
foreach ($parents as $i => $parent) {
$parents[$i] = smart_flatten_conversation($parent);
}