Item Item(
[object table
$db_row = NULL], [string
$dbtable = 'T_items__item'], [string
$dbprefix = 'post_'], [string
$dbIDname = 'post_ID'], [string
$objtype = 'Item'], [string
$datecreated_field = 'datecreated'], [string
$datemodified_field = 'datemodified'], [string
$creator_field = 'creator_user_ID'], [string
$lasteditor_field = 'lastedit_user_ID']
)
|
|
Constructor
Parameters:
|
object table |
$db_row: |
Database row |
|
string |
$dbtable: |
|
|
string |
$dbprefix: |
|
|
string |
$dbIDname: |
|
|
string |
$objtype: |
for derived classes |
|
string |
$datecreated_field: |
datetime field name |
|
string |
$datemodified_field: |
datetime field name |
|
string |
$creator_field: |
User ID field name |
|
string |
$lasteditor_field: |
User ID field name |
boolean add_renderer(
string
$renderer_code
)
|
|
Add a renderer (by code) to the Item.
Parameters:
|
string |
$renderer_code: |
Renderer code to add for this item |
API Tags:
| Return: | True if renderers have changed |
Template function: display anchor for permalinks to refer to.
void assigned_to(
[string
$before = ''], [string
$after = ''], [string
$format = 'htmlbody']
)
|
|
Template function: display assignee of item
Parameters:
void assign_to(
$user_ID, [
$dbupdate = true]
)
|
|
Parameters:
Information Tags:
| Todo: | use extended dbchange instead of set_param... |
| Todo: | Normalize to set_assigned_User!? |
void assign_to_first_cat_for_collection(
integer
$collection_ID
)
|
|
Assign the item to the first category we find in the requested collection
Parameters:
void author(
[
$params = array()]
)
|
|
Template function: display author/creator of item
Parameters:
boolean can_comment(
[string|NULL
$before_error = '<p><em>'], [string
$after_error = '</em></p>'], [string
$non_published_msg = '#'], [string
$closed_msg = '#']
)
|
|
Template function: Check if user can leave comment on this post or display error
Parameters:
|
string|NULL |
$before_error: |
string to display before any error message; NULL to not display anything, but just return boolean |
|
string |
$after_error: |
string to display after any error message |
|
string |
$non_published_msg: |
error message for non published posts, '#' for default |
|
string |
$closed_msg: |
error message for closed comments posts, '#' for default |
API Tags:
| Return: | true if user can post, false if s/he cannot |
Template function: Check if user can can rate this post
API Tags:
| Return: | true if user can post, false if s/he cannot |
boolen can_receive_pings(
)
|
|
Return true if trackbacks and pingbacks are allowed
boolean can_see_comments(
)
|
|
Check if user can see comments on this post, which he cannot if they are disabled for the Item or never allowed for the blog.
void content_extension(
$params
)
|
|
Display content teaser of item (will stop at "<!-- more -->"
Parameters:
void content_teaser(
$params
)
|
|
Display content teaser of item (will stop at "<!-- more -->"
Parameters:
void count_view(
[
$params = array()]
)
|
|
Increase view counter
Parameters:
Information Tags:
| Todo: | merge with inc_viewcount |
Display custom field
Parameters:
Trigger event AfterItemDelete after calling parent method.
API Tags:
Information Tags:
| Todo: | fp> delete related stuff: comments, cats, file links... |
Redefinition of:
- DataObject::dbdelete()
- Delete object from DB.
Insert object into DB based on previously recorded changes
API Tags:
Redefinition of:
- DataObject::dbinsert()
- Insert object into DB based on previously recorded changes.
boolean dbupdate(
[boolean
$auto_track_modification = true]
)
|
|
Update the DB based on previously recorded changes
Parameters:
|
boolean |
$auto_track_modification: |
do we want to auto track the mod date? |
API Tags:
Redefinition of:
- DataObject::dbupdate()
- Update the DB based on previously recorded changes
void deadline_date(
[string
$format = ''], [boolean
$useGM = false]
)
|
|
Template function: display deadline date (datetime) of Item
Parameters:
|
string |
$format: |
date/time format: leave empty to use locale default date format |
|
boolean |
$useGM: |
true if you want GMT |
void deadline_time(
[string
$format = ''], [boolean
$useGM = false]
)
|
|
Template function: display deadline time (datetime) of Item
Parameters:
|
string |
$format: |
date/time format: leave empty to use locale default time format |
|
boolean |
$useGM: |
true if you want GMT |
void delete_link(
[string
$before = ' '], [string
$after = ' '], [string
$text = '#'], [string
$title = '#'], [string
$class = ''], [boolean
$button = false], [string
$actionurl = '#']
)
|
|
Displays button for deleting the Item if user has proper rights
Parameters:
|
string |
$before: |
to display before link |
|
string |
$after: |
to display after link |
|
string |
$text: |
link text |
|
string |
$title: |
link title |
|
string |
$class: |
class name |
|
boolean |
$button: |
true to make this a button instead of a link |
|
string |
$actionurl: |
page url for the delete action |
void delete_prerendered_content(
)
|
|
Unset any prerendered content for this item (in PHP cache).
void deprecate_link(
[string
$before = ' '], [string
$after = ' '], [string
$text = '#'], [string
$title = '#'], [string
$class = ''], [string
$glue = '&']
)
|
|
Display link to deprecate a post if user has edit rights
Parameters:
|
string |
$before: |
to display before link |
|
string |
$after: |
to display after link |
|
string |
$text: |
link text |
|
string |
$title: |
link title |
|
string |
$class: |
class name |
|
string |
$glue: |
glue between url params |
void div_classes(
[
$params = array()]
)
|
|
Output classes for the Item <div>
Parameters:
void edit_link(
[
$params = array()]
)
|
|
Template tag
Parameters:
API Tags:
Display excerpt of item
Parameters:
void extra_status(
[string
$before = ''], [string
$after = ''], [string
$format = 'htmlbody']
)
|
|
Template function: display extra status of item
Parameters:
void feedback_feed_link(
[string
$skin = '_rss2'], [string
$before = ''], [string
$after = ''], [string
$title = '#']
)
|
|
Template function: Displays link to the feed for comments on this item
Parameters:
|
string |
$skin: |
Type of feedback to link to (rss2/atom) |
|
string |
$before: |
String to display before the link (if comments are to be displayed) |
|
string |
$after: |
String to display after the link (if comments are to be displayed) |
|
string |
$title: |
Link title |
void feedback_link(
array
$params
)
|
|
Template function: Displays link to feedback page (under some conditions)
Parameters:
void feedback_moderation(
[string
$type = 'feedbacks'], [string
$before = ''], [string
$after = ''], [string
$zero = ''], [string
$one = '#'], [string
$more = '#'], [string
$edit_comments_link = '#'], [boolean
$params = array()]
)
|
|
Template function: Displays feeback moderation info
Parameters:
|
string |
$type: |
Type of feedback to link to (feedbacks (all)/comments/trackbacks/pingbacks) |
|
string |
$before: |
String to display before the link (if comments are to be displayed) |
|
string |
$after: |
String to display after the link (if comments are to be displayed) |
|
string |
$zero: |
Link text to display when there are 0 comments |
|
string |
$one: |
Link text to display when there is 1 comment |
|
string |
$more: |
Link text to display when there are >1 comments (include %d for # of comments) |
|
string |
$edit_comments_link: |
Link |
|
boolean |
$params: |
true to hide if no feedback |
void files(
[array
$params = array()], [string
$format = 'htmlbody']
)
|
|
Display the attachments/files linked to the current Item
Parameters:
boolean footer(
array
$params
)
|
|
Template tag: display footer for the current Item.
Parameters:
API Tags:
| Return: | true if something has been displayed |
mixed get(
mixed
$parname
)
|
|
Get a member param by its name
Parameters:
|
mixed |
$parname: |
Name of parameter |
API Tags:
| Return: | Value of parameter |
Redefinition of:
- DataObject::get()
- Get a member param by its name
User|NULL get_assigned_User(
)
|
|
Get the User who is assigned to the Item.
API Tags:
| Return: | NULL if no user is assigned. |
string get_assigned_user_options(
)
|
|
Get list of assigned user options
API Tags:
DataObjectList2 get_attachment_FileList(
[integer
$limit = 1000], [string
$position = NULL], [string
$order = 'link_ID']
)
|
|
Get list of attached files
INNER JOIN on files ensures we only get back file links
Parameters:
|
integer |
$limit: |
|
|
string |
$position: |
Restrict to files/images linked to a specific position. Position can be 'teaser'|'aftermore' |
|
string |
$order: |
|
API Tags:
Information Tags:
| Todo: | dh> Add prefetching for MainList/ItemList (get_prefetch_itemlist_IDs) The $limit param and DataObjectList2 makes this quite difficult though. Would save (N-1) queries on a blog list page for N items. |
void get_content_excerpt(
[int
$crop_at = 200]
)
|
|
This is like a teaser with no HTML and a cropping.
Note: Excerpt and Teaser are TWO DIFFERENT THINGS.
Parameters:
|
int |
$crop_at: |
Max length of excerpt |
string get_content_extension(
[mixed
$disppage = '#'], [boolean
$force_more = false], [string
$format = 'htmlbody']
)
|
|
Template function: get content extension of item (part after "<!-- more -->")
Parameters:
|
mixed |
$disppage: |
page number to display specific page, # for url parameter |
|
boolean |
$force_more: |
|
|
string |
$format: |
filename to use to display more |
void get_content_page(
[integer
$page = NULL], [string
$format = 'htmlbody']
)
|
|
Get a specific page to display (from the prerendered cache)
Parameters:
|
integer |
$page: |
Page number, NULL/"#" for current |
|
string |
$format: |
Format, used to retrieve the matching cache; see format_to_output() |
array get_content_parts(
array
$params
)
|
|
Get content parts (split by "<!--more-->").
Parameters:
|
array |
$params: |
'disppage', 'format' |
API Tags:
| Return: | Array of content parts |
string get_content_teaser(
[mixed
$disppage = '#'], [boolean
$stripteaser = '#'], [string
$format = 'htmlbody']
)
|
|
Template function: get content teaser of item (will stop at "<!-- more -->"
Parameters:
|
mixed |
$disppage: |
page number to display specific page, # for url parameter |
|
boolean |
$stripteaser: |
# if you don't want to repeat teaser after more link was pressed and <-- noteaser --> has been found |
|
string |
$format: |
filename to use to display more |
string get_creator_login(
)
|
|
Get login of the User who created the Item.
API Tags:
User &get_creator_User(
)
|
|
Get the User who created the Item.
void get_delete_link(
[string
$before = ' '], [string
$after = ' '], [string
$text = '#'], [string
$title = '#'], [string
$class = ''], [boolean
$button = false], [string
$actionurl = '#']
)
|
|
Gets button for deleting the Item if user has proper rights
Parameters:
|
string |
$before: |
to display before link |
|
string |
$after: |
to display after link |
|
string |
$text: |
link text |
|
string |
$title: |
link title |
|
string |
$class: |
class name |
|
boolean |
$button: |
true to make this a button instead of a link |
|
string |
$actionurl: |
page url for the delete action |
void get_deprecate_link(
[string
$before = ' '], [string
$after = ' '], [string
$text = '#'], [string
$title = '#'], [string
$class = ''], [string
$glue = '&']
)
|
|
Provide link to deprecate a post if user has edit rights
Parameters:
|
string |
$before: |
to display before link |
|
string |
$after: |
to display after link |
|
string |
$text: |
link text |
|
string |
$title: |
link title |
|
string |
$class: |
class name |
|
string |
$glue: |
glue between url params |
void get_edit_link(
[array
$params = array()]
)
|
|
Provide link to edit a post if user has edit rights
Parameters:
|
array |
$params: |
Params: - 'before': to display before link
- 'after': to display after link
- 'text': link text
- 'title': link title
- 'class': CSS class name
- 'save_context': redirect to current URL?
|
void get_feedback_feed_url(
string
$skin_folder_name
)
|
|
Get URL to display the post comments in an XML feed.
Parameters:
|
string |
$skin_folder_name: |
|
void get_feedback_title(
[string
$type = 'feedbacks'], [string
$zero = '#'], [string
$one = '#'], [string
$more = '#'], [string
$status = 'published']
)
|
|
Get text depending on number of comments
Parameters:
|
string |
$type: |
Type of feedback to link to (feedbacks (all)/comments/trackbacks/pingbacks) |
|
string |
$zero: |
Link text to display when there are 0 comments |
|
string |
$one: |
Link text to display when there is 1 comment |
|
string |
$more: |
Link text to display when there are >1 comments (include %d for # of comments) |
|
string |
$status: |
Status of feedbacks to count |
string get_feedback_url(
[
$popup = false], [
$glue = '&']
)
|
|
Get URL to display the post comments.
Parameters:
string get_files(
[array
$params = array()], [string
$format = 'htmlbody']
)
|
|
Get block of attachments/files linked to the current Item
Parameters:
API Tags:
void get_images(
[array
$params = array()], [string
$format = 'htmlbody']
)
|
|
Get block of images linked to the current Item
Parameters:
Get reference to array of Links
Get the meta description tag
void get_more_link(
[
$params = array()]
)
|
|
Display more link
Parameters:
string get_player(
string
$url
)
|
|
Get HTML code to display a flash audio player for playback of a given URL.
Parameters:
|
string |
$url: |
The URL of a MP3 audio file. |
API Tags:
array get_prefetch_itemlist_IDs(
)
|
|
Get a list of item IDs from $MainList and $ItemList, if they are loaded.
This is used for prefetching item related data for the whole list(s). This will at least return the item's ID itself.
string get_prerendered_content(
string
$format
)
|
|
Get the prerendered content. If it has not been generated yet, it will.
NOTE: This calls Item::dbupdate(), if renderers get changed (from Plugin hook). (not for preview though)
Parameters:
|
string |
$format: |
Format, see format_to_output(). Only "htmlbody", "entityencoded", "xml" and "text" get cached. |
void get_publish_link(
[string
$before = ' '], [string
$after = ' '], [string
$text = '#'], [string
$title = '#'], [string
$class = ''], [string
$glue = '&'], [
$save_context = true]
)
|
|
Provide link to publish a post if user has edit rights
Note: publishing date will be updated
Parameters:
|
string |
$before: |
to display before link |
|
string |
$after: |
to display after link |
|
string |
$text: |
link text |
|
string |
$title: |
link title |
|
string |
$class: |
class name |
|
string |
$glue: |
glue between url params |
|
|
$save_context: |
|
Get the list of renderers for this Item.
array get_renderers_validated(
)
|
|
Get the list of validated renderers for this Item. This includes stealth plugins etc.
API Tags:
| Return: | List of validated renderer codes |
Get array of tags.
Load from DB if necessary, prefetching any other tags from MainList/ItemList.
Get the title for the <title> tag
If it's not specifically entered, use the regular post title instead
string get_trackback_url(
)
|
|
Template function: get url to use to trackback this item
string get_views(
[string
$zero = '#'], [string
$one = '#'], [string
$more = '#']
)
|
|
Template function: Display the number of times the Item has been viewed
Note: viewcount is incremented whenever the Item's content is displayed with "MORE" (i-e full content), see Item::content().
Viewcount is NOT incremented on page reloads and other special cases, see Hit::is_new_view()
%d gets replaced in all params by the number of views.
Parameters:
|
string |
$zero: |
Link text to display when there are 0 views |
|
string |
$one: |
Link text to display when there is 1 views |
|
string |
$more: |
Link text to display when there are >1 views |
API Tags:
| Return: | The phrase about the number of views. |
void handle_post_processing(
[boolean
$verbose = true]
)
|
|
Execute or schedule post(=after) processing tasks
Includes notifications & pings
Parameters:
|
boolean |
$verbose: |
give more info messages (we want to avoid that when we save & continue editing) |
boolean has_content_parts(
$params
)
|
|
Does the post have different content parts (teaser/extension, divided by "<!--more-->")? This is also true for posts that have images with "aftermore" position.
Parameters:
API Tags:
boolean has_feedback(
array
$params
)
|
|
Return true if there is any feedback of given type.
Parameters:
boolean hidden_teaser(
$params
)
|
|
Should the teaser get hidden when displaying full post ($more).
Parameters:
API Tags:
void images(
[array
$params = array()], [string
$format = 'htmlbody']
)
|
|
Display the images linked to the current Item
Parameters:
Increment the view count of the item directly in DB (if the item's Author is not $current_User).
This method serves TWO purposes (that would break if we used dbupdate() ) :
- Increment the viewcount WITHOUT affecting the lastmodified date and user.
- Increment the viewcount in an ATOMIC manner (even if several hits on the same Item occur simultaneously).
This also triggers the plugin event 'ItemViewsIncreased' if the view count has been increased.
API Tags:
| Return: | Did we increase view count? |
void insert(
$author_user_ID,
$post_title,
$post_content,
$post_timestamp, [
$main_cat_ID = 1], [
$extra_cat_IDs = array()], [
$post_status = 'published'], [
$post_locale = '#'], [
$post_urltitle = ''], [
$post_url = ''], [
$post_comment_status = 'open'], [
$post_renderers = array('default')], [
$item_typ_ID = 1], [
$item_st_ID = NULL]
)
|
|
Create a new Item/Post and insert it into the DB
This function has to handle all needed DB dependencies!
Parameters:
|
|
$author_user_ID: |
|
|
|
$post_title: |
|
|
|
$post_content: |
|
|
|
$post_timestamp: |
|
|
|
$main_cat_ID: |
|
|
|
$extra_cat_IDs: |
|
|
|
$post_status: |
|
|
|
$post_locale: |
|
|
|
$post_urltitle: |
|
|
|
$post_url: |
|
|
|
$post_comment_status: |
|
|
|
$post_renderers: |
|
|
|
$item_typ_ID: |
|
|
|
$item_st_ID: |
|
API Tags:
| Deprecated: | Use set() + dbinsert() instead |
void insert_update_extracats(
string
$mode
)
|
|
Parameters:
|
string |
$mode: |
'insert' | 'update' |
void insert_update_tags(
string
$mode
)
|
|
Save tags to DB
Parameters:
|
string |
$mode: |
'insert' | 'update' |
Template function: display number of links attached to this Item
boolean load_from_Request(
[boolean
$editing = false]
)
|
|
Load data from Request form fields.
This requires the blog (e.g. $blog_ID or $main_cat_ID to be set).
Parameters:
|
boolean |
$editing: |
true if we are returning to edit mode (new, switchtab...) |
API Tags:
| Return: | true if loaded data seems valid. |
Load links if they were not loaded yet.
Information Tags:
| Todo: | dh> gets not used anywhere?! and is the only user of LinkCache::get_by_item_ID(). |
void more_link(
[
$params = array()]
)
|
|
Template tag
Parameters:
boolean msgform_link(
[string
$params = array()], string
1, string
2, string
3, string
4, string
5
)
|
|
Template function: Provide link to message form for this Item's author.
Parameters:
|
string |
1: |
to display before link |
|
string |
2: |
to display after link |
|
string |
3: |
link text |
|
string |
4: |
link title |
|
string |
5: |
class name |
|
string |
$params: |
url of the message form |
API Tags:
| Return: | true, if a link was displayed; false if there's no email address for the Item's author. |
boolean msgform_link_assigned(
string
$form_url, [string
$before = ' '], [string
$after = ' '], [string
$text = '#'], [string
$title = '#'], [string
$class = '']
)
|
|
Template function: Provide link to message form for this Item's assigned User.
Parameters:
|
string |
$form_url: |
url of the message form |
|
string |
$before: |
to display before link |
|
string |
$after: |
to display after link |
|
string |
$text: |
link text |
|
string |
$title: |
link title |
|
string |
$class: |
class name |
API Tags:
| Return: | true, if a link was displayed; false if there's no email address for the assigned User. |
void page_links(
[
$before = '#'], [
$after = '#'], [
$separator = ' '], [
$single = ''], [
$current_page = '#'], [
$pagelink = '%d'], [
$url = '']
)
|
|
Parameters:
|
|
$before: |
|
|
|
$after: |
|
|
|
$separator: |
|
|
|
$single: |
|
|
|
$current_page: |
|
|
|
$pagelink: |
|
|
|
$url: |
|
void priority(
[string
$before = ''], [string
$after = '']
)
|
|
Template function: display priority of item
Parameters:
|
string |
$before: |
|
|
string |
$after: |
|
void priority_options(
$field_value,
$allow_none
)
|
|
Template function: display list of priority options
Parameters:
|
|
$field_value: |
|
|
|
$allow_none: |
|
void publish_link(
[
$before = ' '], [
$after = ' '], [
$text = '#'], [
$title = '#'], [
$class = ''], [
$glue = '&'], [
$save_context = true]
)
|
|
Parameters:
|
|
$before: |
|
|
|
$after: |
|
|
|
$text: |
|
|
|
$title: |
|
|
|
$class: |
|
|
|
$glue: |
|
|
|
$save_context: |
|
boolean remove_renderer(
string
$renderer_code
)
|
|
Remove a renderer (by code) from the Item.
Parameters:
|
string |
$renderer_code: |
Renderer code to remove for this item |
API Tags:
| Return: | True if renderers have changed |
void renderer_checkboxes(
[array|NULL
$item_renderers = NULL]
)
|
|
Template function: display checkable list of renderers
Parameters:
|
array|NULL |
$item_renderers: |
If given, assume these renderers to be checked. |
void replace_callback(
$matches
)
|
|
Callback user for footer()
Parameters:
void send_email_notifications(
[
$display = true]
)
|
|
Send email notifications to subscribed users
Parameters:
Information Tags:
| Todo: | fp>> shall we notify suscribers of blog were this is in extra-cat? blueyed>> IMHO yes. |
void send_outbound_pings(
[boolean
$verbose = true]
)
|
|
Send outbound pings for a post
Parameters:
|
boolean |
$verbose: |
give more info messages (we want to avoid that when we save & continue editing) |
boolean set(
string
$parname, mixed
$parvalue, [boolean
$make_null = false]
)
|
|
Set param value
By default, all values will be considered strings
Parameters:
|
string |
$parname: |
parameter name |
|
mixed |
$parvalue: |
parameter value |
|
boolean |
$make_null: |
true to set to NULL if empty value |
API Tags:
| Return: | true, if a value has been set; false if it has not changed |
Information Tags:
| Todo: | extra_cat_IDs recording |
Redefinition of:
- ItemLight::set()
- Set param value
void set_creator_by_login(
string
$login
)
|
|
Set creator user
Parameters:
boolean set_creator_User(
User
&$creator_User
)
|
|
Set the Author of the Item.
Parameters:
|
User |
&$creator_User: |
(Do NOT set to NULL or you may kill the current_User) |
API Tags:
| Return: | true, if it has been set; false if it has not changed |
boolean set_renderers(
array
$renderers
)
|
|
Set the renderers of the Item.
Parameters:
|
array |
$renderers: |
List of renderer codes. |
API Tags:
| Return: | true, if it has been set; false if it has not changed |
void set_tags_from_string(
string
$tags
)
|
|
Split tags by comma or semicolon
Parameters:
|
string |
$tags: |
The tags, separated by comma or semicolon |
void split_pages(
[string
$format = 'htmlbody']
)
|
|
Make sure, the pages have been obtained (and split up_ from prerendered cache.
Parameters:
void status(
[string
$params = array()]
)
|
|
Template function: display status of item
Statuses:
- published
- deprecated
- protected
- private
- draft
Parameters:
void tags(
[array
$params = array()], string
1
)
|
|
Display tags for Item
Parameters:
Template function: Displays trackback autodiscovery information
TODO: build into headers
Template function: displays url to use to trackback this item
boolean update_excerpt(
[
$crop_length = 254], [
$suffix = '…']
)
|
|
Quick and dirty "excerpts should not stay empty".
Parameters:
API Tags:
| Return: | true if excerpt has been changed |
Information Tags:
| Todo: | have a maxlength param for excerpts in blog properties |
| Todo: | crop at word boundary, maybe even sentence boundary. |
boolean update_renderers_from_Plugins(
)
|
|
Trigger Plugin::ItemApplyAsRenderer() event and adjust renderers according to return value.
API Tags:
| Return: | True if renderers got changed. |
void url_link(
[
$params = array()]
)
|
|
Template function: Display link to item related url.
By default the link is displayed as a link. Optionally some smart stuff may happen.
Parameters:
integer views(
[string
$zero = '#'], [string
$one = '#'], [string
$more = '#']
)
|
|
Template function: Display a phrase about the number of Item views.
Parameters:
|
string |
$zero: |
Link text to display when there are 0 views |
|
string |
$one: |
Link text to display when there is 1 views |
|
string |
$more: |
Link text to display when there are >1 views (include %d for # of views) |
API Tags:
Template function: Display the number of words in the post