'jabber_feed_widget', 'description' => 'Widget displaying the Jabber feed subscription links.' );
/* Widget control settings. */
/*$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-jabber-feed_widget' ); */
/* Create the widget. */
parent::__construct ('jabber-feed_widget', 'Jabber Feed Widget', $widget_ops); //, $control_ops );
} // }}}
function jabber_feed_widget ()
{
$this->__construct ();
register_shutdown_function (array (&$this, "__destruct"));
}
function __destruct () // {{{
{
} // }}}
// This function deals with the actual display.
function widget ($args, $instance) // {{{
{
extract ($args);
$title = apply_filters('widget_title', $instance['title'] );
echo $before_widget;
if ($title)
echo $before_title . $title . $after_title;
$configuration = get_option ('jabber_feed_configuration');
echo '
';
if (!empty ($configuration['publish_posts']))
{
$post_text = $instance['post_text'];
echo '- ';
jabber_feed_display ($node = 'posts', $what = 'a', $text = $post_text);
echo '
';
}
if (!empty ($configuration['publish_comments']))
{
$comment_text = $instance['comment_text'];
echo '- ';
jabber_feed_display ($node = 'comments', $what = 'a', $text = $comment_text);
echo '
';
if (is_single ())
{
if (comments_open ($id) || count (get_approved_comments ($id) > 0))
{
$current_text = $instance['current_text'];
$id = get_the_ID ();
$current_post = get_post ($id);
$post_title = $current_post->post_title;
$current_text = strip_tags (str_ireplace ('[title]', $post_title, $current_text));
echo '- ';
jabber_feed_display ($node = 'current', $what = 'a', $text = $current_text);
echo '
';
}
}
}
echo '
';
echo $after_widget;
} // }}}
function update ($new_instance, $old_instance) // {{{
{
$instance = $old_instance;
$instance['title'] = strip_tags ($new_instance['title']);
$instance['post_text'] = strip_tags ($new_instance['post_text']);
$instance['comment_text'] = strip_tags ($new_instance['comment_text']);
$instance['current_text'] = strip_tags ($new_instance['current_text']);
return $instance;
} // }}}
function form ($instance) // {{{
{
$configuration = get_option ('jabber_feed_configuration');
$defaults = array ('title' => 'Jabber feeds', 'post_text' => 'Entries (XMPP feed)',
'comment_text' => 'Comments (XMPP feed)',
'current_text' => "Comments of \"[title]\" (XMPP feed)");
$instance = wp_parse_args ((array) $instance, $defaults); ?>
' style="width:100%;" />
' style="width:100%;" />
' style="width:100%;" />
' style="width:100%;" />