| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Statify |
| 4 |
* Plugin URI: https://statify.pluginkollektiv.org/ |
| 5 |
* Description: Compact, easy-to-use and privacy-compliant stats plugin for WordPress. |
| 6 |
* Version: 2.0.2 |
| 7 |
* Requires at least: 5.1 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: pluginkollektiv |
| 10 |
* Author URI: https://pluginkollektiv.org/ |
| 11 |
* License: GPLv3 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 13 |
* Text Domain: statify |
| 14 |
* |
| 15 |
* @package WordPress |
| 16 |
*/ |
| 17 |
|
| 18 |
/* Quit */ |
| 19 |
defined( 'ABSPATH' ) || exit; |
| 20 |
|
| 21 |
/* Constants */ |
| 22 |
define( 'STATIFY_FILE', __FILE__ ); |
| 23 |
define( 'STATIFY_DIR', __DIR__ ); |
| 24 |
define( 'STATIFY_BASE', plugin_basename( __FILE__ ) ); |
| 25 |
define( 'STATIFY_VERSION', '2.0.2' ); |
| 26 |
|
| 27 |
/* Hooks */ |
| 28 |
add_action( 'plugins_loaded', array( 'Statify', 'init' ) ); |
| 29 |
register_activation_hook( STATIFY_FILE, array( 'Statify_Install', 'init' ) ); |
| 30 |
register_deactivation_hook( STATIFY_FILE, array( 'Statify_Deactivate', 'init' ) ); |
| 31 |
register_uninstall_hook( STATIFY_FILE, array( 'Statify_Uninstall', 'init' ) ); |
| 32 |
|
| 33 |
/* Autoload */ |
| 34 |
spl_autoload_register( 'statify_autoload' ); |
| 35 |
|
| 36 |
/** |
| 37 |
* Include classes via autoload. |
| 38 |
* |
| 39 |
* @param string $class_name Name of an class-file name, without file extension. |
| 40 |
*/ |
| 41 |
function statify_autoload( string $class_name ): void { |
| 42 |
|
| 43 |
$plugin_classes = array( |
| 44 |
'Statify', |
| 45 |
'Statify_Api', |
| 46 |
'Statify_Backend', |
| 47 |
'Statify_Evaluation', |
| 48 |
'Statify_Frontend', |
| 49 |
'Statify_Dashboard', |
| 50 |
'Statify_Install', |
| 51 |
'Statify_Uninstall', |
| 52 |
'Statify_Deactivate', |
| 53 |
'Statify_Settings', |
| 54 |
'Statify_Table', |
| 55 |
'Statify_Cron', |
| 56 |
); |
| 57 |
|
| 58 |
if ( in_array( $class_name, $plugin_classes, true ) ) { |
| 59 |
require_once sprintf( |
| 60 |
'%s/inc/class-%s.php', |
| 61 |
STATIFY_DIR, |
| 62 |
strtolower( str_replace( '_', '-', $class_name ) ) |
| 63 |
); |
| 64 |
} elseif ( 0 === strncmp( $class_name, 'Jaybizzle\\CrawlerDetect\\', 24 ) && ! class_exists( $class_name, false ) ) { |
| 65 |
require_once sprintf( |
| 66 |
'%s/lib/%s.php', |
| 67 |
STATIFY_DIR, |
| 68 |
str_replace( '\\', DIRECTORY_SEPARATOR, $class_name ) |
| 69 |
); |
| 70 |
} |
| 71 |
} |
| 72 |
|