Commit f2466023 authored by elachlan's avatar elachlan

Issue #2798991 by naveenvalecha: Fix coding standards & replace the deprecated methods

parent 4a5de631
......@@ -48,7 +48,7 @@ function captcha_set_form_id_setting($form_id, $captcha_type) {
* @param bool $symbolic
* Flag to return as (symbolic) strings instead of object.
*
* @return NULL|CaptchaPoint
* @return null|CaptchaPoint
* NULL if no setting is known
* captcha point object with fields 'module' and 'captcha_type'.
* If argument $symbolic is true, returns 'default' or in the
......
......@@ -137,7 +137,7 @@ function captcha_install() {
// Explain to users that page caching may be disabled.
if ($config = \Drupal::config('system.performance')
->get('cache.page.use_internal') != 0
->get('cache.page.use_internal') != 0
) {
drupal_set_message(\Drupal::translation()
->translate('Note that the CAPTCHA module disables <a href="@performance_admin">page caching</a> of pages that include a CAPTCHA challenge.',
......
......@@ -14,4 +14,3 @@ image_captcha_bilinear_interpolation: 0
image_captcha_dot_noise: 0
image_captcha_line_noise: 0
image_captcha_noise_level: 5
......@@ -2,7 +2,6 @@ name: Image CAPTCHA
type: module
description: Provides an image based CAPTCHA.
package: Spam control
version: 8.x
core: 8.x
dependencies:
- captcha
......
......@@ -6,7 +6,7 @@
*/
(function ($) {
"use strict";
'use strict';
Drupal.behaviors.captchaAdmin = {
attach: function (context) {
......@@ -14,34 +14,34 @@
// Helper function to show/hide noise level widget.
var noise_level_shower = function (speed) {
speed = (typeof speed == 'undefined') ? 'slow' : speed;
if ($("#edit-image-captcha-dot-noise").is(":checked")
|| $("#edit-image-captcha-line-noise").is(":checked")) {
$(".form-item-image-captcha-noise-level").show(speed);
if ($('#edit-image-captcha-dot-noise').is(':checked')
|| $('#edit-image-captcha-line-noise').is(':checked')) {
$('.form-item-image-captcha-noise-level').show(speed);
}
else {
$(".form-item-image-captcha-noise-level").hide(speed);
$('.form-item-image-captcha-noise-level').hide(speed);
}
};
// Add onclick handler to the dot and line noise check boxes.
$("#edit-image-captcha-dot-noise").click(noise_level_shower);
$("#edit-image-captcha-line-noise").click(noise_level_shower);
$('#edit-image-captcha-dot-noise').click(noise_level_shower);
$('#edit-image-captcha-line-noise').click(noise_level_shower);
// Show or hide appropriately on page load.
noise_level_shower(0);
// Helper function to show/hide smooth distortion widget.
var smooth_distortion_shower = function (speed) {
speed = (typeof speed == 'undefined') ? 'slow' : speed;
if ($("#edit-image-captcha-distortion-amplitude").val() > 0) {
$(".form-item-image-captcha-bilinear-interpolation").show(speed);
if ($('#edit-image-captcha-distortion-amplitude').val() > 0) {
$('.form-item-image-captcha-bilinear-interpolation').show(speed);
}
else {
$(".form-item-image-captcha-bilinear-interpolation").hide(speed);
$('.form-item-image-captcha-bilinear-interpolation').hide(speed);
}
};
// Add onchange handler to the distortion level select widget.
$("#edit-image-captcha-distortion-amplitude").change(
$('#edit-image-captcha-distortion-amplitude').change(
smooth_distortion_shower);
// Show or hide appropriately on page load.
smooth_distortion_shower(0);
......
......@@ -69,7 +69,7 @@ class CaptchaSettingsForm extends ConfigFormBase {
$form['form_protection']['default_challenge'] = [
'#type' => 'select',
'#title' => $this->t('Default challenge type'),
'#description' => $this->t('Select the default challenge type for CAPTCHAs. This can be overriden for each form if desired.'),
'#description' => $this->t('Select the default challenge type for CAPTCHAs. This can be overridden for each form if desired.'),
'#options' => _captcha_available_challenge_types(FALSE),
'#default_value' => $config->get('default_challenge'),
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment