bws_wp_min_version_check

The Google Sitemap by BestWebSoft bws wp min version check function.

Description

bws_wp_min_version_check( (string) $plugin_basename, $plugin_info, $require_wp, (bool) $min_wp = false ); 

Parameters (4)

0. $plugin_basename (string)
The plugin basename.
1. $plugin_info
The plugin info.
2. $require_wp
The require wp.
3. $min_wp — Optional. (bool) => false
The min wp.

Usage

  1. if ( !function_exists( 'bws_wp_min_version_check' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-sitemap-by-bestwebsoft/bws_menu/bws_functions.php'; 
  3.  
  4. // The plugin basename. 
  5. $plugin_basename = ''; 
  6.  
  7. // The plugin info. 
  8. $plugin_info = null; 
  9.  
  10. // The require wp. 
  11. $require_wp = null; 
  12.  
  13. // The min wp. 
  14. $min_wp = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bws_wp_min_version_check($plugin_basename, $plugin_info, $require_wp, $min_wp); 
  18.  

Defined (1)

The function is defined in the following location(s).

/bws_menu/bws_functions.php  
  1. function bws_wp_min_version_check( $plugin_basename, $plugin_info, $require_wp, $min_wp = false ) { 
  2. global $wp_version, $bws_versions_notice_array; 
  3. if ( false == $min_wp ) 
  4. $min_wp = $require_wp; 
  5. if ( version_compare( $wp_version, $min_wp, "<" ) ) { 
  6. include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
  7. if ( is_plugin_active( $plugin_basename ) ) { 
  8. deactivate_plugins( $plugin_basename ); 
  9. $admin_url = ( function_exists( 'get_admin_url' ) ) ? get_admin_url( null, 'plugins.php' ) : esc_url( '/wp-admin/plugins.php' ); 
  10. wp_die(  
  11. sprintf( 
  12. "<strong>%s</strong> %s <strong>WordPress %s</strong> %s <br /><br />%s <a href='%s'>%s</a>.",  
  13. $plugin_info['Name'],  
  14. __( 'requires', 'bestwebsoft' ),  
  15. $require_wp,  
  16. __( 'or higher, that is why it has been deactivated! Please upgrade WordPress and try again.', 'bestwebsoft' ),  
  17. __( 'Back to the WordPress', 'bestwebsoft' ),  
  18. $admin_url,  
  19. __( 'Plugins page', 'bestwebsoft' ) 
  20. ); 
  21. } elseif ( version_compare( $wp_version, $require_wp, "<" ) ) { 
  22. $bws_versions_notice_array[] = array( 'name' => $plugin_info['Name'], 'version' => $require_wp );