PluginProbe
Friends / 2.9.0
Friends v2.9.0
4.3.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 All 88 releases
friends / friends.php

friends.php in Friends 2.9.0, at friends.php

153 lines 6.0 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.0
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.0' );
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-new-private-post.php';
92 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_New_Private_Post', 'register' ) );
93
94 require_once __DIR__ . '/widgets/class-widget-post-formats.php';
95 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Post_Formats', 'register' ) );
96
97 require_once __DIR__ . '/widgets/class-widget-header.php';
98 add_action( 'widgets_init', array( __NAMESPACE__ . '\Widget_Header', 'register' ) );
99
100 // Register bundled parsers.
101 add_action(
102 'friends_load_parsers',
103 function ( Feed $friends_feed ) {
104 require_once __DIR__ . '/feed-parsers/class-feed-parser-simplepie.php';
105 $friends_feed->register_parser( Feed_Parser_SimplePie::SLUG, new Feed_Parser_SimplePie() );
106 },
107 9
108 );
109
110 add_action(
111 'friends_load_parsers',
112 function ( Feed $friends_feed ) {
113 require_once __DIR__ . '/feed-parsers/class-feed-parser-microformats.php';
114 $friends_feed->register_parser( Feed_Parser_Microformats::SLUG, new Feed_Parser_Microformats() );
115 },
116 9
117 );
118
119 add_action(
120 'friends_load_parsers',
121 function ( Feed $friends_feed ) {
122 require_once __DIR__ . '/feed-parsers/class-feed-parser-json-feed.php';
123 $friends_feed->register_parser( Feed_Parser_JSON_Feed::SLUG, new Feed_Parser_JSON_Feed() );
124 },
125 9
126 );
127
128 add_action(
129 'friends_load_parsers',
130 function ( \Friends\Feed $friends_feed ) {
131 if ( ! class_exists( '\Activitypub\Activitypub' ) ) {
132 // ActivityPub plugin not active.
133 return;
134 }
135
136 global $wp_filter;
137 if ( isset( $wp_filter['friends_load_parsers']->callbacks[10] ) && class_exists( '\\ReflectionFunction' ) ) {
138 // Unhook the parser from ActivityPub 0.14.
139 foreach ( $wp_filter['friends_load_parsers']->callbacks[10] as $key => $hook ) {
140 $r = new \ReflectionFunction( $hook['function'] );
141 if ( \str_ends_with( $r->getFileName(), 'activitypub.php' ) ) {
142 remove_filter( 'friends_load_parsers', $hook['function'], 10 );
143 break;
144 }
145 }
146 }
147
148 require_once __DIR__ . '/feed-parsers/class-feed-parser-activitypub.php';
149 $friends_feed->register_parser( Feed_Parser_ActivityPub::SLUG, new Feed_Parser_ActivityPub( $friends_feed ) );
150 },
151 9
152 );
153