, http://wp.leau.co * @copyright GPL 2 */ namespace leau\co\amberalert_client; if (!class_exists('\\leau\co\ambertalert_client\\amber_alert_widget')) { /** * Widget: Show amber alert icons * @since 0.0.1 * @author Edward de Leau , {@link http://wp.leau.co} */ class amber_alert_widget extends \WP_Widget { /** * Constructor */ function __construct() { $widget_ops = array('classname' => 'amber_alert_widget', 'description' => __('Toont de Amber Alert button. Daarnaast volgt een paar keer per jaar een popup.')); $control_ops = array('width' => 200, 'height' => 350); parent::__construct('amber_alert_widget', __('Amber Alert Button'), $widget_ops, $control_ops); } /** * (non-PHPdoc) * @see WP_Widget::widget() */ function widget($args, $instance) { extract( $args ); echo $before_widget; $title = apply_filters( 'widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } $size = empty($instance['size']) ? 16 : $instance['size']; $instance['text'] = $this->specificOutput($size); $text = apply_filters( 'widget_text', $instance['text'], $instance ); echo $text; echo $after_widget; } /** * (non-PHPdoc) * @see WP_Widget::update() */ function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = empty($new_instance['title']) ? 'Amber alert' : apply_filters('widget_title', $new_instance['title']); $instance['size'] = $new_instance['size']; return $instance; } /** * (non-PHPdoc) * @see WP_Widget::form() */ function form($instance) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'size' => '' ) ); $title = strip_tags($instance['title']); $size = esc_textarea($instance['size']); ?>

' . '
' . '
' . '' . '
'; /* generates this: $uri = 'http://www.amberalertnederland.nl/flashalert/'; $javascript = ''; echo '
'; echo ''; } } } add_action('widgets_init',function() { return register_widget('\leau\co\amberalert_client\amber_alert_widget'); });