M_NextGen_Data

The NextGEN Gallery M NextGen Data class.

Defined (1)

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

/products/photocrati_nextgen/modules/nextgen_data/module.nextgen_data.php  
  1. class M_NextGen_Data 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-data',  
  12. 'NextGEN Data Tier',  
  13. "Provides a data tier for NextGEN gallery based on the DataMapper module",  
  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_Data_Installer'); 
  21.  
  22. function _register_adapters() 
  23. $this->get_registry()->add_adapter('I_Component_Factory', 'A_NextGen_Data_Factory'); 
  24. #$this->get_registry()->add_adapter('I_CustomPost_DataMapper', 'A_Attachment_DataMapper', 'attachment'); 
  25. $this->get_registry()->add_adapter('I_Installer', 'A_NextGen_Data_Installer'); 
  26.  
  27.  
  28. function _register_utilities() 
  29. $this->get_registry()->add_utility('I_Gallery_Mapper', 'C_Gallery_Mapper'); 
  30. $this->get_registry()->add_utility('I_Image_Mapper', 'C_Image_Mapper'); 
  31. $this->get_registry()->add_utility('I_Album_Mapper', 'C_Album_Mapper'); 
  32. $this->get_registry()->add_utility('I_Gallery_Storage', 'C_Gallery_Storage'); 
  33.  
  34. function get_type_list() 
  35. return array( 
  36. 'A_Attachment_Datamapper' => 'adapter.attachment_datamapper.php',  
  37. 'A_Customtable_Sorting_Datamapper' => 'adapter.customtable_sorting_datamapper.php',  
  38. 'A_Nextgen_Data_Factory' => 'adapter.nextgen_data_factory.php',  
  39. 'C_NextGen_Data_Installer' => 'class.nextgen_data_installer.php',  
  40. 'A_Parse_Image_Metadata' => 'adapter.parse_image_metadata.php',  
  41. 'C_Album' => 'class.album.php',  
  42. 'C_Gallery' => 'class.gallery.php',  
  43. 'C_Image' => 'class.image.php',  
  44. 'C_Album_Mapper' => 'class.album_mapper.php',  
  45. 'C_Gallerystorage_Base' => 'class.gallerystorage_base.php',  
  46. 'C_Gallerystorage_Driver_Base' => 'class.gallerystorage_driver_base.php',  
  47. 'C_Gallery_Mapper' => 'class.gallery_mapper.php',  
  48. 'C_Gallery_Storage' => 'class.gallery_storage.php',  
  49. 'C_Image_Mapper' => 'class.image_mapper.php',  
  50. 'C_Image_Wrapper' => 'class.image_wrapper.php',  
  51. 'C_Image_Wrapper_Collection' => 'class.image_wrapper_collection.php',  
  52. 'C_Nextgen_Metadata' => 'class.nextgen_metadata.php',  
  53. 'Mixin_NextGen_Table_Extras' => 'mixin.nextgen_table_extras.php',  
  54. 'C_Ngglegacy_Gallerystorage_Driver' => 'class.ngglegacy_gallerystorage_driver.php',  
  55. 'C_Ngglegacy_Thumbnail' => 'class.ngglegacy_thumbnail.php',  
  56. 'C_Wordpress_Gallerystorage_Driver' => 'class.wordpress_gallerystorage_driver.php' 
  57. ); 
  58.  
  59.  
  60. function _register_hooks() 
  61. add_action('init', array(&$this, 'register_custom_post_types')); 
  62. add_filter('posts_orderby', array($this, 'wp_query_order_by'), 10, 2); 
  63.  
  64. function register_custom_post_types() 
  65. $types = array( 
  66. 'ngg_album' => 'NextGEN Gallery - Album',  
  67. 'ngg_gallery' => 'NextGEN Gallery - Gallery',  
  68. 'ngg_pictures' => 'NextGEN Gallery - Image',  
  69. ); 
  70.  
  71. foreach ($types as $type => $label) { 
  72. register_post_type($type, array( 
  73. 'label' => $label,  
  74. 'publicly_queryable' => FALSE,  
  75. 'exclude_from_search' => TRUE,  
  76. )); 
  77.  
  78. function wp_query_order_by($order_by, $wp_query) 
  79. if ($wp_query->get('datamapper_attachment')) 
  80. $order_parts = explode(' ', $order_by); 
  81. $order_name = array_shift($order_parts); 
  82.  
  83. $order_by = 'ABS(' . $order_name . ') ' . implode(' ', $order_parts) . ', ' . $order_by; 
  84.  
  85. return $order_by; 
  86.  
  87. static function strip_html($data, $just_scripts=FALSE) 
  88. $retval = $data; 
  89.  
  90. if (!$just_scripts) 
  91. $retval = wp_strip_all_tags($retval, TRUE); 
  92. else { 
  93. $retval = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $retval ); 
  94. $retval= preg_replace('/[\r\n\t ]+/', ' ', $retval); 
  95. $retval = preg_replace("/\\son[^\\s=]+=/", '', $retval); 
  96.  
  97. return $retval;