C_Widget_Slideshow

The NextGEN Gallery C Widget Slideshow class.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/widget/package.module.widget.php  
  1. class C_Widget_Slideshow extends WP_Widget 
  2. function __construct() 
  3. $widget_ops = array('classname' => 'widget_slideshow', 'description' => __('Show a NextGEN Gallery Slideshow', 'nggallery')); 
  4. parent::__construct('slideshow', __('NextGEN Slideshow', 'nggallery'), $widget_ops); 
  5. function form($instance) 
  6. global $wpdb; 
  7. // used for rendering utilities 
  8. $parent = C_Widget::get_instance(); 
  9. // defaults 
  10. $instance = wp_parse_args((array) $instance, array('galleryid' => '0', 'height' => '120', 'title' => 'Slideshow', 'width' => '160', 'limit' => '10')); 
  11. $parent->render_partial('photocrati-widget#form_slideshow', array('self' => $this, 'instance' => $instance, 'title' => esc_attr($instance['title']), 'height' => esc_attr($instance['height']), 'width' => esc_attr($instance['width']), 'limit' => esc_attr($instance['limit']), 'tables' => $wpdb->get_results("SELECT * FROM {$wpdb->nggallery} ORDER BY 'name' ASC"))); 
  12. function update($new_instance, $old_instance) 
  13. $nh = $new_instance['height']; 
  14. $nw = $new_instance['width']; 
  15. if (empty($nh) || (int) $nh === 0) { 
  16. $new_instance['height'] = 120; 
  17. if (empty($nw) || (int) $nw === 0) { 
  18. $new_instance['width'] = 160; 
  19. if (empty($new_instance['limit'])) { 
  20. $new_instance['limit'] = 10; 
  21. $instance = $old_instance; 
  22. $instance['title'] = strip_tags($new_instance['title']); 
  23. $instance['galleryid'] = (int) $new_instance['galleryid']; 
  24. $instance['height'] = (int) $new_instance['height']; 
  25. $instance['width'] = (int) $new_instance['width']; 
  26. $instance['limit'] = (int) $new_instance['limit']; 
  27. return $instance; 
  28. function widget($args, $instance) 
  29. $router = C_Router::get_instance(); 
  30. wp_enqueue_style('nextgen_widgets_style', $router->get_static_url('photocrati-widget#widgets.css'), FALSE, NGG_SCRIPT_VERSION); 
  31. wp_enqueue_style('nextgen_basic_slideshow_style', $router->get_static_url('photocrati-nextgen_basic_gallery#slideshow/nextgen_basic_slideshow.css'), FALSE, NGG_SCRIPT_VERSION); 
  32. // these are handled by extract() but I want to silence my IDE warnings that these vars don't exist 
  33. $before_widget = NULL; 
  34. $before_title = NULL; 
  35. $after_widget = NULL; 
  36. $after_title = NULL; 
  37. $widget_id = NULL; 
  38. extract($args); 
  39. $parent = C_Component_Registry::get_instance()->get_utility('I_Widget'); 
  40. $title = apply_filters('widget_title', empty($instance['title']) ? __('Slideshow', 'nggallery') : $instance['title'], $instance, $this->id_base); 
  41. if (empty($instance['limit'])) { 
  42. $instance['limit'] = 10; 
  43. $out = $this->render_slideshow($instance['galleryid'], $instance['width'], $instance['height'], $instance['limit'], $args); 
  44. $parent->render_partial('photocrati-widget#display_slideshow', array('self' => $this, 'instance' => $instance, 'title' => $title, 'out' => $out, 'before_widget' => $before_widget, 'before_title' => $before_title, 'after_widget' => $after_widget, 'after_title' => $after_title, 'widget_id' => $widget_id)); 
  45. function render_slideshow($galleryID, $irWidth = '', $irHeight = '', $limit = 10, $args) 
  46. $registry = C_Component_Registry::get_instance(); 
  47. $renderer = C_Displayed_Gallery_Renderer::get_instance(); 
  48. $params = array('container_ids' => $galleryID, 'display_type' => 'photocrati-nextgen_basic_slideshow', 'gallery_width' => $irWidth, 'gallery_height' => $irHeight, 'source' => 'galleries', 'slug' => 'widget-' . $args['widget_id'], 'entity_types' => array('image'), 'show_thumbnail_link' => FALSE, 'show_slideshow_link' => FALSE, 'use_imagebrowser_effect' => FALSE, 'ngg_triggers_display' => 'never'); 
  49. if (0 === $galleryID) { 
  50. $params['source'] = 'random_images'; 
  51. $params['maximum_entity_count'] = $limit; 
  52. unset($params['container_ids']); 
  53. $retval = $renderer->display_images($params, NULL); 
  54. $retval = apply_filters('ngg_show_slideshow_widget_content', $retval, $galleryID, $irWidth, $irHeight); 
  55. return $retval;