/** * Check if plugin dependencies are satisfied and add an admin notice if not * * @return bool */ public static function is_dependency_satisfied() { if (class_exists('BuddyPress') && version_compare(BuddyPress::instance()->version, self::PLUGIN_MIN_VERSION, '>=')) { return true; } return false; }
/** * Main BuddyPress Instance. * * BuddyPress is great. * Please load it only one time. * For this, we thank you. * * Insures that only one instance of BuddyPress exists in memory at any * one time. Also prevents needing to define globals all over the place. * * @since 1.7.0 * * @static object $instance * @see buddypress() * * @return BuddyPress The one true BuddyPress. */ public static function instance() { // Store the instance locally to avoid private static replication static $instance = null; // Only run these methods if they haven't been run previously if (null === $instance) { $instance = new BuddyPress(); $instance->constants(); $instance->setup_globals(); $instance->legacy_constants(); $instance->includes(); $instance->setup_actions(); } // Always return the instance return $instance; // The last metroid is in captivity. The galaxy is at peace. }
/** * Main BuddyPress Instance * * BuddyPress is great * Please load it only one time * For this, we thank you * * Insures that only one instance of BuddyPress exists in memory at any one * time. Also prevents needing to define globals all over the place. * * @since BuddyPress (1.7) * * @staticvar array $instance * @uses BuddyPress::constants() Setup the constants (mostly deprecated) * @uses BuddyPress::setup_globals() Setup the globals needed * @uses BuddyPress::includes() Include the required files * @uses BuddyPress::setup_actions() Setup the hooks and actions * @see buddypress() * * @return BuddyPress The one true BuddyPress */ public static function instance() { if (!isset(self::$instance)) { self::$instance = new BuddyPress(); self::$instance->constants(); self::$instance->setup_globals(); self::$instance->legacy_constants(); self::$instance->includes(); self::$instance->setup_actions(); } return self::$instance; }