diff --git a/include/conversation.php b/include/conversation.php index bf1f5645b1..6ded55eec6 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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'), []) : ''; $tpl = Renderer::getMarkupTemplate('jot-header.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$newpost' => 'true', '$baseurl' => System::baseUrl(true), '$geotag' => $geotag, diff --git a/mod/api.php b/mod/api.php index 842c1a74dc..68308d3a62 100644 --- a/mod/api.php +++ b/mod/api.php @@ -50,7 +50,7 @@ function api_content(App $a) * 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 try { diff --git a/mod/cal.php b/mod/cal.php index 62508fbef7..f7fe2435d0 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -67,12 +67,12 @@ function cal_init(App $a) $cal_widget = Widget\CalendarExport::getHTML(); - if (empty($a->page['aside'])) { - $a->page['aside'] = ''; + if (empty(DI::page()['aside'])) { + DI::page()['aside'] = ''; } - $a->page['aside'] .= $vcard_widget; - $a->page['aside'] .= $cal_widget; + DI::page()['aside'] .= $vcard_widget; + DI::page()['aside'] .= $cal_widget; return; } @@ -85,7 +85,7 @@ function cal_content(App $a) $i18n = Event::getStrings(); $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'], '$modparams' => 2, '$i18n' => $i18n, diff --git a/mod/common.php b/mod/common.php index c66da03850..6ad531d071 100644 --- a/mod/common.php +++ b/mod/common.php @@ -41,7 +41,7 @@ function common_content(App $a) $contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['id' => $cid, 'uid' => $uid]); if (DBA::isResult($contact)) { - $a->page['aside'] = ""; + DI::page()['aside'] = ""; Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"])); } } else { @@ -54,10 +54,10 @@ function common_content(App $a) 'url' => 'contact/' . $cid ]); - if (empty($a->page['aside'])) { - $a->page['aside'] = ''; + if (empty(DI::page()['aside'])) { + DI::page()['aside'] = ''; } - $a->page['aside'] .= $vcard_widget; + DI::page()['aside'] .= $vcard_widget; } } diff --git a/mod/community.php b/mod/community.php index 461dd2f9e0..22c1c5d76e 100644 --- a/mod/community.php +++ b/mod/community.php @@ -127,7 +127,7 @@ function community_content(App $a, $update = 0) 'default_location' => $a->user['default-location'], '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'), - 'acl' => ACL::getFullSelectorHTML($a->page, $a->user, true), + 'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true), 'bang' => '', 'visitor' => 'block', 'profile_uid' => local_user(), @@ -193,12 +193,12 @@ function community_content(App $a, $update = 0) $o .= $pager->renderMinimal(count($r)); } - if (empty($a->page['aside'])) { - $a->page['aside'] = ''; + if (empty(DI::page()['aside'])) { + DI::page()['aside'] = ''; } if (Feature::isEnabled(local_user(), 'trending_tags')) { - $a->page['aside'] .= TrendingTags::getHTML($content); + DI::page()['aside'] .= TrendingTags::getHTML($content); } $t = Renderer::getMarkupTemplate("community.tpl"); diff --git a/mod/crepair.php b/mod/crepair.php index b9b8651439..ad90c9f7a9 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -10,6 +10,7 @@ use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model; use Friendica\Module; use Friendica\Util\Strings; @@ -103,8 +104,8 @@ function crepair_content(App $a) return; } - if (empty($a->page['aside'])) { - $a->page['aside'] = ''; + if (empty(DI::page()['aside'])) { + DI::page()['aside'] = ''; } if (DBA::isResult($contact)) { diff --git a/mod/display.php b/mod/display.php index fa2127aaec..f4274caeae 100644 --- a/mod/display.php +++ b/mod/display.php @@ -239,7 +239,7 @@ function display_content(App $a, $update = false, $update_uid = 0) $conversation = ''; } - $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'), + DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('display-head.tpl'), ['$alternate' => $alternate, '$conversation' => $conversation]); @@ -281,7 +281,7 @@ function display_content(App $a, $update = false, $update_uid = 0) 'default_location' => $a->user['default-location'], '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'), - 'acl' => ACL::getFullSelectorHTML($a->page, $a->user, true), + 'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true), 'bang' => '', 'visitor' => 'block', '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 $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']]])) { - $a->page['htmlhead'] .= '' . "\n"; + $page['htmlhead'] .= '' . "\n"; } - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; + DI::page()['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; // Schema.org microdata - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; // Twitter cards - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; // Dublin Core - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; // Open Graph - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; - $a->page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; + $page['htmlhead'] .= ''."\n"; // article:tag return $o; diff --git a/mod/editpost.php b/mod/editpost.php index 690cb2ac0d..b6ed782463 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -9,6 +9,7 @@ use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\FileTag; use Friendica\Model\Item; @@ -47,7 +48,7 @@ function editpost_content(App $a) ]); $tpl = Renderer::getMarkupTemplate('jot-header.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$ispublic' => ' ', // L10n::t('Visible to everybody'), '$geotag' => $geotag, '$nickname' => $a->user['nickname'] diff --git a/mod/events.php b/mod/events.php index 245ee34b30..8984e99561 100644 --- a/mod/events.php +++ b/mod/events.php @@ -37,13 +37,13 @@ function events_init(App $a) return; } - if (empty($a->page['aside'])) { - $a->page['aside'] = ''; + if (empty(DI::page()['aside'])) { + DI::page()['aside'] = ''; } $cal_widget = CalendarExport::getHTML(); - $a->page['aside'] .= $cal_widget; + DI::page()['aside'] .= $cal_widget; return; } @@ -242,7 +242,7 @@ function events_content(App $a) $i18n = Event::getStrings(); $htpl = Renderer::getMarkupTemplate('event_head.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($htpl, [ + DI::page()['htmlhead'] .= Renderer::replaceMacros($htpl, [ '$module_url' => '/events', '$modparams' => 1, '$i18n' => $i18n, @@ -384,10 +384,10 @@ function events_content(App $a) } // ACL blocks are loaded in modals in frio - $a->page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js')); - $a->page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js')); - $a->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); - $a->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); + DI::page()->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js')); + DI::page()->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js')); + DI::page()->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); + DI::page()->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); $o = Renderer::replaceMacros($tpl, [ '$tabs' => $tabs, @@ -489,7 +489,7 @@ function events_content(App $a) $fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00'; 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 { $acl = ''; } diff --git a/mod/follow.php b/mod/follow.php index 94db3ad38d..99601e7592 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -184,7 +184,7 @@ function follow_content(App $a) '$keywords_label'=> L10n::t('Tags:') ]); - $a->page['aside'] = ''; + DI::page()['aside'] = ''; $profiledata = Contact::getDetailsByURL($ret['url']); if ($profiledata) { diff --git a/mod/match.php b/mod/match.php index 189210f4b5..ae7cf73baa 100644 --- a/mod/match.php +++ b/mod/match.php @@ -36,8 +36,8 @@ function match_content(App $a) return ''; } - $a->page['aside'] .= Widget::findPeople(); - $a->page['aside'] .= Widget::follow(); + DI::page()['aside'] .= Widget::findPeople(); + DI::page()['aside'] .= Widget::follow(); $_SESSION['return_path'] = DI::args()->getCommand(); diff --git a/mod/message.php b/mod/message.php index f10ff76b92..5c84838965 100644 --- a/mod/message.php +++ b/mod/message.php @@ -38,14 +38,14 @@ function message_init(App $a) ]; $tpl = Renderer::getMarkupTemplate('message_side.tpl'); - $a->page['aside'] = Renderer::replaceMacros($tpl, [ + DI::page()['aside'] = Renderer::replaceMacros($tpl, [ '$tabs' => $tabs, '$new' => $new, ]); $base = System::baseUrl(); $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), '$base' => $base ]); @@ -199,7 +199,7 @@ function message_content(App $a) $o .= $header; $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], '$linkurl' => L10n::t('Please enter a link URL:') @@ -355,7 +355,7 @@ function message_content(App $a) } $tpl = Renderer::getMarkupTemplate('msg-header.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $a->user['nickname'], '$linkurl' => L10n::t('Please enter a link URL:') diff --git a/mod/network.php b/mod/network.php index be121540c1..0308e4a10e 100644 --- a/mod/network.php +++ b/mod/network.php @@ -132,16 +132,16 @@ function network_init(App $a) } } - if (empty($a->page['aside'])) { - $a->page['aside'] = ''; + if (empty(DI::page()['aside'])) { + DI::page()['aside'] = ''; } - $a->page['aside'] .= Group::sidebarWidget('network/0', 'network', 'standard', $group_id); - $a->page['aside'] .= ForumManager::widget(local_user(), $cid); - $a->page['aside'] .= Widget::postedByYear('network', local_user(), false); - $a->page['aside'] .= Widget::networks('network', $_GET['nets'] ?? ''); - $a->page['aside'] .= Widget\SavedSearches::getHTML(DI::args()->getQueryString()); - $a->page['aside'] .= Widget::fileAs('network', $_GET['file'] ?? ''); + DI::page()['aside'] .= Group::sidebarWidget('network/0', 'network', 'standard', $group_id); + DI::page()['aside'] .= ForumManager::widget(local_user(), $cid); + DI::page()['aside'] .= Widget::postedByYear('network', local_user(), false); + DI::page()['aside'] .= Widget::networks('network', $_GET['nets'] ?? ''); + DI::page()['aside'] .= Widget\SavedSearches::getHTML(DI::args()->getQueryString()); + 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['deny_cid']) || strlen($a->user['deny_gid'])) ? 'lock' : 'unlock'), 'default_perms' => ACL::getDefaultUserPermissions($a->user), - 'acl' => ACL::getFullSelectorHTML($a->page, $a->user, true), + 'acl' => ACL::getFullSelectorHTML(DI::page(), $a->user, true), 'bang' => '', 'visitor' => 'block', '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['deny_cid']) || strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'), '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) ? '!' : ''), 'visitor' => 'block', 'profile_uid' => local_user(), diff --git a/mod/ostatus_subscribe.php b/mod/ostatus_subscribe.php index f112a2ef91..ec79f87e50 100644 --- a/mod/ostatus_subscribe.php +++ b/mod/ostatus_subscribe.php @@ -25,8 +25,6 @@ function ostatus_subscribe_content(App $a) $uid = local_user(); - $a = \get_app(); - $counter = intval($_REQUEST['counter']); if (PConfig::get($uid, 'ostatus', 'legacy_friends') == '') { @@ -65,7 +63,7 @@ function ostatus_subscribe_content(App $a) $total = sizeof($friends); if ($counter >= $total) { - $a->page['htmlhead'] = ''; + DI::page()['htmlhead'] = ''; PConfig::delete($uid, 'ostatus', 'legacy_friends'); PConfig::delete($uid, 'ostatus', 'legacy_contact'); $o .= L10n::t('Done'); @@ -94,7 +92,7 @@ function ostatus_subscribe_content(App $a) $o .= '
' . L10n::t('Keep this window open until done.') . '
'; - $a->page['htmlhead'] = ''; + DI::page()['htmlhead'] = ''; return $o; } diff --git a/mod/photos.php b/mod/photos.php index a0a1be9327..fde2d6c897 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -116,19 +116,19 @@ function photos_init(App $a) { ]); } - if (empty($a->page['aside'])) { - $a->page['aside'] = ''; + if (empty(DI::page()['aside'])) { + DI::page()['aside'] = ''; } - $a->page['aside'] .= $vcard_widget; + DI::page()['aside'] .= $vcard_widget; if (!empty($photo_albums_widget)) { - $a->page['aside'] .= $photo_albums_widget; + DI::page()['aside'] .= $photo_albums_widget; } $tpl = Renderer::getMarkupTemplate("photos_head.tpl"); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl,[ '$ispublic' => L10n::t('everybody') ]); } @@ -957,7 +957,7 @@ function photos_content(App $a) $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,[ '$pagename' => L10n::t('Upload Photos'), @@ -1198,7 +1198,7 @@ function photos_content(App $a) } $tpl = Renderer::getMarkupTemplate('photo_edit_head.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl,[ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl,[ '$prevlink' => $prevlink, '$nextlink' => $nextlink ]); @@ -1325,7 +1325,7 @@ function photos_content(App $a) $album_e = $ph[0]['album']; $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, [ '$id' => $ph[0]['id'], @@ -1527,11 +1527,11 @@ function photos_content(App $a) '$paginate' => $paginate, ]); - $a->page['htmlhead'] .= "\n" . '' . "\n"; - $a->page['htmlhead'] .= '' . "\n"; - $a->page['htmlhead'] .= '' . "\n"; - $a->page['htmlhead'] .= '' . "\n"; - $a->page['htmlhead'] .= '' . "\n"; + DI::page()['htmlhead'] .= "\n" . '' . "\n"; + DI::page()['htmlhead'] .= '' . "\n"; + DI::page()['htmlhead'] .= '' . "\n"; + DI::page()['htmlhead'] .= '' . "\n"; + DI::page()['htmlhead'] .= '' . "\n"; return $o; } diff --git a/mod/poke.php b/mod/poke.php index 69fd42c72c..9a0e50362e 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -20,6 +20,7 @@ use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Item; use Friendica\Protocol\Activity; use Friendica\Util\Strings; @@ -156,7 +157,7 @@ function poke_content(App $a) $id = $contact['id']; $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), ]); diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 6d625cedeb..e04062a4d5 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -167,7 +167,7 @@ function profile_photo_post(App $a) $ph->orient($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']); } @@ -228,7 +228,7 @@ function profile_photo_content(App $a) } $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 } @@ -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'); 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 = [ 'hash' => $hash, diff --git a/mod/profiles.php b/mod/profiles.php index 18fe636d3d..13e92b054e 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -513,7 +513,7 @@ function profiles_content(App $a) { 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), ]); diff --git a/mod/repair_ostatus.php b/mod/repair_ostatus.php index f1a86e6b23..30ad1476ca 100644 --- a/mod/repair_ostatus.php +++ b/mod/repair_ostatus.php @@ -60,7 +60,7 @@ function repair_ostatus_content(App $a) { Contact::createFromProbe($uid, $r[0]["url"], true); - $a->page['htmlhead'] = ''; + DI::page()['htmlhead'] = ''; return $o; } diff --git a/mod/settings.php b/mod/settings.php index 5f28ca6d29..9e47b3d2e1 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -56,7 +56,7 @@ function settings_init(App $a) // These lines provide the javascript needed by the acl selector $tpl = Renderer::getMarkupTemplate('settings/head.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$ispublic' => L10n::t('everybody') ]); @@ -143,7 +143,7 @@ function settings_init(App $a) $tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl"); - $a->page['aside'] = Renderer::replaceMacros($tabtpl, [ + DI::page()['aside'] = Renderer::replaceMacros($tabtpl, [ '$title' => L10n::t('Settings'), '$class' => 'settings-widget', '$items' => $tabs, @@ -787,7 +787,7 @@ function settings_content(App $a) if (!empty($legacy_contact)) { /// @todo Isn't it supposed to be a $a->internalRedirect() call? - $a->page['htmlhead'] = ''; + DI::page()['htmlhead'] = ''; } $settings_connectors = ''; @@ -1203,7 +1203,7 @@ function settings_content(App $a) '$permissions' => L10n::t('Default Post Permissions'), '$permdesc' => L10n::t("\x28click to open/close\x29"), '$visibility' => $profile['net-publish'], - '$aclselect' => ACL::getFullSelectorHTML($a->page, $a->user), + '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user), '$suggestme' => $suggestme, '$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, ''), diff --git a/mod/suggest.php b/mod/suggest.php index 15370d25a9..aab313366b 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -43,8 +43,8 @@ function suggest_content(App $a) $_SESSION['return_path'] = DI::args()->getCommand(); - $a->page['aside'] .= Widget::findPeople(); - $a->page['aside'] .= Widget::follow(); + DI::page()['aside'] .= Widget::findPeople(); + DI::page()['aside'] .= Widget::follow(); $r = GContact::suggestionQuery(local_user()); diff --git a/mod/unfollow.php b/mod/unfollow.php index c7ad413d22..9f9ebdf593 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -142,7 +142,7 @@ function unfollow_content(App $a) '$keywords_label'=> '' ]); - $a->page['aside'] = ''; + DI::page()['aside'] = ''; Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url'])); $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]); diff --git a/mod/videos.php b/mod/videos.php index b6f6b1d8e7..2c21be0cc8 100644 --- a/mod/videos.php +++ b/mod/videos.php @@ -58,14 +58,14 @@ function videos_init(App $a) ]); // If not there, create 'aside' empty - if (!isset($a->page['aside'])) { - $a->page['aside'] = ''; + if (!isset(DI::page()['aside'])) { + DI::page()['aside'] = ''; } - $a->page['aside'] .= $vcard_widget; + DI::page()['aside'] .= $vcard_widget; $tpl = Renderer::getMarkupTemplate("videos_head.tpl"); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl); + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl); } return; diff --git a/mod/wallmessage.php b/mod/wallmessage.php index eaa3174f4a..e9e9057455 100644 --- a/mod/wallmessage.php +++ b/mod/wallmessage.php @@ -118,7 +118,7 @@ function wallmessage_content(App $a) { } $tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl'); - $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [ + DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ '$baseurl' => System::baseUrl(true), '$nickname' => $user['nickname'], '$linkurl' => L10n::t('Please enter a link URL:') diff --git a/src/App.php b/src/App.php index 71b64bdb64..4a62031381 100644 --- a/src/App.php +++ b/src/App.php @@ -40,10 +40,6 @@ use Psr\Log\LoggerInterface; */ class App { - /** - * @var Page The current page environment - */ - public $page; public $profile; public $profile_uid; public $user; @@ -154,7 +150,7 @@ class App * @param App\Arguments $args The Friendica Arguments of the call * @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->config = $config; @@ -168,7 +164,6 @@ class App $this->argv = $args->getArgv(); $this->argc = $args->getArgc(); - $this->page = $page; $this->load(); } @@ -435,10 +430,11 @@ class App * @param App\Router $router * @param IPConfiguration $pconfig * @param Authentication $auth The Authentication backend of the node + * @param App\Page $page The Friendica page printing container * @throws HTTPException\InternalServerErrorException * @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(); @@ -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 - $this->page['page_title'] = $moduleName; + $page['page_title'] = $moduleName; // 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) @@ -579,7 +575,7 @@ class App 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); } /** diff --git a/src/Content/Widget.php b/src/Content/Widget.php index b1e925a662..25c159a5ce 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -13,6 +13,7 @@ use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Session; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\FileTag; use Friendica\Model\GContact; @@ -49,13 +50,12 @@ class Widget */ public static function findPeople() { - $a = \get_app(); $global_dir = Config::get('system', 'directory'); if (Config::get('system', 'invitation_only')) { $x = intval(PConfig::get(local_user(), 'system', 'invites_remaining')); if ($x || is_site_admin()) { - $a->page['aside'] .= '