';
$replace .= 'Get the Flash Player to see the slideshow.';
$replace .= "\n\t".'';
echo $replace;
}
/**********************************************************/
/* Slidehow widget control
/**********************************************************/
function widget_ngg_slideshow() {
// Check for the required plugin functions.
if ( !function_exists('register_sidebar_widget') )
return;
// Check for NextGEN Gallery
if ( !function_exists('nggShowSlideshow') )
return;
function widget_show_ngg_slideshow($args) {
extract($args);
// Each widget can store its own options. We keep strings here.
$options = get_option('widget_nggslideshow');
// These lines generate our output.
echo $before_widget . $before_title . $options['title'] . $after_title;
$url_parts = parse_url(get_bloginfo('home'));
nggSlideshowWidget($options['galleryid'] , $options['width'] , $options['height']);
echo $after_widget;
}
// Admin section
function widget_control_ngg_slideshow() {
global $wpdb;
$options = get_option('widget_nggslideshow');
if ( !is_array($options) )
$options = array('title'=>'Slideshow', 'galleryid'=>'0','height'=>'120','width'=>'160',);
if ( $_POST['ngg-submit'] ) {
$options['title'] = strip_tags(stripslashes($_POST['ngg-title']));
$options['galleryid'] = $_POST['ngg-galleryid'];
$options['height'] = $_POST['ngg-height'];
$options['width'] = $_POST['ngg-width'];
update_option('widget_nggslideshow', $options);
}
$title = htmlspecialchars($options['title'], ENT_QUOTES);
$height = $options['height'];
$width = $options['width'];
// The Box content
echo '
';
echo '
';
echo '
';
echo '';
echo '';
echo '';
}
register_sidebar_widget(array('NextGEN Slideshow', 'widgets'), 'widget_show_ngg_slideshow');
register_widget_control(array('NextGEN Slideshow', 'widgets'), 'widget_control_ngg_slideshow', 300, 200);
}
/*******************************************************/
/* DISPLAY FUNCTION TO THE RECENT & RANDOM IMAGES
/*******************************************************/
function nggDisplayImagesWidget($thumb,$number,$sizeX,$sizeY,$mode,$imgtype) {
// Check for NextGEN Gallery
if ( !function_exists('ngg_get_thumbnail_url') )
return;
//origy ngg options
$ngg_options = get_option('ngg_options');
// get the effect code
if ($ngg_options[thumbEffect] != "none") $thumbcode = stripslashes($ngg_options[thumbCode]);
if ($ngg_options[thumbEffect] == "highslide") $thumbcode = str_replace("%GALLERY_NAME%", "'sidebar'", $thumbcode);
else $thumbcode = str_replace("%GALLERY_NAME%", "sidebar", $thumbcode);
// Put your HTML code here if you want to personalize the image display!
$IMGbefore = ''; // NOT IN USE!
$IMGafter = ''; // NOT IN USE!
$Abefore = ''; // NOT IN USE!
$Aafter = ''; // NOT IN USE!
// [0.99] remember the displayed images
$displayedimages = array();
global $wpdb;
// [0.99] Check the number of the images (disable more pictures)
$numberofimages = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures");
if (($numberofimages < $number)) $number=$numberofimages;
for ($i=1; $i<=$number; $i++) {
// Get a random image from the database
if (($imgtype == "random")) {
// [0.99] -> disable duplicate images in random!
$imageID = $wpdb->get_var("SELECT pid FROM $wpdb->nggpictures ORDER by rand() limit 1");
while ( in_array($imageID, $displayedimages)) {
$imageID = $wpdb->get_var("SELECT pid FROM $wpdb->nggpictures ORDER by rand() limit 1");
}
$displayedimages[$i] = $imageID;
}
else {
// Get the $i latest image from the database
$imageID = $wpdb->get_var("SELECT pid FROM $wpdb->nggpictures ORDER by pid DESC limit ".$i.",1");
}
// [0.97] new variable -> Set up the strings
$Astart = '';
$Aend = '';
// Here comes the display
echo $Abefore;
// [0.95] new function -> Thumbnail or Normal image
if ( ($thumb == "false") ) {
// NORMAL IMAGE mode
if ( ($mode == 'web20') ) {
// [0.95] [deleted] ->
'."\n";
}
/**********************************************************/
/* Recent widget
/**********************************************************/
function widget_ngg_recentimage() {
// Check for the required plugin functions. This will prevent fatal
// errors occurring when you deactivate the dynamic-sidebar plugin.
if ( !function_exists('register_sidebar_widget') )
return;
// Check for NextGEN Gallery
if ( !function_exists('ngg_get_thumbnail_url') )
return;
function widget_nextgenrecentimage($args) {
extract($args);
// Each widget can store its own options. We keep strings here.
$options = get_option('widget_NextGenrecentimage');
$title = $options['title'];
$thumb = $options['thumb'];
$number = $options['number'];
$sizeX = $options['sizeX'];
$sizeY = $options['sizeY'];
$mode = $options['mode'];
$showinhome = htmlspecialchars($options['showinhome'], ENT_QUOTES);
$showcategory = htmlspecialchars($options['showcategory'], ENT_QUOTES);
$categorylist = htmlspecialchars($options['categorylist'], ENT_QUOTES);
$imgtype = "recent";
$show_widget = false; // checking display status (category or home)
$categorieslist = nggGetCSVValues($categorylist,','); // Make array for checking the categories
if (($showcategory == "denied")) { // Denied list -> enable everywhere and make false if found!
$show_widget = true;
foreach((get_the_category()) as $cat)
{ if ((in_array($cat->cat_ID , $categorieslist)))
$show_widget = false;
}
}
if (($showcategory == "allow")) // Allow list -> false is the default -> enable if found
foreach((get_the_category()) as $cat)
{ if ((in_array($cat->cat_ID , $categorieslist)))
$show_widget = true;
}
if (($showcategory == "all")) // All categories -> if it's not the home -> enable
if ((is_home() != true))
$show_widget = true;
if (($showinhome == "yes")) // Home page -> If yes -> enable
if ((is_home()))
$show_widget = true;
$url_parts = parse_url(get_bloginfo('home'));
// Null parameters check
if ( ($number == '') ) $number = 1;
if ( ($sizeX == '') ) $sizeX = 190;
if ( ($sizeY == '') ) $sizeY = 190;
if ($show_widget) {
echo $before_widget . $before_title . $title . $after_title;
echo "\n".'