Replace deprecated $a->page with DI::page()

This commit is contained in:
Philipp Holzer 2019-12-30 20:02:09 +01:00
parent 6c2d13403e
commit 6d7362da41
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
48 changed files with 197 additions and 198 deletions

View File

@ -1171,7 +1171,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
$geotag = !empty($x['allow_location']) ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : ''; $geotag = !empty($x['allow_location']) ? Renderer::replaceMacros(Renderer::getMarkupTemplate('jot_geotag.tpl'), []) : '';
$tpl = Renderer::getMarkupTemplate('jot-header.tpl'); $tpl = Renderer::getMarkupTemplate('jot-header.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$newpost' => 'true', '$newpost' => 'true',
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$geotag' => $geotag, '$geotag' => $geotag,

View File

@ -50,7 +50,7 @@ function api_content(App $a)
* api/oauth/authorize interact with the user. return a standard page * api/oauth/authorize interact with the user. return a standard page
*/ */
$a->page['template'] = "minimal"; DI::page()['template'] = "minimal";
// get consumer/client from request token // get consumer/client from request token
try { try {

View File

@ -67,12 +67,12 @@ function cal_init(App $a)
$cal_widget = Widget\CalendarExport::getHTML(); $cal_widget = Widget\CalendarExport::getHTML();
if (empty($a->page['aside'])) { if (empty(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
$a->page['aside'] .= $vcard_widget; DI::page()['aside'] .= $vcard_widget;
$a->page['aside'] .= $cal_widget; DI::page()['aside'] .= $cal_widget;
return; return;
} }
@ -85,7 +85,7 @@ function cal_content(App $a)
$i18n = Event::getStrings(); $i18n = Event::getStrings();
$htpl = Renderer::getMarkupTemplate('event_head.tpl'); $htpl = Renderer::getMarkupTemplate('event_head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [
'$module_url' => '/cal/' . $a->data['user']['nickname'], '$module_url' => '/cal/' . $a->data['user']['nickname'],
'$modparams' => 2, '$modparams' => 2,
'$i18n' => $i18n, '$i18n' => $i18n,

View File

@ -41,7 +41,7 @@ function common_content(App $a)
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['id' => $cid, 'uid' => $uid]); $contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['id' => $cid, 'uid' => $uid]);
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {
$a->page['aside'] = ""; DI::page()['aside'] = "";
Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"])); Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
} }
} else { } else {
@ -54,10 +54,10 @@ function common_content(App $a)
'url' => 'contact/' . $cid 'url' => 'contact/' . $cid
]); ]);
if (empty($a->page['aside'])) { if (empty(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
$a->page['aside'] .= $vcard_widget; DI::page()['aside'] .= $vcard_widget;
} }
} }

View File

@ -127,7 +127,7 @@ function community_content(App $a, $update = 0)
'default_location' => $a->user['default-location'], 'default_location' => $a->user['default-location'],
'nickname' => $a->user['nickname'], 'nickname' => $a->user['nickname'],
'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'), 'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
'acl' => ACL::getFullSelectorHTML($a->page, $a->user, true), 'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true),
'bang' => '', 'bang' => '',
'visitor' => 'block', 'visitor' => 'block',
'profile_uid' => local_user(), 'profile_uid' => local_user(),
@ -193,12 +193,12 @@ function community_content(App $a, $update = 0)
$o .= $pager->renderMinimal(count($r)); $o .= $pager->renderMinimal(count($r));
} }
if (empty($a->page['aside'])) { if (empty(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
if (Feature::isEnabled(local_user(), 'trending_tags')) { if (Feature::isEnabled(local_user(), 'trending_tags')) {
$a->page['aside'] .= TrendingTags::getHTML($content); DI::page()['aside'] .= TrendingTags::getHTML($content);
} }
$t = Renderer::getMarkupTemplate("community.tpl"); $t = Renderer::getMarkupTemplate("community.tpl");

View File

@ -10,6 +10,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model; use Friendica\Model;
use Friendica\Module; use Friendica\Module;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -103,8 +104,8 @@ function crepair_content(App $a)
return; return;
} }
if (empty($a->page['aside'])) { if (empty(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {

View File

@ -239,7 +239,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$conversation = ''; $conversation = '';
} }
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'), DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'),
['$alternate' => $alternate, ['$alternate' => $alternate,
'$conversation' => $conversation]); '$conversation' => $conversation]);
@ -281,7 +281,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
'default_location' => $a->user['default-location'], 'default_location' => $a->user['default-location'],
'nickname' => $a->user['nickname'], 'nickname' => $a->user['nickname'],
'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'), 'lockstate' => (is_array($a->user) && (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
'acl' => ACL::getFullSelectorHTML($a->page, $a->user, true), 'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true),
'bang' => '', 'bang' => '',
'visitor' => 'block', 'visitor' => 'block',
'profile_uid' => local_user(), 'profile_uid' => local_user(),
@ -342,39 +342,41 @@ function display_content(App $a, $update = false, $update_uid = 0)
$title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8', true); // allow double encoding here $title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
$author_name = htmlspecialchars($author_name, ENT_COMPAT, 'UTF-8', true); // allow double encoding here $author_name = htmlspecialchars($author_name, ENT_COMPAT, 'UTF-8', true); // allow double encoding here
$page = DI::page();
if (DBA::exists('contact', ['unsearchable' => true, 'id' => [$item['contact-id'], $item['author-id'], $item['owner-id']]])) { if (DBA::exists('contact', ['unsearchable' => true, 'id' => [$item['contact-id'], $item['author-id'], $item['owner-id']]])) {
$a->page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n"; $page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
} }
$a->page['htmlhead'] .= '<meta name="author" content="'.$author_name.'" />'."\n"; DI::page()['htmlhead'] .= '<meta name="author" content="'.$author_name.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="title" content="'.$title.'" />'."\n"; $page['htmlhead'] .= '<meta name="title" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="fulltitle" content="'.$title.'" />'."\n"; $page['htmlhead'] .= '<meta name="fulltitle" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="description" content="'.$description.'" />'."\n"; $page['htmlhead'] .= '<meta name="description" content="'.$description.'" />'."\n";
// Schema.org microdata // Schema.org microdata
$a->page['htmlhead'] .= '<meta itemprop="name" content="'.$title.'" />'."\n"; $page['htmlhead'] .= '<meta itemprop="name" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta itemprop="description" content="'.$description.'" />'."\n"; $page['htmlhead'] .= '<meta itemprop="description" content="'.$description.'" />'."\n";
$a->page['htmlhead'] .= '<meta itemprop="image" content="'.$image.'" />'."\n"; $page['htmlhead'] .= '<meta itemprop="image" content="'.$image.'" />'."\n";
$a->page['htmlhead'] .= '<meta itemprop="author" content="'.$author_name.'" />'."\n"; $page['htmlhead'] .= '<meta itemprop="author" content="'.$author_name.'" />'."\n";
// Twitter cards // Twitter cards
$a->page['htmlhead'] .= '<meta name="twitter:card" content="summary" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:card" content="summary" />'."\n";
$a->page['htmlhead'] .= '<meta name="twitter:title" content="'.$title.'" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:title" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="twitter:description" content="'.$description.'" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:description" content="'.$description.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="twitter:image" content="'.System::baseUrl().'/'.$image.'" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:image" content="'.System::baseUrl().'/'.$image.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="twitter:url" content="'.$item["plink"].'" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:url" content="'.$item["plink"].'" />'."\n";
// Dublin Core // Dublin Core
$a->page['htmlhead'] .= '<meta name="DC.title" content="'.$title.'" />'."\n"; $page['htmlhead'] .= '<meta name="DC.title" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="DC.description" content="'.$description.'" />'."\n"; $page['htmlhead'] .= '<meta name="DC.description" content="'.$description.'" />'."\n";
// Open Graph // Open Graph
$a->page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n"; $page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n"; $page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:image" content="'.System::baseUrl().'/'.$image.'" />'."\n"; $page['htmlhead'] .= '<meta property="og:image" content="'.System::baseUrl().'/'.$image.'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:url" content="'.$item["plink"].'" />'."\n"; $page['htmlhead'] .= '<meta property="og:url" content="'.$item["plink"].'" />'."\n";
$a->page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n"; $page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n";
$a->page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n"; $page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n";
// article:tag // article:tag
return $o; return $o;

View File

@ -9,6 +9,7 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\FileTag; use Friendica\Model\FileTag;
use Friendica\Model\Item; use Friendica\Model\Item;
@ -47,7 +48,7 @@ function editpost_content(App $a)
]); ]);
$tpl = Renderer::getMarkupTemplate('jot-header.tpl'); $tpl = Renderer::getMarkupTemplate('jot-header.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$ispublic' => '&nbsp;', // L10n::t('Visible to <strong>everybody</strong>'), '$ispublic' => '&nbsp;', // L10n::t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $a->user['nickname'] '$nickname' => $a->user['nickname']

View File

@ -37,13 +37,13 @@ function events_init(App $a)
return; return;
} }
if (empty($a->page['aside'])) { if (empty(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
$cal_widget = CalendarExport::getHTML(); $cal_widget = CalendarExport::getHTML();
$a->page['aside'] .= $cal_widget; DI::page()['aside'] .= $cal_widget;
return; return;
} }
@ -242,7 +242,7 @@ function events_content(App $a)
$i18n = Event::getStrings(); $i18n = Event::getStrings();
$htpl = Renderer::getMarkupTemplate('event_head.tpl'); $htpl = Renderer::getMarkupTemplate('event_head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [
'$module_url' => '/events', '$module_url' => '/events',
'$modparams' => 1, '$modparams' => 1,
'$i18n' => $i18n, '$i18n' => $i18n,
@ -384,10 +384,10 @@ function events_content(App $a)
} }
// ACL blocks are loaded in modals in frio // ACL blocks are loaded in modals in frio
$a->page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js')); DI::page()->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js'));
$a->page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js')); DI::page()->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js'));
$a->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); DI::page()->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
$a->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); DI::page()->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
$o = Renderer::replaceMacros($tpl, [ $o = Renderer::replaceMacros($tpl, [
'$tabs' => $tabs, '$tabs' => $tabs,
@ -489,7 +489,7 @@ function events_content(App $a)
$fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00'; $fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00';
if (!$cid && in_array($mode, ['new', 'copy'])) { if (!$cid && in_array($mode, ['new', 'copy'])) {
$acl = ACL::getFullSelectorHTML($a->page, $a->user, false, ACL::getDefaultUserPermissions($orig_event)); $acl = ACL::getFullSelectorHTML(DI::page(), $a->user, false, ACL::getDefaultUserPermissions($orig_event));
} else { } else {
$acl = ''; $acl = '';
} }

View File

@ -184,7 +184,7 @@ function follow_content(App $a)
'$keywords_label'=> L10n::t('Tags:') '$keywords_label'=> L10n::t('Tags:')
]); ]);
$a->page['aside'] = ''; DI::page()['aside'] = '';
$profiledata = Contact::getDetailsByURL($ret['url']); $profiledata = Contact::getDetailsByURL($ret['url']);
if ($profiledata) { if ($profiledata) {

View File

@ -36,8 +36,8 @@ function match_content(App $a)
return ''; return '';
} }
$a->page['aside'] .= Widget::findPeople(); DI::page()['aside'] .= Widget::findPeople();
$a->page['aside'] .= Widget::follow(); DI::page()['aside'] .= Widget::follow();
$_SESSION['return_path'] = DI::args()->getCommand(); $_SESSION['return_path'] = DI::args()->getCommand();

View File

@ -38,14 +38,14 @@ function message_init(App $a)
]; ];
$tpl = Renderer::getMarkupTemplate('message_side.tpl'); $tpl = Renderer::getMarkupTemplate('message_side.tpl');
$a->page['aside'] = Renderer::replaceMacros($tpl, [ DI::page()['aside'] = Renderer::replaceMacros($tpl, [
'$tabs' => $tabs, '$tabs' => $tabs,
'$new' => $new, '$new' => $new,
]); ]);
$base = System::baseUrl(); $base = System::baseUrl();
$head_tpl = Renderer::getMarkupTemplate('message-head.tpl'); $head_tpl = Renderer::getMarkupTemplate('message-head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$base' => $base '$base' => $base
]); ]);
@ -199,7 +199,7 @@ function message_content(App $a)
$o .= $header; $o .= $header;
$tpl = Renderer::getMarkupTemplate('msg-header.tpl'); $tpl = Renderer::getMarkupTemplate('msg-header.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => L10n::t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')
@ -355,7 +355,7 @@ function message_content(App $a)
} }
$tpl = Renderer::getMarkupTemplate('msg-header.tpl'); $tpl = Renderer::getMarkupTemplate('msg-header.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => L10n::t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')

View File

@ -132,16 +132,16 @@ function network_init(App $a)
} }
} }
if (empty($a->page['aside'])) { if (empty(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
$a->page['aside'] .= Group::sidebarWidget('network/0', 'network', 'standard', $group_id); DI::page()['aside'] .= Group::sidebarWidget('network/0', 'network', 'standard', $group_id);
$a->page['aside'] .= ForumManager::widget(local_user(), $cid); DI::page()['aside'] .= ForumManager::widget(local_user(), $cid);
$a->page['aside'] .= Widget::postedByYear('network', local_user(), false); DI::page()['aside'] .= Widget::postedByYear('network', local_user(), false);
$a->page['aside'] .= Widget::networks('network', $_GET['nets'] ?? ''); DI::page()['aside'] .= Widget::networks('network', $_GET['nets'] ?? '');
$a->page['aside'] .= Widget\SavedSearches::getHTML(DI::args()->getQueryString()); DI::page()['aside'] .= Widget\SavedSearches::getHTML(DI::args()->getQueryString());
$a->page['aside'] .= Widget::fileAs('network', $_GET['file'] ?? ''); DI::page()['aside'] .= Widget::fileAs('network', $_GET['file'] ?? '');
} }
/** /**
@ -374,7 +374,7 @@ function networkFlatView(App $a, $update = 0)
(strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) ||
strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'), strlen($a->user['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'),
'default_perms' => ACL::getDefaultUserPermissions($a->user), 'default_perms' => ACL::getDefaultUserPermissions($a->user),
'acl' => ACL::getFullSelectorHTML($a->page, $a->user, true), 'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true),
'bang' => '', 'bang' => '',
'visitor' => 'block', 'visitor' => 'block',
'profile_uid' => local_user(), 'profile_uid' => local_user(),
@ -548,7 +548,7 @@ function networkThreadedView(App $a, $update, $parent)
(strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) || (strlen($a->user['allow_cid']) || strlen($a->user['allow_gid']) ||
strlen($a->user['deny_cid']) || strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'), strlen($a->user['deny_cid']) || strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'),
'default_perms' => ACL::getDefaultUserPermissions($a->user), 'default_perms' => ACL::getDefaultUserPermissions($a->user),
'acl' => ACL::getFullSelectorHTML($a->page, $a->user, true, $default_permissions), 'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true, $default_permissions),
'bang' => (($gid || $cid || $nets) ? '!' : ''), 'bang' => (($gid || $cid || $nets) ? '!' : ''),
'visitor' => 'block', 'visitor' => 'block',
'profile_uid' => local_user(), 'profile_uid' => local_user(),

View File

@ -25,8 +25,6 @@ function ostatus_subscribe_content(App $a)
$uid = local_user(); $uid = local_user();
$a = \get_app();
$counter = intval($_REQUEST['counter']); $counter = intval($_REQUEST['counter']);
if (PConfig::get($uid, 'ostatus', 'legacy_friends') == '') { if (PConfig::get($uid, 'ostatus', 'legacy_friends') == '') {
@ -65,7 +63,7 @@ function ostatus_subscribe_content(App $a)
$total = sizeof($friends); $total = sizeof($friends);
if ($counter >= $total) { if ($counter >= $total) {
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl() . '/settings/connectors">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl() . '/settings/connectors">';
PConfig::delete($uid, 'ostatus', 'legacy_friends'); PConfig::delete($uid, 'ostatus', 'legacy_friends');
PConfig::delete($uid, 'ostatus', 'legacy_contact'); PConfig::delete($uid, 'ostatus', 'legacy_contact');
$o .= L10n::t('Done'); $o .= L10n::t('Done');
@ -94,7 +92,7 @@ function ostatus_subscribe_content(App $a)
$o .= '<p>' . L10n::t('Keep this window open until done.') . '</p>'; $o .= '<p>' . L10n::t('Keep this window open until done.') . '</p>';
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl() . '/ostatus_subscribe?counter=' . $counter . '">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl() . '/ostatus_subscribe?counter=' . $counter . '">';
return $o; return $o;
} }

View File

@ -116,19 +116,19 @@ function photos_init(App $a) {
]); ]);
} }
if (empty($a->page['aside'])) { if (empty(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
$a->page['aside'] .= $vcard_widget; DI::page()['aside'] .= $vcard_widget;
if (!empty($photo_albums_widget)) { if (!empty($photo_albums_widget)) {
$a->page['aside'] .= $photo_albums_widget; DI::page()['aside'] .= $photo_albums_widget;
} }
$tpl = Renderer::getMarkupTemplate("photos_head.tpl"); $tpl = Renderer::getMarkupTemplate("photos_head.tpl");
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl,[
'$ispublic' => L10n::t('everybody') '$ispublic' => L10n::t('everybody')
]); ]);
} }
@ -957,7 +957,7 @@ function photos_content(App $a)
$tpl = Renderer::getMarkupTemplate('photos_upload.tpl'); $tpl = Renderer::getMarkupTemplate('photos_upload.tpl');
$aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML($a->page, $a->user)); $aclselect_e = ($visitor ? '' : ACL::getFullSelectorHTML(DI::page(), $a->user));
$o .= Renderer::replaceMacros($tpl,[ $o .= Renderer::replaceMacros($tpl,[
'$pagename' => L10n::t('Upload Photos'), '$pagename' => L10n::t('Upload Photos'),
@ -1198,7 +1198,7 @@ function photos_content(App $a)
} }
$tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl'); $tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl,[
'$prevlink' => $prevlink, '$prevlink' => $prevlink,
'$nextlink' => $nextlink '$nextlink' => $nextlink
]); ]);
@ -1325,7 +1325,7 @@ function photos_content(App $a)
$album_e = $ph[0]['album']; $album_e = $ph[0]['album'];
$caption_e = $ph[0]['desc']; $caption_e = $ph[0]['desc'];
$aclselect_e = ACL::getFullSelectorHTML($a->page, $a->user, false, ACL::getDefaultUserPermissions($ph[0])); $aclselect_e = ACL::getFullSelectorHTML(DI::page(), $a->user, false, ACL::getDefaultUserPermissions($ph[0]));
$edit = Renderer::replaceMacros($edit_tpl, [ $edit = Renderer::replaceMacros($edit_tpl, [
'$id' => $ph[0]['id'], '$id' => $ph[0]['id'],
@ -1527,11 +1527,11 @@ function photos_content(App $a)
'$paginate' => $paginate, '$paginate' => $paginate,
]); ]);
$a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n"; DI::page()['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n"; DI::page()['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:image" content="' . System::baseUrl() . "/" . $photo["href"] . '" />' . "\n"; DI::page()['htmlhead'] .= '<meta name="twitter:image" content="' . System::baseUrl() . "/" . $photo["href"] . '" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n"; DI::page()['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
$a->page['htmlhead'] .= '<meta name="twitter:image:height" content="' . $photo["height"] . '" />' . "\n"; DI::page()['htmlhead'] .= '<meta name="twitter:image:height" content="' . $photo["height"] . '" />' . "\n";
return $o; return $o;
} }

View File

@ -20,6 +20,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -156,7 +157,7 @@ function poke_content(App $a)
$id = $contact['id']; $id = $contact['id'];
$head_tpl = Renderer::getMarkupTemplate('poke_head.tpl'); $head_tpl = Renderer::getMarkupTemplate('poke_head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($head_tpl,[ DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl,[
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
]); ]);

View File

@ -167,7 +167,7 @@ function profile_photo_post(App $a)
$ph->orient($src); $ph->orient($src);
@unlink($src); @unlink($src);
$imagecrop = profile_photo_crop_ui_head($a, $ph); $imagecrop = profile_photo_crop_ui_head($ph);
DI::baseUrl()->redirect('profile_photo/use/' . $imagecrop['hash']); DI::baseUrl()->redirect('profile_photo/use/' . $imagecrop['hash']);
} }
@ -228,7 +228,7 @@ function profile_photo_content(App $a)
} }
$ph = Photo::getImageForPhoto($r[0]); $ph = Photo::getImageForPhoto($r[0]);
$imagecrop = profile_photo_crop_ui_head($a, $ph); $imagecrop = profile_photo_crop_ui_head($ph);
// go ahead as we have jus uploaded a new photo to crop // go ahead as we have jus uploaded a new photo to crop
} }
@ -271,7 +271,7 @@ function profile_photo_content(App $a)
} }
} }
function profile_photo_crop_ui_head(App $a, Image $image) function profile_photo_crop_ui_head(Image $image)
{ {
$max_length = Config::get('system', 'max_image_length'); $max_length = Config::get('system', 'max_image_length');
if (!$max_length) { if (!$max_length) {
@ -315,7 +315,7 @@ function profile_photo_crop_ui_head(App $a, Image $image)
} }
} }
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate("crophead.tpl"), []); DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate("crophead.tpl"), []);
$imagecrop = [ $imagecrop = [
'hash' => $hash, 'hash' => $hash,

View File

@ -513,7 +513,7 @@ function profiles_content(App $a) {
return; return;
} }
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('profed_head.tpl'), [ DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('profed_head.tpl'), [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
]); ]);

View File

@ -60,7 +60,7 @@ function repair_ostatus_content(App $a) {
Contact::createFromProbe($uid, $r[0]["url"], true); Contact::createFromProbe($uid, $r[0]["url"], true);
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="1; URL='.System::baseUrl().'/repair_ostatus?counter='.$counter.'">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="1; URL='.System::baseUrl().'/repair_ostatus?counter='.$counter.'">';
return $o; return $o;
} }

View File

@ -56,7 +56,7 @@ function settings_init(App $a)
// These lines provide the javascript needed by the acl selector // These lines provide the javascript needed by the acl selector
$tpl = Renderer::getMarkupTemplate('settings/head.tpl'); $tpl = Renderer::getMarkupTemplate('settings/head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$ispublic' => L10n::t('everybody') '$ispublic' => L10n::t('everybody')
]); ]);
@ -143,7 +143,7 @@ function settings_init(App $a)
$tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl"); $tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl");
$a->page['aside'] = Renderer::replaceMacros($tabtpl, [ DI::page()['aside'] = Renderer::replaceMacros($tabtpl, [
'$title' => L10n::t('Settings'), '$title' => L10n::t('Settings'),
'$class' => 'settings-widget', '$class' => 'settings-widget',
'$items' => $tabs, '$items' => $tabs,
@ -787,7 +787,7 @@ function settings_content(App $a)
if (!empty($legacy_contact)) { if (!empty($legacy_contact)) {
/// @todo Isn't it supposed to be a $a->internalRedirect() call? /// @todo Isn't it supposed to be a $a->internalRedirect() call?
$a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">';
} }
$settings_connectors = ''; $settings_connectors = '';
@ -1203,7 +1203,7 @@ function settings_content(App $a)
'$permissions' => L10n::t('Default Post Permissions'), '$permissions' => L10n::t('Default Post Permissions'),
'$permdesc' => L10n::t("\x28click to open/close\x29"), '$permdesc' => L10n::t("\x28click to open/close\x29"),
'$visibility' => $profile['net-publish'], '$visibility' => $profile['net-publish'],
'$aclselect' => ACL::getFullSelectorHTML($a->page, $a->user), '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user),
'$suggestme' => $suggestme, '$suggestme' => $suggestme,
'$blockwall'=> $blockwall, // array('blockwall', L10n::t('Allow friends to post to your profile page:'), !$blockwall, ''), '$blockwall'=> $blockwall, // array('blockwall', L10n::t('Allow friends to post to your profile page:'), !$blockwall, ''),
'$blocktags'=> $blocktags, // array('blocktags', L10n::t('Allow friends to tag your posts:'), !$blocktags, ''), '$blocktags'=> $blocktags, // array('blocktags', L10n::t('Allow friends to tag your posts:'), !$blocktags, ''),

View File

@ -43,8 +43,8 @@ function suggest_content(App $a)
$_SESSION['return_path'] = DI::args()->getCommand(); $_SESSION['return_path'] = DI::args()->getCommand();
$a->page['aside'] .= Widget::findPeople(); DI::page()['aside'] .= Widget::findPeople();
$a->page['aside'] .= Widget::follow(); DI::page()['aside'] .= Widget::follow();
$r = GContact::suggestionQuery(local_user()); $r = GContact::suggestionQuery(local_user());

View File

@ -142,7 +142,7 @@ function unfollow_content(App $a)
'$keywords_label'=> '' '$keywords_label'=> ''
]); ]);
$a->page['aside'] = ''; DI::page()['aside'] = '';
Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url'])); Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url']));
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]); $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);

View File

@ -58,14 +58,14 @@ function videos_init(App $a)
]); ]);
// If not there, create 'aside' empty // If not there, create 'aside' empty
if (!isset($a->page['aside'])) { if (!isset(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
$a->page['aside'] .= $vcard_widget; DI::page()['aside'] .= $vcard_widget;
$tpl = Renderer::getMarkupTemplate("videos_head.tpl"); $tpl = Renderer::getMarkupTemplate("videos_head.tpl");
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl); DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl);
} }
return; return;

View File

@ -118,7 +118,7 @@ function wallmessage_content(App $a) {
} }
$tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl'); $tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => System::baseUrl(true),
'$nickname' => $user['nickname'], '$nickname' => $user['nickname'],
'$linkurl' => L10n::t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')

View File

@ -40,10 +40,6 @@ use Psr\Log\LoggerInterface;
*/ */
class App class App
{ {
/**
* @var Page The current page environment
*/
public $page;
public $profile; public $profile;
public $profile_uid; public $profile_uid;
public $user; public $user;
@ -154,7 +150,7 @@ class App
* @param App\Arguments $args The Friendica Arguments of the call * @param App\Arguments $args The Friendica Arguments of the call
* @param Core\Process $process The process methods * @param Core\Process $process The process methods
*/ */
public function __construct(Database $database, IConfiguration $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, App\Page $page, Core\Process $process) public function __construct(Database $database, IConfiguration $config, App\Mode $mode, BaseURL $baseURL, LoggerInterface $logger, Profiler $profiler, L10n $l10n, Arguments $args, Core\Process $process)
{ {
$this->database = $database; $this->database = $database;
$this->config = $config; $this->config = $config;
@ -168,7 +164,6 @@ class App
$this->argv = $args->getArgv(); $this->argv = $args->getArgv();
$this->argc = $args->getArgc(); $this->argc = $args->getArgc();
$this->page = $page;
$this->load(); $this->load();
} }
@ -435,10 +430,11 @@ class App
* @param App\Router $router * @param App\Router $router
* @param IPConfiguration $pconfig * @param IPConfiguration $pconfig
* @param Authentication $auth The Authentication backend of the node * @param Authentication $auth The Authentication backend of the node
* @param App\Page $page The Friendica page printing container
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
*/ */
public function runFrontend(App\Module $module, App\Router $router, IPConfiguration $pconfig, Authentication $auth) public function runFrontend(App\Module $module, App\Router $router, IPConfiguration $pconfig, Authentication $auth, App\Page $page)
{ {
$moduleName = $module->getName(); $moduleName = $module->getName();
@ -567,7 +563,7 @@ class App
} }
// Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid // Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
$this->page['page_title'] = $moduleName; $page['page_title'] = $moduleName;
// determine the module class and save it to the module instance // determine the module class and save it to the module instance
// @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet) // @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet)
@ -579,7 +575,7 @@ class App
ModuleHTTPException::rawContent($e); ModuleHTTPException::rawContent($e);
} }
$this->page->run($this, $this->baseURL, $this->mode, $module, $this->l10n, $this->config, $pconfig); $page->run($this, $this->baseURL, $this->mode, $module, $this->l10n, $this->config, $pconfig);
} }
/** /**

View File

@ -13,6 +13,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\FileTag; use Friendica\Model\FileTag;
use Friendica\Model\GContact; use Friendica\Model\GContact;
@ -49,13 +50,12 @@ class Widget
*/ */
public static function findPeople() public static function findPeople()
{ {
$a = \get_app();
$global_dir = Config::get('system', 'directory'); $global_dir = Config::get('system', 'directory');
if (Config::get('system', 'invitation_only')) { if (Config::get('system', 'invitation_only')) {
$x = intval(PConfig::get(local_user(), 'system', 'invites_remaining')); $x = intval(PConfig::get(local_user(), 'system', 'invites_remaining'));
if ($x || is_site_admin()) { if ($x || is_site_admin()) {
$a->page['aside'] .= '<div class="side-link widget" id="side-invite-remain">' DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
. L10n::tt('%d invitation available', '%d invitations available', $x) . L10n::tt('%d invitation available', '%d invitations available', $x)
. '</div>'; . '</div>';
} }

View File

@ -3576,7 +3576,7 @@ class Item
if (strpos($mime, 'video') !== false) { if (strpos($mime, 'video') !== false) {
if (!$vhead) { if (!$vhead) {
$vhead = true; $vhead = true;
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('videos_head.tpl')); DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('videos_head.tpl'));
} }
$url_parts = explode('/', $the_url); $url_parts = explode('/', $the_url);

View File

@ -155,7 +155,7 @@ class Profile
} }
// Add profile data to sidebar // Add profile data to sidebar
$a->page['aside'] .= self::sidebar($a, $profiledata, true, $show_connect); DI::page()['aside'] .= self::sidebar($a, $profiledata, true, $show_connect);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
return; return;
@ -189,7 +189,7 @@ class Profile
$a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme'); $a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme');
$a->profile['network'] = Protocol::DFRN; $a->profile['network'] = Protocol::DFRN;
$a->page['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename'); DI::page()['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename');
if (!$profiledata && !PConfig::get(local_user(), 'system', 'always_my_theme')) { if (!$profiledata && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
$a->setCurrentTheme($a->profile['theme']); $a->setCurrentTheme($a->profile['theme']);
@ -208,7 +208,7 @@ class Profile
} }
if (local_user() && local_user() == $a->profile['uid'] && $profiledata) { if (local_user() && local_user() == $a->profile['uid'] && $profiledata) {
$a->page['aside'] .= Renderer::replaceMacros( DI::page()['aside'] .= Renderer::replaceMacros(
Renderer::getMarkupTemplate('profile_edlink.tpl'), Renderer::getMarkupTemplate('profile_edlink.tpl'),
[ [
'$editprofile' => L10n::t('Edit profile'), '$editprofile' => L10n::t('Edit profile'),
@ -225,7 +225,7 @@ class Profile
* But: When this profile was on the same server, then we could display the contacts * But: When this profile was on the same server, then we could display the contacts
*/ */
if (!$profiledata) { if (!$profiledata) {
$a->page['aside'] .= self::sidebar($a, $a->profile, $block, $show_connect); DI::page()['aside'] .= self::sidebar($a, $a->profile, $block, $show_connect);
} }
return; return;

View File

@ -44,7 +44,7 @@ class AllFriends extends BaseModule
throw new HTTPException\BadRequestException(L10n::t('Invalid contact.')); throw new HTTPException\BadRequestException(L10n::t('Invalid contact.'));
} }
$app->page['aside'] = ""; DI::page()['aside'] = "";
Model\Profile::load($app, "", 0, Model\Contact::getDetailsByURL($contact["url"])); Model\Profile::load($app, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
$total = Model\GContact::countAllFriends(local_user(), $cid); $total = Model\GContact::countAllFriends(local_user(), $cid);

View File

@ -51,8 +51,6 @@ abstract class BaseAdminModule extends BaseModule
public static function content(array $parameters = []) public static function content(array $parameters = [])
{ {
$a = DI::app();
if (!is_site_admin()) { if (!is_site_admin()) {
notice(L10n::t('Please login to continue.')); notice(L10n::t('Please login to continue.'));
Session::set('return_path', DI::args()->getQueryString()); Session::set('return_path', DI::args()->getQueryString());
@ -64,7 +62,7 @@ abstract class BaseAdminModule extends BaseModule
} }
// Header stuff // Header stuff
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []); DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []);
/* /*
* Side bar links * Side bar links
@ -109,7 +107,7 @@ abstract class BaseAdminModule extends BaseModule
]; ];
$t = Renderer::getMarkupTemplate('admin/aside.tpl'); $t = Renderer::getMarkupTemplate('admin/aside.tpl');
$a->page['aside'] .= Renderer::replaceMacros($t, [ DI::page()['aside'] .= Renderer::replaceMacros($t, [
'$admin' => ['addons_admin' => Addon::getAdminList()], '$admin' => ['addons_admin' => Addon::getAdminList()],
'$subpages' => $aside_sub, '$subpages' => $aside_sub,
'$admtxt' => L10n::t('Admin'), '$admtxt' => L10n::t('Admin'),

View File

@ -15,7 +15,7 @@ class BaseSettingsModule extends BaseModule
$a = DI::app(); $a = DI::app();
$tpl = Renderer::getMarkupTemplate('settings/head.tpl'); $tpl = Renderer::getMarkupTemplate('settings/head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$ispublic' => L10n::t('everybody') '$ispublic' => L10n::t('everybody')
]); ]);
@ -102,7 +102,7 @@ class BaseSettingsModule extends BaseModule
$tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl"); $tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl");
$a->page['aside'] = Renderer::replaceMacros($tabtpl, [ DI::page()['aside'] = Renderer::replaceMacros($tabtpl, [
'$title' => L10n::t('Settings'), '$title' => L10n::t('Settings'),
'$class' => 'settings-widget', '$class' => 'settings-widget',
'$items' => $tabs, '$items' => $tabs,

View File

@ -46,7 +46,7 @@ class Bookmarklet extends BaseModule
'nickname' => $app->user['nickname'], 'nickname' => $app->user['nickname'],
'lockstate' => ((is_array($app->user) && ((strlen($app->user['allow_cid'])) || (strlen($app->user['allow_gid'])) || (strlen($app->user['deny_cid'])) || (strlen($app->user['deny_gid'])))) ? 'lock' : 'unlock'), 'lockstate' => ((is_array($app->user) && ((strlen($app->user['allow_cid'])) || (strlen($app->user['allow_gid'])) || (strlen($app->user['deny_cid'])) || (strlen($app->user['deny_gid'])))) ? 'lock' : 'unlock'),
'default_perms' => ACL::getDefaultUserPermissions($app->user), 'default_perms' => ACL::getDefaultUserPermissions($app->user),
'acl' => ACL::getFullSelectorHTML($app->page, $app->user, true), 'acl' => ACL::getFullSelectorHTML(DI::page(), $app->user, true),
'bang' => '', 'bang' => '',
'visitor' => 'block', 'visitor' => 'block',
'profile_uid' => local_user(), 'profile_uid' => local_user(),

View File

@ -252,8 +252,8 @@ class Contact extends BaseModule
$nets = $_GET['nets'] ?? ''; $nets = $_GET['nets'] ?? '';
$rel = $_GET['rel'] ?? ''; $rel = $_GET['rel'] ?? '';
if (empty($a->page['aside'])) { if (empty(DI::page()['aside'])) {
$a->page['aside'] = ''; DI::page()['aside'] = '';
} }
$contact_id = null; $contact_id = null;
@ -347,10 +347,10 @@ class Contact extends BaseModule
$groups_widget = null; $groups_widget = null;
} }
$a->page['aside'] .= $vcard_widget . $findpeople_widget . $follow_widget . $groups_widget . $networks_widget . $rel_widget; DI::page()['aside'] .= $vcard_widget . $findpeople_widget . $follow_widget . $groups_widget . $networks_widget . $rel_widget;
$tpl = Renderer::getMarkupTemplate('contacts-head.tpl'); $tpl = Renderer::getMarkupTemplate('contacts-head.tpl');
$a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => DI::baseUrl()->get(true), '$baseurl' => DI::baseUrl()->get(true),
]); ]);
@ -434,7 +434,7 @@ class Contact extends BaseModule
} }
} }
$a->page['aside'] = ''; DI::page()['aside'] = '';
return Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_drop_confirm.tpl'), [ return Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_drop_confirm.tpl'), [
'$header' => L10n::t('Drop contact'), '$header' => L10n::t('Drop contact'),
@ -472,7 +472,7 @@ class Contact extends BaseModule
if (!empty($a->data['contact']) && is_array($a->data['contact'])) { if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
$contact = $a->data['contact']; $contact = $a->data['contact'];
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [ DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_head.tpl'), [
'$baseurl' => DI::baseUrl()->get(true), '$baseurl' => DI::baseUrl()->get(true),
]); ]);

View File

@ -33,8 +33,8 @@ class Directory extends BaseModule
} }
if (local_user()) { if (local_user()) {
$app->page['aside'] .= Widget::findPeople(); DI::page()['aside'] .= Widget::findPeople();
$app->page['aside'] .= Widget::follow(); DI::page()['aside'] .= Widget::follow();
} }
$output = ''; $output = '';

View File

@ -137,7 +137,7 @@ class Group extends BaseModule
$a = DI::app(); $a = DI::app();
$a->page['aside'] = Model\Group::sidebarWidget('contact', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone')); DI::page()['aside'] = Model\Group::sidebarWidget('contact', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
// With no group number provided we jump to the unassigned contacts as a starting point // With no group number provided we jump to the unassigned contacts as a starting point
// @TODO: Replace with parameter from router // @TODO: Replace with parameter from router

View File

@ -41,16 +41,16 @@ class Help extends BaseModule
$title = basename($path); $title = basename($path);
$filename = $path; $filename = $path;
$text = self::loadDocFile('doc/' . $path . '.md', $lang); $text = self::loadDocFile('doc/' . $path . '.md', $lang);
$a->page['title'] = L10n::t('Help:') . ' ' . str_replace('-', ' ', Strings::escapeTags($title)); DI::page()['title'] = L10n::t('Help:') . ' ' . str_replace('-', ' ', Strings::escapeTags($title));
} }
$home = self::loadDocFile('doc/Home.md', $lang); $home = self::loadDocFile('doc/Home.md', $lang);
if (!$text) { if (!$text) {
$text = $home; $text = $home;
$filename = "Home"; $filename = "Home";
$a->page['title'] = L10n::t('Help'); DI::page()['title'] = L10n::t('Help');
} else { } else {
$a->page['aside'] = Markdown::convert($home, false); DI::page()['aside'] = Markdown::convert($home, false);
} }
if (!strlen($text)) { if (!strlen($text)) {
@ -104,7 +104,7 @@ class Help extends BaseModule
$html = implode("\n", $lines); $html = implode("\n", $lines);
$a->page['aside'] = '<div class="help-aside-wrapper widget"><div id="toc-wrapper">' . $toc . '</div>' . $a->page['aside'] . '</div>'; DI::page()['aside'] = '<div class="help-aside-wrapper widget"><div id="toc-wrapper">' . $toc . '</div>' . DI::page()['aside'] . '</div>';
} }
return $html; return $html;

View File

@ -42,7 +42,7 @@ class Home extends BaseModule
$customHome = $homeFilePath; $customHome = $homeFilePath;
if (file_exists($cssFilePath)) { if (file_exists($cssFilePath)) {
$app->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/home.css' . '" media="all" />'; DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . DI::baseUrl()->get() . '/home.css' . '" media="all" />';
} }
} }

View File

@ -114,9 +114,9 @@ class Compose extends BaseModule
Hook::callAll('jot_tool', $jotplugins); Hook::callAll('jot_tool', $jotplugins);
// Output // Output
$a->page->registerFooterScript(Theme::getPathForFile('js/ajaxupload.js')); DI::page()->registerFooterScript(Theme::getPathForFile('js/ajaxupload.js'));
$a->page->registerFooterScript(Theme::getPathForFile('js/linkPreview.js')); DI::page()->registerFooterScript(Theme::getPathForFile('js/linkPreview.js'));
$a->page->registerFooterScript(Theme::getPathForFile('js/compose.js')); DI::page()->registerFooterScript(Theme::getPathForFile('js/compose.js'));
$tpl = Renderer::getMarkupTemplate('item/compose.tpl'); $tpl = Renderer::getMarkupTemplate('item/compose.tpl');
return Renderer::replaceMacros($tpl, [ return Renderer::replaceMacros($tpl, [
@ -162,7 +162,7 @@ class Compose extends BaseModule
'$jotplugins' => $jotplugins, '$jotplugins' => $jotplugins,
'$sourceapp' => L10n::t($a->sourcename), '$sourceapp' => L10n::t($a->sourcename),
'$rand_num' => Crypto::randomDigits(12), '$rand_num' => Crypto::randomDigits(12),
'$acl_selector' => ACL::getFullSelectorHTML($a->page, $a->user, $doesFederate, [ '$acl_selector' => ACL::getFullSelectorHTML(DI::page(), $a->user, $doesFederate, [
'allow_cid' => $contact_allow_list, 'allow_cid' => $contact_allow_list,
'allow_gid' => $group_allow_list, 'allow_gid' => $group_allow_list,
'deny_cid' => $contact_deny_list, 'deny_cid' => $contact_deny_list,

View File

@ -84,51 +84,53 @@ class Profile extends BaseModule
if (!$update) { if (!$update) {
ProfileModel::load($a, self::$which, self::$profile); ProfileModel::load($a, self::$which, self::$profile);
$a->page['htmlhead'] .= "\n"; $page = DI::page();
$page['htmlhead'] .= "\n";
$blocked = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && Config::get('system', 'block_public'); $blocked = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && Config::get('system', 'block_public');
$userblock = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && $a->profile['hidewall']; $userblock = !local_user() && !Session::getRemoteContactID($a->profile['profile_uid']) && $a->profile['hidewall'];
if (!empty($a->profile['page-flags']) && $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) { if (!empty($a->profile['page-flags']) && $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY) {
$a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n"; $page['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n";
} }
if (!empty($a->profile['openidserver'])) { if (!empty($a->profile['openidserver'])) {
$a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\n"; $page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\n";
} }
if (!empty($a->profile['openid'])) { if (!empty($a->profile['openid'])) {
$delegate = strstr($a->profile['openid'], '://') ? $a->profile['openid'] : 'https://' . $a->profile['openid']; $delegate = strstr($a->profile['openid'], '://') ? $a->profile['openid'] : 'https://' . $a->profile['openid'];
$a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\n"; $page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\n";
} }
// site block // site block
if (!$blocked && !$userblock) { if (!$blocked && !$userblock) {
$keywords = str_replace(['#', ',', ' ', ',,'], ['', ' ', ',', ','], $a->profile['pub_keywords'] ?? ''); $keywords = str_replace(['#', ',', ' ', ',,'], ['', ' ', ',', ','], $a->profile['pub_keywords'] ?? '');
if (strlen($keywords)) { if (strlen($keywords)) {
$a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\n"; $page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\n";
} }
} }
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\n"; $page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\n";
if (!$a->profile['net-publish'] || $a->profile['hidewall']) { if (!$a->profile['net-publish'] || $a->profile['hidewall']) {
$a->page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n"; $page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
} }
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . self::$which . '" title="DFRN: ' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . self::$which . '" title="DFRN: ' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\n"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\n"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . DI::baseUrl()->getHostname() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : '')); $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . DI::baseUrl()->getHostname() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\n"; $page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
$dfrn_pages = ['request', 'confirm', 'notify', 'poll']; $dfrn_pages = ['request', 'confirm', 'notify', 'poll'];
foreach ($dfrn_pages as $dfrn) { foreach ($dfrn_pages as $dfrn) {
$a->page['htmlhead'] .= '<link rel="dfrn-' . $dfrn . '" href="' . System::baseUrl() . '/dfrn_' . $dfrn . '/' . self::$which . '" />' . "\n"; $page['htmlhead'] .= '<link rel="dfrn-' . $dfrn . '" href="' . System::baseUrl() . '/dfrn_' . $dfrn . '/' . self::$which . '" />' . "\n";
} }
$a->page['htmlhead'] .= '<link rel="dfrn-poco" href="' . System::baseUrl() . '/poco/' . self::$which . '" />' . "\n"; $page['htmlhead'] .= '<link rel="dfrn-poco" href="' . System::baseUrl() . '/poco/' . self::$which . '" />' . "\n";
} }
$category = $datequery = $datequery2 = ''; $category = $datequery = $datequery2 = '';
@ -191,9 +193,9 @@ class Profile extends BaseModule
$commpage = $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY; $commpage = $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
$commvisitor = $commpage && $remote_contact; $commvisitor = $commpage && $remote_contact;
$a->page['aside'] .= Widget::postedByYear(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'] ?? 0, true); DI::page()['aside'] .= Widget::postedByYear(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'] ?? 0, true);
$a->page['aside'] .= Widget::categories(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], XML::escape($category)); DI::page()['aside'] .= Widget::categories(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], XML::escape($category));
$a->page['aside'] .= Widget::tagCloud(); DI::page()['aside'] .= Widget::tagCloud();
if (Security::canWriteToUserWall($a->profile['profile_uid'])) { if (Security::canWriteToUserWall($a->profile['profile_uid'])) {
$x = [ $x = [
@ -207,7 +209,7 @@ class Profile extends BaseModule
|| strlen($a->user['deny_cid']) || strlen($a->user['deny_cid'])
|| strlen($a->user['deny_gid']) || strlen($a->user['deny_gid'])
) ? 'lock' : 'unlock', ) ? 'lock' : 'unlock',
'acl' => $is_owner ? ACL::getFullSelectorHTML($a->page, $a->user, true) : '', 'acl' => $is_owner ? ACL::getFullSelectorHTML(DI::page(), $a->user, true) : '',
'bang' => '', 'bang' => '',
'visitor' => $is_owner || $commvisitor ? 'block' : 'none', 'visitor' => $is_owner || $commvisitor ? 'block' : 'none',
'profile_uid' => $a->profile['profile_uid'], 'profile_uid' => $a->profile['profile_uid'],

View File

@ -23,14 +23,12 @@ class Directory extends BaseSearchModule
$search = Strings::escapeTags(trim(rawurldecode($_REQUEST['search'] ?? ''))); $search = Strings::escapeTags(trim(rawurldecode($_REQUEST['search'] ?? '')));
$a = DI::app(); if (empty(DI::page()['aside'])) {
DI::page()['aside'] = '';
if (empty($a->page['aside'])) {
$a->page['aside'] = '';
} }
$a->page['aside'] .= Widget::findPeople(); DI::page()['aside'] .= Widget::findPeople();
$a->page['aside'] .= Widget::follow(); DI::page()['aside'] .= Widget::follow();
return self::performContactSearch($search); return self::performContactSearch($search);
} }

View File

@ -66,7 +66,7 @@ class Index extends BaseSearchModule
} }
if (local_user()) { if (local_user()) {
DI::app()->page['aside'] .= Widget\SavedSearches::getHTML('search?q=' . urlencode($search), $search); DI::page()['aside'] .= Widget\SavedSearches::getHTML('search?q=' . urlencode($search), $search);
} }
Nav::setSelected('search'); Nav::setSelected('search');

View File

@ -75,7 +75,6 @@ class Login extends BaseModule
*/ */
public static function form($return_path = null, $register = false, $hiddens = []) public static function form($return_path = null, $register = false, $hiddens = [])
{ {
$a = DI::app();
$o = ''; $o = '';
$noid = Config::get('system', 'no_openid'); $noid = Config::get('system', 'no_openid');
@ -101,7 +100,7 @@ class Login extends BaseModule
if (local_user()) { if (local_user()) {
$tpl = Renderer::getMarkupTemplate('logout.tpl'); $tpl = Renderer::getMarkupTemplate('logout.tpl');
} else { } else {
$a->page['htmlhead'] .= Renderer::replaceMacros( DI::page()['htmlhead'] .= Renderer::replaceMacros(
Renderer::getMarkupTemplate('login_head.tpl'), Renderer::getMarkupTemplate('login_head.tpl'),
[ [
'$baseurl' => DI::baseUrl()->get(true) '$baseurl' => DI::baseUrl()->get(true)

View File

@ -4,6 +4,7 @@ use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI;
function duepuntozero_init(App $a) { function duepuntozero_init(App $a) {
@ -14,19 +15,19 @@ Renderer::setActiveTemplateEngine('smarty3');
$colorset = Config::get('duepuntozero', 'colorset'); // user setting have priority, then node settings $colorset = Config::get('duepuntozero', 'colorset'); // user setting have priority, then node settings
if ($colorset) { if ($colorset) {
if ($colorset == 'greenzero') if ($colorset == 'greenzero')
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n"; DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/greenzero.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'purplezero') if ($colorset == 'purplezero')
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />'."\n"; DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/purplezero.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'easterbunny') if ($colorset == 'easterbunny')
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n"; DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/easterbunny.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'darkzero') if ($colorset == 'darkzero')
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />'."\n"; DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/darkzero.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'comix') if ($colorset == 'comix')
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n"; DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/comix.css" type="text/css" media="screen" />'."\n";
if ($colorset == 'slackr') if ($colorset == 'slackr')
$a->page['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n"; DI::page()['htmlhead'] .= '<link rel="stylesheet" href="view/theme/duepuntozero/deriv/slackr.css" type="text/css" media="screen" />'."\n";
} }
$a->page['htmlhead'] .= <<< EOT DI::page()['htmlhead'] .= <<< EOT
<script> <script>
function cmtBbOpen(comment, id) { function cmtBbOpen(comment, id) {
if ($(comment).hasClass('comment-edit-text-full')) { if ($(comment).hasClass('comment-edit-text-full')) {

View File

@ -8,6 +8,7 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\DI;
/** /**
* @brief Load page template in dependence of the template mode * @brief Load page template in dependence of the template mode
@ -22,7 +23,7 @@ function load_page(App $a)
require 'view/theme/frio/none.php'; require 'view/theme/frio/none.php';
} else { } else {
$template = 'view/theme/' . $a->getCurrentTheme() . '/' $template = 'view/theme/' . $a->getCurrentTheme() . '/'
. (($a->page['template'] ?? '') ?: 'default' ) . '.php'; . ((DI::page()['template'] ?? '') ?: 'default' ) . '.php';
if (file_exists($template)) { if (file_exists($template)) {
require_once $template; require_once $template;
} else { } else {

View File

@ -36,7 +36,7 @@ function frio_init(App $a)
// if the device is a mobile device set js is_mobile // if the device is a mobile device set js is_mobile
// variable so the js scripts can use this information // variable so the js scripts can use this information
if (DI::mode()->isMobile() || DI::mode()->isMobile()) { if (DI::mode()->isMobile() || DI::mode()->isMobile()) {
$a->page['htmlhead'] .= <<< EOT DI::page()['htmlhead'] .= <<< EOT
<script type="text/javascript"> <script type="text/javascript">
var is_mobile = 1; var is_mobile = 1;
</script> </script>
@ -45,7 +45,7 @@ EOT;
$enable_compose = \Friendica\Core\PConfig::get(local_user(), 'frio', 'enable_compose'); $enable_compose = \Friendica\Core\PConfig::get(local_user(), 'frio', 'enable_compose');
$compose = $enable_compose === '1' || $enable_compose === null && Config::get('frio', 'enable_compose') ? 1 : 0; $compose = $enable_compose === '1' || $enable_compose === null && Config::get('frio', 'enable_compose') ? 1 : 0;
$a->page['htmlhead'] .= <<< HTML DI::page()['htmlhead'] .= <<< HTML
<script type="text/javascript"> <script type="text/javascript">
var compose = $compose; var compose = $compose;
</script> </script>

View File

@ -9,8 +9,9 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
function quattro_init(App $a) { function quattro_init(App $a) {
$a->page['htmlhead'] .= '<script src="'.System::baseUrl().'/view/theme/quattro/tinycon.min.js"></script>'; DI::page()['htmlhead'] .= '<script src="'.System::baseUrl().'/view/theme/quattro/tinycon.min.js"></script>';
$a->page['htmlhead'] .= '<script src="'.System::baseUrl().'/view/theme/quattro/js/quattro.js"></script>';; DI::page()['htmlhead'] .= '<script src="'.System::baseUrl().'/view/theme/quattro/js/quattro.js"></script>';;
} }

View File

@ -13,6 +13,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
function smoothly_init(App $a) { function smoothly_init(App $a) {
Renderer::setActiveTemplateEngine('smarty3'); Renderer::setActiveTemplateEngine('smarty3');
@ -20,7 +21,7 @@ function smoothly_init(App $a) {
$cssFile = null; $cssFile = null;
$ssl_state = null; $ssl_state = null;
$baseurl = System::baseUrl($ssl_state); $baseurl = System::baseUrl($ssl_state);
$a->page['htmlhead'] .= <<< EOT DI::page()['htmlhead'] .= <<< EOT
<script> <script>
function cmtBbOpen(id) { function cmtBbOpen(id) {
@ -75,7 +76,7 @@ EOT;
/** custom css **/ /** custom css **/
if (!is_null($cssFile)) { if (!is_null($cssFile)) {
$a->page['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile); DI::page()['htmlhead'] .= sprintf('<link rel="stylesheet" type="text/css" href="%s" />', $cssFile);
} }
_js_in_foot(); _js_in_foot();
@ -85,12 +86,11 @@ if (! function_exists('_js_in_foot')) {
function _js_in_foot() { function _js_in_foot() {
/** @purpose insert stuff in bottom of page /** @purpose insert stuff in bottom of page
*/ */
$a = \get_app();
$ssl_state = null; $ssl_state = null;
$baseurl = System::baseUrl($ssl_state); $baseurl = System::baseUrl($ssl_state);
$bottom['$baseurl'] = $baseurl; $bottom['$baseurl'] = $baseurl;
$tpl = Renderer::getMarkupTemplate('bottom.tpl'); $tpl = Renderer::getMarkupTemplate('bottom.tpl');
return $a->page['bottom'] = Renderer::replaceMacros($tpl, $bottom); return DI::page()['bottom'] = Renderer::replaceMacros($tpl, $bottom);
} }
} }

View File

@ -33,17 +33,17 @@ function vier_init(App $a)
if (!empty($a->argv[0]) && ($a->argv[0] . ($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(); 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"; DI::page()['htmlhead'] .= "<link rel='stylesheet' type='text/css' href='view/theme/vier/wide.css' media='screen and (min-width: 1300px)'/>\n";
} }
if (DI::mode()->isMobile() || DI::mode()->isMobile()) { if (DI::mode()->isMobile() || DI::mode()->isMobile()) {
$a->page['htmlhead'] .= '<meta name=viewport content="width=device-width, initial-scale=1">'."\n"; DI::page()['htmlhead'] .= '<meta name=viewport content="width=device-width, initial-scale=1">'."\n";
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen"/>'."\n"; DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen"/>'."\n";
} }
/// @todo deactivated since it doesn't work with desktop browsers at the moment /// @todo deactivated since it doesn't work with desktop browsers at the moment
//$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen and (max-width: 1000px)"/>'."\n"; //DI::page()['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="view/theme/vier/mobile.css" media="screen and (max-width: 1000px)"/>'."\n";
$a->page['htmlhead'] .= <<< EOT DI::page()['htmlhead'] .= <<< EOT
<link rel='stylesheet' type='text/css' href='view/theme/vier/narrow.css' media='screen and (max-width: 1100px)' /> <link rel='stylesheet' type='text/css' href='view/theme/vier/narrow.css' media='screen and (max-width: 1100px)' />
<script type="text/javascript"> <script type="text/javascript">
function showThread(id) { function showThread(id) {
@ -65,7 +65,7 @@ function cmtBbClose(id) {
EOT; EOT;
if (DI::mode()->isMobile() || DI::mode()->isMobile()) { if (DI::mode()->isMobile() || DI::mode()->isMobile()) {
$a->page['htmlhead'] .= <<< EOT DI::page()['htmlhead'] .= <<< EOT
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$(".mobile-aside-toggle a").click(function(e){ $(".mobile-aside-toggle a").click(function(e){
@ -82,9 +82,9 @@ EOT;
// Hide the left menu bar // Hide the left menu bar
/// @TODO maybe move this static array out where it should belong? /// @TODO maybe move this static array out where it should belong?
if (empty($a->page['aside']) && in_array($a->argv[0], ["community", "events", "help", "delegation", "notifications", if (empty(DI::page()['aside']) && in_array($a->argv[0], ["community", "events", "help", "delegation", "notifications",
"probe", "webfinger", "login", "invite", "credits"])) { "probe", "webfinger", "login", "invite", "credits"])) {
$a->page['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />"; DI::page()['htmlhead'] .= "<link rel='stylesheet' href='view/theme/vier/hide.css' />";
} }
} }
@ -365,5 +365,5 @@ function vier_community_info()
//print right_aside //print right_aside
$tpl = Renderer::getMarkupTemplate('communityhome.tpl'); $tpl = Renderer::getMarkupTemplate('communityhome.tpl');
$a->page['right_aside'] = Renderer::replaceMacros($tpl, $aside); DI::page()['right_aside'] = Renderer::replaceMacros($tpl, $aside);
} }