Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. //----Gallery Page Short Code-----------
  2. public static function Gallery($atts){
  3.  
  4. if (!function_exists('getfilters')){
  5. function getfilters($gal){
  6. $filters = array();
  7. foreach($gal as $item){
  8. $filters = array_merge($filters,wp_get_object_terms($item->pid, 'ngg_tag', 'fields=names'));
  9. }
  10. $filters = array_unique($filters);
  11. foreach($filters as $filter){
  12. $html .= '<li><a id="'.$filter.'"><span>'.$filter.'</span></a></li>';
  13. }
  14. return $html;
  15. }
  16. }
  17.  
  18. if (!function_exists('toHTML')){
  19. function toHTML($gal){
  20. global $nggdb;
  21. $html = '';
  22. $html .= ' <div class="smaller-title border">
  23. <h2 class="category-title">'.gettitle($gal).'</h2>
  24.  
  25. </div>';
  26. $html .= '<div class="gal-wrapper">
  27. <ul class="images-gallery" id="all">';
  28. $elid = 0;
  29. foreach($gal as $item){
  30. $elid++;
  31. $picture = nggdb::find_image($item->pid);
  32. $html .= '
  33. <li class="'.implode(' ', wp_get_object_terms($item->pid, 'ngg_tag', 'fields=names')).'" data-id="'.$elid.'">
  34. <div class="ic_container"><a title="'.stripslashes(nggGallery::i18n($item->alttext)).'" rel="group" href="'.$picture->imageURL.'"><img src="'.$picture->thumbURL.'" alt="Hello World" /></a>
  35. <div class="ic_caption">
  36. <h3>'.stripslashes(nggGallery::i18n($item->alttext)).'</h3>
  37. <p class="ic_text">'.$item->description.'</p>
  38. </div>
  39. </div></li>';
  40. }
  41.  
  42. $html .= ' </ul><div class="clear"></div>
  43. </div>';
  44. return $html;
  45. }
  46. }
  47. //----we have to check if there is a nextGenGalleryPlugin
  48. if (class_exists('nggLoader')){
  49. extract( shortcode_atts( array(
  50. 'id' => 0,
  51. ), $atts ) );
  52.  
  53. $gallery = getGallery($id);
  54. return toHTML($gallery);
  55. //if there is no nextGenGallery tell to get one
  56. }
  57. else {
  58. TiAdminPanel::AlertNow('error','NextGen Gallery plugin is not installed. I can not show you the gallery');
  59. }
  60. }
  61.  
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement