PluginProbe
Friends / 2.9.2
Friends v2.9.2
4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 2.9.2 All 87 releases
friends / friends.php

friends.php in Friends 2.9.2, at friends.php

159 lines 6.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin name: Friends
4 * Plugin author: Alex Kirk
5 * Plugin URI: https://github.com/akirk/friends
6 * Version: 2.9.2
7 * Requires PHP: 5.6
8
9 * Description: A social network between WordPresses. Privacy focused, by itself a self-hosted RSS++ reader with notifications.
10 *
11 * License: GPL2
12 * Text Domain: friends
13 * Domain Path: /languages/
14 *
15 * @package Friends
16 */
17
18 namespace Friends;
19
20 /**
21 * This file loads all the dependencies the Friends plugin.
22 */
23
24 defined( 'ABSPATH' ) || exit;
25 define( 'FRIENDS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
26 define( 'FRIENDS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
27 define( 'FRIENDS_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) );
28 define( 'FRIENDS_VERSION', '2.9.2' );
29
30 require_once __DIR__ . '/libs/Mf2/Parser.php';
31
32 require_once __DIR__ . '/includes/class-user.php';
33 require_once __DIR__ . '/includes/class-user-feed.php';
34 require_once __DIR__ . '/includes/class-user-query.php';
35 require_once __DIR__ . '/includes/class-subscription.php';
36
37 // Classes to be implemented or used by parser plugins.
38 require_once __DIR__ . '/feed-parsers/class-feed-parser.php';
39 require_once __DIR__ . '/feed-parsers/class-feed-parser-v2.php';
40 require_once __DIR__ . '/feed-parsers/class-feed-item.php';
41
42 require_once __DIR__ . '/includes/class-access-control.php';
43 require_once __DIR__ . '/includes/class-admin.php';
44 require_once __DIR__ . '/includes/class-automatic-status.php';
45 require_once __DIR__ . '/includes/class-blocks.php';
46 require_once __DIR__ . '/includes/class-feed.php';
47 require_once __DIR__ . '/includes/class-frontend.php';
48 require_once __DIR__ . '/includes/class-logging.php';
49 require_once __DIR__ . '/includes/class-messages.php';
50 require_once __DIR__ . '/includes/class-notifications.php';
51 require_once __DIR__ . '/includes/class-plugin-installer.php';
52 require_once __DIR__ . '/includes/class-reactions.php';
53 require_once __DIR__ . '/includes/class-rest.php';
54 require_once __DIR__ . '/includes/class-shortcodes.php';
55 require_once __DIR__ . '/includes/class-template-loader.php';
56 require_once __DIR__ . '/includes/class-third-parties.php';
57 require_once __DIR__ . '/includes/class-friends.php';
58
59 add_action( 'plugins_loaded', array( __NAMESPACE__ . '\Friends', 'init' ) );
60 add_action( 'admin_init', array( __NAMESPACE__ . '\Plugin_Installer', 'register_hooks' ) );
61
62 if ( is_admin() && FRIENDS_VERSION > get_option( 'friends_plugin_version' ) ) {
63 add_action( 'admin_init', array( __NAMESPACE__ . '\Friends', 'upgrade_plugin' ) );
64 }
65
66 add_action( 'upgrader_process_complete', array( __NAMESPACE__ . '\Friends', 'upgrade_plugin_trigger' ), 10, 2 );
67 register_activation_hook( __FILE__, array( __NAMESPACE__ . '\Friends', 'activate_plugin' ) );
68 register_deactivation_hook( __FILE__, array( __NAMESPACE__ . '\Friends', 'deactivate_plugin' ) );
69 register_uninstall_hook( __FILE__, array( __NAMESPACE__ . '\Friends', 'uninstall_plugin' ) );
70
71 add_action( 'activate_blog', array( __NAMESPACE__ . '\Friends', 'activate_plugin' ) );
72 add_action( 'wp_initialize_site', array( __NAMESPACE__ . '\Friends', 'activate_for_blog' ) );
73
74 // Register widgets.
75 require_once __DIR__ . '/widgets/class-widget-base-friends-list.php';
76 require_once __DIR__ . '/widgets/class-widget-refresh.php';
77 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Refresh', 'register' ) );
78
79 require_once __DIR__ . '/widgets/class-widget-friends-list.php';
80 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Friends_List', 'register' ) );
81
82 require_once __DIR__ . '/widgets/class-widget-starred-friends-list.php';
83 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Starred_Friends_List', 'register' ) );
84
85 require_once __DIR__ . '/widgets/class-widget-recent-friends-list.php';
86 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Recent_Friends_List', 'register' ) );
87
88 require_once __DIR__ . '/widgets/class-widget-friend-request.php';
89 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Friend_Request', 'register' ) );
90
91 require_once __DIR__ . '/widgets/class-widget-friend-stats.php';
92 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Friend_Stats', 'register' ) );
93
94 require_once __DIR__ . '/widgets/class-widget-new-private-post.php';
95 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_New_Private_Post', 'register' ) );
96
97 require_once __DIR__ . '/widgets/class-widget-post-formats.php';
98 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Post_Formats', 'register' ) );
99
100 require_once __DIR__ . '/widgets/class-widget-header.php';
101 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Header', 'register' ) );
102
103 // Register bundled parsers.
104 add_action(
105 'friends_load_parsers',
106 function ( Feed $friends_feed ) {
107 require_once __DIR__ . '/feed-parsers/class-feed-parser-simplepie.php';
108 $friends_feed->register_parser( Feed_Parser_SimplePie::SLUG, new Feed_Parser_SimplePie( $friends_feed ) );
109 },
110 9
111 );
112
113 add_action(
114 'friends_load_parsers',
115 function ( Feed $friends_feed ) {
116 require_once __DIR__ . '/feed-parsers/class-feed-parser-microformats.php';
117 $friends_feed->register_parser( Feed_Parser_Microformats::SLUG, new Feed_Parser_Microformats() );
118 },
119 9
120 );
121
122 add_action(
123 'friends_load_parsers',
124 function ( Feed $friends_feed ) {
125 require_once __DIR__ . '/feed-parsers/class-feed-parser-json-feed.php';
126 $friends_feed->register_parser( Feed_Parser_JSON_Feed::SLUG, new Feed_Parser_JSON_Feed() );
127 },
128 9
129 );
130
131 add_action(
132 'friends_load_parsers',
133 function ( \Friends\Feed $friends_feed ) {
134 if ( ! class_exists( '\Activitypub\Activitypub' ) ) {
135 // ActivityPub plugin not active.
136 return;
137 }
138
139 global $wp_filter;
140 if ( isset( $wp_filter['friends_load_parsers']->callbacks[10] ) && class_exists( '\\ReflectionFunction' ) ) {
141 // Unhook the parser from ActivityPub 0.14.
142 foreach ( $wp_filter['friends_load_parsers']->callbacks[10] as $key => $hook ) {
143 $r = new \ReflectionFunction( $hook['function'] );
144 if ( \str_ends_with( $r->getFileName(), 'activitypub.php' ) ) {
145 remove_filter( 'friends_load_parsers', $hook['function'], 10 );
146 break;
147 }
148 }
149 }
150
151 require_once __DIR__ . '/feed-parsers/class-feed-parser-activitypub.php';
152 $friends_feed->register_parser( Feed_Parser_ActivityPub::SLUG, new Feed_Parser_ActivityPub( $friends_feed ) );
153 },
154 9
155 );
156
157 require_once __DIR__ . '/integrations/class-enable-mastodon-apps.php';
158 Enable_Mastodon_Apps::init();
159