/sources/support.php

Description
Functions
addon_installed (line 365)

Check to see if an addon is installed.

  • return: Whether it is
boolean addon_installed (ID_TEXT $addon)
  • ID_TEXT $addon: The module name
array_peek (line 603)

Peek at a stack element.

  • return: The result of the peeking
mixed array_peek (array $array, [integer $depth_down = 1])
  • array $array: The stack to peek in
  • integer $depth_down: The depth into the stack we are peaking
brand_base_url (line 1189)

Find the base URL for documentation.

  • return: The base URL for documentation
URLPATH brand_base_url ()
browser_matches (line 1203)

See's if the current browser matches some special property code. Assumes users are keeping up on newish browsers (except for IE users, who are 6+)

  • return: Whether there is a match
boolean browser_matches (string $code)
  • string $code: The property code
collapse_1d_complexity (line 740)

Take a list of maps of just one element, and make it into a single map

  • return: The collapsed map
array collapse_1d_complexity (string $key, array $list)
  • string $key: The key of our maps that reside in our map
  • array $list: The map of maps
collapse_2d_complexity (line 722)

Take a list of maps of just two elements, and make it into a single map

  • return: The collapsed map
array collapse_2d_complexity (string $key, string $value, array $list)
  • string $key: The key key of our maps that reside in our map
  • string $value: The value key of our maps that reside in our map
  • array $list: The map of maps
compare_ip_address (line 903)

Compare two IP addresses for potential correlation. Not as simple as equality due to '*' syntax.

  • return: Whether the IP addresses correlate
boolean compare_ip_address (string $wild, IP $full)
  • string $wild: The general IP address that is potentially wildcarded
  • IP $full: The specific IP address we are checking
compare_ip_address_ip4 (line 921)

Compare two IP addresses for potential correlation. Not as simple as equality due to '*' syntax. IP4-only variant

  • return: Whether the IP addresses correlate
boolean compare_ip_address_ip4 (string $wild, array $full_parts)
  • string $wild: The general IP address that is potentially wildcarded
  • array $full_parts: The exploded parts of the specific IP address we are checking
compare_ip_address_ip6 (line 938)

Compare two IP addresses for potential correlation. Not as simple as equality due to '*' syntax. IP6-only variant

  • return: Whether the IP addresses correlate
boolean compare_ip_address_ip6 (string $wild, array $full_parts)
  • string $wild: The general IP address that is potentially wildcarded
  • array $full_parts: The exploded parts of the specific IP address we are checking
cron_installed (line 866)

Find if Cron is installed

  • return: Whether Cron is installed
boolean cron_installed ()
escape_html (line 1160)

Get the specified string, but with all characters escaped.

  • return: The escaped string
string escape_html (mixed $string)
  • mixed $string: The input string
find_template_place (line 88)

Search for a template.

  • return: List of parameters needed for the _do_template function to be able to load the template (NULL: could not find the template)
?array find_template_place (ID_TEXT $codename, ?LANGUAGE_NAME $lang, ID_TEXT $theme, string $suffix, string $type)
  • ID_TEXT $codename: The codename of the template being loaded
  • ?LANGUAGE_NAME $lang: The language to load the template in (templates can embed language references) (NULL: users own language)
  • ID_TEXT $theme: The theme to use
  • string $suffix: File type suffix of template file (e.g. .tpl)
  • string $type: Subdirectory type to look in
flatten_slashed_array (line 1455)

Turn an array into a humanely readable string.

  • return: A humanely readable version of the array.
string flatten_slashed_array (array $array)
  • array $array: Array to convert
float_format (line 404)

Format the given float number as a nicely formatted string.

  • return: Nicely formatted string
string float_format (float $val, [integer $frac_digits = 2])
  • float $val: The value to format
  • integer $frac_digits: The number of fractional digits
float_to_raw_string (line 381)

Convert a float to a "technical string representation of a float".

  • return: The string converted
string float_to_raw_string (float $num, [integer $dec_keep = 0])
  • float $num: The number
  • integer $dec_keep: The number of decimals to keep
fractional_edit (line 322)

Find whether a fractional edit is underway.

  • return: Whether a fractional edit is underway
boolean fractional_edit ()
geolocate_ip (line 879)

Find the country an IP address long is located in

  • return: The country initials (NULL: unknown)
?string geolocate_ip ([?IP $ip = NULL])
  • ?IP $ip: The IP to geolocate (NULL: current user's IP)
get_bot_type (line 1398)

Get the name of a webcrawler bot, or NULL if no bot detected

  • return: Webcrawling bot name (NULL: not a bot)
?string get_bot_type ()
get_browser_string (line 833)

Get a string of the users web browser

  • return: The web browser string
string get_browser_string ()
get_flagrant (line 953)

Get the XHTML for the flagrant text message.

  • return: The flagrant text message
tempcode get_flagrant ()
get_ip_address (line 782)

Attempt to get the IP address of the current user

  • return: The users IP address
IP get_ip_address ([integer $amount = 4])
  • integer $amount: The number of groups to include in the IP address (rest will be replaced with *'s). For IP6, this is doubled.
get_loaded_tags (line 1606)

Get Tempcode for tags, based on loaded up from SEO keywords (seo_meta_load_for).

  • return: Loaded tag output (or blank if there are none)
tempcode get_loaded_tags ([?ID_TEXT $limit_to = NULL])
  • ?ID_TEXT $limit_to: The search code for this tag content (e.g. downloads) (NULL: there is none)
get_members_viewing (line 1067)

Get a map of members viewing the specified ocPortal location.

  • return: A map of member-ids to rows about them (NULL: Too many)
?array get_members_viewing ([?ID_TEXT $page = NULL], [?ID_TEXT $type = NULL], [?SHORT_TEXT $id = NULL], [boolean $forum_layer = false])
  • ?ID_TEXT $page: The page they need to be viewing (NULL: don't care)
  • ?ID_TEXT $type: The page-type they need to be viewing (NULL: don't care)
  • ?SHORT_TEXT $id: The type-id they need to be viewing (NULL: don't care)
  • boolean $forum_layer: Whether this has to be done over the forum driver (multi site network)
get_num_users_peak (line 1148)

Get the largest amount of users ever to be on the site at the same time.

  • return: The number of peak users
integer get_num_users_peak ()
get_num_users_site (line 1103)

Get the number of users on the site in the last 5 minutes. The function also maintains the statistic via the sessions table.

  • return: The number of users on the site
integer get_num_users_site ()
get_os_string (line 843)

Get the user's operating system

  • return: The operating system string
string get_os_string ()
get_page_name (line 662)

Get the name of the current page

  • return: The current page name
ID_TEXT get_page_name ()
get_rand_password (line 1544)

Get a randomised password.

  • return: The randomised password
string get_rand_password ()
get_zone_default_page (line 1646)

Get the default page for a zone.

  • return: Default page
ID_TEXT get_zone_default_page (ID_TEXT $zone_name)
  • ID_TEXT $zone_name: Zone name
globalise (line 525)

Turn the tempcode lump into a standalone page (except for header/footer which is assumed already handled elsewhere).

  • return: Standalone page
tempcode globalise (tempcode $middle, [?mixed $message = NULL], [string $type = ''], [boolean $include_header_and_footer = false])
  • tempcode $middle: The tempcode to put into a nice frame
  • ?mixed $message: 'Additional' message (NULL: none)
  • string $type: The type of special message
  • boolean $include_header_and_footer: Whether to automatically include the header and footer templates
has_cookies (line 1503)

Determine whether the user's browser supports cookies or not.

Unfortunately this function will only return true once a user has been to the site more than once... ocPortal will set a cookie, and if it perseveres, that indicates cookies work.

  • return: Whether the user has definitely got cookies
boolean has_cookies ()
has_js (line 1531)

Determine whether the user's browser supports JavaScript or not.

Unfortunately this function will only return true once a user has been to the site more than once... Javascript will set a cookie, indicating it works.

  • return: Whether the user has definitely got Javascript
boolean has_js ()
has_no_forum (line 352)

Find whether we have no forum on this website.

  • return: Whether we have no forum on this website
boolean has_no_forum ()
init__support (line 28)

Standard code module initialisation function.

void init__support ()
integer_format (line 418)

Format the given integer number as a nicely formatted string.

  • return: Nicely formatted string
string integer_format (integer $val)
  • integer $val: The value to format
intelligent_write_error (line 284)

Discern the cause of a file-write error, and show an appropriate error message.

void intelligent_write_error (PATH $path)
  • PATH $path: File path that could not be written
intelligent_write_error_inline (line 306)

Discern the cause of a file-write error, and return an appropriate error message.

  • return: Message
tempcode intelligent_write_error_inline (PATH $path)
  • PATH $path: File path that could not be written
is_mobile (line 1313)

Look at the user's browser, and decide if they are viewing on a mobile device or not.

  • return: Whether the user is using a mobile device
boolean is_mobile ([?string $user_agent = NULL])
  • ?string $user_agent: The user agent (NULL: get from environment, current user's browser)
is_wide (line 158)

Find whether panels will be shown.

  • return: Result.
BINARY is_wide ()
is_wide_high (line 145)

Find whether panels and the header/footer areas won't be shown.

  • return: Result.
BINARY is_wide_high ()
is_writable_wrap (line 246)

Find whether a file/directory is writeable. This function is designed to get past that the PHP is_writable function does not work properly on Windows.

  • return: Whether the file is writeable
boolean is_writable_wrap (PATH $path)
  • PATH $path: The file path
list_to_map (line 696)

Take a list of maps, and make one of the values of each array the index of a map to the map

  • return: The collapsed map
array list_to_map (string $map_value, array $list)
  • string $map_value: The key key of our maps that reside in our map
  • array $list: The list of maps
log_it (line 993)

Log an action

void log_it (ID_TEXT $type, [?SHORT_TEXT $a = NULL], [?SHORT_TEXT $b = NULL])
  • ID_TEXT $type: The type of activity just carried out (a lang string)
  • ?SHORT_TEXT $a: The most important parameter of the activity (e.g. id) (NULL: none)
  • ?SHORT_TEXT $b: A secondary (perhaps, human readable) parameter of the activity (e.g. caption) (NULL: none)
make_xhtml_strict (line 579)

Take a Tempcode object and run some hackerish code to make it XHTML-strict.

  • return: object (no longer cache safe)
object Tempcode make_xhtml_strict (object Tempcode $global)
  • object Tempcode $global: object
match_key_match (line 617)

See if the current URL matches the given ocPortal match tags.

  • return: Whether there is a match
boolean match_key_match (string $match_tag, [boolean $support_post = false])
  • string $match_tag: Match tags
  • boolean $support_post: Check against POSTed data too
member_tracking_update (line 1037)

Update the member tracker for the currently viewing user.

void member_tracking_update ()
mixed (line 1554)

Assign this to explicitly declare that a variable may be of mixed type, and initialise to NULL.

  • return: Of mixed type (NULL: default)
?mixed mixed ()
multi_sort (line 432)

Helper function to sort a list of maps by the value at $key in each of those maps.

  • return: The comparison result (0 for equal, -1 for less, 1 for more)
integer multi_sort (array $a, array $b)
  • array $a: The first to compare
  • array $b: The second to compare
ocf_require_all_forum_stuff (line 502)

Require all code relating to the OCF forum

void ocf_require_all_forum_stuff ()
ocp_mb_strlen (line 173)

Get string length, with utf-8 awareness where possible/required.

  • return: The string length.
integer ocp_mb_strlen (string $in)
  • string $in: The string to get the length of.
ocp_mb_strtolower (line 216)

Make a string lowercase, with utf-8 awareness where possible/required.

  • return: Result.
string ocp_mb_strtolower (string $in)
  • string $in: Subject.
ocp_mb_strtoupper (line 231)

Make a string uppercase, with utf-8 awareness where possible/required.

  • return: Result.
string ocp_mb_strtoupper (string $in)
  • string $in: Subject.
ocp_mb_substr (line 190)

Return part of a string, with utf-8 awareness where possible/required.

  • return: String part (false: $start was over the end of the string).
~string ocp_mb_substr (string $in, integer $from, [?integer $amount = NULL], [boolean $force = false])
  • string $in: The subject.
  • integer $from: The start position.
  • ?integer $amount: The length to extract (NULL: all remaining).
  • boolean $force: Whether to force unicode as on.
ocp_srv (line 757)

Get server environment variables.

  • return: The variable value ('' means unknown)
string ocp_srv (string $key)
  • string $key: The variable name
ocp_tempnam (line 558)

Create file with unique file name, but works around compatibility issues between servers.

  • return: The name of the temporary file (false: error).
~string ocp_tempnam (string $prefix)
  • string $prefix: The prefix of the temporary file name.
php_addslashes (line 1005)

Escape a string to fit within PHP double quotes.

  • return: Resultant string
string php_addslashes (string $in)
  • string $in: String in
read_multi_code (line 1440)

Read a multi code from a named parameter stub.

  • return: The multi code.
SHORT_TEXT read_multi_code (ID_TEXT $param)
  • ID_TEXT $param: The parameter stub (stub of a series of POST parameters, made by ocf_get_forum_multi_code_field's field or similar).
remove_duplicate_rows (line 1019)

Remove any duplication inside the list of rows (each row being a map). Duplication is defined by rows with correspinding IDs.

  • return: The filtered rows
array remove_duplicate_rows (array $rows, [string $id_field = 'id'])
  • array $rows: The rows to remove duplication of
  • string $id_field: The ID field
seo_meta_get_for (line 1566)

Get meta information for specified resource

  • return: The first element is the meta keyword string for the specified resource, and the other is the meta description string.
array seo_meta_get_for (ID_TEXT $type, ID_TEXT $id)
  • ID_TEXT $type: The type of resource (e.g. download)
  • ID_TEXT $id: The ID of the resource
seo_meta_load_for (line 1591)

Load the specified resource's meta information into the system for use on this page.

Also, if the title is specified then this is used for the page title.

void seo_meta_load_for (ID_TEXT $type, ID_TEXT $id, [?string $title = NULL])
  • ID_TEXT $type: The type of resource (e.g. download)
  • ID_TEXT $id: The ID of the resource
  • ?string $title: The page-specific title to use, in Comcode or plain-text format with possible HTML entities included [Comcode will later be stripped] (NULL: none)
strlen_sort (line 334)

Helper function for usort to sort a list by string length.

  • return: The comparison result (0 for equal, -1 for less, 1 for more)
integer strlen_sort (string $a, string $b)
  • string $a: The first string to compare
  • string $b: The second string to compare
wordfilter_text (line 1475)

Get a word-filtered version of the specified text.

  • return: Filtered version of the input text
string wordfilter_text (string $text)
  • string $text: Text to filter
xmlentities (line 1490)

XML escape the input string.

  • return: Escaped version of input string
string xmlentities (string $string, [integer $quote_style = ENT_COMPAT])
  • string $string: Input string
  • integer $quote_style: Quote style

Documentation generated on Sun, 02 Jan 2011 23:25:36 +0000 by phpDocumentor 1.4.3