Skip to content

Instantly share code, notes, and snippets.

@hiddentrak
Created February 15, 2011 10:23
Show Gist options
  • Save hiddentrak/827361 to your computer and use it in GitHub Desktop.
Save hiddentrak/827361 to your computer and use it in GitHub Desktop.
Add NextGen Gallery plugin support to FlashPress
<?php
/**
* Vo Object for NextGen Album Object
*
* @package flashpress.vo
* @author Myles Bieniasz
**/
class NextGenAlbumVO {
var $_explicitType = "flashpress.vo.NextGenAlbumVO";
public $ID = 0;
public $title = "";
public $galleries = array();
}
?>
<?php
/**
* Vo Object for NextGen Gallery Object
*
* @package flashpress.vo
* @author Myles Bieniasz
**/
class NextGenGalleryVO {
var $_explicitType = "flashpress.vo.NextGenGalleryVO";
public $ID = 0;
public $title = "";
public $images = array();
}
?>
//NEXTGEN Gallery import
require_once('../../../blog/wp-content/plugins/nextgen-gallery/lib/ngg-db.php');
require_once('vo/NextGenGalleryVO.php');
require_once('vo/NextGenAlbumVO.php');
/**
* This function returns a NextGen Gallery
* @param integer $galleryID Id of gallery to retrieve
* @return array Array of image info
*/
public function getGalleryByID( $galleryID )
{
$galleryID = (int) $galleryID;
$pictureList = nggdb::get_gallery($galleryID);
$gallery = new NextGenGalleryVO();
$gallery->ID = $galleryID;
//$gallery->images = $pictureList;
foreach( $pictureList as $picID => $image )
{
array_push( $gallery->images, $image );
}
$gallery->title = $gallery->images[0]->title;
return $gallery;
}
/**
* This function returns a NextGen Album
* @param integer $albumID Id of album to retrieve
* @return array Array of image info
*/
public function getAlbumByID( $albumID )
{
$albumID = (int) $albumID;
$album = nggdb::find_album( $albumID );
$galleries = $album->gallery_ids;
$albumList = array();
foreach( $galleries as $galleryID )
{
$gallery = $this->getGalleryByID( $galleryID );
array_push( $albumList, $gallery );
}
return $albumList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment