[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * This is a bare HTML page view which has access to Phabricator page 5 * infrastructure like Celerity, but no content or builtin static resources. 6 * You basically get a valid HMTL5 document and an empty body tag. 7 * 8 * @concrete-extensible 9 */ 10 class PhabricatorBarePageView extends AphrontPageView { 11 12 private $request; 13 private $controller; 14 private $frameable; 15 private $deviceReady; 16 17 private $bodyContent; 18 19 public function setController(AphrontController $controller) { 20 $this->controller = $controller; 21 return $this; 22 } 23 24 public function getController() { 25 return $this->controller; 26 } 27 28 public function setRequest(AphrontRequest $request) { 29 $this->request = $request; 30 return $this; 31 } 32 33 public function getRequest() { 34 return $this->request; 35 } 36 37 public function setFrameable($frameable) { 38 $this->frameable = $frameable; 39 return $this; 40 } 41 42 public function getFrameable() { 43 return $this->frameable; 44 } 45 46 public function setDeviceReady($device_ready) { 47 $this->deviceReady = $device_ready; 48 return $this; 49 } 50 51 public function getDeviceReady() { 52 return $this->deviceReady; 53 } 54 55 protected function willRenderPage() { 56 // We render this now to resolve static resources so they can appear in the 57 // document head. 58 $this->bodyContent = phutil_implode_html('', $this->renderChildren()); 59 } 60 61 protected function getHead() { 62 $framebust = null; 63 if (!$this->getFrameable()) { 64 $framebust = '(top == self) || top.location.replace(self.location.href);'; 65 } 66 67 $viewport_tag = null; 68 if ($this->getDeviceReady()) { 69 $viewport_tag = phutil_tag( 70 'meta', 71 array( 72 'name' => 'viewport', 73 'content' => 'width=device-width, '. 74 'initial-scale=1, '. 75 'maximum-scale=1', 76 )); 77 } 78 $icon_tag_76 = phutil_tag( 79 'link', 80 array( 81 'rel' => 'apple-touch-icon', 82 'href' => celerity_get_resource_uri( 83 '/rsrc/favicons/apple-touch-icon-76x76.png'), 84 )); 85 86 $icon_tag_120 = phutil_tag( 87 'link', 88 array( 89 'rel' => 'apple-touch-icon', 90 'sizes' => '120x120', 91 'href' => celerity_get_resource_uri( 92 '/rsrc/favicons/apple-touch-icon-120x120.png'), 93 )); 94 95 $icon_tag_152 = phutil_tag( 96 'link', 97 array( 98 'rel' => 'apple-touch-icon', 99 'sizes' => '152x152', 100 'href' => celerity_get_resource_uri( 101 '/rsrc/favicons/apple-touch-icon-152x152.png'), 102 )); 103 104 $apple_tag = phutil_tag( 105 'meta', 106 array( 107 'name' => 'apple-mobile-web-app-status-bar-style', 108 'content' => 'black-translucent', 109 )); 110 111 $referrer_tag = phutil_tag( 112 'meta', 113 array( 114 'name' => 'referrer', 115 'content' => 'never', 116 )); 117 118 $response = CelerityAPI::getStaticResourceResponse(); 119 120 $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); 121 return hsprintf( 122 '%s%s%s%s%s%s%s%s', 123 $viewport_tag, 124 $icon_tag_76, 125 $icon_tag_120, 126 $icon_tag_152, 127 $apple_tag, 128 $referrer_tag, 129 CelerityStaticResourceResponse::renderInlineScript( 130 $framebust.jsprintf('window.__DEV__=%d;', ($developer ? 1 : 0))), 131 $response->renderResourcesOfType('css')); 132 } 133 134 protected function getBody() { 135 return $this->bodyContent; 136 } 137 138 protected function getTail() { 139 $response = CelerityAPI::getStaticResourceResponse(); 140 return $response->renderResourcesOfType('js'); 141 } 142 143 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |