Move PConfig::get() to DI::pConfig()->get()

This commit is contained in:
nupplaPhil 2020-01-18 16:50:57 +01:00
parent 6e2880c679
commit 9e9429b56d
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
61 changed files with 190 additions and 179 deletions

View file

@ -379,7 +379,7 @@ class Event
public static function getStrings()
{
// First day of the week (0 = Sunday).
$firstDay = PConfig::get(local_user(), 'system', 'first_day_of_week', 0);
$firstDay = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
$i18n = [
"firstDay" => $firstDay,

View file

@ -8,6 +8,7 @@ namespace Friendica\Model;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Database\DBA;
use Friendica\DI;
/**
* @brief This class handles FileTag related functions
@ -174,7 +175,7 @@ class FileTag
return true;
}
$saved = PConfig::get($uid, 'system', 'filetags');
$saved = DI::pConfig()->get($uid, 'system', 'filetags');
if (strlen($saved)) {
if ($type == 'file') {
@ -256,7 +257,7 @@ class FileTag
Item::update($fields, ['id' => $item_id]);
}
$saved = PConfig::get($uid, 'system', 'filetags');
$saved = DI::pConfig()->get($uid, 'system', 'filetags');
if (!strlen($saved) || !stristr($saved, '[' . self::encode($file) . ']')) {
PConfig::set($uid, 'system', 'filetags', $saved . '[' . self::encode($file) . ']');
@ -311,7 +312,7 @@ class FileTag
);
if (!DBA::isResult($r)) {
$saved = PConfig::get($uid, 'system', 'filetags');
$saved = DI::pConfig()->get($uid, 'system', 'filetags');
PConfig::set($uid, 'system', 'filetags', str_replace($pattern, '', $saved));
}

View file

@ -3026,7 +3026,7 @@ class Item
* $expire_network_only = save your own wall posts
* and just expire conversations started by others
*/
$expire_network_only = PConfig::get($uid, 'expire', 'network_only', false);
$expire_network_only = DI::pConfig()->get($uid, 'expire', 'network_only', false);
if ($expire_network_only) {
$condition[0] .= " AND NOT `wall`";
@ -3046,16 +3046,16 @@ class Item
return;
}
$expire_items = PConfig::get($uid, 'expire', 'items', true);
$expire_items = DI::pConfig()->get($uid, 'expire', 'items', true);
// Forcing expiring of items - but not notes and marked items
if ($force) {
$expire_items = true;
}
$expire_notes = PConfig::get($uid, 'expire', 'notes', true);
$expire_starred = PConfig::get($uid, 'expire', 'starred', true);
$expire_photos = PConfig::get($uid, 'expire', 'photos', false);
$expire_notes = DI::pConfig()->get($uid, 'expire', 'notes', true);
$expire_starred = DI::pConfig()->get($uid, 'expire', 'starred', true);
$expire_photos = DI::pConfig()->get($uid, 'expire', 'photos', false);
$expired = 0;
@ -3525,7 +3525,7 @@ class Item
// Compile eventual content filter reasons
$filter_reasons = [];
if (!$is_preview && public_contact() != $item['author-id']) {
if (!empty($item['content-warning']) && (!local_user() || !PConfig::get(local_user(), 'system', 'disable_cw', false))) {
if (!empty($item['content-warning']) && (!local_user() || !DI::pConfig()->get(local_user(), 'system', 'disable_cw', false))) {
$filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']);
}

View file

@ -9,6 +9,7 @@ namespace Friendica\Model;
use Friendica\Content\Text;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\DI;
class ItemContent
{
@ -158,7 +159,7 @@ class ItemContent
$post['url'] = $item['plink'];
} elseif (strpos($item['body'], '[share') !== false) {
$post['url'] = $item['plink'];
} elseif (PConfig::get($item['uid'], 'system', 'no_intelligent_shortening')) {
} elseif (DI::pConfig()->get($item['uid'], 'system', 'no_intelligent_shortening')) {
$post['url'] = $item['plink'];
}
$msg = Text\Plaintext::shorten($msg, $limit);

View file

@ -184,12 +184,12 @@ class Profile
$a->profile = $pdata;
$a->profile_uid = $pdata['profile_uid'];
$a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme');
$a->profile['mobile-theme'] = DI::pConfig()->get($a->profile['profile_uid'], 'system', 'mobile_theme');
$a->profile['network'] = Protocol::DFRN;
DI::page()['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename');
if (!$profiledata && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
if (!$profiledata && !DI::pConfig()->get(local_user(), 'system', 'always_my_theme')) {
$a->setCurrentTheme($a->profile['theme']);
$a->setCurrentMobileTheme($a->profile['mobile-theme']);
}
@ -1218,7 +1218,7 @@ class Profile
public static function getThemeUid(App $a)
{
$uid = !empty($a->profile_uid) ? intval($a->profile_uid) : 0;
if (local_user() && (PConfig::get(local_user(), 'system', 'always_my_theme') || !$uid)) {
if (local_user() && (DI::pConfig()->get(local_user(), 'system', 'always_my_theme') || !$uid)) {
return local_user();
}

View file

@ -275,7 +275,7 @@ class User
$default_group = 0;
if ($network == Protocol::OSTATUS) {
$default_group = PConfig::get($uid, "ostatus", "default_group");
$default_group = DI::pConfig()->get($uid, "ostatus", "default_group");
}
if ($default_group != 0) {
@ -326,7 +326,7 @@ class User
{
$user = self::getAuthenticationInfo($user_info);
if ($third_party && PConfig::get($user['uid'], '2fa', 'verified')) {
if ($third_party && DI::pConfig()->get($user['uid'], '2fa', 'verified')) {
// Third-party apps can't verify two-factor authentication, we use app-specific passwords instead
if (AppSpecificPassword::authenticateUser($user['uid'], $password)) {
return $user['uid'];