M_NextGen_Basic_Tagcloud

The NextGEN Gallery M NextGen Basic Tagcloud class.

Defined (1)

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

/products/photocrati_nextgen/modules/nextgen_basic_tagcloud/module.nextgen_basic_tagcloud.php  
  1. class M_NextGen_Basic_Tagcloud 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. NGG_BASIC_TAGCLOUD,  
  12. 'NextGen Basic Tagcloud',  
  13. 'Provides a tagcloud for NextGEN Gallery',  
  14. '0.15',  
  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_Tagcloud_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_TAGCLOUD 
  28. ); 
  29.  
  30.  
  31. function _register_utilities() 
  32. if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id)) 
  33. $this->get_registry()->add_utility('I_Taxonomy_Controller', 'C_Taxonomy_Controller'); 
  34.  
  35. function _register_adapters() 
  36. // Provides validation for the display type 
  37. $this->get_registry()->add_adapter( 
  38. 'I_Display_Type',  
  39. 'A_NextGen_Basic_Tagcloud' 
  40. ); 
  41.  
  42. // Provides default values for the display type 
  43. $this->get_registry()->add_adapter( 
  44. 'I_Display_Type_Mapper',  
  45. 'A_NextGen_Basic_TagCloud_Mapper' 
  46. ); 
  47.  
  48. if (M_Attach_To_Post::is_atp_url() || is_admin()) 
  49. // Adds a display settings form 
  50. $this->get_registry()->add_adapter( 
  51. 'I_Form',  
  52. 'A_NextGen_Basic_TagCloud_Form',  
  53. $this->module_id 
  54. ); 
  55.  
  56. if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id)) 
  57. // Provides settings fields and frontend rendering 
  58. $this->get_registry()->add_adapter( 
  59. 'I_Display_Type_Controller',  
  60. 'A_NextGen_Basic_Tagcloud_Controller',  
  61. $this->module_id 
  62. ); 
  63.  
  64. // Add legacy urls 
  65. $this->get_registry()->add_adapter( 
  66. 'I_Routing_App',  
  67. 'A_NextGen_Basic_TagCloud_Urls' 
  68. ); 
  69.  
  70. function _register_hooks() 
  71. if (apply_filters('ngg_load_frontend_logic', TRUE, $this->module_id) 
  72. && (!defined('NGG_DISABLE_LEGACY_SHORTCODES') || !NGG_DISABLE_LEGACY_SHORTCODES)) 
  73. C_NextGen_Shortcode_Manager::add('tagcloud', array(&$this, 'render_shortcode')); 
  74. C_NextGen_Shortcode_Manager::add('nggtagcloud', array(&$this, 'render_shortcode')); 
  75.  
  76. add_filter( 
  77. 'the_posts',  
  78. array( 
  79. C_Taxonomy_Controller::get_instance(),  
  80. 'detect_ngg_tag'),  
  81. -10,  
  82. ); 
  83.  
  84. add_action('ngg_routes', array(&$this, 'define_routes')); 
  85.  
  86. function define_routes($router) 
  87. $slug = '/'.C_NextGen_Settings::get_instance()->router_param_slug; 
  88. $router->rewrite("{*}{$slug}{*}/tags/{\\w}{*}", "{1}{$slug}{2}/gallerytag--{3}{4}"); 
  89.  
  90. /** 
  91. * Gets a value from the parameter array, and if not available, uses the default value 
  92. * @param string $name 
  93. * @param mixed $default 
  94. * @param array $params 
  95. * @return mixed 
  96. */ 
  97. function _get_param($name, $default, $params) 
  98. return (isset($params[$name])) ? $params[$name] : $default; 
  99.  
  100. /** 
  101. * Short-cut for rendering a thumbnail gallery based on tags 
  102. * @param array $params 
  103. * @param null $inner_content 
  104. * @return string 
  105. */ 
  106. function render_shortcode($params, $inner_content=NULL) 
  107. $params['tagcloud'] = $this->_get_param('tagcloud', 'yes', $params); 
  108. $params['source'] = $this->_get_param('source', 'tags', $params); 
  109. $params['display_type'] = $this->_get_param('display_type', NGG_BASIC_TAGCLOUD, $params); 
  110.  
  111. $renderer = C_Displayed_Gallery_Renderer::get_instance(); 
  112. return $renderer->display_images($params, $inner_content); 
  113.  
  114. function get_type_list() 
  115. return array( 
  116. 'A_Nextgen_Basic_Tagcloud' => 'adapter.nextgen_basic_tagcloud.php',  
  117. 'A_Nextgen_Basic_Tagcloud_Controller' => 'adapter.nextgen_basic_tagcloud_controller.php',  
  118. 'A_Nextgen_Basic_Tagcloud_Form' => 'adapter.nextgen_basic_tagcloud_form.php',  
  119. 'C_NextGen_Basic_Tagcloud_Installer' => 'class.nextgen_basic_tagcloud_installer.php',  
  120. 'A_Nextgen_Basic_Tagcloud_Mapper' => 'adapter.nextgen_basic_tagcloud_mapper.php',  
  121. 'A_Nextgen_Basic_Tagcloud_Urls' => 'adapter.nextgen_basic_tagcloud_urls.php',  
  122. 'C_Taxonomy_Controller' => 'class.taxonomy_controller.php' 
  123. );