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


PHP ScopeConfigInterface::isEnabled方法代码示例

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


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

示例1: aroundRenderResult

 /**
  * @param \Magento\Framework\Controller\ResultInterface $subject
  * @param callable $proceed
  * @param ResponseHttp $response
  * @return \Magento\Framework\Controller\ResultInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundRenderResult(\Magento\Framework\Controller\ResultInterface $subject, \Closure $proceed, ResponseHttp $response)
 {
     $result = $proceed($response);
     $usePlugin = $this->registry->registry('use_page_cache_plugin');
     if (!$usePlugin || !$this->config->isEnabled() || $this->config->getType() != \Magento\PageCache\Model\Config::BUILT_IN) {
         return $result;
     }
     if ($this->state->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) {
         $cacheControlHeader = $response->getHeader('Cache-Control');
         if ($cacheControlHeader instanceof \Zend\Http\Header\HeaderInterface) {
             $response->setHeader('X-Magento-Cache-Control', $cacheControlHeader->getFieldValue());
         }
         $response->setHeader('X-Magento-Cache-Debug', 'MISS', true);
     }
     $tagsHeader = $response->getHeader('X-Magento-Tags');
     $tags = [];
     if ($tagsHeader) {
         $tags = explode(',', $tagsHeader->getFieldValue());
         $response->clearHeader('X-Magento-Tags');
     }
     $tags = array_unique(array_merge($tags, [\Magento\PageCache\Model\Cache\Type::CACHE_TAG]));
     $response->setHeader('X-Magento-Tags', implode(',', $tags));
     $this->kernel->process($response);
     return $result;
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:32,代码来源:BuiltinPlugin.php

示例2: execute

 /**
  * Purges CloudFlare cache by tag
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if (!$this->config->isEnabled()) {
         return;
     }
     $object = $observer->getEvent()->getObject();
     if ($object instanceof \Magento\Framework\DataObject\IdentityInterface === false || empty($object->getIdentities())) {
         return;
     }
     $this->cacheTags->purgeCacheTags($object->getIdentities());
 }
开发者ID:cloudflare,项目名称:cloudflare-magento,代码行数:17,代码来源:InvalidateCloudFlareObserver.php

示例3: aroundDispatch

 /**
  * @param \Magento\Framework\App\FrontControllerInterface $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return false|\Magento\Framework\App\Response\Http|\Magento\Framework\Controller\ResultInterface
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontControllerInterface $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     $response = $proceed($request);
     if ($this->config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->config->isEnabled() && $response instanceof \Magento\Framework\App\Response\Http) {
         $this->version->process();
         if ($this->state->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) {
             $response->setHeader('X-Magento-Debug', 1);
         }
     }
     return $response;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:VarnishPlugin.php

示例4: aroundRenderResult

 /**
  * @param \Magento\Framework\Controller\ResultInterface $subject
  * @param callable $proceed
  * @param ResponseHttp $response
  * @return \Magento\Framework\Controller\ResultInterface
  */
 public function aroundRenderResult(\Magento\Framework\Controller\ResultInterface $subject, \Closure $proceed, ResponseHttp $response)
 {
     $proceed($response);
     $usePlugin = $this->registry->registry('use_page_cache_plugin');
     if ($this->config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->config->isEnabled() && $usePlugin) {
         $this->version->process();
         if ($this->state->getMode() == \Magento\Framework\App\State::MODE_DEVELOPER) {
             $response->setHeader('X-Magento-Debug', 1);
         }
     }
     return $subject;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:VarnishPlugin.php

示例5: execute

 /**
  * If Varnish caching is enabled it collects array of tags
  * of incoming object and asks to clean cache.
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->config->isEnabled()) {
         $object = $observer->getEvent()->getObject();
         if ($object instanceof \Magento\Framework\DataObject\IdentityInterface) {
             $tags = [];
             $pattern = "((^|,)%s(,|\$))";
             foreach ($object->getIdentities() as $tag) {
                 $tags[] = sprintf($pattern, preg_replace("~_\\d+\$~", '', $tag));
                 $tags[] = sprintf($pattern, $tag);
             }
             $this->purgeCache->sendPurgeRequest(implode('|', array_unique($tags)));
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:InvalidateVarnishObserver.php

示例6: aroundDispatch

 /**
  * @param \Magento\Framework\App\FrontControllerInterface $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\Controller\ResultInterface|\Magento\Framework\App\Response\Http
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\FrontControllerInterface $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->config->isEnabled() || $this->config->getType() != \Magento\PageCache\Model\Config::BUILT_IN) {
         return $proceed($request);
     }
     $this->version->process();
     $result = $this->kernel->load();
     if ($result === false) {
         $result = $proceed($request);
         if ($result instanceof ResponseHttp) {
             $this->addDebugHeaders($result);
             $this->kernel->process($result);
         }
     } else {
         $this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'HIT', true);
     }
     return $result;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:25,代码来源:BuiltinPlugin.php

示例7: aroundDispatch

 /**
  * @param \Magento\Framework\App\FrontControllerInterface $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return false|\Magento\Framework\App\Response\Http
  */
 public function aroundDispatch(\Magento\Framework\App\FrontControllerInterface $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     if ($this->config->getType() == \Magento\PageCache\Model\Config::BUILT_IN && $this->config->isEnabled()) {
         $this->version->process();
         $response = $this->kernel->load();
         if ($response === false) {
             $response = $proceed($request);
             $cacheControl = $response->getHeader('Cache-Control')['value'];
             $this->addDebugHeader($response, 'X-Magento-Cache-Control', $cacheControl);
             $this->kernel->process($response);
             $this->addDebugHeader($response, 'X-Magento-Cache-Debug', 'MISS');
         } else {
             $this->addDebugHeader($response, 'X-Magento-Cache-Debug', 'HIT');
         }
     } else {
         return $response = $proceed($request);
     }
     return $response;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:25,代码来源:BuiltinPlugin.php

示例8: execute

 /**
  * Flush CloudFlare cache
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(Observer $observer)
 {
     if ($this->config->isEnabled()) {
         $this->cacheTags->purgeCache();
     }
 }
开发者ID:cloudflare,项目名称:cloudflare-magento,代码行数:12,代码来源:FlushAllCloudFlareObserver.php

示例9: flushAllCache

 /**
  * Flash Varnish cache
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function flushAllCache(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_config->getType() == \Magento\PageCache\Model\Config::VARNISH && $this->_config->isEnabled()) {
         $this->sendPurgeRequest('.*');
     }
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:Observer.php


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