当前位置: 首页>>代码示例>>PHP>>正文


PHP Logger::err方法代码示例

本文整理汇总了PHP中Pimcore\Logger::err方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::err方法的具体用法?PHP Logger::err怎么用?PHP Logger::err使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Logger的用法示例。


在下文中一共展示了Logger::err方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * Loads a list of entries for the specicifies parameters, returns an array of Search\Backend\Data
  *
  * @return array
  */
 public function load()
 {
     $entries = [];
     $data = $this->db->fetchAll("SELECT * FROM search_backend_data" . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     foreach ($data as $entryData) {
         if ($entryData['maintype'] == 'document') {
             $element = Document::getById($entryData['id']);
         } elseif ($entryData['maintype'] == 'asset') {
             $element = Asset::getById($entryData['id']);
         } elseif ($entryData['maintype'] == 'object') {
             $element = Object::getById($entryData['id']);
         } else {
             Logger::err("unknown maintype ");
         }
         if ($element) {
             $entry = new Search\Backend\Data();
             $entry->setId(new Search\Backend\Data\Id($element));
             $entry->setFullPath($entryData['fullpath']);
             $entry->setType($entryData['type']);
             $entry->setSubtype($entryData['subtype']);
             $entry->setUserOwner($entryData['userowner']);
             $entry->setUserModification($entryData['usermodification']);
             $entry->setCreationDate($entryData['creationdate']);
             $entry->setModificationDate($entryData['modificationdate']);
             $entry->setPublished($entryData['published'] === 0 ? false : true);
             $entries[] = $entry;
         }
     }
     $this->model->setEntries($entries);
     return $entries;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:36,代码来源:Dao.php

示例2: update

 /**
  * @return void
  */
 protected function update()
 {
     // only do this if the file exists and contains data
     if ($this->getDataChanged() || !$this->getCustomSetting("duration")) {
         try {
             $this->setCustomSetting("duration", $this->getDurationFromBackend());
         } catch (\Exception $e) {
             Logger::err("Unable to get duration of video: " . $this->getId());
         }
     }
     $this->clearThumbnails();
     parent::update();
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:16,代码来源:Video.php

示例3: mail

 /**
  *
  */
 public function mail()
 {
     $conf = Config::getSystemConfig();
     if (!empty($conf->general->logrecipient)) {
         Logger::debug(get_class($this) . ": detected log recipient:" . $conf->general->logrecipient);
         $user = User::getById($conf->general->logrecipient);
         Logger::debug(get_class($this) . ": detected log recipient:" . $user->getEmail());
         if ($user instanceof User && $user->isAdmin()) {
             $email = $user->getEmail();
             Logger::debug(get_class($this) . ": user is valid");
             if (!empty($email)) {
                 if (is_dir(PIMCORE_LOG_MAIL_TEMP)) {
                     Logger::debug(get_class($this) . ": detected mail log dir");
                     Logger::debug(get_class($this) . ": opening dir " . PIMCORE_LOG_MAIL_TEMP);
                     if ($handle = opendir(PIMCORE_LOG_MAIL_TEMP)) {
                         Logger::debug(get_class($this) . ": reading dir " . PIMCORE_LOG_MAIL_TEMP);
                         while (false !== ($file = readdir($handle))) {
                             Logger::debug(get_class($this) . ": detected file " . $file);
                             if (is_file(PIMCORE_LOG_MAIL_TEMP . "/" . $file) and is_writable(PIMCORE_LOG_MAIL_TEMP . "/" . $file)) {
                                 $now = time();
                                 $threshold = 1 * 60 * 15;
                                 $fileModified = filemtime(PIMCORE_LOG_MAIL_TEMP . "/" . $file);
                                 Logger::debug(get_class($this) . ": file is writeable and was last modified: " . $fileModified);
                                 if ($fileModified !== false and $fileModified < $now - $threshold) {
                                     $mail = Tool::getMail([$email], "pimcore log notification - " . $file);
                                     $mail->setIgnoreDebugMode(true);
                                     $mail->setBodyText(file_get_contents(PIMCORE_LOG_MAIL_TEMP . "/" . $file));
                                     $mail->send();
                                     @unlink(PIMCORE_LOG_MAIL_TEMP . "/" . $file);
                                     Logger::debug(get_class($this) . ": sent mail and deleted temp log file " . $file);
                                 } elseif ($fileModified > $now - $threshold) {
                                     Logger::debug(get_class($this) . ": leaving temp log file alone because file [ {$file} ] was written to within the last 15 minutes");
                                 }
                             }
                         }
                     }
                 }
             } else {
                 Logger::err(get_class($this) . ": Cannot send mail to configured log user [" . $user->getName() . "] because email is empty");
             }
         } else {
             Logger::err(get_class($this) . ": Cannot send mail to configured log user. User is either null or not an admin");
         }
     } else {
         Logger::debug(get_class($this) . ": No log recipient configured");
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:50,代码来源:Maintenance.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // clear all data
     $db = \Pimcore\Db::get();
     $db->query("TRUNCATE `search_backend_data`;");
     $elementsPerLoop = 100;
     $types = ["asset", "document", "object"];
     foreach ($types as $type) {
         $listClassName = "\\Pimcore\\Model\\" . ucfirst($type) . "\\Listing";
         $list = new $listClassName();
         if (method_exists($list, "setUnpublished")) {
             $list->setUnpublished(true);
         }
         $elementsTotal = $list->getTotalCount();
         for ($i = 0; $i < ceil($elementsTotal / $elementsPerLoop); $i++) {
             $list->setLimit($elementsPerLoop);
             $list->setOffset($i * $elementsPerLoop);
             $this->output->writeln("Processing " . $type . ": " . ($list->getOffset() + $elementsPerLoop) . "/" . $elementsTotal);
             $elements = $list->load();
             foreach ($elements as $element) {
                 try {
                     $searchEntry = Search\Backend\Data::getForElement($element);
                     if ($searchEntry instanceof Search\Backend\Data and $searchEntry->getId() instanceof Search\Backend\Data\Id) {
                         $searchEntry->setDataFromElement($element);
                     } else {
                         $searchEntry = new Search\Backend\Data($element);
                     }
                     $searchEntry->save();
                 } catch (\Exception $e) {
                     Logger::err($e);
                 }
             }
             \Pimcore::collectGarbage();
         }
     }
     $db->query("OPTIMIZE TABLE search_backend_data;");
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:37,代码来源:SearchBackendReindexCommand.php

示例5: copyAction

 public function copyAction()
 {
     $success = false;
     $message = "";
     $sourceId = intval($this->getParam("sourceId"));
     $source = Object::getById($sourceId);
     $session = Tool\Session::get("pimcore_copy");
     $targetId = intval($this->getParam("targetId"));
     if ($this->getParam("targetParentId")) {
         $sourceParent = Object::getById($this->getParam("sourceParentId"));
         // this is because the key can get the prefix "_copy" if the target does already exists
         if ($session->{$this->getParam("transactionId")}["parentId"]) {
             $targetParent = Object::getById($session->{$this->getParam("transactionId")}["parentId"]);
         } else {
             $targetParent = Object::getById($this->getParam("targetParentId"));
         }
         $targetPath = preg_replace("@^" . $sourceParent->getRealFullPath() . "@", $targetParent . "/", $source->getRealPath());
         $target = Object::getByPath($targetPath);
     } else {
         $target = Object::getById($targetId);
     }
     if ($target->isAllowed("create")) {
         $source = Object::getById($sourceId);
         if ($source != null) {
             try {
                 if ($this->getParam("type") == "child") {
                     $newObject = $this->_objectService->copyAsChild($target, $source);
                     $session->{$this->getParam("transactionId")}["idMapping"][(int) $source->getId()] = (int) $newObject->getId();
                     // this is because the key can get the prefix "_copy" if the target does already exists
                     if ($this->getParam("saveParentId")) {
                         $session->{$this->getParam("transactionId")}["parentId"] = $newObject->getId();
                         Tool\Session::writeClose();
                     }
                 } elseif ($this->getParam("type") == "replace") {
                     $this->_objectService->copyContents($target, $source);
                 }
                 $success = true;
             } catch (\Exception $e) {
                 Logger::err($e);
                 $success = false;
                 $message = $e->getMessage() . " in object " . $source->getRealFullPath() . " [id: " . $source->getId() . "]";
             }
         } else {
             Logger::error("could not execute copy/paste, source object with id [ {$sourceId} ] not found");
             $this->_helper->json(["success" => false, "message" => "source object not found"]);
         }
     } else {
         Logger::error("could not execute copy/paste because of missing permissions on target [ " . $targetId . " ]");
         $this->_helper->json(["error" => false, "message" => "missing_permission"]);
     }
     $this->_helper->json(["success" => $success, "message" => $message]);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:52,代码来源:ObjectController.php

示例6: cleanupBrokenViews

 /**
  * check if autogenerated views (eg. localized fields, ...) are still valid, if not, they're removed
  * @static
  */
 public static function cleanupBrokenViews()
 {
     $db = self::get();
     $tables = $db->fetchAll("SHOW FULL TABLES");
     foreach ($tables as $table) {
         reset($table);
         $name = current($table);
         $type = next($table);
         if ($type == "VIEW") {
             try {
                 $createStatement = $db->fetchRow("SHOW FIELDS FROM " . $name);
             } catch (\Exception $e) {
                 if (strpos($e->getMessage(), "references invalid table") !== false) {
                     \Logger::err("view " . $name . " seems to be a broken one, it will be removed");
                     \Logger::err("error message was: " . $e->getMessage());
                     $db->query("DROP VIEW " . $name);
                 } else {
                     \Logger::error($e);
                 }
             }
         }
     }
 }
开发者ID:sfie,项目名称:pimcore,代码行数:27,代码来源:Db.php

示例7: saveAction

 public function saveAction()
 {
     try {
         $success = false;
         if ($this->getParam("id")) {
             $asset = Asset::getById($this->getParam("id"));
             if ($asset->isAllowed("publish")) {
                 // metadata
                 if ($this->getParam("metadata")) {
                     $metadata = \Zend_Json::decode($this->getParam("metadata"));
                     $metadata = Asset\Service::minimizeMetadata($metadata);
                     $asset->setMetadata($metadata);
                 }
                 // properties
                 if ($this->getParam("properties")) {
                     $properties = [];
                     $propertiesData = \Zend_Json::decode($this->getParam("properties"));
                     if (is_array($propertiesData)) {
                         foreach ($propertiesData as $propertyName => $propertyData) {
                             $value = $propertyData["data"];
                             try {
                                 $property = new Model\Property();
                                 $property->setType($propertyData["type"]);
                                 $property->setName($propertyName);
                                 $property->setCtype("asset");
                                 $property->setDataFromEditmode($value);
                                 $property->setInheritable($propertyData["inheritable"]);
                                 $properties[$propertyName] = $property;
                             } catch (\Exception $e) {
                                 Logger::err("Can't add " . $propertyName . " to asset " . $asset->getRealFullPath());
                             }
                         }
                         $asset->setProperties($properties);
                     }
                 }
                 // scheduled tasks
                 if ($this->getParam("scheduler")) {
                     $tasks = [];
                     $tasksData = \Zend_Json::decode($this->getParam("scheduler"));
                     if (!empty($tasksData)) {
                         foreach ($tasksData as $taskData) {
                             $taskData["date"] = strtotime($taskData["date"] . " " . $taskData["time"]);
                             $task = new Model\Schedule\Task($taskData);
                             $tasks[] = $task;
                         }
                     }
                     $asset->setScheduledTasks($tasks);
                 }
                 if ($this->hasParam("data")) {
                     $asset->setData($this->getParam("data"));
                 }
                 $asset->setUserModification($this->getUser()->getId());
                 try {
                     $asset->save();
                     $asset->getData();
                     $success = true;
                 } catch (\Exception $e) {
                     if (Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
                         throw $e;
                     }
                     $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
                 }
             } else {
                 Logger::debug("prevented save asset because of missing permissions ");
             }
             $this->_helper->json(["success" => $success]);
         }
         $this->_helper->json(false);
     } catch (\Exception $e) {
         Logger::log($e);
         if (Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
             $this->_helper->json(["success" => false, "type" => "ValidationException", "message" => $e->getMessage(), "stack" => $e->getTraceAsString(), "code" => $e->getCode()]);
         }
         throw $e;
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:76,代码来源:AssetController.php

示例8: searchAction

 public function searchAction()
 {
     if ($this->getParam("q")) {
         try {
             $page = $this->getParam('page');
             if (empty($page)) {
                 $page = 1;
             }
             $perPage = 10;
             $result = \Pimcore\Google\Cse::search($this->getParam("q"), ($page - 1) * $perPage, null, ["cx" => "002859715628130885299:baocppu9mii"], $this->getParam("facet"));
             $paginator = \Zend_Paginator::factory($result);
             $paginator->setCurrentPageNumber($page);
             $paginator->setItemCountPerPage($perPage);
             $this->view->paginator = $paginator;
             $this->view->result = $result;
         } catch (\Exception $e) {
             // something went wrong: eg. limit exceeded, wrong configuration, ...
             \Pimcore\Logger::err($e);
             echo $e->getMessage();
             exit;
         }
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:23,代码来源:AdvancedController.php

示例9: saveAction

 public function saveAction()
 {
     try {
         if ($this->getParam("id")) {
             $page = Document\Page::getById($this->getParam("id"));
             // check if there's a document in session which should be used as data-source
             // see also self::clearEditableDataAction() | this is necessary to reset all fields and to get rid of
             // outdated and unused data elements in this document (eg. entries of area-blocks)
             $pageSession = Session::useSession(function ($session) use($page) {
                 if (isset($session->{"document_" . $page->getId()}) && isset($session->{"document_" . $page->getId() . "_useForSave"})) {
                     if ($session->{"document_" . $page->getId() . "_useForSave"}) {
                         // only use the page from the session once
                         unset($session->{"document_" . $page->getId() . "_useForSave"});
                         return $session->{"document_" . $page->getId()};
                     }
                 }
                 return null;
             }, "pimcore_documents");
             if ($pageSession) {
                 $page = $pageSession;
             } else {
                 $page = $this->getLatestVersion($page);
             }
             $page->setUserModification($this->getUser()->getId());
             if ($this->getParam("task") == "unpublish") {
                 $page->setPublished(false);
             }
             if ($this->getParam("task") == "publish") {
                 $page->setPublished(true);
             }
             $settings = [];
             if ($this->getParam("settings")) {
                 $settings = \Zend_Json::decode($this->getParam("settings"));
             }
             // check for redirects
             if ($this->getUser()->isAllowed("redirects") && $this->getParam("settings")) {
                 if (is_array($settings)) {
                     $redirectList = new Redirect\Listing();
                     $redirectList->setCondition("target = ?", $page->getId());
                     $existingRedirects = $redirectList->load();
                     $existingRedirectIds = [];
                     foreach ($existingRedirects as $existingRedirect) {
                         $existingRedirectIds[$existingRedirect->getId()] = $existingRedirect->getId();
                     }
                     for ($i = 1; $i < 100; $i++) {
                         if (array_key_exists("redirect_url_" . $i, $settings)) {
                             // check for existing
                             if ($settings["redirect_id_" . $i]) {
                                 $redirect = Redirect::getById($settings["redirect_id_" . $i]);
                                 unset($existingRedirectIds[$redirect->getId()]);
                             } else {
                                 // create new one
                                 $redirect = new Redirect();
                             }
                             $redirect->setSource($settings["redirect_url_" . $i]);
                             $redirect->setTarget($page->getId());
                             $redirect->setStatusCode(301);
                             $redirect->save();
                         }
                     }
                     // remove existing redirects which were delete
                     foreach ($existingRedirectIds as $existingRedirectId) {
                         $redirect = Redirect::getById($existingRedirectId);
                         $redirect->delete();
                     }
                 }
             }
             // check if settings exist, before saving meta data
             if ($this->getParam("settings") && is_array($settings)) {
                 $metaData = [];
                 for ($i = 1; $i < 30; $i++) {
                     if (array_key_exists("metadata_" . $i, $settings)) {
                         $metaData[] = $settings["metadata_" . $i];
                     }
                 }
                 $page->setMetaData($metaData);
             }
             // only save when publish or unpublish
             if ($this->getParam("task") == "publish" && $page->isAllowed("publish") or $this->getParam("task") == "unpublish" && $page->isAllowed("unpublish")) {
                 $this->setValuesToDocument($page);
                 try {
                     $page->save();
                     $this->saveToSession($page);
                     $this->_helper->json(["success" => true]);
                 } catch (\Exception $e) {
                     if (\Pimcore\Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
                         throw $e;
                     }
                     Logger::err($e);
                     $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
                 }
             } else {
                 if ($page->isAllowed("save")) {
                     $this->setValuesToDocument($page);
                     try {
                         $page->saveVersion();
                         $this->saveToSession($page);
                         $this->_helper->json(["success" => true]);
                     } catch (\Exception $e) {
                         Logger::err($e);
//.........这里部分代码省略.........
开发者ID:pimcore,项目名称:pimcore,代码行数:101,代码来源:PageController.php

示例10: startPdfGeneration

 /**
  * @param $documentId
  * @throws \Exception
  */
 public function startPdfGeneration($documentId)
 {
     $jobConfigFile = $this->loadJobConfigObject($documentId);
     $document = $this->getPrintDocument($documentId);
     // check if there is already a generating process running, wait if so ...
     Model\Tool\Lock::acquire($document->getLockKey(), 0);
     try {
         \Pimcore::getEventManager()->trigger("document.print.prePdfGeneration", $document, ["processor" => $this]);
         $pdf = $this->buildPdf($document, $jobConfigFile->config);
         file_put_contents($document->getPdfFileName(), $pdf);
         \Pimcore::getEventManager()->trigger("document.print.postPdfGeneration", $document, ["filename" => $document->getPdfFileName(), "pdf" => $pdf]);
         $creationDate = \Zend_Date::now();
         $document->setLastGenerated($creationDate->get() + 1);
         $document->save();
     } catch (\Exception $e) {
         $document->save();
         Logger::err($e);
     }
     Model\Tool\Lock::release($document->getLockKey());
     Model\Tool\TmpStore::delete($document->getLockKey());
     @unlink($this->getJobConfigFile($documentId));
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:26,代码来源:Processor.php

示例11: deleteInfoAction

 public function deleteInfoAction()
 {
     $hasDependency = false;
     try {
         $document = Document::getById($this->getParam("id"));
         $hasDependency = $document->getDependencies()->isRequired();
     } catch (\Exception $e) {
         Logger::err("failed to access document with id: " . $this->getParam("id"));
     }
     $deleteJobs = [];
     // check for childs
     if ($document instanceof Document) {
         $deleteJobs[] = [["url" => "/admin/recyclebin/add", "params" => ["type" => "document", "id" => $document->getId()]]];
         $hasChilds = $document->hasChilds();
         if (!$hasDependency) {
             $hasDependency = $hasChilds;
         }
         $childs = 0;
         if ($hasChilds) {
             // get amount of childs
             $list = new Document\Listing();
             $list->setCondition("path LIKE '" . $document->getRealFullPath() . "/%'");
             $childs = $list->getTotalCount();
             if ($childs > 0) {
                 $deleteObjectsPerRequest = 5;
                 for ($i = 0; $i < ceil($childs / $deleteObjectsPerRequest); $i++) {
                     $deleteJobs[] = [["url" => "/admin/document/delete", "params" => ["step" => $i, "amount" => $deleteObjectsPerRequest, "type" => "childs", "id" => $document->getId()]]];
                 }
             }
         }
         // the object itself is the last one
         $deleteJobs[] = [["url" => "/admin/document/delete", "params" => ["id" => $document->getId()]]];
     }
     // get the element key
     $elementKey = $document->getKey();
     $this->_helper->json(["hasDependencies" => $hasDependency, "childs" => $childs, "deletejobs" => $deleteJobs, "elementKey" => $elementKey]);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:37,代码来源:DocumentController.php

示例12: content

 /**
  *
  */
 public function content()
 {
     // create info object and assign it to the view
     $info = new Area\Info();
     try {
         $info->setTag($this);
         $info->setName($this->getName());
         $info->setId($this->currentIndex["type"]);
         $info->setIndex($this->current);
         $info->setPath(str_replace(PIMCORE_DOCUMENT_ROOT, "", $this->getPathForBrick($this->currentIndex["type"])));
         $info->setConfig($this->getBrickConfig($this->currentIndex["type"]));
     } catch (\Exception $e) {
         Logger::err($e);
     }
     if ($this->getView() instanceof \Zend_View) {
         $this->getView()->brick = $info;
         $areas = $this->getAreaDirs();
         $view = $areas[$this->currentIndex["type"]] . "/view.php";
         $action = $areas[$this->currentIndex["type"]] . "/action.php";
         $edit = $areas[$this->currentIndex["type"]] . "/edit.php";
         $options = $this->getOptions();
         $params = [];
         if (isset($options["params"]) && is_array($options["params"]) && array_key_exists($this->currentIndex["type"], $options["params"])) {
             if (is_array($options["params"][$this->currentIndex["type"]])) {
                 $params = $options["params"][$this->currentIndex["type"]];
             }
         }
         // assign parameters to view
         foreach ($params as $key => $value) {
             $this->getView()->assign($key, $value);
         }
         // check for action file
         $actionObject = null;
         if (is_file($action)) {
             include_once $action;
             $actionClassFound = true;
             $actionClass = preg_replace_callback("/[\\-_][a-z]/", function ($matches) {
                 $replacement = str_replace(["-", "_"], "", $matches[0]);
                 return strtoupper($replacement);
             }, ucfirst($this->currentIndex["type"]));
             $actionClassname = "\\Pimcore\\Model\\Document\\Tag\\Area\\" . $actionClass;
             if (!class_exists($actionClassname, false)) {
                 // also check the legacy prefixed class name, as this is used by some plugins
                 $actionClassname = "\\Document_Tag_Area_" . ucfirst($this->currentIndex["type"]);
                 if (!class_exists($actionClassname, false)) {
                     $actionClassFound = false;
                 }
             }
             if ($actionClassFound) {
                 $actionObject = new $actionClassname();
                 if ($actionObject instanceof Area\AbstractArea) {
                     $actionObject->setView($this->getView());
                     $areaConfig = new \Zend_Config_Xml($areas[$this->currentIndex["type"]] . "/area.xml");
                     $actionObject->setConfig($areaConfig);
                     // params
                     $params = array_merge($this->view->getAllParams(), $params);
                     $actionObject->setParams($params);
                     if ($info) {
                         $actionObject->setBrick($info);
                     }
                     if (method_exists($actionObject, "action")) {
                         $actionObject->action();
                     }
                     $this->getView()->assign('actionObject', $actionObject);
                 }
             } else {
                 $this->getView()->assign('actionObject', null);
             }
         }
         if (is_file($view)) {
             $editmode = $this->getView()->editmode;
             if ($actionObject && method_exists($actionObject, "getBrickHtmlTagOpen")) {
                 echo $actionObject->getBrickHtmlTagOpen($this);
             } else {
                 echo '<div class="pimcore_area_' . $this->currentIndex["type"] . ' pimcore_area_content">';
             }
             if (is_file($edit) && $editmode) {
                 echo '<div class="pimcore_area_edit_button_' . $this->getName() . ' pimcore_area_edit_button"></div>';
                 // forces the editmode in view.php independent if there's an edit.php or not
                 if (!array_key_exists("forceEditInView", $params) || !$params["forceEditInView"]) {
                     $this->getView()->editmode = false;
                 }
             }
             $this->getView()->template($view);
             if (is_file($edit) && $editmode) {
                 $this->getView()->editmode = true;
                 echo '<div class="pimcore_area_editmode_' . $this->getName() . ' pimcore_area_editmode pimcore_area_editmode_hidden">';
                 $this->getView()->template($edit);
                 echo '</div>';
             }
             if ($actionObject && method_exists($actionObject, "getBrickHtmlTagClose")) {
                 echo $actionObject->getBrickHtmlTagClose($this);
             } else {
                 echo '</div>';
             }
             if ($actionObject && method_exists($actionObject, "postRenderAction")) {
                 $actionObject->postRenderAction();
//.........这里部分代码省略.........
开发者ID:pimcore,项目名称:pimcore,代码行数:101,代码来源:Areablock.php

示例13: getBodyTextRendered

 /**
  * Replaces the placeholders with the content and returns
  * the rendered text if a text was set with "$mail->setBodyText()"     *
  * @return string
  */
 public function getBodyTextRendered()
 {
     $text = $this->getBodyText();
     //if the content was manually set with $obj->setBodyText(); this content will be used
     if ($text instanceof \Zend_Mime_Part) {
         $rawText = $text->getRawContent();
         $content = $this->placeholderObject->replacePlaceholders($rawText, $this->getParams(), $this->getDocument(), $this->getEnableLayoutOnPlaceholderRendering());
     } else {
         //creating text version from html email if html2text is installed
         try {
             include_once "simple_html_dom.php";
             $htmlContent = $this->getBodyHtmlRendered();
             $html = str_get_html($htmlContent);
             if ($html) {
                 $body = $html->find("body", 0);
                 if ($body) {
                     $style = $body->find("style", 0);
                     if ($style) {
                         $style->clear();
                     }
                     $htmlContent = $body->innertext;
                 }
                 $html->clear();
                 unset($html);
             }
             $content = $this->html2Text($htmlContent);
         } catch (\Exception $e) {
             \Logger::err($e);
             $content = "";
         }
     }
     return $content;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:38,代码来源:Mail.php

示例14: saveAction

 public function saveAction()
 {
     try {
         if ($this->getParam("id")) {
             $page = Document\Newsletter::getById($this->getParam("id"));
             $page = $this->getLatestVersion($page);
             $page->setUserModification($this->getUser()->getId());
             if ($this->getParam("task") == "unpublish") {
                 $page->setPublished(false);
             }
             if ($this->getParam("task") == "publish") {
                 $page->setPublished(true);
             }
             // only save when publish or unpublish
             if ($this->getParam("task") == "publish" && $page->isAllowed("publish") or $this->getParam("task") == "unpublish" && $page->isAllowed("unpublish")) {
                 $this->setValuesToDocument($page);
                 try {
                     $page->save();
                     $this->saveToSession($page);
                     $this->_helper->json(["success" => true]);
                 } catch (\Exception $e) {
                     Logger::err($e);
                     $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
                 }
             } else {
                 if ($page->isAllowed("save")) {
                     $this->setValuesToDocument($page);
                     try {
                         $page->saveVersion();
                         $this->saveToSession($page);
                         $this->_helper->json(["success" => true]);
                     } catch (\Exception $e) {
                         if (Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
                             throw $e;
                         }
                         Logger::err($e);
                         $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
                     }
                 }
             }
         }
     } catch (\Exception $e) {
         Logger::log($e);
         if (\Pimcore\Tool\Admin::isExtJS6() && $e instanceof Element\ValidationException) {
             $this->_helper->json(["success" => false, "type" => "ValidationException", "message" => $e->getMessage(), "stack" => $e->getTraceAsString(), "code" => $e->getCode()]);
         }
         throw $e;
     }
     $this->_helper->json(false);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:50,代码来源:NewsletterController.php

示例15: updateMaxmindDb

 /**
  *
  */
 public static function updateMaxmindDb()
 {
     $downloadUrl = "http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz";
     $geoDbFile = PIMCORE_CONFIGURATION_DIRECTORY . "/GeoLite2-City.mmdb";
     $geoDbFileGz = $geoDbFile . ".gz";
     $firstTuesdayOfMonth = strtotime(date("F") . " 2013 tuesday");
     $filemtime = 0;
     if (file_exists($geoDbFile)) {
         $filemtime = filemtime($geoDbFile);
     }
     // update if file is older than 30 days, or if it is the first tuesday of the month
     if ($filemtime < time() - 30 * 86400 || date("m/d/Y") == date("m/d/Y", $firstTuesdayOfMonth) && $filemtime < time() - 86400) {
         $data = Tool::getHttpData($downloadUrl);
         if (strlen($data) > 1000000) {
             File::put($geoDbFileGz, $data);
             @unlink($geoDbFile);
             $sfp = gzopen($geoDbFileGz, "rb");
             $fp = fopen($geoDbFile, "w");
             while ($string = gzread($sfp, 4096)) {
                 fwrite($fp, $string, strlen($string));
             }
             gzclose($sfp);
             fclose($fp);
             unlink($geoDbFileGz);
             \Logger::info("Updated MaxMind GeoIP2 Database in: " . $geoDbFile);
         } else {
             \Logger::err("Failed to update MaxMind GeoIP2, size is under about 1M");
         }
     } else {
         \Logger::debug("MayMind GeoIP2 Download skipped, everything up to date, last update: " . date("m/d/Y H:i", $filemtime));
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:35,代码来源:Update.php


注:本文中的Pimcore\Logger::err方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。