Move PConfig::get() to DI::pConfig()->get()
This commit is contained in:
parent
6e2880c679
commit
9e9429b56d
61 changed files with 190 additions and 179 deletions
|
@ -138,9 +138,9 @@ function community_content(App $a, $update = 0)
|
|||
|
||||
// check if we serve a mobile device and get the user settings accordingly
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 20);
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', 20);
|
||||
} else {
|
||||
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 40);
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network', 40);
|
||||
}
|
||||
|
||||
// now that we have the user settings, see if the theme forces
|
||||
|
|
|
@ -70,7 +70,7 @@ function network_init(App $a)
|
|||
$sel_nets = $_GET['nets'] ?? '';
|
||||
$sel_tabs = network_query_get_sel_tab($a);
|
||||
$sel_groups = network_query_get_sel_group($a);
|
||||
$last_sel_tabs = PConfig::get(local_user(), 'network.view', 'tab.selected');
|
||||
$last_sel_tabs = DI::pConfig()->get(local_user(), 'network.view', 'tab.selected');
|
||||
|
||||
$remember_tab = ($sel_tabs[0] === 'active' && is_array($last_sel_tabs) && $last_sel_tabs[0] !== 'active');
|
||||
|
||||
|
@ -219,10 +219,10 @@ function networkPager(App $a, Pager $pager, $update)
|
|||
// check if we serve a mobile device and get the user settings
|
||||
// accordingly
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network');
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network');
|
||||
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
|
||||
} else {
|
||||
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network');
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network');
|
||||
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40);
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ function networkConversation(App $a, $items, Pager $pager, $mode, $update, $orde
|
|||
$o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user());
|
||||
|
||||
if (!$update) {
|
||||
if (PConfig::get(local_user(), 'system', 'infinite_scroll')) {
|
||||
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
|
||||
$o .= HTML::scrollLoader();
|
||||
} else {
|
||||
$o .= $pager->renderMinimal(count($items));
|
||||
|
@ -491,7 +491,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
$tabs = network_tabs($a);
|
||||
$o .= $tabs;
|
||||
|
||||
if ($gid && ($t = Contact::getOStatusCountByGroupId($gid)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) {
|
||||
if ($gid && ($t = Contact::getOStatusCountByGroupId($gid)) && !DI::pConfig()->get(local_user(), 'system', 'nowarn_insecure')) {
|
||||
notice(L10n::tt("Warning: This group contains %s member from a network that doesn't allow non public messages.",
|
||||
"Warning: This group contains %s members from a network that doesn't allow non public messages.",
|
||||
$t) . EOL);
|
||||
|
@ -612,7 +612,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
'id' => 'network',
|
||||
]) . $o;
|
||||
|
||||
if ($contact['network'] === Protocol::OSTATUS && $contact['writable'] && !PConfig::get(local_user(),'system','nowarn_insecure')) {
|
||||
if ($contact['network'] === Protocol::OSTATUS && $contact['writable'] && !DI::pConfig()->get(local_user(),'system','nowarn_insecure')) {
|
||||
notice(L10n::t('Private messages to this person are at risk of public disclosure.') . EOL);
|
||||
}
|
||||
} else {
|
||||
|
@ -770,7 +770,7 @@ function networkThreadedView(App $a, $update, $parent)
|
|||
|
||||
// When checking for updates we need to fetch from the newest date to the newest date before
|
||||
// Only do this, when the last stored date isn't too long ago (10 times the update interval)
|
||||
$browser_update = PConfig::get(local_user(), 'system', 'update_interval', 40000) / 1000;
|
||||
$browser_update = DI::pConfig()->get(local_user(), 'system', 'update_interval', 40000) / 1000;
|
||||
|
||||
if (($browser_update > 0) && $update && !empty($_SESSION['network_last_date']) &&
|
||||
(($bottom_limit < $_SESSION['network_last_date']) || ($top_limit == $bottom_limit)) &&
|
||||
|
@ -994,7 +994,7 @@ function network_infinite_scroll_head(App $a, &$htmlhead)
|
|||
*/
|
||||
global $pager;
|
||||
|
||||
if (PConfig::get(local_user(), 'system', 'infinite_scroll')
|
||||
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')
|
||||
&& ($_GET['mode'] ?? '') != 'minimal'
|
||||
) {
|
||||
$tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
|
||||
|
|
|
@ -26,7 +26,7 @@ function ostatus_subscribe_content(App $a)
|
|||
|
||||
$counter = intval($_REQUEST['counter']);
|
||||
|
||||
if (PConfig::get($uid, 'ostatus', 'legacy_friends') == '') {
|
||||
if (DI::pConfig()->get($uid, 'ostatus', 'legacy_friends') == '') {
|
||||
|
||||
if ($_REQUEST['url'] == '') {
|
||||
PConfig::delete($uid, 'ostatus', 'legacy_contact');
|
||||
|
@ -53,7 +53,7 @@ function ostatus_subscribe_content(App $a)
|
|||
PConfig::set($uid, 'ostatus', 'legacy_friends', $curlResult->getBody());
|
||||
}
|
||||
|
||||
$friends = json_decode(PConfig::get($uid, 'ostatus', 'legacy_friends'));
|
||||
$friends = json_decode(DI::pConfig()->get($uid, 'ostatus', 'legacy_friends'));
|
||||
|
||||
if (empty($friends)) {
|
||||
$friends = [];
|
||||
|
|
|
@ -453,7 +453,7 @@ function ping_get_notifications($uid)
|
|||
&& empty($result[$notification["parent"]])
|
||||
) {
|
||||
// Should we condense the notifications or show them all?
|
||||
if (PConfig::get(local_user(), 'system', 'detailed_notif')) {
|
||||
if (DI::pConfig()->get(local_user(), 'system', 'detailed_notif')) {
|
||||
$result[$notification["id"]] = $notification;
|
||||
} else {
|
||||
$result[$notification["parent"]] = $notification;
|
||||
|
|
|
@ -535,7 +535,7 @@ function profiles_content(App $a) {
|
|||
$personal_account = !(in_array($a->user["page-flags"],
|
||||
[User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]));
|
||||
|
||||
$detailed_profile = (PConfig::get(local_user(), 'system', 'detailled_profile') AND $personal_account);
|
||||
$detailed_profile = (DI::pConfig()->get(local_user(), 'system', 'detailled_profile') AND $personal_account);
|
||||
|
||||
$is_default = (($r[0]['is-default']) ? 1 : 0);
|
||||
$tpl = Renderer::getMarkupTemplate("profile_edit.tpl");
|
||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Core\PConfig;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Content\Text\HTML;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Profile;
|
||||
|
||||
function profperm_init(App $a)
|
||||
|
@ -41,7 +42,7 @@ function profperm_content(App $a) {
|
|||
|
||||
// Switch to text mod interface if we have more than 'n' contacts or group members
|
||||
|
||||
$switchtotext = PConfig::get(local_user(),'system','groupedit_image_limit');
|
||||
$switchtotext = DI::pConfig()->get(local_user(),'system','groupedit_image_limit');
|
||||
if (is_null($switchtotext)) {
|
||||
$switchtotext = Config::get('system','groupedit_image_limit', 400);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\Logger;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\ActivityNamespace;
|
||||
use Friendica\Protocol\OStatus;
|
||||
|
@ -158,7 +159,7 @@ function salmon_post(App $a, $xml = '') {
|
|||
if (!DBA::isResult($r)) {
|
||||
Logger::log('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.');
|
||||
|
||||
if (PConfig::get($importer['uid'], 'system', 'ostatus_autofriend')) {
|
||||
if (DI::pConfig()->get($importer['uid'], 'system', 'ostatus_autofriend')) {
|
||||
$result = Contact::createFromProbe($importer['uid'], $author_link);
|
||||
|
||||
if ($result['success']) {
|
||||
|
|
|
@ -776,13 +776,13 @@ function settings_content(App $a)
|
|||
}
|
||||
|
||||
if (($a->argc > 1) && ($a->argv[1] === 'connectors')) {
|
||||
$accept_only_sharer = intval(PConfig::get(local_user(), 'system', 'accept_only_sharer'));
|
||||
$disable_cw = intval(PConfig::get(local_user(), 'system', 'disable_cw'));
|
||||
$no_intelligent_shortening = intval(PConfig::get(local_user(), 'system', 'no_intelligent_shortening'));
|
||||
$attach_link_title = intval(PConfig::get(local_user(), 'system', 'attach_link_title'));
|
||||
$ostatus_autofriend = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend'));
|
||||
$default_group = PConfig::get(local_user(), 'ostatus', 'default_group');
|
||||
$legacy_contact = PConfig::get(local_user(), 'ostatus', 'legacy_contact');
|
||||
$accept_only_sharer = intval(DI::pConfig()->get(local_user(), 'system', 'accept_only_sharer'));
|
||||
$disable_cw = intval(DI::pConfig()->get(local_user(), 'system', 'disable_cw'));
|
||||
$no_intelligent_shortening = intval(DI::pConfig()->get(local_user(), 'system', 'no_intelligent_shortening'));
|
||||
$attach_link_title = intval(DI::pConfig()->get(local_user(), 'system', 'attach_link_title'));
|
||||
$ostatus_autofriend = intval(DI::pConfig()->get(local_user(), 'system', 'ostatus_autofriend'));
|
||||
$default_group = DI::pConfig()->get(local_user(), 'ostatus', 'default_group');
|
||||
$legacy_contact = DI::pConfig()->get(local_user(), 'ostatus', 'legacy_contact');
|
||||
|
||||
if (!empty($legacy_contact)) {
|
||||
/// @todo Isn't it supposed to be a $a->internalRedirect() call?
|
||||
|
@ -915,27 +915,27 @@ function settings_content(App $a)
|
|||
$theme_selected = $a->user['theme'] ?: $default_theme;
|
||||
$mobile_theme_selected = Session::get('mobile-theme', $default_mobile_theme);
|
||||
|
||||
$nowarn_insecure = intval(PConfig::get(local_user(), 'system', 'nowarn_insecure'));
|
||||
$nowarn_insecure = intval(DI::pConfig()->get(local_user(), 'system', 'nowarn_insecure'));
|
||||
|
||||
$browser_update = intval(PConfig::get(local_user(), 'system', 'update_interval'));
|
||||
$browser_update = intval(DI::pConfig()->get(local_user(), 'system', 'update_interval'));
|
||||
if (intval($browser_update) != -1) {
|
||||
$browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds
|
||||
}
|
||||
|
||||
$itemspage_network = intval(PConfig::get(local_user(), 'system', 'itemspage_network'));
|
||||
$itemspage_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_network'));
|
||||
$itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items
|
||||
$itemspage_mobile_network = intval(PConfig::get(local_user(), 'system', 'itemspage_mobile_network'));
|
||||
$itemspage_mobile_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network'));
|
||||
$itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items
|
||||
|
||||
$nosmile = PConfig::get(local_user(), 'system', 'no_smilies', 0);
|
||||
$first_day_of_week = PConfig::get(local_user(), 'system', 'first_day_of_week', 0);
|
||||
$nosmile = DI::pConfig()->get(local_user(), 'system', 'no_smilies', 0);
|
||||
$first_day_of_week = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
|
||||
$weekdays = [0 => L10n::t("Sunday"), 1 => L10n::t("Monday")];
|
||||
|
||||
$noinfo = PConfig::get(local_user(), 'system', 'ignore_info', 0);
|
||||
$infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0);
|
||||
$no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update', 0);
|
||||
$bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver', 0);
|
||||
$no_smart_threading = PConfig::get(local_user(), 'system', 'no_smart_threading', 0);
|
||||
$noinfo = DI::pConfig()->get(local_user(), 'system', 'ignore_info', 0);
|
||||
$infinite_scroll = DI::pConfig()->get(local_user(), 'system', 'infinite_scroll', 0);
|
||||
$no_auto_update = DI::pConfig()->get(local_user(), 'system', 'no_auto_update', 0);
|
||||
$bandwidth_saver = DI::pConfig()->get(local_user(), 'system', 'bandwidth_saver', 0);
|
||||
$no_smart_threading = DI::pConfig()->get(local_user(), 'system', 'no_smart_threading', 0);
|
||||
|
||||
$theme_config = "";
|
||||
if (($themeconfigfile = get_theme_config_file($theme_selected)) !== null) {
|
||||
|
@ -1000,12 +1000,12 @@ function settings_content(App $a)
|
|||
$unkmail = $a->user['unkmail'];
|
||||
$cntunkmail = $a->user['cntunkmail'];
|
||||
|
||||
$expire_items = PConfig::get(local_user(), 'expire', 'items', true);
|
||||
$expire_notes = PConfig::get(local_user(), 'expire', 'notes', true);
|
||||
$expire_starred = PConfig::get(local_user(), 'expire', 'starred', true);
|
||||
$expire_photos = PConfig::get(local_user(), 'expire', 'photos', false);
|
||||
$expire_network_only = PConfig::get(local_user(), 'expire', 'network_only', false);
|
||||
$suggestme = PConfig::get(local_user(), 'system', 'suggestme', false);
|
||||
$expire_items = DI::pConfig()->get(local_user(), 'expire', 'items', true);
|
||||
$expire_notes = DI::pConfig()->get(local_user(), 'expire', 'notes', true);
|
||||
$expire_starred = DI::pConfig()->get(local_user(), 'expire', 'starred', true);
|
||||
$expire_photos = DI::pConfig()->get(local_user(), 'expire', 'photos', false);
|
||||
$expire_network_only = DI::pConfig()->get(local_user(), 'expire', 'network_only', false);
|
||||
$suggestme = DI::pConfig()->get(local_user(), 'system', 'suggestme', false);
|
||||
|
||||
// nowarn_insecure
|
||||
|
||||
|
@ -1244,11 +1244,11 @@ function settings_content(App $a)
|
|||
'$desktop_notifications' => ['desktop_notifications', L10n::t('Activate desktop notifications') , false, L10n::t('Show desktop popup on new notifications')],
|
||||
|
||||
'$email_textonly' => ['email_textonly', L10n::t('Text-only notification emails'),
|
||||
PConfig::get(local_user(), 'system', 'email_textonly'),
|
||||
DI::pConfig()->get(local_user(), 'system', 'email_textonly'),
|
||||
L10n::t('Send text only notification emails, without the html part')],
|
||||
|
||||
'$detailed_notif' => ['detailed_notif', L10n::t('Show detailled notifications'),
|
||||
PConfig::get(local_user(), 'system', 'detailed_notif'),
|
||||
DI::pConfig()->get(local_user(), 'system', 'detailed_notif'),
|
||||
L10n::t('Per default, notifications are condensed to a single notification per item. When enabled every notification is displayed.')],
|
||||
|
||||
'$h_advn' => L10n::t('Advanced Account/Page Type Settings'),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once 'mod/community.php';
|
||||
|
||||
|
@ -19,7 +19,7 @@ function update_community_content(App $a) {
|
|||
$text = '';
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Contact;
|
||||
|
||||
function update_contact_content(App $a)
|
||||
|
@ -19,7 +19,7 @@ function update_contact_content(App $a)
|
|||
$text = '';
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once "mod/display.php";
|
||||
|
||||
|
@ -20,7 +21,7 @@ function update_display_content(App $a)
|
|||
|
||||
$text = display_content($a, true, $profile_uid);
|
||||
|
||||
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once "mod/network.php";
|
||||
|
||||
|
@ -23,13 +24,13 @@ function update_network_content(App $a)
|
|||
echo "<!DOCTYPE html><html><body>\r\n";
|
||||
echo "<section>";
|
||||
|
||||
if (!PConfig::get($profile_uid, "system", "no_auto_update") || ($_GET["force"] == 1)) {
|
||||
if (!DI::pConfig()->get($profile_uid, "system", "no_auto_update") || ($_GET["force"] == 1)) {
|
||||
$text = network_content($a, $profile_uid, $parent);
|
||||
} else {
|
||||
$text = "";
|
||||
}
|
||||
|
||||
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
|
||||
require_once("mod/notes.php");
|
||||
|
||||
|
@ -32,7 +33,7 @@ function update_notes_content(App $a) {
|
|||
|
||||
$text = notes_content($a, $profile_uid);
|
||||
|
||||
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Profile;
|
||||
|
||||
function update_profile_content(App $a) {
|
||||
|
@ -30,7 +31,7 @@ function update_profile_content(App $a) {
|
|||
|
||||
$text = Profile::content([], $profile_uid);
|
||||
|
||||
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
|
||||
if (DI::pConfig()->get(local_user(), "system", "bandwidth_saver")) {
|
||||
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
|
||||
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||
$text = preg_replace($pattern, $replace, $text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue