-
Notifications
You must be signed in to change notification settings - Fork 2
/
pressbooks-stats.php
59 lines (49 loc) · 2.46 KB
/
pressbooks-stats.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
56
57
58
59
<?php
/**
* Plugin Name: Pressbooks Stats
* Description: Pressbooks plugin which provides some basic activity statistics for a Pressbooks network.
* Requires at least: WordPress 6.5
* Requires Plugins: pressbooks
* x-release-please-start-version
* Version: 1.10.1
* x-release-please-end
* Pressbooks tested up to: 6.18.0
* Author: Pressbooks (Book Oven Inc.)
* Author URI: https://pressbooks.org
* Network: True
* License: GPL v3 or later
*
* @package Pressbooks_Stats
* @author Pressbooks (Book Oven Inc.)
* @license GPL-3.0-or-later
*/
// -------------------------------------------------------------------------------------------------------------------
// Setup some defaults
// -------------------------------------------------------------------------------------------------------------------
if ( ! defined( 'PB_STATS_PLUGIN_DIR' ) ) {
define( 'PB_STATS_PLUGIN_DIR', __DIR__ . '/' ); // Must have trailing slash!
}
if ( ! defined( 'PB_STATS_PLUGIN_URL' ) ) {
define( 'PB_STATS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); // Must have trailing slash!
}
// -------------------------------------------------------------------------------------------------------------------
// Class autoloader
// -------------------------------------------------------------------------------------------------------------------
\HM\Autoloader\register_class_path( 'PressbooksStats', __DIR__ . '/inc' );
// -------------------------------------------------------------------------------------------------------------------
// Requires
// -------------------------------------------------------------------------------------------------------------------
require( PB_STATS_PLUGIN_DIR . 'inc/helpers/namespace.php' );
require( PB_STATS_PLUGIN_DIR . 'inc/stats/namespace.php' );
// -------------------------------------------------------------------------------------------------------------------
// Hooks
// -------------------------------------------------------------------------------------------------------------------
// Activate
register_activation_hook( __FILE__, '\PressbooksStats\Helpers\install' );
// Stats
add_action( 'pressbooks_track_export', '\PressbooksStats\Stats\track_export' );
add_action( 'admin_init', '\PressbooksStats\Stats\init_css_js' );
add_action( 'network_admin_menu', '\PressbooksStats\Stats\menu' );
if ( ! defined( 'PB_DISABLE_NETWORK_STORAGE' ) || ! PB_DISABLE_NETWORK_STORAGE ) {
add_action( 'mu_rightnow_end', '\PressbooksStats\Stats\display_network_storage' );
}