File/includes/functions_content.php

Description
  • version: $Id: functions_content.php 8752 2008-08-13 14:37:33Z Kellanved $
  • copyright: (c) 2005 phpBB Group
  • license: GNU Public License
Classes
Class Description
 class bitfield
Functions
bbcode_nl2br (line 688)

custom version of nl2br which takes custom BBCodes into account

void bbcode_nl2br ( $text)
  • $text
bump_topic_allowed (line 200)

Bump Topic Check - used by posting and viewtopic

void bump_topic_allowed ( $forum_id,  $topic_bumped,  $last_post_time,  $topic_poster,  $last_topic_poster)
  • $forum_id
  • $topic_bumped
  • $last_post_time
  • $topic_poster
  • $last_topic_poster
censor_text (line 657)

Censoring

void censor_text ( $text)
  • $text
decode_message (line 347)

Decode text whereby text is coming from the db and expected to be pre-parsed content We are placing this outside of the message parser because we are often in need of it...

void decode_message ( &$message, [ $bbcode_uid = ''])
  • &$message
  • $bbcode_uid
extension_allowed (line 1054)

Check if extension is allowed to be posted.

  • return: False if the extension is not allowed to be posted, else true.
bool extension_allowed (mixed $forum_id, string $extension, array &$extensions)
  • mixed $forum_id: The forum id to check or false if private message
  • string $extension: The extension to check, for example zip.
  • array &$extensions: The extension array holding the information from the cache (will be obtained if empty)
generate_text_for_display (line 392)

For display of custom parsed text on user-facing pages

Expects $text to be the value directly from the database (stored value)

void generate_text_for_display ( $text,  $uid,  $bitfield,  $flags)
  • $text
  • $uid
  • $bitfield
  • $flags
generate_text_for_edit (line 473)

For decoding custom parsed text for edits as well as extracting the flags

Expects $text to be the value directly from the database (pre-parsed content)

void generate_text_for_edit ( $text,  $uid,  $flags)
  • $text
  • $uid
  • $flags
generate_text_for_storage (line 435)

For parsing custom parsed text to be stored within the database.

This function additionally returns the uid and bitfield that needs to be stored. Expects $text to be the value directly from request_var() and in it's non-parsed form

void generate_text_for_storage ( &$text,  &$uid,  &$bitfield,  &$flags, [ $allow_bbcode = false], [ $allow_urls = false], [ $allow_smilies = false])
  • &$text
  • &$uid
  • &$bitfield
  • &$flags
  • $allow_bbcode
  • $allow_urls
  • $allow_smilies
gen_sort_selects (line 44)

Generate sort selection fields

void gen_sort_selects ( &$limit_days,  &$sort_by_text,  &$sort_days,  &$sort_key,  &$sort_dir,  &$s_limit_days,  &$s_sort_key,  &$s_sort_dir,  &$u_sort_param, [ $def_st = false], [ $def_sk = false], [ $def_sd = false])
  • &$limit_days
  • &$sort_by_text
  • &$sort_days
  • &$sort_key
  • &$sort_dir
  • &$s_limit_days
  • &$s_sort_key
  • &$s_sort_dir
  • &$u_sort_param
  • $def_st
  • $def_sk
  • $def_sd
get_context (line 238)

Generates a text with approx. the specified length which contains the specified words and their context

  • return: Context of the specified words separated by "..."
string get_context (string $text, string $words, [int $length = 400])
  • string $text: The full text from which context shall be extracted
  • string $words: An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!)
  • int $length: The desired length of the resulting text, however the result might be shorter or longer than this value
get_username_string (line 1140)

Get username details for placing into templates.

  • return: A string consisting of what is wanted based on $mode.
string get_username_string (string $mode, int $user_id, string $username, [string $username_colour = ''], [string $guest_username = false], [string $custom_profile_url = false])
  • string $mode: Can be profile (for getting an url to the profile), username (for obtaining the username), colour (for obtaining the user colour), full (for obtaining a html string representing a coloured link to the users profile) or no_profile (the same as full but forcing no profile link)
  • int $user_id: The users id
  • string $username: The users name
  • string $username_colour: The users colour
  • string $guest_username: optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then.
  • string $custom_profile_url: optional parameter to specify a profile url. The user id get appended to this url as &u={user_id}
make_clickable (line 614)

make_clickable function

Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx. Cuts down displayed size of link if over 50 chars, turns absolute links into relative versions when the server/script path matches the link

void make_clickable ( $text, [ $server_url = false], [ $class = 'postlink'])
  • $text
  • $server_url
  • $class
make_clickable_callback (line 492)

A subroutine of make_clickable used with preg_replace

It places correct HTML around an url, shortens the displayed text and makes sure no entities are inside URLs

void make_clickable_callback ( $type,  $whitespace,  $url,  $relative_url,  $class)
  • $type
  • $whitespace
  • $url
  • $relative_url
  • $class
make_jumpbox (line 101)

Generate Jumpbox

void make_jumpbox ( $action, [ $forum_id = false], [ $select_all = false], [ $acl_list = false], [ $force_display = false])
  • $action
  • $forum_id
  • $select_all
  • $acl_list
  • $force_display
parse_attachments (line 722)

General attachment parsing

void parse_attachments (mixed $forum_id, string &$message, array &$attachments, array &$update_count, [bool $preview = false])
  • mixed $forum_id: The forum id the attachments are displayed in (false if in private message)
  • string &$message: The post/private message
  • array &$attachments: The attachments to parse for (inline) display. The attachments array will hold templated data after parsing.
  • array &$update_count: The attachment counts to be updated - will be filled
  • bool $preview: If set to true the attachments are parsed for preview. Within preview mode the comments are fetched from the given $attachments array and not fetched from the database.
smiley_text (line 699)

Smiley processing

void smiley_text ( $text, [ $force_option = false])
  • $text
  • $force_option
strip_bbcode (line 373)

Strips all bbcode from a text and returns the plain content

void strip_bbcode ( &$text, [ $uid = ''])
  • &$text
  • $uid
truncate_string (line 1077)

Truncates string while retaining special characters if going over the max length The default max length is 60 at the moment The maximum storage length is there to fit the string within the given length. The string may be further truncated due to html entities.

For example: string given is 'a "quote"' (length: 9), would be a stored as 'a "quote"' (length: 19)

void truncate_string (string $string, [int $max_length = 60], [int $max_store_length = 255], [bool $allow_reply = true], [string $append = ''])
  • string $string: The text to truncate to the given length. String is specialchared.
  • int $max_length: Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char)
  • int $max_store_length: Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars).
  • bool $allow_reply: Allow Re: in front of string
  • string $append: String to be appended

Documentation generated on Tue, 26 Aug 2008 08:34:04 +0200 by phpDocumentor 1.4.2