-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathovos-codesafe.php
More file actions
77 lines (67 loc) · 2.01 KB
/
Copy pathovos-codesafe.php
File metadata and controls
77 lines (67 loc) · 2.01 KB
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
69
70
71
72
73
74
75
76
77
<?php
declare(strict_types=1);
/**
* Plugin Name: ovos codesafe
* Description: Connects this site to an ovos codesafe instance — PHP and browser JavaScript errors, with grouping, alerting and issue lifecycle handled by the console.
* Version: 1.0.0
* Requires at least: 6.0
* Requires PHP: 8.3
* Author: ovos media gmbh
* Author URI: https://www.ovos.at
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: ovos-codesafe
* Update URI: https://github.com/ovos/codesafe-client-wordpress
*/
// this bootstrap file stays parseable on old PHP on purpose: the
// Requires PHP header stops activation, this guard stops execution
// if the plugin ended up active regardless
defined('ABSPATH') || exit;
if(PHP_VERSION_ID < 80300)
{
return;
}
spl_autoload_register(static function ($class) {
if(strpos($class, 'Ovos\\Codesafe\\') !== 0)
{
return;
}
$file = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 14)) . '.php';
if(is_file($file))
{
require $file;
}
});
Ovos\Codesafe\Plugin::boot(__FILE__);
// the prepend layer runs whether or not the plugin does: deactivating switches
// it off through its consent file (security audit 2026-10-03 M16)
register_deactivation_hook(__FILE__, [Ovos\Codesafe\Lifecycle::class, 'deactivate']);
if(function_exists('ovos_codesafe') === false)
{
/**
* Manual captures from theme or plugin code:
*
* ovos_codesafe()->captureException($e, ['orderId' => 7]);
* ovos_codesafe()->captureMessage('checkout step skipped', 4);
*
* @return Ovos\Codesafe\Sender|null
*/
function ovos_codesafe()
{
$plugin = Ovos\Codesafe\Plugin::instance();
return $plugin !== null ? $plugin->sender : null;
}
}
if(function_exists('ovos_console') === false)
{
/**
* The helper under the plugin's first name, for theme and plugin code
* written against ovos-console
*
* @return Ovos\Codesafe\Sender|null
*/
function ovos_console()
{
return ovos_codesafe();
}
}