'; $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 ( !class_exists('nggallery') ) return; global $wpdb; //get ngg options $ngg_options = get_option('ngg_options'); // get the effect code $thumbcode = nggallery::get_thumbcode("sidebar_".$imgtype); $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE exclude != 1 "); if ($count < $number) $number = $count; if ($imgtype == "random") $imageList = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures WHERE exclude != 1 ORDER by rand() limit $number"); else $imageList = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures WHERE exclude != 1 ORDER by pid DESC limit 0,$number"); if (is_array($imageList)){ foreach($imageList as $image) { //TODO:Insert title $out = ''; $addmode = ($mode == 'web20') ? "&mode=web20" : "" ; if ( $thumb == "false" ) $out .= ''.$image->alttext.''; else $out .= ''.$image->alttext.''; echo $out . ''."\n"; } } } /**********************************************************/ /* SIMPLE INSERT TAGS /**********************************************************/ function nggDisplayRandomImages($number,$width,$height) { echo "\n".'
'."\n"; nggDisplayImagesWidget("true",$number,$width,$height,"","random"); echo '
'."\n"; } function nggDisplayRecentImages($number,$width,$height) { echo "\n".'
'."\n"; nggDisplayImagesWidget("true",$number,$width,$height,"","recent"); echo '
'."\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 ( !class_exists('nggallery') ) 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".'
'."\n"; nggDisplayImagesWidget($thumb,$number,$sizeX,$sizeY,$mode,$imgtype); echo '
'."\n"; echo $after_widget; } } /** * @desc Output of pluginīs editform in the 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'

'; echo '

'; echo '

'; echo '

'; echo '

'; echo '

'; 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 ( !class_exists('nggallery') ) return; function widget_nextgenimage($args) { 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); $imgtype = "random"; //origy ngg options $ngg_options = get_option('ngg_options'); // get the effect code $thumbcode = nggallery::get_thumbcode("sidebar"); $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".'
'."\n"; nggDisplayImagesWidget($thumb,$number,$sizeX,$sizeY,$mode,$imgtype,$thumbcode); echo '
'."\n"; echo $after_widget; } } /** * @desc Output of pluginīs editform in the adminarea * @author KeViN */ function widget_nextgenimage_control($number=1) { $options = get_option('widget_NextGenimage'); if ( !is_array($options) ) $options = array('title'=>'', 'buttontext'=>__('NextGEN Random Image','nggallery')); if ( $_POST['nextgen-submit'] ) { // Remember to sanitize and format use input appropriately. $options = ""; $options['title'] = strip_tags(stripslashes($_POST['nextgen-title'])); $options['thumb'] = strip_tags(stripslashes($_POST['nextgen-thumb'])); $options['number'] = strip_tags(stripslashes($_POST['nextgen-number'])); $options['sizeX'] = strip_tags(stripslashes($_POST['nextgen-sizeX'])); $options['sizeY'] = strip_tags(stripslashes($_POST['nextgen-sizeY'])); $options['mode'] = strip_tags(stripslashes($_POST['nextgen-mode'])); // [0.80] [new functiions and newvariables] -> Category controll $options['showinhome'] = strip_tags(stripslashes($_POST['nextgen-showinhome'])); $options['showcategory']= strip_tags(stripslashes($_POST['nextgen-showcategory'])); $options['categorylist']= strip_tags(stripslashes($_POST['nextgen-categorylist'])); // [0.95] [new variable] -> (random / recent) $options['imgtype'] = strip_tags(stripslashes($_POST['nextgen-imgtype'])); update_option('widget_NextGenimage', $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); $showinhome = htmlspecialchars($options['showinhome'], ENT_QUOTES); $showcategory = htmlspecialchars($options['showcategory'], ENT_QUOTES); $categorylist = htmlspecialchars($options['categorylist'], ENT_QUOTES); $mode = htmlspecialchars($options['imgtype'], ENT_QUOTES); // Here comes the form echo'

'; echo '

'; echo '

'; echo '

'; echo '

'; echo '

'; 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 Random Image', 'widgets'), 'widget_nextgenimage'); register_widget_control(array('NextGEN Random Image', 'widgets'), 'widget_nextgenimage_control', 300, 400); } // Run our code later in case this loads prior to any required plugins. add_action('widgets_init', 'widget_ngg_randomimage'); add_action('widgets_init', 'widget_ngg_slideshow'); add_action('widgets_init', 'widget_ngg_recentimage'); ?>