| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: WebFinger |
| 4 |
* Plugin URI: https://github.com/pfefferle/wordpress-webfinger |
| 5 |
* Description: WebFinger for WordPress |
| 6 |
* Version: 4.1.0 |
| 7 |
* Requires at least: 6.4 |
| 8 |
* Author: Matthias Pfefferle |
| 9 |
* Author URI: https://notiz.blog/ |
| 10 |
* License: MIT |
| 11 |
* License URI: https://opensource.org/licenses/MIT |
| 12 |
* |
| 13 |
* @package Webfinger |
| 14 |
*/ |
| 15 |
|
| 16 |
namespace Webfinger; |
| 17 |
|
| 18 |
\defined( 'WEBFINGER_LEGACY' ) || \define( 'WEBFINGER_LEGACY', false ); |
| 19 |
|
| 20 |
// Plugin related constants. |
| 21 |
\define( 'WEBFINGER_PLUGIN_DIR', \plugin_dir_path( __FILE__ ) ); |
| 22 |
\define( 'WEBFINGER_PLUGIN_BASENAME', \plugin_basename( __FILE__ ) ); |
| 23 |
\define( 'WEBFINGER_PLUGIN_FILE', WEBFINGER_PLUGIN_DIR . \basename( __FILE__ ) ); |
| 24 |
\define( 'WEBFINGER_PLUGIN_URL', \plugin_dir_url( __FILE__ ) ); |
| 25 |
|
| 26 |
// Require the autoloader. |
| 27 |
require_once WEBFINGER_PLUGIN_DIR . 'includes/class-autoloader.php'; |
| 28 |
Autoloader::register_path( 'Webfinger\\', WEBFINGER_PLUGIN_DIR . 'includes/' ); |
| 29 |
|
| 30 |
/** |
| 31 |
* Initialize plugin. |
| 32 |
*/ |
| 33 |
function init() { |
| 34 |
// List of various public helper functions. |
| 35 |
require_once WEBFINGER_PLUGIN_DIR . 'includes/functions.php'; |
| 36 |
require_once WEBFINGER_PLUGIN_DIR . 'includes/deprecated.php'; |
| 37 |
|
| 38 |
Webfinger::init(); |
| 39 |
Admin::init(); |
| 40 |
Health_Check::init(); |
| 41 |
|
| 42 |
// Add legacy WebFinger class. |
| 43 |
if ( WEBFINGER_LEGACY && ! \class_exists( '\WebFingerLegacy_Plugin' ) ) { |
| 44 |
Legacy::init(); |
| 45 |
} |
| 46 |
} |
| 47 |
\add_action( 'plugins_loaded', '\Webfinger\init' ); |
| 48 |
|
| 49 |
/** |
| 50 |
* Flush rewrite rules. |
| 51 |
*/ |
| 52 |
function flush_rewrite_rules() { |
| 53 |
Webfinger::generate_rewrite_rules(); |
| 54 |
\flush_rewrite_rules(); |
| 55 |
} |
| 56 |
\register_activation_hook( __FILE__, '\Webfinger\flush_rewrite_rules' ); |
| 57 |
\register_deactivation_hook( __FILE__, '\flush_rewrite_rules' ); |
| 58 |
|