-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
split-tests.php
55 lines (50 loc) · 1.52 KB
/
split-tests.php
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
<?php
/**
* Plugin Name: Split Tests
* Plugin URI: https://github.com/the-markup/split-tests
* Description: Simple A/B testing in WordPress.
* Author: The Markup <[email protected]>
* Author URI: https://themarkup.org/
* Text Domain: split-tests
* Domain Path: /languages
* Version: 0.1.1
*
* @package SplitTests
*/
if (! function_exists('dbug')) {
function dbug() {
$args = func_get_args();
$out = array();
foreach ( $args as $arg ) {
if ( ! is_scalar( $arg ) ) {
$arg = print_r( $arg, true );
}
$out[] = $arg;
}
$out = implode( "\n", $out );
error_log( "\n$out" );
}
}
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once(__DIR__ . '/vendor/autoload.php');
} else {
require_once __DIR__ . '/src/API.php';
require_once __DIR__ . '/src/Assets.php';
require_once __DIR__ . '/src/Cron.php';
require_once __DIR__ . '/src/Database.php';
require_once __DIR__ . '/src/PostType.php';
require_once __DIR__ . '/src/DomTests.php';
require_once __DIR__ . '/src/TitleTests.php';
require_once __DIR__ . '/src/Plugin.php';
}
add_action('plugins_loaded', function() {
SplitTests\Plugin::init();
});
register_activation_hook(__FILE__, function() {
$plugin = SplitTests\Plugin::init();
$plugin->activate();
});
register_deactivation_hook(__FILE__, function() {
$plugin = SplitTests\Plugin::init();
$plugin->deactivate();
});