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


PHP Pimcore类代码示例

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


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

示例1: dispatchLoopShutdown

 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);
     }
 }
开发者ID:Cruiser13,项目名称:pimcore-minify,代码行数:25,代码来源:MinifyJs.php

示例2: getHref

 /**
  * @return string
  */
 public function getHref()
 {
     $this->updatePathFromInternal();
     $url = $this->data['path'];
     if ($this->data['internalType'] == 'object') {
         $objectInfo = explode('::', $url);
         if (count($objectInfo) == 2) {
             $path = FALSE;
             $cmdEv = \Pimcore::getEventManager()->trigger('toolbox.url.objectFrontendUrl', null, array('className' => $objectInfo[0], 'path' => $objectInfo[1]));
             if ($cmdEv->stopped()) {
                 $path = $cmdEv->last();
                 if (!empty($path)) {
                     $path = \Toolbox\Tools\GlobalLink::parse($path);
                 }
             }
             return $path;
         } else {
             return FALSE;
         }
     }
     if (strlen($this->data['parameters']) > 0) {
         $url .= "?" . str_replace("?", "", $this->getParameters());
     }
     if (strlen($this->data['anchor']) > 0) {
         $url .= "#" . str_replace("#", "", $this->getAnchor());
     }
     return $url;
 }
开发者ID:dachcom-digital,项目名称:pimcore-toolbox,代码行数:31,代码来源:Globallink.php

示例3: __wakeup

 /**
  *
  */
 public function __wakeup()
 {
     $options = $this->getOptions();
     if (\Pimcore::inAdmin() || empty($options)) {
         $this->configureOptions();
     }
 }
开发者ID:sfie,项目名称:pimcore,代码行数:10,代码来源:Personamultiselect.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $validJobs = array();
     if ($input->getOption("job")) {
         $validJobs = explode(",", $input->getOption("job"));
     }
     // create manager
     $manager = Schedule\Manager\Factory::getManager("maintenance.pid");
     $manager->setValidJobs($validJobs);
     $manager->setForce((bool) $input->getOption("force"));
     // register scheduled tasks
     $manager->registerJob(new Schedule\Maintenance\Job("scheduledtasks", new Schedule\Task\Executor(), "execute"));
     $manager->registerJob(new Schedule\Maintenance\Job("logmaintenance", new \Pimcore\Log\Maintenance(), "mail"));
     $manager->registerJob(new Schedule\Maintenance\Job("cleanuplogfiles", new \Pimcore\Log\Maintenance(), "cleanupLogFiles"));
     $manager->registerJob(new Schedule\Maintenance\Job("httperrorlog", new \Pimcore\Log\Maintenance(), "httpErrorLogCleanup"));
     $manager->registerJob(new Schedule\Maintenance\Job("usagestatistics", new \Pimcore\Log\Maintenance(), "usageStatistics"));
     $manager->registerJob(new Schedule\Maintenance\Job("checkErrorLogsDb", new \Pimcore\Log\Maintenance(), "checkErrorLogsDb"));
     $manager->registerJob(new Schedule\Maintenance\Job("archiveLogEntries", new \Pimcore\Log\Maintenance(), "archiveLogEntries"));
     $manager->registerJob(new Schedule\Maintenance\Job("sanitycheck", "\\Pimcore\\Model\\Element\\Service", "runSanityCheck"));
     $manager->registerJob(new Schedule\Maintenance\Job("versioncleanup", new \Pimcore\Model\Version(), "maintenanceCleanUp"));
     $manager->registerJob(new Schedule\Maintenance\Job("versioncompress", new \Pimcore\Model\Version(), "maintenanceCompress"));
     $manager->registerJob(new Schedule\Maintenance\Job("redirectcleanup", "\\Pimcore\\Model\\Redirect", "maintenanceCleanUp"));
     $manager->registerJob(new Schedule\Maintenance\Job("cleanupbrokenviews", "\\Pimcore\\Db", "cleanupBrokenViews"));
     $manager->registerJob(new Schedule\Maintenance\Job("downloadmaxminddb", "\\Pimcore\\Update", "updateMaxmindDb"));
     $manager->registerJob(new Schedule\Maintenance\Job("cleanupcache", "\\Pimcore\\Model\\Cache", "maintenance"));
     $manager->registerJob(new Schedule\Maintenance\Job("tmpstorecleanup", "\\Pimcore\\Model\\Tool\\TmpStore", "cleanup"));
     $manager->registerJob(new Schedule\Maintenance\Job("imageoptimize", "\\Pimcore\\Model\\Asset\\Image\\Thumbnail\\Processor", "processOptimizeQueue"));
     \Pimcore::getEventManager()->trigger("system.maintenance", $manager);
     $manager->run();
     \Logger::info("All maintenance-jobs finished!");
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:31,代码来源:MaintenanceCommand.php

示例5: callResourceMethod

 /**
  * @param string $method
  * @param array $args
  * @return mixed
  */
 public function callResourceMethod($method, $args)
 {
     $capture = false;
     if (Pimcore::inAdmin()) {
         $methodsToCheck = array("query", "update", "delete", "insert");
         if (in_array($method, $methodsToCheck)) {
             $capture = true;
             Pimcore_Resource::startCapturingDefinitionModifications($method, $args);
         }
     }
     //HACK - do not execute transaction methods when
     //Zend_Registry::set('explicit_transactions', true) was set earlier in code
     $transactionMethodsToCheck = array('beginTransaction', 'rollBack', 'commit');
     try {
         $explicitTransactions = Zend_Registry::get('explicit_transactions');
     } catch (Exception $e) {
         $explicitTransactions = false;
     }
     if (!$explicitTransactions || !in_array($method, $transactionMethodsToCheck)) {
         $r = call_user_func_array(array($this->getResource(), $method), $args);
     }
     if (Pimcore::inAdmin() && $capture) {
         Pimcore_Resource::stopCapturingDefinitionModifications();
     }
     return $r;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:31,代码来源:Wrapper.php

示例6: dispatchLoopShutdown

 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);
         }
     }
 }
开发者ID:Cruiser13,项目名称:pimcore-minify,代码行数:60,代码来源:MinifyCss.php

示例7: getDataByIdAction

 public function getDataByIdAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
         $this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
     }
     Element\Editlock::lock($this->getParam("id"), "document");
     $link = Document\Hardlink::getById($this->getParam("id"));
     $link = clone $link;
     $link->idPath = Element\Service::getIdPath($link);
     $link->userPermissions = $link->getUserPermissions();
     $link->setLocked($link->isLocked());
     $link->setParent(null);
     if ($link->getSourceDocument()) {
         $link->sourcePath = $link->getSourceDocument()->getRealFullPath();
     }
     $this->addTranslationsData($link);
     $this->minimizeProperties($link);
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($link));
     \Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $link, "returnValueContainer" => $returnValueContainer]);
     if ($link->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(false);
 }
开发者ID:solverat,项目名称:pimcore,代码行数:27,代码来源:HardlinkController.php

示例8: attachEvents

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function attachEvents()
 {
     self::getInstall()->attachEvents();
     \Pimcore::getEventManager()->attach('coreshop.payment.getProvider', function ($e) {
         return $this;
     });
 }
开发者ID:coreshop,项目名称:sofortueberweisung,代码行数:10,代码来源:Shop.php

示例9: getDataByIdAction

 public function getDataByIdAction()
 {
     // check for lock
     if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
         $this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
     }
     Element\Editlock::lock($this->getParam("id"), "document");
     $email = Document\Newsletter::getById($this->getParam("id"));
     $email = clone $email;
     $email = $this->getLatestVersion($email);
     $versions = Element\Service::getSafeVersionInfo($email->getVersions());
     $email->setVersions(array_splice($versions, 0, 1));
     $email->idPath = Element\Service::getIdPath($email);
     $email->userPermissions = $email->getUserPermissions();
     $email->setLocked($email->isLocked());
     $email->setParent(null);
     // unset useless data
     $email->setElements(null);
     $email->childs = null;
     $this->addTranslationsData($email);
     $this->minimizeProperties($email);
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($email));
     \Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $email, "returnValueContainer" => $returnValueContainer]);
     if ($email->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(false);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:30,代码来源:NewsletterController.php

示例10: init

 public function init()
 {
     // Disable plugin if the allowed domain is not yet set
     $settingDomain = WebsiteSetting::getByName("subdomainAdmin");
     if (!is_object($settingDomain) || $settingDomain->getData() == "") {
         return;
     }
     // Create temporary request object - not available yet in front controller
     $currentUrl = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
     $request = new \Zend_Controller_Request_Http($currentUrl);
     // Disable main domain setting to allow admin access on another domain
     $conf = Config::getSystemConfig();
     $mainDomain = $conf->general->domain;
     if (Tool::isRequestToAdminBackend($request) && Tool::isDomainAllowedToAdminBackend($request)) {
         $confArr = $conf->toArray();
         $mainDomain = $confArr['general']['domain'];
         $confArr['general']['domain'] = "";
         Config::setSystemConfig(new \Zend_Config($confArr));
     }
     // Register plugin
     \Pimcore::getEventManager()->attach("system.startup", function ($event) use(&$mainDomain) {
         $front = \Zend_Controller_Front::getInstance();
         $frontControllerPlugin = new FrontControllerPlugin();
         $front->registerPlugin($frontControllerPlugin);
         // Restore main domain
         $conf = Config::getSystemConfig();
         $confArr = $conf->toArray();
         $confArr['general']['domain'] = $mainDomain;
         Config::setSystemConfig(new \Zend_Config($confArr));
     });
 }
开发者ID:shanky0110,项目名称:pimcore-plugin-subdomain-admin,代码行数:31,代码来源:Plugin.php

示例11: getDataByIdAction

 public function getDataByIdAction()
 {
     // check for lock
     if (\Pimcore\Model\Element\Editlock::isLocked($this->getParam("id"), "document")) {
         $this->_helper->json(["editlock" => \Pimcore\Model\Element\Editlock::getByElement($this->getParam("id"), "document")]);
     }
     \Pimcore\Model\Element\Editlock::lock($this->getParam("id"), "document");
     $page = Document\Printpage::getById($this->getParam("id"));
     $page = $this->getLatestVersion($page);
     $page->getVersions();
     $page->getScheduledTasks();
     $page->idPath = Service::getIdPath($page);
     $page->userPermissions = $page->getUserPermissions();
     $page->setLocked($page->isLocked());
     if ($page->getContentMasterDocument()) {
         $page->contentMasterDocumentPath = $page->getContentMasterDocument()->getRealFullPath();
     }
     $this->addTranslationsData($page);
     // unset useless data
     $page->setElements(null);
     $page->childs = null;
     // cleanup properties
     $this->minimizeProperties($page);
     //Hook for modifying return value - e.g. for changing permissions based on object data
     //data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
     $returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($page));
     \Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $page, "returnValueContainer" => $returnValueContainer]);
     if ($page->isAllowed("view")) {
         $this->_helper->json($returnValueContainer->getData());
     }
     $this->_helper->json(false);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:32,代码来源:Printpage.php

示例12: init

 public function init()
 {
     parent::init();
     // set language
     try {
         $locale = Zend_Registry::get("Zend_Locale");
         $this->setLanguage($locale->getLanguage());
     } catch (Exception $e) {
         if ($this->_getParam("language")) {
             $this->setLanguage($this->_getParam("language"));
         } else {
             $config = Pimcore_Config::getSystemConfig();
             $this->setLanguage($config->general->language);
         }
     }
     try {
         Zend_Registry::get("pimcore_admin_initialized");
         $this->setUser(Zend_Registry::get("pimcore_admin_user"));
     } catch (Exception $e) {
         // general definitions
         Document::setHideUnpublished(false);
         Object_Abstract::setHideUnpublished(false);
         Object_Abstract::setGetInheritedValues(false);
         Pimcore::setAdminMode();
         // init translations
         self::initTranslations($this);
         // init zend action helpers
         Zend_Controller_Action_HelperBroker::addPrefix('Pimcore_Controller_Action_Helper');
         // authenticate user, first try to authenticate with session information
         $user = Pimcore_Tool_Authentication::authenticateSession();
         if ($user instanceof User) {
             $this->setUser($user);
             if ($this->getUser()->getLanguage()) {
                 $this->setLanguage($this->getUser()->getLanguage());
             }
         } else {
             // try to authenticate with digest, but this is only allowed for WebDAV
             if ($this->_getParam("module") == "admin" && $this->_getParam("controller") == "asset" && $this->_getParam("action") == "webdav") {
                 $user = Pimcore_Tool_Authentication::authenticateDigest();
                 if ($user instanceof User) {
                     $this->setUser($user);
                     return;
                 }
             }
         }
         // send a auth header for the client (is covered by the ajax object in javascript)
         if (!$this->getUser() instanceof User) {
             $this->getResponse()->setHeader("X-Pimcore-Auth", "required");
         }
         // redirect to the login-page if the user isn't authenticated
         if (!$this->getUser() instanceof User && !($this->_getParam("module") == "admin" && $this->_getParam("controller") == "login")) {
             $this->_redirect("/admin/login");
             $this->getResponse()->sendResponse();
             exit;
         }
         Zend_Registry::set("pimcore_admin_user", $this->getUser());
         Zend_Registry::set("pimcore_admin_initialized", true);
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:59,代码来源:Admin.php

示例13: attachEvents

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function attachEvents()
 {
     self::getInstall()->attachEvents();
     $shopProvider = new Provider();
     \Pimcore::getEventManager()->attach("coreshop.payment.getProvider", function ($e) use($shopProvider) {
         return $shopProvider;
     });
 }
开发者ID:coreshop,项目名称:Paypal,代码行数:11,代码来源:Shop.php

示例14: __construct

 /**
  * Constructor.
  *
  * @param string $name The name of the application
  * @param string $version The version of the application
  *
  * @api
  */
 public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
 {
     parent::__construct('Pimcore CLI', Version::getVersion());
     // init default autoload namespaces
     $this->initDefaultAutoloadNamespaces();
     // allow to register commands here (e.g. through plugins)
     \Pimcore::getEventManager()->trigger('system.console.init', $this);
 }
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:16,代码来源:Application.php

示例15: init

 /**
  * @throws \Zend_EventManager_Exception_InvalidArgumentException
  */
 public function init()
 {
     // attach event-listener
     foreach (["asset", "object", "document", "object.class"] as $type) {
         \Pimcore::getEventManager()->attach($type . ".postAdd", array($this, "createUuid"));
         \Pimcore::getEventManager()->attach($type . ".postDelete", array($this, "deleteUuid"));
     }
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:11,代码来源:Module.php


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