<?php if (function_exists('snap_my_roll')){snap_my_roll();} ?>. Version: 0.5 Author: Denis Balencourt Author URI: http://www.balencourt.com/blog/snap-my-roll */ function snap_my_roll($title,$size){ global $wpdb; $js_url = get_option('siteurl') . '/wp-content/plugins/snap-my-roll/' . 'js/'; //store links in an array $my_query = "SELECT link_name, link_url FROM wp_links WHERE link_visible = 'Y'"; $links = $wpdb->get_results($my_query, OBJECT); //rand the the array and build the javascript shuffle($links); echo "
  • \n\t

    ".$title."

    \n"; echo ''."\n"; echo ''."\n"; echo '\n"; //lets print the list of images echo '\n
  • "; } function widget_snap_my_roll_init() { if (!function_exists('register_sidebar_widget')) { return; } function widget_snap_my_roll($args) { extract($args); echo $before_widget . $before_title . $after_title; if(!$options = get_option('snap_my_roll')) $options = array('title'=>'Snap My Roll', 'size'=>'s'); snap_my_roll($options['title'], $options['size']); echo $after_widget; } function widget_snap_my_roll_options() { if(!$options = get_option('snap_my_roll')) $options = array('title'=>'Snap My Roll', 'size'=>'s'); if($_POST['snap_my_roll-submit']) { $options = array('title' => $_POST['snap_my_roll-title'], 'size' => $_POST['snap_my_roll-size']); update_option('snap_my_roll', $options); } echo '

    Widget Title:

    '; echo '

    Select a snapshot size
    '; echo ' Small [202x152 pixels]
    '; echo ' Medium [400x300 pixels]

    '; echo ''; } register_sidebar_widget('Snap My Roll','widget_snap_my_roll'); register_widget_control('Snap My Roll','widget_snap_my_roll_options', 200, 200); } add_action('plugins_loaded', 'widget_snap_my_roll_init'); ?>