-
Notifications
You must be signed in to change notification settings - Fork 3
/
core-standards.php
51 lines (44 loc) · 1.78 KB
/
core-standards.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
<?php
/*
Plugin Name: Core Standards
Version: 3.3.1
Text Domain: core-standards
Description: Standard refinements.
Author: netzstrategen
Author URI: https://www.netzstrategen.com
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0
*/
namespace Netzstrategen\CoreStandards;
if (!defined('ABSPATH')) {
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
exit;
}
/**
* Loads PSR-4-style plugin classes.
*/
function classloader($class) {
static $ns_offset;
if (strpos($class, __NAMESPACE__ . '\\') === 0) {
if ($ns_offset === NULL) {
$ns_offset = strlen(__NAMESPACE__) + 1;
}
include __DIR__ . '/src/' . strtr(substr($class, $ns_offset), '\\', '/') . '.php';
}
}
spl_autoload_register(__NAMESPACE__ . '\classloader');
register_activation_hook(__FILE__, __NAMESPACE__ . '\Schema::activate');
register_deactivation_hook(__FILE__, __NAMESPACE__ . '\Schema::deactivate');
register_uninstall_hook(__FILE__, __NAMESPACE__ . '\Schema::uninstall');
add_action('wp_upgrade', __NAMESPACE__ . '\Schema::ensureUploadsHtaccess');
add_action('widgets_init', __NAMESPACE__ . '\Widgets\UserLoginFormWidget::init');
add_action('plugins_loaded', __NAMESPACE__ . '\Plugin::plugins_loaded');
add_action('init', __NAMESPACE__ . '\Plugin::init', 20);
add_action('admin_init', __NAMESPACE__ . '\Admin::init');
// Adds settings fields to 'Reading' settings page, after 'Search Engine visibility'.
add_action('admin_init', __NAMESPACE__ . '\TrackingOptOut::admin_init', 9);
if (defined('WP_CLI') && WP_CLI) {
\WP_CLI::add_command('user export-csv', __NAMESPACE__ . '\Commands\UserExport');
\WP_CLI::add_command('user import-csv-raw', __NAMESPACE__ . '\Commands\UserImport');
\WP_CLI::add_hook('before_run_command', __NAMESPACE__ . '\Hooks\Language::limitLanguage');
}