PluginProbe
WebFinger / 3.2.4
WebFinger v3.2.4
4.1.0 trunk 0.5 0.7 0.9 0.9.1 1.0 1.0.1 1.1 1.2 1.3 1.3.1 2.0.0 2.0.1 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 All 36 releases
webfinger / webfinger.php

webfinger.php in WebFinger 3.2.4, at webfinger.php

65 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WebFinger
4 * Plugin URI: https://github.com/pfefferle/wordpress-webfinger
5 * Description: WebFinger for WordPress
6 * Version: 3.2.4
7 * Author: Matthias Pfefferle
8 * Author URI: https://notiz.blog/
9 * License: MIT
10 * License URI: https://opensource.org/licenses/MIT
11 */
12
13 defined( 'WEBFINGER_LEGACY' ) || define( 'WEBFINGER_LEGACY', false );
14
15 /**
16 * Initialize plugin
17 */
18 function webfinger_init() {
19 // list of various public helper functions
20 require_once( dirname( __FILE__ ) . '/includes/functions.php' );
21
22 require_once( dirname( __FILE__ ) . '/includes/class-webfinger.php' );
23
24 add_action( 'query_vars', array( 'Webfinger', 'query_vars' ) );
25 add_action( 'parse_request', array( 'Webfinger', 'parse_request' ) );
26
27 add_action( 'init', array( 'Webfinger', 'generate_rewrite_rules' ) );
28
29 add_filter( 'webfinger_data', array( 'Webfinger', 'generate_user_data' ), 10, 3 );
30 add_filter( 'webfinger_data', array( 'Webfinger', 'generate_post_data' ), 10, 3 );
31 add_filter( 'webfinger_data', array( 'Webfinger', 'filter_by_rel' ), 99, 1 );
32
33 // default output
34 add_action( 'webfinger_render', array( 'Webfinger', 'render_jrd' ) );
35
36 // add legacy WebFinger class
37 if ( WEBFINGER_LEGACY && ! class_exists( 'WebFingerLegacy_Plugin' ) ) {
38 require_once( dirname( __FILE__ ) . '/includes/class-webfinger-legacy.php' );
39
40 add_action( 'query_vars', array( 'Webfinger_Legacy', 'query_vars' ) );
41 add_filter( 'host_meta', array( 'Webfinger_Legacy', 'host_meta_discovery' ) );
42
43 // host-meta recource
44 add_action( 'host_meta_render', array( 'Webfinger_Legacy', 'render_host_meta' ), -1, 3 );
45
46 // XRD output
47 add_action( 'webfinger_render', array( 'Webfinger_Legacy', 'render_xrd' ), 5 );
48
49 // support plugins pre 3.0.0
50 add_filter( 'webfinger_user_data', array( 'Webfinger_Legacy', 'legacy_filter' ), 10, 3 );
51 }
52 }
53 add_action( 'plugins_loaded', 'webfinger_init' );
54
55 /**
56 * Flush rewrite rules
57 */
58 function webfinger_flush_rewrite_rules() {
59 require_once( dirname( __FILE__ ) . '/includes/class-webfinger.php' );
60 Webfinger::generate_rewrite_rules();
61 flush_rewrite_rules();
62 }
63 register_activation_hook( __FILE__, 'webfinger_flush_rewrite_rules' );
64 register_deactivation_hook( __FILE__, 'flush_rewrite_rules' );
65