This plugin feeds Jabber server pubsub nodes when new posts are published on Wordpress and comments are added.
jabber_feed_get ($node = 'posts', $what = 'url', $text = '') will return a string being a url (bare, or in a 'a' or 'link' tag).
jabber_feed_display ($node = 'posts', $what = 'url', $text = '') is the same as the previous template but display the string instead of returning it!
These template functions can be used in your theme.
Note that if your theme uses the 'wp_head' function in its header (most cases), a autodiscovery link on the post node will be automatically generated in the header. Otherwise, you can add it by yourself with these functions for instance.
PHP must be built with the option
--enable-sockets on PHP 4 >= 4.0.7 or PHP 5 (though I haven't tried with such a version, with PHP 5.3.0 and more, this extension is moved to the PECL repository!). If you have an error relating to socket, this is most likely a dependency issue.
Note for gentoo users: you must set the 'sockets' USE flag.
It uses the library 'expat' to parse XML (enabled with the
option of the php compilation).
Note for gentoo users: you must set the 'xml' USE flag.
It uses the
Auth_SASL PEAR module (
pear install Auth_SASL or install with your distribution's package manager) for SASL authentication. For now, this dependency is mandatory because this is the only supported authentication mechanism. Maybe in some future will it become optional.
OPTIONAL: to have the option of sending formated notification in XHTML, the "tidy" PECL extension must be installed.
It is based on the libtidy library which must first be installed: http://tidy.sourceforge.net/
Then with PHP 4.3.X or PHP 5, you can install it as a PECL module:
pecl install tidy; or with the
--with-tidy compilation option in PHP 5.
Without this, you won't have access to the XHTML option and all notifications will be sent as a normal textual message.
OPTIONAL: if the plugin is installed on a BSD (Mac included), in order to use the SRV records on the admin JID, which is the correct way of resolving the server and port addresses for a domain, the PEAR extension NET_DNS must be installed: 'pear install NET_DNS' (Note that it will ask to have php compiled with 'mhash' option). If it is installed on Windows, it is not anymore mandatory if you have PHP 5.3.0 or later installed (under this version of PHP, you should also install this extension to benefit SRV records). Linux servers do not need this extension to have SRV. Note for gentoo users: you must set the 'mhash' USE flag.
This script has been tested only currently on WordPress 2.0 up to WordPress 2.9.1 with PHP 5.2.1 to 5.2.11, running on a GNU/Linux 64 bits (Gentoo Linux). Hopefully it should work with other software versions (not for PHP4, because of the TLS feature with is PHP5 specific. Yet if you are really interested into PHP4 compatibility and if TLS is not required for your connection, just ask me, I will try to make a compatibility layer), but I cannot guarantee. Tell me please if you tried this successfully with another configuration so that I update the known working platforms list.
At the opposite, if you find a bug or encounter an issue on some configuration, don't hesitate to tell me, and I will try and fix it.
jabber_feed_get and `jabber_feed_display` have the same parameters, but the
first returns the link whereas the latter displays it:
jabber_feed_get ($node = 'posts', $what = 'url', $text = '')
jabber_feed_display ($node = 'posts', $what = 'url', $text = '')
So for instance, if the pubsub server is 'pubsub.jabber.org' and the node is 'blog':
jabber_feed_display ('posts', 'bare') displays simply:
which is a bare url of the node containing all the posts.
jabber_feed_get ('comments', 'a', 'All the comments') will return:
<a rel='alternate' href='xmpp:pubsub.jabber.org?action=subscribe;node=blog/comments;subscription_type=items;subscription_depth=1'>All the comments</a>
which is a link for all comments.
jabber_feed_display (5, 'link') will display:
<link rel='alternate' href='xmpp:pubsub.jabber.org?action=subscribe;node=blog/comments/5' />
which is an autodiscovery link for the comments of post 5.