mirror of
https://github.com/friendica/friendica
synced 2025-04-19 13:10:10 +00:00
Replace deprecated defaults() calls by ?? and ?: operators in src/Module/
This commit is contained in:
parent
8998926e5b
commit
f59ea2af55
40 changed files with 115 additions and 94 deletions
|
@ -25,7 +25,7 @@ class Babel extends BaseModule
|
|||
|
||||
$results = [];
|
||||
if (!empty($_REQUEST['text'])) {
|
||||
switch (defaults($_REQUEST, 'type', 'bbcode')) {
|
||||
switch (($_REQUEST['type'] ?? '') ?: 'bbcode') {
|
||||
case 'bbcode':
|
||||
$bbcode = trim($_REQUEST['text']);
|
||||
$results[] = [
|
||||
|
@ -176,10 +176,10 @@ class Babel extends BaseModule
|
|||
|
||||
$tpl = Renderer::getMarkupTemplate('babel.tpl');
|
||||
$o = Renderer::replaceMacros($tpl, [
|
||||
'$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
|
||||
'$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
|
||||
'$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
|
||||
'$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
|
||||
'$text' => ['text', L10n::t('Source text'), $_REQUEST['text'] ?? '', ''],
|
||||
'$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'bbcode'],
|
||||
'$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'markdown'],
|
||||
'$type_html' => ['type', L10n::t('HTML'), 'html', '', (($_REQUEST['type'] ?? '') ?: 'bbcode') == 'html'],
|
||||
'$results' => $results
|
||||
]);
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class Feed extends BaseModule
|
|||
|
||||
$tpl = Renderer::getMarkupTemplate('feedtest.tpl');
|
||||
return Renderer::replaceMacros($tpl, [
|
||||
'$url' => ['url', L10n::t('Source URL'), defaults($_REQUEST, 'url', ''), ''],
|
||||
'$url' => ['url', L10n::t('Source URL'), $_REQUEST['url'] ?? '', ''],
|
||||
'$result' => $result
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class Localtime extends BaseModule
|
|||
{
|
||||
public static function post()
|
||||
{
|
||||
$time = defaults($_REQUEST, 'time', 'now');
|
||||
$time = ($_REQUEST['time'] ?? '') ?: 'now';
|
||||
|
||||
$bd_format = L10n::t('l F d, Y \@ g:i A');
|
||||
|
||||
|
@ -25,7 +25,7 @@ class Localtime extends BaseModule
|
|||
{
|
||||
$app = self::getApp();
|
||||
|
||||
$time = defaults($_REQUEST, 'time', 'now');
|
||||
$time = ($_REQUEST['time'] ?? '') ?: 'now';
|
||||
|
||||
$output = '<h3>' . L10n::t('Time Conversion') . '</h3>';
|
||||
$output .= '<p>' . L10n::t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
|
||||
|
@ -41,7 +41,7 @@ class Localtime extends BaseModule
|
|||
|
||||
$output .= '<form action ="' . $app->getBaseURL() . '/localtime?time=' . $time . '" method="post" >';
|
||||
$output .= '<p>' . L10n::t('Please select your timezone:') . '</p>';
|
||||
$output .= Temporal::getTimezoneSelect(defaults($_REQUEST, 'timezone', Installer::DEFAULT_TZ));
|
||||
$output .= Temporal::getTimezoneSelect(($_REQUEST['timezone'] ?? '') ?: Installer::DEFAULT_TZ);
|
||||
$output .= '<input type="submit" name="submit" value="' . L10n::t('Submit') . '" /></form>';
|
||||
|
||||
return $output;
|
||||
|
|
|
@ -21,7 +21,7 @@ class Probe extends BaseModule
|
|||
throw $e;
|
||||
}
|
||||
|
||||
$addr = defaults($_GET, 'addr', '');
|
||||
$addr = $_GET['addr'] ?? '';
|
||||
$res = '';
|
||||
|
||||
if (!empty($addr)) {
|
||||
|
|
|
@ -20,7 +20,7 @@ class WebFinger extends BaseModule
|
|||
throw $e;
|
||||
}
|
||||
|
||||
$addr = defaults($_GET, 'addr', '');
|
||||
$addr = $_GET['addr'] ?? '';
|
||||
$res = '';
|
||||
|
||||
if (!empty($addr)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue