Skip to content

Instantly share code, notes, and snippets.

@JayWood
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayWood/8b4bd5d8e21eff6e5ac1 to your computer and use it in GitHub Desktop.
Save JayWood/8b4bd5d8e21eff6e5ac1 to your computer and use it in GitHub Desktop.
CWV3 Dialog Filter
<?php
function cwv3_issue_17( $output ){
$exit_text = get_option( 'cwv3_exit_txt', __( 'Exit', 'cwv3' ) );
$enter_text = get_option( 'cwv3_enter_txt', __( 'Enter', 'cwv3' ) );
$cwv3_denial_title = get_option( 'cwv3_den_title', __( 'Access Denied', 'cwv3' ) );
$cwv3_denial_message = get_option( 'cwv3_den_msg', __( 'You have been denied access to this content. If you feel this is in error, please contact a site administrator.', 'cwv3' ) );
$cwv3_title = get_option( 'cwv3_d_title', __( 'Warning: Explicit Content', 'cwv3' ) );
$cwv3_message = get_option( 'cwv3_d_msg', __( 'The content you are about to view may be considered offensive and/or inappropriate. Furthermore, this content may be considered adult content, if you are not of legal age or are easily offended, you are required to click the exit button.', 'cwv3' ) );
$exit_url = get_option( 'cwv3_exit_link', '#' );
$enter_url = get_option( 'cwv3_enter_link', '#' );
ob_start();
?>
<!-- CWV3 JS Dialog -->
<div class="cwv3 dialog-overlay" style="display:none;">&nbsp;</div>
<div id="cwv3_dialog" class="cwv3_dialog js" style="display:none;">
<div class="cwv3 auth">
<div class="cwv3_title"><?php echo esc_attr( $cwv3_title ); ?></div>
<div class="cwv3_content"><?php echo $cwv3_message ?></div>
<div class="cwv3_btns">
<div class="cwv3_enter">
<a href="<?php echo esc_url( $enter_url ); ?>"><?php echo esc_attr( $enter_text ); ?></a>
</div>
<div class="cwv3_exit">
<a href="<?php echo esc_url( $exit_url ); ?>"><?php echo esc_attr( $exit_text ); ?></a>
</div>
</div>
</div>
<div class="cwv3 denied">
<div class="cwv3_title"><?php echo esc_attr( $cwv3_denial_title ); ?></div>
<div class="cwv3_content"><?php echo $cwv3_denial_message; ?></div>
<div class="cwv3_btns">
<div class="cwv3_exit">
<a href="<?php echo esc_url( $exit_url ); ?>"><?php echo esc_attr( $exit_text ); ?></a>
</div>
</div>
</div>
</div>
<!-- END CWV3 JS Dialog -->
<?php
return ob_get_clean();
}
add_filter( 'cwv3_js_dialog_output', 'cwv3_issue_17' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment