$stamp = microtime(true);
$return = call_user_func($info['func'], $type);
- $duration = (float) (microtime(true) - $stamp);
+ $duration = floatval(microtime(true) - $stamp);
Logger::info(API_LOG_PREFIX . 'username {username}', ['module' => 'api', 'action' => 'call', 'username' => $a->user['username'], 'duration' => round($duration, 2)]);
'$new_post' => L10n::t('New Post'),
'$return_path' => $query_str,
'$action' => 'item',
- '$share' => defaults($x, 'button', L10n::t('Share')),
+ '$share' => ($x['button'] ?? '') ?: L10n::t('Share'),
'$upload' => L10n::t('Upload photo'),
'$shortupload' => L10n::t('upload photo'),
'$attach' => L10n::t('Attach file'),
'$shortsetloc' => L10n::t('set location'),
'$noloc' => L10n::t('Clear browser location'),
'$shortnoloc' => L10n::t('clear location'),
- '$title' => defaults($x, 'title', ''),
+ '$title' => $x['title'] ?? '',
'$placeholdertitle' => L10n::t('Set title'),
- '$category' => defaults($x, 'category', ''),
+ '$category' => $x['category'] ?? '',
'$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? L10n::t("Categories \x28comma-separated list\x29") : '',
'$wait' => L10n::t('Please wait'),
'$permset' => L10n::t('Permission settings'),
'$shortpermset' => L10n::t('permissions'),
'$wall' => $notes_cid ? 0 : 1,
'$posttype' => $notes_cid ? Item::PT_PERSONAL_NOTE : Item::PT_ARTICLE,
- '$content' => defaults($x, 'content', ''),
- '$post_id' => defaults($x, 'post_id', ''),
+ '$content' => $x['content'] ?? '',
+ '$post_id' => $x['post_id'] ?? '',
'$baseurl' => System::baseUrl(true),
'$defloc' => $x['default_location'],
'$visitor' => $x['visitor'],
$ret = [];
foreach ($response_verbs as $v) {
$ret[$v] = [];
- $ret[$v]['count'] = defaults($conv_responses[$v], $item['uri'], 0);
- $ret[$v]['list'] = defaults($conv_responses[$v], $item['uri'] . '-l', []);
- $ret[$v]['self'] = defaults($conv_responses[$v], $item['uri'] . '-self', '0');
+ $ret[$v]['count'] = $conv_responses[$v][$item['uri']] ?? 0;
+ $ret[$v]['list'] = $conv_responses[$v][$item['uri'] . '-l'] ?? [];
+ $ret[$v]['self'] = $conv_responses[$v][$item['uri'] . '-self'] ?? '0';
if (count($ret[$v]['list']) > MAX_LIKERS) {
$ret[$v]['list_part'] = array_slice($ret[$v]['list'], 0, MAX_LIKERS);
array_push($ret[$v]['list_part'], '<a href="#" data-toggle="modal" data-target="#' . $v . 'Modal-'
return false;
}
- $params['notify_flags'] = defaults($params, 'notify_flags', $user['notify-flags']);
- $params['language'] = defaults($params, 'language' , $user['language']);
- $params['to_name'] = defaults($params, 'to_name' , $user['username']);
- $params['to_email'] = defaults($params, 'to_email' , $user['email']);
+ $params['notify_flags'] = ($params['notify_flags'] ?? '') ?: $user['notify-flags'];
+ $params['language'] = ($params['language'] ?? '') ?: $user['language'];
+ $params['to_name'] = ($params['to_name'] ?? '') ?: $user['username'];
+ $params['to_email'] = ($params['to_email'] ?? '') ?: $user['email'];
// from here on everything is in the recipients language
L10n::pushLang($params['language']);
if (!isset($params['subject'])) {
Logger::warning('subject isn\'t set.', ['type' => $params['type']]);
}
- $subject = defaults($params, 'subject', '');
+ $subject = $params['subject'] ?? '';
if (!isset($params['preamble'])) {
Logger::warning('preamble isn\'t set.', ['type' => $params['type'], 'subject' => $subject]);
}
- $preamble = defaults($params, 'preamble', '');
+ $preamble = $params['preamble'] ?? '';
if (!isset($params['body'])) {
Logger::warning('body isn\'t set.', ['type' => $params['type'], 'subject' => $subject, 'preamble' => $preamble]);
}
- $body = defaults($params, 'body', '');
+ $body = $params['body'] ?? '';
$show_in_notification_page = false;
}
$datarray['siteurl'] = $siteurl;
$datarray['type'] = $params['type'];
$datarray['parent'] = $parent_id;
- $datarray['source_name'] = defaults($params, 'source_name', '');
- $datarray['source_link'] = defaults($params, 'source_link', '');
- $datarray['source_photo'] = defaults($params, 'source_photo', '');
+ $datarray['source_name'] = $params['source_name'] ?? '';
+ $datarray['source_link'] = $params['source_link'] ?? '';
+ $datarray['source_photo'] = $params['source_photo'] ?? '';
$datarray['uid'] = $params['uid'];
- $datarray['username'] = defaults($params, 'to_name', '');
+ $datarray['username'] = $params['to_name'] ?? '';
$datarray['hsitelink'] = $hsitelink;
$datarray['tsitelink'] = $tsitelink;
$datarray['hitemlink'] = '<a href="'.$itemlink.'">'.$itemlink.'</a>';
$data["type"] = "link";
}
- $data["title"] = defaults($data, "title", "");
+ $data["title"] = $data["title"] ?? '';
if ((($data["type"] != "link") && ($data["type"] != "video") && ($data["type"] != "photo")) || ($data["title"] == $data["url"])) {
return "";
echo file_get_contents("$THEMEPATH/style.css");
}
-$uid = defaults($_REQUEST, 'puid', 0);
+$uid = $_REQUEST['puid'] ?? 0;
$s_colorset = Config::get('duepuntozero', 'colorset');
$colorset = PConfig::get($uid, 'duepuntozero', 'colorset');
'$nav_icon_color' => array_key_exists('nav_icon_color', $disable) ? '' : ['frio_nav_icon_color', L10n::t('Navigation bar icon color '), $arr['nav_icon_color'], '', false],
'$link_color' => array_key_exists('link_color', $disable) ? '' : ['frio_link_color', L10n::t('Link color'), $arr['link_color'], '', false],
'$background_color' => array_key_exists('background_color', $disable) ? '' : ['frio_background_color', L10n::t('Set the background color'), $arr['background_color'], '', false],
- '$contentbg_transp' => array_key_exists('contentbg_transp', $disable) ? '' : ['frio_contentbg_transp', L10n::t('Content background opacity'), defaults($arr, 'contentbg_transp', 100), ''],
+ '$contentbg_transp' => array_key_exists('contentbg_transp', $disable) ? '' : ['frio_contentbg_transp', L10n::t('Content background opacity'), ($arr['contentbg_transp'] ?? 0) ?: 100, ''],
'$background_image' => array_key_exists('background_image', $disable) ? '' : ['frio_background_image', L10n::t('Set the background image'), $arr['background_image'], $background_image_help, false],
'$bg_image_options_title' => L10n::t('Background image style'),
'$bg_image_options' => Image::get_options($arr),
<html>
<head>
<title><?php if (!empty($page['title'])) echo $page['title'] ?></title>
- <meta request="<?php echo htmlspecialchars(defaults($_REQUEST, 'pagename', '')) ?>">
+ <meta request="<?php echo htmlspecialchars($_REQUEST['pagename'] ?? '') ?>">
<script type="text/javascript">var baseurl = "<?php echo System::baseUrl(); ?>";</script>
<script type="text/javascript">var frio = "<?php echo 'view/theme/frio'; ?>";</script>
<?php
</main>
<footer>
- <?php echo defaults($page, 'footer', ''); ?>
+ <?php echo $page['footer'] ?? ''; ?>
</footer>
<?php } ?> <!-- End of condition if $minimal else the rest -->
</body>
require 'view/theme/frio/none.php';
} else {
$template = 'view/theme/' . $a->getCurrentTheme() . '/'
- . defaults($a->page, 'template', 'default' ) . '.php';
+ . (($a->page['template'] ?? '') ?: 'default' ) . '.php';
if (file_exists($template)) {
require_once $template;
} else {
use Friendica\Core\PConfig;
use Friendica\Model\Profile;
-$uid = defaults($_REQUEST, 'puid', 0);
+$uid = $_REQUEST['puid'] ?? 0;
$color = false;
$quattro_align = false;
use Friendica\Core\PConfig;
use Friendica\Model\Profile;
-$uid = defaults($_REQUEST, 'puid', 0);
+$uid = $_REQUEST['puid'] ?? 0;
$style = PConfig::get($uid, 'vier', 'style');
Renderer::setActiveTemplateEngine('smarty3');
- if (!empty($a->argv[0]) && $a->argv[0] . defaults($a->argv, 1, '') === "profile".$a->user['nickname'] || $a->argv[0] === "network" && local_user()) {
+ if (!empty($a->argv[0]) && ($a->argv[0] . ($a->argv[1] ?? '')) === ('profile' . $a->user['nickname']) || $a->argv[0] === 'network' && local_user()) {
vier_community_info();
$a->page['htmlhead'] .= "<link rel='stylesheet' type='text/css' href='view/theme/vier/wide.css' media='screen and (min-width: 1300px)'/>\n";
//Community_Pages at right_aside
if ($show_pages && local_user()) {
- $cid = defaults($_GET, 'cid', null);
+ $cid = $_GET['cid'] ?? null;
//sort by last updated item
$lastitem = true;