Repository navigation
Expand file tree
/
Copy pathovos-codesafe.php
More file actions
80 lines (70 loc) · 2.28 KB
/
Copy pathovos-codesafe.php
File metadata and controls
80 lines (70 loc) · 2.28 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
78
79
80
<?php
declare(strict_types=1);
/**
* Plugin Name: ovos codesafe
* Description: From the first threat to the verified patch. Connects this site to your ovos codesafe instance, which detects the attacks on it and the errors in its code, shields against the attack pattern while the fix ships, and proves the fix held.
* Version: 1.0.2
* 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), after the
// goodbye to codesafe; activating forgets the hello's record so the first
// request says hello at once
register_activation_hook(__FILE__, [Ovos\Codesafe\Lifecycle::class, 'activate']);
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();
}
}