Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions includes/classes/ThirdParty/Altcha.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Modifications to Altcha.
*
* @package Orbit
*/

namespace Eighteen73\Orbit\ThirdParty;

use Eighteen73\Orbit\Singleton;

/**
* Modifications to Altcha.
*/
class Altcha {
use Singleton;

/**
* Run on init
*
* @return void
*/
public function setup() {
add_filter( 'altcha_challenge_url', [ $this, 'altcha_challenge_url' ] );
}

/**
* Override the Altcha challenge URL
* We want to ensure the url is never cached, so we add a query string to ensure it's always unique.
*
* @param string $url The Altcha challenge URL
* @return string
*/
public function altcha_challenge_url( string $url ): string {
return $url . '?r=' . wp_rand( 1000, 9999 );
}
}
1 change: 1 addition & 0 deletions orbit.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
DisallowIndexing\DisallowIndexing::instance()->setup();
Performance\Fast404::instance()->setup();
ThirdParty\WooCommerce::instance()->setup();
ThirdParty\Altcha::instance()->setup();

add_action(
'init',
Expand Down
Loading