Textpattern PHP Cross Reference Content Management Systems

Summary: /textpattern/lib/txplib_wrapper.php - 959 lines - 28820 bytes - Source - Print

Description: Textpattern Wrapper Class for Textpattern 4.0.x. Main goal for this class is to be used as a textpattern data wrapper by any code which needs to have access to the textpattern articles data, like XML-RPC, Atom, Moblogging or other external implementations.

Author: Pedro Palazón
Copyright: 2005-2008 The Textpattern Development Team - http://textpattern.com
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TXP_Wrapper:: (23 methods):
__construct()
deleteArticleID()
getArticleList()
getArticle()
getArticleID()
updateArticleID()
newArticle()
getSectionsList()
getSection()
getCategoryList()
getCategory()
getCategoryID()
getCategoryTitle()
getUser()
getTemplate()
setTemplate()
updateArticleField()
_setArticle()
_validate()
_sendPings()
_check_keys()
textile_main_fields()
format_field()

Class: TXP_Wrapper

Wrapper for Textpattern.

__construct($txp_user, $txpass = null)  line: 138
Constructor.

This is used to pass user credentials
to the wrapper.

param: string $txp_user The user login name
param: string $txpass   User password
deleteArticleID($article_id line: 158
Deletes an article with the given ID.

return: bool TRUE on success
param: int $article_id The article
getArticleList($what = '*', $where = '1', $offset = 0, $limit = 10, $slash = true)  line: 182
Retrieves a list of articles matching the given criteria.

This method forms an SQL query from the given arguments and returns an
array of resulting articles.

This method requires authentication and at least 'article.edit.own'
privileges. If the user doesn't have 'article.edit' privileges,
only the user's own articles can be accessed.

return: array|bool Array of artilces, or FALSE on failure
param: string $what   The select clause
param: string $where  The where clause
param: int    $offset The offset
param: int    $limit  The limit
param: bool   $slash  If TRUE, escapes $where and $what
getArticle($what = '*', $where = '1', $slash = true)  line: 231
Retrieves an article matching the given criteria.

This method forms an SQL query from the given arguments and returns an
article as an assocative array.

This method requires authentication and at least 'article.edit.own'
privileges. If the user doesn't have 'article.edit' privileges,
only the user's own articles can be accessed.

return: array|bool An article, or FALSE on failure
param: string $what  Select clause
param: string $where Where clause
param: bool   $slash If TRUE, escapes $where and $what
getArticleID($article_id, $what = '*')  line: 275
Gets an article with the given ID.

This method is an shortcut for TXP_Wrapper::getArticle().

return: array|bool The article, or FALSE on failure
param: int    $article_id The article
param: string $what       The SQL select clause
updateArticleID($article_id, $params line: 307
Updates an existing article.

This method takes an array of article fields, and updates an article with
the given ID. Supplied values are sanitised and prepared internally.

return: int|bool The article id, or FALSE on failure
param: int   $article_id The article
param: array $params     The article fields to update
newArticle($params line: 351
Creates a new article.

return: int|bool Article ID, or FALSE on failure
param: array $params The article fields
getSectionsList()  line: 380
Gets a list of sections as an assocative array.

This method requires authentication and 'article' privileges.

return: array|bool FALSE on failure
getSection($name line: 406
Gets a section as an assocative array.

This method requires authentication and 'article' privileges.

return: array|bool FALSE on failure
param: string $name The section name
getCategoryList()  line: 432
Gets a list of categories as an assocative array.

This method requires authentication and 'article' privileges.

return: array|bool FALSE on failure
getCategory($name line: 458
Gets a category as an assocative array.

This method requires authentication and 'article' privileges.

return: array|bool FALSE on failure
param: string $name The category name
getCategoryID($id line: 484
Gets a category as an assocative array by ID.

This method is an alternative to TXP_wrapper::getCategory().

This method requires authentication and 'article' privileges.

return: array|bool FALSE on failure
param: string $id The category ID
getCategoryTitle($title line: 506
Gets a category as an assocative array by title.

This method is an alternative to TXP_wrapper::getCategory().

This method requires authentication and 'article' privileges.

return: array|bool FALSE on failure
param: string $title The category title
getUser()  line: 528
Gets an array of information about the current user.

This method requires authentication. Resulting array contains all columns
from 'txp_users' database table.

return: array|bool FALSE on failure
getTemplate($name line: 552
Retrieves a page template contents with the given name.

This method requires authentication and 'page' privileges.

return: string|bool The template, or FALSE on failure
param: string $name The template
setTemplate($name, $html line: 572
Updates a page template with the given name.

This method requires authentication and 'page' privileges.

return: bool TRUE on success
param: string $name The template name
param: string $html The template contents
updateArticleField($article_id, $field, $value line: 600
Intended for updating an article's non-content fields, like categories,
sections or keywords.

This method requires authentication and 'article.edit' privileges.

return: bool TRUE on success
param: int    $article_id The article
param: string $field      The field to update
param: mixed  $value      The new value
_setArticle($incoming, $article_id = null)  line: 664
Creates and updates articles.

return: int|bool The article ID on success, or FALSE on failure
param: array $incoming   The article fields
param: int   $article_id The ID of the article to update
_validate($user, $password = null)  line: 814
Validates the given user credentials.

return: bool TRUE on success
param: string $user     The username
param: string $password The password
_sendPings()  line: 842
Pings Ping-O-Matic when an article is published.

This is duplicated code from txp_article.php.

_check_keys($incoming, $default = array()  line: 863
Validates and filters the given article fields.

Checks if the given parameters are appropriate for the article.

return: array Filtered data array
param: array $incoming The incoming associative array
param: array $default  An associative array containing default values for the desired keys
textile_main_fields($incoming, $use_textile = 1)  line: 901
Apply Textile to the main article fields.

This is duplicated from txp_article.php.

return: array The $incoming array formatted
param: array $incoming    The incoming fields
param: bool  $use_textile Use Textile or not
format_field($field, $format, $textile line: 933
Formats a article field according to the given options.

return: string HTML formatted field
param: string  $field  The field contents
param: int     $format Either LEAVE_TEXT_UNTOUCHED, CONVERT_LINEBREAKS, USE_TEXTILE
param: Textile An instance of Textile

title

Body