'Displays an Airliners.net picture (Random, Top Of Yesterday, or specific picture by ID) using official Airliners.net script')); } /** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $imgtype = esc_attr($instance['imgtype']); $imgid = esc_attr($instance['imgid']); echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } echo $this->render($imgtype, $imgid); echo $after_widget; } /* Render the content, used by widget and shortcode methods */ public static function render($imgtype, $imgid) { $text = ""; if ($imgtype=='random') { $text = ""; } if ($imgtype=='yesterday') { $text = ""; } if ($imgtype=='picture') { $text = ""; } return $text; } /** @see WP_Widget::update */ function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['imgtype'] = strip_tags($new_instance['imgtype']); $instance['imgid'] = strip_tags($new_instance['imgid']); return $instance; } /** @see WP_Widget::form */ function form($instance) { $title = ''; $imgtype = 'random'; $imgid = '1'; if (isset($instance['title'])) { $title = esc_attr($instance['title']); } if (isset($instance['imgtype'])) { $imgtype = esc_attr($instance['imgtype']); } if (isset($instance['imgid'])) { $imgid = esc_attr($instance['imgid']); } ?>

'random', 'imgid' => '1' ), $atts ); $text = "
".airliners_widget_Widget::render($attributes['imgtype'], $attributes['imgid'])."
"; return $text; } /* Initialization Handler */ function airliners_widget_init() { register_widget( 'airliners_widget_Widget' ); wp_enqueue_style( 'airliners_widget_Widget', plugin_dir_url( __FILE__ ).'airliners-widget.css'); } // register Widget add_action('widgets_init', 'airliners_widget_init'); // register ShortCode add_shortcode( 'airliners', 'airliners_widget_shortcode' );