M_NextGen_Basic_ImageBrowser

The NextGEN Gallery M NextGen Basic ImageBrowser class.

Defined (1)

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

/products/photocrati_nextgen/modules/nextgen_basic_imagebrowser/module.nextgen_basic_imagebrowser.php  
  1. class M_NextGen_Basic_ImageBrowser 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_imagebrowser',  
  12. 'NextGEN Basic ImageBrowser',  
  13. 'Provides the NextGEN Basic ImageBrowser Display Type',  
  14. '0.14',  
  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_ImageBrowser_Installer'); 
  21.  
  22. function initialize() 
  23. parent::initialize(); 
  24. if (is_admin()) { 
  25. $forms = C_Form_Manager::get_instance(); 
  26. $forms->add_form( 
  27. NGG_DISPLAY_SETTINGS_SLUG, NGG_BASIC_IMAGEBROWSER 
  28. ); 
  29.  
  30. /** 
  31. * Register adapters required for the NextGen Basic ImageBrowser 
  32. */ 
  33. function _register_adapters() 
  34. $this->get_registry()->add_adapter( 
  35. 'I_Display_Type_Mapper', 'A_NextGen_Basic_ImageBrowser_Mapper' 
  36. ); 
  37.  
  38. // Add validation for the display type 
  39. $this->get_registry()->add_adapter( 
  40. 'I_Display_Type', 'A_NextGen_Basic_ImageBrowser' 
  41. ); 
  42.  
  43. // Add imagebrowser ngglegacy-compatible urls 
  44. $this->get_registry()->add_adapter( 
  45. 'I_Routing_App', 'A_NextGen_Basic_ImageBrowser_Urls' 
  46. ); 
  47.  
  48. if (M_Attach_To_Post::is_atp_url() || is_admin()) 
  49. // Provide the imagebrowser form 
  50. $this->get_registry()->add_adapter( 
  51. 'I_Form',  
  52. 'A_NextGen_Basic_ImageBrowser_Form',  
  53. $this->module_id 
  54. ); 
  55.  
  56. if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id)) 
  57. // Add rendering logic 
  58. $this->get_registry()->add_adapter( 
  59. 'I_Display_Type_Controller',  
  60. 'A_NextGen_Basic_ImageBrowser_Controller',  
  61. $this->module_id 
  62. ); 
  63.  
  64. function _register_hooks() 
  65. if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id) 
  66. && (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES)) 
  67. C_NextGen_Shortcode_Manager::add('imagebrowser', array(&$this, 'render_shortcode')); 
  68. C_NextGen_Shortcode_Manager::add('nggimagebrowser', array(&$this, 'render_shortcode')); 
  69.  
  70. add_action('ngg_routes', array(&$this, 'define_routes')); 
  71.  
  72. function define_routes($router) 
  73. $slug = '/'.C_NextGen_Settings::get_instance()->router_param_slug; 
  74. $router->rewrite("{*}{$slug}{*}/image/{\\w}", "{1}{$slug}{2}/pid--{3}"); 
  75.  
  76. /** 
  77. * Gets a value from the parameter array, and if not available, uses the default value 
  78. * @param string $name 
  79. * @param mixed $default 
  80. * @param array $params 
  81. * @return mixed 
  82. */ 
  83. function _get_param($name, $default, $params) 
  84. return (isset($params[$name])) ? $params[$name] : $default; 
  85.  
  86. function render_shortcode($params, $inner_content=NULL) 
  87. $params['gallery_ids'] = $this->_get_param('id', NULL, $params); 
  88. $params['source'] = $this->_get_param('source', 'galleries', $params); 
  89. $params['display_type'] = $this->_get_param('display_type', NGG_BASIC_IMAGEBROWSER, $params); 
  90.  
  91. unset($params['id']); 
  92.  
  93. $renderer = C_Displayed_Gallery_Renderer::get_instance(); 
  94. return $renderer->display_images($params, $inner_content); 
  95.  
  96. function get_type_list() 
  97. return array( 
  98. 'A_Nextgen_Basic_Imagebrowser' => 'adapter.nextgen_basic_imagebrowser.php',  
  99. 'A_Nextgen_Basic_Imagebrowser_Controller' => 'adapter.nextgen_basic_imagebrowser_controller.php',  
  100. 'A_Nextgen_Basic_Imagebrowser_Form' => 'adapter.nextgen_basic_imagebrowser_form.php',  
  101. 'C_Nextgen_Basic_Imagebrowser_Installer' => 'class.nextgen_basic_imagebrowser_installer.php',  
  102. 'A_Nextgen_Basic_Imagebrowser_Mapper' => 'adapter.nextgen_basic_imagebrowser_mapper.php',  
  103. 'A_Nextgen_Basic_Imagebrowser_Urls' => 'adapter.nextgen_basic_imagebrowser_urls.php',  
  104. );