/** * */ public function dispatchLoopShutdown() { if (!Tool::isHtmlResponse($this->getResponse())) { return; } $siteKey = \Pimcore\Tool\Frontend::getSiteKey(); $reportConfig = \Pimcore\Config::getReportConfig(); if ($this->enabled && isset($reportConfig->tagmanager->sites->{$siteKey}->containerId)) { $containerId = $reportConfig->tagmanager->sites->{$siteKey}->containerId; if ($containerId) { $code = <<<CODE <!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id={$containerId}" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','{$containerId}');</script> <!-- End Google Tag Manager --> CODE; $body = $this->getResponse()->getBody(); // insert code after the opening <body> tag $body = preg_replace("@<body(>|.*?[^?]>)@", "<body\$1\n\n" . $code, $body); $this->getResponse()->setBody($body); } } }
public function dispatchLoopShutdown() { if (!Tool::isHtmlResponse($this->getResponse())) { return; } if (!Tool::useFrontendOutputFilters($this->getRequest()) && !$this->getRequest()->getParam("pimcore_preview")) { return; } if (\Pimcore::inDebugMode()) { return; } if ($this->enabled) { include_once "simple_html_dom.php"; $body = $this->getResponse()->getBody(); $html = str_get_html($body); if ($html) { $html = $this->searchForScriptSrcAndReplace($html); $html = $this->searchForInlineScriptAndReplace($html); $body = $html->save(); $html->clear(); unset($html); } $this->getResponse()->setBody($body); } }
/** * */ public function dispatchLoopShutdown() { if (!Tool::isHtmlResponse($this->getResponse())) { return; } if (!Tool::useFrontendOutputFilters($this->getRequest()) && !$this->getRequest()->getParam("pimcore_preview")) { return; } if (isset($_COOKIE["pimcore_admin_sid"])) { try { // we should not start a session here as this can break the functionality of the site if // the website itself uses sessions, so we include the code, and check asynchronously if the user is logged in // this is done by the embedded script $body = $this->getResponse()->getBody(); $document = $this->getRequest()->getParam("document"); if ($document instanceof Model\Document && !Model\Staticroute::getCurrentRoute()) { $documentId = $document->getId(); } if (!isset($documentId) || !$documentId) { $documentId = "null"; } $code = '<script type="text/javascript" src="/admin/admin-button/script?documentId=' . $documentId . '"></script>'; // search for the end <head> tag, and insert the google analytics code before // this method is much faster than using simple_html_dom and uses less memory $bodyEndPosition = stripos($body, "</body>"); if ($bodyEndPosition !== false) { $body = substr_replace($body, $code . "\n\n</body>\n", $bodyEndPosition, 7); } $this->getResponse()->setBody($body); } catch (\Exception $e) { \Logger::error($e); } } }
public function __construct() { $this->logger = Logging::getInstance(); $this->client = \Pimcore\Tool::getHttpClient(); $overrideConfig = new \Zend_Config(array("maxredirects" => 5)); $this->client->setConfig($overrideConfig); }
public function addLanguage($languageToAdd) { // Check if language is not already added if (in_array($languageToAdd, Tool::getValidLanguages())) { $result = false; } else { // Read all the documents from the first language $availableLanguages = Tool::getValidLanguages(); $firstLanguageDocument = \Pimcore\Model\Document::getByPath('/' . reset($availableLanguages)); \Zend_Registry::set('SEI18N_add', 1); // Add the language main folder $document = Page::create(1, array('key' => $languageToAdd, "userOwner" => 1, "userModification" => 1, "published" => true, "controller" => 'default', "action" => 'go-to-first-child')); $document->setProperty('language', 'text', $languageToAdd); // Set the language to this folder and let it inherit to the child pages $document->setProperty('isLanguageRoot', 'text', 1, false, false); // Set as language root document $document->save(); // Add Link to other languages $t = new Keys(); $t->insert(array("document_id" => $document->getId(), "language" => $languageToAdd, "sourcePath" => $firstLanguageDocument->getFullPath())); // Lets add all the docs $this->addDocuments($firstLanguageDocument->getId(), $languageToAdd); \Zend_Registry::set('SEI18N_add', 0); $oldConfig = Config::getSystemConfig(); $settings = $oldConfig->toArray(); $languages = explode(',', $settings['general']['validLanguages']); $languages[] = $languageToAdd; $settings['general']['validLanguages'] = implode(',', $languages); $config = new \Zend_Config($settings, true); $writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => PIMCORE_CONFIGURATION_SYSTEM)); $writer->write(); $result = true; } return $result; }
/** * checks configuration and if specified classes exist * * @param $config * @throws OnlineShop_Framework_Exception_InvalidConfigException */ protected function checkConfig($config) { $tempCart = null; if (empty($config->cart->class)) { throw new OnlineShop_Framework_Exception_InvalidConfigException("No Cart class defined."); } else { if (Tool::classExists($config->cart->class)) { $tempCart = new $config->cart->class($config->cart); if (!$tempCart instanceof OnlineShop_Framework_ICart) { throw new OnlineShop_Framework_Exception_InvalidConfigException("Cart class " . $config->cart->class . " does not implement OnlineShop_Framework_ICart."); } } else { throw new OnlineShop_Framework_Exception_InvalidConfigException("Cart class " . $config->cart->class . " not found."); } } if (empty($config->pricecalculator->class)) { throw new OnlineShop_Framework_Exception_InvalidConfigException("No pricecalculator class defined."); } else { if (Tool::classExists($config->pricecalculator->class)) { $tempCalc = new $config->pricecalculator->class($config->pricecalculator->config, $tempCart); if (!$tempCalc instanceof OnlineShop_Framework_ICartPriceCalculator) { throw new OnlineShop_Framework_Exception_InvalidConfigException("Cart class " . $config->pricecalculator->class . " does not implement OnlineShop_Framework_ICartPriceCalculator."); } } else { throw new OnlineShop_Framework_Exception_InvalidConfigException("pricecalculator class " . $config->pricecalculator->class . " not found."); } } }
public function dispatchLoopShutdown() { if (!Tool::isHtmlResponse($this->getResponse())) { return; } if (\Pimcore::inDebugMode()) { return; } if (!Tool::useFrontendOutputFilters($this->getRequest()) && !$this->getRequest()->getParam("pimcore_preview")) { return; } if ($this->enabled) { include_once "simple_html_dom.php"; $body = $this->getResponse()->getBody(); $html = str_get_html($body); if ($html) { $styles = $html->find("link[rel=stylesheet], style[type=text/css]"); $stylesheetContent = ""; foreach ($styles as $style) { if ($style->tag == "style") { $stylesheetContent .= $style->innertext; } else { $source = $style->href; $path = ""; if (is_file(PIMCORE_ASSET_DIRECTORY . $source)) { $path = PIMCORE_ASSET_DIRECTORY . $source; } else { if (is_file(PIMCORE_DOCUMENT_ROOT . $source)) { $path = PIMCORE_DOCUMENT_ROOT . $source; } } if (!empty($path) && is_file("file://" . $path)) { $content = file_get_contents($path); $content = $this->correctReferences($source, $content); if ($style->media && $style->media != "all") { $content = "@media " . $style->media . " {" . $content . "}"; } $stylesheetContent .= $content; $style->outertext = ""; } } } if (strlen($stylesheetContent) > 1) { $stylesheetPath = PIMCORE_TEMPORARY_DIRECTORY . "/minified_css_" . md5($stylesheetContent) . ".css"; if (!is_file($stylesheetPath)) { $stylesheetContent = \Minify_CSS::minify($stylesheetContent); // put minified contents into one single file file_put_contents($stylesheetPath, $stylesheetContent); chmod($stylesheetPath, 0766); } $head = $html->find("head", 0); $head->innertext = $head->innertext . "\n" . '<link rel="stylesheet" type="text/css" href="' . str_replace(PIMCORE_DOCUMENT_ROOT, "", $stylesheetPath) . '" />' . "\n"; } $body = $html->save(); $html->clear(); unset($html); $this->getResponse()->setBody($body); } } }
/** * @param $object * @param $apiclass * @param $type * @param null $options * @return array|string * @throws \Exception */ public static function map($object, $apiclass, $type, $options = null) { if ($object instanceof \Zend_Date) { $object = $object->toString(); } else { if (is_object($object)) { if (Tool::classExists($apiclass)) { $new = new $apiclass(); if (method_exists($new, "map")) { $new->map($object, $options); $object = $new; } } else { throw new \Exception("Webservice\\Data\\Mapper: Cannot map [ {$apiclass} ] - class does not exist"); } } else { if (is_array($object)) { $tmpArray = array(); foreach ($object as $v) { $className = self::findWebserviceClass($v, $type); $tmpArray[] = self::map($v, $className, $type); } $object = $tmpArray; } } } return $object; }
/** * @param bool $forceReload * @return mixed|null|\Zend_Config * @throws \Zend_Exception */ public static function getSystemConfig($forceReload = false) { $config = null; if (\Zend_Registry::isRegistered("pimcore_config_system") && !$forceReload) { $config = \Zend_Registry::get("pimcore_config_system"); } else { try { $file = self::locateConfigFile("system.php"); if (file_exists($file)) { $config = new \Zend_Config(include $file); } else { throw new \Exception($file . " doesn't exist"); } self::setSystemConfig($config); } catch (\Exception $e) { $file = self::locateConfigFile("system.php"); \Logger::emergency("Cannot find system configuration, should be located at: " . $file); if (is_file($file)) { $m = "Your system.php located at " . $file . " is invalid, please check and correct it manually!"; Tool::exitWithError($m); } } } return $config; }
/** * @param null $adapter * @return null|Adapter\GD|Adapter\Imagick * @throws \Exception */ public static function getInstance($adapter = null) { // use the default adapter if set manually (!= null) and no specify adapter is given if (!$adapter && self::$defaultAdapter) { $adapter = self::$defaultAdapter; } try { if ($adapter) { $adapterClass = "\\Pimcore\\Image\\Adapter\\" . $adapter; if (Tool::classExists($adapterClass)) { return new $adapterClass(); } else { if (Tool::classExists($adapter)) { return new $adapter(); } else { throw new \Exception("Image-transform adapter `" . $adapter . "´ does not exist."); } } } else { if (extension_loaded("imagick")) { return new Adapter\Imagick(); } else { return new Adapter\GD(); } } } catch (\Exception $e) { \Logger::crit("Unable to load image extensions: " . $e->getMessage()); throw $e; } return null; }
private function storeLanguage() { if ($this->mySessionSite->Locale) { \Zend_Registry::set("Zend_Locale", $this->mySessionSite->Locale); } if ($this->_getParam("lg")) { $locale = new \Zend_Locale($this->_getParam("lg")); \Zend_Registry::set("Zend_Locale", $locale); } if (\Zend_Registry::isRegistered("Zend_Locale") and $this->mySessionSite->Locale) { //init forcée à french à reprendre $locale = \Zend_Registry::get("Zend_Locale"); } else { $locale = new \Zend_Locale("fr_FR"); \Zend_Registry::set("Zend_Locale", $locale); } $this->mySessionSite->Locale = $locale; $this->view->language = $this->language = $locale->getLanguage(); $languages = \Pimcore\Tool::getValidLanguages(); $languageOptions = array(); foreach ($languages as $short) { if (!empty($short)) { $languageOptions[] = array("language" => $short, "display" => \Zend_Locale::getTranslation($short == "fr_FR" ? "fr" : $short, 'Language', $locale)); $validLanguages[] = $short; } } $this->view->languageOptions = $languageOptions; $this->view->isAjax = $this->isAjax(); }
/** * @static * @return array */ public static function createClassMappings() { $modelsDir = PIMCORE_PATH . "/models/"; $files = rscandir($modelsDir); $includePatterns = array("/Webservice\\/Data/"); foreach ($files as $file) { if (is_file($file)) { $file = str_replace($modelsDir, "", $file); $file = str_replace(".php", "", $file); $class = str_replace(DIRECTORY_SEPARATOR, "_", $file); if (\Pimcore\Tool::classExists($class)) { $match = false; foreach ($includePatterns as $pattern) { if (preg_match($pattern, $file)) { $match = true; break; } } if (strpos($file, "Webservice" . DIRECTORY_SEPARATOR . "Data") !== false) { $match = true; } if (!$match) { continue; } $classMap[str_replace("\\Pimcore\\Model\\Webservice\\Data\\", "", $class)] = $class; } } } return $classMap; }
/** * @param \Zend_Controller_Request_Abstract $request */ public function routeStartup(\Zend_Controller_Request_Abstract $request) { $maintenance = false; $file = \Pimcore\Tool\Admin::getMaintenanceModeFile(); if (is_file($file)) { $conf = (include $file); if (isset($conf["sessionId"])) { if ($conf["sessionId"] != $_COOKIE["pimcore_admin_sid"]) { $maintenance = true; } } else { @unlink($file); } } // do not activate the maintenance for the server itself // this is to avoid problems with monitoring agents $serverIps = ["127.0.0.1"]; if ($maintenance && !in_array(\Pimcore\Tool::getClientIp(), $serverIps)) { header("HTTP/1.1 503 Service Temporarily Unavailable", 503); $file = PIMCORE_PATH . "/static/html/maintenance.html"; $customFile = PIMCORE_CUSTOM_CONFIGURATION_DIRECTORY . "/maintenance.html"; if (file_exists($customFile)) { $file = $customFile; } echo file_get_contents($file); exit; } }
/** * determineResourceClass * * @param $className */ protected function determineResourceClass($className) { if (Tool::classExists($className)) { return $className; } return parent::determineResourceClass($className); }
/** * @param null $options * @return bool|void * @throws \Exception * @throws \Zend_Http_Client_Exception */ public function send($options = null) { $sourceFile = $this->getSourceFile(); $destinationFile = $this->getDestinationFile(); if (!$sourceFile) { throw new \Exception("No sourceFile provided."); } if (!$destinationFile) { throw new \Exception("No destinationFile provided."); } if (is_array($options)) { if ($options['overwrite'] == false && file_exists($destinationFile)) { throw new \Exception("Destination file : '" . $destinationFile . "' already exists."); } } if (!$this->getHttpClient()) { $httpClient = \Pimcore\Tool::getHttpClient(null, ['timeout' => 3600 * 60]); } else { $httpClient = $this->getHttpClient(); } $httpClient->setUri($this->getSourceFile()); $response = $httpClient->request(); if ($response->isSuccessful()) { $data = $response->getBody(); File::mkdir(dirname($destinationFile)); $result = File::put($destinationFile, $data); if ($result === false) { throw new \Exception("Couldn't write destination file:" . $destinationFile); } } else { throw new \Exception("Couldn't download file:" . $sourceFile); } return true; }
/** * @throws Exception */ public function languageDetectionAction() { // Get the browser language $locale = new Zend_Locale(); $browserLanguage = $locale->getLanguage(); $languages = Tool::getValidLanguages(); // Check if the browser language is a valid frontend language if (in_array($browserLanguage, $languages)) { $language = $browserLanguage; } else { // If it is not, take the first frontend language as default $language = reset($languages); } // Get the folder of the current language (in the current site) $currentSitePath = $this->document->getRealFullPath(); $folder = Document\Page::getByPath($currentSitePath . '/' . $language); if ($folder) { $document = $this->findFirstDocumentByParentId($folder->getId()); if ($document) { $this->redirect($document->getPath() . $document->getKey()); } else { throw new Exception('No document found in your browser language'); } } else { throw new Exception('No language folder found that matches your browser language'); } }
/** * @param string $content * @param array $records */ public function send($content, array $records) { $mail = Tool::getMail(array($this->address), "pimcore log notification"); $mail->setIgnoreDebugMode(true); $mail->setBodyText($content); $mail->send(); }
/** * @param $imagePath * @param array $options * @return $this|bool|self */ public function load($imagePath, $options = []) { // support image URLs if (preg_match("@^https?://@", $imagePath)) { $tmpFilename = "imagick_auto_download_" . md5($imagePath) . "." . File::getFileExtension($imagePath); $tmpFilePath = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/" . $tmpFilename; $this->tmpFiles[] = $tmpFilePath; File::put($tmpFilePath, \Pimcore\Tool::getHttpData($imagePath)); $imagePath = $tmpFilePath; } if ($this->resource) { unset($this->resource); $this->resource = null; } try { $i = new \Imagick(); $this->imagePath = $imagePath; if (method_exists($i, "setcolorspace")) { $i->setcolorspace(\Imagick::COLORSPACE_SRGB); } $i->setBackgroundColor(new \ImagickPixel('transparent')); //set .png transparent (print) if (isset($options["resolution"])) { // set the resolution to 2000x2000 for known vector formats // otherwise this will cause problems with eg. cropPercent in the image editable (select specific area) // maybe there's a better solution but for now this fixes the problem $i->setResolution($options["resolution"]["x"], $options["resolution"]["y"]); } $imagePathLoad = $imagePath; if (!defined("HHVM_VERSION")) { $imagePathLoad .= "[0]"; // not supported by HHVM implementation - selects the first layer/page in layered/pages file formats } if (!$i->readImage($imagePathLoad) || !filesize($imagePath)) { return false; } $this->resource = $i; // this is because of HHVM which has problems with $this->resource->readImage(); // set dimensions $dimensions = $this->getDimensions(); $this->setWidth($dimensions["width"]); $this->setHeight($dimensions["height"]); // check if image can have alpha channel if (!$this->reinitializing) { $alphaChannel = $i->getImageAlphaChannel(); if ($alphaChannel) { $this->setIsAlphaPossible(true); } } $this->setColorspaceToRGB(); } catch (\Exception $e) { \Logger::error("Unable to load image: " . $imagePath); \Logger::error($e); return false; } $this->setModified(false); return $this; }
/** * @param \Zend_Controller_Request_Abstract $request * @throws mixed */ protected function _handleError(\Zend_Controller_Request_Abstract $request) { // remove zend error handler $front = \Zend_Controller_Front::getInstance(); $front->unregisterPlugin("Zend_Controller_Plugin_ErrorHandler"); $response = $this->getResponse(); if ($response->isException() && !$this->_isInsideErrorHandlerLoop) { // get errorpage try { // enable error handler $front->setParam('noErrorHandler', false); $errorPath = Config::getSystemConfig()->documents->error_pages->default; if (Site::isSiteRequest()) { $site = Site::getCurrentSite(); $errorPath = $site->getErrorDocument(); } if (empty($errorPath)) { $errorPath = "/"; } $document = Document::getByPath($errorPath); if (!$document instanceof Document\Page) { // default is home $document = Document::getById(1); } if ($document instanceof Document\Page) { $params = Tool::getRoutingDefaults(); if ($module = $document->getModule()) { $params["module"] = $module; } if ($controller = $document->getController()) { $params["controller"] = $controller; $params["action"] = "index"; } if ($action = $document->getAction()) { $params["action"] = $action; } $this->setErrorHandler($params); $request->setParam("document", $document); \Zend_Registry::set("pimcore_error_document", $document); // ensure that a viewRenderer exists, and is enabled if (!\Zend_Controller_Action_HelperBroker::hasHelper("viewRenderer")) { $viewRenderer = new \Pimcore\Controller\Action\Helper\ViewRenderer(); \Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); } $viewRenderer = \Zend_Controller_Action_HelperBroker::getExistingHelper("viewRenderer"); $viewRenderer->setNoRender(false); if ($viewRenderer->view === null) { $viewRenderer->initView(PIMCORE_WEBSITE_PATH . "/views"); } } } catch (\Exception $e) { \Logger::emergency("error page not found"); } } // call default ZF error handler parent::_handleError($request); }
/** * */ public function dispatchLoopShutdown() { $config = \Pimcore\Config::getSystemConfig(); if (!$config->general->show_cookie_notice || !Tool::useFrontendOutputFilters($this->getRequest()) || !Tool::isHtmlResponse($this->getResponse())) { return; } $template = file_get_contents(__DIR__ . "/EuCookieLawNotice/template.html"); # cleanup code $template = preg_replace('/[\\r\\n\\t]+/', ' ', $template); #remove new lines, spaces, tabs $template = preg_replace('/>[\\s]+</', '><', $template); #remove new lines, spaces, tabs $template = preg_replace('/[\\s]+/', ' ', $template); #remove new lines, spaces, tabs $translations = $this->getTranslations(); foreach ($translations as $key => &$value) { $value = htmlentities($value, ENT_COMPAT, "UTF-8"); $template = str_replace("%" . $key . "%", $value, $template); } $linkContent = ""; if (array_key_exists("linkTarget", $translations)) { $linkContent = '<a href="' . $translations["linkTarget"] . '" data-content="' . $translations["linkText"] . '"></a>'; } $template = str_replace("%link%", $linkContent, $template); $templateCode = \Zend_Json::encode($template); $code = ' <script> (function () { var ls = window["localStorage"]; if(ls && !ls.getItem("pc-cookie-accepted")) { var code = ' . $templateCode . '; var ci = window.setInterval(function () { if(document.body) { clearInterval(ci); document.body.insertAdjacentHTML("beforeend", code); document.getElementById("pc-button").onclick = function () { document.getElementById("pc-cookie-notice").style.display = "none"; ls.setItem("pc-cookie-accepted", "true"); }; } }, 100); } })(); </script> '; $body = $this->getResponse()->getBody(); // search for the end <head> tag, and insert the google analytics code before // this method is much faster than using simple_html_dom and uses less memory $headEndPosition = stripos($body, "</head>"); if ($headEndPosition !== false) { $body = substr_replace($body, $code . "</head>", $headEndPosition, 7); } $this->getResponse()->setBody($body); }
/** * */ public function dispatchLoopShutdown() { if (!\Pimcore\Tool::isHtmlResponse($this->getResponse())) { return; } // removes the non-valid html attributes which are used by the wysiwyg editor for ID based linking $body = $this->getResponse()->getBody(); $body = preg_replace("/ pimcore_(id|type|disable_thumbnail)=\\\"([0-9a-z]+)\\\"/", "", $body); $this->getResponse()->setBody($body); }
/** * @param $module * @throws \Exception */ public function registerModule($module) { if (Tool::classExists($module)) { $moduleInstance = new $module(); $moduleInstance->init(); $this->_systemModules[] = $moduleInstance; } else { throw new \Exception("unknown module [ {$module} ]."); } }
/** * */ public function dispatchLoopShutdown() { if (!\Pimcore\Tool::isHtmlResponse($this->getResponse())) { return; } if ($this->enabled) { include_once "simple_html_dom.php"; $body = $this->getResponse()->getBody(); $body = \Pimcore\Tool\Less::processHtml($body); $this->getResponse()->setBody($body); } }
/** * @return mixed|null * @throws \Exception */ public static function getConfiguration() { $config = null; $configFile = PIMCORE_CONFIGURATION_DIRECTORY . "/hybridauth.php"; if (is_file($configFile)) { $config = (include $configFile); $config["base_url"] = "http://" . \Pimcore\Tool::getHostname() . "/hybridauth/endpoint"; } else { throw new \Exception("HybridAuth configuration not found. Please place it into this file: {$configFile}"); } return $config; }
/** * @return mixed|null * @throws \Exception */ public static function getConfiguration() { $config = null; $configFile = \Pimcore\Config::locateConfigFile("hybridauth.php"); if (is_file($configFile)) { $config = (include $configFile); $config["base_url"] = \Pimcore\Tool::getHostUrl() . "/hybridauth/endpoint"; } else { throw new \Exception("HybridAuth configuration not found. Please place it into this file: {$configFile}"); } return $config; }
/** * @return bool */ public function start() { if (\Pimcore\Tool::isFrontentRequestByAdmin() && !$this->force) { return false; } if ($content = CacheManager::load($this->key)) { echo $content; return true; } $this->captureEnabled = true; ob_start(); return false; }
public static function getDataFromEditmode($data, $pimcoreTagName) { $tagClass = '\\Pimcore\\Model\\Object\\ClassDefinition\\Data\\' . ucfirst($pimcoreTagName); if (\Pimcore\Tool::classExists($tagClass)) { /** * @var \Pimcore\Model\Object\ClassDefinition\Data $tag */ $tag = new $tagClass(); return $tag->getDataFromEditmode($data); } //purposely return null if there is no valid class, log a warning Logger::warning("No valid pimcore tag found for fieldType ({$pimcoreTagName}), check 'fieldType' exists, and 'type' is not being used in config"); return null; }
/** * */ public function dispatchLoopShutdown() { if (!\Pimcore\Tool::isHtmlResponse($this->getResponse())) { return; } if ($this->enabled) { include_once "simple_html_dom.php"; if ($this->getRequest()->getParam("pimcore_editmode")) { $this->editmode(); } else { $this->frontend(); } } }
/** * @param $domain */ public function __construct($domain) { $this->_domain = $domain; try { $robotsUrl = $domain . '/robots.txt'; $cacheKey = "robots_" . crc32($robotsUrl); if (!($robotsTxt = Cache::load($cacheKey))) { $robotsTxt = \Pimcore\Tool::getHttpData($robotsUrl); Cache::save($robotsTxt, $cacheKey, array("system"), 3600, 999, true); } $this->_rules = $this->_makeRules($robotsTxt); } catch (\Exception $e) { } }
/** * */ public function configureOptions() { $validLanguages = (array) Tool::getValidLanguages(); $locales = Tool::getSupportedLocales(); $options = array(); foreach ($locales as $short => $translation) { if ($this->getOnlySystemLanguages()) { if (!in_array($short, $validLanguages)) { continue; } } $options[] = array("key" => $translation, "value" => $short); } $this->setOptions($options); }