diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6cd69aa31ead90c957c72ffb8038a791f62dd1f..aa26b4cf64adcd0cfd4078e322a04e4101efd28d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,8 @@ include: # https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml # Uncomment the lines below if you want to override any of the variables. The following is just an example. ################ -# variables: +variables: + _CSPELL_WORDS: 'antonín, slejška, ipinfo, keycdn, iplocation' # SKIP_ESLINT: '1' # OPT_IN_TEST_NEXT_MAJOR: '1' # _CURL_TEMPLATES_REF: 'main' diff --git a/README.md b/README.md index 7d37a8f1a54c63130c65cbb5da90e85bc478c30e..c85040825f7853f0440994df34b2212c0d6f43b4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## INTRODUCTION -The IP Info module summarizes informations for IPs: +The IP Info module summarizes information for IPs: - Log messages with the IP - Is the IP banned? @@ -32,4 +32,3 @@ directly in the Drupal administration. Current maintainers: - Antonín Slejška - https://www.drupal.org/u/anton%C3%ADn-slej%C5%A1ka - diff --git a/src/Controller/IpController.php b/src/Controller/IpController.php index 33fdd8126ebe80f04e31142d44560dff4d33940b..fb5479f1e6d6cb64f8d8a63b0495825d5e32b4ea 100644 --- a/src/Controller/IpController.php +++ b/src/Controller/IpController.php @@ -22,6 +22,8 @@ use Drupal\Component\Utility\Unicode; class IpController extends DbLogController { /** + * The ban IP manager. + * * @var \Drupal\ban\BanIpManagerInterface */ protected $ipManager; @@ -29,6 +31,14 @@ class IpController extends DbLogController { /** * Constructs a new IpController object. * + * @param \Drupal\Core\Database\Connection $database + * The database connection. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler. + * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter + * The date formatter. + * @param \Drupal\Core\Form\FormBuilderInterface $form_builder + * The form builder. * @param \Drupal\ban\BanIpManagerInterface $ip_manager * The ban IP manager. */ @@ -56,10 +66,12 @@ class IpController extends DbLogController { // Add unban link. if (isset($ban_id)) { $build['dblog_filter_form']['#prefix'] .= Link::fromTextAndUrl($this->t('Unban this IP address'), Url::fromRoute('ban.delete', ['ban_id' => $ban_id]))->toString() . '.</p>'; - } else { + } + else { $build['dblog_filter_form']['#prefix'] .= '</p>'; } - } else { + } + else { $build['dblog_filter_form']['#prefix'] = '<p>' . $this->t('The IP address is not banned.') . ' '; // Add ban link. $build['dblog_filter_form']['#prefix'] .= Link::fromTextAndUrl($this->t('Ban this IP address'), Url::fromRoute('ban.admin_page', ['default_ip' => $ip_address]))->toString() . '.</p>'; @@ -78,7 +90,7 @@ class IpController extends DbLogController { } // Remove the last comma. $lookup_services_links = rtrim($lookup_services_links, ', '); - $build['dblog_filter_form']['#prefix'] .= '<p>' . $this->t('Lookup the IP: ') . $lookup_services_links . '</p>'; + $build['dblog_filter_form']['#prefix'] .= '<p>' . $this->t('Lookup the IP:') . ' ' . $lookup_services_links . '</p>'; // Get IP data from IPinfo.io API. if ( @@ -203,7 +215,7 @@ class IpController extends DbLogController { 'data' => [ // Cells. ['class' => ['icon']], - $this->t($dblog->type), + $dblog->type, $this->dateFormatter->format($dblog->timestamp, 'short'), $message, ['data' => $username], diff --git a/src/Routing/RouteSubscriber.php b/src/Routing/RouteSubscriber.php index 49f594819191fe8234bb28efd51ece0b70693fd3..c55fd84693acaf9a28132f9da1f36c7523d58aea 100644 --- a/src/Routing/RouteSubscriber.php +++ b/src/Routing/RouteSubscriber.php @@ -5,6 +5,9 @@ namespace Drupal\ip_info\Routing; use Drupal\Core\Routing\RouteSubscriberBase; use Symfony\Component\Routing\RouteCollection; +/** + * Subscriber for IP info routes. + */ class RouteSubscriber extends RouteSubscriberBase { /**