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


PHP AbstractObject::setHideUnpublished方法代码示例

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


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

示例1: init

 /**
  * @throws \Zend_Controller_Router_Exception
  */
 public function init()
 {
     // this is only executed once per request (first request)
     if (self::$isInitial) {
         \Pimcore::getEventManager()->trigger("frontend.controller.preInit", $this);
     }
     parent::init();
     // log exceptions if handled by error_handler
     $this->checkForErrors();
     // general definitions
     if (self::$isInitial) {
         \Pimcore::unsetAdminMode();
         Document::setHideUnpublished(true);
         Object\AbstractObject::setHideUnpublished(true);
         Object\AbstractObject::setGetInheritedValues(true);
         Object\Localizedfield::setGetFallbackValues(true);
     }
     // assign variables
     $this->view->controller = $this;
     // init website config
     $config = Config::getWebsiteConfig();
     $this->config = $config;
     $this->view->config = $config;
     $document = $this->getParam("document");
     if (!$document instanceof Document) {
         \Zend_Registry::set("pimcore_editmode", false);
         $this->editmode = false;
         $this->view->editmode = false;
         self::$isInitial = false;
         // check for a locale first, and set it if available
         if ($this->getParam("pimcore_parentDocument")) {
             // this is a special exception for renderlets in editmode (ajax request), because they depend on the locale of the parent document
             // otherwise there'll be notices like:  Notice: 'No translation for the language 'XX' available.'
             if ($parentDocument = Document::getById($this->getParam("pimcore_parentDocument"))) {
                 if ($parentDocument->getProperty("language")) {
                     $this->setLocaleFromDocument($parentDocument->getProperty("language"));
                 }
             }
         }
         // no document available, continue, ...
         return;
     } else {
         $this->setDocument($document);
         // register global locale if the document has the system property "language"
         if ($this->getDocument()->getProperty("language")) {
             $this->setLocaleFromDocument($this->getDocument()->getProperty("language"));
         }
         if (self::$isInitial) {
             // append meta-data to the headMeta() view helper,  if it is a document-request
             if (!Model\Staticroute::getCurrentRoute() && $this->getDocument() instanceof Document\Page) {
                 if (is_array($this->getDocument()->getMetaData())) {
                     foreach ($this->getDocument()->getMetaData() as $meta) {
                         // only name
                         if (!empty($meta["idName"]) && !empty($meta["idValue"]) && !empty($meta["contentValue"])) {
                             $method = "append" . ucfirst($meta["idName"]);
                             $this->view->headMeta()->{$method}($meta["idValue"], $meta["contentValue"]);
                         }
                     }
                 }
             }
         }
     }
     // this is only executed once per request (first request)
     if (self::$isInitial) {
         // contains the logged in user if necessary
         $user = null;
         // default is to set the editmode to false, is enabled later if necessary
         \Zend_Registry::set("pimcore_editmode", false);
         if (Tool::isFrontentRequestByAdmin()) {
             $this->disableBrowserCache();
             // start admin session & get logged in user
             $user = Authentication::authenticateSession();
         }
         if (\Pimcore::inDebugMode()) {
             $this->disableBrowserCache();
         }
         if (!$this->document->isPublished()) {
             if (Tool::isFrontentRequestByAdmin()) {
                 if (!$user) {
                     throw new \Zend_Controller_Router_Exception("access denied for " . $this->document->getFullPath());
                 }
             } else {
                 throw new \Zend_Controller_Router_Exception("access denied for " . $this->document->getFullPath());
             }
         }
         // logged in users only
         if ($user) {
             // set the user to registry so that it is available via \Pimcore\Tool\Admin::getCurrentUser();
             \Zend_Registry::set("pimcore_admin_user", $user);
             // document editmode
             if ($this->getParam("pimcore_editmode")) {
                 \Zend_Registry::set("pimcore_editmode", true);
                 // check if there is the document in the session
                 $docKey = "document_" . $this->getDocument()->getId();
                 $docSession = Session::getReadOnly("pimcore_documents");
                 if ($docSession->{$docKey}) {
                     // if there is a document in the session use it
//.........这里部分代码省略.........
开发者ID:tododo,项目名称:pimcore,代码行数:101,代码来源:Frontend.php

示例2: init

 /**
  * @throws \Zend_Exception
  */
 public function init()
 {
     parent::init();
     // set language
     if (\Zend_Registry::isRegistered("Zend_Locale")) {
         $locale = (string) \Zend_Registry::get("Zend_Locale");
         $this->setLanguage($locale);
     } else {
         if ($this->getParam("language")) {
             $this->setLanguage($this->getParam("language"));
         } else {
             $config = Config::getSystemConfig();
             $this->setLanguage($config->general->language);
             // try to set browser-language (validation if installed is in $this->setLanguage() )
             $this->setLanguage(new \Zend_Locale());
         }
     }
     if (self::$adminInitialized) {
         // this will be executed on every call to this init() method
         try {
             $this->setUser(\Zend_Registry::get("pimcore_admin_user"));
         } catch (\Exception $e) {
             \Logger::emerg("adminInitialized was set to true although there was no user set in the registry -> to be save the process was killed");
             exit;
         }
     } else {
         // the following code is only called once, even when there are some subcalls (eg. with $this->action, ... )
         \Pimcore::getEventManager()->trigger("admin.controller.preInit", $this);
         $this->disableBrowserCache();
         // general definitions
         Model\Document::setHideUnpublished(false);
         Model\Object\AbstractObject::setHideUnpublished(false);
         Model\Object\AbstractObject::setGetInheritedValues(false);
         Model\Object\Localizedfield::setGetFallbackValues(false);
         \Pimcore::setAdminMode();
         // init translations
         self::initTranslations($this);
         // init zend action helpers, we need to leave the prefixed class name here as the plugin loader isn't able to handle namespaces
         \Zend_Controller_Action_HelperBroker::addPrefix('Pimcore_Controller_Action_Helper');
         // this is to make it possible to use the session id as a part of the route (ZF default route) used for external editors, etc.
         if ($this->getParam("pimcore_admin_sid")) {
             $_REQUEST["pimcore_admin_sid"] = $this->getParam("pimcore_admin_sid");
         }
         // authenticate user, first try to authenticate with session information
         $user = Authentication::authenticateSession();
         if ($user instanceof Model\User) {
             $this->setUser($user);
             if ($this->getUser()->getLanguage()) {
                 $this->setLanguage($this->getUser()->getLanguage());
             }
         } else {
             // try to authenticate with http basic auth, but this is only allowed for WebDAV
             if ($this->getParam("module") == "admin" && $this->getParam("controller") == "asset" && $this->getParam("action") == "webdav") {
                 $user = Authentication::authenticateHttpBasic();
                 if ($user instanceof Model\User) {
                     $this->setUser($user);
                     \Zend_Registry::set("pimcore_admin_user", $this->getUser());
                     self::$adminInitialized = true;
                     return;
                 }
             }
         }
         // redirect to the login-page if the user isn't authenticated
         if (!$this->getUser() instanceof Model\User && !($this->getParam("module") == "admin" && $this->getParam("controller") == "login")) {
             // put a detailed message into the debug.log
             \Logger::error("Prevented access to " . $_SERVER["REQUEST_URI"] . " because there is no user in the session!", ["server" => $_SERVER, "get" => $_GET, "post" => $_POST, "session" => $_SESSION, "cookie" => $_COOKIE]);
             // send a auth header for the client (is covered by the ajax object in javascript)
             $this->getResponse()->setHeader("X-Pimcore-Auth", "required");
             // redirect to login page
             $this->redirect("/admin/login");
             // exit the execution -> just to be sure
             exit;
         }
         // we're now authenticated so we can remove the default error handler so that we get just the normal PHP errors
         if ($this->getParam("controller") != "login") {
             $front = \Zend_Controller_Front::getInstance();
             $front->unregisterPlugin("Pimcore\\Controller\\Plugin\\ErrorHandler");
             $front->throwExceptions(true);
             @ini_set("display_errors", "On");
             @ini_set("display_startup_errors", "On");
         }
         \Zend_Registry::set("pimcore_admin_user", $this->getUser());
         self::$adminInitialized = true;
         // usage statistics
         $this->logUsageStatistics();
         \Pimcore::getEventManager()->trigger("admin.controller.postInit", $this);
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:91,代码来源:Admin.php

示例3: prepareDataForIndex

 /**
  * prepare data for index creation and store is in store table
  *
  * @param OnlineShop_Framework_ProductInterfaces_IIndexable $object
  */
 public function prepareDataForIndex(OnlineShop_Framework_ProductInterfaces_IIndexable $object)
 {
     $subObjectIds = $this->tenantConfig->createSubIdsForObject($object);
     foreach ($subObjectIds as $subObjectId => $object) {
         /**
          * @var OnlineShop_Framework_ProductInterfaces_IIndexable $object
          */
         if ($object->getOSDoIndexProduct() && $this->tenantConfig->inIndex($object)) {
             $a = Pimcore::inAdmin();
             $b = \Pimcore\Model\Object\AbstractObject::doGetInheritedValues();
             Pimcore::unsetAdminMode();
             \Pimcore\Model\Object\AbstractObject::setGetInheritedValues(true);
             $hidePublishedMemory = \Pimcore\Model\Object\AbstractObject::doHideUnpublished();
             \Pimcore\Model\Object\AbstractObject::setHideUnpublished(false);
             $categories = $object->getCategories();
             $categoryIds = array();
             $parentCategoryIds = array();
             if ($categories) {
                 foreach ($categories as $c) {
                     $parent = $c;
                     if ($parent != null) {
                         if ($parent->getOSProductsInParentCategoryVisible()) {
                             while ($parent && $parent instanceof OnlineShop_Framework_AbstractCategory) {
                                 $parentCategoryIds[$parent->getId()] = $parent->getId();
                                 $parent = $parent->getParent();
                             }
                         } else {
                             $parentCategoryIds[$parent->getId()] = $parent->getId();
                         }
                         $categoryIds[$c->getId()] = $c->getId();
                     }
                 }
             }
             ksort($categoryIds);
             $virtualProductId = $subObjectId;
             $virtualProductActive = $object->isActive();
             if ($object->getOSIndexType() == "variant") {
                 $virtualProductId = $this->tenantConfig->createVirtualParentIdForSubId($object, $subObjectId);
             }
             $virtualProduct = \Pimcore\Model\Object\AbstractObject::getById($virtualProductId);
             if ($virtualProduct && method_exists($virtualProduct, "isActive")) {
                 $virtualProductActive = $virtualProduct->isActive();
             }
             $data = array("o_id" => $subObjectId, "o_classId" => $object->getClassId(), "o_virtualProductId" => $virtualProductId, "o_virtualProductActive" => $virtualProductActive, "o_parentId" => $object->getOSParentId(), "o_type" => $object->getOSIndexType(), "categoryIds" => ',' . implode(",", $categoryIds) . ",", "parentCategoryIds" => ',' . implode(",", $parentCategoryIds) . ",", "priceSystemName" => $object->getPriceSystemName(), "active" => $object->isActive(), "inProductList" => $object->isActive(true));
             $relationData = array();
             $columnConfig = $this->columnConfig->column;
             if (!empty($columnConfig->name)) {
                 $columnConfig = array($columnConfig);
             } else {
                 if (empty($columnConfig)) {
                     $columnConfig = array();
                 }
             }
             foreach ($columnConfig as $column) {
                 try {
                     //$data[$column->name] = null;
                     $value = null;
                     if (!empty($column->getter)) {
                         $getter = $column->getter;
                         $value = $getter::get($object, $column->config, $subObjectId, $this->tenantConfig);
                     } else {
                         if (!empty($column->fieldname)) {
                             $getter = "get" . ucfirst($column->fieldname);
                         } else {
                             $getter = "get" . ucfirst($column->name);
                         }
                         if (method_exists($object, $getter)) {
                             $value = $object->{$getter}($column->locale);
                         }
                     }
                     if (!empty($column->interpreter)) {
                         $interpreter = $column->interpreter;
                         $value = $interpreter::interpret($value, $column->config);
                         $interpreterObject = new $interpreter();
                         if ($interpreterObject instanceof OnlineShop_Framework_IndexService_RelationInterpreter) {
                             foreach ($value as $v) {
                                 $relData = array();
                                 $relData['src'] = $subObjectId;
                                 $relData['src_virtualProductId'] = $virtualProductId;
                                 $relData['dest'] = $v['dest'];
                                 $relData['fieldname'] = $column->name;
                                 $relData['type'] = $v['type'];
                                 $relationData[] = $relData;
                             }
                         } else {
                             $data[$column->name] = $value;
                         }
                     } else {
                         $data[$column->name] = $value;
                     }
                     if (is_array($data[$column->name])) {
                         $data[$column->name] = OnlineShop_Framework_IndexService_Tenant_IWorker::MULTISELECT_DELIMITER . implode($data[$column->name], OnlineShop_Framework_IndexService_Tenant_IWorker::MULTISELECT_DELIMITER) . OnlineShop_Framework_IndexService_Tenant_IWorker::MULTISELECT_DELIMITER;
                     }
                 } catch (Exception $e) {
                     Logger::err("Exception in IndexService: " . $e->getMessage(), $e);
//.........这里部分代码省略.........
开发者ID:ascertain,项目名称:NGshop,代码行数:101,代码来源:BatchProcessing.php

示例4:

$request->setControllerName("default");
$request->setActionName("default");
$front->setRequest($request);
$front->setResponse(new \Zend_Controller_Response_Cli());
// generic pimcore setup
\Pimcore::setSystemRequirements();
\Pimcore::initAutoloader();
\Pimcore::initConfiguration();
\Pimcore::setupFramework();
\Pimcore::initLogger();
\Pimcore::initModules();
\Pimcore::initPlugins();
//Activate Inheritance for cli-scripts
\Pimcore::unsetAdminMode();
Document::setHideUnpublished(true);
Object\AbstractObject::setHideUnpublished(true);
Object\AbstractObject::setGetInheritedValues(true);
Object\Localizedfield::setGetFallbackValues(true);
// CLI has no memory/time limits
@ini_set('memory_limit', -1);
@ini_set('max_execution_time', -1);
@ini_set('max_input_time', -1);
// Error reporting is enabled in CLI
@ini_set("display_errors", "On");
@ini_set("display_startup_errors", "On");
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
// Pimcore\Console handles maintenance mode through the AbstractCommand
if (!$pimcoreConsole) {
    // skip if maintenance mode is on and the flag is not set
    // we cannot use \Zend_Console_Getopt here because it doesn't allow to be called twice (unrecognized parameter, ...)
    if (\Pimcore\Tool\Admin::isInMaintenanceMode() && !in_array("--ignore-maintenance-mode", $_SERVER['argv'])) {
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:31,代码来源:startup.php

示例5: updateIndex

 public function updateIndex(OnlineShop_Framework_ProductInterfaces_IIndexable $object)
 {
     if (!$this->tenantConfig->isActive($object)) {
         Logger::info("Tenant {$this->name} is not active.");
         return;
     }
     $subObjectIds = $this->tenantConfig->createSubIdsForObject($object);
     foreach ($subObjectIds as $subObjectId => $object) {
         if ($object->getOSDoIndexProduct() && $this->tenantConfig->inIndex($object)) {
             $a = Pimcore::inAdmin();
             $b = \Pimcore\Model\Object\AbstractObject::doGetInheritedValues();
             Pimcore::unsetAdminMode();
             \Pimcore\Model\Object\AbstractObject::setGetInheritedValues(true);
             $hidePublishedMemory = \Pimcore\Model\Object\AbstractObject::doHideUnpublished();
             \Pimcore\Model\Object\AbstractObject::setHideUnpublished(false);
             $categories = $object->getCategories();
             $themes = $object->getTheme();
             $categoryIds = array();
             $parentCategoryIds = array();
             if ($categories) {
                 foreach ($categories as $c) {
                     $parent = $c;
                     if ($parent != null) {
                         if ($parent->getOSProductsInParentCategoryVisible()) {
                             while ($parent && $parent instanceof OnlineShop_Framework_AbstractCategory) {
                                 $parentCategoryIds[$parent->getId()] = $parent->getId();
                                 $parent = $parent->getParent();
                             }
                         } else {
                             $parentCategoryIds[$parent->getId()] = $parent->getId();
                         }
                         $categoryIds[$c->getId()] = $c->getId();
                     }
                 }
             }
             $themeIds = array();
             if ($themes) {
                 foreach ($themes as $theme) {
                     $parent = $theme;
                     if ($parent != null) {
                         $themeIds[$theme->getId()] = $theme->getId();
                     }
                 }
             }
             ksort($categoryIds);
             $virtualProductId = $subObjectId;
             $virtualProductActive = $object->isActive();
             if ($object->getOSIndexType() == "variant") {
                 $virtualProductId = $this->tenantConfig->createVirtualParentIdForSubId($object, $subObjectId);
             }
             $virtualProduct = \Pimcore\Model\Object\AbstractObject::getById($virtualProductId);
             if ($virtualProduct && method_exists($virtualProduct, "isActive")) {
                 $virtualProductActive = $virtualProduct->isActive();
             }
             $data = array("o_id" => $subObjectId, "o_classId" => $object->getClassId(), "o_virtualProductId" => $virtualProductId, "o_virtualProductActive" => $virtualProductActive, "o_parentId" => $object->getOSParentId(), "o_type" => $object->getOSIndexType(), "categoryIds" => ',' . implode(",", $categoryIds) . ",", "parentCategoryIds" => ',' . implode(",", $parentCategoryIds) . ",", "priceSystemName" => $object->getPriceSystemName(), "active" => $object->isActive(), "inProductList" => $object->isActive(true), "theme" => ',' . implode(",", $themeIds) . ",");
             $relationData = array();
             $columnConfig = $this->columnConfig->column;
             if (!empty($columnConfig->name)) {
                 $columnConfig = array($columnConfig);
             } else {
                 if (empty($columnConfig)) {
                     $columnConfig = array();
                 }
             }
             foreach ($columnConfig as $column) {
                 try {
                     $value = null;
                     if (!empty($column->getter)) {
                         $getter = $column->getter;
                         $value = $getter::get($object, $column->config, $subObjectId, $this->tenantConfig);
                     } else {
                         if (!empty($column->fieldname)) {
                             $getter = "get" . ucfirst($column->fieldname);
                         } else {
                             $getter = "get" . ucfirst($column->name);
                         }
                         if (method_exists($object, $getter)) {
                             $value = $object->{$getter}($column->locale);
                         }
                     }
                     if (!empty($column->interpreter)) {
                         $interpreter = $column->interpreter;
                         $value = $interpreter::interpret($value, $column->config);
                         $interpreterObject = new $interpreter();
                         if ($interpreterObject instanceof OnlineShop_Framework_IndexService_RelationInterpreter) {
                             foreach ($value as $v) {
                                 $relData = array();
                                 $relData['src'] = $subObjectId;
                                 $relData['src_virtualProductId'] = $virtualProductId;
                                 $relData['dest'] = $v['dest'];
                                 $relData['fieldname'] = $column->name;
                                 $relData['type'] = $v['type'];
                                 $relationData[] = $relData;
                             }
                         } else {
                             $data[$column->name] = $value;
                         }
                     } else {
                         $data[$column->name] = $value;
                     }
//.........这里部分代码省略.........
开发者ID:ascertain,项目名称:NGshop,代码行数:101,代码来源:DefaultMysql.php


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