Procedural File: lib.php
Source Location: /lib.php
Page Details
Contains support functions used by PivotX.
Includes
require_once
($pivotx_path.'includes/preload.php')
[line 59]
require_once
($pivotx_path.'offline.php')
[line 80]
require_once
($pivotx_path.'modules/module_direct.php')
[line 75]
Constants
INPIVOTX [line 21]
Contains support functions used by PivotX.
Functions
addDirToZip [line 2520]
void addDirToZip(
&$zipfile, string $dirname, [mixed $exclude = ''], string $zipfile
)
|
|
Adds a directory (recursively) to a zip file.
Parameters:
|
string |
$zipfile: |
|
|
string |
$dirname: |
|
|
mixed |
$exclude: |
Directories to be exluded |
|
|
&$zipfile: |
|
addFileToZip [line 2507]
void addFileToZip(
&$zipfile, string $filename, string $zipfile
)
|
|
Adds a file to a zip file.
Parameters:
|
string |
$zipfile: |
|
|
string |
$filename: |
|
|
|
&$zipfile: |
|
addltgt [line 3707]
string addltgt(
string $i
)
|
|
Replaces > / < with &gt; / &lt; in the text $i.
Parameters:
addTrailingSlash [line 3354]
string addTrailingSlash(
string $path
)
|
|
Ensures that a path has a trailing slash
Parameters:
archivenameToDates [line 3496]
void archivenameToDates(
unknown_type $name
)
|
|
Get the start and enddate for an archivename like '2007-10' or '2006-w32'
Parameters:
arrayToJson [line 5541]
Convert a PHP-array to JSON formatted string.
Parameters:
API Tags:
backup [line 2544]
Downloads the configuration files, templates or entries database.
Parameters:
checkDB [line 648]
boolean checkDB(
[string $sites_path = '']
)
|
|
Check if the 'db' folder and the most important files are writable.
Note: if they don't exist, it's ok: if the folder is writable, PivotX can create them.
Parameters:
checkPaths [line 706]
Checks that the templates, upload and sub-db directories exist and are writable.
It will try to create the directories if possible.
checkVersion [line 900]
boolean checkVersion(
string $currentversion, string $requiredversion
)
|
|
Compares versions of software.
Versions should use the "MAJOR.MINOR.EDIT" scheme, or in other words the format "x.y.z" where (x, y, z) are numbers in [0-9].
Parameters:
|
string |
$currentversion: |
|
|
string |
$requiredversion: |
|
check_version [line 5306]
void check_version(
$currentversion, $requiredversion
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
|
|
$currentversion: |
|
|
|
$requiredversion: |
|
API Tags:
chmodFile [line 4483]
void chmodFile(
$filename
)
|
|
Chmods a file (according to the configuration).
Parameters:
chmod_file [line 5468]
void chmod_file(
$filename
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
cleanAttributes [line 2161]
string cleanAttributes(
string $str
)
|
|
Clean strings to be used as (X)HTML attributes - strip tags and entify ampersands and quotes.
Parameters:
cleanParams [line 2177]
array cleanParams(
array $params
)
|
|
Clean smarty params: strip quotes and HTML entities
Parameters:
cleanPath [line 2147]
Cleans idiotic and unsafe parts of a path.
We can't use realpath since the path can be relative.
Parameters:
cleanUserInput [line 2121]
Clean several keys with values supplied by the user in the $_GET, $_POST, $_REQUEST and $_COOKIE super globals.
clean_params [line 5342]
void clean_params(
$params
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
commentFormat [line 4110]
string commentFormat(
string $text, [ $striplinebreaks = false]
)
|
|
Formats comments according the settings for the current weblog.
We strip _all_ tags except <b> and <i> and after that we convert everything that looks like a url or mail-address to the equivalent link (if enabled). Using textile if enabled.
Parameters:
|
string |
$text: |
|
|
|
$striplinebreaks: |
|
comment_format [line 5522]
void comment_format(
$text, [ $striplinebreaks = false]
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
decodeText [line 3867]
string decodeText(
string $text, [string $level = 'minimal']
)
|
|
Decodes text using different levels. (Opposite of encode_text.)
Currently 'minimal' and 'special' is supported. The later is the same as reverting htmlspecialchars (with ENT_QUOTES). 'minimal' behaves as 'special' except that "<" / ">" is left untouched.
Parameters:
|
string |
$text: |
|
|
string |
$level: |
|
displayPage [line 236]
Determines which page needs to be shown, and calls the handler for that page
emoticonize [line 3576]
string emoticonize(
string $text
)
|
|
Convert textual emoticons into their graphical counterpart.
Parameters:
encodeMailLink [line 3921]
string encodeMailLink(
string $mail, string $text, [string $title = ""], [boolean $encrypt = false]
)
|
|
Creates a Javascript encoded mailto link.
If encoding of email addresses is disabled in the weblog config and $encrypt is false, it outputs a plain HTML mailto link.
Parameters:
|
string |
$mail: |
|
|
string |
$text: |
Text of mailto link. |
|
string |
$title: |
Title for the mailto link. |
|
boolean |
$encrypt: |
|
encodemail_link [line 5532]
void encodemail_link(
$mail, $text, [ $title = ""], [ $encrypt = false]
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
|
|
$mail: |
|
|
|
$text: |
|
|
|
$title: |
|
|
|
$encrypt: |
|
API Tags:
encodeText [line 3896]
string encodeText(
string $text, [string $level = 'minimal']
)
|
|
Encodes text using different levels.
Currently 'minimal' and 'special' is supported. The later is the same as htmlspecialchars (with ENT_QUOTES). 'minimal' behaves as 'special' except that "<" / ">" is left untouched.
Parameters:
|
string |
$text: |
|
|
string |
$level: |
|
entify [line 3650]
string entify(
string $i
)
|
|
Converts all applicable characters, encoded in UTF-8, to HTML entities.
Currently the function does nothing for PHP version prior to 4.3.0.
Parameters:
entifyAmpersand [line 3693]
string entifyAmpersand(
string $i
)
|
|
Replaces & (which isn't part of an HTML entity) with & in the text $i.
Parameters:
entifyQuotes [line 3678]
string entifyQuotes(
string $i
)
|
|
Replaces ' / " with ' / " in the text $i.
Parameters:
filearray_sort [line 5369]
void filearray_sort(
$a, $b
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
fileOperations [line 1364]
void fileOperations(
string $folder
)
|
|
Do basic operations for the file explorers: create files/folder, delete files, duplicate files.
Parameters:
fixDate [line 3286]
string fixDate(
string $date, string $time
)
|
|
Merges a split date (using European day/month ordering for input) and returns the date in standard PivotX format.
Parameters:
|
string |
$date: |
|
|
string |
$time: |
|
fixPath [line 3305]
string fixPath(
string $path, [ $nodoubleleadingslashes = false]
)
|
|
Cleans up/fixes a relative paths.
As an example '/site/pivotx/../index.php' becomes '/site/index.php'. In addition (non-leading) double slashes are removed.
Parameters:
|
string |
$path: |
|
|
|
$nodoubleleadingslashes: |
|
fix_date [line 5414]
void fix_date(
$date, $time
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
formatDate [line 2996]
string formatDate(
[string $date = ""], [string $format = ""], [string $title = ""]
)
|
|
Formats date, according to the passed $format
Parameters:
|
string |
$date: |
|
|
string |
$format: |
|
|
string |
$title: |
|
formatDateFuzzy [line 3070]
string formatDateFuzzy(
string $date
)
|
|
Formats the date as a 'fuzzy date', like 'yesterday evening' or 'on wednesday'.
Most os this is taken from Graham Keellings 'fuzzy date snippet'. See here for details: http://www.keellings.com/graham/software/pivot.php
Parameters:
formatDateRange [line 3168]
string formatDateRange(
string $start_date, string $end_date, string $format
)
|
|
Formats date range, according to the passed format
Parameters:
|
string |
$start_date: |
|
|
string |
$end_date: |
|
|
string |
$format: |
|
formatEntry [line 2971]
string formatEntry(
array $entry, string $format
)
|
|
Formats all data in an entry according to the passed $format.
Parameters:
|
array |
$entry: |
|
|
string |
$format: |
|
formatFilename [line 1531]
void formatFilename(
string $filename, [boolean $include_dirs = false], [string $dir_delimiter = ' ']
)
|
|
Tries to format a filename in a nice way.
Parameters:
|
string |
$filename: |
|
|
boolean |
$include_dirs: |
|
|
string |
$dir_delimiter: |
$return string |
formatFilesize [line 1511]
string formatFilesize(
integer $size
)
|
|
Format a filesize like '10.3 kb' or '2.5 mb'
Parameters:
format_date [line 5396]
void format_date(
[ $date = ""], [ $format = ""], [ $title = ""]
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
format_date_range [line 5405]
void format_date_range(
$start_date, $end_date, $format
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
|
|
$start_date: |
|
|
|
$end_date: |
|
|
|
$format: |
|
API Tags:
format_entry [line 5387]
void format_entry(
$entry, $format
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
getAttrValue [line 3601]
void getAttrValue(
string $att_name, string $attributes
)
|
|
Searches in (HTML) text for the value of a attribute.
For example, after calling:
my_value will contain 12
Parameters:
|
string |
$att_name: |
Name of attribuite to find the value of |
|
string |
$attributes: |
Text which contains the attribute set to a value |
getCurrentDate [line 4777]
adapted from an article by Allan Kent on phpbuilder.com this function takes the current system time and date, and offsets it to get the time and date we want to output to our users.
getDateRange [line 3447]
void getDateRange(
$date, $unit
)
|
|
Parameters:
getDaysInMonth [line 3418]
integer getDaysInMonth(
integer $month, integer $year
)
|
|
Calculates the number of days in a month, taking into account leap years.
Code adapted from the Calendar class/extension.
Parameters:
|
integer |
$month: |
|
|
integer |
$year: |
|
getDefault [line 1608]
mixed getDefault(
mixed $a, mixed $b, [boolean $strict = false]
)
|
|
Helper function to get defaults from smarty functions. If $a is defined it returns that, else it returns $b. If $strict=true, it will also return $a, if it is a string with value '0' or an integer with value 0.
Parameters:
|
mixed |
$a: |
|
|
mixed |
$b: |
|
|
boolean |
$strict: |
|
getEditCommentLink [line 4053]
string getEditCommentLink(
[integer $uid = 0], $number, integer $count
)
|
|
Get the link to edit or delete comments directly from the entrypage.
Parameters:
|
integer |
$uid: |
|
|
integer |
$count: |
|
|
|
$number: |
|
getEditlink [line 4026]
string getEditlink(
$name, integer $uid, string $prefix, string $postfix, [string $type = "entry"], string $text
)
|
|
Get the link to edit an entry directly from the frontpage.
Parameters:
|
string |
$text: |
|
|
integer |
$uid: |
|
|
string |
$prefix: |
|
|
string |
$postfix: |
|
|
string |
$type: |
|
|
|
$name: |
|
getEditTrackbackLink [line 4080]
string getEditTrackbackLink(
[integer $uid = 0], $number, integer $count
)
|
|
Get the link to edit or delete trackbacks directly from the entrypage.
Parameters:
|
integer |
$uid: |
|
|
integer |
$count: |
|
|
|
$number: |
|
getExtension [line 2861]
string getExtension(
string $filename
)
|
|
Gets the extension (if any) of a filename.
Parameters:
getFiles [line 1217]
void getFiles(
string $basepath, string $additionalpath, string $imageurl, string $imagepath
)
|
|
Gets a list of files to display in the template. It also sets some other things, like used paths, and whether or not the current folder is writable.
Parameters:
|
string |
$basepath: |
|
|
string |
$additionalpath: |
|
|
string |
$imageurl: |
|
|
string |
$imagepath: |
|
getHost [line 830]
string getHost(
[ $host = '']
)
|
|
Get the current hostname or parse it out of an URL.
Try to be as liberal as possible, to prevent unexpected results. These three will all give http://www.example.org as result: www.example.org, http://www.example.org, http://www.example.org/index.html
Parameters:
getMem [line 876]
Get the amount of used memory, if memory_get_usage is defined.
getMicrotime [line 3251]
Gets current Unix timestamp (in seconds) with microseconds, as a float.
getPivotxURL [line 766]
Returns and sets the URL at which PivotX resides.
The URL is only set when a user is logged in/using the admin side of PivotX to avoid problems with servers reporting wrong URLs (when using mod_rewrite in particular). When running Multi-site the config object isn't set first time this function is called.
getRemoteFile [line 1479]
string getRemoteFile(
string $url
)
|
|
Get a file over HTTP. First try file_get_contents, and if that fails try curl.
Parameters:
getRfcDate [line 3228]
string getRfcDate(
string $time
)
|
|
Get a date in RFC 2822 format, which is _not_ localised!!
Parameters:
API Tags:
getSimpleAggregate [line 1875]
void getSimpleAggregate(
string $key, string $value, array $array, [bool $implode = false]
)
|
|
Create a simple aggregated array, with $key as keys and $value as an array of values. If $implode is true, it implodes the values to a string
Parameters:
|
string |
$key: |
|
|
string |
$value: |
|
|
array |
$array: |
|
|
bool |
$implode: |
|
getSimpleList [line 1841]
void getSimpleList(
string $key, array $array, [bool $implode = false]
)
|
|
Get a simple list of values from a multi-dimensional array
Parameters:
|
string |
$key: |
|
|
array |
$array: |
|
|
bool |
$implode: |
|
getSvnRevision [line 223]
integer getSvnRevision(
)
|
|
Returns our SVN Revision number
getUploadFolderUrl [line 2748]
void getUploadFolderUrl(
[ $basefilename = '']
)
|
|
Get the upload folder url (relative to images/)
Parameters:
get_attr_value [line 5423]
void get_attr_value(
$att_name, $attributes
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
get_current_date [line 5504]
Deprecated function. Kept for backwards compatibility.
API Tags:
get_default [line 5333]
void get_default(
$a, $b, [ $strict = false]
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
get_editcommentlink [line 5513]
void get_editcommentlink(
[ $uid = 0], $number
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
implodeDeep [line 2253]
string implodeDeep(
string $glue, mixed $value
)
|
|
Implode an array recursively
Parameters:
|
string |
$glue: |
|
|
mixed |
$value: |
|
implode_deep [line 5360]
void implode_deep(
$glue, $value
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
initEmoticons [line 3550]
Load the translation table that is used to convert textual emoticons to their graphical counterpart
initializePivotX [line 95]
void initializePivotX(
[ $loadextensions = true]
)
|
|
Initializes PivotX: set up the global $PIVOTX object.
(Form will be initialized when needed, Smarty is initialized in modules/module_smarty.php)
Parameters:
isBase64Encoded [line 5236]
void isBase64Encoded(
string $str
)
|
|
Check if a given string is base64 encoded.
Parameters:
isChrome [line 5184]
Simple check to see if the current browser is Chrome or not
isEmail [line 2793]
boolean isEmail(
string $theAdr
)
|
|
Checks if the text is a valid email address.
Given a chain it returns true if $theAdr conforms to RFC 2822. It does not check the existence of the address. Suppose a mail of the form addr-spec = local-part "@" domain
local-part = dot-atom / quoted-string / obs-local-part
dot-atom = [CFWS] dot-atom-text [CFWS]
dot-atom-text = 1*atext *("." 1*atext)
atext = ALPHA / DIGIT / ; Any character except controls,
"!" / "#" / "$" / "%" / ; SP, and specials.
"&" / "'" / "*" / "+" / ; Used for atoms
"-" / "/" / "=" / "?" /
"^" / "_" / "`" / "{" /
"|" / "}" / "~" / "." /
Parameters:
isInstalled [line 208]
Checks whether PivotX is installed/setup.
isMobile [line 5097]
Determine if the current browser is a mobile device or not.
adapted from: http://www.russellbeattie.com/blog/mobile-browser-detection-in-php
isSecureConn [line 5077]
Determine if the current connection is secure, i.e., using the HTTPS protocol.
isTablet [line 5170]
Determine if the current browser is a tablet device or not.
For now this is specific for iPads, but more devices can be added, once they are on the market.
isUrl [line 2848]
boolean isUrl(
string $url
)
|
|
Checks whether the text is an URL or not.
Parameters:
isWordHtml [line 3721]
Checks if text is HTML (crap) saved by/pasted from Microsoft word.
Parameters:
liberalUnserialize [line 1940]
void liberalUnserialize(
string $filename
)
|
|
Unserializes a serialised representation of arrays. It was designed to be as liberal as possible, parsing any information it can find.
Parameters:
Information Tags:
| Author: | Bob den Otter, www.twokings.nl |
| Version: | 0.2 |
liberal_unserialize [line 5432]
void liberal_unserialize(
$filename
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
loadSerialize [line 4293]
mixed loadSerialize(
string $filename, [boolean $silent = false]
)
|
|
Loads a serialized file, unserializes it, and returns it.
If the file isn't readable (or doesn't exist) or reading it fails, false is returned.
Parameters:
|
string |
$filename: |
|
|
boolean |
$silent: |
Set to true if you want an visible error. |
loadTemplate [line 1908]
string loadTemplate(
string $basename
)
|
|
Loads a given template.
Parameters:
load_serialize [line 5441]
void load_serialize(
$filename, [ $silent = false]
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
mailResetPasswordLink [line 2645]
boolean mailResetPasswordLink(
array $values
)
|
|
Sends a mail with a password reset link.
The input array $values should contain 'name', 'email', 'reset_id' and 'link'.
Parameters:
API Tags:
| Return: | True if we could send the mail, false otherwise. |
makeAdminPageLink [line 2702]
string makeAdminPageLink(
[string $page = '']
)
|
|
Make a link to an admin page.
Parameters:
makeArchiveArray [line 2461]
void makeArchiveArray(
[boolean $force = FALSE], string $unit
)
|
|
Sets the global variable $Archive_array used by several archive snippets.
Parameters:
|
string |
$unit: |
time unit for the archive. |
|
boolean |
$force: |
|
makeArchiveName [line 2477]
string makeArchiveName(
[string $date = ''], [string $this_weblog = ''], [string $archive_unit = 'month']
)
|
|
Makes archive name for a date, weblog and time unit.
Parameters:
|
string |
$date: |
|
|
string |
$this_weblog: |
|
|
string |
$archive_unit: |
- 'year', 'month' or 'week'. |
makeDir [line 3373]
boolean makeDir(
string $name
)
|
|
Recursively creates chmodded directories. Returns true on success, and false on failure.
NB! Directories are created with permission 777 - worldwriteable - unless you have set 'chmod_dir' to 0XYZ in the advanced config.
Parameters:
makeExcerpt [line 4707]
string makeExcerpt(
string $str, [int $length = 180], [ $hellip = false]
)
|
|
Make the 'excerpt', used for displaying entries and pages on the dashboard as well as on the Entries and Pages overview screens.
Parameters:
|
string |
$str: |
|
|
int |
$length: |
|
|
|
$hellip: |
|
makeJsVars [line 1188]
string; makeJsVars(
array $array
)
|
|
Convert a PHP array into an associative array for javascript..
Parameters:
makeKey [line 855]
string makeKey(
int $length
)
|
|
Makes a random key with the specified length.
Parameters:
makeThumbname [line 2896]
string makeThumbname(
string $filename
)
|
|
Creates a thumbnail name based on a give filename.
Parameters:
makeUploadFolder [line 2724]
string makeUploadFolder(
[string $basefilename = '']
)
|
|
Creates a folder for uploaded files.
Replaces "%year%", "%month%", "%username%", and "%firstletter%" (if present in the path specification) with the corresponding values.
Parameters:
API Tags:
| Return: | The name of the folder. |
makeURI [line 4599]
string makeURI(
string $str, [string $type = 'entry']
)
|
|
Modify a string, so that we can use it for URI's. Like safeString, but using hyphens instead of underscores.
Parameters:
|
string |
$str: |
|
|
string |
$type: |
|
makeValuepairs [line 1163]
void makeValuepairs(
array $array, string $key, string $value
)
|
|
Make a simple array consisting of key=>value pairs, that can be used in select-boxes in forms.
Parameters:
|
array |
$array: |
|
|
string |
$key: |
|
|
string |
$value: |
|
make_jsvars [line 5324]
void make_jsvars(
$array
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
make_thumbname [line 5378]
void make_thumbname(
$filename
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
make_valuepairs [line 5315]
void make_valuepairs(
$array, $key, $value
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
paraWeblogNeeded [line 1647]
boolean paraWeblogNeeded(
string $weblog, [array $categories = ""]
)
|
|
Check if the w parameter is needed in PivotX generated URL (for sites with multiple weblogs).
Parameters:
|
string |
$weblog: |
Weblog to be examined. |
|
array |
$categories: |
|
pivotxAdminRedirect [line 5200]
does pivotxAdminRedirect(
string $page, [mixed $args = false]
)
|
|
Easy way to redirect to other admin pages
Parameters:
|
string |
$page: |
page to redirect to (if false, we ignored it) |
|
mixed |
$args: |
either url arguments (as string) or an array which build an url from |
API Tags:
| Return: | not return (period) |
pivotxMail [line 2602]
void pivotxMail(
string $to, string $subject, string $message, [string $headers = ''], [string $additional_parameters = '']
)
|
|
Wrapper around PHP's standard mail function that sets the necessary headers for UTF-8 messages.
The function only supports text messages. The messages are sent base64 encoded (since there is no bultin PHP function for quoted printable). If no sender is set, the PivotX superadmin is set in the From field.
Parameters:
|
string |
$to: |
|
|
string |
$subject: |
|
|
string |
$message: |
|
|
string |
$headers: |
|
|
string |
$additional_parameters: |
|
pivotxMarkdown [line 3989]
string pivotxMarkdown(
string $str, [integer $with_smartypants = 0]
)
|
|
Wrapper for Markdown/SmartyPants
Parameters:
|
string |
$str: |
|
|
integer |
$with_smartypants: |
If equal to 4 SmartyPants is also used. |
pivotxTextile [line 3956]
string pivotxTextile(
string $str
)
|
|
Wrapper for Textile.
Parameters:
randomString [line 2676]
string randomString(
[integer $len = 12], [ $loweronly = false]
)
|
|
Produces a random string (with numbers and latin letters) of the given length.
Can be useful for generating passwords.
Parameters:
|
integer |
$len: |
|
|
|
$loweronly: |
|
relativeToAbsoluteURLS [line 5038]
string relativeToAbsoluteURLS(
string $link
)
|
|
convert relative URL's to absolute URL's. Used when we need an absolute path in RSS feeds.
Parameters:
removeExtension [line 2878]
void removeExtension(
string $filename
)
|
|
Removes the extension (if any) from a filename
Parameters:
|
string |
$filename: |
$return string |
renderErrorpage [line 432]
void renderErrorpage(
string $error, string $additionalinfo
)
|
|
Display our error page, if something goes wrong.
Parameters:
|
string |
$error: |
|
|
string |
$additionalinfo: |
|
renderTemplate [line 310]
void renderTemplate(
string $template, [array $page = ""]
)
|
|
Display template.
Parameters:
|
string |
$template: |
|
|
array |
$page: |
|
safeString [line 4513]
string safeString(
string $str, [boolean $strict = false], [ $extrachars = ""]
)
|
|
Returns a "safe" version of the given string - basically only US-ASCII and numbers. Needed because filenames and titles and such, can't use all characters.
Parameters:
|
string |
$str: |
|
|
boolean |
$strict: |
|
|
|
$extrachars: |
|
safe_string [line 5477]
void safe_string(
$str, [ $strict = false], [ $extrachars = ""]
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
|
|
$str: |
|
|
|
$strict: |
|
|
|
$extrachars: |
|
API Tags:
sanitizePostedEntry [line 945]
void sanitizePostedEntry(
$entry
)
|
|
Parameters:
sanitizePostedPage [line 1063]
void sanitizePostedPage(
$page
)
|
|
Parameters:
sanitizeTitle [line 923]
void sanitizeTitle(
$title
)
|
|
Sanitize titles for the bookmarklet: - Remove extra spaces and linebreaks.
- Remove common parts of titles that repeat the website's name.
example: " YouTube - Name of video " returns: "Name of video".
Parameters:
saveSerialize [line 4349]
void saveSerialize(
$filename, &$data
)
|
|
Parameters:
save_serialize [line 5450]
void save_serialize(
$filename, &$data
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
sendMailNotification [line 4817]
void sendMailNotification(
string $type, array $data
)
|
|
Sends notification for any type - currently only "entries", "comments" and "visitor_registration".
Parameters:
|
string |
$type: |
|
|
array |
$data: |
|
setError [line 489]
void setError(
[ $type = 'general'], string $error_msg, [string $sql_query = ""], integer $error_no
)
|
|
Custom error handler for the SQL object. We don't want to output the entire error message to the user, but instead print a slightly more helpful message without breaking the page layout.
Parameters:
|
string |
$error_msg: |
|
|
string |
$sql_query: |
|
|
integer |
$error_no: |
|
|
|
$type: |
|
setPaths [line 555]
void setPaths(
[ $sites_path = '']
)
|
|
Make the $PIVOTX['paths'] array, which is used in many places to figure out where files should be read from or written to. Also updates directories for the templates.
Parameters:
API Tags:
stripOnlyTags [line 2212]
string stripOnlyTags(
string $str, $tags
)
|
|
This function does the opposite of strip_tags(). instead of _allowing_ certain tags, this function only _strips_ certain tags.
Parameters:
stripSlashesDeep [line 2237]
mixed stripSlashesDeep(
&$value, mixed $value
)
|
|
Recursively strip slashes from a string or array (of strings)
Parameters:
API Tags:
stripslashes_deep [line 5351]
void stripslashes_deep(
&$value
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
stripTagsAttributes [line 4749]
void stripTagsAttributes(
string $source, [string $allowedtags = ""], [mixed $disabledattributes = ""]
)
|
|
Strip tags from a given $source, and also remove attributes / javascript handlers.
If $allowedtags is "*", it will use the most common 'safe' tags. If $disabledattributes is empty, it will stip out all javascript handlers.
Parameters:
|
string |
$source: |
|
|
string |
$allowedtags: |
|
|
mixed |
$disabledattributes: |
|
stripTrailingSlash [line 3340]
string stripTrailingSlash(
string $path
)
|
|
Ensures that a path has no trailing slash
Parameters:
stripTrailingSpace [line 4686]
void stripTrailingSpace(
$text
)
|
|
Remove trailing whitespace from a given string. Not just spaces and linebreaks, but also , 's and the like.
Parameters:
stripWordHtml [line 3744]
void stripWordHtml(
$text
)
|
|
Simple function that strips off all the crap Microsoft Word inserts when saving as HTML.
Only the following tags are kept: <b><i><u><a><br><p><em><strong>
Parameters:
strip_tags_attributes [line 5495]
void strip_tags_attributes(
$source, [ $allowedtags = ""], [ $disabledattributes = ""]
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
|
|
$source: |
|
|
|
$allowedtags: |
|
|
|
$disabledattributes: |
|
API Tags:
strip_trailing_space [line 5486]
void strip_trailing_space(
$text
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
API Tags:
templateGuess [line 1791]
string templateGuess(
string $filter
)
|
|
Returns the most suitable template by guessing.
Parameters:
templateList [line 1551]
array templateList(
[string $dir = ""], [ $recursive = false]
)
|
|
Looks recursively through the 'templates' folder, and make a list of all template files.
Parameters:
templateOptions [line 1733]
array templateOptions(
array $templates, string $filter, [array $skip = array()]
)
|
|
Returns an array of themes, with the most suitable ones at the top.
templates that match $skip are skipped completely.
Parameters:
|
array |
$templates: |
|
|
string |
$filter: |
|
|
array |
$skip: |
|
themeList [line 1684]
array themeList(
string $dir
)
|
|
Looks recursively look through the 'templates' folder, and make a list of all template theme files.
Parameters:
tidyHtml [line 2289]
string tidyHtml(
string $text, [boolean $thorough = FALSE]
)
|
|
These functions are used to tidy up the general nastyness in html generated by wysiwyg editors in IE and Mozilla.
On certain older (5.1.x) versions of PHP, there's a issue with regexes. To work around this, we check for a valid string, before we return. If something went wrong, we just return the original, untidied $text.
Parameters:
|
string |
$text: |
|
|
boolean |
$thorough: |
|
tidyHtmlCallback [line 2340]
string tidyHtmlCallback(
string $match
)
|
|
Helper function for tidy_html.
Parameters:
API Tags:
tidyHtmlCallbackChangetag [line 2372]
string tidyHtmlCallbackChangetag(
string $match
)
|
|
Helper function for tidy_html.
Parameters:
API Tags:
tidyHtmlCallbackDoublequote [line 2383]
string tidyHtmlCallbackDoublequote(
string $match
)
|
|
Helper function for tidy_html.
Parameters:
API Tags:
tidyHtmlCallbackNesteddivs [line 2416]
string tidyHtmlCallbackNesteddivs(
string $match
)
|
|
Helper function for tidy_html.
Parameters:
API Tags:
tidyHtmlCallbackNestedobjects [line 2437]
string tidyHtmlCallbackNestedobjects(
string $match
)
|
|
Helper function for tidy_html.
Parameters:
API Tags:
tidyHtmlCallbackNovalueattr [line 2405]
string tidyHtmlCallbackNovalueattr(
string $match
)
|
|
Helper function for tidy_html.
Parameters:
API Tags:
tidyHtmlCallbackSinglequote [line 2394]
string tidyHtmlCallbackSinglequote(
string $match
)
|
|
Helper function for tidy_html.
Parameters:
API Tags:
timeDiffWebFile [line 5058]
int timeDiffWebFile(
[boolean $debug = false]
)
|
|
Calculates the time difference between the web and file server.
This function is used by hardened bbclone and trackbacks (to get the correct time when deleting keys that are older than a given time).
Parameters:
timeTaken [line 3263]
string timeTaken(
[string $type = ""]
)
|
|
Calculates time that was needed for execution.
Parameters:
trackbackFormat [line 4224]
string trackbackFormat(
string $text
)
|
|
Formats trackbacks according the settings for the current weblog.
We strip _all_ tags except <b> and <i> and after that we convert everything that looks like a url or mail-address to the equivalent link (if enabled).
Parameters:
trimQuery [line 1626]
Manipulates a query so mySQL 4.1 specific syntax is stripped out.
This way, the queries will also work (to some extent) on mysql 4.0.x
Parameters:
trimText [line 3779]
string trimText(
string $str, int $length, [boolean $nbsp = false], [boolean $hellip = true], [ $striptags = true]
)
|
|
Trim a text to a given length, taking html entities into account.
Formerly we first removed entities (using unentify), cut the text at the wanted length and then added the entities again (using entify). This caused lot of problems so now we are using a trick from http://www.greywyvern.com/code/php/htmlwrap.phps where entities are replaced by the ACK (006) ASCII symbol, the text cut and then the entities reinserted.
Parameters:
|
string |
$str: |
string to trim |
|
int |
$length: |
position where to trim |
|
boolean |
$nbsp: |
whether to replace spaces by entities |
|
boolean |
$hellip: |
whether to add … entity at the end |
|
|
$striptags: |
|
API Tags:
unentify [line 3665]
string unentify(
string $i
)
|
|
Converts all HTML entities to their applicable characters encoded in UTF-8.
Currently the function does nothing for PHP version prior to 4.3.0.
Parameters:
uniqueURI [line 4636]
string uniqueURI(
$source_uri, [int $code = null], [ $type = 'page'], [ $iterator = 0], string $uri, string $key
)
|
|
Check if a requested uri is already taken, Returns a valid unique uri by appending random stuff
TODO: make it work for weblogs and other special items in pivotx too
Parameters:
|
string |
$uri: |
|
|
int |
$code: |
|
|
string |
$key: |
|
|
|
$source_uri: |
|
|
|
$type: |
|
|
|
$iterator: |
|
uploadAllowed [line 2918]
boolean uploadAllowed(
$path, string $url
)
|
|
Checks whether uploading files to this directory is allowed.
PivotX should never ever allow uploading outside the images, templates and db folders.
Parameters:
wipeSmartyCache [line 5244]
Go through the cache folder, delete all files.
wipeSmartyCacheFolder [line 5270]
void wipeSmartyCacheFolder(
string $path
)
|
|
Helper function for wipeSmartyCache().
Parameters:
API Tags:
wordwrapHTMLEntities [line 3838]
string wordwrapHTMLEntities(
string $str, [int $width = 75], [string $break = "\n"], [boolean $cut = false]
)
|
|
Wraps a string to a given number of characters, taking html entities into account.
To avoid a lot of problems with html_entity_decode we are using a trick from http://www.greywyvern.com/code/php/htmlwrap.phps where entities are replaced by the ACK (006) ASCII symbol, the string wrapped and then the entities reinserted.
Parameters:
|
string |
$str: |
string to wrap |
|
int |
$width: |
position where to wrap |
|
string |
$break: |
string used to break the line |
|
boolean |
$cut: |
If set to TRUE, always wrap at or before the specified width. |
API Tags:
writeFile [line 4443]
void writeFile(
$filename, $output, [ $mode = 'w']
)
|
|
Saves a file, and outputs some feedback, if wanted.
Parameters:
|
|
$filename: |
|
|
|
$output: |
|
|
|
$mode: |
|
write_file [line 5459]
void write_file(
$filename, $output, [ $mode = 'w']
)
|
|
Deprecated function. Kept for backwards compatibility.
Parameters:
|
|
$filename: |
|
|
|
$output: |
|
|
|
$mode: |
|
API Tags:
zeroise [line 2766]
string zeroise(
integer $number, integer $threshold
)
|
|
Adds leading zeros when necessary
Parameters:
|
integer |
$number: |
|
|
integer |
$threshold: |
|
_lu_getarray [line 2089]
void _lu_getarray(
&$str, integer $count, string $str
)
|
|
Get a series of tokens from $str to make an array.
Parameters:
|
string |
$str: |
|
|
integer |
$count: |
|
|
|
&$str: |
|
_lu_getstring [line 2040]
void _lu_getstring(
&$str, integer $length, string $str
)
|
|
Get a token of type string.
Parameters:
|
string |
$str: |
|
|
integer |
$length: |
|
|
|
&$str: |
|
_lu_gettype [line 2008]
void _lu_gettype(
&$str, string $str
)
|
|
Find the type of the first token.
Parameters:
_lu_part [line 1961]
void _lu_part(
&$str, string $str
)
|
|
This is the function where the hard work gets done: first we determine the type of the token, and parse that.
Gets called by liberalUnserialize() and (recursively) _lu_getarray()
Parameters:
|
|