@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add HTML header for Atom/RSS discovery on Phame blog pages

Summary:
Allow easier discovery and subscribing to Atom feeds of Phame blogs.

To be extra cautious, also make sure that the added line is a `PhutilSafeHTML`.

Original author: @20after4

Closes T15550

Test Plan: Go to `/phame/blog/view/1/` and check the HTML source code. See an additional `<link>` item with `type="application/atom+xml"` in the `<head>` section.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, 20after4, Cigaryno

Maniphest Tasks: T15550

Differential Revision: https://we.phorge.it/D25346

+33 -1
+9
src/applications/phame/controller/blog/PhameBlogViewController.php
··· 117 117 $about, 118 118 )); 119 119 120 + $page->addHeadItem(phutil_tag( 121 + 'link', 122 + array( 123 + 'rel' => 'alternate', 124 + 'type' => 'application/atom+xml', 125 + 'href' => $blog->getFeedURI(), 126 + 'title' => $blog->getName(), 127 + ))); 128 + 120 129 return $page; 121 130 } 122 131
+9
src/applications/phame/storage/PhameBlog.php
··· 200 200 return '/phame/blog/manage/'.$this->getID().'/'; 201 201 } 202 202 203 + /** 204 + * Get relative URI of Phame blog feed. 205 + * 206 + * @return string Relative URI of Phame blog feed 207 + */ 208 + public function getFeedURI() { 209 + return '/phame/blog/feed/'.$this->getID().'/'; 210 + } 211 + 203 212 public function getProfileImageURI() { 204 213 return $this->getProfileImageFile()->getBestURI(); 205 214 }
+15 -1
src/view/page/PhabricatorStandardPageView.php
··· 23 23 private $crumbs; 24 24 private $navigation; 25 25 private $footer; 26 + private $headItems = array(); 26 27 27 28 public function setShowFooter($show_footer) { 28 29 $this->showFooter = $show_footer; ··· 375 376 } 376 377 377 378 379 + /** 380 + * Insert a HTML element into <head> of the page to render. 381 + * Used by PhameBlogViewController. 382 + * 383 + * @param PhutilSafeHTML HTML header to add 384 + */ 385 + public function addHeadItem($html) { 386 + if ($html instanceof PhutilSafeHTML) { 387 + $this->headItems[] = $html; 388 + } 389 + } 390 + 378 391 protected function getHead() { 379 392 $monospaced = null; 380 393 ··· 407 420 } 408 421 409 422 return hsprintf( 410 - '%s%s%s', 423 + '%s%s%s%s', 411 424 parent::getHead(), 412 425 $font_css, 426 + phutil_implode_html('', $this->headItems), 413 427 $response->renderSingleResource('javelin-magical-init', 'phabricator')); 414 428 } 415 429