1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
<?php
namespace SIW\Compatibility;
class WP_Sentry_Integration {
const PHP_DSN = 'https://d66e53bd9d3e41199ff984851c98706b@sentry.io/1264830';
const JS_DSN = 'https://e8240c08387042d583692b6415c700e3@sentry.io/1264820';
public static function init() {
$self = new self();
$self->define_constants();
add_filter( 'rocket_exclude_js', [ $self, 'exclude_js_from_combine' ] );
}
public function define_constants() {
$constants = [
'WP_SENTRY_VERSION' => SIW_PLUGIN_VERSION,
'WP_SENTRY_ENV' => SIW_ENVIRONMENT,
'WP_SENTRY_ERROR_TYPES' => E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_USER_DEPRECATED,
'WP_SENTRY_PUBLIC_DSN' => self::JS_DSN,
'WP_SENTRY_DSN' => self::PHP_DSN,
'WP_SENTRY_DEFAULT_PII' => true,
];
foreach ( $constants as $constant => $value ) {
if ( ! defined( $constant ) && ! empty( $value ) ) {
define( $constant, $value );
}
}
}
public function exclude_js_from_combine( array $excluded_files ) {
$excluded_files[] = '/wp-content/plugins/wp-sentry-integration/public/(.*).js';
return $excluded_files;
}
}