Alkaline

Return to documentation ↩

const build = 1000
const copyright = 'Powered by Alkaline. Copyright © 2010-2011 by Budin Ltd. All rights reserved.'
const edition = 'standard'
const product = 'Alkaline'
const version = '1.1'
public $admin
public $db_type
public $db_version
public $tables
public $tables_cache
public $tables_index
protected $db
protected $notifications
public __construct()
Initiates Alkaline
return void
public __destruct()
Terminates object, closes the database connection
return void
public exec($query)
Prepares and executes SQL statement
string $query Query
return int Number of affected rows
public prepare($query)
Prepares a statement for execution and returns a statement object
string $query Query
return PDOStatement
public prequery(&$query)
Translate query for different database types
string $query Query
return string Translated query
public postquery(&$query, $db=null)
Determine if query was successful; if not, log it using report()
string $query
string $db
return bool True if successful
public removeNull($input)
Remove nulls from a JSON string
string $input JSON input
return string JSON ouput
public boomerang($request)
Retrieve data from
string $request Request
return string Response
public access($key=null)
Authenticate guest access
string $key Guest access key
return void Redirects if unsuccessful
public addNote($message, $type=null)
Add a notification
string $message Message
string $type Notification type (usually 'success', 'error', or 'notice')
return void
public countNotes($type=null)
Check notifications
string $type Notification type
return int Number of notifications
public returnNotes($type=null)
View notifications
string $type Notification type
return string HTML-formatted notifications
public seekDirectory($dir=null, $ext=IMG_EXT)
Browse a local directory (non-recursive) for filenames
string $dir Full path to directory
string $ext File extensions to seek
return array Full paths of files
public countDirectory($dir=null, $ext=IMG_EXT)
Browse a local directory (non-recursive) for file count
string $dir Full path to directory
string $ext File extensions to seek
return int Number of files
public getFilename($file)
Determine a filename from a path
string $file Full or relative file path
return string|false Filename (including extension) or error
public emptyDirectory($dir=null)
Empty a directory
string $dir Full path to directory
return void
public checkPerm($file)
Check file permissions
string $file Full path to file
return string Octal value (e.g., 0644)
public replaceVar($var, $replacement, $subject)
Replace a variable's value in a PHP file (for installation)
string $var Variable (e.g., $var)
string $replacement Full line replacement (e.g., $var = 'dog';)
string $subject Subject input
return string Subject output
public convertToBool(&$input, $default='')
Convert a possible string to boolean
mixed $input
mixed $default Return if unknown
return boolean
public convertToArray(&$input)
Convert a possible string or integer into an array
mixed $input
return array
public convertToIntegerArray(&$input)
Convert a possible string or integer into an array of integers
mixed $input
return array
public changeExt($file, $ext)
Change filename extension
string $file Filename
string $ext Desired extension
return string Changed filename
public formatTime($time=null, $format=null, $empty=false)
Make time more human-readable
string $time Time
string $format Format (as in date();)
string $empty If null or empty input time, return this string
return string|false Time or error
public formatRelTime($time, $format=null, $empty=false, $round=null)
Make time relative
string $time Time
string $format Format (as in date();)
string $empty If null or empty input time, return this string
int $round Digits of rounding (as in round();)
return string|false Time or error
public numberToMonth($num)
Convert numerical month to written month (U.S. English)
string $num Numerical month (e.g., 01)
return string|false Written month (e.g., January) or error
public numberToWords($num, $power=0, $powsuffix= '')
Convert number to words (U.S. English)
string $num
string $power
string $powsuffix
return string
public makeUnicode($string)
Convert to Unicode (UTF-8)
string $string
return string
public sanitize($string)
Sanitize table and column names (to prevent SQL injection attacks)
string $string
return string
public makeHTMLSafe($input)
Make HTML-safe quotations
string $input
return string
public reverseHTMLSafe($input)
Reverse HTML-safe quotations
string $input
return string
public makeFilenameSafe($str)
Make a string unique, and filename safe
string $str
return string
public reverseFilenameSafe($str)
Reverse unique string
string $str
return string
public stripTags($var)
Strip tags from string or array
string $var
return string|array
public closeTags($html)
Close open HTML tags
string $html
return string
public countWords($string)
Count the number of words in a string (more reliable than str_word_count();)
string $string
return int Word count
public randInt($min=null, $max=null)
Return random integer using best-available algorithm
string $min
string $max
return void
public getType($var)
Returns the type of the variable as a comparable string
mixed $var Variable
return string Type of variable
public addComments()
Add comments from $_POST data
return bool True if successful
public addTrackbacks()
Add trackbacks from $_REQUEST data
return string XML response
public revertVersion($version_id)
Revert to title and text of a previous version
int $version_id
return bool True if successful
public updateCount($count_table, $result_table, $result_field, $result_id)
Update count of single field
string $count_table
string $result_table
string $result_field
string $result_id
return bool True if successful
public updateCounts($count_table, $result_table, $result_field)
Update count of entire column
string $count_table
string $result_table
string $result_field
return bool True if successful
public getInfo()
Get all table row counts
return array Tables and their row counts
public getBadges()
Get Alkaline Dashboard header badges
return array Associate array of fields and integers
public getTags($show_hidden_tags=false)
Get array of tags
bool $show_hidden_tags Include hidden tags
return array Associative array of tags
public loadCitation($uri, $field, $field_id)
Load a citation
string $uri URI of citation
string $field Field for ID entry
int $field_id ID to enter
return array Associative array of newly created citation row
public hintTag($hint)
List tags by search, for suggestions
string $hint Search string
return array
public hintPostCategory($hint)
List page category by search, for suggestions
string $hint Search string
return array
public hintPageCategory($hint)
List category by search, for suggestions
string $hint Search string
return array
public getIncludes()
Get array of all includes
return array Array of includes
public showRights($name, $right_id=null)
Get HTML of all rights
string $name Name and ID of
integer $right_id Default or selected right_id
return string
public showSizes($name, $size_id=null)
Get HTML of all sizes
string $name Name and ID of
integer $size_id Default or selected size_id
return string
public showPrivacy($name, $privacy_id=1)
Get HTML of all privacy levels
string $name Name and ID of
integer $privacy_id Default or selected privacy_id
return string
public showSets($name, $set_id=null, $static_only=false)
Get HTML of all sets
string $name Name and ID of
integer $set_id Default or selected set_id
bool $static_only Display on static sets
return string
public showThemes($name, $theme_id=null)
Get HTML of all themes
string $name Name and ID of
integer $theme_id Default or selected theme_id
return string
public showEXIFNames($name, $exif_name=null)
Get HTML of all EXIF names
string $name Name and ID of
integer $exif_name Default or selected exif_name
return string
public getTable($table, $ids=null, $limit=null, $page=1, $order_by=null)
Get table
string $table Table name
string $ids Row IDs
string $limit
string $page
string $order_by
return array
public getRow($table, $id)
Get row
string $table Table name
string $id Row ID
return array
public addRow($fields=null, $table)
Add row (includes updating default fields)
array $fields Associative array of key (column) and value (field)
string $table Table name
return int|false Row ID or error
public updateRow($fields, $table, $ids=null, $default=true)
Update row
string $fields Associative array of key (column) and value (field)
string $table Table name
string $ids Row IDs
string $default Include default fields (e.g., update modified dates)
return bool True if successful
public deleteRow($table, $ids=null)
Delete row
string $table Table name
string $ids Row IDs
return bool True if successful
public deleteEmptyRow($table, $fields)
Delete empty rows
string $table Table name
string $fields Fields to check for empty values (if any are empty, deletion will occur)
return bool True if successful
public countTable($table)
Count table rows
string $table Table name
return int Number of rows
public recordStat($page_type=null)
public setForm(&$array, $name, $unset='')
Set form option
string $array
string $name
string $unset
return void
public readForm($array=null, $name, $check=true)
Retrieve HTML-formatted form option
string $array
string $name
string $check
return string
public returnForm($array, $name, $default=null)
Return form option
string $array
string $name
string $default
return string
public setConf($name, $unset='')
Set configuration key
string $name
string $unset
return void
public readConf($name, $check=true)
Return HTML-formatted configuration key
string $name
string $check
return string
public returnConf($name)
Return configuration key
string $name
return string
public saveConf()
Save configuration
return int|false Bytes written or error
public findID($string, $numeric_required=false)
Find ID number from string
string $string Input string
string $numeric_required If true, will return false if number not found
return int|string|false ID, string, or error
public findIDRef($str)
Find image IDs (in , , etc.) from a string
string $str Input string
return array Image IDs
public findMetaRef($html)
Find meta references from an HTML string
string $html Input HTML string
return array Associate array of data (site_name, title, url)
public makeURL($string)
Make a URL-friendly string (removes special characters, replaces spaces)
string $string
return string
public removeAccents($string)
Converts all accent characters to ASCII characters.
If there are no accent characters, then the string given is just returned.
string $string Text that might have accent characters
return string Filtered string with replaced "nice" characters.
public seems_utf8($str)
public minimizeURL($url)
Minimize URL for display purposes
string $url
return string
public magicURL($page)
Change page number on current URL
string $page
return void
public fitString($string, $length=50)
Trim long strings
string $string
string $length Maximum character length
return string
public fitStringByWord($string, $length=50)
Trim strings, end on a whole word
string $string
string $length Maximum character length
return string
public nl2br($str)
Apply nl2br() when you don't know if
tags are being used
string $str
return string
public returnCount($count, $singular, $plural=null)
Choose between singular and plural forms of a string
string $count Count
string $singular Singular form
string $plural Plural form
return string
public returnFullCount($count, $singular, $plural=null)
Choose between singular and plural forms of a string and include count
string $count Count
string $singular Singular form
string $plural Plural form
return string
public correctWinPath($path)
If Windows Server, make path Windows-friendly
string $path
return string
public location($get=null)
Current page for redirects (removes all GET variables except page)
array $get Append to URL (GET variables as associative array)
return string
public locationFull($get=null)
Current page for redirects
array $get Append to URL (GET variables as associative array)
return string URL
public setCallback($page=null)
Set callback location
string $page
return void
public callback($url=null)
Send to callback location
string $url Fallback URL if callback URL isn't set
return void
public back()
Send back (for cancel links)
return void
public siftDomain($uri)
Sift through a URI () for just the domain (www.whatever.com)
string $uri
return string
public email($to=0, $subject=null, $message=null)
Send email
int $to If integer, looks up email address from users table; else, an email address
string $subject
string $message
return True if successful
public debug()
Return debug array
return array
public report($message, $number=null)
Add message to error log
string $message
string $number
return void
public deleteDisallowedUsers()
public compare($string1, $string2)
Compare two strings
string $string1
string $string2
return string
protected appendTablePrefix($tables)
Append table prefix to table names (before executing query)
string $tables Comma-separated tables
return string Comma-separated tables
private makeHTMLSafeHelper($string)
private reverseHTMLSafeHelper($string)
static addError($severity, $message=null, $filename=null, $line_number=null, $http_headers=null)
Set errors
int $severity Severity (PHP error constant), title (user-generated), or exception (OO-code generated)
string $message
string $filename
int $line_number
int $http_headers Index array of HTTP headers to send (if an item is an integer, send as status code)
return void
static addException($e)
Add Exception
Exception $e
return void
static returnErrors()
Display errors
return void|string HTML-formatted notifications