<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Network\HTTPException;
use Friendica\Util\Network;
use Friendica\Util\Strings;
+use Friendica\Util\Profiler;
/**
* Contains the page specific environment variables for the current Page
* The path can be absolute or relative to the Friendica installation base folder.
*
* @param string $path
- *
+ * @param string $media
* @see Page::initHead()
- *
*/
- public function registerStylesheet($path)
+ public function registerStylesheet($path, string $media = 'screen')
{
$path = Network::appendQueryParam($path, ['v' => FRIENDICA_VERSION]);
$path = mb_substr($path, mb_strlen($this->basePath . DIRECTORY_SEPARATOR));
}
- $this->stylesheets[] = trim($path, '/');
+ $this->stylesheets[trim($path, '/')] = $media;
}
/**
$touch_icon = $config->get('system', 'touch_icon');
if ($touch_icon == '') {
- $touch_icon = 'images/friendica-128.png';
+ $touch_icon = 'images/friendica-192.png';
}
Hook::callAll('head', $this->page['htmlhead']);
'$local_user' => local_user(),
'$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION,
'$delitem' => $l10n->t('Delete this item?'),
+ '$blockAuthor' => $l10n->t('Block this author? They won\'t be able to follow you nor see your public posts, and you won\'t be able to see their posts and their notifications.'),
'$update_interval' => $interval,
'$shortcut_icon' => $shortcut_icon,
'$touch_icon' => $touch_icon,
'$block_public' => intval($config->get('system', 'block_public')),
- '$stylesheets' => array_unique($this->stylesheets),
+ '$stylesheets' => $this->stylesheets,
]) . $this->page['htmlhead'];
}
// If you're just visiting, let javascript take you home
if (!empty($_SESSION['visitor_home'])) {
$homebase = $_SESSION['visitor_home'];
- } elseif (local_user()) {
- $homebase = 'profile/' . $app->user['nickname'];
+ } elseif (!empty($app->getLoggedInUserNickname())) {
+ $homebase = 'profile/' . $app->getLoggedInUserNickname();
}
if (isset($homebase)) {
*
* @throws HTTPException\InternalServerErrorException
*/
- public function run(App $app, BaseURL $baseURL, Mode $mode, Module $module, L10n $l10n, IConfig $config, IPConfig $pconfig)
+ public function run(App $app, BaseURL $baseURL, Mode $mode, Module $module, L10n $l10n, Profiler $profiler, IConfig $config, IPConfig $pconfig)
{
$moduleName = $module->getName();
*
* Sets the $Page->page['content'] variable
*/
+ $timestamp = microtime(true);
$this->initContent($module, $mode);
+ $profiler->set(microtime(true) - $timestamp, 'content');
// Load current theme info after module has been initialized as theme could have been set in module
$currentTheme = $app->getCurrentTheme();
}
$page = $this->page;
- $profile = $app->profile;
header("X-Friendica-Version: " . FRIENDICA_VERSION);
header("Content-type: text/html; charset=utf-8");