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
- class M_NextGen_Basic_ImageBrowser extends C_Base_Module
- {
- function define()
- {
- parent::define(
- 'photocrati-nextgen_basic_imagebrowser',
- 'NextGEN Basic ImageBrowser',
- 'Provides the NextGEN Basic ImageBrowser Display Type',
- '0.11',
- 'https://www.imagely.com/wordpress-gallery-plugin/nextgen-gallery/',
- 'Photocrati Media',
- 'https://www.imagely.com'
- );
- C_Photocrati_Installer::add_handler($this->module_id, 'C_NextGen_Basic_ImageBrowser_Installer');
- }
- function initialize()
- {
- parent::initialize();
- if (is_admin()) {
- $forms = C_Form_Manager::get_instance();
- $forms->add_form(
- NGG_DISPLAY_SETTINGS_SLUG, NGG_BASIC_IMAGEBROWSER
- );
- }
- }
- /**
- * Register adapters required for the NextGen Basic ImageBrowser
- */
- function _register_adapters()
- {
- $this->get_registry()->add_adapter(
- 'I_Display_Type_Mapper', 'A_NextGen_Basic_ImageBrowser_Mapper'
- );
- // Add validation for the display type
- $this->get_registry()->add_adapter(
- 'I_Display_Type', 'A_NextGen_Basic_ImageBrowser'
- );
- // Add imagebrowser ngglegacy-compatible urls
- $this->get_registry()->add_adapter(
- 'I_Routing_App', 'A_NextGen_Basic_ImageBrowser_Urls'
- );
- if (M_Attach_To_Post::is_atp_url() || is_admin())
- {
- // Provide the imagebrowser form
- $this->get_registry()->add_adapter(
- 'I_Form',
- 'A_NextGen_Basic_ImageBrowser_Form',
- $this->module_id
- );
- }
- if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id))
- {
- // Add rendering logic
- $this->get_registry()->add_adapter(
- 'I_Display_Type_Controller',
- 'A_NextGen_Basic_ImageBrowser_Controller',
- $this->module_id
- );
- }
- }
- function _register_hooks()
- {
- if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id)
- && (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES))
- {
- C_NextGen_Shortcode_Manager::add('imagebrowser', array(&$this, 'render_shortcode'));
- C_NextGen_Shortcode_Manager::add('nggimagebrowser', array(&$this, 'render_shortcode'));
- }
- add_action('ngg_routes', array(&$this, 'define_routes'));
- }
- function define_routes($router)
- {
- $slug = '/'.C_NextGen_Settings::get_instance()->router_param_slug;
- $router->rewrite("{*}{$slug}{*}/image/{\\w}", "{1}{$slug}{2}/pid--{3}");
- }
- /**
- * Gets a value from the parameter array, and if not available, uses the default value
- *
- * @param string $name
- * @param mixed $default
- * @param array $params
- * @return mixed
- */
- function _get_param($name, $default, $params)
- {
- return (isset($params[$name])) ? $params[$name] : $default;
- }
- function render_shortcode($params, $inner_content=NULL)
- {
- $params['gallery_ids'] = $this->_get_param('id', NULL, $params);
- $params['source'] = $this->_get_param('source', 'galleries', $params);
- $params['display_type'] = $this->_get_param('display_type', NGG_BASIC_IMAGEBROWSER, $params);
- unset($params['id']);
- $renderer = C_Displayed_Gallery_Renderer::get_instance();
- return $renderer->display_images($params, $inner_content);
- }
- function get_type_list()
- {
- return array(
- 'A_Nextgen_Basic_Imagebrowser' => 'adapter.nextgen_basic_imagebrowser.php',
- 'A_Nextgen_Basic_Imagebrowser_Controller' => 'adapter.nextgen_basic_imagebrowser_controller.php',
- 'A_Nextgen_Basic_Imagebrowser_Form' => 'adapter.nextgen_basic_imagebrowser_form.php',
- 'C_Nextgen_Basic_Imagebrowser_Installer' => 'class.nextgen_basic_imagebrowser_installer.php',
- 'A_Nextgen_Basic_Imagebrowser_Mapper' => 'adapter.nextgen_basic_imagebrowser_mapper.php',
- 'A_Nextgen_Basic_Imagebrowser_Urls' => 'adapter.nextgen_basic_imagebrowser_urls.php',
- );
- }
- }