check_nextgen

Checks if there is a NextGEN version running.

Defined (1)

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

/nggallery.php  
  1. class check_nextgen { 
  2.  
  3. static function nextgen_activated() { 
  4.  
  5. if (!function_exists('get_plugin_data')) { 
  6. include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
  7.  
  8. $nextcellent_plugin= plugin_basename(__FILE__); 
  9.  
  10. $plugin_list = get_plugins(); 
  11.  
  12. //Loop over all the active plugins 
  13. foreach ($plugin_list as $plugin_file=>$plugin_data) { 
  14. //If we found nextcellent, skip it 
  15. if ($plugin_file==$nextcellent_plugin) continue; 
  16. //If the plugin is deactivated ignore it. 
  17. if (!is_plugin_active($plugin_file)) continue; 
  18. if (strpos($plugin_file, 'nggallery.php')!==FALSE) { 
  19. $version = $plugin_data['Version']; 
  20. //Check if effectively could be nextgen 
  21. $is_nextgen= (strpos(strtolower($plugin_data['Name']), 'nextgen') !==FALSE); 
  22. if ($is_nextgen) { //is it? 
  23. //Yes, display msg on admin console 
  24. add_action( 
  25. 'admin_notices',  
  26. create_function( 
  27. '',  
  28. 'echo \'<div id="message" class="error"><p><strong>' . __('Sorry, NextCellent Gallery is deactivated: NextGEN version ' . $version . ' was detected. Deactivate it before running NextCellent!', 'nggallery') . '</strong></p></div>\';' 
  29. ); 
  30. //Deactivate this plugin 
  31. deactivate_plugins($nextcellent_plugin); 
  32. return true; 
  33. return false;