mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-11 01:24:27 +02:00
Replace BaseObject class with DI::* calls
This commit is contained in:
parent
1de3f186d7
commit
388b963714
98 changed files with 321 additions and 440 deletions
|
@ -7,12 +7,10 @@
|
|||
*/
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\App\Authentication;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
|
@ -23,11 +21,11 @@ use Friendica\Core\Session;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Model\Notify;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
|
@ -254,9 +252,7 @@ function api_login(App $a)
|
|||
throw new UnauthorizedException("This API requires login");
|
||||
}
|
||||
|
||||
/** @var Authentication $authentication */
|
||||
$authentication = BaseObject::getClass(Authentication::class);
|
||||
$authentication->setForUser($a, $record);
|
||||
DI::auth()->setForUser($a, $record);
|
||||
|
||||
$_SESSION["allow_api"] = true;
|
||||
|
||||
|
@ -5909,10 +5905,7 @@ function api_friendica_notification($type)
|
|||
if ($a->argc!==3) {
|
||||
throw new BadRequestException("Invalid argument count");
|
||||
}
|
||||
/** @var Notify $nm */
|
||||
$nm = BaseObject::getClass(Notify::class);
|
||||
|
||||
$notes = $nm->getAll([], ['seen' => 'ASC', 'date' => 'DESC'], 50);
|
||||
$notes = DI::notify()->getAll([], ['seen' => 'ASC', 'date' => 'DESC'], 50);
|
||||
|
||||
if ($type == "xml") {
|
||||
$xmlnotes = [];
|
||||
|
@ -5954,8 +5947,7 @@ function api_friendica_notification_seen($type)
|
|||
|
||||
$id = (!empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0);
|
||||
|
||||
/** @var Notify $nm */
|
||||
$nm = BaseObject::getClass(Notify::class);
|
||||
$nm = DI::notify();
|
||||
$note = $nm->getByID($id);
|
||||
if (is_null($note)) {
|
||||
throw new BadRequestException("Invalid argument");
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
*/
|
||||
|
||||
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;
|
||||
|
@ -20,6 +18,7 @@ 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;
|
||||
|
@ -141,8 +140,7 @@ function localize_item(&$item)
|
|||
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)
|
||||
|
@ -399,8 +397,7 @@ function count_descendants($item) {
|
|||
|
||||
function visible_activity($item) {
|
||||
|
||||
/** @var Activity $activity */
|
||||
$activity = BaseObject::getClass(Activity::class);
|
||||
$activity = DI::activity();
|
||||
|
||||
if (empty($item['verb']) || $activity->isHidden($item['verb'])) {
|
||||
return false;
|
||||
|
@ -668,10 +665,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
|
|||
|
||||
$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']);
|
||||
|
@ -1031,10 +1025,7 @@ function builtin_activity_puller($item, &$conv_responses) {
|
|||
return;
|
||||
}
|
||||
|
||||
/** @var Activity $activity */
|
||||
$activity = BaseObject::getClass(Activity::class);
|
||||
|
||||
if (!empty($item['verb']) && $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);
|
||||
|
|
|
@ -3,13 +3,10 @@
|
|||
* @file include/items.php
|
||||
*/
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\System;
|
||||
|
@ -19,11 +16,9 @@ use Friendica\Model\Item;
|
|||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\Feed;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once __DIR__ . '/../mod/share.php';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue