• 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_validate_card_number_format() – Given a number and algorithem, determine if we have a valid credit card format

You appear to be a bot. Output may be restricted

Description

Given a number and algorithem, determine if we have a valid credit card format

Usage

$bool = edd_validate_card_number_format( $number );

Parameters

$number
( integer ) optional – The Credit Card Number to validate

Returns

bool If the card number provided matches a specific format of a valid card

Source

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

1 to 27 of 27
function edd_validate_card_number_format( $number = 0 ) {

  $number = trim( $number );
  if ( empty( $number ) ) {
    return false;
  }

  if ( ! is_numeric( $number ) ) {
    return false;
  }

  $is_valid_format = false;

  // First check if it passes with the passed method, Luhn by default
  $is_valid_format = edd_validate_card_number_format_luhn( $number );

  // Run additional checks before we start the regexing and looping by type
  $is_valid_format = apply_filters( 'edd_valiate_card_format_pre_type', $is_valid_format, $number );

  if ( true === $is_valid_format ) {
    // We've passed our method check, onto card specific checks
    $card_type       = edd_detect_cc_type( $number );
    $is_valid_format = ! empty( $card_type ) ? true : false;
  }

  return apply_filters( 'edd_cc_is_valid_format', $is_valid_format, $number );
}
 

 View on GitHub View on Trac

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

Primary Sidebar

Information

Function name: edd_validate_card_number_format
Plugin ref: Easy Digital Downloads
Version: 2.9.26
Sourcefile: includes/checkout/functions.php
File ref: includes/checkout/functions.php
Deprecated?: No
API Letters: C,E,F,N,V

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