private function getOptions($templatesFolder) { $kernel = $this->container->get('kernel'); $deployBundle = $this->container->getParameter('red_kite_labs_theme_engine.deploy_bundle'); $deployBundleAsset = new Asset($kernel, $deployBundle, $this->container->getParameter('red_kite_labs_theme_engine.web_path')); $deployBundlePath = $deployBundleAsset->getRealPath(); $viewsDir = $deployBundlePath . '/Resources/views'; return array("deployBundle" => $deployBundle, "configDir" => $deployBundlePath . '/' . $this->container->getParameter('red_kite_cms.deploy_bundle.config_dir'), "assetsDir" => $deployBundlePath . '/' . $this->container->getParameter('red_kite_cms.deploy_bundle.assets_base_dir'), "viewsDir" => $viewsDir, "templatesDir" => $templatesFolder, "deployDir" => $viewsDir . '/' . $templatesFolder, "uploadAssetsFullPath" => $this->container->getParameter('red_kite_cms.upload_assets_full_path'), "uploadAssetsAbsolutePath" => AssetsPath::getAbsoluteUploadFolder($this->container), "deployBundleAssetsPath" => "/" . $deployBundleAsset->getAbsolutePath(), "deployController" => $this->container->getParameter('red_kite_cms.deploy_bundle.controller'), "webFolderPath" => $this->container->getParameter('red_kite_cms.web_folder_full_path'), "websiteUrl" => $this->container->getParameter('red_kite_cms.website_url'), "credits" => $this->container->getParameter('red_kite_cms.love'), "kernelDir" => $kernel->getRootDir()); }
/** * {@inheritdoc} */ protected function generateOptions($folder, $rootAlias) { $assetsPath = $this->container->getParameter('red_kite_cms.upload_assets_full_path') . '/' . $folder; if (!is_dir($assetsPath)) { @mkdir($assetsPath); } $request = $this->container->get('request'); $options = array('locale' => '', 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $assetsPath, 'URL' => '/' . AssetsPath::getUploadFolder($this->container) . '/' . $folder, 'accessControl' => 'access', 'rootAlias' => $rootAlias))); return $options; }
private function addImage($values) { $images = $this->decodeImages(); $savedImages = $this->fetchImagesBySrcAttribute($images); $file = $values["AddFile"]; $imageFile = "/" . AssetsPath::getUploadFolder($this->container) . "/" . preg_replace('/http?:\\/\\/[^\\/]+/', '', $file); if (in_array($imageFile, $savedImages)) { throw new RuntimeException('exception_file_already_added'); } $images[]['image'] = $imageFile; return json_encode($images); }