Add setting for Patreon campaign link
This commit is contained in:
parent
9593ca2826
commit
4653c0b7b1
@ -941,6 +941,12 @@ define( 'FICTIONEER_OPTIONS', array(
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'label' => __( 'Patreon Client Secret', 'fictioneer' )
|
||||
),
|
||||
'fictioneer_patreon_campaign_link' => array(
|
||||
'name' => 'fictioneer_patreon_campaign_link',
|
||||
'group' => 'fictioneer-settings-connections-group',
|
||||
'sanitize_callback' => 'fictioneer_sanitize_patreon_url',
|
||||
'label' => __( 'Patreon campaign link', 'fictioneer' )
|
||||
),
|
||||
'fictioneer_patreon_global_lock_tiers' => array(
|
||||
'name' => 'fictioneer_patreon_global_lock_tiers',
|
||||
'group' => 'fictioneer-settings-connections-group',
|
||||
@ -1283,6 +1289,24 @@ function fictioneer_sanitize_list_into_unique_array( $input ) {
|
||||
return fictioneer_sanitize_list_into_array( $input, array( 'unique' => 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes a Patreon URL
|
||||
*
|
||||
* @since 5.15.0
|
||||
*
|
||||
* @param string $url The URL entered.
|
||||
*
|
||||
* @return array The sanitized URL or an empty string if invalid.
|
||||
*/
|
||||
|
||||
function fictioneer_sanitize_patreon_url( $url ) {
|
||||
$url = sanitize_url( $url );
|
||||
$url = filter_var( $url, FILTER_VALIDATE_URL ) ? $url : '';
|
||||
$url = strpos( $url, 'https://www.patreon.com/') === 0 ? $url : '';
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// SANITIZE OPTION FILTERS
|
||||
// =============================================================================
|
||||
|
@ -110,6 +110,10 @@ $patreon_tiers = is_array( $patreon_tiers ) ? $patreon_tiers : [];
|
||||
<?php fictioneer_settings_text_input( 'fictioneer_patreon_client_secret' ); ?>
|
||||
</div>
|
||||
|
||||
<div class="fictioneer-card__row">
|
||||
<?php fictioneer_settings_text_input( 'fictioneer_patreon_campaign_link' ); ?>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="fictioneer-card__row">
|
||||
|
Loading…
x
Reference in New Issue
Block a user