/** * {@inheritdoc} */ public function matches(Request $request) { $path = $request->getPathInfo(); $patterns = $this->configFactory->get('xhprof.config')->get('exclude'); // never collect phpinfo page. $patterns .= "\r\n/admin/reports/status/php"; return !$this->pathMatcher->matchPath($path, $patterns); }
/** * {@inheritdoc} */ public function matches(Request $request) { $path = $request->getPathInfo(); $patterns = $this->configFactory->get('webprofiler.config')->get('exclude'); // never add Webprofiler to phpinfo page. $patterns .= "\r\n/admin/reports/status/php"; // never add Webprofiler to uninstall confirm page. $patterns .= "\r\n/admin/modules/uninstall/*"; return !$this->pathMatcher->matchPath($path, $patterns); }
/** * {@inheritdoc} */ public function evaluate() { // Convert path to lowercase. This allows comparison of the same path // with different case. Ex: /Page, /page, /PAGE. $pages = Unicode::strtolower($this->configuration['pages']); if (!$pages) { return TRUE; } $request = $this->requestStack->getCurrentRequest(); // Compare the lowercase path alias (if any) and internal path. $path = rtrim($this->currentPath->getPath($request), '/'); $path_alias = Unicode::strtolower($this->aliasManager->getAliasByPath($path)); return $this->pathMatcher->matchPath($path_alias, $pages) || $path != $path_alias && $this->pathMatcher->matchPath($path, $pages); }
/** * {@inheritdoc} */ public function evaluate() { // Convert path to lowercase. This allows comparison of the same path // with different case. Ex: /Page, /page, /PAGE. $pages = Unicode::strtolower($this->configuration['pages']); if (!$pages) { return TRUE; } $request = $this->requestStack->getCurrentRequest(); // Compare the lowercase path alias (if any) and internal path. // @todo Remove dependency on the internal _system_path attribute: // https://www.drupal.org/node/2293581. $path = $request->attributes->get('_system_path'); $path_alias = Unicode::strtolower($this->aliasManager->getAliasByPath($path)); return $this->pathMatcher->matchPath($path_alias, $pages) || $path != $path_alias && $this->pathMatcher->matchPath($path, $pages); }
/** * Checks whether a give path matches the ng-lightbox path rules. * This function checks both internal paths and aliased paths. * * @param \Drupal\Core\Url $url * The Url object. * * @return bool * TRUE if it matches the given rules. */ public function isNgLightboxEnabledPath(Url $url) { // No lightbox on external Urls. if ($url->isExternal()) { return FALSE; } // If we don't want to enable the Lightbox on admin pages. if ($this->config->get('skip_admin_paths') && $this->adminContext->isAdminRoute()) { return FALSE; } // @TODO, decide whether we want to try and support paths or to adopt routes // like core is trying to force us into. $path = strtolower($url->toString()); // We filter out empty paths because some modules (such as Media) use // theme_link() to generate links with empty paths. if (empty($path)) { return FALSE; } // Remove the base path. if ($base_path = \Drupal::request()->getBasePath()) { $path = substr($path, strlen($base_path)); } // Check the cache, see if we've handled this before. if (isset($this->matches[$path])) { return $this->matches[$path]; } // Normalise the patterns as well so they match the normalised paths. $patterns = strtolower($this->config->get('patterns')); // Check for internal paths first which is much quicker than the alias lookup. if ($this->pathMatcher->matchPath($path, $patterns)) { $this->matches[$path] = TRUE; } else { // Now check for aliases paths. $aliased_path = strtolower($this->aliasManager->getAliasByPath($path)); if ($path != $aliased_path && $this->pathMatcher->matchPath($aliased_path, $patterns)) { $this->matches[$path] = TRUE; } else { // No match. $this->matches[$path] = FALSE; } } return $this->matches[$path]; }