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