basics.php File Reference

Go to the source code of this file.


Namespaces

namespace  cake

Enumerations

enum  DAY
enum  HOUR
enum  MINUTE
enum  MONTH
enum  SECOND
enum  WEEK
enum  YEAR

Functions

 a ()
 aa ()
 am ()
 cache ($path, $data=null, $expires= '+1 day', $target= 'cache')
 clearCache ($params=null, $type= 'views', $ext= '.php')
 config ()
 convertSlash ($string)
 debug ($var=false, $showHtml=false, $showFrom=true)
 e ($text)
 env ($key)
 fileExistsInPath ($file)
 ife ($condition, $val1=null, $val2=null)
 listClasses ($path)
 loadBehavior ($name)
 loadComponent ($name)
 loadController ($name)
 loadControllers ()
 loadHelper ($name)
 loadModel ($name=null)
 loadModels ()
 loadPluginComponent ($plugin, $component)
 loadPluginHelper ($plugin, $helper)
 loadPluginModels ($plugin)
 loadView ($name)
 low ($str)
 params ($p)
 paths ()
 pr ($var)
 r ($search, $replace, $subject)
 setUri ()
 setUrl ()
 stripslashes_deep ($value)
 up ($str)
 uses ()
 vendor ()

Variables

 $a2 = array_values($a2)
 $bad = array("\n", "\r", "\t")
 $c1 = count($a1)
 $c2 = count($a2)
 $good = ' '
 $out = array()
 $res = @fopen($fileName, 'w+b')
return $write
return false

Enumeration Type Documentation

enum DAY

Definition at line 35 of file basics.php.

enum HOUR

Definition at line 34 of file basics.php.

enum MINUTE

Definition at line 33 of file basics.php.

enum MONTH

Definition at line 37 of file basics.php.

enum SECOND

Basic defines for timing functions.

Definition at line 32 of file basics.php.

enum WEEK

Definition at line 36 of file basics.php.

enum YEAR

Definition at line 38 of file basics.php.


Function Documentation

aa (  ) 

Constructs associative array from pairs of arguments.

Example: aa('a','b')

Would return: array('a'=>'b')

Returns:
array Associative array

Definition at line 244 of file basics.php.

am (  ) 

Merge a group of arrays

Parameters:
array First array
array Second array
array Third array
array Etc...
Returns:
array All array parameters merged into one

Definition at line 334 of file basics.php.

Referenced by Model::_deleteDependent(), Model::_findThreaded(), String::cleanInsert(), ContainableBehavior::contain(), FormHelper::dateTime(), Model::deconstruct(), Set::extract(), loadControllers(), loadModels(), JavascriptHelper::object(), and Object::requestAction().

cache ( path,
data = null,
expires = '+1 day',
target = 'cache' 
)

Reads/writes temporary data to cache files or session.

Parameters:
string $path File path within /tmp to save the file.
mixed $data The data to save to the temporary file.
mixed $expires A valid strtotime string when the data expires.
string $target The target of the cached data; either 'cache' or 'public'.
Returns:
mixed The contents of the temporary file.
Deprecated:
Please use Cache::write() instead

Definition at line 450 of file basics.php.

References $filename, low(), and Configure::read().

Referenced by View::_render(), Object::_savePersistent(), View::element(), ApiShell::initialize(), View::render(), and JavascriptHelper::writeEvents().

clearCache ( params = null,
type = 'views',
ext = '.php' 
)

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

Parameters:
mixed $params 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
string $type Directory in tmp/cache defaults to view directory
string $ext The file extension you are deleting
Returns:
true if files found and deleted false otherwise

Definition at line 502 of file basics.php.

References $file.

Referenced by Model::_clearCache().

convertSlash ( string  ) 

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

Parameters:
string String to convert
Returns:
string with underscore remove from start and end of string

Definition at line 855 of file basics.php.

debug ( var = false,
showHtml = false,
showFrom = true 
)

Prints out debug information about given variable.

Only runs if debug level is non-zero.

Parameters:
boolean $var Variable to show debug information for.
boolean $showHtml If set to true, the method prints the debug data in a screen-friendly way.
boolean $showFrom If set to true, the method prints from where the function was called.

Definition at line 105 of file basics.php.

References r(), and Configure::read().

Referenced by Xml::error(), ExtractTask::execute(), ExtractTask::help(), Configure::read(), and CakeLog::write().

e ( text  ) 

Convenience method for echo().

Parameters:
string $text String to echo

Definition at line 261 of file basics.php.

Referenced by AjaxHelper::afterRender(), ConsoleShell::main(), DboSource::queryAssociation(), DboOracle::queryAssociation(), and DboSource::showQuery().

env ( key  ) 

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

Parameters:
string $key Environment variable name.
Returns:
string Environment variable setting.

Definition at line 353 of file basics.php.

References r().

Referenced by AjaxHelper::afterRender(), Dispatcher::baseUrl(), Dispatcher::cached(), DboMssql::connect(), AjaxHelper::div(), AjaxHelper::divEnd(), SecurityComponent::loginCredentials(), Router::matchRoute(), Dispatcher::parseParams(), Controller::referer(), MediaView::render(), AuthComponent::startup(), Dispatcher::uri(), String::uuid(), and Helper::webroot().

fileExistsInPath ( file  ) 

Searches include path for files

Parameters:
string $file File to look for
Returns:
Full path to file if exists, otherwise false

Definition at line 836 of file basics.php.

References $file.

Referenced by ConnectionManager::loadDataSource().

ife ( condition,
val1 = null,
val2 = null 
)

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:
mixed $condition Conditional expression
mixed $val1 Value to return in case condition matches
mixed $val2 Value to return if condition doesn't match
Returns:
mixed $val1 or $val2, depending on whether $condition evaluates to a non-empty expression.

Definition at line 913 of file basics.php.

Referenced by TranslateBehavior::afterFind(), TranslateBehavior::beforeFind(), TranslateBehavior::beforeValidate(), JavascriptHelper::blockEnd(), PaginatorHelper::counter(), FormHelper::create(), View::entity(), TextHelper::excerpt(), Debugger::exportVar(), Model::find(), AclShell::getPath(), DboOracle::index(), DboMysql::index(), Model::invalidFields(), Router::mapResources(), AclShell::nodeExists(), Folder::realpath(), Controller::redirect(), ContainableBehavior::setup(), AjaxHelper::sortable(), Multibyte::strripos(), Multibyte::strrpos(), Multibyte::utf8(), JavascriptHelper::value(), AclShell::view(), and Cache::write().

listClasses ( path  ) 

Deprecated:
See also:
Configure::listObjects('file', $path);

Definition at line 1070 of file basics.php.

References Configure::listObjects().

Referenced by loadPluginModels().

loadBehavior ( name  ) 

Deprecated:
See also:
App::import('Behavior', 'BehaviorrName');

Definition at line 979 of file basics.php.

References App::import().

loadComponent ( name  ) 

Deprecated:
See also:
App::import('Component', 'ComponentName');

Definition at line 963 of file basics.php.

References App::import().

loadController ( name  ) 

Deprecated:
See also:
App::import('Controller', 'ControllerName');

Definition at line 939 of file basics.php.

References App::import().

loadControllers (  ) 

Deprecated:
See also:
$controllers = Configure::listObjects('controller'); and App::import('Controller', $controllers); or App::import('Controller', array(List of Controllers);

Definition at line 1046 of file basics.php.

References am(), App::import(), and Configure::listObjects().

loadHelper ( name  ) 

Deprecated:
See also:
App::import('Helper', 'HelperName');

Definition at line 947 of file basics.php.

References App::import().

loadModel ( name = null  ) 

Deprecated:
See also:
App::import('Model', 'ModelName');

Definition at line 931 of file basics.php.

References App::import().

Referenced by loadPluginModels().

loadModels (  ) 

Deprecated:
See also:
$model = Configure::listObjects('model'); and App::import('Model', $models); or App::import('Model', array(List of Models));

Definition at line 988 of file basics.php.

References am(), App::import(), and Configure::listObjects().

loadPluginComponent ( plugin,
component 
)

Deprecated:
See also:
App::import('Component', 'PluginName.ComponentName');

Definition at line 971 of file basics.php.

References App::import().

loadPluginHelper ( plugin,
helper 
)

Deprecated:
See also:
App::import('Helper', 'PluginName.HelperName');

Definition at line 955 of file basics.php.

References App::import().

loadPluginModels ( plugin  ) 

Deprecated:
See also:
App::import('Model', 'PluginName.PluginModel');

Definition at line 1012 of file basics.php.

References Inflector::camelize(), App::import(), listClasses(), loadModel(), Overloadable::overload(), and Inflector::underscore().

loadView ( name  ) 

Deprecated:
See also:
App::import('View', 'ViewName');

Definition at line 923 of file basics.php.

References App::import().

low ( str  ) 

paths (  ) 

pr ( var  ) 

Print_r convenience function, which prints out

 tags around
 the output of given array. Similar to debug().

 
See also:
debug()
Parameters:
array $var Variable to print out
boolean $showFrom If set to true, the method prints from where the function was called

Definition at line 301 of file basics.php.

References Configure::read().

Referenced by Debugger::dump().

r ( search,
replace,
subject 
)

Convenience method for str_replace().

Parameters:
string $search String to be replaced
string $replace String to insert
string $subject String to search
Returns:
string Replaced string

Definition at line 290 of file basics.php.

Referenced by Validation::date(), debug(), env(), ShellDispatcher::help(), ConsoleShell::initialize(), Shell::shortPath(), and TimeHelper::wasWithinLast().

setUri (  ) 

Deprecated:
See also:
Dispatcher::uri();

Definition at line 1156 of file basics.php.

setUrl (  ) 

Deprecated:
See also:
Dispatcher::getUrl();

Definition at line 1163 of file basics.php.

stripslashes_deep ( value  ) 

Recursively strips slashes from all values in an array

Parameters:
array $value Array of values to strip slashes
Returns:
mixed What is returned from calling stripslashes

Definition at line 556 of file basics.php.

Referenced by Router::parse(), and Dispatcher::parseParams().

up ( str  ) 

Convenience method for strtoupper().

Parameters:
string $str String to uppercase
Returns:
string Uppercased string

Definition at line 279 of file basics.php.

Referenced by Shell::in().

uses (  ) 

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

Example: uses('flay', 'time');

Parameters:
string $name Filename without the .php part

Definition at line 90 of file basics.php.

References $file.

Referenced by Shell::_loadModels(), Controller::constructClasses(), Shell::createFile(), TextHelper::flay(), FileEngine::init(), Controller::loadModel(), Object::log(), ProjectTask::securitySalt(), AclBehavior::setup(), and AuthComponent::startup().


Variable Documentation

$a2 = array_values($a2)

Definition at line 173 of file basics.php.

$bad = array("\n", "\r", "\t")

Definition at line 826 of file basics.php.

Referenced by ModelTask::doAssociations().

$c1 = count($a1)

Definition at line 174 of file basics.php.

$c2 = count($a2)

Definition at line 175 of file basics.php.

$good = ' '

Definition at line 827 of file basics.php.

$out = array()

Definition at line 879 of file basics.php.

Referenced by AjaxHelper::_buildOptions(), Helper::_parseAttributes(), View::_render(), AjaxHelper::afterRender(), DboOracle::alterSchema(), DboMysql::alterSchema(), Helper::assign(), PluginTask::bake(), ModelTask::bake(), DbConfigTask::bake(), ControllerTask::bake(), TestTask::bake(), ControllerTask::bakeTest(), DboSqlite::buildColumn(), DboPostgres::buildColumn(), DboAdodb::buildColumn(), DboSqlite::buildIndex(), DboPostgres::buildIndex(), DboMssql::buildIndex(), CacheHelper::cache(), Security::cipher(), Set::combine(), DboSource::conditionKeysToString(), DboSource::conditions(), PaginatorHelper::counter(), HtmlHelper::css(), Set::diff(), DboMysql::dropSchema(), XmlHelper::elem(), FormHelper::end(), Shell::error(), Debugger::exportVar(), DboSource::fetchAll(), Folder::findRecursive(), PaginatorHelper::first(), ModelTask::fixture(), SessionHelper::flash(), NumberHelper::format(), Set::format(), JavascriptHelper::getCache(), HtmlHelper::getCrumbs(), JsHelper::if_(), FormHelper::input(), FormHelper::inputs(), RssHelper::items(), PaginatorHelper::last(), JavascriptHelper::link(), SecurityComponent::loginRequest(), AclShell::main(), HtmlHelper::meta(), PaginatorHelper::numbers(), JsHelper::object(), JavascriptHelper::object(), Router::parse(), FormHelper::radio(), View::render(), View::renderCache(), Set::reverse(), DboSource::showQuery(), AclShell::startup(), HtmlHelper::style(), FormHelper::submit(), HtmlHelper::tableCells(), HtmlHelper::tableHeaders(), Flay::toHtml(), CakeSchema::write(), and JavascriptHelper::writeEvents().

$res = @fopen($fileName, 'w+b')

Definition at line 427 of file basics.php.

Referenced by DboFirebird::lastInsertId(), and DboOracle::queryAssociation().

return $write

Definition at line 434 of file basics.php.

Referenced by SchemaShell::dump(), and Configure::store().

return false

Definition at line 437 of file basics.php.