=' );
}
/**
* Adds notice in WP Admin that minimum version of PHP is not met.
*
* @access private
*/
public static function add_php_notice() {
$screen = get_current_screen();
$valid_screens = self::get_critical_screen_ids();
if ( null === $screen || ! current_user_can( 'activate_plugins' ) || ! in_array( $screen->id, $valid_screens, true ) ) {
return;
}
// translators: %1$s is version of PHP that Activity Feed Anywhere requires; %2$s is the version of PHP WordPress is running on.
$message = sprintf( __( 'Activity Feed Anywhere requires a minimum PHP version of %1$s, but you are running %2$s.', 'activity-feed-anywhere' ), self::MINIMUM_PHP_VERSION, phpversion() );
echo '
';
echo wp_kses( $message, array( 'strong' => array() ) );
$php_update_url = 'https://wordpress.org/support/update-php/';
if ( function_exists( 'wp_get_update_php_url' ) ) {
$php_update_url = wp_get_update_php_url();
}
printf(
'
%2$s %3$s
',
esc_url( $php_update_url ),
esc_html__( 'Learn more about updating PHP', 'activity-feed-anywhere' ),
/* translators: accessibility text */
esc_html__( '(opens in a new tab)', 'activity-feed-anywhere' )
);
echo '
';
}
/**
* Checks for our BuddyBoss requirement.
*
* @return bool
*/
private static function check_buddyboss() {
// We aren't currently compatible with BuddyBoss
include_once ABSPATH. 'wp-admin/includes/plugin.php';
if ( is_plugin_active ('buddyboss-platform/bp-loader.php') ) {
return false;
} else {
return true;
}
}
/**
* Adds notice in WP Admin that BuddyBoss is prohibited.
*
* @access private
*/
public static function add_buddyboss_notice() {
$screen = get_current_screen();
$valid_screens = self::get_critical_screen_ids();
if ( null === $screen || ! current_user_can( 'activate_plugins' ) || ! in_array( $screen->id, $valid_screens, true ) ) {
return;
}
$message = __( 'Activity Feed Anywhere is currently incompatible with BuddyBoss.', 'activity-feed-anywhere' );
echo '';
echo wp_kses( $message, array( 'strong' => array() ) );
$spaces_url = 'https://buddypress.org';
printf(
'
%2$s %3$s
',
esc_url( $spaces_url ),
esc_html__( 'Learn about BuddyPress', 'activity-feed-anywhere' ),
/* translators: accessibility text */
esc_html__( '(opens in a new tab)', 'activity-feed-anywhere' )
);
echo '
';
}
/**
* Checks for our BuddyPress requirement.
*
* @return bool
*/
private static function check_buddypress() {
if ( class_exists( 'BuddyPress' ) ) {
return true;
} else {
return false;
}
}
/**
* Adds notice in WP Admin that BuddyPress is required.
*
* @access private
*/
public static function add_buddypress_notice() {
$screen = get_current_screen();
$valid_screens = self::get_critical_screen_ids();
if ( null === $screen || ! current_user_can( 'activate_plugins' ) || ! in_array( $screen->id, $valid_screens, true ) ) {
return;
}
$message = __( 'Activity Feed Anywhere requires BuddyPress to be installed and activated.', 'activity-feed-anywhere' );
echo '';
echo wp_kses( $message, array( 'strong' => array() ) );
$spaces_url = 'https://buddypress.org';
printf(
'
%2$s %3$s
',
esc_url( $spaces_url ),
esc_html__( 'Learn about BuddyPress', 'activity-feed-anywhere' ),
/* translators: accessibility text */
esc_html__( '(opens in a new tab)', 'activity-feed-anywhere' )
);
echo '
';
}
/**
* Deactivate self.
*/
public static function deactivate_self() {
deactivate_plugins( BS_AFA_PLUGIN_BASENAME );
}
/**
* Returns the screen IDs where dependency notices should be displayed.
*
* @return array
*/
private static function get_critical_screen_ids() {
return array( 'dashboard', 'plugins', 'plugins-network' );
}
}