M_NextGen_Basic_Album

The NextGEN Gallery M NextGen Basic Album class.

Defined (1)

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

/products/photocrati_nextgen/modules/nextgen_basic_album/module.nextgen_basic_album.php  
  1. class M_NextGen_Basic_Album extends C_Base_Module 
  2. function define() 
  3. parent::define( 
  4. 'photocrati-nextgen_basic_album',  
  5. 'NextGEN Basic Album',  
  6. "Provides support for NextGEN's Basic Album",  
  7. '0.13',  
  8. 'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',  
  9. 'Photocrati Media',  
  10. 'https://www.imagely.com' 
  11. ); 
  12.  
  13. C_Photocrati_Installer::add_handler($this->module_id, 'C_NextGen_Basic_Album_Installer'); 
  14.  
  15. function initialize() 
  16. parent::initialize(); 
  17.  
  18. if (is_admin()) { 
  19. $forms = C_Form_Manager::get_instance(); 
  20. $forms->add_form( 
  21. NGG_DISPLAY_SETTINGS_SLUG,  
  22. NGG_BASIC_COMPACT_ALBUM 
  23. ); 
  24. $forms->add_form( 
  25. NGG_DISPLAY_SETTINGS_SLUG,  
  26. NGG_BASIC_EXTENDED_ALBUM 
  27. ); 
  28.  
  29.  
  30. function _register_adapters() 
  31. // Add validation for album display settings 
  32. $this->get_registry()->add_adapter( 
  33. 'I_Display_Type',  
  34. 'A_NextGen_Basic_Album' 
  35. ); 
  36.  
  37. if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id)) 
  38. // Add a controller for displaying albums on the front-end 
  39. $this->get_registry()->add_adapter( 
  40. 'I_Display_Type_Controller',  
  41. 'A_NextGen_Basic_Album_Controller',  
  42. array( 
  43. NGG_BASIC_COMPACT_ALBUM,  
  44. NGG_BASIC_EXTENDED_ALBUM,  
  45. $this->module_id 
  46. ); 
  47.  
  48. // Add a generic adapter for display types to do late url rewriting 
  49. $this->get_registry()->add_adapter( 
  50. 'I_Displayed_Gallery_Renderer',  
  51. 'A_NextGen_Basic_Album_Routes' 
  52. ); 
  53.  
  54. $this->get_registry()->add_adapter('I_MVC_View', 'A_NextGen_Album_Breadcrumbs'); 
  55. $this->get_registry()->add_adapter('I_MVC_View', 'A_NextGen_Album_Descriptions'); 
  56.  
  57.  
  58. // Add a mapper for setting the defaults for the album 
  59. $this->get_registry()->add_adapter( 
  60. 'I_Display_Type_Mapper',  
  61. 'A_NextGen_Basic_Album_Mapper' 
  62. ); 
  63.  
  64. if (M_Attach_To_Post::is_atp_url() || is_admin()) 
  65. // Add a display settings form for each display type 
  66. $this->get_registry()->add_adapter( 
  67. 'I_Form',  
  68. 'A_NextGen_Basic_Compact_Album_Form',  
  69. NGG_BASIC_COMPACT_ALBUM 
  70. ); 
  71. $this->get_registry()->add_adapter( 
  72. 'I_Form',  
  73. 'A_NextGen_Basic_Extended_Album_Form',  
  74. NGG_BASIC_EXTENDED_ALBUM 
  75. ); 
  76.  
  77. // Creates special parameter segments 
  78. $this->get_registry()->add_adapter( 
  79. 'I_Routing_App',  
  80. 'A_NextGen_Basic_Album_Urls' 
  81. ); 
  82.  
  83. function _register_hooks() 
  84. if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id) 
  85. && (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES)) 
  86. C_NextGen_Shortcode_Manager::add('album', array(&$this, 'ngglegacy_shortcode')); 
  87. C_NextGen_Shortcode_Manager::add('nggalbum', array(&$this, 'ngglegacy_shortcode')); 
  88.  
  89. add_filter('ngg_atp_show_display_type', array($this, 'atp_show_basic_albums'), 10, 2); 
  90.  
  91. /** 
  92. * ATP filters display types by not displaying those whose name attribute isn't an active POPE module. This 
  93. * is a workaround/hack to compensate for basic albums sharing a module. 
  94. * @param bool $available 
  95. * @param C_Display_Type $display_type 
  96. * @return bool 
  97. */ 
  98. function atp_show_basic_albums($available, $display_type) 
  99. if (in_array($display_type->name, array(NGG_BASIC_COMPACT_ALBUM, NGG_BASIC_EXTENDED_ALBUM))) 
  100. $available = TRUE; 
  101. return $available; 
  102.  
  103. /** 
  104. * Gets a value from the parameter array, and if not available, uses the default value 
  105. * @param string $name 
  106. * @param mixed $default 
  107. * @param array $params 
  108. * @return mixed 
  109. */ 
  110. function _get_param($name, $default, $params) 
  111. return (isset($params[$name])) ? $params[$name] : $default; 
  112.  
  113. /** 
  114. * Renders the shortcode for rendering an album 
  115. * @param array $params 
  116. * @param null $inner_content 
  117. * @return string 
  118. */ 
  119. function ngglegacy_shortcode($params, $inner_content=NULL) 
  120. $params['source'] = $this->_get_param('source', 'albums', $params); 
  121. $params['container_ids'] = $this->_get_param('id', NULL, $params); 
  122. $params['display_type'] = $this->_get_param('display_type', NGG_BASIC_COMPACT_ALBUM, $params); 
  123.  
  124. unset($params['id']); 
  125.  
  126. $renderer = C_Displayed_Gallery_Renderer::get_instance(); 
  127. return $renderer->display_images($params, $inner_content); 
  128.  
  129. function get_type_list() 
  130. return array( 
  131. 'A_NextGen_Album_Breadcrumbs' => 'adapter.nextgen_album_breadcrumbs.php',  
  132. 'A_NextGen_Album_Descriptions' => 'adapter.nextgen_album_descriptions.php',  
  133. 'A_Nextgen_Basic_Album' => 'adapter.nextgen_basic_album.php',  
  134. 'A_Nextgen_Basic_Album_Controller' => 'adapter.nextgen_basic_album_controller.php',  
  135. 'A_Nextgen_Basic_Album_Mapper' => 'adapter.nextgen_basic_album_mapper.php',  
  136. 'A_Nextgen_Basic_Album_Routes' => 'adapter.nextgen_basic_album_routes.php',  
  137. 'A_Nextgen_Basic_Album_Urls' => 'adapter.nextgen_basic_album_urls.php',  
  138. 'A_Nextgen_Basic_Compact_Album_Form' => 'adapter.nextgen_basic_compact_album_form.php',  
  139. 'A_Nextgen_Basic_Extended_Album_Form' => 'adapter.nextgen_basic_extended_album_form.php',  
  140. 'Mixin_Nextgen_Basic_Album_Form' => 'mixin.nextgen_basic_album_form.php' 
  141. );