Search

RSS / Atom

Textpattern Links

TXP_Wrapper

# 31 05 2006 - 19:12 #

Admin tasks can not be achieved from this wrapper. To do them use Textpattern itself.

Main goal of this class is to keep API implementations focused on the task they undertake, without worry about how data should be formated before to be inserted or retrieved from the Textpattern DB, in function of User Preferences.

There are several possible usages for the class, for example, a future Atom Publishing protocol implementation. Anyway, I’m pretty sure you will have better ideas than me!

Class usage:

Create an instance of the class:

require_once txpath.'/lib/txplib_wrapper.php';
$txp = new TXP_Wrapper($username, $password);

As you can see, it’s a requirement to provide a valid username and password in order to instantiate the class. If you provide an
invalid user name or password, all the public class methods will return false.

Additionally, you can check if user is authorized using the code below:

if ($txp->loggedin)
{
//do process here
}

The class will try to call doSlash() for any incoming input, which is, by the way, a good practice for any Textpattern related development which relies on user supplied data.

Class Methods:

You can give a look at class methods in the code itself. It’s documented using PHP Documentor so, you should be able to extract the relevant info from class comments. (Those coments will remain on the class source, since it’s intended to be used mostly by developers).

All private methods names start with an underscore. Currently, you can call private methods too; but this will be prevented when we update Textpattern to PHP5 so, handle with care.

Anyway, you should avoid your application to rely on these methods since we can – and eventually will do – change the way these methods work on future releases of the class.