-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tab to update cloudflare turnstile keys * Remove unneeded global * docs column
- Loading branch information
Showing
4 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?php | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; // Exit if accessed directly | ||
} | ||
|
||
/** | ||
* Class DT_Multisite_Tab_Google Map_Keys | ||
*/ | ||
class DT_Multisite_Tab_Cloudflare | ||
{ | ||
public function content(){ | ||
$this->process_post(); | ||
?> | ||
<div class="wrap"> | ||
<div id="poststuff"> | ||
<div id="post-body" class="metabox-holder columns-2"> | ||
<div id="post-body-content"> | ||
<!-- Main Column --> | ||
|
||
<?php $this->list_keys() ?> | ||
|
||
<!-- End Main Column --> | ||
</div><!-- end post-body-content --> | ||
<div id="postbox-container-1" class="postbox-container"> | ||
<!-- Right Column --> | ||
|
||
<?php $this->documentation() ?> | ||
|
||
<!-- --><?php //$this->default_key() ?> | ||
|
||
|
||
<!-- End Right Column --> | ||
</div><!-- postbox-container 1 --> | ||
<div id="postbox-container-2" class="postbox-container"> | ||
</div><!-- postbox-container 2 --> | ||
</div><!-- post-body meta box container --> | ||
</div><!--poststuff end --> | ||
</div><!-- wrap end --> | ||
<?php | ||
} | ||
|
||
public function process_post() { | ||
// update | ||
if ( isset( $_POST['cloudflare_nonce'] ) | ||
&& wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cloudflare_nonce'] ) ), 'cloudflare' ) ) { | ||
|
||
update_site_option( 'dt_cloudflare_site_key', sanitize_text_field( wp_unslash( $_POST['dt_cloudflare_site_key'] ?? '' ) ) ); | ||
update_site_option( 'dt_cloudflare_secret_key', sanitize_text_field( wp_unslash( $_POST['dt_cloudflare_secret_key'] ?? '' ) ) ); | ||
} | ||
} | ||
|
||
public function list_keys(){ | ||
$network_cloudflare_site_key = get_site_option( 'dt_cloudflare_site_key', '' ); | ||
$network_cloudflare_secret_key = get_site_option( 'dt_cloudflare_secret_key', '' ); | ||
|
||
?> | ||
<!-- Box --> | ||
<form method="post"> | ||
<?php wp_nonce_field( 'cloudflare', 'cloudflare_nonce' ) ?> | ||
<table class="widefat striped"> | ||
<thead> | ||
<tr> | ||
<th>Option</th> | ||
<th>Keys</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td style="width:30%;"> | ||
Cloudflare Turnstile Site Key | ||
</td> | ||
<td> | ||
<input type="text" class="regular-text" style="width:100%;" value="<?php echo esc_attr( $network_cloudflare_site_key ) ?>" name="dt_cloudflare_site_key" placeholder="add site key" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="width:30%;"> | ||
Cloudflare Turnstile Secret Key | ||
</td> | ||
<td> | ||
<input type="password" class="regular-text" style="width:100%;" value="<?php echo esc_attr( $network_cloudflare_secret_key ) ?>" name="dt_cloudflare_secret_key" placeholder="add secret key" /> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="width:10%;"> | ||
<button class="button btn" type="submit">Update</button> | ||
</td> | ||
<td></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</form> | ||
<br> | ||
<!-- End Box --> | ||
<?php | ||
} | ||
|
||
public function documentation(){ | ||
?> | ||
<!-- Box --> | ||
<div class="postbox"> | ||
<h3 class="hndle">Documentation</h3> | ||
<div class="inside"> | ||
<p> | ||
<?php esc_html_e( 'Cloudflare Turnstile is a security feature that helps protect your website from spam and abuse. It is a free service that requires a site key and a secret key.', 'disciple-tools' ) ?> | ||
</p> | ||
<p> | ||
See <a href="https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/">Turnstile Documentation</a> | ||
</p> | ||
</div> | ||
</div> | ||
<!-- End Box --> | ||
<?php | ||
} | ||
} |
File renamed without changes.