Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 18
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3use NewfoldLabs\WP\ModuleLoader\Container;
4
5add_action(
6    'newfold_container_set',
7    function ( Container $container ) {
8        $brand_code = array(
9            'bluehost'      => '86241',
10            'hostgator'     => '57686',
11            'web'           => '86239',
12            'crazy-domains' => '57687',
13            'default'       => '86240',
14        );
15        $brand      = $container->plugin()->id;
16        if ( is_plugin_active( 'jetpack/jetpack.php' ) ) {
17            if ( empty( $brand ) || ! array_key_exists( $brand, $brand_code ) ) {
18                    $brand = 'default';
19            }
20            $jetpack_affiliate_code = get_option( 'jetpack_affiliate_code' );
21            ! $jetpack_affiliate_code && update_option( 'jetpack_affiliate_code', $brand_code[ $brand ] );
22        }
23    }
24);