Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Drupal\Core\Routing; use Drupal\Component\Utility\UrlHelper; /** * Pro..
Decoded Output download
<?php
namespace Drupal\Core\Routing;
use Drupal\Component\Utility\UrlHelper;
/**
* Provides a trait which ensures that a URL is safe to redirect to.
*/
trait LocalAwareRedirectResponseTrait {
/**
* The request context.
*
* @var \Drupal\Core\Routing\RequestContext
*/
protected $requestContext;
/**
* {@inheritdoc}
*/
protected function isLocal($url) {
return !UrlHelper::isExternal($url) || UrlHelper::externalIsLocal($url, $this->getRequestContext()->getCompleteBaseUrl());
}
/**
* Returns the request context.
*
* @return \Drupal\Core\Routing\RequestContext
*/
protected function getRequestContext() {
if (!isset($this->requestContext)) {
$this->requestContext = \Drupal::service('router.request_context');
}
return $this->requestContext;
}
/**
* Sets the request context.
*
* @param \Drupal\Core\Routing\RequestContext $request_context
* The request context.
*
* @return $this
*/
public function setRequestContext(RequestContext $request_context) {
$this->requestContext = $request_context;
return $this;
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\Core\Routing;
use Drupal\Component\Utility\UrlHelper;
/**
* Provides a trait which ensures that a URL is safe to redirect to.
*/
trait LocalAwareRedirectResponseTrait {
/**
* The request context.
*
* @var \Drupal\Core\Routing\RequestContext
*/
protected $requestContext;
/**
* {@inheritdoc}
*/
protected function isLocal($url) {
return !UrlHelper::isExternal($url) || UrlHelper::externalIsLocal($url, $this->getRequestContext()->getCompleteBaseUrl());
}
/**
* Returns the request context.
*
* @return \Drupal\Core\Routing\RequestContext
*/
protected function getRequestContext() {
if (!isset($this->requestContext)) {
$this->requestContext = \Drupal::service('router.request_context');
}
return $this->requestContext;
}
/**
* Sets the request context.
*
* @param \Drupal\Core\Routing\RequestContext $request_context
* The request context.
*
* @return $this
*/
public function setRequestContext(RequestContext $request_context) {
$this->requestContext = $request_context;
return $this;
}
}
Function Calls
None |
Stats
MD5 | f6c65442e846b93a088972a120a1877c |
Eval Count | 0 |
Decode Time | 98 ms |