'modules/wordads/js/cmp-loader.js', 'dependencies' => array(), 'enqueue' => true, 'version' => JETPACK__VERSION, ) ); wp_enqueue_script( 'cmp_config_script', esc_url( self::get_config_url() ), array( 'cmp_script_loader' ), JETPACK__VERSION, false ); } /** * Gets the value to be used when an opt-in cookie is set. * * @return string The value to store in the opt-in cookie. */ private static function get_config_url() { return sprintf( 'https://public-api.wordpress.com/wpcom/v2/sites/%1$d/cmp/configuration/%2$s/?_jsonp=a8c_cmp_callback', (int) Jetpack_Options::get_option( 'id' ), strtolower( get_locale() ) // Defaults to en_US not en. ); } /** * Gets the domain to be used for the opt-out cookie. * Use the site's custom domain, or if the site has a wordpress.com subdomain, use .wordpress.com to share the cookie. * * @return string The domain to set for the opt-out cookie. */ public static function get_cookie_domain() { $host = 'localhost'; if ( isset( $_SERVER['HTTP_HOST'] ) ) { $host = filter_var( wp_unslash( $_SERVER['HTTP_HOST'] ) ); } return '.wordpress.com' === substr( $host, -strlen( '.wordpress.com' ) ) ? '.wordpress.com' : '.' . $host; } }