Bin e padrões para validação de cartão de crédito.
| Bandeira | Começa com | Máximo de número | Máximo de número cvc | Regex |
|---|---|---|---|---|
| Visa | 4 |
13,16 | 3 | ^4[0-9]{12}(?:[0-9]{3}) |
| Mastercard | 5 |
16 | 3 | ^5[1-5][0-9]{14} |
| Diners | 301,305,36,38 link |
14,16 | 3 | `^3(?:0[0-5] |
| var path = require('path') | |
| module.exports = { | |
| entry: { | |
| app: './src/main.js' | |
| }, | |
| output: { | |
| path: path.resolve(__dirname, '../dist/static'), | |
| publicPath: '/static/', | |
| filename: '[name].js' |
| <?php | |
| //* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php | |
| /** | |
| * Manage WooCommerce styles and scripts. | |
| */ | |
| function grd_woocommerce_script_cleaner() { | |
| // Remove the generator tag | |
| remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); |
| <?php | |
| $input = 'nome:ps4 sku:SKU7889-988;OI99129 data:10/12/2016 nome:Playstation 4 nome:Nintendo Wii sku:TESTE123 9aos'; | |
| preg_match_all('/(?:([^: ]+):)([^: ]+(?:\s+[^: ]+\b(?!:))*)/', $input, $matches, PREG_SET_ORDER); | |
| echo $input; | |
| echo '<pre>'; | |
| print_r($matches); | |
| echo '</pre>'; |
| /** | |
| * Parse hash bang parameters from a URL as key value object. | |
| * | |
| * For repeated parameters the last parameter is effective. | |
| * | |
| * If = syntax is not used the value is set to null. | |
| * | |
| * #x&y=3 -> { x:null, y:3 } | |
| * | |
| * @param aURL URL to parse or null if window.location is used |
| //Add a stylesheet after default style.css | |
| wp_enqueue_style( 'my-css', get_template_directory_uri() . 'my-css.css', array('themename-style')); | |
| //WooCommerce - Sort products by SKU | |
| add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_catalog_orderby'); | |
| function custom_woocommerce_catalog_orderby( $args ) { | |
| $args['meta_key'] = '_sku'; | |
| $args['orderby'] = 'meta_value'; | |
| $args['order'] = 'asc'; | |
| return $args; |
| function wc_ninja_remove_password_strength() { | |
| if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) { | |
| wp_dequeue_script( 'wc-password-strength-meter' ); | |
| } | |
| } | |
| add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 ); |
| <?php | |
| function custom_woocommerce_login_redirect( $url ) { | |
| return get_permalink( wc_get_page_id( 'shop' ) ); | |
| } | |
| add_filter( 'woocommerce_login_redirect', 'custom_woocommerce_login_redirect' ); |
Bin e padrões para validação de cartão de crédito.
| Bandeira | Começa com | Máximo de número | Máximo de número cvc | Regex |
|---|---|---|---|---|
| Visa | 4 |
13,16 | 3 | ^4[0-9]{12}(?:[0-9]{3}) |
| Mastercard | 5 |
16 | 3 | ^5[1-5][0-9]{14} |
| Diners | 301,305,36,38 link |
14,16 | 3 | `^3(?:0[0-5] |
| <?php | |
| // Test cards | |
| $cards = array( | |
| '378282246310005', // American Express | |
| '371449635398431', // American Express | |
| '5078601870000127985', // Aura | |
| '5078601800003247449', // Aura | |
| '30569309025904', // Diners Club | |
| '38520000023237', // Diners Club |