classname = 'ngg-widget-slideshow'; $swfobject->message = __('Get the Flash Player to see the slideshow.', 'nggallery'); $swfobject->add_params('wmode', 'opaque'); // adding the flash parameter $swfobject->add_flashvars( 'file', NGGALLERY_URLPATH . 'nggextractXML.php?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".''; echo $out; } /**********************************************************/ /* 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 ( !class_exists('nggallery') ) 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; 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); } add_action('widgets_init', 'widget_ngg_slideshow'); /** * nggWidget - The widget control for NextGEN Gallery ( require WP2.2 or hiogher) * * @package NextGEN Gallery * @author Alex Rabe * @copyright 2008 * @version 1.00 * @access public */ class nggWidget { function nggWidget() { // Run our code later in case this loads prior to any required plugins. add_action('widgets_init', array(&$this, 'ngg_widget_register')); } function ngg_widget_register() { if ( !class_exists('nggallery') ) return; // For K2 Sidebar manager we do different if(class_exists('K2SBM') && K2_USING_SBM ) { K2SBM::register_sidebar_module('NextGEN Gallery', 'ngg_sbm_widget_output', 'sb-ngg-widget'); K2SBM::register_sidebar_module_control('NextGEN Gallery', 'ngg_sbm_widget_control'); } else { // test for widget plugin > 2.2 if ( !function_exists('wp_register_sidebar_widget') ) return; $options = get_option('ngg_widget'); $number = $options['number']; if ( $number < 1 ) $number = 1; if ( $number > 9 ) $number = 9; $dims = array('width' => 410, 'height' => 300); $class = array('classname' => 'ngg_widget'); for ($i = 1; $i <= 9; $i++) { $name = sprintf(__('NextGEN Gallery %d','nggallery'), $i); $id = "ngg-widget-$i"; // Never never never translate an id wp_register_sidebar_widget($id, $name, $i <= $number ? array(&$this, 'ngg_widget_output') : /* unregister */ '', $class, $i); wp_register_widget_control($id, $name, $i <= $number ? array(&$this, 'ngg_widget_control') : /* unregister */ '', $dims, $i); } add_action('sidebar_admin_setup', array(&$this, 'ngg_widget_admin_setup')); add_action('sidebar_admin_page', array(&$this, 'ngg_widget_admin_page')); } } function ngg_widget_admin_page() { $options = get_option('ngg_widget'); ?>