/**
  * @return string $statusMessage
  */
 public static function uninstall()
 {
     try {
         // remove static routes
         Feed_Plugin_Install::removeStaticRoutes();
         return self::getTranslate()->_('feed_uninstalled_successfully');
     } catch (Exception $e) {
         Logger::crit($e);
         return self::getTranslate()->_('feed_uninstall_failed');
     }
 }
 public function __construct()
 {
     $this->logger = Logger::instance(__CLASS__);
     if (!defined('WSDL_URL')) {
         $this->logger->crit('constant WSDL_URL is not set. Check config/soap.inc.php');
         exit;
     }
     if (!defined('SOAP_OUTPUT_BASE_DIR')) {
         $this->logger->crit('constant SOAP_OUTPUT_BASE_DIR is not set. Check config/soap.inc.php');
         exit;
     }
     if (!defined('SOAP_MODEL_DIR')) {
         $this->logger->crit('constant SOAP_MODEL_DIR is not set. Check config/soap.inc.php');
         exit;
     }
     if (!is_dir(SOAP_OUTPUT_BASE_DIR . '/' . SOAP_MODEL_DIR)) {
         mkdir(SOAP_OUTPUT_BASE_DIR . '/' . SOAP_MODEL_DIR, 0755, true);
     }
     $this->soapClient = new SoapClient(WSDL_URL);
 }
Example #3
0
 public static function uninstall()
 {
     try {
         $installer = new Installer(PIMCORE_PLUGINS_PATH . '/Member/install');
         $installer->removeObjectFolder('/members');
         $installer->removeClassmap('Object_Member');
         $installer->removeConfig('member');
         $installer->removeDocuments();
         $installer->removeClass('Member');
     } catch (\Exception $e) {
         \Logger::crit($e);
         return sprintf(self::getTranslate()->_('plugin_member_uninstall_failed'), $e->getMessage());
     }
     return self::getTranslate()->_('plugin_member_uninstall_successful');
 }
Example #4
0
 /**
  * @static
  * @return null|Pimcore_Video_Adapter
  */
 public static function getInstance($adapter = null)
 {
     try {
         if ($adapter) {
             $adapterClass = "Pimcore_Video_Adapter_" . $adapter;
             if (Pimcore_Tool::classExists($adapterClass)) {
                 return new $adapterClass();
             } else {
                 throw new Exception("Video-transcode adapter `" . $adapter . "´ does not exist.");
             }
         } else {
             return new Pimcore_Video_Adapter_Ffmpeg();
         }
     } catch (Exception $e) {
         Logger::crit("Unable to load video adapter: " . $e->getMessage());
         throw $e;
     }
     return null;
 }
Example #5
0
 /**
  * @param null $adapter
  * @return bool|null|Video\Adapter
  * @throws \Exception
  */
 public static function getInstance($adapter = null)
 {
     try {
         if ($adapter) {
             $adapterClass = "\\Pimcore\\Video\\Adapter\\" . $adapter;
             if (Tool::classExists($adapterClass)) {
                 return new $adapterClass();
             } else {
                 throw new \Exception("Video-transcode adapter `" . $adapter . "´ does not exist.");
             }
         } else {
             if ($adapter = self::getDefaultAdapter()) {
                 return $adapter;
             }
         }
     } catch (\Exception $e) {
         \Logger::crit("Unable to load video adapter: " . $e->getMessage());
         throw $e;
     }
     return null;
 }
Example #6
0
 /**
  * @return string $statusMessage
  */
 public static function uninstall()
 {
     try {
         $install = new Blog_Plugin_Install();
         // remove predefined document types
         $install->removeDocTypes();
         // remove static routes
         $install->removeStaticRoutes();
         // remove custom view
         $install->removeCustomView();
         // remove object folder with all childs
         $install->removeFolders();
         // classmap
         $install->unsetClassmap();
         // remove classes
         $install->removeClass('BlogEntry');
         $install->removeClass('BlogCategory');
         return self::getTranslate()->_('blog_uninstalled_successfully');
     } catch (Exception $e) {
         Logger::crit($e);
         return self::getTranslate()->_('blog_uninstall_failed');
     }
 }
Example #7
0
 /**
  * @static
  * @return null|Pimcore_Image_Adapter
  */
 public static function getInstance($adapter = null)
 {
     try {
         if ($adapter) {
             $adapterClass = "Pimcore_Image_Adapter_" . $adapter;
             if (class_exists($adapterClass)) {
                 return new $adapterClass();
             } else {
                 throw new Exception("Image-transform adapter `" . $adapter . "´ does not exist.");
             }
         } else {
             if (extension_loaded("imagick")) {
                 return new Pimcore_Image_Adapter_Imagick();
             } else {
                 return new Pimcore_Image_Adapter_GD();
             }
         }
     } catch (Exception $e) {
         Logger::crit("Unable to load image extensions: " . $e->getMessage());
         throw $e;
     }
     return null;
 }
Example #8
0
 /**
  * @param array $additionalTags
  */
 public function clearDependentCache($additionalTags = array())
 {
     try {
         $tags = array("object_" . $this->getId(), "object_properties", "output");
         $tags = array_merge($tags, $additionalTags);
         Cache::clearTags($tags);
     } catch (\Exception $e) {
         \Logger::crit($e);
     }
 }
Example #9
0
 /**
  *
  */
 public static function init()
 {
     if (!self::$instance instanceof \Zend_Cache_Core) {
         // check for custom cache configuration
         $customCacheFile = PIMCORE_CONFIGURATION_DIRECTORY . "/cache.xml";
         if (is_file($customCacheFile)) {
             $config = self::getDefaultConfig();
             try {
                 $conf = new \Zend_Config_Xml($customCacheFile);
                 if ($conf->frontend) {
                     $config["frontendType"] = (string) $conf->frontend->type;
                     $config["customFrontendNaming"] = (bool) $conf->frontend->custom;
                     if ($conf->frontend->options && method_exists($conf->frontend->options, "toArray")) {
                         $config["frontendConfig"] = $conf->frontend->options->toArray();
                     }
                 }
                 if ($conf->backend) {
                     $config["backendType"] = (string) $conf->backend->type;
                     $config["customBackendNaming"] = (bool) $conf->backend->custom;
                     if ($conf->backend->options && method_exists($conf->backend->options, "toArray")) {
                         $config["backendConfig"] = $conf->backend->options->toArray();
                     }
                 }
                 if (isset($config["frontendConfig"]["lifetime"])) {
                     self::$defaultLifetime = $config["frontendConfig"]["lifetime"];
                 }
                 $config = self::normalizeConfig($config);
                 // here you can use the cache backend you like
                 try {
                     self::$instance = self::initializeCache($config);
                 } catch (\Exception $e) {
                     \Logger::crit("can't initialize cache with the given configuration " . $e->getMessage());
                 }
             } catch (\Exception $e) {
                 \Logger::crit($e);
                 \Logger::crit("Error while reading cache configuration, using the default file backend");
             }
         }
     }
     // return default cache if cache cannot be initialized
     if (!self::$instance instanceof \Zend_Cache_Core) {
         self::$instance = self::getDefaultCache();
     }
     self::$instance->setLifetime(self::$defaultLifetime);
     self::$instance->setOption("automatic_serialization", true);
     self::$instance->setOption("automatic_cleaning_factor", 0);
     // init the write lock once (from other processes etc.)
     if (self::$writeLockTimestamp === null) {
         self::$writeLockTimestamp = 0;
         // set the write lock to 0, otherwise infinite loop (self::hasWriteLock() calls self::getInstance())
         self::hasWriteLock();
     }
     self::setZendFrameworkCaches(self::$instance);
 }
Example #10
0
 /**
  * @param  Element_Interface  $element
  * @return void
  */
 public function setDataFromElement($element)
 {
     $this->id = new SearchPhp_Backend_Data_Id($element);
     $this->fullPath = $element->getFullPath();
     $this->creationDate = $element->getCreationDate();
     $this->modificationDate = $element->getModificationDate();
     $this->userModification = $element->getUserModification();
     $this->userOwner = $element->getUserOwner();
     $this->type = $element->getType();
     if ($element instanceof Object_Abstract) {
         $this->subtype = $element->getClassName();
     } else {
         $this->subtype = $this->type;
     }
     $properties = $element->getProperties();
     if (is_array($properties)) {
         foreach ($properties as $nextProperty) {
             if ($nextProperty->getType() == 'text') {
                 $this->properties .= $nextProperty->getData() . " ";
             }
         }
     }
     if ($element instanceof Document) {
         if ($element instanceof Document_Folder) {
             $this->data = $element->getKey();
             $this->published = true;
         } else {
             if ($element instanceof Document_Link) {
                 $this->published = $element->isPublished();
                 $this->data = $element->getName() . " " . $element->getTitle() . " " . $element->getHref();
             } else {
                 if ($element instanceof Document_PageSnippet) {
                     $this->published = $element->isPublished();
                     $elements = $element->getElements();
                     if (is_array($elements)) {
                         foreach ($elements as $tag) {
                             if ($tag instanceof Document_Tag_Interface) {
                                 $this->data .= strip_tags($tag->frontend()) . " ";
                             }
                         }
                     }
                     if ($element instanceof Document_Page) {
                         $this->published = $element->isPublished();
                         $this->data .= " " . $element->getName() . " " . $element->getTitle() . " " . $element->getDescription() . " " . $element->getKeywords();
                     }
                 }
             }
         }
     } else {
         if ($element instanceof Asset) {
             $this->data = $element->getFilename();
             $this->published = true;
         } else {
             if ($element instanceof Object_Abstract) {
                 if ($element instanceof Object_Concrete) {
                     $this->published = $element->isPublished();
                     foreach ($element->getClass()->getFieldDefinitions() as $key => $value) {
                         $this->data .= $value->getForCsvExport($element) . " ";
                     }
                 } else {
                     if ($element instanceof Object_Folder) {
                         $this->data = $element->getKey();
                         $this->published = true;
                     }
                 }
             } else {
                 Logger::crit("SearchPhp_Backend_Data received an unknown element!");
             }
         }
     }
 }
 /**
  * @return string $statusMessage
  */
 public static function uninstall()
 {
     try {
         $install = new Install();
         self::getEventManager()->trigger('uninstall.pre', null, array("installer" => $install));
         // remove predefined document types
         //$install->removeDocTypes();
         // remove static routes
         $install->removeStaticRoutes();
         // remove custom view
         $install->removeCustomView();
         // remove object folder with all childs
         $install->removeFolders();
         // remove classes
         $install->removeClassmap();
         //$install->removeClass("CoreShopCartRule");
         $install->removeClass('CoreShopProduct');
         $install->removeClass('CoreShopCategory');
         $install->removeClass('CoreShopCart');
         $install->removeClass('CoreShopCartItem');
         $install->removeClass("CoreShopUser");
         $install->removeClass("CoreShopOrder");
         $install->removeClass("CoreShopOrderState");
         $install->removeClass("CoreShopPayment");
         $install->removeClass("CoreShopOrderItem");
         $install->removeFieldcollection('CoreShopUserAddress');
         $install->removeImageThumbnails();
         $install->removeConfig();
         self::getEventManager()->trigger('uninstall.post', null, array("installer" => $install));
         return self::getTranslate()->_('coreshop_uninstalled_successfully');
     } catch (Exception $e) {
         \Logger::crit($e);
         return self::getTranslate()->_('coreshop_uninstall_failed');
     }
 }
Example #12
0
 /**
  * @return void
  */
 public function clearDependentCache()
 {
     // this is mostly called in Redirect\Dao not here
     try {
         \Pimcore\Cache::clearTag("redirect");
     } catch (\Exception $e) {
         \Logger::crit($e);
     }
 }
Example #13
0
 /**
  * @param array $additionalTags
  */
 public function clearDependentCache($additionalTags = [])
 {
     try {
         $tags = ["asset_" . $this->getId(), "asset_properties", "output"];
         $tags = array_merge($tags, $additionalTags);
         \Pimcore\Cache::clearTags($tags);
     } catch (\Exception $e) {
         \Logger::crit($e);
     }
 }
Example #14
0
 /**
  * Returns a instance of the cache, if the instance isn't available it creates a new one
  *
  * @return Zend_Cache_Core|Zend_Cache_Frontend
  */
 public static function getInstance()
 {
     if (!empty($_REQUEST["nocache"])) {
         self::disable();
     }
     if (!self::$instance instanceof Zend_Cache_Core) {
         // default file based configuration
         $config = self::getDefaultConfig();
         // check for custom cache configuration
         $customCacheFile = PIMCORE_CONFIGURATION_DIRECTORY . "/cache.xml";
         if (is_file($customCacheFile)) {
             try {
                 $conf = new Zend_Config_Xml($customCacheFile);
                 if ($conf->frontend) {
                     $config["frontendType"] = (string) $conf->frontend->type;
                     $config["customFrontendNaming"] = (bool) $conf->frontend->custom;
                     if ($conf->frontend->options && method_exists($conf->backend->options, "toArray")) {
                         $config["frontendConfig"] = $conf->frontend->options->toArray();
                     }
                 }
                 if ($conf->backend) {
                     $config["backendType"] = (string) $conf->backend->type;
                     $config["customBackendNaming"] = (bool) $conf->backend->custom;
                     if ($conf->backend->options && method_exists($conf->backend->options, "toArray")) {
                         $config["backendConfig"] = $conf->backend->options->toArray();
                     }
                 }
             } catch (Exception $e) {
                 Logger::crit($e);
                 Logger::crit("Error while reading cache configuration, using the default file backend");
             }
         }
         self::$defaultLifetime = $config["frontendConfig"]["lifetime"];
         // here you can use the cache backend you like
         try {
             self::$instance = self::initializeCache($config);
         } catch (Exception $e) {
             Logger::crit("can't initialize cache with the given configuration " . $e->getMessage());
         }
     }
     // return default cache if cache cannot be initialized
     if (!self::$instance instanceof Zend_Cache_Core) {
         self::$instance = self::getDefaultCache();
     }
     // reset default lifetime
     self::$instance->setLifetime(self::$defaultLifetime);
     return self::$instance;
 }
            } catch (\Exception $e) {
                continue;
            }
            $contents = $config->toArray();
            if (!is_writable(dirname($phpFile))) {
                throw new \Exception($phpFile . " is not writable");
            }
            if ($fileName == "customviews") {
                $cvData = [];
                if (isset($contents["views"]["view"][0])) {
                    $cvData = $contents["views"]["view"];
                } else {
                    $cvData[] = $contents["views"]["view"];
                }
                $contents = ["views" => $cvData];
            }
            if (!$contents) {
                throw new \Exception("Something went wrong during the migration of " . $xmlFile . " to " . $phpFile . " - Please check the contents of the XML and try it again");
            }
            $contents = var_export_pretty($contents);
            $phpContents = "<?php \n\nreturn " . $contents . ";\n";
            \Pimcore\File::put($phpFile, $phpContents);
        } catch (\Exception $e) {
            \Logger::crit($e);
            echo "<b>Critical ERROR!</b><br />";
            echo $e->getMessage();
            echo "<br />Please try to fix it an run the update again.";
            exit;
        }
    }
}
Example #16
0
 /**
  * @param $element
  * @return $this
  */
 public function setDataFromElement($element)
 {
     $this->data = null;
     $this->id = new Data\Id($element);
     $this->fullPath = $element->getFullPath();
     $this->creationDate = $element->getCreationDate();
     $this->modificationDate = $element->getModificationDate();
     $this->userModification = $element->getUserModification();
     $this->userOwner = $element->getUserOwner();
     $this->type = $element->getType();
     if ($element instanceof Object\Concrete) {
         $this->subtype = $element->getClassName();
     } else {
         $this->subtype = $this->type;
     }
     $this->properties = "";
     $properties = $element->getProperties();
     if (is_array($properties)) {
         foreach ($properties as $nextProperty) {
             $pData = (string) $nextProperty->getData();
             if ($nextProperty->getName() == "bool") {
                 $pData = $pData ? "true" : "false";
             }
             $this->properties .= $nextProperty->getName() . ":" . $pData . " ";
         }
     }
     $this->data = "";
     if ($element instanceof Document) {
         if ($element instanceof Document\Folder) {
             $this->data = $element->getKey();
             $this->published = true;
         } else {
             if ($element instanceof Document\Link) {
                 $this->published = $element->isPublished();
                 $this->data = $element->getTitle() . " " . $element->getHref();
             } else {
                 if ($element instanceof Document\PageSnippet) {
                     $this->published = $element->isPublished();
                     $elements = $element->getElements();
                     if (is_array($elements) && !empty($elements)) {
                         foreach ($elements as $tag) {
                             if ($tag instanceof Document\Tag\TagInterface) {
                                 ob_start();
                                 $this->data .= strip_tags($tag->frontend()) . " ";
                                 $this->data .= ob_get_clean();
                             }
                         }
                     }
                     if ($element instanceof Document\Page) {
                         $this->published = $element->isPublished();
                         $this->data .= " " . $element->getTitle() . " " . $element->getDescription() . " " . $element->getKeywords() . " " . $element->getPrettyUrl();
                     }
                 }
             }
         }
     } else {
         if ($element instanceof Asset) {
             $this->data = $element->getFilename();
             foreach ($element->getMetadata() as $md) {
                 $this->data .= " " . $md["name"] . ":" . $md["data"];
             }
             if ($element instanceof Asset\Document && \Pimcore\Document::isAvailable()) {
                 if (\Pimcore\Document::isFileTypeSupported($element->getFilename())) {
                     $contentText = $element->getText();
                     $contentText = str_replace(["\r\n", "\r", "\n", "\t", "\f"], " ", $contentText);
                     $contentText = preg_replace("/[ ]+/", " ", $contentText);
                     $this->data .= " " . $contentText;
                 }
             }
             $this->published = true;
         } else {
             if ($element instanceof Object\AbstractObject) {
                 if ($element instanceof Object\Concrete) {
                     $getInheritedValues = Object\AbstractObject::doGetInheritedValues();
                     Object\AbstractObject::setGetInheritedValues(true);
                     $this->published = $element->isPublished();
                     foreach ($element->getClass()->getFieldDefinitions() as $key => $value) {
                         $this->data .= $value->getDataForSearchIndex($element) . " ";
                     }
                     Object\AbstractObject::setGetInheritedValues($getInheritedValues);
                 } else {
                     if ($element instanceof Object\Folder) {
                         $this->data = $element->getKey();
                         $this->published = true;
                     }
                 }
             } else {
                 \Logger::crit("Search\\Backend\\Data received an unknown element!");
             }
         }
     }
     if ($element instanceof Element\ElementInterface) {
         $this->data = "ID: " . $element->getId() . "  \nPath: " . $this->getFullPath() . "  \n" . $this->cleanupData($this->data);
     }
     return $this;
 }
Example #17
0
 /**
  * @return void
  */
 public function clearDependentCache()
 {
     // this is mostly called in Staticroute\Dao not here
     try {
         \Pimcore\Model\Cache::clearTag("staticroute");
     } catch (\Exception $e) {
         \Logger::crit($e);
     }
 }
Example #18
0
 /**
  * @return void
  */
 public function clearDependentCache()
 {
     // this is mostly called in Site\Resource not here
     try {
         Cache::clearTag("site");
     } catch (\Exception $e) {
         \Logger::crit($e);
     }
 }
Example #19
0
 protected function protect()
 {
     $user = $this->getParam("username");
     $data = $this->readLogFile();
     $matchesIpOnly = 0;
     $matchesUserOnly = 0;
     $matchesUserIp = 0;
     foreach ($data as $login) {
         $matchIp = false;
         $matchUser = false;
         if ($login[0] > time() - 300) {
             if ($user && $login[2] == $user) {
                 $matchesUserOnly++;
                 $matchUser = true;
             }
             if ($login[1] == Tool::getAnonymizedClientIp()) {
                 $matchesIpOnly++;
                 $matchIp = true;
             }
             if ($matchIp && $matchUser) {
                 $matchesUserIp++;
             }
         }
     }
     if ($matchesIpOnly > 49 || $matchesUserOnly > 9 || $matchesUserIp > 4) {
         $m = "Security Alert: Too many login attempts , please wait 5 minutes and try again.";
         \Logger::crit($m);
         die($m);
     }
 }
Example #20
0
 /**
  * @param  Element_Interface  $element
  * @return void
  */
 public function setDataFromElement($element)
 {
     $this->data = null;
     $this->id = new Search_Backend_Data_Id($element);
     $this->fullPath = $element->getFullPath();
     $this->creationDate = $element->getCreationDate();
     $this->modificationDate = $element->getModificationDate();
     $this->userModification = $element->getUserModification();
     $this->userOwner = $element->getUserOwner();
     $this->type = $element->getType();
     if ($element instanceof Object_Concrete) {
         $this->subtype = $element->getO_className();
     } else {
         $this->subtype = $this->type;
     }
     $properties = $element->getProperties();
     if (is_array($properties)) {
         foreach ($properties as $nextProperty) {
             if ($nextProperty->getType() == 'text') {
                 $this->properties .= $nextProperty->getData() . " ";
             }
         }
     }
     if ($element instanceof Document) {
         if ($element instanceof Document_Folder) {
             $this->data = $element->getKey();
             $this->published = true;
         } else {
             if ($element instanceof Document_Link) {
                 $this->published = $element->isPublished();
                 $this->data = $element->getName() . " " . $element->getTitle() . " " . $element->getHref();
             } else {
                 if ($element instanceof Document_PageSnippet) {
                     $this->published = $element->isPublished();
                     $elements = $element->getElements();
                     if (is_array($elements)) {
                         foreach ($elements as $tag) {
                             if ($tag instanceof Document_Tag_Interface) {
                                 ob_start();
                                 $this->data .= strip_tags($tag->frontend()) . " ";
                                 $this->data .= ob_get_clean();
                             }
                         }
                     }
                     if ($element instanceof Document_Page) {
                         $this->published = $element->isPublished();
                         $this->data .= " " . $element->getName() . " " . $element->getTitle() . " " . $element->getDescription() . " " . $element->getKeywords();
                     }
                 }
             }
         }
     } else {
         if ($element instanceof Asset) {
             $this->data = $element->getFilename();
             $this->published = true;
         } else {
             if ($element instanceof Object_Abstract) {
                 if ($element instanceof Object_Concrete) {
                     $getInheritedValues = Object_Abstract::doGetInheritedValues();
                     Object_Abstract::setGetInheritedValues(true);
                     $this->published = $element->isPublished();
                     foreach ($element->getClass()->getFieldDefinitions() as $key => $value) {
                         // Object_Class_Data_Fieldcollections is special because it doesn't support the csv export
                         if ($value instanceof Object_Class_Data_Fieldcollections) {
                             $getter = "get" . $value->getName();
                             $this->fieldcollectionData .= Pimcore_Tool_Serialize::serialize($value->getDataForEditmode($element->{$getter}(), $element)) . " ";
                         } else {
                             if ($value instanceof Object_Class_Data_Localizedfields) {
                                 $getter = "get" . $value->getName();
                                 $this->localizedData .= Pimcore_Tool_Serialize::serialize($value->getDataForEditmode($element->{$getter}(), $element)) . " ";
                             } else {
                                 $this->data .= $value->getForCsvExport($element) . " ";
                             }
                         }
                     }
                     Object_Abstract::setGetInheritedValues($getInheritedValues);
                 } else {
                     if ($element instanceof Object_Folder) {
                         $this->data = $element->getKey();
                         $this->published = true;
                     }
                 }
             } else {
                 Logger::crit("Search_Backend_Data received an unknown element!");
             }
         }
     }
 }
Example #21
0
 protected function protect()
 {
     $data = $this->readLogFile();
     $matches = 0;
     foreach ($data as $login) {
         if ($login[1] == Pimcore_Tool::getClientIp()) {
             if ($login[0] > time() - 300) {
                 $matches++;
             }
         }
     }
     if ($matches > 4) {
         $m = "Security Alert: Too many logins, please wait 5 minutes and try again.";
         Logger::crit($m);
         die($m);
     }
 }
Example #22
0
 /**
  * @param  Element_Interface  $element
  * @return void
  */
 public function setDataFromElement($element)
 {
     $this->data = null;
     $this->id = new Search_Backend_Data_Id($element);
     $this->fullPath = $element->getFullPath();
     $this->creationDate = $element->getCreationDate();
     $this->modificationDate = $element->getModificationDate();
     $this->userModification = $element->getUserModification();
     $this->userOwner = $element->getUserOwner();
     $this->type = $element->getType();
     if ($element instanceof Object_Concrete) {
         $this->subtype = $element->getO_className();
     } else {
         $this->subtype = $this->type;
     }
     $this->properties = "";
     $properties = $element->getProperties();
     if (is_array($properties)) {
         foreach ($properties as $nextProperty) {
             if ($nextProperty->getType() == 'text') {
                 $this->properties .= $nextProperty->getData() . " ";
             }
         }
     }
     $this->data = "";
     if ($element instanceof Document) {
         if ($element instanceof Document_Folder) {
             $this->data = $element->getKey();
             $this->published = true;
         } else {
             if ($element instanceof Document_Link) {
                 $this->published = $element->isPublished();
                 $this->data = $element->getName() . " " . $element->getTitle() . " " . $element->getHref();
             } else {
                 if ($element instanceof Document_PageSnippet) {
                     $this->published = $element->isPublished();
                     $elements = $element->getElements();
                     if (is_array($elements) && !empty($elements)) {
                         foreach ($elements as $tag) {
                             if ($tag instanceof Document_Tag_Interface) {
                                 ob_start();
                                 $this->data .= strip_tags($tag->frontend()) . " ";
                                 $this->data .= ob_get_clean();
                             }
                         }
                     }
                     if ($element instanceof Document_Page) {
                         $this->published = $element->isPublished();
                         $this->data .= " " . $element->getName() . " " . $element->getTitle() . " " . $element->getDescription() . " " . $element->getKeywords();
                     }
                 }
             }
         }
     } else {
         if ($element instanceof Asset) {
             $this->data = $element->getFilename();
             $this->published = true;
         } else {
             if ($element instanceof Object_Abstract) {
                 if ($element instanceof Object_Concrete) {
                     $getInheritedValues = Object_Abstract::doGetInheritedValues();
                     Object_Abstract::setGetInheritedValues(true);
                     $this->published = $element->isPublished();
                     foreach ($element->getClass()->getFieldDefinitions() as $key => $value) {
                         // Object_Class_Data_Fieldcollections, Object_Class_Data_Localizedfields and Object_Class_Data_Objectbricks is special because it doesn't support the csv export
                         if ($value instanceof Object_Class_Data_Fieldcollections) {
                             $getter = "get" . $value->getName();
                             $fcData = $element->{$getter}();
                             if ($fcData instanceof Object_Fieldcollection) {
                                 foreach ($fcData as $item) {
                                     if (!$item instanceof Object_Fieldcollection_Data_Abstract) {
                                         continue;
                                     }
                                     try {
                                         $collectionDef = Object_Fieldcollection_Definition::getByKey($item->getType());
                                     } catch (Exception $e) {
                                         continue;
                                     }
                                     foreach ($collectionDef->getFieldDefinitions() as $fd) {
                                         $this->data .= $fd->getForCsvExport($item) . " ";
                                     }
                                 }
                             }
                             //$this->data .= Pimcore_Tool_Serialize::serialize($value->getDataForEditmode($element->$getter(), $element))." ";
                         } else {
                             if ($value instanceof Object_Class_Data_Localizedfields) {
                                 // only for text-values at the moment, because the CSV doesn't work for localized fields (getter-problem)
                                 $getter = "get" . $value->getName();
                                 $lfData = $element->{$getter}();
                                 if ($lfData instanceof Object_Localizedfield) {
                                     foreach ($lfData->getItems() as $language => $values) {
                                         foreach ($values as $lData) {
                                             if (is_string($lData)) {
                                                 $this->data .= $lData . " ";
                                             }
                                         }
                                     }
                                 }
                                 //$this->data .= Pimcore_Tool_Serialize::serialize($value->getDataForEditmode($element->$getter(), $element))." ";
                             } else {
                                 if ($value instanceof Object_Class_Data_Objectbricks) {
                                     $getter = "get" . $value->getName();
                                     $obData = $element->{$getter}();
                                     if ($obData instanceof Object_Objectbrick) {
                                         $items = $obData->getItems();
                                         foreach ($items as $item) {
                                             if (!$item instanceof Object_Objectbrick_Data_Abstract) {
                                                 continue;
                                             }
                                             try {
                                                 $collectionDef = Object_Objectbrick_Definition::getByKey($item->getType());
                                             } catch (Exception $e) {
                                                 continue;
                                             }
                                             foreach ($collectionDef->getFieldDefinitions() as $fd) {
                                                 $this->data .= $fd->getForCsvExport($item) . " ";
                                             }
                                         }
                                     }
                                     //$this->data .= Pimcore_Tool_Serialize::serialize($value->getDataForEditmode($element->$getter(), $element))." ";
                                 } else {
                                     $this->data .= $value->getForCsvExport($element) . " ";
                                 }
                             }
                         }
                     }
                     Object_Abstract::setGetInheritedValues($getInheritedValues);
                 } else {
                     if ($element instanceof Object_Folder) {
                         $this->data = $element->getKey();
                         $this->published = true;
                     }
                 }
             } else {
                 Logger::crit("Search_Backend_Data received an unknown element!");
             }
         }
     }
     if ($element instanceof Element_Interface) {
         $this->data = "ID: " . $element->getId() . "  \nPath: " . $this->getFullPath() . "  \n" . $this->cleanupData($this->data);
     }
 }