Making WordPress.org


Ignore:
Timestamp:
06/29/2018 08:57:02 PM (8 years ago)
Author:
obenland
Message:

Main: phpcs updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/inc/recaptcha.php

    r7218 r7350  
    22/**
    33 * Functions for reCAPTCHA.
     4 *
     5 * @package WordPressdotorg\MainTheme
    46 */
     7
    58namespace WordPressdotorg\MainTheme\reCAPTCHA;
    69
     10/**
     11 * Enqueues reCAPTCHA scripts.
     12 *
     13 * @param mixed $form_id Form ID.
     14 */
    715function enqueue_script( $form_id ) {
    816    if ( ! defined( 'RECAPTCHA_INVIS_PUBKEY' ) ) {
     
    1119
    1220    wp_enqueue_script( 'recaptcha-api', 'https://www.google.com/recaptcha/api.js', array(), '2' );
    13     wp_add_inline_script( 'recaptcha-api', 'function reCAPTCHAPostSubmit(token) { document.getElementById(' . json_encode( (string)$form_id ) . ').submit(); }' );
     21    wp_add_inline_script( 'recaptcha-api', 'function reCAPTCHAPostSubmit(token) { document.getElementById(' . wp_json_encode( (string) $form_id ) . ').submit(); }' );
    1422}
    1523
     24/**
     25 * Displays a submit button.
     26 *
     27 * @param string $submit_text Button text.
     28 * @param string $classes     CSS classes.
     29 */
    1630function display_submit_button( $submit_text = 'Submit', $classes = 'button' ) {
    1731    echo '<input' .
     
    2539}
    2640
     41// phpcs:disable WordPress.VIP, WordPress.CSRF.NonceVerification.NoNonceVerification
     42
     43/**
     44 * Response status.
     45 *
     46 * @return bool
     47 */
    2748function check_status() {
    2849    // If reCAPTCHA is not setup, skip it.
     
    3758    $verify = array(
    3859        'secret'   => RECAPTCHA_INVIS_PRIVKEY,
    39         'remoteip' => $_SERVER['REMOTE_ADDR'],
    40         'response' => $_POST['g-recaptcha-response'],
     60        'remoteip' => wp_unslash( $_SERVER['REMOTE_ADDR'] ),
     61        'response' => wp_unslash( $_POST['g-recaptcha-response'] ),
    4162    );
    4263
    4364    $resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array( 'body' => $verify ) );
    4465
    45     if ( is_wp_error( $resp ) || 200 != wp_remote_retrieve_response_code( $resp ) ) {
     66    if ( is_wp_error( $resp ) || 200 !== wp_remote_retrieve_response_code( $resp ) ) {
    4667        return false;
    4768    }
Note: See TracChangeset for help on using the changeset viewer.