• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / edd_mask_domain() – Given a domain, mask it with the * character.

You appear to be a bot. Output may be restricted

Description

Given a domain, mask it with the * character.

TLD parts will remain intact (.com, .co.uk, etc). All subdomains will be masked t**t.e*****e.co.uk.

Usage

$string = edd_mask_domain( $domain );

Parameters

$domain
( string ) optional –

Returns

string

Source

File name: easy-digital-downloads/includes/privacy-functions.php
Lines:

1 to 30 of 30
function edd_mask_domain( $domain = '' ) {

  if ( empty( $domain ) ) {
    return '';
  }

  $domain_parts = explode( '.', $domain );

  if ( count( $domain_parts ) === 2 ) {

    // We have a single entry tld like .org or .com
    $domain_parts[0] = edd_mask_string( $domain_parts[0] );

  } else {

    $part_count     = count( $domain_parts );
    $possible_cctld = strlen( $domain_parts[ $part_count - 2 ] ) <= 3 ? true : false;

    $mask_parts = $possible_cctld ? array_slice( $domain_parts, 0, $part_count - 2 ) : array_slice( $domain_parts, 0, $part_count - 1 );

    $i = 0;
    while ( $i < count( $mask_parts ) ) {
      $domain_parts[ $i ] = edd_mask_string( $domain_parts[ $i ]);
      $i++;
    }

  }

  return implode( '.', $domain_parts );
}
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 26th November 2019

Primary Sidebar

Information

Function name: edd_mask_domain
Plugin ref: Easy Digital Downloads
Version: 2.9.26
Sourcefile: includes/privacy-functions.php
File ref: includes/privacy-functions.php
Deprecated?: No
API Letters: D,E,M

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.6.2
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites