diff --git a/activitypub.php b/activitypub.php index a1cd6df..e19751f 100644 --- a/activitypub.php +++ b/activitypub.php @@ -27,6 +27,7 @@ function init() { \defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=

)|(?<=
)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' ); \defined( 'ACTIVITYPUB_USERNAME_REGEXP' ) || \define( 'ACTIVITYPUB_USERNAME_REGEXP', '(?:([A-Za-z0-9_-]+)@((?:[A-Za-z0-9_-]+\.)+[A-Za-z]+))' ); \defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "[ap_title]\n\n[ap_content]\n\n[ap_hashtags]\n\n[ap_shortlink]" ); + \define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); \define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); \define( 'ACTIVITYPUB_PLUGIN_FILE', plugin_dir_path( __FILE__ ) . '/' . basename( __FILE__ ) ); @@ -139,11 +140,25 @@ function plugin_settings_link( $actions ) { /** * Only load code that needs BuddyPress to run once BP is loaded and initialized. */ -function enable_buddypress_features() { - require_once \dirname( __FILE__ ) . '/integration/class-buddypress.php'; - Integration\Buddypress::init(); -} -add_action( 'bp_include', __NAMESPACE__ . '\enable_buddypress_features' ); +add_action( + 'bp_include', + function() { + require_once \dirname( __FILE__ ) . '/integration/class-buddypress.php'; + Integration\Buddypress::init(); + }, + 0 +); + +add_action( + 'plugins_loaded', + function() { + if ( defined( 'WP_SWEEP_VERSION' ) ) { + require_once \dirname( __FILE__ ) . '/integration/class-wp-sweep.php'; + Integration\Wp_Sweep::init(); + } + }, + 0 +); /** * `get_plugin_data` wrapper diff --git a/includes/collection/class-followers.php b/includes/collection/class-followers.php index 8a271f6..c7e55c2 100644 --- a/includes/collection/class-followers.php +++ b/includes/collection/class-followers.php @@ -338,6 +338,25 @@ class Followers { return $items; } + /** + * Get all Followers + * + * @param array $args The WP_Term_Query arguments. + * + * @return array The Term list of Followers. + */ + public static function get_all_followers( $args = array() ) { + $defaults = array( + 'taxonomy' => self::TAXONOMY, + 'hide_empty' => false, + ); + + $args = wp_parse_args( $args, $defaults ); + $terms = new WP_Term_Query( $args ); + + return $terms->get_terms(); + } + /** * Count the total number of followers * diff --git a/integration/class-wp-sweep.php b/integration/class-wp-sweep.php new file mode 100644 index 0000000..730edba --- /dev/null +++ b/integration/class-wp-sweep.php @@ -0,0 +1,50 @@ + 'ids' ) ); + + $excluded_term_ids = array_merge( $excluded_term_ids, $followers ); + + return array_unique( $excluded_term_ids ); + } +}