register_parser( Feed_Parser_SimplePie::SLUG, new Feed_Parser_SimplePie( $friends_feed ) ); }, 9 ); add_action( 'friends_load_parsers', function ( Feed $friends_feed ) { require_once __DIR__ . '/feed-parsers/class-feed-parser-microformats.php'; $friends_feed->register_parser( Feed_Parser_Microformats::SLUG, new Feed_Parser_Microformats() ); }, 9 ); add_action( 'friends_load_parsers', function ( Feed $friends_feed ) { require_once __DIR__ . '/feed-parsers/class-feed-parser-json-feed.php'; $friends_feed->register_parser( Feed_Parser_JSON_Feed::SLUG, new Feed_Parser_JSON_Feed() ); }, 9 ); add_action( 'friends_load_parsers', function ( \Friends\Feed $friends_feed ) { if ( ! class_exists( '\Activitypub\Activitypub' ) ) { // ActivityPub plugin not active. return; } global $wp_filter; if ( isset( $wp_filter['friends_load_parsers']->callbacks[10] ) && class_exists( '\\ReflectionFunction' ) ) { // Unhook the parser from ActivityPub 0.14. foreach ( $wp_filter['friends_load_parsers']->callbacks[10] as $key => $hook ) { $r = new \ReflectionFunction( $hook['function'] ); if ( \str_ends_with( $r->getFileName(), 'activitypub.php' ) ) { remove_filter( 'friends_load_parsers', $hook['function'], 10 ); break; } } } require_once __DIR__ . '/feed-parsers/class-feed-parser-activitypub.php'; $friends_feed->register_parser( Feed_Parser_ActivityPub::SLUG, new Feed_Parser_ActivityPub( $friends_feed ) ); }, 9 ); // Global functions, for phpcs. /** * Validate feed catch_all * * @param array $catch_all The catch_all value to. * @return array A valid catch_all */ function validate_feed_catch_all( $catch_all ) { return Feed::validate_feed_catch_all( $catch_all ); } /** * Validate feed item rules * * @param array $rules The rules to validate. * @return array The valid rules. */ function validate_feed_rules( $rules ) { return Feed::validate_feed_rules( $rules ); } /** * Check whether this is a valid URL * * @param string $url The URL to check. * @return false|string URL or false on failure. */ function check_url( $url ) { return Friends::check_url( $url ); } // Integrations. require_once __DIR__ . '/integrations/class-blockroll.php'; Blockroll::init(); require_once __DIR__ . '/integrations/class-enable-mastodon-apps.php'; Enable_Mastodon_Apps::init();