HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: Core support functions

» Return to Contents



Sources/global.php file is the main file, the one that is included first, and the one that contains the functions required to start everything else off.
Please be careful when modifying this file, as it is very easy to make a mistake and ruin your installation of ocPortal.

global.php launches global2.php, which may, like any source file except minikernel.php and global.php, be overridden in sources_custom. This overriding system allows you to distinguish which files you have changed, to maintain the original copy of the file, and to not lose your changes on upgrade.
The downside to this is that upgrades may file if you have overrided source files that have had necessary changes to them.
The override system is rolled out across ocPortal, for everything from modules to templates. For files that may be edited inside ocPortal itself, the overriding system works as a great file-permission solution: you do not need to chmod all your templates, because the originals are never changed, only overridden.

sources/global.php

Global_functions_global.php

Function summary

void require_code (string codename, boolean light_exit)
void require_code_no_override (string codename)
?object object_factory (string class, boolean null_ok)
PATH get_file_base ()
PATH get_custom_file_base ()
string filter_naughty (string in, boolean preg)
string filter_naughty_harsh (string in, boolean preg)
~LONG_TEXT file_get_contents (SHORT_TEXT filename, integer type)

void require_code(string codename, boolean light_exit)

This function is a very important one when coding. It allows you to include a source code file (from root/sources/ or root/sources_custom/) through the proper channels.You should remember this function, and not substitute anything else for it, as that will likely make your code unstable.It is key to source code modularity in ocPortal.

Parameters…

Name codename
Description The codename for the source module to load (or a full relative path, ending with .php; if custom checking is needed, this must be the custom version)
Type string

Name light_exit
Description Whether to cleanly fail when a source file is missing
Default value boolean-false
Type boolean

(No return value)


Return to the function index for this class Expand: View the source code to this function

void require_code_no_override(string codename)

Require code, but without looking for sources_custom overrides

Parameters…

Name codename
Description The codename for the source module to load
Type string

(No return value)


Return to the function index for this class Expand: View the source code to this function

?object object_factory(string class, boolean null_ok)

Make an object of the given class

Parameters…

Name class
Description The class name
Type string

Name null_ok
Description Whether to return NULL if there is no such class
Default value boolean-false
Type boolean

Returns…

Description The object (NULL: no such class)
Type ?object

Return to the function index for this class Expand: View the source code to this function

PATH get_file_base()

Get the file base for your installation of ocPortal

Parameters…

Returns…

Description The file base, without a trailing slash
Type PATH

Return to the function index for this class Expand: View the source code to this function

PATH get_custom_file_base()

Get the file base for your installation of ocPortal.  For a shared install only, this is different to the base-url.

Parameters…

Returns…

Description The file base, without a trailing slash
Type PATH

Return to the function index for this class Expand: View the source code to this function

string filter_naughty(string in, boolean preg)

Get the parameter put into it, with no changes. If it detects that the parameter is naughty (i.e malicious, and probably from a hacker), it will log the hack-attack and output an error message.This function is designed to be called on parameters that will be embedded in a path, and defines malicious as trying to reach a parent directory using '..'. All file paths in ocPortal should be absolute

Parameters…

Name in
Description String to test
Type string

Name preg
Description Whether to just filter out the naughtyness
Default value boolean-false
Type boolean

Returns…

Description Same as input string
Type string

Return to the function index for this class Expand: View the source code to this function

string filter_naughty_harsh(string in, boolean preg)

This function is similar to filter_naughty, except it requires the parameter to be strictly alphanumeric. It is intended for use on text that will be put into an eval.

Parameters…

Name in
Description String to test
Type string

Name preg
Description Whether to just filter out the naughtyness
Default value boolean-false
Type boolean

Returns…

Description Same as input string
Type string

Return to the function index for this class Expand: View the source code to this function

~LONG_TEXT file_get_contents(SHORT_TEXT filename, integer type)

Get the contents of a file.

Parameters…

Name filename
Description The file name.
Type SHORT_TEXT

Name type
Description Either FILE_TEXT or FILE_BINARY.
Default value 0
Type integer

Returns…

Description The file contents (false: error).
Type ~LONG_TEXT

Return to the function index for this class Expand: View the source code to this function

sources/global2.php

Global_functions_global2.php

Function summary

void init__global2 ()
mixed str_word_count (string input, integer format)
string html_entity_decode (string input, integer quote_style, ?string charset)
~string unichrm_hex (array matches)
~string unichrm (array matches)
~string unichr (integer c)
void debug_mode_aftertests ()
boolean can_fast_spider_cache ()
void fast_spider_cache (boolean bot)
void disable_php_memory_limit ()
string get_charset ()
void load_user_stuff ()
void catch_fatal_errors ()
boolean ocportal_error_handler (integer errno, PATH errstr, string errfile, integer errline)
boolean is_browser_decacheing ()
boolean running_script (string is_this_running)
void inform_exit (mixed text)
void warn_exit (mixed text)
void suggest_fatalistic ()
void fatal_exit (mixed text)
void log_hack_attack_and_exit (ID_TEXT reason, SHORT_TEXT reason_param_a, SHORT_TEXT reason_param_b, boolean silent)
boolean handle_has_checked_recently (ID_TEXT id_code)
integer make_seed ()
string ocp_version_full ()
string get_domain ()
string get_forum_type ()
URLPATH get_forum_base_url (boolean forum_base)
?string get_cookie_path ()
?string get_cookie_domain ()
integer get_cookie_days ()
string get_site_name ()
boolean in_safe_mode ()
URLPATH find_script (string name, boolean append_keep, integer base_url_code)
URLPATH get_base_url (?boolean https, ?ID_TEXT zone_for)
URLPATH get_custom_base_url (?boolean https)
URLPATH get_complex_base_url (URLPATH at)
?string either_param (ID_TEXT name, ?mixed default)
?string post_param (ID_TEXT name, ?mixed default, boolean html, boolean conv_from_wysiwyg)
?string get_param (ID_TEXT name, ?mixed default, boolean no_security)
string __param (array array, string name, ?mixed default, boolean integer, ?boolean posted)
boolean simulated_wildcard_match (string context, string word, boolean full_cover)
?integer either_param_integer (ID_TEXT name, ?mixed default)
?integer post_param_integer (ID_TEXT name, ?mixed default)
?integer get_param_integer (ID_TEXT name, ?mixed default, boolean not_string_ok)
string unixify_line_format (string in, ?ID_TEXT desired_charset, boolean html, boolean from_disk)
string javascript_enforce (string j, ?ID_TEXT theme, ?boolean minify)
tempcode javascript_tempcode (?string position)
void require_javascript (ID_TEXT javascript)
string css_enforce (string c, ?ID_TEXT theme, ?boolean minify)
tempcode css_tempcode (boolean inline, boolean only_global, ?string context, ?ID_TEXT theme)
void require_css (ID_TEXT css)
void sync_file (PATH filename)
void sync_file_move (PATH old, PATH new)
void convert_data_encodings (boolean known_utf8)
boolean will_be_unicode_neutered (string data)

void init__global2()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

mixed str_word_count(string input, integer format)

Isolate the words in the input string.

Parameters…

Name input
Description String to count words in
Type string

Name format
Description The format
Default value 0
Type integer
Values restricted to 0 1 2

Returns…

Description Typically a list - the words of the input string
Type mixed

Return to the function index for this class Expand: View the source code to this function

string html_entity_decode(string input, integer quote_style, ?string charset)

Decode the HTML entitity encoded input string.

Parameters…

Name input
Description The text to decode
Type string

Name quote_style
Description The quote style code
Type integer

Name charset
Description Character set to decode to (NULL: default)
Default value
Type ?string

Returns…

Description The decoded text
Type string

Return to the function index for this class Expand: View the source code to this function

~string unichrm_hex(array matches)

Convert a unicode character number to a unicode string. Callback for preg_replace.

Parameters…

Name matches
Description Regular expression match array.
Type array

Returns…

Description Converted data (false: could not convert).
Type ~string

Return to the function index for this class Expand: View the source code to this function

~string unichrm(array matches)

Convert a unicode character number to a unicode string. Callback for preg_replace.

Parameters…

Name matches
Description Regular expression match array.
Type array

Returns…

Description Converted data (false: could not convert).
Type ~string

Return to the function index for this class Expand: View the source code to this function

~string unichr(integer c)

Convert a unicode character number to a HTML-entity enabled string, using lower ASCII characters where possible.

Parameters…

Name c
Description Character number.
Type integer

Returns…

Description Converted data (false: could not convert).
Type ~string

Return to the function index for this class Expand: View the source code to this function

void debug_mode_aftertests()

Run after-tests for debug mode, to make sure coding standards are met.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

boolean can_fast_spider_cache()

Find if we can use the fast spider cache.

Parameters…

Returns…

Description Whether we can
Type boolean

Return to the function index for this class Expand: View the source code to this function

void fast_spider_cache(boolean bot)

If possible dump the user to 100% static caching.

Parameters…

Name bot
Description Whether to cache as a bot
Default value boolean-true
Type boolean

(No return value)


Return to the function index for this class Expand: View the source code to this function

void disable_php_memory_limit()

Disable the PHP memory limit. Do not use this carelessly, use it if a screen is a bit fat or in an importer, don't use it assuming memory is infinite.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

string get_charset()

Get the character set to use. We try and be clever to allow AJAX scripts to avoid loading up language

Parameters…

Returns…

Description The character set
Type string

Return to the function index for this class Expand: View the source code to this function

void load_user_stuff()

Load stuff that allows user code to work.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

void catch_fatal_errors()

ocPortal error catcher for fatal versions. This is hooked in only on PHP5.2 as error_get_last() only works on these versions.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

boolean ocportal_error_handler(integer errno, PATH errstr, string errfile, integer errline)

ocPortal error handler (hooked into PHP error system).

Parameters…

Name errno
Description The error code-number
Type integer

Name errstr
Description The error message
Type PATH

Name errfile
Description The file the error occurred in
Type string

Name errline
Description The line the error occurred on
Type integer

Returns…

Description Always false
Type boolean

Return to the function index for this class Expand: View the source code to this function

boolean is_browser_decacheing()

Find whether the browser session is set to be doing a hard cache-empty refresh.

Parameters…

Returns…

Description Whether the browser session is set to be doing a hard cache-empty refresh
Type boolean

Return to the function index for this class Expand: View the source code to this function

boolean running_script(string is_this_running)

Find whether a certain script is being run to get here.

Parameters…

Name is_this_running
Description Script filename (canonically we want NO .php file type suffix)
Type string

Returns…

Description Whether the script is running
Type boolean

Return to the function index for this class Expand: View the source code to this function

void inform_exit(mixed text)

This is a intended to output an informational exit at the same time as terminating execution

Parameters…

Name text
Description The error message (string or tempcode)
Type mixed

(No return value)


Return to the function index for this class Expand: View the source code to this function

void warn_exit(mixed text)

This is a less-revealing alternative to fatal_exit, that is used for user-errors/common-corruption-scenarios

Parameters…

Name text
Description The error message (string or tempcode)
Type mixed

(No return value)


Return to the function index for this class Expand: View the source code to this function

void suggest_fatalistic()

Give the user an option to see a stack trace by adding in a link, but only if they have permission

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

void fatal_exit(mixed text)

Do a fatal exit, echo the header (if possible) and an error message, followed by a debugging back-trace.It also adds an entry to the error log, for reference.

Parameters…

Name text
Description The error message (string or tempcode)
Type mixed

(No return value)


Return to the function index for this class Expand: View the source code to this function

void log_hack_attack_and_exit(ID_TEXT reason, SHORT_TEXT reason_param_a, SHORT_TEXT reason_param_b, boolean silent)

Log a hackattack, then displays an error message. It also attempts to send an e-mail to the staff alerting them of the hackattack.

Parameters…

Name reason
Description The reason for the hack attack. This has to be a language string codename
Type ID_TEXT

Name reason_param_a
Description A parameter for the hack attack language string (this should be based on a unique ID, preferably)
Default value
Type SHORT_TEXT

Name reason_param_b
Description A more illustrative parameter, which may be anything (e.g. a title)
Default value
Type SHORT_TEXT

Name silent
Description Whether to silently log the hack rather than also exiting
Default value boolean-false
Type boolean

(No return value)


Return to the function index for this class Expand: View the source code to this function

boolean handle_has_checked_recently(ID_TEXT id_code)

Use the url_title_cache table (a bit of a hack but saved changed the DB structure) to see if a check-op was performed has been performed within the last 30 days.

Parameters…

Name id_code
Description Special check code (often a URL but does not need to be).
Type ID_TEXT

Returns…

Description Whether the check has happened recently.
Type boolean

Return to the function index for this class Expand: View the source code to this function

integer make_seed()

A custom random number seed generator. It returns a random number seed.

Parameters…

Returns…

Description A random seed
Type integer

Return to the function index for this class Expand: View the source code to this function

string ocp_version_full()

Get the full string version of ocPortal that you are running.

Parameters…

Returns…

Description The string saying the full ocPortal version number
Type string

Return to the function index for this class Expand: View the source code to this function

string get_domain()

Get the domain the website is installed on (preferably, without any www). The domain is used for e-mail defaults amongst other things.

Parameters…

Returns…

Description The domain of the website
Type string

Return to the function index for this class Expand: View the source code to this function

string get_forum_type()

Get the type of forums installed.

Parameters…

Returns…

Description The type of forum installed
Type string

Return to the function index for this class Expand: View the source code to this function

URLPATH get_forum_base_url(boolean forum_base)

Get the installed forum base URL.

Parameters…

Name forum_base
Description Whether to get the base directory of the forum. Unless running OCF, this makes no difference - if possibly running OCF, you need to think about this parameter: are you trying to reach the MSN-central-site or just a link to the forums?
Default value boolean-false
Type boolean

Returns…

Description The installed forum base URL
Type URLPATH

Return to the function index for this class Expand: View the source code to this function

?string get_cookie_path()

Get the ocPortal cookie path.

Parameters…

Returns…

Description The ocPortal cookie path (NULL: no special path, global)
Type ?string

Return to the function index for this class Expand: View the source code to this function

?string get_cookie_domain()

Get the ocPortal cookie domain.

Parameters…

Returns…

Description The ocPortal cookie domain (NULL: current domain)
Type ?string

Return to the function index for this class Expand: View the source code to this function

integer get_cookie_days()

Get the number of days to store our cookies.

Parameters…

Returns…

Description The number of days to store our cookies
Type integer

Return to the function index for this class Expand: View the source code to this function

string get_site_name()

Get the site name.

Parameters…

Returns…

Description The name of the site
Type string

Return to the function index for this class Expand: View the source code to this function

boolean in_safe_mode()

Find whether we are running in safe mode.

Parameters…

Returns…

Description Whether we are in safe mode
Type boolean

Return to the function index for this class Expand: View the source code to this function

URLPATH find_script(string name, boolean append_keep, integer base_url_code)

Find the URL to a certain external handler script (ocPortal allows these to be moved around between zones, to suit site .htaccess requirements).

Parameters…

Name name
Description The codename of the needed script
Type string

Name append_keep
Description Whether to append keep variables
Default value boolean-false
Type boolean

Name base_url_code
Description Code representing what base URL type to use (0=guess, 1=http, 2=https)
Default value 0
Type integer
Values restricted to 0 1 2

Returns…

Description The URL to the script
Type URLPATH

Return to the function index for this class Expand: View the source code to this function

URLPATH get_base_url(?boolean https, ?ID_TEXT zone_for)

Get the base url (the minimum fully qualified URL to our installation).

Parameters…

Name https
Description Whether to get the HTTPS base URL (NULL: do so only if the current page uses the HTTPS base URL)
Default value
Type ?boolean

Name zone_for
Description The zone the link is for (NULL: root zone)
Default value
Type ?ID_TEXT

Returns…

Description The base-url
Type URLPATH

Return to the function index for this class Expand: View the source code to this function

URLPATH get_custom_base_url(?boolean https)

Get the base url (the minimum fully qualified URL to our personal data installation). For a shared install only, this is different to the base-url.

Parameters…

Name https
Description Whether to get the HTTPS base URL (NULL: do so only if the current page uses the HTTPS base URL)
Default value
Type ?boolean

Returns…

Description The base-url
Type URLPATH

Return to the function index for this class Expand: View the source code to this function

URLPATH get_complex_base_url(URLPATH at)

Function to get a base URL for an OCF relative-URL. The situation is complex as it needs to take into account OCF multi-site-network's, locally defined theme images, and shared-installs (myocp style).

Parameters…

Name at
Description Short base URL we need to probe
Type URLPATH

Returns…

Description The appropriate base-url
Type URLPATH

Return to the function index for this class Expand: View the source code to this function

?string either_param(ID_TEXT name, ?mixed default)

Get a value (either POST or GET), or the default if neither can be found.

Parameters…

Name name
Description The name of the parameter to get
Type ID_TEXT

Name default
Description The default value to give the parameter if the parameter value is not defined (NULL: allow missing parameter) (false: give error on missing parameter)
Default value boolean-false
Type ?mixed

Returns…

Description The parameter value (NULL: missing)
Type ?string

Return to the function index for this class Expand: View the source code to this function

?string post_param(ID_TEXT name, ?mixed default, boolean html, boolean conv_from_wysiwyg)

Get the value of the specified POST key, if it is found, or the default otherwise.

Parameters…

Name name
Description The name of the parameter to get
Type ID_TEXT

Name default
Description The default value to give the parameter if the parameter value is not defined (NULL: allow missing parameter) (false: give error on missing parameter)
Default value boolean-false
Type ?mixed

Name html
Description Whether we are cleaning for HTML rather than Comcode/plain-text
Default value boolean-false
Type boolean

Name conv_from_wysiwyg
Description Whether to convert WYSIWYG contents to Comcode automatically
Default value boolean-true
Type boolean

Returns…

Description The parameter value (NULL: missing)
Type ?string

Return to the function index for this class Expand: View the source code to this function

?string get_param(ID_TEXT name, ?mixed default, boolean no_security)

Get the value of the specified GET key, if it is found, or the default otherwise.

Parameters…

Name name
Description The name of the parameter to get
Type ID_TEXT

Name default
Description The default value to give the parameter if the parameter value is not defined (NULL: allow missing parameter) (false: give error on missing parameter)
Default value boolean-false
Type ?mixed

Name no_security
Description Whether to skip the security check
Default value boolean-false
Type boolean

Returns…

Description The parameter value (NULL: missing)
Type ?string

Return to the function index for this class Expand: View the source code to this function

string __param(array array, string name, ?mixed default, boolean integer, ?boolean posted)

Helper function to load up a GET/POST parameter.

Parameters…

Name array
Description The array we're extracting parameters from
Type array

Name name
Description The name of the parameter
Type string

Name default
Description The default value to give the parameter if the parameter value is not defined (NULL: allow missing parameter) (false: give error on missing parameter)
Type ?mixed

Name integer
Description Whether the parameter has to be an integer
Default value boolean-false
Type boolean

Name posted
Description Whether the parameter is a POST parameter (NULL: undetermined)
Default value boolean-false
Type ?boolean

Returns…

Description The value of the parameter
Type string

Return to the function index for this class Expand: View the source code to this function

boolean simulated_wildcard_match(string context, string word, boolean full_cover)

Do a wildcard match by converting to a regular expression.

Parameters…

Name context
Description The haystack
Type string

Name word
Description The needle (a wildcard expression)
Type string

Name full_cover
Description Whether full-coverance is required
Default value boolean-false
Type boolean

Returns…

Description Whether we have a match
Type boolean

Return to the function index for this class Expand: View the source code to this function

?integer either_param_integer(ID_TEXT name, ?mixed default)

This function is the integeric partner of either_param, as it returns the value as an integer.You should always use integer specified versions when inputting integers, for the added security that type validation allows. If the value is of the wrong type, it indicates a hack attempt and will be logged.

Parameters…

Name name
Description The name of the parameter to get
Type ID_TEXT

Name default
Description The default value to give the parameter if the parameter value is not defined or the empty string (NULL: allow missing parameter) (false: give error on missing parameter)
Default value boolean-false
Type ?mixed

Returns…

Description The parameter value (NULL: not set, and NULL given as default)
Type ?integer

Return to the function index for this class Expand: View the source code to this function

?integer post_param_integer(ID_TEXT name, ?mixed default)

This function is the integeric partner of post_param, as it returns the value as an integer.

Parameters…

Name name
Description The name of the parameter to get
Type ID_TEXT

Name default
Description The default value to give the parameter if the parameter value is not defined or the empty string (NULL: allow missing parameter) (false: give error on missing parameter)
Default value boolean-false
Type ?mixed

Returns…

Description The parameter value (NULL: not set, and NULL given as default)
Type ?integer

Return to the function index for this class Expand: View the source code to this function

?integer get_param_integer(ID_TEXT name, ?mixed default, boolean not_string_ok)

This function is the integeric partner of get_param, as it returns the value as an integer.

Parameters…

Name name
Description The name of the parameter to get
Type ID_TEXT

Name default
Description The default value to give the parameter if the parameter value is not defined or the empty string (NULL: allow missing parameter) (false: give error on missing parameter)
Default value boolean-false
Type ?mixed

Name not_string_ok
Description If a string is given, use the default parameter rather than giving an error (only use this if you are suffering from a parameter conflict situation between different parts of ocPortal)
Default value boolean-false
Type boolean

Returns…

Description The parameter value (NULL: not set, and NULL given as default)
Type ?integer

Return to the function index for this class Expand: View the source code to this function

string unixify_line_format(string in, ?ID_TEXT desired_charset, boolean html, boolean from_disk)

Make sure that lines are seperated by chr(10), with no chr(13)'s there at all. For Mac data, this will be a flip scenario. For Linux data this will be a null operation. For windows data this will be change from chr(13).chr(10) to just chr(10). For a realistic scenario, data could have originated on all kinds of platforms, with some editors converting, some situations being inter-platform, and general confusion. Don't make blind assumptions - use this function to clean data, then write clean code that only considers chr(10)'s.

Parameters…

Name in
Description The data to clean
Type string

Name desired_charset
Description The character set it should be in. We don't do any real conversions using this, only make sure that common problems with fed ISO-8859-1 data are resolved (NULL: output character set)
Default value
Type ?ID_TEXT

Name html
Description Whether we are cleaning for HTML rather than Comcode/plain-text
Default value boolean-false
Type boolean

Name from_disk
Description Whether the file is loaded from disk (less conversion needed)
Default value boolean-false
Type boolean

Returns…

Description The cleaned data
Type string

Return to the function index for this class Expand: View the source code to this function

string javascript_enforce(string j, ?ID_TEXT theme, ?boolean minify)

Force a Javascript file to be cached (ordinarily we can rely on this to be automated by require_javascript/javascript_tempcode).

Parameters…

Name j
Description The javascript file required
Type string

Name theme
Description The name of the theme (NULL: current theme)
Default value
Type ?ID_TEXT

Name minify
Description Whether to minify (NULL: read from environment)
Default value
Type ?boolean

Returns…

Description The path to the javascript file in the cache (blank: no file)
Type string

Return to the function index for this class Expand: View the source code to this function

tempcode javascript_tempcode(?string position)

Get tempcode to tie in (to the HTML, in <head>) all the Javascript files that have been required.

Parameters…

Name position
Description Position to get Javascript for (NULL: all positions)
Default value
Type ?string
Values restricted to NULL header footer

Returns…

Description The tempcode to tie in the Javascript files
Type tempcode

Return to the function index for this class Expand: View the source code to this function

void require_javascript(ID_TEXT javascript)

Make sure that the given javascript file is loaded up.

Parameters…

Name javascript
Description The javascript file required
Type ID_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

string css_enforce(string c, ?ID_TEXT theme, ?boolean minify)

Force a CSS file to be cached.

Parameters…

Name c
Description The CSS file required
Type string

Name theme
Description The name of the theme (NULL: current theme)
Default value
Type ?ID_TEXT

Name minify
Description Whether to minify (NULL: read from environment)
Default value
Type ?boolean

Returns…

Description The path to the CSS file in the cache (blank: no file)
Type string

Return to the function index for this class Expand: View the source code to this function

tempcode css_tempcode(boolean inline, boolean only_global, ?string context, ?ID_TEXT theme)

Get tempcode to tie in (to the HTML, in <head>) all the CSS files that have been required.

Parameters…

Name inline
Description Force inline CSS
Default value boolean-false
Type boolean

Name only_global
Description Only do global CSS
Default value boolean-false
Type boolean

Name context
Description HTML context for which we filter (minimise) any CSS we spit out as inline (NULL: none)
Default value
Type ?string

Name theme
Description The name of the theme (NULL: current theme)
Default value
Type ?ID_TEXT

Returns…

Description The tempcode to tie in the CSS files
Type tempcode

Return to the function index for this class Expand: View the source code to this function

void require_css(ID_TEXT css)

Make sure that the given CSS file is loaded up.

Parameters…

Name css
Description The CSS file required
Type ID_TEXT

(No return value)


Return to the function index for this class Expand: View the source code to this function

void sync_file(PATH filename)

Provides a hook for file synchronisation between mirrored servers. Called after any file creation, deletion or edit.

Parameters…

Name filename
Description File/directory name to sync on (full path)
Type PATH

(No return value)


Return to the function index for this class Expand: View the source code to this function

void sync_file_move(PATH old, PATH new)

Provides a hook for file-move synchronisation between mirrored servers. Called after any rename or move action.

Parameters…

Name old
Description File/directory name to move from (may be full or relative path)
Type PATH

Name new
Description File/directory name to move to (may be full or relative path)
Type PATH

(No return value)


Return to the function index for this class Expand: View the source code to this function

void convert_data_encodings(boolean known_utf8)

Performs lots of magic to make sure data encodings are converted correctly. Input, and output too (as often stores internally in UTF or performs automatic dynamic conversions from internal to external charsets).Roll on PHP6 that has a true internal UTF string model. For now, anyone who uses UTF will get some (albeit minor) imperfections from PHP's manipulations of the strings.

Parameters…

Name known_utf8
Description Whether we know we are working in UTF-8. This is the case for AJAX calls.
Default value boolean-false
Type boolean

(No return value)


Return to the function index for this class Expand: View the source code to this function

boolean will_be_unicode_neutered(string data)

Guard for entity_utf8_decode. Checks that the data can be stripped so there is no unicode left. Either the htmlentities function must convert mechanically to entity-characters or all higher ascii character codes (which are actually unicode control codes in a unicode interpretation) that are used happen to be linked to named entities.

Parameters…

Name data
Description Data to check.
Type string

Returns…

Description Whether we are good to execute entity_utf8_decode.
Type boolean

Return to the function index for this class Expand: View the source code to this function