User:Freakerz/Codex

From Habari Project

Jump to: navigation, search

Contents

How to use this information

If you do not know how Habari provides content to themes, please read about template tags first.

Posts Object

Properties

get_param_cache

Array of parameters used to fetch the last Posts object.

Retrieving

get($paramarray = array())

by_status($status)

by_slug($slug = '')

Counting

count_total($status)

count_all()

count_by_author($user_id = '', $status)

count_by_tag($tag = '', $status)

Traversing

ascend()

descend()

Post Object

Properties

author

User object containing several informations on the Post object's author.

cached_content

We do not use this property yet, for cache please refer to the Cache class.

comments

Comments object containing comments for the Post object.

comment_count

Number of comments for the Post object.

comment_feed_link

URI to the Atom feed for the Post object.

editlink

URI to edit the Post object.

guid

Unique identifier with the format: tag:<hostname>,<yyyy>:<slug>/<time>.

id

Identification number of the Post object.

info

InfoObject Object for the Post object.

modified

HabariDateTime object of the time the Post object was last modified.
This field is updated only if the `minor edit` checkbox is unchecked in the publish form.
Also note that feeds are sorted using this property.

permalink

URI to view the Post object.

pubdate

HabariDateTime object of the time the Post object was published.

slug

Slugified title, all non-alphanumerical characters are replaced by a hyphen-minus (-). e.g: "Bienvenue à Québec" becomes "bienvenue-qu-bec"

statusname, status

Status as its textual representation (statusname) or integer value (status).

tags

Array where the keys are slugs and values their textual representation. e.g: Array( [foo-bar] => Foo Bar )

title

Textual representation of the Post's title.

typename, content_type

Type as its textual representation (typename) or integer value (content_type).

updated

HabariDateTime object of the time the Post object was last updated.
This field is updated anytime you edit a post.

Extending

Tags Object

Retrieving

get()

get_one($tag)

get_by_text($tag)

get_by_slug($slug)

get_by_id($tag)

Counting

max_count()

post_count($tag)

Tag Object

Properties

id

Identification number of the Tag object.

tag_slug

Slugified tag, all non-alphanumerical characters are replaced by a hyphen-minus (-). e.g: "Habari Project" becomes "habari-project"

tag_text

Textual representation of the Tag's title.

Comments Object

Properties

approved

Comments object containing approved comments from the source Comments object.

comments

Comments object containing comments from the source Comments object.

count

Number of comments contained by the Comments object.

moderated

Comments object containing moderated comments from the source Comments object.

pingbacks

Comments object containing pingbacks from the source Comments object.

trackbacks

Comments object containing trackbacks from the source Comments object.

unapproved

Comments object containing unapproved comments from the source Comments object.

Retrieving

get($paramarray = array())

by_email($email = '')

by_name($name = '')

by_ip($ip = '')

by_url($url = '')

by_post_id($post_id)

by_slug($slug = '')

by_status($status = 0)

only($what = 'approved')

Counting

count_total($status = Comment::STATUS_APPROVED, $type = Comment::COMMENT)

count_by_name($name = '', $status = Comment::STATUS_APPROVED)

count_by_email($email = '', $status = Comment::STATUS_APPROVED)

count_by_url($url = '', $status = Comment::STATUS_APPROVED)

count_by_ip($ip = '', $status = Comment::STATUS_APPROVED)

count_by_slug($slug = '', $status = Comment::STATUS_APPROVED)

count_by_id($id= 0, $status = Comment::STATUS_APPROVED)

Comment Object

Properties

content

Text of the comment.

date

HabariDateTime object of the time the Comment object was last submitted.

email

E-mail address of the comment author.

id

Identification number of the Comment object.

info

InfoObject Object for the Post object.

ip

IP of the comment author.

name

Name of the comment author.

post_id

Identification number of the Post object this comment is attached to.

post

Post object this comment is attached to.

statusname, status

Status as its textual representation (statusname) or integer value (status).

typename, type

Type as its textual representation (typename) or integer value (type).

url

URI to the comment author's website.

Extending

Users Object

Properties

get_param_cache

Array of parameters used to fetch the last Posts object.

Retrieving

get($paramarray = array())

Fetches user(s) based on the supplied parameters.
where
id
info
count
limit
nolimit
orderby

get_by_info($key, $value = null)

Fetches a user from the database by a userinfo. e.g: displayname

get_all()

Fetches all users from the database.

User Object

Properties

displayname

Display name of the user.

email

E-mail address of the user.

id

Identification number of the user.

info

InfoObject Object for the User object.

groups

Array of group ids to which the user belongs to.

password

Password of the user.

username

Username of the user.

InfoObject Object

The InfoObject class implements the InfoRecords interface which lets plugins store extra informations assigned to Habari's assets. e.g: posts, comments, users, etc.

Retrieving

Comments, Posts and Users have each an InfoObject assigned. It is automatically fetched when you retrieve its assigned Comment, Post or User.

Accessing data from this InfoObject is as easy as fetching an object property:

$user->info->displayname

HabariDateTime

Formatting

With the HabariDateTime object, you can either get() or out() the date. Each support the same format strings as PHP's date() function.

// March 10, 2001, 5:16 pm
$post->pubdate->out('F j, Y, g:i a');

// Monday 8th of August 2005 03:12:46 PM
echo $comment->date->get('l jS \of F Y h:i:s A');
Personal tools