Skip to content
Open
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
10 changes: 6 additions & 4 deletions admin/class-gdpr-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ public function sanitize_consents( $consents ) {
unset( $consents[ $key ] );
continue;
}

$output[ $key ] = array(
'name' => sanitize_text_field( wp_unslash( $props['name'] ) ),
'policy-page' => isset( $props['policy-page'] ) ? absint( $props['policy-page'] ) : 0,
'description' => isset( $props['description'] ) ? wp_kses( wp_unslash( $props['description'] ), $this->allowed_html ) : '',
'registration' => isset( $props['registration'] ) ? wp_kses( wp_unslash( $props['registration'] ), $this->allowed_html ) : '',
'name' => sanitize_text_field( wp_unslash( $props['name'] ) ),
'policy-page' => isset( $props['policy-page'] ) ? absint( $props['policy-page'] ) : 0,
'policy-page-url' => isset( $props['policy-page-url'] ) ? sanitize_text_field( $props['policy-page-url'] ) : '',
'description' => isset( $props['description'] ) ? wp_kses( wp_unslash( $props['description'] ), $this->allowed_html ) : '',
'registration' => isset( $props['registration'] ) ? wp_kses( wp_unslash( $props['registration'] ), $this->allowed_html ) : '',
);
}
return $output;
Expand Down
3 changes: 3 additions & 0 deletions admin/partials/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,15 @@
</label>
</th>
<td>
<input type="text" placeholder="Policy Page URL" name="gdpr_consent_types[<?php echo esc_attr( $consent_id ); ?>][policy-page-url]" id="consent-policy-page-url-<?php echo esc_attr( $consent_id ); ?>" value="<?php echo esc_attr( $consent['policy-page-url'] ); ?>" />
OR
<select name="gdpr_consent_types[<?php echo esc_attr( $consent_id ); ?>][policy-page]" id="consent-policy-page-<?php echo esc_attr( $consent_id ); ?>">
<option value=""></option>
<?php foreach ( $pages as $page ) : ?>
<option value="<?php echo esc_attr( $page->ID ); ?>" <?php selected( $consent['policy-page'], $page->ID ); ?>><?php echo esc_html( $page->post_title ); ?></option>
<?php endforeach ?>
</select>

</td>
</tr>
<tr>
Expand Down
2 changes: 2 additions & 0 deletions admin/partials/templates/tmpl-consents.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
</label>
</th>
<td>
<input type="text" placeholder="Policy Page URL" name="gdpr_consent_types[{{data.key}}][policy-page-url]" />
OR
<select name="gdpr_consent_types[{{data.key}}][policy-page]" id="consent-policy-page-{{data.key}}">
<option value=""></option>
<?php foreach ( $pages as $cpage ) : ?>
Expand Down
7 changes: 4 additions & 3 deletions templates/privacy-preferences-modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@
<?php if ( ! empty( $args['consent_types'] ) ) : ?>
<?php foreach ( $args['consent_types'] as $consent_key => $gdpr_type ) : ?>
<?php
if ( ! $gdpr_type['policy-page'] ) {
if ( ! $gdpr_type['policy-page'] && ! $gdpr_type['policy-page-url'] ) {
continue;
}
$policy_page = ( ! empty ( $gdpr_type['policy-page-url'] ) ) ? $gdpr_type['policy-page-url'] : get_permalink( $gdpr_type['policy-page'] );
?>
<li><a href="<?php echo esc_url( get_permalink( $gdpr_type['policy-page'] ) ); ?>" target="_blank"><?php echo esc_html( $gdpr_type['name'] ); ?></a></li>
<li><a href="<?php echo esc_url( $policy_page ); ?>" target="_blank"><?php echo esc_html( $gdpr_type['name'] ); ?></a></li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
Expand All @@ -71,7 +72,7 @@
<div class="gdpr-cookies-used">
<div class="gdpr-cookie-title">
<p><?php echo esc_html( $gdpr_type['name'] ); ?></p>
<?php if ( $gdpr_type['policy-page'] ) : ?>
<?php if ( $gdpr_type['policy-page'] || $gdpr_type['policy-page-url'] ) : ?>
<span class="gdpr-always-active"><?php esc_html_e( 'Required', 'gdpr' ); ?></span>
<input type="hidden" name="user_consents[]" value="<?php echo esc_attr( $consent_key ); ?>" style="display:none;">
<?php else : ?>
Expand Down