[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Delivers CSS and JS resources to the browser. This controller handles all 5 * `/res/` requests, and manages caching, package construction, and resource 6 * preprocessing. 7 */ 8 final class CelerityPhabricatorResourceController 9 extends CelerityResourceController { 10 11 private $path; 12 private $hash; 13 private $library; 14 15 public function getCelerityResourceMap() { 16 return CelerityResourceMap::getNamedInstance($this->library); 17 } 18 19 public function willProcessRequest(array $data) { 20 $this->path = $data['path']; 21 $this->hash = $data['hash']; 22 $this->library = $data['library']; 23 } 24 25 public function processRequest() { 26 // Check that the resource library exists before trying to serve resources 27 // from it. 28 try { 29 $this->getCelerityResourceMap(); 30 } catch (Exception $ex) { 31 return new Aphront400Response(); 32 } 33 34 return $this->serveResource($this->path); 35 } 36 37 protected function buildResourceTransformer() { 38 $minify_on = PhabricatorEnv::getEnvConfig('celerity.minify'); 39 $developer_on = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); 40 41 $should_minify = ($minify_on && !$developer_on); 42 43 return id(new CelerityResourceTransformer()) 44 ->setMinify($should_minify) 45 ->setCelerityMap($this->getCelerityResourceMap()); 46 } 47 48 }
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 |