/ cake / basics.php

config

top

Loads configuration files. Receives a set of configuration files to load. Example:

config('config1', 'config2');

Function defined in file:
cake/basics.php on line 57
Return

boolean Success

Link
http://book.cakephp.org/view/1125/config

uses

top

Loads component/components from LIBS. Takes optional number of parameters.

Example:

uses('flay', 'time');

Function defined in file:
cake/basics.php on line 88
Deprecated

Will be removed in 2.0

Link
http://book.cakephp.org/view/1140/uses

debug

top

Prints out debug information about given variable.

Only runs if debug level is greater than zero.

Parameters:
$var boolean Variable to show debug information for. optional false
$showHtml boolean If set to true, the method prints the debug data in a screen-friendly way. optional false
$showFrom boolean If set to true, the method prints from where the function was called. optional true
Function defined in file:
cake/basics.php on line 106
Link
Array

getMicrotime

top

Returns microtime for execution time checking

Function defined in file:
cake/basics.php on line 129
Return

float Microtime

sortByKey

top

Sorts given $array by key $sortby.

Parameters:
$array array Array to sort required (no default)
$sortby string Sort by this key required (no default)
$order string Sort order asc/desc (ascending or descending). optional 'asc'
$type integer Type of sorting to perform optional 1
Function defined in file:
cake/basics.php on line 145
Return

mixed Sorted array

h

top

Convenience method for htmlspecialchars.

Parameters:
$text string Text to wrap through htmlspecialchars required (no default)
$charset string Character set to use when escaping. Defaults to config value in 'App.encoding' or 'UTF-8' optional NULL
Function defined in file:
cake/basics.php on line 206
Return

string Wrapped text

Link
http://book.cakephp.org/view/1132/h

pluginSplit

top

Splits a dot syntax plugin name into its plugin and classname. If $name does not have a dot, then index 0 will be null.

Commonly used like list($plugin, $name) = pluginSplit($name);

Parameters:
$name string The name you want to plugin split. required (no default)
$dotAppend boolean Set to true if you want the plugin to have a '.' appended to it. optional false
$plugin string Optional default plugin to use if no plugin is found. Defaults to null. optional NULL
Function defined in file:
cake/basics.php on line 236
Return

array Array with 2 indexes. 0 => plugin name, 1 => classname

a

top

Returns an array of all the given parameters.

Example:

a('a', 'b')

Would return:

array('a', 'b')

Function defined in file:
cake/basics.php on line 262
Return

array Array of given parameters

Link
http://book.cakephp.org/view/1122/a
Deprecated

Will be removed in 2.0

aa

top

Constructs associative array from pairs of arguments.

Example:

aa('a','b')

Would return:

array('a'=>'b')

Function defined in file:
cake/basics.php on line 282
Return

array Associative array

Link
http://book.cakephp.org/view/1123/aa
Deprecated

Will be removed in 2.0

e

top

Convenience method for echo().

Parameters:
$text string String to echo required (no default)
Function defined in file:
cake/basics.php on line 303
Link
http://book.cakephp.org/view/1129/e
Deprecated

Will be removed in 2.0

low

top

Convenience method for strtolower().

Parameters:
$str string String to lowercase required (no default)
Function defined in file:
cake/basics.php on line 315
Return

string Lowercased string

Link
http://book.cakephp.org/view/1134/low
Deprecated

Will be removed in 2.0

up

top

Convenience method for strtoupper().

Parameters:
$str string String to uppercase required (no default)
Function defined in file:
cake/basics.php on line 327
Return

string Uppercased string

Link
http://book.cakephp.org/view/1139/up
Deprecated

Will be removed in 2.0

r

top

Convenience method for str_replace().

Parameters:
$search string String to be replaced required (no default)
$replace string String to insert required (no default)
$subject string String to search required (no default)
Function defined in file:
cake/basics.php on line 341
Return

string Replaced string

Link
http://book.cakephp.org/view/1137/r
Deprecated

Will be removed in 2.0

pr

top

Print_r convenience function, which prints out <PRE> tags around the output of given array. Similar to debug().

Parameters:
$var array Variable to print out required (no default)
Function defined in file:
cake/basics.php on line 353

params

top

Display parameters.

Parameters:
$p mixed Parameter as string or array required (no default)
Function defined in file:
cake/basics.php on line 368
Return

string

Deprecated

Will be removed in 2.0

am

top

Merge a group of arrays

Function defined in file:
cake/basics.php on line 388
Return

array All array parameters merged into one

Link
http://book.cakephp.org/view/1124/am

env

top

Gets an environment variable from available sources, and provides emulation for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on IIS, or SCRIPT_NAME in CGI mode). Also exposes some additional custom environment information.

Parameters:
$key string Environment variable name. required (no default)
Function defined in file:
cake/basics.php on line 410
Return

string Environment variable setting.

Link
http://book.cakephp.org/view/1130/env

cache

top

Reads/writes temporary data to cache files or session.

Parameters:
$path string File path within /tmp to save the file. required (no default)
$data mixed The data to save to the temporary file. optional NULL
$expires mixed A valid strtotime string when the data expires. optional '+1 day'
$target string The target of the cached data; either 'cache' or 'public'. optional 'cache'
Function defined in file:
cake/basics.php on line 527
Return

mixed The contents of the temporary file.

Deprecated

Please use Cache::write() instead

clearCache

top

Used to delete files in the cache directories, or clear contents of cache directories

Parameters:
$params mixed As String name to be searched for deletion, if name is a directory all files in directory will be deleted. If array, names to be searched for deletion. If clearCache() without params, all files in app/tmp/cache/views will be deleted optional NULL
$type string Directory in tmp/cache defaults to view directory optional 'views'
$ext string The file extension you are deleting optional '.php'
Function defined in file:
cake/basics.php on line 579
Return

true if files found and deleted false otherwise

stripslashes_deep

top

Recursively strips slashes from all values in an array

Parameters:
$values array Array of values to strip slashes required (no default)
Function defined in file:
cake/basics.php on line 638
Return

mixed What is returned from calling stripslashes

Link
http://book.cakephp.org/view/1138/stripslashes_deep

__

top

Returns a translated string if one is found; Otherwise, the submitted message.

Parameters:
$singular string Text to translate required (no default)
$return boolean Set to true to return translated string, or false to echo optional false
Function defined in file:
cake/basics.php on line 657
Return

mixed translated string if $return is false string will be echoed

Link
http://book.cakephp.org/view/1121/__

__n

top

Returns correct plural form of message identified by $singular and $plural for count $count. Some languages have more than one form for plural messages dependent on the count.

Parameters:
$singular string Singular text to translate required (no default)
$plural string Plural text required (no default)
$count integer Count required (no default)
$return boolean true to return, false to echo optional false
Function defined in file:
cake/basics.php on line 682
Return

mixed plural form of translated string if $return is false string will be echoed

__d

top

Allows you to override the current domain for a single message lookup.

Parameters:
$domain string Domain required (no default)
$msg string String to translate required (no default)
$return string true to return, false to echo optional false
Function defined in file:
cake/basics.php on line 705
Return

translated string if $return is false string will be echoed

__dn

top

Allows you to override the current domain for a single plural message lookup. Returns correct plural form of message identified by $singular and $plural for count $count from domain $domain.

Parameters:
$domain string Domain required (no default)
$singular string Singular string to translate required (no default)
$plural string Plural required (no default)
$count integer Count required (no default)
$return boolean true to return, false to echo optional false
Function defined in file:
cake/basics.php on line 732
Return

plural form of translated string if $return is false string will be echoed

__dc

top

Allows you to override the current domain for a single message lookup. It also allows you to specify a category.

The category argument allows a specific category of the locale settings to be used for fetching a message. Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.

Note that the category must be specified with a numeric value, instead of the constant name. The values are:

  • LC_ALL 0
  • LC_COLLATE 1
  • LC_CTYPE 2
  • LC_MONETARY 3
  • LC_NUMERIC 4
  • LC_TIME 5
  • LC_MESSAGES 6

Parameters:
$domain string Domain required (no default)
$msg string Message to translate required (no default)
$category integer Category required (no default)
$return boolean true to return, false to echo optional false
Function defined in file:
cake/basics.php on line 770
Return

translated string if $return is false string will be echoed

__dcn

top

Allows you to override the current domain for a single plural message lookup. It also allows you to specify a category. Returns correct plural form of message identified by $singular and $plural for count $count from domain $domain.

The category argument allows a specific category of the locale settings to be used for fetching a message. Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.

Note that the category must be specified with a numeric value, instead of the constant name. The values are:

  • LC_ALL 0
  • LC_COLLATE 1
  • LC_CTYPE 2
  • LC_MONETARY 3
  • LC_NUMERIC 4
  • LC_TIME 5
  • LC_MESSAGES 6

Parameters:
$domain string Domain required (no default)
$singular string Singular string to translate required (no default)
$plural string Plural required (no default)
$count integer Count required (no default)
$category integer Category required (no default)
$return boolean true to return, false to echo optional false
Function defined in file:
cake/basics.php on line 812
Return

plural form of translated string if $return is false string will be echoed

__c

top

The category argument allows a specific category of the locale settings to be used for fetching a message. Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.

Note that the category must be specified with a numeric value, instead of the constant name. The values are:

  • LC_ALL 0
  • LC_COLLATE 1
  • LC_CTYPE 2
  • LC_MONETARY 3
  • LC_NUMERIC 4
  • LC_TIME 5
  • LC_MESSAGES 6

Parameters:
$msg string String to translate required (no default)
$category integer Category required (no default)
$return string true to return, false to echo optional false
Function defined in file:
cake/basics.php on line 846
Return

translated string if $return is false string will be echoed

LogError

top

Shortcut to Log::write.

Parameters:
$message string Message to write to log required (no default)
Function defined in file:
cake/basics.php on line 922

fileExistsInPath

top

Searches include path for files.

Parameters:
$file string File to look for required (no default)
Function defined in file:
cake/basics.php on line 938
Return

Full path to file if exists, otherwise false

Link
http://book.cakephp.org/view/1131/fileExistsInPath

convertSlash

top

Convert forward slashes to underscores and removes first and last underscores in a string

Parameters:
$string required (no default)
Function defined in file:
cake/basics.php on line 959
Return

string with underscore remove from start and end of string

Link
http://book.cakephp.org/view/1126/convertSlash

ife

top

Wraps ternary operations. If $condition is a non-empty value, $val1 is returned, otherwise $val2. Don't use for isset() conditions, or wrap your variable with @ operator: Example:

ife(isset($variable), @$variable, 'default');

Parameters:
$condition mixed Conditional expression required (no default)
$val1 mixed Value to return in case condition matches optional NULL
$val2 mixed Value to return if condition doesn't match optional NULL
Function defined in file:
cake/basics.php on line 1021
Return

mixed $val1 or $val2, depending on whether $condition evaluates to a non-empty expression.

Link
http://book.cakephp.org/view/1133/ife
Deprecated

Will be removed in 2.0