public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     global $IP;
     if (strpos($this->mOid, '..') !== false) {
         throw new Exception('File path must not contain \'..\'.');
     }
     if (endsWith($this->mOid, '.js', false)) {
         $this->mContentType = AssetsManager::TYPE_JS;
     } else {
         if (endsWith($this->mOid, '.css', false)) {
             $this->mContentType = AssetsManager::TYPE_CSS;
         } else {
             throw new Exception('Requested file must be .css or .js.');
         }
     }
     $filePath = $IP . '/' . $this->mOid;
     if (file_exists($filePath)) {
         $this->mContent = file_get_contents($filePath);
     } else {
         $requestDetails = AssetsManager::getRequestDetails();
         Wikia::log(__METHOD__, false, "file '{$filePath}' doesn't exist ({$requestDetails})", true);
         throw new Exception('File does not exist');
     }
 }
 public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     if (strpos($this->mOid, '..') !== false) {
         throw new Exception('File path must not contain \'..\'.');
     }
     if (!endsWith($this->mOid, '.scss', false)) {
         throw new Exception('Requested file must be .scss.');
     }
     //remove slashes at the beginning of the string, we need a pure relative path to open the file
     $this->mOid = preg_replace('/^[\\/]+/', '', $this->mOid);
     $this->mContentType = AssetsManager::TYPE_CSS;
 }
 public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     global $IP, $wgUser;
     $ac = new AssetsConfig();
     $assets = $ac->resolve($this->mOid, true, !isset($this->mParams['minify']) || $this->mParams['minify'] == true, $this->mParams);
     $this->mContentType = $ac->getGroupType($this->mOid);
     foreach ($assets as $asset) {
         // reference to a file to be fetched by the browser from external server (BugId:9522)
         if (substr($asset, 0, 10) == '#external_') {
             // do nothing
         } else {
             if (Http::isValidURI($asset)) {
                 $params = array();
                 $url = parse_url($asset);
                 if (isset($url['query'])) {
                     parse_str($url['query'], $params);
                 }
                 // Start checking the url to see if it is something we care about (BugId:30188)
                 if (isset($params['action']) && $params['action'] == 'raw' && isset($params['gen']) && $params['gen'] == 'js') {
                     //$this->mContent .= RequestContext::getMain()->getSkin()->generateUserJs(); // FIXME
                 } else {
                     if (isset($params['action']) && $params['action'] == 'raw' && isset($params['gen']) && $params['gen'] == 'css') {
                         //$this->mContent .= RequestContext::getMain()->getSkin()->generateUserStylesheet(); // FIXME
                     } else {
                         //Debug added on May 4, 2012 to inquire external requests spikes
                         $start = microtime(true);
                         $this->mContent .= HTTP::get($asset);
                         $totalTime = microtime(true) - $start;
                         if ($totalTime >= 1) {
                             Wikia::log(__METHOD__, false, "oid: {$this->mOid}, totalTime: {$totalTime}, asset: {$asset}, referrer: {$_SERVER['HTTP_REFERER']}, entrypoint: {$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}", true);
                         }
                     }
                 }
             } else {
                 $this->mContent .= file_get_contents($IP . '/' . $asset);
             }
         }
         if ($this->mContentType == AssetsManager::TYPE_JS) {
             // add semicolon to separate concatenated files (BugId:20272)
             // but only for JS (BugId:20824)
             $this->mContent .= ";\n";
         }
     }
     // For RTE only
     // TODO: add "filters" definitions to config.php
     if ($this->mOid == 'rte' || $this->mOid == 'eplrte' || $this->mOid == 'mini_editor_rte_js') {
         $this->mContent = preg_replace('#^.*@Packager\\.RemoveLine.*$#m', '', $this->mContent);
         $this->mContent = str_replace("", '', $this->mContent);
     }
 }
 public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     $groups = explode(',', $this->mOid);
     foreach ($groups as $groupName) {
         // fake request to a group
         $groupRequest = new WebRequest();
         $groupRequest->setVal('type', 'group');
         $groupRequest->setVal('oid', $groupName);
         $builder = new AssetsManagerGroupBuilder($groupRequest);
         $this->mContent .= "\n\n" . $builder->getContent();
         $this->mContentType = $builder->getContentType();
     }
 }
 public function __construct(WebRequest $request)
 {
     parent::__construct($request);
     $files = explode(',', $this->mOid);
     foreach ($files as $file) {
         // fake single SASS file request
         $sassRequest = new WebRequest();
         $sassRequest->setVal('type', 'sass');
         $sassRequest->setVal('oid', $file);
         $builder = new AssetsManagerSassBuilder($sassRequest);
         $this->mContent .= "\n\n/* {$file} */\n" . $builder->getContent();
     }
     $this->mContentType = AssetsManager::TYPE_CSS;
 }
 public function __construct(WebRequest $request)
 {
     global $IP;
     parent::__construct($request);
     // TODO: the background image shouldn't be passed as the url - we should pass a File reference and derive ourselves
     if (isset($this->mParams['background-image']) && VignetteRequest::isVignetteUrl($this->mParams['background-image']) && isset($this->mParams['path-prefix'])) {
         $connector = strpos($this->mParams['background-image'], '?') === false ? '?' : '&';
         $this->mParams['background-image'] .= "{$connector}path-prefix={$this->mParams['path-prefix']}";
     }
     if (strpos($this->mOid, '..') !== false) {
         throw new Exception('File path must not contain \'..\'.');
     }
     if (!endsWith($this->mOid, '.scss', false)) {
         throw new Exception('Requested file must be .scss.');
     }
     //remove slashes at the beginning of the string, we need a pure relative path to open the file
     $this->mOid = preg_replace('/^[\\/]+/', '', $this->mOid);
     if (!file_exists("{$IP}/{$this->mOid}")) {
         throw new Exception("File {$this->mOid} does not exist!");
     }
     $this->mContentType = AssetsManager::TYPE_CSS;
 }