/** * Returns the JS file content * * @param ContainerInterface $container Dependency injection container * @param ServerRequestInterface $request Request object * @param ResponseInterface $response Response object * @param array $args Associative list of route parameters * @return ResponseInterface $response Modified response object with generated output */ public static function fileAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) { $contents = ''; $files = array(); $aimeos = $container->get('aimeos'); $type = isset($args['type']) ? $args['type'] : 'js'; foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); $files = array_merge($files, $jsb2->getFiles($type)); } } foreach ($files as $file) { if (($content = file_get_contents($file)) !== false) { $contents .= $content; } } $response->getBody()->write($contents); if ($type === 'js') { $response = $response->withHeader('Content-Type', 'application/javascript'); } elseif ($type === 'css') { $response = $response->withHeader('Content-Type', 'text/css'); } return $response; }
/** * Returns the CSS/JS file content * * @return string CSS/JS files content */ public function fileAction() { $contents = ''; $files = array(); $type = $this->request->getArgument('type'); foreach (Base::getAimeos()->getCustomPaths('admin/jqadm') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); $files = array_merge($files, $jsb2->getFiles($type)); } } foreach ($files as $file) { if (($content = file_get_contents($file)) === false) { throw new \RuntimeException(sprintf('File "%1$s" not found', $jsbAbsPath)); } $contents .= $content; } if ($type === 'js') { $this->response->setHeader('Content-Type', 'application/javascript'); } elseif ($type === 'css') { $this->response->setHeader('Content-Type', 'text/css'); } return $contents; }
/** * Returns the JS file content * * @param $type File type, i.e. "css" or "js" * @return Response Response object */ public function fileAction($type) { $contents = ''; $files = array(); $aimeos = $this->get('aimeos')->get(); foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); $files = array_merge($files, $jsb2->getFiles($type)); } } foreach ($files as $file) { if (($content = file_get_contents($file)) !== false) { $contents .= $content; } } $response = new Response($contents); if ($type === 'js') { $response->headers->set('Content-Type', 'application/javascript'); } elseif ($type === 'css') { $response->headers->set('Content-Type', 'text/css'); } return $response; }
/** * Returns the JS file content * * @return \Illuminate\Http\Response Response object containing the generated output */ public function fileAction() { if (config('shop.authorize', true)) { $this->authorize('admin', [['admin', 'editor']]); } $contents = ''; $files = array(); $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get(); $type = Route::input('type', Input::get('type', 'js')); foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); $files = array_merge($files, $jsb2->getFiles($type)); } } foreach ($files as $file) { if (($content = file_get_contents($file)) !== false) { $contents .= $content; } } $response = response($contents); if ($type === 'js') { $response->header('Content-Type', 'application/javascript'); } elseif ($type === 'css') { $response->header('Content-Type', 'text/css'); } return $response; }
/** * Returns the JS file content * * @return \TYPO3\Flow\Http\Response Response object */ public function fileAction() { $files = array(); $aimeos = $this->aimeos->get(); $type = $this->request->getArgument('type'); foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); $files = array_merge($files, $jsb2->getFiles($type)); } } foreach ($files as $file) { if (($content = file_get_contents($file)) !== false) { $this->response->appendContent($content); } } if ($type === 'js') { $this->response->setHeader('Content-Type', 'application/javascript'); } elseif ($type === 'css') { $this->response->setHeader('Content-Type', 'text/css'); } }
/** * Returns the JS file content * * @return \Illuminate\Http\Response Response object containing the generated output */ public function fileAction() { if (config('shop.authorize', true)) { $this->authorize('admin', [['admin']]); } $contents = ''; $jsFiles = array(); $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get(); foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) { foreach ($paths as $path) { $jsbAbsPath = $base . '/' . $path; $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); } } foreach ($jsFiles as $file) { if (($content = file_get_contents($file)) !== false) { $contents .= $content; } } return response($contents)->header('Content-Type', 'application/javascript'); }