/** * Singleton private constructor * @param string $pluginPath */ private function __construct($pluginPath = null) { if (!is_string($pluginPath)) { $pluginPath = Globals::getPluginPath(); } $this->pluginPath = $pluginPath; }
/** * {@inheritDoc} */ public function onPreSerialize(PreSerializeEvent $event) { $model = $event->getObject(); Globals::setUploadDir($this->uploadDir); if ($model instanceof ImageInterface) { $model->generateThumbs($this->liipManager); } }
public function onKernelController(FilterControllerEvent $event) { if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { $controller = $event->getController(); $this->extension->setController($controller); if (is_array($controller)) { $controller = reset($controller); } if ($controller) { Globals::setHost($this->host); Globals::setApplicationDir($this->applicationDir); Globals::setEnv($this->environment); Globals::setUploadDir($this->uploadDir); Globals::setPluginPath($this->pluginPath); } } return $event; }
/** * Read plugins from the directory * * @Annotations\Delete("/cache") * @ApiDoc( * description = "Clear the application cache.", * resource = false, * statusCodes = { * 200 = "Returned when cache has been cleared" * } * ) * * @return View */ public function cacheClearAction() { $this->checkIsAdmin(); $kernel = $this->get('kernel'); $application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel); $application->setAutoExit(false); $options = array('command' => 'cache:clear', "--env" => Globals::getEnv(), '--no-warmup' => true); return new JsonResponse(['cache' => $application->run(new \Symfony\Component\Console\Input\ArrayInput($options))]); }
/** * Get the image url * * @param boolean $absolute Absolute url * @return string * @JMS\VirtualProperty * @JMS\SerializedName("url") */ public function getUrl($absolute = true) { $url = Globals::getUploadDir(false) . '/' . $this->folder . ($this->folder ? '/' : '') . $this->filename; if ($absolute) { $url = Globals::getHost() . $url; } return $url; }