Documentation » API Reference

Application:

Functions


htmlentities_compat ($val1$val2 ENT_QUOTES$val3 'iso-8859-1'

  • Access: public
  • Return: string

Where htmlentities() causes corruption of data in alternate character
sets, this function aims to translate the necessary entities without
damaging the data. Currently does a str_replace for the following
entities:
- '&' * => '&'
- '<' * => '<'
- '>' * => '>'
- '<' * * => '&lt;'
- '>' * * => '&gt;'
- '"' * * => '"'

It also does an extra preg_replace for & followed by a
space/tab/cr/lf and replaces the & with a &amp;.


htmlentities_compat_decode ($matches

  • Access: public
  • Return: string

Callback for fixing unicode entities for htmlentities_compat().


htmlentities_reverse ($val1

  • Access: public
  • Return: string

Reverses the htmlentities_compat() function exactly.


&make_obj ($array

  • Access: public
  • Return: object

Note: Deprecated in favour of a simple:

$obj = (object) $array;

Creates an object out of a hash (or any other type). There is no make_hash()
function because that can simply be cast as well ($array = (array) $obj).
Thanks to Demian Turner for pointing out this equivalence.


make_assoc ($array$key ''$value ''

  • Access: public
  • Return: array hash

Creates a single-level associative array out of an array of objects
or an array of associative arrays. $key and $value specify the
property or array key name to use for their respective values in
the new associative array.


better_crypt ($pass$salt ''

  • Access: public
  • Return: string

Makes sure that the salt is always two characters in length before
sending it to the crypt() function. Also generates its own two
character salt if none is provided.


better_crypt_compare ($pass$original

  • Access: public
  • Return: boolean

Calls the better_crypt() function instead of crypt() when comparing
a new password to the original to see if it matches up.


vsprintf ($str$args

  • Access: public
  • Return: string

If the PHP version is less than 4.1.0, emulates the vsprintf() function
using a call_user_func_array() with the sprintf() function. The use of this
function in the saf.I18n package was causing fatal errors in Sitellite on
earlier PHP versions.


is_a ($class$match

  • Access: public
  • Return: boolean

If the PHP version is less than 4.2.0, emulates the is_a() function,
which determines whether the object, $class, is of the class specified
by $match.


html_marker ($note

  • Access: public
  • Return: string

Creates an HTML comment padded with dashes for easily marking sections
of a document. Hnady for viewing the source of large documents.


array_search ($needle ''$haystack ''

  • Access: public
  • Return: mixed

If the PHP version is less than 4.0.5, emulates the array_search()
function.


format_filesize ($size 0

  • Access: public
  • Return: string

Returns a file size formatted in a more human-friendly format, rounded
to the nearest Gb, Mb, Kb, or byte.


commify ($number ""

  • Access: public
  • Return: string

Adds commas every three numbers from the right of the period to a given
number.


info ($value$full false

  • Access: public

Wraps a print_r() or var_dump() of the given $value with a set of <pre></pre>
tags around it, and echoes it.


assocify ($arr

  • Access: public
  • Return: array hash

Turns a regular array into an associative array with a $value => $value
new key/value relation. For example, an array [1=>Joe,2=>Jane,3=>Joe]
would become [Joe=>Joe,Jane=>Jane]. Please note the loss of duplicate
values.


array_chunk ($input$size$preserve_keys false

  • Access: public

Provides array_chunk() for PHP 4.1 users.


array_change_key_case ($array$changeCase CASE_LOWER

  • Access: public
  • See: http://www.php.net/array_change_key_case
  • Return: array

Returns an array with all string keys lowercased or uppercased


array_chunk_fill ($list$chunk$assoc false$fill '&nbsp;'

  • Access: public
  • Return: array

Calls array_chunk(), but adds a parameter $fill, which "fills out"
the potentially uneven number if items in the last array with the
value of $fill.


xmlentities ($string$quote_style ENT_COMPAT

  • Access: public
  • Return: string

Converts entities to unicode entities (ie. < becomes &#60;).
From php.net/htmlentities comments, user "webwurst at web dot de"


xmlentities_reverse ($string

  • Access: public
  • Return: string

Converts XML unicode entities back to their original characters
(ie. &#60; becomes <).


mime ($file$default 'text/plain'

  • Access: public
  • Return: string

Determines the content type of a file based on a small list of common types.
Useful when mime_content_type() isn't available or isn't configured
correctly.


mime_content_type ($file


is_assoc ($arr

  • Access: public
  • Return: boolean

Determines whether the specified variable is an associative array.


sql_split ($sql

  • Access: public
  • Return: array

Splits an SQL script into distinct queries which can be evaluated or
manipulated individually.


better_strrpos ($haystack$needle

  • Access: public
  • Return: int

strrpos() which allows multiple characters in the needle.


localdate ($format$unixdate ''

  • Access: public
  • Return: string

A date() replacement which respects your setlocale() setting.
From php.net/date comments, user "isp dot phptime at spsoft dot de"


readfile_chunked ($filename$retbytes true

  • Access: public
  • Return: int

Replacement for readfile() in PHP5 which doesn't encounter memory limits.


sitellite_mail ($to_user$subject$body$from_user ''

  • Access: public
  • Return: boolean

Replacement for mail() in Sitellite, using Sitellite's internal messaging
system instead. The first parameter is a username instead of an email address,
and the fourth is a sender's username instead of a From header.

Return to Top