Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/core/componen.../api/spam
File: ReCaptcha.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Wrapper for ProviderName's API.
[3] Fix | Delete
*
[4] Fix | Delete
* @since 4.0.7
[5] Fix | Delete
*
[6] Fix | Delete
* @package ET\Core\API\Misc\ReCaptcha
[7] Fix | Delete
*/
[8] Fix | Delete
class ET_Core_API_Spam_ReCaptcha extends ET_Core_API_Spam_Provider {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* @inheritDoc
[12] Fix | Delete
*/
[13] Fix | Delete
public $BASE_URL = 'https://www.google.com/recaptcha/api/siteverify';
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* @inheritDoc
[17] Fix | Delete
*/
[18] Fix | Delete
public $max_accounts = 1;
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* @inheritDoc
[22] Fix | Delete
*/
[23] Fix | Delete
public $name = 'ReCaptcha';
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* @inheritDoc
[27] Fix | Delete
*/
[28] Fix | Delete
public $slug = 'recaptcha';
[29] Fix | Delete
[30] Fix | Delete
public function __construct( $owner = 'ET_Core', $account_name = '', $api_key = '' ) {
[31] Fix | Delete
parent::__construct( $owner, $account_name, $api_key );
[32] Fix | Delete
[33] Fix | Delete
$this->_add_actions_and_filters();
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
protected function _add_actions_and_filters() {
[37] Fix | Delete
if ( ! is_admin() && ! et_core_is_fb_enabled() ) {
[38] Fix | Delete
add_action( 'wp_enqueue_scripts', array( $this, 'action_wp_enqueue_scripts' ) );
[39] Fix | Delete
}
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
public function action_wp_enqueue_scripts() {
[43] Fix | Delete
$deps = array( 'jquery', 'es6-promise' );
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* reCAPTCHA v3 actions may only contain alphanumeric characters and slashes/underscore.
[47] Fix | Delete
* https://developers.google.com/recaptcha/docs/v3#actions
[48] Fix | Delete
*
[49] Fix | Delete
* Replace all non-alphanumeric characters with underscore.
[50] Fix | Delete
* Ex: '?page_id=254980' => '_page_id_254980'
[51] Fix | Delete
*/
[52] Fix | Delete
$action = preg_replace( '/[^A-Za-z0-9]/', '_', basename( get_the_permalink() ) );
[53] Fix | Delete
[54] Fix | Delete
if ( $this->is_enabled() ) {
[55] Fix | Delete
$deps[] = 'recaptcha-v3';
[56] Fix | Delete
[57] Fix | Delete
wp_enqueue_script( 'recaptcha-v3', "https://www.google.com/recaptcha/api.js?render={$this->data['site_key']}" );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
wp_enqueue_script( 'es6-promise', ET_CORE_URL . 'admin/js/es6-promise.auto.min.js' );
[61] Fix | Delete
wp_enqueue_script( 'et-core-api-spam-recaptcha', ET_CORE_URL . 'admin/js/recaptcha.js', $deps );
[62] Fix | Delete
wp_localize_script( 'et-core-api-spam-recaptcha', 'et_core_api_spam_recaptcha', array(
[63] Fix | Delete
'site_key' => empty( $this->data['site_key'] ) ? '' : $this->data['site_key'],
[64] Fix | Delete
'page_action' => array( 'action' => $action ),
[65] Fix | Delete
) );
[66] Fix | Delete
}
[67] Fix | Delete
[68] Fix | Delete
public function is_enabled() {
[69] Fix | Delete
return isset( $this->data['site_key'], $this->data['secret_key'] )
[70] Fix | Delete
&& et_()->all( array( $this->data['site_key'], $this->data['secret_key'] ) );
[71] Fix | Delete
}
[72] Fix | Delete
[73] Fix | Delete
/**
[74] Fix | Delete
* Verify a form submission.
[75] Fix | Delete
*
[76] Fix | Delete
* @since 4.0.7
[77] Fix | Delete
*
[78] Fix | Delete
* @global $_POST['token']
[79] Fix | Delete
*
[80] Fix | Delete
* @return mixed[]|string $result {
[81] Fix | Delete
* Interaction Result
[82] Fix | Delete
*
[83] Fix | Delete
* @type bool $success Whether or not the request was valid for this site.
[84] Fix | Delete
* @type int $score Score for the request (0 < score < 1).
[85] Fix | Delete
* @type string $action Action name for this request (important to verify).
[86] Fix | Delete
* @type string $challenge_ts Timestamp of the challenge load (ISO format yyyy-MM-ddTHH:mm:ssZZ).
[87] Fix | Delete
* @type string $hostname Hostname of the site where the challenge was solved.
[88] Fix | Delete
* @type string[] $error-codes Optional
[89] Fix | Delete
* }
[90] Fix | Delete
*/
[91] Fix | Delete
public function verify_form_submission() {
[92] Fix | Delete
$args = array(
[93] Fix | Delete
'secret' => $this->data['secret_key'],
[94] Fix | Delete
'response' => et_()->array_get_sanitized( $_POST, 'token' ),
[95] Fix | Delete
'remoteip' => et_core_get_ip_address(),
[96] Fix | Delete
);
[97] Fix | Delete
[98] Fix | Delete
$this->prepare_request( $this->BASE_URL, 'POST', false, $args );
[99] Fix | Delete
$this->make_remote_request();
[100] Fix | Delete
[101] Fix | Delete
return $this->response->ERROR ? $this->response->ERROR_MESSAGE : $this->response->DATA;
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
/**
[105] Fix | Delete
* @inheritDoc
[106] Fix | Delete
*/
[107] Fix | Delete
public function get_account_fields() {
[108] Fix | Delete
return array(
[109] Fix | Delete
'site_key' => array(
[110] Fix | Delete
'label' => esc_html__( 'Site Key (v3)', 'et_core' ),
[111] Fix | Delete
),
[112] Fix | Delete
'secret_key' => array(
[113] Fix | Delete
'label' => esc_html__( 'Secret Key (v3)', 'et_core' ),
[114] Fix | Delete
),
[115] Fix | Delete
);
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
/**
[119] Fix | Delete
* @inheritDoc
[120] Fix | Delete
*/
[121] Fix | Delete
public function get_data_keymap( $keymap = array() ) {
[122] Fix | Delete
return array(
[123] Fix | Delete
'ip_address' => 'remoteip',
[124] Fix | Delete
'response' => 'response',
[125] Fix | Delete
'secret_key' => 'secret',
[126] Fix | Delete
);
[127] Fix | Delete
}
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function