phpDocumentor pivotx
[ class tree: pivotx ] [ index: pivotx ] [ all elements ]

Procedural File: lib.php

Source Location: /lib.php

Page Details

Contains support functions used by PivotX.

Includes
require_once ($pivotx_path.'modules/module_tags.php') [line 63]
[ Top ]

require_once ($pivotx_path.'forms.php') [line 72]
[ Top ]

require_once ($pivotx_path.'modules/module_search.php') [line 68]
[ Top ]

require_once ($pivotx_path.'modules/module_smarty.php') [line 77]
[ Top ]

require_once ($pivotx_path.'objects.php') [line 73]
[ Top ]

require_once ($pivotx_path.'includes/compat.php') [line 57]
[ Top ]

require_once ($pivotx_path.'modules/formclass.php') [line 78]
[ Top ]

require_once ($pivotx_path.'modules/module_i18n.php') [line 59]
[ Top ]

require_once ($pivotx_path.'modules/module_lang.php') [line 60]
[ Top ]

[ Top ]

require_once ($pivotx_path.'data.php') [line 74]
[ Top ]

require_once ($pivotx_path.'modules/module_parser.php') [line 67]
[ Top ]

require_once ($pivotx_path.'modules/module_upload.php') [line 71]
[ Top ]

require_once ($pivotx_path.'offline.php') [line 76]
[ Top ]

require_once ($pivotx_path.'pages.php') [line 75]
[ Top ]

[ Top ]

require_once ($pivotx_path.'modules/module_sql.php') [line 79]
[ Top ]

[ Top ]

[ Top ]

[ Top ]

require_once ($pivotx_path.'modules/module_db.php') [line 58]
[ Top ]


Constants
INPIVOTX  [line 21]

INPIVOTX = TRUE

Contains support functions used by PivotX.


[ Top ]


Functions
addDirToZip  [line 2526]

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: 


[ Top ]
addFileToZip  [line 2513]

void addFileToZip( &$zipfile, string $filename, string $zipfile  )

Adds a file to a zip file.

Parameters:
string   $zipfile: 
string   $filename: 
   &$zipfile: 


[ Top ]
addltgt  [line 3720]

string addltgt( string $i  )

Replaces > / < with > / < in the text $i.

Parameters:
string   $i: 


[ Top ]
addTrailingSlash  [line 3377]

string addTrailingSlash( string $path  )

Ensures that a path has a trailing slash

Parameters:
string   $path: 


[ Top ]
archivenameToDates  [line 3519]

void archivenameToDates( unknown_type $name  )

Get the start and enddate for an archivename like '2007-10' or '2006-w32'

Parameters:
unknown_type   $name: 


[ Top ]
arrayToJson  [line 5564]

void arrayToJson( $arr  )

Convert a PHP-array to JSON formatted string.

Parameters:
   $arr: 

API Tags:
See:  http://www.bin-co.com/php/scripts/array2json/


[ Top ]
backup  [line 2550]

void backup( $what  )

Downloads the configuration files, templates or entries database.

Parameters:
   $what: 


[ Top ]
checkDB  [line 624]

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:
string   $sites_path: 


[ Top ]
checkPaths  [line 682]

boolean checkPaths( )

Checks that the templates, upload and sub-db directories exist and are writable.

It will try to create the directories if possible.



[ Top ]
checkVersion  [line 876]

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: 


[ Top ]
check_version  [line 5329]

void check_version( $currentversion, $requiredversion  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $currentversion: 
   $requiredversion: 

API Tags:
See:  checkVersion()


[ Top ]
chmodFile  [line 4473]

void chmodFile( $filename  )

Chmods a file (according to the configuration).

Parameters:
   $filename: 


[ Top ]
chmod_file  [line 5491]

void chmod_file( $filename  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $filename: 

API Tags:
See:  chmodFile()


[ Top ]
cleanAttributes  [line 2164]

string cleanAttributes( string $str  )

Clean strings to be used as (X)HTML attributes - strip tags and entify ampersands and quotes.

Parameters:
string   $str: 


[ Top ]
cleanParams  [line 2180]

array cleanParams( array $params  )

Clean smarty params: strip quotes and HTML entities

Parameters:
array   $params: 


[ Top ]
cleanPath  [line 2150]

void cleanPath( $path  )

Cleans idiotic and unsafe parts of a path.

We can't use realpath since the path can be relative.

Parameters:
   $path: 


[ Top ]
cleanUserInput  [line 2124]

void cleanUserInput( )

Clean several keys with values supplied by the user in the $_GET, $_POST, $_REQUEST and $_COOKIE super globals.



[ Top ]
clean_params  [line 5365]

void clean_params( $params  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $params: 

API Tags:
See:  cleanParams()


[ Top ]
commentFormat  [line 4123]

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: 


[ Top ]
comment_format  [line 5545]

void comment_format( $text, [ $striplinebreaks = false]  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $text: 
   $striplinebreaks: 

API Tags:
See:  commentFormat()


[ Top ]
decodeText  [line 3880]

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 "&lt;" / "&gt;" is left untouched.

Parameters:
string   $text: 
string   $level: 


[ Top ]
displayPage  [line 222]

void displayPage( )

Determines which page needs to be shown, and calls the handler for that page



[ Top ]
emoticonize  [line 3599]

string emoticonize( string $text  )

Convert textual emoticons into their graphical counterpart.

Parameters:
string   $text: 


[ Top ]
encodeMailLink  [line 3934]

string encodeMailLink( string $mail, string $text, [string $title = &quot;&quot;], [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: 


[ Top ]
encodemail_link  [line 5555]

void encodemail_link( $mail, $text, [ $title = &quot;&quot;], [ $encrypt = false]  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $mail: 
   $text: 
   $title: 
   $encrypt: 

API Tags:
See:  encodeMailLink()


[ Top ]
encodeText  [line 3909]

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: 


[ Top ]
entify  [line 3671]

string entify( string $i  )

Converts all applicable characters, encoded in UTF-8, to HTML entities.

Parameters:
string   $i: 


[ Top ]
entifyAmpersand  [line 3706]

string entifyAmpersand( string $i  )

Replaces & (which isn't part of an HTML entity) with &amp; in the text $i.

Parameters:
string   $i: 


[ Top ]
entifyQuotes  [line 3691]

string entifyQuotes( string $i  )

Replaces ' / " with &#039; / &quot; in the text $i.

Parameters:
string   $i: 


[ Top ]
escape  [line 3640]

void escape( $i  )
Parameters:
   $i: 


[ Top ]
filearray_sort  [line 5392]

void filearray_sort( $a, $b  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $a: 
   $b: 

API Tags:
See:  fileArraySort()


[ Top ]
fileOperations  [line 1326]

void fileOperations( string $folder  )

Do basic operations for the file explorers: create files/folder, delete files, duplicate files.

Parameters:
string   $folder: 


[ Top ]
fixDate  [line 3309]

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: 


[ Top ]
fixPath  [line 3328]

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: 


[ Top ]
fix_date  [line 5437]

void fix_date( $date, $time  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $date: 
   $time: 

API Tags:
See:  fixDate()


[ Top ]
formatDate  [line 3004]

string formatDate( [string $date = &quot;&quot;], [string $format = &quot;&quot;], [string $title = &quot;&quot;]  )

Formats date, according to the passed $format

Parameters:
string   $date: 
string   $format: 
string   $title: 


[ Top ]
formatDateFuzzy  [line 3083]

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:
string   $date: 


[ Top ]
formatDateRange  [line 3181]

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: 


[ Top ]
formatEntry  [line 2979]

string formatEntry( array $entry, string $format  )

Formats all data in an entry according to the passed $format.

Parameters:
array   $entry: 
string   $format: 


[ Top ]
formatFilename  [line 1534]

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


[ Top ]
formatFilesize  [line 1514]

string formatFilesize( integer $size  )

Format a filesize like '10.3 kb' or '2.5 mb'

Parameters:
integer   $size: 


[ Top ]
format_date  [line 5419]

void format_date( [ $date = &quot;&quot;], [ $format = &quot;&quot;], [ $title = &quot;&quot;]  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $date: 
   $format: 
   $title: 

API Tags:
See:  formatDate()


[ Top ]
format_date_range  [line 5428]

void format_date_range( $start_date, $end_date, $format  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $start_date: 
   $end_date: 
   $format: 

API Tags:
See:  formatDateRange()


[ Top ]
format_entry  [line 5410]

void format_entry( $entry, $format  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $entry: 
   $format: 

API Tags:
See:  formatEntry()


[ Top ]
getAttrValue  [line 3624]

void getAttrValue( string $att_name, string $attributes  )

Searches in (HTML) text for the value of a attribute.

For example, after calling:

  1. $my_value=getAttrValue('size''color="green" size="12"');
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


[ Top ]
getCurrentDate  [line 4779]

void getCurrentDate( )

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.



[ Top ]
getDateRange  [line 3470]

void getDateRange( $date, $unit  )
Parameters:
   $date: 
   $unit: 


[ Top ]
getDaysInMonth  [line 3441]

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: 


[ Top ]
getDefault  [line 1611]

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: 


[ Top ]
getEditCommentLink  [line 4066]

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: 


[ Top ]
getEditlink  [line 4039]

string getEditlink( $name, integer $uid, string $prefix, string $postfix, [string $type = &quot;entry&quot;], 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: 


[ Top ]
getEditTrackbackLink  [line 4093]

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: 


[ Top ]
getExtension  [line 2867]

string getExtension( string $filename  )

Gets the extension (if any) of a filename.

Parameters:
string   $filename: 


[ Top ]
getFiles  [line 1179]

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: 


[ Top ]
getHost  [line 806]

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:
   $host: 


[ Top ]
getMem  [line 852]

string getMem( )

Get the amount of used memory, if memory_get_usage is defined.



[ Top ]
getMicrotime  [line 3274]

float getMicrotime( )

Gets current Unix timestamp (in seconds) with microseconds, as a float.



[ Top ]
getPivotxURL  [line 742]

string getPivotxURL( )

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.



[ Top ]
getRemoteFile  [line 1482]

string getRemoteFile( string $url  )

Get a file over HTTP. First try file_get_contents, and if that fails try curl.

Parameters:
string   $url: 


[ Top ]
getRfcDate  [line 3251]

string getRfcDate( string $time  )

Get a date in RFC 2822 format, which is _not_ localised!!

Parameters:
string   $time: 

API Tags:
See:  http://www.faqs.org/rfcs/rfc2822


[ Top ]
getSimpleAggregate  [line 1878]

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: 


[ Top ]
getSimpleList  [line 1844]

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: 


[ Top ]
getSvnRevision  [line 209]

integer getSvnRevision( )

Returns our SVN Revision number



[ Top ]
getUploadFolderUrl  [line 2754]

void getUploadFolderUrl( [ $basefilename = '']  )

Get the upload folder url (relative to images/)

Parameters:
   $basefilename: 


[ Top ]
get_attr_value  [line 5446]

void get_attr_value( $att_name, $attributes  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $att_name: 
   $attributes: 

API Tags:
See:  getAttrValue()


[ Top ]
get_current_date  [line 5527]

void get_current_date( )

Deprecated function. Kept for backwards compatibility.


API Tags:
See:  getCurrentDate()


[ Top ]
get_default  [line 5356]

void get_default( $a, $b, [ $strict = false]  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $a: 
   $b: 
   $strict: 

API Tags:
See:  getDefault()


[ Top ]
get_editcommentlink  [line 5536]

void get_editcommentlink( [ $uid = 0], $number  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $uid: 
   $number: 

API Tags:
See:  getEditCommentLink()


[ Top ]
implodeDeep  [line 2256]

string implodeDeep( string $glue, mixed $value  )

Implode an array recursively

Parameters:
string   $glue: 
mixed   $value: 


[ Top ]
implode_deep  [line 5383]

void implode_deep( $glue, $value  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $glue: 
   $value: 

API Tags:
See:  implodeDeep()


[ Top ]
initEmoticons  [line 3573]

void initEmoticons( )

Load the translation table that is used to convert textual emoticons to their graphical counterpart



[ Top ]
initializePivotX  [line 91]

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:
   $loadextensions: 


[ Top ]
ini_get_bool  [line 5245]

void ini_get_bool( $key  )

Returns true or false for boolean PHP settings.

This is need because ini_get can return various (string) values which inidicates on/off.

Parameters:
   $key: 


[ Top ]
isBase64Encoded  [line 5235]

void isBase64Encoded( string $str  )

Check if a given string is base64 encoded.

Parameters:
string   $str: 


[ Top ]
isChrome  [line 5183]

boolean isChrome( )

Simple check to see if the current browser is Chrome or not



[ Top ]
isEmail  [line 2799]

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:
string   $theAdr: 


[ Top ]
isInstalled  [line 194]

boolean isInstalled( )

Checks whether PivotX is installed/setup.



[ Top ]
isMobile  [line 5097]

boolean isMobile( )

Determine if the current browser is a mobile device or not.

adapted from: http://www.russellbeattie.com/blog/mobile-browser-detection-in-php



[ Top ]
isTablet  [line 5169]

boolean isTablet( )

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.



[ Top ]
isUrl  [line 2854]

boolean isUrl( string $url  )

Checks whether the text is an URL or not.

Parameters:
string   $url: 


[ Top ]
isWordHtml  [line 3734]

void isWordHtml( $text  )

Checks if text is HTML (crap) saved by/pasted from Microsoft word.

Parameters:
   $text: 


[ Top ]
liberalUnserialize  [line 1943]

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:
string   $filename: 

Information Tags:
Author:  Bob den Otter, www.twokings.nl
Version:  0.2

[ Top ]
liberal_unserialize  [line 5455]

void liberal_unserialize( $filename  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $filename: 

API Tags:
See:  liberalUnserialize()


[ Top ]
loadSerialize  [line 4306]

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.


[ Top ]
loadTemplate  [line 1911]

string loadTemplate( string $basename  )

Loads a given template.

Parameters:
string   $basename: 


[ Top ]
load_serialize  [line 5464]

void load_serialize( $filename, [ $silent = false]  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $filename: 
   $silent: 

API Tags:
See:  loadSerialize()


[ Top ]
mailResetPasswordLink  [line 2651]

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:
array   $values: 

API Tags:
Return:  True if we could send the mail, false otherwise.


[ Top ]
makeAdminPageLink  [line 2708]

string makeAdminPageLink( [string $page = '']  )

Make a link to an admin page.

Parameters:
string   $page: 


[ Top ]
makeArchiveArray  [line 2464]

array makeArchiveArray( [boolean $force = FALSE], string $unit  )

Returns an archive array for a given unit from the database.

Parameters:
string   $unit:  time unit for the archive.
boolean   $force: 


[ Top ]
makeArchiveName  [line 2483]

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'.


[ Top ]
makeDir  [line 3396]

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:
string   $name: 


[ Top ]
makeExcerpt  [line 4708]

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: 


[ Top ]
makeJsVars  [line 1150]

string; makeJsVars( array $array  )

Convert a PHP array into an associative array for javascript..

Parameters:
array   $array: 


[ Top ]
makeKey  [line 831]

string makeKey( int $length  )

Makes a random key with the specified length.

Parameters:
int   $length: 


[ Top ]
makeThumbname  [line 2902]

string makeThumbname( string $filename  )

Creates a thumbnail name based on a give filename.

Parameters:
string   $filename: 


[ Top ]
makeUploadFolder  [line 2730]

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:
string   $basefilename: 

API Tags:
Return:  The name of the folder.


[ Top ]
makeURI  [line 4589]

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: 


[ Top ]
makeValuepairs  [line 1125]

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: 


[ Top ]
make_jsvars  [line 5347]

void make_jsvars( $array  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $array: 

API Tags:
See:  makeJsVars()


[ Top ]
make_thumbname  [line 5401]

void make_thumbname( $filename  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $filename: 

API Tags:
See:  makeThumbname()


[ Top ]
make_valuepairs  [line 5338]

void make_valuepairs( $array, $key, $value  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $array: 
   $key: 
   $value: 

API Tags:
See:  makeValuepairs()


[ Top ]
paraWeblogNeeded  [line 1650]

boolean paraWeblogNeeded( string $weblog, [array $categories = &quot;&quot;]  )

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: 


[ Top ]
pivotxAdminRedirect  [line 5199]

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)


[ Top ]
pivotxMail  [line 2608]

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: 


[ Top ]
pivotxMarkdown  [line 4002]

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.


[ Top ]
pivotxTextile  [line 3969]

string pivotxTextile( string $str  )

Wrapper for Textile.

Parameters:
string   $str: 


[ Top ]
randomString  [line 2682]

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: 


[ Top ]
relativeToAbsoluteURLS  [line 5055]

string relativeToAbsoluteURLS( string $link  )

convert relative URL's to absolute URL's. Used when we need an absolute path in RSS feeds.

Parameters:
string   $link: 


[ Top ]
removeExtension  [line 2884]

void removeExtension( string $filename  )

Removes the extension (if any) from a filename

Parameters:
string   $filename:  $return string


[ Top ]
renderErrorpage  [line 418]

void renderErrorpage( string $error, string $additionalinfo  )

Display our error page, if something goes wrong.

Parameters:
string   $error: 
string   $additionalinfo: 


[ Top ]
renderTemplate  [line 296]

void renderTemplate( string $template, [array $page = &quot;&quot;]  )

Display template.

Parameters:
string   $template: 
array   $page: 


[ Top ]
safeString  [line 4503]

string safeString( string $str, [boolean $strict = false], [ $extrachars = &quot;&quot;]  )

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: 


[ Top ]
safe_string  [line 5500]

void safe_string( $str, [ $strict = false], [ $extrachars = &quot;&quot;]  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $str: 
   $strict: 
   $extrachars: 

API Tags:
See:  safeString()


[ Top ]
sanitizePostedEntry  [line 921]

void sanitizePostedEntry( $entry  )
Parameters:
   $entry: 


[ Top ]
sanitizePostedPage  [line 1032]

void sanitizePostedPage( $page  )
Parameters:
   $page: 


[ Top ]
sanitizeTitle  [line 899]

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:
   $title: 


[ Top ]
saveSerialize  [line 4362]

void saveSerialize( $filename, &$data  )
Parameters:
   $filename: 
   &$data: 


[ Top ]
save_serialize  [line 5473]

void save_serialize( $filename, &$data  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $filename: 
   &$data: 

API Tags:
See:  saveSerialize()


[ Top ]
sendMailNotification  [line 4819]

void sendMailNotification( string $type, array $data  )

Sends notification for any type - currently only "entries", "comments" and "visitor_registration".

Parameters:
string   $type: 
array   $data: 


[ Top ]
setError  [line 475]

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: 


[ Top ]
setPaths  [line 531]

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:
   $sites_path: 

API Tags:
See:  fixpath()


[ Top ]
stripOnlyTags  [line 2215]

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:
string   $str: 
   $tags: 


[ Top ]
stripSlashesDeep  [line 2240]

mixed stripSlashesDeep( &$value, mixed $value  )

Recursively strip slashes from a string or array (of strings)

Parameters:
mixed   $value: 
   &$value: 

API Tags:
See:  82524


[ Top ]
stripslashes_deep  [line 5374]

void stripslashes_deep( &$value  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   &$value: 

API Tags:
See:  stripSlashesDeep()


[ Top ]
stripTagsAttributes  [line 4750]

void stripTagsAttributes( string $source, [string $allowedtags = &quot;&quot;], [mixed $disabledattributes = &quot;&quot;]  )

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: 


[ Top ]
stripTrailingSlash  [line 3363]

string stripTrailingSlash( string $path  )

Ensures that a path has no trailing slash

Parameters:
string   $path: 


[ Top ]
stripTrailingSpace  [line 4687]

void stripTrailingSpace( $text  )

Remove trailing whitespace from a given string. Not just spaces and linebreaks, but also &nbsp;,
's and the like.

Parameters:
   $text: 


[ Top ]
stripWordHtml  [line 3757]

void stripWordHtml( $text  )

Simple function that strips off all the crap Microsoft Word inserts when saving as HTML.

Only the following tags are kept:

  1. <b><i><u><a><br><p><em><strong>

Parameters:
   $text: 


[ Top ]
strip_tags_attributes  [line 5518]

void strip_tags_attributes( $source, [ $allowedtags = &quot;&quot;], [ $disabledattributes = &quot;&quot;]  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $source: 
   $allowedtags: 
   $disabledattributes: 

API Tags:
See:  stripTagsAttributes()


[ Top ]
strip_trailing_space  [line 5509]

void strip_trailing_space( $text  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $text: 

API Tags:
See:  stripTrailingSpace()


[ Top ]
templateGuess  [line 1794]

string templateGuess( string $filter  )

Returns the most suitable template by guessing.

Parameters:
string   $filter: 


[ Top ]
templateList  [line 1554]

array templateList( [string $dir = &quot;&quot;], [ $recursive = false]  )

Looks recursively through the 'templates' folder, and make a list of all template files.

Parameters:
string   $dir: 
   $recursive: 


[ Top ]
templateOptions  [line 1736]

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: 


[ Top ]
themeList  [line 1687]

array themeList( string $dir  )

Looks recursively look through the 'templates' folder, and make a list of all template theme files.

Parameters:
string   $dir: 


[ Top ]
tidyHtml  [line 2292]

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: 


[ Top ]
tidyHtmlCallback  [line 2343]

string tidyHtmlCallback( string $match  )

Helper function for tidy_html.

Parameters:
string   $match: 

API Tags:
See:  tidy_html


[ Top ]
tidyHtmlCallbackChangetag  [line 2375]

string tidyHtmlCallbackChangetag( string $match  )

Helper function for tidy_html.

Parameters:
string   $match: 

API Tags:
See:  tidy_html


[ Top ]
tidyHtmlCallbackDoublequote  [line 2386]

string tidyHtmlCallbackDoublequote( string $match  )

Helper function for tidy_html.

Parameters:
string   $match: 

API Tags:
See:  tidy_html


[ Top ]
tidyHtmlCallbackNesteddivs  [line 2419]

string tidyHtmlCallbackNesteddivs( string $match  )

Helper function for tidy_html.

Parameters:
string   $match: 

API Tags:
See:  tidy_html


[ Top ]
tidyHtmlCallbackNestedobjects  [line 2440]

string tidyHtmlCallbackNestedobjects( string $match  )

Helper function for tidy_html.

Parameters:
string   $match: 

API Tags:
See:  tidy_html


[ Top ]
tidyHtmlCallbackNovalueattr  [line 2408]

string tidyHtmlCallbackNovalueattr( string $match  )

Helper function for tidy_html.

Parameters:
string   $match: 

API Tags:
See:  tidy_html


[ Top ]
tidyHtmlCallbackSinglequote  [line 2397]

string tidyHtmlCallbackSinglequote( string $match  )

Helper function for tidy_html.

Parameters:
string   $match: 

API Tags:
See:  tidy_html


[ Top ]
timeDiffWebFile  [line 5075]

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:
boolean   $debug: 


[ Top ]
timeTaken  [line 3286]

string timeTaken( [string $type = &quot;&quot;]  )

Calculates time that was needed for execution.

Parameters:
string   $type: 


[ Top ]
trackbackFormat  [line 4237]

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:
string   $text: 


[ Top ]
trimQuery  [line 1629]

void trimQuery( $query  )

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:
   $query: 


[ Top ]
trimText  [line 3792]

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 &nbsp; entities
boolean   $hellip:  whether to add &hellip; entity at the end
   $striptags: 

API Tags:
Return:  trimmed string


[ Top ]
unentify  [line 3681]

string unentify( string $i  )

Converts all HTML entities to their applicable characters encoded in UTF-8.

Parameters:
string   $i: 


[ Top ]
uniqueURI  [line 4626]

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: 


[ Top ]
uploadAllowed  [line 2926]

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. Added ability to add extra paths to allow uploading in, but they must always be below the site-directory.

Parameters:
string   $url: 
   $path: 


[ Top ]
wipeSmartyCache  [line 5267]

void wipeSmartyCache( )

Go through the cache folder, delete all files.



[ Top ]
wipeSmartyCacheFolder  [line 5293]

void wipeSmartyCacheFolder( string $path  )

Helper function for wipeSmartyCache().

Parameters:
string   $path: 

API Tags:
See:  wipeSmartyCache();


[ Top ]
wordwrapHTMLEntities  [line 3851]

string wordwrapHTMLEntities( string $str, [int $width = 75], [string $break = &quot;\n&quot;], [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:
Return:  wrapped string


[ Top ]
writeFile  [line 4433]

void writeFile( $filename, $output, [ $mode = 'w']  )

Saves a file, and outputs some feedback, if wanted.

Parameters:
   $filename: 
   $output: 
   $mode: 


[ Top ]
write_file  [line 5482]

void write_file( $filename, $output, [ $mode = 'w']  )

Deprecated function. Kept for backwards compatibility.

Parameters:
   $filename: 
   $output: 
   $mode: 

API Tags:
See:  writeFile()


[ Top ]
zeroise  [line 2772]

string zeroise( integer $number, integer $threshold  )

Adds leading zeros when necessary

Parameters:
integer   $number: 
integer   $threshold: 


[ Top ]
_lu_getarray  [line 2092]

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: 


[ Top ]
_lu_getstring  [line 2043]

void _lu_getstring( &$str, integer $length, string $str  )

Get a token of type string.

Parameters:
string   $str: 
integer   $length: 
   &$str: 


[ Top ]
_lu_gettype  [line 2011]

void _lu_gettype( &$str, string $str  )

Find the type of the first token.

Parameters:
string   $str: 
   &$str: 


[ Top ]
_lu_part  [line 1964]

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:
string   $str: 
   &$str: 


[ Top ]


Documentation generated on Tue, 05 Sep 2017 01:06:03 +0200 by phpDocumentor 1.4.3