C_NextGen_Product_Installer

The NextGEN Gallery C NextGen Product Installer class.

Defined (1)

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

/products/photocrati_nextgen/class.nextgen_product_installer.php  
  1. class C_NextGen_Product_Installer 
  2. function _filter_modules($pope_modules_list, $product) 
  3. foreach ($product as $module_name) { 
  4. $module = C_Component_Registry::get_instance()->get_module($module_name); 
  5. $str = $module->module_id . '|' . $module->module_version; 
  6. $search = array_search($str, $pope_modules_list); 
  7. if (FALSE !== $search) 
  8. unset($pope_modules_list[$search]); 
  9. return $pope_modules_list; 
  10.  
  11. function get_modules_to_load_for($product_id) 
  12. $modules = array(); 
  13.  
  14. $obj = C_Component_Registry::get_instance()->get_product($product_id); 
  15. try { 
  16. $klass = new ReflectionClass( $obj ); 
  17. if ( $klass->hasMethod( 'get_modules_to_load' ) ) { 
  18. $modules = $obj->get_modules_to_load(); 
  19. } elseif ( $klass->hasProperty( 'modules' ) ) { 
  20. $modules = $klass->getStaticPropertyValue( 'modules' ); 
  21.  
  22. if ( ! $modules && $klass->hasMethod( 'define_modules' ) ) { 
  23. $modules = $obj->define_modules(); 
  24. if ( $klass->hasProperty( 'modules' ) ) { 
  25. $modules = $klass->getStaticPropertyValue( 'modules' ); 
  26. catch (ReflectionException $ex) { 
  27. // Oh oh... 
  28.  
  29. return $modules; 
  30.  
  31. function uninstall($hard) 
  32. // remove this products modules from the pope_module_list registry 
  33. $registry = C_Component_Registry::get_instance(); 
  34. $nextgen_product = $registry->get_product('photocrati-nextgen'); 
  35. $pope_modules_list = get_option('pope_module_list', array()); 
  36. $pope_modules_list = $this->_filter_modules($pope_modules_list, $nextgen_product->get_modules_to_load()); 
  37.  
  38. // run each modules respective uninstall routines 
  39. foreach ($nextgen_product->get_modules_to_load() as $module_name) { 
  40. if (($handler = C_Photocrati_Installer::get_handler_instance($module_name))) { 
  41. if (method_exists($handler, 'uninstall')) $handler->uninstall($hard); 
  42.  
  43. // lastly remove this product itself from the pope_module_list registry 
  44. $search = array_search('photocrati-nextgen|' . NGG_PLUGIN_VERSION, $pope_modules_list); 
  45. if (FALSE !== $search) 
  46. unset($pope_modules_list[$search]); 
  47.  
  48. // TODO: remove this. NextGen Pro's uninstall routine will be updated in a separate release,  
  49. // so to maintain proper support we run the same routine as above for it 
  50. $pro_version = FALSE; 
  51. if (defined('NGG_PRO_PLUGIN_VERSION')) 
  52. $pro_version = 'NGG_PRO_PLUGIN_VERSION'; 
  53. if (defined('NEXTGEN_GALLERY_PRO_VERSION')) 
  54. $pro_version = 'NEXTGEN_GALLERY_PRO_VERSION'; 
  55. if (FALSE !== $pro_version) 
  56. $pro_version = constant($pro_version); 
  57.  
  58. if (FALSE !== $pro_version) 
  59. $pope_modules_list = $this->_filter_modules($pope_modules_list, $this->get_modules_to_load_for('photocrati-nextgen-pro')); 
  60. $search = array_search('photocrati-nextgen-pro|' . $pro_version, $pope_modules_list); 
  61. if (FALSE !== $search) 
  62. unset($pope_modules_list[$search]); 
  63.  
  64. if (empty($pope_modules_list)) 
  65. delete_option('pope_module_list'); 
  66. else 
  67. update_option('pope_module_list', $pope_modules_list); 
  68.