'widget_slideshow', 'description' => __( 'Show a NextGEN Gallery Slideshow', 'nggallery') ); $this->WP_Widget('slideshow', __('NextGEN Slideshow', 'nggallery'), $widget_ops); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', empty( $instance['title'] ) ? __('Slideshow', 'nggallery') : $instance['title'], $instance, $this->id_base); $out = $this->render_slideshow($instance['galleryid'] , $instance['width'] , $instance['height']); if ( !empty( $out ) ) { echo $before_widget; if ( $title) echo $before_title . $title . $after_title; ?>
classname = 'ngg-widget-slideshow'; $swfobject->message = __('Get the Flash Player to see the slideshow.', 'nggallery'); $swfobject->add_params('wmode', 'opaque'); $swfobject->add_params('bgcolor', $ngg_options['irScreencolor'], 'FFFFFF', 'string', '#'); $swfobject->add_attributes('styleclass', 'slideshow-widget'); // adding the flash parameter $swfobject->add_flashvars( 'file', urlencode( trailingslashit( home_url() ) . 'index.php?callback=imagerotator&gid=' . $galleryID ) ); $swfobject->add_flashvars( 'shownavigation', 'false', 'true', 'bool'); $swfobject->add_flashvars( 'shuffle', $ngg_options['irShuffle'], 'true', 'bool'); $swfobject->add_flashvars( 'showicons', $ngg_options['irShowicons'], 'true', 'bool'); $swfobject->add_flashvars( 'overstretch', $ngg_options['irOverstretch'], 'false', 'string'); $swfobject->add_flashvars( 'rotatetime', $ngg_options['irRotatetime'], 5, 'int'); $swfobject->add_flashvars( 'transition', $ngg_options['irTransition'], 'random', 'string'); $swfobject->add_flashvars( 'backcolor', $ngg_options['irBackcolor'], 'FFFFFF', 'string', '0x'); $swfobject->add_flashvars( 'frontcolor', $ngg_options['irFrontcolor'], '000000', 'string', '0x'); $swfobject->add_flashvars( 'lightcolor', $ngg_options['irLightcolor'], '000000', 'string', '0x'); $swfobject->add_flashvars( 'screencolor', $ngg_options['irScreencolor'], '000000', 'string', '0x'); $swfobject->add_flashvars( 'width', $irWidth, '260'); $swfobject->add_flashvars( 'height', $irHeight, '320'); // create the output $out = $swfobject->output(); // add now the script code $out .= "\n".''; $out = apply_filters('ngg_show_slideshow_widget_content', $out, $galleryID, $irWidth, $irHeight); return $out; } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['galleryid'] = (int) $new_instance['galleryid']; $instance['height'] = (int) $new_instance['height']; $instance['width'] = (int) $new_instance['width']; return $instance; } function form( $instance ) { global $wpdb; //Defaults $instance = wp_parse_args( (array) $instance, array( 'title' => 'Slideshow', 'galleryid' => '0', 'height' => '120', 'width' => '160') ); $title = esc_attr( $instance['title'] ); $height = esc_attr( $instance['height'] ); $width = esc_attr( $instance['width'] ); $tables = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY 'name' ASC "); ?>
'ngg_images', 'description' => __( 'Add recent or random images from the galleries', 'nggallery') ); $this->WP_Widget('ngg-images', __('NextGEN Widget', 'nggallery'), $widget_ops); } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['items'] = (int) $new_instance['items']; $instance['type'] = $new_instance['type']; $instance['show'] = $new_instance['show']; $instance['width'] = (int) $new_instance['width']; $instance['height'] = (int) $new_instance['height']; $instance['exclude'] = $new_instance['exclude']; $instance['list'] = $new_instance['list']; $instance['webslice']= (bool) $new_instance['webslice']; return $instance; } function form( $instance ) { //Defaults $instance = wp_parse_args( (array) $instance, array( 'title' => 'Gallery', 'items' => '4', 'type' => 'random', 'show' => 'thumbnail', 'height' => '50', 'width' => '75', 'exclude' => 'all', 'list' => '', 'webslice' => true ) ); $title = esc_attr( $instance['title'] ); $items = intval ( $instance['items'] ); $height = esc_attr( $instance['height'] ); $width = esc_attr( $instance['width'] ); ?>
x
(px)
id_base); global $wpdb; $items = $instance['items']; $exclude = $instance['exclude']; $list = $instance['list']; $webslice = $instance['webslice']; $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE exclude != 1 "); if ($count < $instance['items']) $instance['items'] = $count; $exclude_list = ''; // THX to Kay Germer for the idea & addon code if ( (!empty($list)) && ($exclude != 'all') ) { $list = explode(',',$list); // Prepare for SQL $list = "'" . implode("', '", $list ) . "'"; if ($exclude == 'denied') $exclude_list = "AND NOT (t.gid IN ($list))"; if ($exclude == 'allow') $exclude_list = "AND t.gid IN ($list)"; // Limit the output to the current author, can be used on author template pages if ($exclude == 'user_id' ) $exclude_list = "AND t.author IN ($list)"; } if ( $instance['type'] == 'random' ) $imageList = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 $exclude_list ORDER by rand() limit {$items}"); else $imageList = $wpdb->get_results("SELECT t.*, tt.* FROM $wpdb->nggallery AS t INNER JOIN $wpdb->nggpictures AS tt ON t.gid = tt.galleryid WHERE tt.exclude != 1 $exclude_list ORDER by pid DESC limit 0,$items"); // IE8 webslice support if needed if ( $webslice ) { $before_widget .= "\n" . '