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