Guest User

Untitled

a guest
May 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. <?php
  2.  
  3. if ( true == apply_filters( 'is_gdpr', true ) ) {
  4. add_filter( 'pre_comment_user_ip', function( $ip ) {
  5. $packed_in_addr = inet_pton( $ip );
  6. if ( 4 == strlen( $packed_in_addr ) ) {
  7. return inet_ntop( inet_pton( $ip ) & inet_pton( '255.255.0.0' ) );
  8. } else {
  9. return inet_ntop( inet_pton( $ip ) & inet_pton( 'ffff:ffff:ffff:ffff:0000:0000:0000:0000' ) );
  10. }
  11. } );
  12. }
Add Comment
Please, Sign In to add comment