[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/items/model/ -> _item.class.php (sommaire)

This file implements the Item class. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

Author: blueyed: Daniel HAHLER.
Author: fplanque: Francois PLANQUE.
Author: gorgeb: Bertrand GORGE / EPISTEMA
Author: mbruneau: Marc BRUNEAU / PROGIDISTRI
Copyright: (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}
Version: $Id: _item.class.php,v 1.15 2007/11/04 01:10:57 fplanque Exp $
Poids: 3495 lignes (100 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

Item:: (81 méthodes):
  Item()
  assign_to()
  author()
  load_from_Request()
  anchor()
  assigned_to()
  get_assigned_user_options()
  can_see_comments()
  can_comment()
  can_rate()
  get_prerendered_content()
  set_prerendered_content()
  update_renderers_from_Plugins()
  split_pages()
  get_content_page()
  get_content_excerpt()
  content_teaser()
  get_content_teaser()
  content_extension()
  get_content_extension()
  count_view()
  more_link()
  get_more_link()
  deadline_date()
  deadline_time()
  linkcount()
  load_links()
  set_tags_from_string()
  msgform_link()
  msgform_link_assigned()
  page_links()
  images()
  get_images()
  feedback_feed_link()
  get_feedback_feed_url()
  feedback_link()
  get_feedback_title()
  feedback_moderation()
  get_delete_link()
  delete_link()
  get_edit_link()
  edit_link()
  get_publish_link()
  publish_link()
  get_deprecate_link()
  deprecate_link()
  priority()
  priority_options()
  renderer_checkboxes()
  status()
  status_raw()
  extra_status()
  tags()
  trackback_rdf()
  trackback_url()
  get_trackback_url()
  url_link()
  wordcount()
  get_views()
  views()
  set()
  set_renderers()
  set_creator_User()
  insert()
  dbinsert()
  dbupdate()
  dbdelete()
  insert_update_extracats()
  insert_update_tags()
  inc_viewcount()
  get_assigned_User()
  load_Blog()
  handle_post_processing()
  send_email_notifications()
  send_outbound_pings()
  get()
  assign_to_first_cat_for_collection()
  get_renderers()
  get_renderers_validated()
  add_renderer()
  remove_renderer()


Classe: Item  - X-Ref

Item Class

Item( $db_row = NULL, $dbtable = 'T_items__item', $dbprefix = 'post_', $dbIDname = 'post_ID', $objtype = 'Item', $datecreated_field = 'datecreated', $datemodified_field = 'datemodified', $creator_field = 'creator_user_ID', $lasteditor_field = 'lastedit_user_ID' )   X-Ref
Constructor

param: object table Database row
param: string
param: string
param: string
param: string for derived classes
param: string datetime field name
param: string datetime field name
param: string User ID field name
param: string User ID field name

assign_to( $user_ID, $dbupdate = true )   X-Ref


author( $params = array()   X-Ref
Template function: display author/creator of item

param: string String to display before author name
param: string String to display after author name
param: string Output format, see {@link format_to_output()}

load_from_Request( $force_edit_date = false )   X-Ref
Load data from Request form fields.

This requires the blog (e.g. {@link $blog_ID} or {@link $main_cat_ID} to be set).

param: boolean true to force edit date (as long as perms permit)
return: boolean true if loaded data seems valid.

anchor()   X-Ref
Template function: display anchor for permalinks to refer to.


assigned_to( $before = '', $after = '', $format = 'htmlbody' )   X-Ref
Template function: display assignee of item

param: string
param: string
param: string Output format, see {@link format_to_output()}

get_assigned_user_options()   X-Ref
Get list of assigned user options

return: string HTML select options list

can_see_comments()   X-Ref
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.

return: boolean

can_comment( $before_error = '<p><em>', $after_error = '</em></p>', $non_published_msg = ')   X-Ref
Template function: Check if user can leave comment on this post or display error

param: string|NULL string to display before any error message; NULL to not display anything, but just return boolean
param: string string to display after any error message
param: string error message for non published posts, '#' for default
param: string error message for closed comments posts, '#' for default
return: boolean true if user can post, false if s/he cannot

can_rate()   X-Ref
Template function: Check if user can can rate this post

return: boolean true if user can post, false if s/he cannot

get_prerendered_content( $format )   X-Ref
Get the prerendered content. If it has not been generated yet, it will.

param: string Format, see {@link format_to_output()}.
return: string

set_prerendered_content( $content, $cache_key )   X-Ref
Set the pre-rendered content.

This is meant to get called by ItemList2, which would do a single query for all
items.

param: string Pre-rendered content
param: string Cache-Key ($format.'/'.$renderers). See {@link Item::get_prerendered_content()} for the appropriate query skeleton.

update_renderers_from_Plugins()   X-Ref
Trigger {@link Plugin::ItemApplyAsRenderer()} event and adjust renderers according
to return value.

return: boolean True if renderers got changed.

split_pages( $format = 'htmlbody' )   X-Ref
Make sure, the pages have been obtained (and split up_ from prerendered cache.

param: string Format, used to retrieve the matching cache; see {@link format_to_output()}

get_content_page( $page, $format = 'htmlbody' )   X-Ref
Get a specific page to display (from the prerendered cache)

param: integer Page number
param: string Format, used to retrieve the matching cache; see {@link format_to_output()}

get_content_excerpt( $crop_at = 200 )   X-Ref
This is like a teaser with no HTML and a cropping.


content_teaser( $params )   X-Ref
Display content teaser of item (will stop at "<!-- more -->"


get_content_teaser( $disppage = ')   X-Ref
Template function: get content teaser of item (will stop at "<!-- more -->"

param: mixed page number to display specific page, # for url parameter
param: boolean # if you don't want to repeat teaser after more link was pressed and <-- noteaser --> has been found
param: string filename to use to display more
return: string

content_extension( $params )   X-Ref
Display content teaser of item (will stop at "<!-- more -->"


get_content_extension( $disppage = ')   X-Ref
Template function: get content extension of item (part after "<!-- more -->")

param: mixed page number to display specific page, # for url parameter
param: boolean
param: string filename to use to display more
return: string

count_view( $params = array()   X-Ref
Increase view counter


more_link( $params = array()   X-Ref
Template tag


get_more_link( $params = array()   X-Ref
Display more link

param: string string to display before more link
param: string string to display after more link
param: string
param: string
param: mixed
param: string Output format, see {@link format_to_output()}

deadline_date( $format = '', $useGM = false )   X-Ref
Template function: display deadline date (datetime) of Item

param: string date/time format: leave empty to use locale default date format
param: boolean true if you want GMT

deadline_time( $format = '', $useGM = false )   X-Ref
Template function: display deadline time (datetime) of Item

param: string date/time format: leave empty to use locale default time format
param: boolean true if you want GMT

linkcount()   X-Ref
Pas de description

load_links()   X-Ref
Load links if they were not loaded yet.


set_tags_from_string( $tags )   X-Ref
Pas de description

msgform_link( $params = array()   X-Ref
Template function: Provide link to message form for this Item's author.

param: string url of the message form
param: string to display before link
param: string to display after link
param: string link text
param: string link title
param: string class name
return: boolean true, if a link was displayed; false if there's no email address for the Item's author.

msgform_link_assigned( $form_url, $before = ' ', $after = ' ', $text = ')   X-Ref
Template function: Provide link to message form for this Item's assigned User.

param: string url of the message form
param: string to display before link
param: string to display after link
param: string link text
param: string link title
param: string class name
return: boolean true, if a link was displayed; false if there's no email address for the assigned User.

page_links( $before = ')   X-Ref
Pas de description

images( $params = array()   X-Ref
Display the images linked to the current Item

param: array of params
param: string Output format, see {@link format_to_output()}

get_images( $params = array()   X-Ref
Get block of images linked to the current Item

param: array of params
param: string Output format, see {@link format_to_output()}

feedback_feed_link( $skin = '_rss2', $before = '', $after = '', $title=')   X-Ref
Template function: Displays link to the feed for comments on this item

param: string Type of feedback to link to (rss2/atom)
param: string String to display before the link (if comments are to be displayed)
param: string String to display after the link (if comments are to be displayed)
param: string Link title

get_feedback_feed_url( $skin_folder_name )   X-Ref
Get URL to display the post comments in an XML feed.

param: string

feedback_link( $params )   X-Ref
Template function: Displays link to feedback page (under some conditions)

param: array

get_feedback_title( $type = 'feedbacks', $zero = ')   X-Ref
Get text depending on number of comments

param: string Type of feedback to link to (feedbacks (all)/comments/trackbacks/pingbacks)
param: string Link text to display when there are 0 comments
param: string Link text to display when there is 1 comment
param: string Link text to display when there are >1 comments (include %d for # of comments)
param: string Status of feedbacks to count

feedback_moderation( $type = 'feedbacks', $before = '', $after = '', $zero = '', $one = ')   X-Ref
Template function: Displays feeback moderation info

param: string Type of feedback to link to (feedbacks (all)/comments/trackbacks/pingbacks)
param: string String to display before the link (if comments are to be displayed)
param: string String to display after the link (if comments are to be displayed)
param: string Link text to display when there are 0 comments
param: string Link text to display when there is 1 comment
param: string Link text to display when there are >1 comments (include %d for # of comments)
param: string Link
param: boolean true to hide if no feedback

get_delete_link( $before = ' ', $after = ' ', $text = ')   X-Ref
Gets button for deleting the Item if user has proper rights

param: string to display before link
param: string to display after link
param: string link text
param: string link title
param: string class name
param: boolean true to make this a button instead of a link
param: string page url for the delete action

delete_link( $before = ' ', $after = ' ', $text = ')   X-Ref
Displays button for deleting the Item if user has proper rights

param: string to display before link
param: string to display after link
param: string link text
param: string link title
param: string class name
param: boolean true to make this a button instead of a link
param: string page url for the delete action

get_edit_link( $params = array()   X-Ref
Provide link to edit a post if user has edit rights


edit_link( $params = array()   X-Ref
Template tag


get_publish_link( $before = ' ', $after = ' ', $text = ')   X-Ref
Provide link to publish a post if user has edit rights

Note: publishing date will be updated

param: string to display before link
param: string to display after link
param: string link text
param: string link title
param: string class name
param: string glue between url params

publish_link( $before = ' ', $after = ' ', $text = ')   X-Ref
Pas de description

get_deprecate_link( $before = ' ', $after = ' ', $text = ')   X-Ref
Provide link to deprecate a post if user has edit rights

param: string to display before link
param: string to display after link
param: string link text
param: string link title
param: string class name
param: string glue between url params

deprecate_link( $before = ' ', $after = ' ', $text = ')   X-Ref
Display link to deprecate a post if user has edit rights

param: string to display before link
param: string to display after link
param: string link text
param: string link title
param: string class name
param: string glue between url params

priority( $before = '', $after = '' )   X-Ref
Template function: display priority of item

param: string
param: string

priority_options( $field_value, $allow_none )   X-Ref
Template function: display list of priority options


renderer_checkboxes( $item_renderers = NULL )   X-Ref
Template function: display checkable list of renderers

param: array|NULL If given, assume these renderers to be checked.

status( $params = array()   X-Ref
Template function: display status of item

Statuses:
- published
- deprecated
- protected
- private
- draft

param: string Output format, see {@link format_to_output()}

status_raw()   X-Ref
Pas de description

extra_status( $before = '', $after = '', $format = 'htmlbody' )   X-Ref
Template function: display extra status of item

param: string
param: string
param: string Output format, see {@link format_to_output()}

tags( $params = array()   X-Ref
Display tags for Item

param: array of params
param: string Output format, see {@link format_to_output()}

trackback_rdf()   X-Ref
Template function: Displays trackback autodiscovery information

TODO: build into headers

trackback_url()   X-Ref
Template function: displays url to use to trackback this item


get_trackback_url()   X-Ref
Template function: get url to use to trackback this item

return: string

url_link( $before = '', $after = '', $text = '%s', $attribs = array()   X-Ref
Template function: Display link to item related url

param: string string to display before the link (if exists)
param: string string to display after the link (if exists)
param: string Link text to use (%s gets replaced by the URL).
param: array Attributes for the <a> tag (if the href attribute is set, %s gets replaced by the URL).
param: string Output format, see {@link format_to_output()}

wordcount()   X-Ref
Template function: Display the number of words in the post


get_views( $zero = ')   X-Ref
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 {@link Item::content()}.

Viewcount is NOT incremented on page reloads and other special cases, see {@link Hit::is_new_view()}

%d gets replaced in all params by the number of views.

param: string Link text to display when there are 0 views
param: string Link text to display when there is 1 views
param: string Link text to display when there are >1 views
return: string The phrase about the number of views.

views( $zero = ')   X-Ref
Template function: Display a phrase about the number of Item views.

param: string Link text to display when there are 0 views
param: string Link text to display when there is 1 views
param: string Link text to display when there are >1 views (include %d for # of views)
return: integer Number of views.

set( $parname, $parvalue, $make_null = false )   X-Ref
Set param value

By default, all values will be considered strings

param: string parameter name
param: mixed parameter value
param: boolean true to set to NULL if empty value
return: boolean true, if a value has been set; false if it has not changed

set_renderers( $renderers )   X-Ref
Set the renderers of the Item.

param: array List of renderer codes.
return: boolean true, if it has been set; false if it has not changed

set_creator_User( & $creator_User )   X-Ref
Set the Author of the Item.

param: User (Do NOT set to NULL or you may kill the current_User)
return: boolean true, if it has been set; false if it has not changed

insert( $author_user_ID, $post_title, $post_content, $post_timestamp, $main_cat_ID = 1, $extra_cat_IDs = array()   X-Ref
Create a new Item/Post and insert it into the DB

This function has to handle all needed DB dependencies!


dbinsert()   X-Ref
Insert object into DB based on previously recorded changes

return: boolean true on success

dbupdate()   X-Ref
Update the DB based on previously recorded changes

return: boolean true on success

dbdelete()   X-Ref
Trigger event AfterItemDelete after calling parent method.

return: boolean true on success

insert_update_extracats( $mode )   X-Ref

param: string 'insert' | 'update'

insert_update_tags( $mode )   X-Ref
Save tags to DB

param: string 'insert' | 'update'

inc_viewcount()   X-Ref
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.

return: boolean Did we increase view count?

get_assigned_User()   X-Ref
Get the User who is assigned to the Item.

return: User|NULL NULL if no user is assigned.

load_Blog()   X-Ref
Pas de description

handle_post_processing()   X-Ref
Execute or schedule post(=after) processing tasks

Includes notifications & pings

send_email_notifications( $display = true )   X-Ref
Send email notifications to subscribed users


send_outbound_pings()   X-Ref
Send outbound pings for a post


get( $parname )   X-Ref
Get a member param by its name

param: mixed Name of parameter
return: mixed Value of parameter

assign_to_first_cat_for_collection( $collection_ID )   X-Ref
Assign the item to the first category we find in the requested collection

param: integer $collection_ID

get_renderers()   X-Ref
Get the list of renderers for this Item.

return: array

get_renderers_validated()   X-Ref
Get the list of validated renderers for this Item. This includes stealth plugins etc.

return: array List of validated renderer codes

add_renderer( $renderer_code )   X-Ref
Add a renderer (by code) to the Item.

param: string Renderer code to add for this item
return: boolean True if renderers have changed

remove_renderer( $renderer_code )   X-Ref
Remove a renderer (by code) from the Item.

param: string Renderer code to remove for this item
return: boolean True if renderers have changed



Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics