';
$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,$thumbcode) {
// Check for NextGEN Gallery
if ( !function_exists('ngg_get_thumbnail_url') )
return;
// 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;
//echo $number." <-- total display images";
//echo $numberofimages." <-- total images in you galleries";
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
/**********************************************************/
/* HERE COMES THE RECENT IMAGE 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;
// This is the function that outputs our little widget...
function widget_nextgenrecentimage($args) {
// $args is an array of strings that help widgets to conform to
// the active theme: before_widget, before_title, after_widget,
// and after_title are the array keys.
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);
// [0.95] -> [add function -> imagetype (imgtype) -> random or recent
$imgtype = "recent"; //$options['imgtype'];
//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);
$show_widget = false; // checking display status (category or home)
$categorieslist = getCSVValues($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".'
'."\n";
// v.095 [deleted] -> echo ''."\n";
echo $after_widget;
}
}
/**
* @desc Output of pluginīs editform in te adminarea
* @author KeViN
*/
function widget_nextgenrecentimage_control($number=1) {
$options = get_option('widget_NextGenrecentimage');
if ( !is_array($options) )
$options = array('title'=>'Recent Images', 'buttontext'=>__('NextGEN Recent Image','nggallery'));
if ( $_POST['nextgen-recentsubmit'] ) {
// Remember to sanitize and format use input appropriately.
$options = "";
$options['title'] = strip_tags(stripslashes($_POST['nextgen-recenttitle']));
$options['thumb'] = strip_tags(stripslashes($_POST['nextgen-recentthumb']));
$options['number'] = strip_tags(stripslashes($_POST['nextgen-recentnumber']));
$options['sizeX'] = strip_tags(stripslashes($_POST['nextgen-recentsizeX']));
$options['sizeY'] = strip_tags(stripslashes($_POST['nextgen-recentsizeY']));
// [0.80] [new functiions and newvariables] -> Category controll
$options['showinhome'] = strip_tags(stripslashes($_POST['nextgen-recentshowinhome']));
$options['showcategory']= strip_tags(stripslashes($_POST['nextgen-recentshowcategory']));
$options['categorylist']= strip_tags(stripslashes($_POST['nextgen-recentcategorylist']));
// [0.95] [new variable] -> (random / recent)
$options['imgtype'] = strip_tags(stripslashes($_POST['nextgen-recentimgtype']));
update_option('widget_NextGenrecentimage', $options);
}
// Be sure you format your options to be valid HTML attributes.
$title = htmlspecialchars($options['title'], ENT_QUOTES);
$thumb = htmlspecialchars($options['thumb'], ENT_QUOTES);
$number = htmlspecialchars($options['number'], ENT_QUOTES);
$sizeX = htmlspecialchars($options['sizeX'], ENT_QUOTES);
$sizeY = htmlspecialchars($options['sizeY'], ENT_QUOTES);
$mode = htmlspecialchars($options['mode'], ENT_QUOTES);
// [0.80] [new functiions and newvariables] -> Category controll
$showinhome = htmlspecialchars($options['showinhome'], ENT_QUOTES);
$showcategory = htmlspecialchars($options['showcategory'], ENT_QUOTES);
$categorylist = htmlspecialchars($options['categorylist'], ENT_QUOTES);
// [0.95] [new variable] -> (random / recent)
$mode = htmlspecialchars($options['imgtype'], ENT_QUOTES);
// Here comes the form
echo'';
// [0.95] [new function] -> Thumbnail or Normal Image?
echo '';
echo '';
echo '';
echo '';
echo '';
// [0.80] [new variables] -> category control
echo '';
echo '';
echo '';
echo '';
}
// This registers our widget so it appears with the other available
// widgets and can be dragged and dropped into any active sidebars.
register_sidebar_widget(array('NextGEN Recent Image', 'widgets'), 'widget_nextgenrecentimage');
register_widget_control(array('NextGEN Recent Image', 'widgets'), 'widget_nextgenrecentimage_control', 300, 400);
}
/* */
/**********************************************************/
/* Random widget
/**********************************************************/
function widget_ngg_randomimage() {
// 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;
// This is the function that outputs our little widget...
function widget_nextgenimage($args) {
// $args is an array of strings that help widgets to conform to
// the active theme: before_widget, before_title, after_widget,
// and after_title are the array keys.
extract($args);
// Each widget can store its own options. We keep strings here.
$options = get_option('widget_NextGenimage');
$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);
// [0.95] -> [add function -> imagetype (imgtype) -> random or recent
$imgtype = "random"; //$options['imgtype'];
//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);
$show_widget = false; // checking display status (category or home)
$categorieslist = getCSVValues($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".'