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


PHP Drupal::Request方法代码示例

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


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

示例1: onKernelRequest

 /**
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     // Store server information for SPI in case data is being sent from PHP CLI.
     if (PHP_SAPI == 'cli') {
         return;
     }
     // Check that there's no form submission in progress.
     if (\Drupal::request()->server->get('REQUEST_METHOD') == 'POST') {
         return;
     }
     // Check that we're not on an AJAX overlay page.
     if (\Drupal::request()->isXmlHttpRequest()) {
         return;
     }
     // Check that we're not serving a private file or image
     $controller_name = \Drupal::request()->attributes->get('_controller');
     if (strpos($controller_name, 'FileDownloadController') !== FALSE || strpos($controller_name, 'ImageStyleDownloadController') !== FALSE) {
         return;
     }
     $config = $this->configFactory->get('acquia_connector.settings');
     // Get the last time we processed data.
     $last = $this->state->get('acquia_connector.boot_last', 0);
     // 60 minute interval for storing the global variable.
     $interval = $config->get('cron_interval');
     if ($config->get('cron_interval_override')) {
         $interval = $config->get('cron_interval_override');
     }
     // Determine if the required interval has passed.
     $now = REQUEST_TIME;
     if ($now - $last > $interval * 60) {
         $platform = Controller\SpiController::getPlatform();
         // acquia_spi_data_store_set() replacement.
         $expire = REQUEST_TIME + 60 * 60 * 24;
         $this->cache->set('acquia.spi.platform', $platform, $expire);
         $this->state->set('acquia_connector.boot_last', $now);
     }
     if ($config->get('hide_signup_messages')) {
         return;
     }
     // Check that we're not on one of our own config pages, all of which are prefixed
     // with admin/config/system/acquia-connector.
     $current_path = \Drupal::Request()->attributes->get('_system_path');
     if (\Drupal::service('path.matcher')->matchPath($current_path, 'admin/config/system/acquia-connector/*')) {
         return;
     }
     // Check that the user has 'administer site configuration' permission.
     if (!\Drupal::currentUser()->hasPermission('administer site configuration')) {
         return;
     }
     // Check that there are no Acquia credentials currently set up.
     if (Subscription::hasCredentials()) {
         return;
     }
     // Display a message asking to connect to the Acquia Network.
     $text = 'Sign up for Acquia Cloud Free, a free Drupal sandbox to experiment with new features, test your code quality, and apply continuous integration best practices. Check out the <a href="@acquia-free">epic set of dev features and tools</a> that come with your free subscription.<br/>If you have an Acquia Subscription, <a href="@settings">connect now</a>. Otherwise, you can turn this message off by disabling the Acquia Connector modules.';
     if (\Drupal::request()->server->has('AH_SITE_GROUP')) {
         $text = '<a href="@settings">Connect your site to the Acquia Subscription now</a>. <a href="@more">Learn more</a>.';
     }
     $message = t($text, ['@more' => Url::fromUri('https://docs.acquia.com/network/install')->getUri(), '@acquia-free' => Url::fromUri('https://www.acquia.com/acquia-cloud-free')->getUri(), '@settings' => Url::fromRoute('acquia_connector.setup')->toString()]);
     drupal_set_message($message, 'warning', FALSE);
 }
开发者ID:alexku,项目名称:travisintegrationtest,代码行数:64,代码来源:InitSubscriber.php


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