| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Webmention |
| 4 |
* Plugin URI: https://github.com/pfefferle/wordpress-webmention |
| 5 |
* Description: Webmention support for WordPress posts |
| 6 |
* Author: Matthias Pfefferle |
| 7 |
* Author URI: https://notiz.blog/ |
| 8 |
* Version: 5.9.0 |
| 9 |
* Requires at least: 6.2 |
| 10 |
* Requires PHP: 7.4 |
| 11 |
* License: MIT |
| 12 |
* License URI: https://opensource.org/licenses/MIT |
| 13 |
* Text Domain: webmention |
| 14 |
* Domain Path: /languages |
| 15 |
*/ |
| 16 |
|
| 17 |
namespace Webmention; |
| 18 |
|
| 19 |
\define( 'WEBMENTION_VERSION', '5.9.0' ); |
| 20 |
|
| 21 |
\define( 'WEBMENTION_PLUGIN_DIR', \plugin_dir_path( __FILE__ ) ); |
| 22 |
\define( 'WEBMENTION_PLUGIN_BASENAME', \plugin_basename( __FILE__ ) ); |
| 23 |
\define( 'WEBMENTION_PLUGIN_FILE', \plugin_dir_path( __FILE__ ) . '/' . \basename( __FILE__ ) ); |
| 24 |
\define( 'WEBMENTION_PLUGIN_URL', \plugin_dir_url( __FILE__ ) ); |
| 25 |
|
| 26 |
require_once WEBMENTION_PLUGIN_DIR . 'includes/class-autoloader.php'; |
| 27 |
require_once WEBMENTION_PLUGIN_DIR . 'includes/functions.php'; |
| 28 |
|
| 29 |
if ( \WP_DEBUG ) { |
| 30 |
require_once WEBMENTION_PLUGIN_DIR . 'includes/debug.php'; |
| 31 |
} |
| 32 |
|
| 33 |
// Register the autoloader. |
| 34 |
Autoloader::register_path( __NAMESPACE__, WEBMENTION_PLUGIN_DIR . 'includes' ); |
| 35 |
|
| 36 |
// Initialize the plugin. |
| 37 |
$webmention = Webmention::get_instance(); |
| 38 |
$webmention->init(); |
| 39 |
|
| 40 |
/** |
| 41 |
* Plugin Version Number used for caching. |
| 42 |
*/ |
| 43 |
function version() { |
| 44 |
return Webmention::get_instance()->get_version(); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Activation Hook |
| 49 |
* |
| 50 |
* Migrate DB if needed |
| 51 |
*/ |
| 52 |
function activation() { |
| 53 |
\Webmention\Upgrade::maybe_upgrade(); |
| 54 |
} |
| 55 |
register_activation_hook( __FILE__, '\Webmention\activation' ); |
| 56 |
|
| 57 |
/** |
| 58 |
* `get_plugin_data` wrapper |
| 59 |
* |
| 60 |
* @return array the plugin metadata array |
| 61 |
*/ |
| 62 |
function get_plugin_meta( $default_headers = array() ) { |
| 63 |
if ( ! $default_headers ) { |
| 64 |
$default_headers = array( |
| 65 |
'Name' => 'Plugin Name', |
| 66 |
'PluginURI' => 'Plugin URI', |
| 67 |
'Version' => 'Version', |
| 68 |
'Description' => 'Description', |
| 69 |
'Author' => 'Author', |
| 70 |
'AuthorURI' => 'Author URI', |
| 71 |
'TextDomain' => 'Text Domain', |
| 72 |
'DomainPath' => 'Domain Path', |
| 73 |
'Network' => 'Network', |
| 74 |
'RequiresWP' => 'Requires at least', |
| 75 |
'RequiresPHP' => 'Requires PHP', |
| 76 |
'UpdateURI' => 'Update URI', |
| 77 |
); |
| 78 |
} |
| 79 |
|
| 80 |
return \get_file_data( __FILE__, $default_headers, 'plugin' ); |
| 81 |
} |
| 82 |
|
| 83 |
// Check for CLI env, to add the CLI commands |
| 84 |
if ( \defined( 'WP_CLI' ) && \WP_CLI ) { |
| 85 |
\WP_CLI::add_command( 'webmention', Cli::class ); |
| 86 |
} |
| 87 |
|