/** * @param bool $arrayKeys * * @return array|mixed */ private static function getActiveBricks($arrayKeys = TRUE) { $areaElements = ExtensionManager::getBrickConfigs(); /** * @var String $areaElementName * @var \Zend_Config_Xml $areaElementData */ foreach ($areaElements as $areaElementName => $areaElementData) { if (!ExtensionManager::isEnabled('brick', $areaElementName)) { unset($areaElements[$areaElementName]); continue; } } if ($arrayKeys === TRUE) { return array_keys($areaElements); } return $areaElements; }
/** * @param \Zend_Controller_Request_Abstract $request */ public function postDispatch(\Zend_Controller_Request_Abstract $request) { $conf = Config::getSystemConfig(); // add scripts to editmode if (\Pimcore\Tool\Admin::isExtJS6()) { $editmodeLibraries = array("/pimcore/static6/js/pimcore/namespace.js", "/pimcore/static6/js/lib/prototype-light.js", "/pimcore/static6/js/lib/jquery.min.js", "/pimcore/static6/js/lib/ext/ext-all.js", "/pimcore/static6/js/lib/ckeditor/ckeditor.js"); $editmodeScripts = array("/pimcore/static6/js/pimcore/functions.js", "/pimcore/static6/js/pimcore/element/tag/imagehotspotmarkereditor.js", "/pimcore/static6/js/pimcore/element/tag/imagecropper.js", "/pimcore/static6/js/pimcore/document/edit/helper.js", "/pimcore/static6/js/pimcore/document/edit/dnd.js", "/pimcore/static6/js/pimcore/document/tag.js", "/pimcore/static6/js/pimcore/document/tags/block.js", "/pimcore/static6/js/pimcore/document/tags/date.js", "/pimcore/static6/js/pimcore/document/tags/href.js", "/pimcore/static6/js/pimcore/document/tags/multihref.js", "/pimcore/static6/js/pimcore/document/tags/checkbox.js", "/pimcore/static6/js/pimcore/document/tags/image.js", "/pimcore/static6/js/pimcore/document/tags/input.js", "/pimcore/static6/js/pimcore/document/tags/link.js", "/pimcore/static6/js/pimcore/document/tags/select.js", "/pimcore/static6/js/pimcore/document/tags/snippet.js", "/pimcore/static6/js/pimcore/document/tags/textarea.js", "/pimcore/static6/js/pimcore/document/tags/numeric.js", "/pimcore/static6/js/pimcore/document/tags/wysiwyg.js", "/pimcore/static6/js/pimcore/document/tags/renderlet.js", "/pimcore/static6/js/pimcore/document/tags/table.js", "/pimcore/static6/js/pimcore/document/tags/video.js", "/pimcore/static6/js/pimcore/document/tags/multiselect.js", "/pimcore/static6/js/pimcore/document/tags/areablock.js", "/pimcore/static6/js/pimcore/document/tags/area.js", "/pimcore/static6/js/pimcore/document/tags/pdf.js", "/pimcore/static6/js/pimcore/document/edit/helper.js"); $editmodeStylesheets = array("/pimcore/static6/css/icons.css", "/pimcore/static6/css/editmode.css?_dc=" . time()); } else { $editmodeLibraries = array("/pimcore/static/js/pimcore/namespace.js", "/pimcore/static/js/lib/prototype-light.js", "/pimcore/static/js/lib/jquery.min.js", "/pimcore/static/js/lib/ext/adapter/jquery/ext-jquery-adapter-debug.js", "/pimcore/static/js/lib/ext/ext-all-debug.js", "/pimcore/static/js/lib/ext-plugins/ux/Spinner.js", "/pimcore/static/js/lib/ext-plugins/ux/SpinnerField.js", "/pimcore/static/js/lib/ext-plugins/ux/MultiSelect.js", "/pimcore/static/js/lib/ext-plugins/GridRowOrder/roworder.js", "/pimcore/static/js/lib/ckeditor/ckeditor.js", "/pimcore/static/js/pimcore/libfixes.js"); $editmodeScripts = array("/pimcore/static/js/pimcore/functions.js", "/pimcore/static/js/pimcore/element/tag/imagehotspotmarkereditor.js", "/pimcore/static/js/pimcore/element/tag/imagecropper.js", "/pimcore/static/js/pimcore/document/edit/helper.js", "/pimcore/static/js/pimcore/document/edit/dnd.js", "/pimcore/static/js/pimcore/document/tag.js", "/pimcore/static/js/pimcore/document/tags/block.js", "/pimcore/static/js/pimcore/document/tags/date.js", "/pimcore/static/js/pimcore/document/tags/href.js", "/pimcore/static/js/pimcore/document/tags/multihref.js", "/pimcore/static/js/pimcore/document/tags/checkbox.js", "/pimcore/static/js/pimcore/document/tags/image.js", "/pimcore/static/js/pimcore/document/tags/input.js", "/pimcore/static/js/pimcore/document/tags/link.js", "/pimcore/static/js/pimcore/document/tags/select.js", "/pimcore/static/js/pimcore/document/tags/snippet.js", "/pimcore/static/js/pimcore/document/tags/textarea.js", "/pimcore/static/js/pimcore/document/tags/numeric.js", "/pimcore/static/js/pimcore/document/tags/wysiwyg.js", "/pimcore/static/js/pimcore/document/tags/renderlet.js", "/pimcore/static/js/pimcore/document/tags/table.js", "/pimcore/static/js/pimcore/document/tags/video.js", "/pimcore/static/js/pimcore/document/tags/multiselect.js", "/pimcore/static/js/pimcore/document/tags/areablock.js", "/pimcore/static/js/pimcore/document/tags/area.js", "/pimcore/static/js/pimcore/document/tags/pdf.js", "/pimcore/static/js/pimcore/document/edit/helper.js"); $editmodeStylesheets = array("/pimcore/static/css/icons.css", "/pimcore/static/css/editmode.css?asd=" . time()); } //add plugin editmode JS and CSS try { $pluginConfigs = ExtensionManager::getPluginConfigs(); $jsPaths = array(); $cssPaths = array(); if (!empty($pluginConfigs)) { //registering plugins foreach ($pluginConfigs as $p) { $pluginJsPaths = array(); if (array_key_exists("pluginDocumentEditmodeJsPaths", $p['plugin']) && is_array($p['plugin']['pluginDocumentEditmodeJsPaths']) && isset($p['plugin']['pluginDocumentEditmodeJsPaths']['path'])) { if (is_array($p['plugin']['pluginDocumentEditmodeJsPaths']['path'])) { $pluginJsPaths = $p['plugin']['pluginDocumentEditmodeJsPaths']['path']; } else { if ($p['plugin']['pluginDocumentEditmodeJsPaths']['path'] != null) { $pluginJsPaths[] = $p['plugin']['pluginDocumentEditmodeJsPaths']['path']; } } } //manipulate path for frontend if (is_array($pluginJsPaths) and count($pluginJsPaths) > 0) { for ($i = 0; $i < count($pluginJsPaths); $i++) { if (is_file(PIMCORE_PLUGINS_PATH . $pluginJsPaths[$i])) { $jsPaths[] = "/plugins" . $pluginJsPaths[$i]; } } } $pluginCssPaths = array(); if (array_key_exists("pluginDocumentEditmodeCssPaths", $p['plugin']) && is_array($p['plugin']['pluginDocumentEditmodeCssPaths']) && isset($p['plugin']['pluginDocumentEditmodeCssPaths']['path'])) { if (is_array($p['plugin']['pluginDocumentEditmodeCssPaths']['path'])) { $pluginCssPaths = $p['plugin']['pluginDocumentEditmodeCssPaths']['path']; } else { if ($p['plugin']['pluginDocumentEditmodeCssPaths']['path'] != null) { $pluginCssPaths[] = $p['plugin']['pluginDocumentEditmodeCssPaths']['path']; } } } //manipulate path for frontend if (is_array($pluginCssPaths) and count($pluginCssPaths) > 0) { for ($i = 0; $i < count($pluginCssPaths); $i++) { if (is_file(PIMCORE_PLUGINS_PATH . $pluginCssPaths[$i])) { $cssPaths[] = "/plugins" . $pluginCssPaths[$i]; } } } } } $editmodeScripts = array_merge($editmodeScripts, $jsPaths); $editmodeStylesheets = array_merge($editmodeStylesheets, $cssPaths); } catch (\Exception $e) { \Logger::alert("there is a problem with the plugin configuration"); \Logger::alert($e); } $editmodeHeadHtml = "\n\n\n<!-- pimcore editmode -->\n"; // include stylesheets foreach ($editmodeStylesheets as $sheet) { $editmodeHeadHtml .= '<link rel="stylesheet" type="text/css" href="' . $sheet . '?_dc=' . Version::$revision . '" />'; $editmodeHeadHtml .= "\n"; } $editmodeHeadHtml .= "\n\n"; $editmodeHeadHtml .= '<script type="text/javascript">var jQueryPreviouslyLoaded = (typeof jQuery == "undefined") ? false : true;</script>' . "\n"; // include script libraries foreach ($editmodeLibraries as $script) { $editmodeHeadHtml .= '<script type="text/javascript" src="' . $script . '?_dc=' . Version::$revision . '"></script>'; $editmodeHeadHtml .= "\n"; } // combine the pimcore scripts in non-devmode if ($conf->general->devmode) { foreach ($editmodeScripts as $script) { $editmodeHeadHtml .= '<script type="text/javascript" src="' . $script . '?_dc=' . Version::$revision . '"></script>'; $editmodeHeadHtml .= "\n"; } } else { $scriptContents = ""; foreach ($editmodeScripts as $scriptUrl) { $scriptContents .= file_get_contents(PIMCORE_DOCUMENT_ROOT . $scriptUrl) . "\n\n\n"; } $editmodeHeadHtml .= '<script type="text/javascript" src="' . \Pimcore\Tool\Admin::getMinimizedScriptPath($scriptContents) . '?_dc=' . Version::$revision . '"></script>' . "\n"; } $user = \Pimcore\Tool\Authentication::authenticateSession(); $lang = $user->getLanguage(); $editmodeHeadHtml .= '<script type="text/javascript" src="/admin/misc/json-translations-system/language/' . $lang . '/?_dc=' . Version::$revision . '"></script>' . "\n"; $editmodeHeadHtml .= '<script type="text/javascript" src="/admin/misc/json-translations-admin/language/' . $lang . '/?_dc=' . Version::$revision . '"></script>' . "\n"; $editmodeHeadHtml .= "\n\n"; // set var for editable configurations which is filled by Document\Tag::admin() $editmodeHeadHtml .= '<script type="text/javascript"> var editableConfigurations = new Array(); var pimcore_document_id = ' . $request->getParam("document")->getId() . '; if(jQueryPreviouslyLoaded) { jQuery.noConflict( true ); } </script>'; $editmodeHeadHtml .= "\n\n<!-- /pimcore editmode -->\n\n\n"; // add scripts in html header for pages in editmode if ($this->controller->editmode && Document\Service::isValidType($this->controller->document->getType())) { //ckogler include_once "simple_html_dom.php"; $body = $this->getResponse()->getBody(); $html = str_get_html($body); if ($html) { $htmlElement = $html->find("html", 0); $head = $html->find("head", 0); $bodyElement = $html->find("body", 0); // if there's no head and no body, create a wrapper including these elements // add html headers for snippets in editmode, so there is no problem with javascript if (!$head && !$bodyElement && !$htmlElement) { $body = "<!DOCTYPE html>\n<html>\n<head></head><body>" . $body . "</body></html>"; $html = str_get_html($body); // get them again with the updated html markup $htmlElement = $html->find("html", 0); $head = $html->find("head", 0); $bodyElement = $html->find("body", 0); } if ($head && $bodyElement && $htmlElement) { $head->innertext = $head->innertext . "\n\n" . $editmodeHeadHtml; $bodyElement->onunload = "pimcoreOnUnload();"; if (\Pimcore\Tool\Admin::isExtJS6()) { $bodyElement->innertext = $bodyElement->innertext . "\n\n" . '<script type="text/javascript" src="/pimcore/static6/js/pimcore/document/edit/startup.js?_dc=' . Version::$revision . '"></script>' . "\n\n"; } else { $bodyElement->innertext = $bodyElement->innertext . "\n\n" . '<script type="text/javascript" src="/pimcore/static/js/pimcore/document/edit/startup.js?_dc=' . Version::$revision . '"></script>' . "\n\n"; } $body = $html->save(); $this->getResponse()->setBody($body); } else { $this->getResponse()->setBody('<div style="font-size:30px; font-family: Arial; font-weight:bold; color:red; text-align: center; margin: 40px 0">You have to define a <html>, <head>, <body><br />HTML-tag in your view/layout markup!</div>'); } $html->clear(); unset($html); } } // IE compatibility //$this->getResponse()->setHeader("X-UA-Compatible", "IE=8; IE=9", true); }
/** * Returns a list of all class definitions. */ public function serverInfoAction() { $this->checkUserPermission("system_settings"); $systemSettings = \Pimcore\Config::getSystemConfig()->toArray(); $system = array("currentTime" => time(), "phpCli" => Tool\Console::getPhpCli()); $pimcoreConstants = array(); //only Pimcore_ constants -> others might break the \Zend_Encode functionality foreach ((array) get_defined_constants() as $constant => $value) { if (strpos($constant, 'PIMCORE_') === 0) { $pimcoreConstants[$constant] = $value; } } $pimcore = array("version" => \Pimcore\Version::getVersion(), "revision" => \Pimcore\Version::getRevision(), "instanceIdentifier" => $systemSettings["general"]["instanceIdentifier"], "modules" => array(), "constants" => $pimcoreConstants); foreach ((array) \Pimcore\API\Plugin\Broker::getInstance()->getModules() as $module) { $pimcore["modules"][] = get_class($module); } $plugins = \Pimcore\ExtensionManager::getPluginConfigs(); $this->encoder->encode(array("success" => true, "system" => $system, "pimcore" => $pimcore, "plugins" => $plugins)); }
/** * @static * @throws Exception|\Zend_Controller_Router_Exception */ public static function run() { self::setSystemRequirements(); // detect frontend (website) $frontend = Tool::isFrontend(); // enable the output-buffer, why? see in self::outputBufferStart() //if($frontend) { self::outputBufferStart(); //} self::initAutoloader(); self::initConfiguration(); self::setupFramework(); // config is loaded now init the real logger self::initLogger(); // initialize cache Cache::init(); // load plugins and modules (=core plugins) self::initModules(); self::initPlugins(); // init front controller $front = \Zend_Controller_Front::getInstance(); $conf = Config::getSystemConfig(); if (!$conf) { // redirect to installer if configuration isn't present if (!preg_match("/^\\/install.*/", $_SERVER["REQUEST_URI"])) { header("Location: /install/"); exit; } } if (self::inDebugMode() && $frontend && !$conf->general->disable_whoops && !defined("HHVM_VERSION")) { $whoops = new \Whoops\Run(); $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); $jsonErrorHandler = new \Whoops\Handler\JsonResponseHandler(); $jsonErrorHandler->onlyForAjaxRequests(true); $whoops->pushHandler($jsonErrorHandler); $whoops->register(); // add event handler before Pimcore::shutdown() to ensure fatal errors are handled by Whoops self::getEventManager()->attach("system.shutdown", array($whoops, "handleShutdown"), 10000); } $front->registerPlugin(new Controller\Plugin\ErrorHandler(), 1); $front->registerPlugin(new Controller\Plugin\Maintenance(), 2); // register general pimcore plugins for frontend if ($frontend) { $front->registerPlugin(new Controller\Plugin\Thumbnail(), 795); $front->registerPlugin(new Controller\Plugin\Less(), 799); $front->registerPlugin(new Controller\Plugin\AdminButton(), 806); } if (Tool::useFrontendOutputFilters(new \Zend_Controller_Request_Http())) { $front->registerPlugin(new Controller\Plugin\HybridAuth(), 792); $front->registerPlugin(new Controller\Plugin\QrCode(), 793); $front->registerPlugin(new Controller\Plugin\CommonFilesFilter(), 794); $front->registerPlugin(new Controller\Plugin\WysiwygAttributes(), 796); $front->registerPlugin(new Controller\Plugin\Webmastertools(), 797); $front->registerPlugin(new Controller\Plugin\Analytics(), 798); $front->registerPlugin(new Controller\Plugin\TagManagement(), 804); $front->registerPlugin(new Controller\Plugin\Targeting(), 805); $front->registerPlugin(new Controller\Plugin\EuCookieLawNotice(), 807); $front->registerPlugin(new Controller\Plugin\HttpErrorLog(), 850); $front->registerPlugin(new Controller\Plugin\Cache(), 901); // for caching } self::initControllerFront($front); // set router $router = $front->getRouter(); $routeAdmin = new \Zend_Controller_Router_Route('admin/:controller/:action/*', array('module' => 'admin', "controller" => "index", "action" => "index")); $routeInstall = new \Zend_Controller_Router_Route('install/:controller/:action/*', array('module' => 'install', "controller" => "index", "action" => "index")); $routeUpdate = new \Zend_Controller_Router_Route('admin/update/:controller/:action/*', array('module' => 'update', "controller" => "index", "action" => "index")); $routePlugins = new \Zend_Controller_Router_Route('admin/plugin/:controller/:action/*', array('module' => 'pluginadmin', "controller" => "index", "action" => "index")); $routeExtensions = new \Zend_Controller_Router_Route('admin/extensionmanager/:controller/:action/*', array('module' => 'extensionmanager', "controller" => "index", "action" => "index")); $routeReports = new \Zend_Controller_Router_Route('admin/reports/:controller/:action/*', array('module' => 'reports', "controller" => "index", "action" => "index")); $routePlugin = new \Zend_Controller_Router_Route('plugin/:module/:controller/:action/*', array("controller" => "index", "action" => "index")); $routeWebservice = new \Zend_Controller_Router_Route('webservice/:controller/:action/*', array("module" => "webservice", "controller" => "index", "action" => "index")); $routeSearchAdmin = new \Zend_Controller_Router_Route('admin/search/:controller/:action/*', array("module" => "searchadmin", "controller" => "index", "action" => "index")); // website route => custom router which check for a suitable document $routeFrontend = new Controller\Router\Route\Frontend(); $router->addRoute('default', $routeFrontend); // only do this if not frontend => performance issue if (!$frontend) { $router->addRoute("install", $routeInstall); $router->addRoute('plugin', $routePlugin); $router->addRoute('admin', $routeAdmin); $router->addRoute('update', $routeUpdate); $router->addRoute('plugins', $routePlugins); $router->addRoute('extensionmanager', $routeExtensions); $router->addRoute('reports', $routeReports); $router->addRoute('searchadmin', $routeSearchAdmin); if ($conf instanceof \Zend_Config and $conf->webservice and $conf->webservice->enabled) { $router->addRoute('webservice', $routeWebservice); } // check if this request routes into a plugin, if so check if the plugin is enabled if (preg_match("@^/plugin/([^/]+)/.*@", $_SERVER["REQUEST_URI"], $matches)) { $pluginName = $matches[1]; if (!Pimcore\ExtensionManager::isEnabled("plugin", $pluginName)) { \Pimcore\Tool::exitWithError("Plugin is disabled. To use this plugin please enable it in the extension manager!"); } } // force the main (default) domain for "admin" requests if ($conf->general->domain && $conf->general->domain != Tool::getHostname()) { $url = ($_SERVER['HTTPS'] == "on" ? "https" : "http") . "://" . $conf->general->domain . $_SERVER["REQUEST_URI"]; header("HTTP/1.1 301 Moved Permanently"); header("Location: " . $url, true, 301); exit; } } // check if webdav is configured and add router if ($conf instanceof \Zend_Config) { if ($conf->assets->webdav->hostname) { $routeWebdav = new \Zend_Controller_Router_Route_Hostname($conf->assets->webdav->hostname, array("module" => "admin", 'controller' => 'asset', 'action' => 'webdav')); $router->addRoute('webdav', $routeWebdav); } } $front->setRouter($router); self::getEventManager()->trigger("system.startup", $front); // throw exceptions also when in preview or in editmode (documents) to see it immediately when there's a problem with this page $throwExceptions = false; if (Tool::isFrontentRequestByAdmin()) { $user = \Pimcore\Tool\Authentication::authenticateSession(); if ($user instanceof User) { $throwExceptions = true; } } // run dispatcher // this is also standard for /admin/ requests -> error handling is done in Pimcore_Controller_Action_Admin if (!PIMCORE_DEBUG && !$throwExceptions && !PIMCORE_DEVMODE) { @ini_set("display_errors", "Off"); @ini_set("display_startup_errors", "Off"); $front->dispatch(); } else { @ini_set("display_errors", "On"); @ini_set("display_startup_errors", "On"); $front->throwExceptions(true); try { $front->dispatch(); } catch (\Zend_Controller_Router_Exception $e) { if (!headers_sent()) { header("HTTP/1.0 404 Not Found"); } \Logger::err($e); throw new \Zend_Controller_Router_Exception("No route, document, custom route or redirect is matching the request: " . $_SERVER["REQUEST_URI"] . " | \n" . "Specific ERROR: " . $e->getMessage()); } catch (\Exception $e) { if (!headers_sent()) { header("HTTP/1.0 500 Internal Server Error"); } throw $e; } } }
/** * */ public static function initPlugins() { // add plugin include paths $autoloader = \Zend_Loader_Autoloader::getInstance(); try { $pluginConfigs = ExtensionManager::getPluginConfigs(); if (!empty($pluginConfigs)) { $includePaths = array(get_include_path()); //adding plugin include paths and namespaces if (count($pluginConfigs) > 0) { foreach ($pluginConfigs as $p) { if (!ExtensionManager::isEnabled("plugin", $p["plugin"]["pluginName"])) { continue; } if (is_array($p['plugin']['pluginIncludePaths']['path'])) { foreach ($p['plugin']['pluginIncludePaths']['path'] as $path) { $includePaths[] = PIMCORE_PLUGINS_PATH . $path; } } else { if ($p['plugin']['pluginIncludePaths']['path'] != null) { $includePaths[] = PIMCORE_PLUGINS_PATH . $p['plugin']['pluginIncludePaths']['path']; } } if (is_array($p['plugin']['pluginNamespaces']['namespace'])) { foreach ($p['plugin']['pluginNamespaces']['namespace'] as $namespace) { $autoloader->registerNamespace($namespace); } } else { if ($p['plugin']['pluginNamespaces']['namespace'] != null) { $autoloader->registerNamespace($p['plugin']['pluginNamespaces']['namespace']); } } } } set_include_path(implode(PATH_SEPARATOR, $includePaths)); $broker = \Pimcore\API\Plugin\Broker::getInstance(); //registering plugins foreach ($pluginConfigs as $p) { if (!ExtensionManager::isEnabled("plugin", $p["plugin"]["pluginName"])) { continue; } $jsPaths = array(); $isExtJs5 = \Pimcore\Tool\Admin::isExtJS5(); if ($isExtJs5 && is_array($p['plugin']['pluginJsPaths-extjs5']) && isset($p['plugin']['pluginJsPaths-extjs5']['path']) && is_array($p['plugin']['pluginJsPaths-extjs5']['path'])) { $jsPaths = $p['plugin']['pluginJsPaths-extjs5']['path']; } else { if ($isExtJs5 && is_array($p['plugin']['pluginJsPaths-extjs5']) && $p['plugin']['pluginJsPaths-extjs5']['path'] != null) { $jsPaths[0] = $p['plugin']['pluginJsPaths-extjs5']['path']; } else { if (is_array($p['plugin']['pluginJsPaths']) && isset($p['plugin']['pluginJsPaths']['path']) && is_array($p['plugin']['pluginJsPaths']['path'])) { $jsPaths = $p['plugin']['pluginJsPaths']['path']; } else { if (is_array($p['plugin']['pluginJsPaths']) && $p['plugin']['pluginJsPaths']['path'] != null) { $jsPaths[0] = $p['plugin']['pluginJsPaths']['path']; } } } } //manipulate path for frontend if (is_array($jsPaths) and count($jsPaths) > 0) { for ($i = 0; $i < count($jsPaths); $i++) { if (is_file(PIMCORE_PLUGINS_PATH . $jsPaths[$i])) { $jsPaths[$i] = "/plugins" . $jsPaths[$i]; } } } $cssPaths = array(); if ($isExtJs5 && is_array($p['plugin']['pluginCssPaths-extjs5']) && isset($p['plugin']['pluginCssPaths-extjs5']['path']) && is_array($p['plugin']['pluginCssPaths-extjs5']['path'])) { $cssPaths = $p['plugin']['pluginCssPaths-extjs5']['path']; } else { if ($isExtJs5 && is_array($p['plugin']['pluginCssPaths-extjs5']) && $p['plugin']['pluginCssPaths-extjs5']['path'] != null) { $cssPaths[0] = $p['plugin']['pluginCssPaths-extjs5']['path']; } else { if (is_array($p['plugin']['pluginCssPaths']) && isset($p['plugin']['pluginCssPaths']['path']) && is_array($p['plugin']['pluginCssPaths']['path'])) { $cssPaths = $p['plugin']['pluginCssPaths']['path']; } else { if (is_array($p['plugin']['pluginCssPaths']) && $p['plugin']['pluginCssPaths']['path'] != null) { $cssPaths[0] = $p['plugin']['pluginCssPaths']['path']; } } } } //manipulate path for frontend if (is_array($cssPaths) and count($cssPaths) > 0) { for ($i = 0; $i < count($cssPaths); $i++) { if (is_file(PIMCORE_PLUGINS_PATH . $cssPaths[$i])) { $cssPaths[$i] = "/plugins" . $cssPaths[$i]; } } } try { $className = $p['plugin']['pluginClassName']; if (!empty($className) && Tool::classExists($className)) { $plugin = new $className($jsPaths, $cssPaths); if ($plugin instanceof \Pimcore\API\Plugin\AbstractPlugin) { $broker->registerPlugin($plugin); } } } catch (\Exception $e) { \Logger::err("Could not instantiate and register plugin [" . $p['plugin']['pluginClassName'] . "]"); } } \Zend_Registry::set("Pimcore_API_Plugin_Broker", $broker); } } catch (\Exception $e) { \Logger::alert("there is a problem with the plugin configuration"); \Logger::alert($e); } }
public function deleteAction() { $type = $this->getParam("type"); $id = $this->getParam("id"); ExtensionManager::delete($id, $type); $this->_helper->json(array("success" => true)); }
public function getBrickConfigs() { return ExtensionManager::getBrickConfigs(); }
/** * @return array|mixed */ public function getBrickConfigs() { if ($this->isCustomAreaPath()) { return ExtensionManager::getBrickConfigs($this->getAreaDirectory()); } return ExtensionManager::getBrickConfigs(); }
/** * @param null $customPath * @return array|mixed */ public static function getBrickDirectories($customPath = null) { $cacheKey = "brick_directories"; if ($customPath) { $cacheKey .= "_" . crc32($customPath); } $areas = []; try { $areas = \Zend_Registry::get($cacheKey); } catch (\Exception $e) { if ($customPath) { $areaRepositories = [$customPath]; } else { $areaRepositories = [PIMCORE_WEBSITE_PATH . "/views/areas", PIMCORE_WEBSITE_VAR . "/areas"]; } // include area repositories from active plugins $configs = ExtensionManager::getPluginConfigs(); foreach ($configs as $config) { $className = $config["plugin"]["pluginClassName"]; if (!empty($className)) { $isEnabled = ExtensionManager::isEnabled("plugin", $config["plugin"]["pluginName"]); $areaDir = PIMCORE_PLUGINS_PATH . "/" . $config["plugin"]["pluginName"] . "/views/areas"; if ($isEnabled && file_exists($areaDir)) { $areaRepositories[] = $areaDir; } } } // get directories foreach ($areaRepositories as $respository) { if (is_dir($respository) && is_readable($respository)) { $blockDirs = scandir($respository); foreach ($blockDirs as $blockDir) { if (is_dir($respository . "/" . $blockDir)) { if (is_file($respository . "/" . $blockDir . "/area.xml")) { $areas[$blockDir] = $respository . "/" . $blockDir; } } } } } \Zend_Registry::set($cacheKey, $areas); } return $areas; }