From a75e08976f2af9724210cd2f48ea2988127539a1 Mon Sep 17 00:00:00 2001
From: phpnut transforms and > to >, no typography additions.
- * @param boolean $allowHtml Set this to trim whitespace and disable all HTML
- * @return string Formatted text
- */
- function toHtml ($text=null, $bare=false, $allowHtml=false)
- {
+ * Returns given text translated to HTML using the Flay syntax.
+ *
+ * @param string $text String to format
+ * @param boolean $bare Set this to only do transforms and > to >, no typography additions.
+ * @param boolean $allowHtml Set this to trim whitespace and disable all HTML
+ * @return string Formatted text
+ */
+ function toHtml ($text=null, $bare=false, $allowHtml=false)
+ {
if (empty($text) && empty($this->text))
{
@@ -91,7 +91,7 @@ class Flay extends Object
$text = $text? $text: $this->text;
- // trim whitespace and disable all HTML
+// trim whitespace and disable all HTML
if ($allowHtml)
{
$text = trim($text);
@@ -103,17 +103,17 @@ class Flay extends Object
if (!$bare)
{
- // multi-paragraph functions
+// multi-paragraph functions
$text = preg_replace('#(?:[\n]{0,2})"""(.*)"""(?:[\n]{0,2})#s', "\n\n%BLOCKQUOTE%\n\n\\1\n\n%ENDBLOCKQUOTE%\n\n", $text);
$text = preg_replace('#(?:[\n]{0,2})===(.*)===(?:[\n]{0,2})#s', "\n\n%CENTER%\n\n\\1\n\n%ENDCENTER%\n\n", $text);
}
- // pre-parse newlines
+// pre-parse newlines
$text = preg_replace("#\r\n#", "\n", $text);
$text = preg_replace("#[\n]{2,}#", "%PARAGRAPH%", $text);
$text = preg_replace('#[\n]{1}#', "%LINEBREAK%", $text);
- // split into paragraphs and parse
+// split into paragraphs and parse
$out = '';
foreach (split('%PARAGRAPH%', $text) as $line)
{
@@ -123,64 +123,64 @@ class Flay extends Object
if (!$bare)
{
- // pre-parse links
- $links = array();
- $regs = null;
- if (preg_match_all('#\[([^\[]{4,})\]#', $line, $regs))
- {
+// pre-parse links
+ $links = array();
+ $regs = null;
+ if (preg_match_all('#\[([^\[]{4,})\]#', $line, $regs))
+ {
foreach ($regs[1] as $reg)
{
$links[] = $reg;
$line = str_replace("[{$reg}]",'%LINK'.(count($links)-1).'%', $line);
}
- }
+ }
- // MAIN TEXT FUNCTIONS
- // bold
- $line = ereg_replace("\*([^\*]*)\*", "\\1", $line);
- // italic
- $line = ereg_replace("_([^_]*)_", "\\1", $line);
+// MAIN TEXT FUNCTIONS
+// bold
+ $line = ereg_replace("\*([^\*]*)\*", "\\1", $line);
+// italic
+ $line = ereg_replace("_([^_]*)_", "\\1", $line);
}
- // entities
+// entities
$line = str_replace(' - ', ' – ', $line);
$line = str_replace(' -- ', ' — ', $line);
$line = str_replace('(C)', '©', $line);
$line = str_replace('(R)', '®', $line);
$line = str_replace('(TM)', '™', $line);
- // guess e-mails
+// guess e-mails
$emails = null;
if (preg_match_all("#([_A-Za-z0-9+-+]+(?:\.[_A-Za-z0-9+-]+)*@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*)#", $line, $emails))
{
- foreach ($emails[1] as $email)
- {
+ foreach ($emails[1] as $email)
+ {
$line = str_replace($email, "{$email}", $line);
- }
+ }
}
if (!$bare)
{
- // guess links
- $urls = null;
- if (preg_match_all("#((?:http|https|ftp|nntp)://[^ ]+)#", $line, $urls))
- {
+// guess links
+ $urls = null;
+ if (preg_match_all("#((?:http|https|ftp|nntp)://[^ ]+)#", $line, $urls))
+ {
foreach ($urls[1] as $url)
{
$line = str_replace($url, "{$url}", $line);
}
- }
- if (preg_match_all("#(www\.[^\n\%\ ]+[^\n\%\,\.\ ])#", $line, $urls))
- {
+ }
+ if (preg_match_all("#(www\.[^\n\%\ ]+[^\n\%\,\.\ ])#", $line, $urls))
+ {
foreach ($urls[1] as $url)
{
$line = str_replace($url, "{$url}", $line);
}
- }
+ }
- // re-parse links
- if (count($links))
- {
+// re-parse links
+ if (count($links))
+ {
for ($ii=0; $ii {$line} %BLOCKQUOTE% %ENDBLOCKQUOTE% %CENTER% Query: {$sql} [Aff:{$this->affected} Num:{$this->numRows} Took:{$this->took}ms]");
if($error)
{
print(" tags around
* the output of given array. Similar to debug().
*
- * @see debug()
- * @param array $var
+ * @see debug()
+ * @param array $var
*/
function pr($var)
{
@@ -750,14 +760,14 @@ function env($key)
if (!function_exists('file_get_contents'))
{
- /**
- * Returns contents of a file as a string.
- *
- * @param string $fileName Name of the file.
- * @param boolean $useIncludePath Wheter the function should use the
- * include path or not.
- * @return mixed Boolean false or contents of required file.
- */
+/**
+ * Returns contents of a file as a string.
+ *
+ * @param string $fileName Name of the file.
+ * @param boolean $useIncludePath Wheter the function should use the
+ * include path or not.
+ * @return mixed Boolean false or contents of required file.
+ */
function file_get_contents($fileName, $useIncludePath = false)
{
$res = fopen($fileName, 'rb', $useIncludePath);
@@ -788,15 +798,15 @@ if (!function_exists('file_get_contents'))
if (!function_exists('file_put_contents'))
{
- /**
- * Writes data into file.
- *
- * If file exists, it will be overwritten. If data is an array, it will be
- * join()ed with an empty string.
- *
- * @param string $fileName File name.
- * @param mixed $data String or array.
- */
+/**
+ * Writes data into file.
+ *
+ * If file exists, it will be overwritten. If data is an array, it will be
+ * join()ed with an empty string.
+ *
+ * @param string $fileName File name.
+ * @param mixed $data String or array.
+ */
function file_put_contents($fileName, $data)
{
if (is_array($data))
@@ -843,12 +853,12 @@ function cache($path, $data = null, $expires = '+1 day', $target = 'cache')
if ($data == null)
{
- // Read data from file
+// Read data from file
if (file_exists($filename) && $filetime !== false)
{
if ($filetime + $timediff < $now)
{
- // File has expired
+// File has expired
@unlink($filename);
}
else
@@ -906,8 +916,8 @@ function countdim($array)
}
/**
- * Shortcut to Log::write.
- */
+ * Shortcut to Log::write.
+ */
function LogError ($message)
{
if(!class_exists('CakeLog'))
diff --git a/cake/bootstrap.php b/cake/bootstrap.php
index 75ce37413..521bd43cf 100644
--- a/cake/bootstrap.php
+++ b/cake/bootstrap.php
@@ -79,7 +79,7 @@ else
}
else
{
- $url = $_GET['url'];
+ $url = $_GET['url'];
}
}
@@ -87,8 +87,8 @@ else
if (strpos($url, 'ccss/') === 0)
{
- include WWW_ROOT.DS.'css.php';
- die();
+ include WWW_ROOT.DS.'css.php';
+ die();
}
diff --git a/cake/config/paths.php b/cake/config/paths.php
index 8c5554a2e..166b7c7a5 100644
--- a/cake/config/paths.php
+++ b/cake/config/paths.php
@@ -36,12 +36,12 @@
*/
if(!defined('ROOT'))
{
- define ('ROOT', '../');
+ define ('ROOT', '../');
}
if(!defined('WEBROOT_DIR'))
{
- define ('WEBROOT_DIR', 'webroot');
+ define ('WEBROOT_DIR', 'webroot');
}
/**
diff --git a/cake/dispatcher.php b/cake/dispatcher.php
index a9e4d6ab9..145b83a3b 100644
--- a/cake/dispatcher.php
+++ b/cake/dispatcher.php
@@ -49,30 +49,30 @@ class Dispatcher extends Object
* Base URL
* @var string
*/
- var $base = false;
+ var $base = false;
/**
* @var string
*/
- var $admin = false;
+ var $admin = false;
/**
* @var string
*/
- var $webservices = null;
+ var $webservices = null;
/**
* @var string
*/
- var $plugin = null;
+ var $plugin = null;
/**
* Constructor.
*/
- function __construct()
- {
+ function __construct()
+ {
parent::__construct();
- }
+ }
/**
* Dispatches and invokes given URL, handing over control to the involved controllers, and then renders the results (if autoRender is set).
@@ -84,12 +84,12 @@ class Dispatcher extends Object
* @param string $url URL information to work on.
* @return boolean Success
*/
- function dispatch($url, $additionalParams=array())
- {
+ function dispatch($url, $additionalParams=array())
+ {
$params = array_merge($this->parseParams($url), $additionalParams);
$missingController = false;
$missingAction = false;
- $missingView = false;
+ $missingView = false;
$privateAction = false;
$this->base = $this->baseUrl();
if (empty($params['controller']))
@@ -125,11 +125,18 @@ class Dispatcher extends Object
else
{
$ctrlClass = $pluginClass;
+ $oldAction = $params['action'];
$params = $this->_restructureParams($params);
$plugin = Inflector::underscore($ctrlName);
$this->plugin = $plugin.DS;
loadPluginModels($plugin);
$this->base = $this->base.'/'.Inflector::underscore($ctrlName);
+ if(empty($params['controller']) || !class_exists($pluginClass))
+ {
+ $params['controller'] = Inflector::underscore($ctrlName);
+ $ctrlClass = $ctrlName.'Controller';
+ $params['action'] = $oldAction;
+ }
}
}
}
@@ -157,7 +164,7 @@ class Dispatcher extends Object
if ($missingController)
{
return $this->cakeError('missingController',array(array('className' => Inflector::camelize($params['controller']."Controller"),
- 'webroot' => $this->webroot)));
+ 'webroot' => $this->webroot)));
}
else
{
@@ -229,7 +236,7 @@ class Dispatcher extends Object
}
return $this->_invoke($controller, $params);
- }
+ }
/**
* Invokes given controller's render action if autoRender option is set. Otherwise the contents of the operation are returned as a string.
@@ -238,47 +245,47 @@ class Dispatcher extends Object
* @param array $params
* @return string
*/
- function _invoke (&$controller, $params)
- {
- if (!empty($controller->beforeFilter))
- {
- if(is_array($controller->beforeFilter))
- {
- foreach($controller->beforeFilter as $filter)
- {
- if(is_callable(array($controller,$filter)) && $filter != 'beforeFilter')
- {
- $controller->$filter();
- }
- }
- }
- else
- {
- if(is_callable(array($controller, $controller->beforeFilter)) && $controller->beforeFilter != 'beforeFilter')
- {
- $controller->{$controller->beforeFilter}();
- }
- }
- }
- $controller->beforeFilter();
+ function _invoke (&$controller, $params)
+ {
+ if (!empty($controller->beforeFilter))
+ {
+ if(is_array($controller->beforeFilter))
+ {
+ foreach($controller->beforeFilter as $filter)
+ {
+ if(is_callable(array($controller,$filter)) && $filter != 'beforeFilter')
+ {
+ $controller->$filter();
+ }
+ }
+ }
+ else
+ {
+ if(is_callable(array($controller, $controller->beforeFilter)) && $controller->beforeFilter != 'beforeFilter')
+ {
+ $controller->{$controller->beforeFilter}();
+ }
+ }
+ }
+ $controller->beforeFilter();
- foreach($controller->components as $c)
- {
- if (isset($controller->{$c}) && is_object($controller->{$c}) && is_callable(array($controller->{$c}, 'startup')))
- {
- $controller->{$c}->startup($controller);
- }
- }
+ foreach($controller->components as $c)
+ {
+ if (isset($controller->{$c}) && is_object($controller->{$c}) && is_callable(array($controller->{$c}, 'startup')))
+ {
+ $controller->{$c}->startup($controller);
+ }
+ }
- $output = call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']);
- if ($controller->autoRender)
- {
- $output = $controller->render();
- }
- $controller->output =& $output;
- $controller->afterFilter();
- return $controller->output;
- }
+ $output = call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']);
+ if ($controller->autoRender)
+ {
+ $output = $controller->render();
+ }
+ $controller->output =& $output;
+ $controller->afterFilter();
+ return $controller->output;
+ }
/**
* Returns array of GET and POST parameters. GET parameters are taken from given URL.
@@ -286,52 +293,52 @@ class Dispatcher extends Object
* @param string $from_url URL to mine for parameter information.
* @return array Parameters found in POST and GET.
*/
- function parseParams($from_url)
- {
- // load routes config
- $Route = new Router();
- include CONFIGS.'routes.php';
- $params = $Route->parse ($from_url);
+ function parseParams($from_url)
+ {
+// load routes config
+ $Route = new Router();
+ include CONFIGS.'routes.php';
+ $params = $Route->parse ($from_url);
- if (ini_get('magic_quotes_gpc') == 1)
- {
- if(!empty($_POST))
- {
- $params['form'] = stripslashes_deep($_POST);
- }
- }
- else
- {
- $params['form'] = $_POST;
- }
+ if (ini_get('magic_quotes_gpc') == 1)
+ {
+ if(!empty($_POST))
+ {
+ $params['form'] = stripslashes_deep($_POST);
+ }
+ }
+ else
+ {
+ $params['form'] = $_POST;
+ }
- if (isset($params['form']['data']))
- {
- $params['data'] = $params['form']['data'];
- }
+ if (isset($params['form']['data']))
+ {
+ $params['data'] = $params['form']['data'];
+ }
- if (isset($_GET))
- {
- if (ini_get('magic_quotes_gpc') == 1)
- {
- $params['url'] = stripslashes_deep($_GET);
- }
- else
- {
- $params['url'] = $_GET;
- }
- }
+ if (isset($_GET))
+ {
+ if (ini_get('magic_quotes_gpc') == 1)
+ {
+ $params['url'] = stripslashes_deep($_GET);
+ }
+ else
+ {
+ $params['url'] = $_GET;
+ }
+ }
- foreach ($_FILES as $name => $data)
- {
- $params['form'][$name] = $data;
- }
- $params['bare'] = empty($params['ajax'])? (empty($params['bare'])? 0: 1): 1;
+ foreach ($_FILES as $name => $data)
+ {
+ $params['form'][$name] = $data;
+ }
+ $params['bare'] = empty($params['ajax'])? (empty($params['bare'])? 0: 1): 1;
- $params['webservices'] = empty($params['webservices']) ? null : $params['webservices'];
+ $params['webservices'] = empty($params['webservices']) ? null : $params['webservices'];
- return $params;
- }
+ return $params;
+ }
/**
* Returns a base URL.
@@ -340,18 +347,18 @@ class Dispatcher extends Object
*/
function baseUrl()
{
- $htaccess = null;
- $base = $this->admin;
- $this->webroot = '';
- if (defined('BASE_URL'))
- {
- $base = BASE_URL.$this->admin;
- }
+ $htaccess = null;
+ $base = $this->admin;
+ $this->webroot = '';
+ if (defined('BASE_URL'))
+ {
+ $base = BASE_URL.$this->admin;
+ }
- $docRoot = env('DOCUMENT_ROOT');
- $scriptName = env('PHP_SELF');
+ $docRoot = env('DOCUMENT_ROOT');
+ $scriptName = env('PHP_SELF');
- // If document root ends with 'webroot', it's probably correctly set
+// If document root ends with 'webroot', it's probably correctly set
$r = null;
if (preg_match('/'.APP_DIR.'\\'.DS.WEBROOT_DIR.'/', $docRoot))
{
@@ -399,21 +406,21 @@ class Dispatcher extends Object
}
}
return $base;
- }
+ }
- function _restructureParams($params)
- {
- $params['controller'] = $params['action'];
- if(isset($params['pass'][0]))
- {
- $params['action'] = $params['pass'][0];
- array_shift($params['pass']);
- }
- else
- {
- $params['action'] = null;
- }
- return $params;
- }
+ function _restructureParams($params)
+ {
+ $params['controller'] = $params['action'];
+ if(isset($params['pass'][0]))
+ {
+ $params['action'] = $params['pass'][0];
+ array_shift($params['pass']);
+ }
+ else
+ {
+ $params['action'] = null;
+ }
+ return $params;
+ }
}
?>
\ No newline at end of file
diff --git a/cake/docs/CHANGELOG.txt b/cake/docs/CHANGELOG.txt
index 6b9988c68..fc14935bb 100644
--- a/cake/docs/CHANGELOG.txt
+++ b/cake/docs/CHANGELOG.txt
@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////
-// +---------------------------------------------------------------------------------------------------+ //
+// +---------------------------------------------------------------------------------------------------+//
// + $Id$
// + Last Modified: $Date$
// + Modified By: $LastChangedBy$
-// +---------------------------------------------------------------------------------------------------+ //
+// +---------------------------------------------------------------------------------------------------+//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/cake/docs/CREDITS.txt b/cake/docs/CREDITS.txt
index 6b9988c68..fc14935bb 100644
--- a/cake/docs/CREDITS.txt
+++ b/cake/docs/CREDITS.txt
@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////
-// +---------------------------------------------------------------------------------------------------+ //
+// +---------------------------------------------------------------------------------------------------+//
// + $Id$
// + Last Modified: $Date$
// + Modified By: $LastChangedBy$
-// +---------------------------------------------------------------------------------------------------+ //
+// +---------------------------------------------------------------------------------------------------+//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/cake/docs/GOTCHAS.txt b/cake/docs/GOTCHAS.txt
index 8a99a96e0..b903f01e8 100644
--- a/cake/docs/GOTCHAS.txt
+++ b/cake/docs/GOTCHAS.txt
@@ -1,9 +1,9 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////
-// +---------------------------------------------------------------------------------------------------+ //
+// +---------------------------------------------------------------------------------------------------+//
// + $Id$
// + Last Modified:$
// + Modified By:$
-// +---------------------------------------------------------------------------------------------------+ //
+// +---------------------------------------------------------------------------------------------------+//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
You can find some help with problems you may have installing CakePHP here:
diff --git a/cake/docs/README.txt b/cake/docs/README.txt
index 46f7b6cd3..c6c37ac5d 100644
--- a/cake/docs/README.txt
+++ b/cake/docs/README.txt
@@ -1,9 +1,9 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////
-// +---------------------------------------------------------------------------------------------------+ //
+// +---------------------------------------------------------------------------------------------------+//
// + $Id$
// + Last Modified: $Date$
// + Modified By: $LastChangedBy$
-// +---------------------------------------------------------------------------------------------------+ //
+// +---------------------------------------------------------------------------------------------------+//
///////////////////////////////////////////////////////////////////////////////////////////////////////////
This README will be updated
diff --git a/cake/libs/bake.php b/cake/libs/bake.php
index 2f4d8e654..20e74062b 100644
--- a/cake/libs/bake.php
+++ b/cake/libs/bake.php
@@ -39,11 +39,11 @@ uses('object', 'inflector');
* @package cake
* @subpackage cake.libs
* @since CakePHP v CakePHP v 0.10.3.1612
- */
+ */
class Bake extends Object
{
- /**
+/**
* Standard input stream (php://stdin).
*
* @var resource
@@ -51,7 +51,7 @@ class Bake extends Object
*/
var $stdin = null;
- /**
+/**
* Standard output stream (php://stdout).
*
* @var resource
@@ -59,7 +59,7 @@ class Bake extends Object
*/
var $stdout = null;
- /**
+/**
* Standard error stream (php://stderr).
*
* @var resource
@@ -67,7 +67,7 @@ class Bake extends Object
*/
var $stderr = null;
- /**
+/**
* Counts actions taken.
*
* @var integer
@@ -75,7 +75,7 @@ class Bake extends Object
*/
var $actions = null;
- /**
+/**
* Decides whether to overwrite existing files without asking.
*
* @var boolean
@@ -83,7 +83,7 @@ class Bake extends Object
*/
var $dontAsk = false;
- /**
+/**
* Returns code template for PHP file generator.
*
* @param string $type
@@ -94,24 +94,24 @@ class Bake extends Object
{
switch ($type)
{
- case 'view': return "%s";
+ case 'view': return "%s";
case 'model': return "";
case 'action': return "\n\tfunction %s () {\n\t\t\n\t}\n";
- case 'ctrl': return "";
+ case 'ctrl': return "";
case 'helper': return "";
- case 'test': return 'abc = new %s ();
}
- // called after the tests
+// called after the tests
function tearDown()
{
unset($this->abc);
@@ -120,7 +120,7 @@ class %sTest extends TestCase
/*
function testFoo ()
{
- $result = $this->abc->Foo();
+ $result = $this->abc->Foo();
$expected = \'\';
$this->assertEquals($result, $expected);
}
@@ -133,7 +133,7 @@ class %sTest extends TestCase
}
}
- /**
+/**
* Baker's constructor method. Initialises bakery, and starts production.
*
* @param string $type
@@ -152,7 +152,7 @@ class %sTest extends TestCase
$this->stdout = fopen('php://stdout', 'w');
$this->stderr = fopen('php://stderr', 'w');
- // Output directory name
+// Output directory name
fwrite($this->stderr, "\n".substr(ROOT,0,strlen(ROOT)-1).":\n".str_repeat('-',strlen(ROOT)+1)."\n");
switch ($type)
@@ -172,7 +172,7 @@ class %sTest extends TestCase
$add_actions = array();
$controllerPlural = Inflector::pluralize($controller);
-
+
if ($controllerPlural != $controller)
{
fwrite($this->stdout, "I use pluralized Controller names. You entered '$controller'. I can inflect it to '$controllerPlural'. Should I? If no, I will use '$controller'. [y/n/q] ");
@@ -221,7 +221,7 @@ class %sTest extends TestCase
}
}
- /**
+/**
* Creates new view in VIEWS/$controller/ directory.
*
* @param string $controller
@@ -245,7 +245,7 @@ class %sTest extends TestCase
$this->actions++;
}
- /**
+/**
* Creates new controller with defined actions, controller's test and
* helper with helper's test.
*
@@ -263,12 +263,12 @@ class %sTest extends TestCase
{
$this->makeController($name, $actions);
$this->makeControllerTest($name);
- //$this->makeHelper($name);
- //$this->makeHelperTest($name);
+//$this->makeHelper($name);
+//$this->makeHelperTest($name);
$this->actions++;
}
- /**
+/**
* Creates new controller file with defined actions.
*
* @param string $name
@@ -284,14 +284,14 @@ class %sTest extends TestCase
*/
function makeController ($name, $actions)
{
- $ctrl = $this->makeControllerName($name);
+ $ctrl = $this->makeControllerName($name);
$helper = $this->makeHelperName($name);
- //$body = sprintf($this->template('ctrl'), $ctrl, $helper, join('', $this->getActions($actions)));
- $body = sprintf($this->template('ctrl'), $ctrl, 'AppController', join('', $this->getActions($actions)));
+//$body = sprintf($this->template('ctrl'), $ctrl, $helper, join('', $this->getActions($actions)));
+ $body = sprintf($this->template('ctrl'), $ctrl, 'AppController', join('', $this->getActions($actions)));
return $this->createFile($this->makeControllerFn($name), $body);
}
- /**
+/**
* Returns controller's name in CamelCase.
*
* @param string $name
@@ -304,7 +304,7 @@ class %sTest extends TestCase
return Inflector::camelize($name).'Controller';
}
- /**
+/**
* Returns a name for controller's file, underscored.
*
* @param string $name
@@ -317,7 +317,7 @@ class %sTest extends TestCase
return CONTROLLERS.Inflector::underscore($name).'_controller.php';
}
- /**
+/**
* Creates new test for a controller.
*
* @param string $name
@@ -331,13 +331,13 @@ class %sTest extends TestCase
*/
function makeControllerTest ($name)
{
- $fn = CONTROLLER_TESTS.Inflector::underscore($name).'_controller_test.php';
+ $fn = CONTROLLER_TESTS.Inflector::underscore($name).'_controller_test.php';
$body = $this->getTestBody($this->makeControllerName($name));
- return true; //$this->createFile($fn, $body); // Disable creating tests till later
+ return true;//$this->createFile($fn, $body);// Disable creating tests till later
}
- /**
+/**
* Creates new helper.
*
* @param string $name
@@ -355,7 +355,7 @@ class %sTest extends TestCase
return $this->createFile($this->makeHelperFn($name), $body);
}
- /**
+/**
* Returns CamelCase name for a helper.
*
* @param string $name
@@ -368,7 +368,7 @@ class %sTest extends TestCase
return Inflector::camelize($name).'Helper';
}
- /**
+/**
* Underscores file name for a helper.
*
* @param string $name
@@ -382,7 +382,7 @@ class %sTest extends TestCase
return HELPERS.Inflector::underscore($name).'_helper.php';
}
- /**
+/**
* Creates new test for a helper.
*
* @param string $name
@@ -396,13 +396,13 @@ class %sTest extends TestCase
*/
function makeHelperTest ($name)
{
- $fn = HELPER_TESTS.Inflector::underscore($name).'_helper_test.php';
+ $fn = HELPER_TESTS.Inflector::underscore($name).'_helper_test.php';
$body = $this->getTestBody($this->makeHelperName($name));
return $this->createFile($fn, $body);
}
- /**
+/**
* Returns an array of actions' templates.
*
* @param array $as
@@ -420,7 +420,7 @@ class %sTest extends TestCase
return $out;
}
- /**
+/**
* Returns a test template for given class.
*
* @param string $class
@@ -433,7 +433,7 @@ class %sTest extends TestCase
return sprintf($this->template('test'), $class, $class);
}
- /**
+/**
* Creates new model.
*
* @param string $name
@@ -470,12 +470,12 @@ class %sTest extends TestCase
}
$this->createFile($this->getModelFn($name), sprintf($this->template('model'), $this->getModelName($name)));
- //$this->makeModelTest ($name);
- // TODO: Add model test back when I'm less lazy
+//$this->makeModelTest ($name);
+// TODO: Add model test back when I'm less lazy
$this->actions++;
}
- /**
+/**
* Returns an underscored filename for a model.
*
* @param string $name
@@ -489,7 +489,7 @@ class %sTest extends TestCase
return MODELS.Inflector::underscore($name).'.php';
}
- /**
+/**
* Creates a test for a given model.
*
* @param string $name
@@ -503,13 +503,13 @@ class %sTest extends TestCase
*/
function makeModelTest ($name)
{
- $fn = MODEL_TESTS.Inflector::underscore($name).'_test.php';
+ $fn = MODEL_TESTS.Inflector::underscore($name).'_test.php';
$body = $this->getTestBody($this->getModelName($name));
return $this->createFile($fn, $body);
}
- /**
+/**
* Returns CamelCased name of a model.
*
* @param string $name
@@ -522,7 +522,7 @@ class %sTest extends TestCase
return Inflector::camelize($name);
}
- /**
+/**
* Creates a file with given path and contents.
*
* @param string $path
@@ -558,7 +558,7 @@ class %sTest extends TestCase
}
else
{
- fwrite($this->stdout, "Skip {$shortPath}\n");
+ fwrite($this->stdout, "Skip {$shortPath}\n");
return false;
}
}
@@ -567,19 +567,19 @@ class %sTest extends TestCase
{
fwrite($f, $contents);
fclose($f);
- fwrite($this->stdout, "Wrote {$shortPath}\n");
- // debug ("Wrote {$path}");
+ fwrite($this->stdout, "Wrote {$shortPath}\n");
+// debug ("Wrote {$path}");
return true;
}
else
{
fwrite($this->stderr, "Error! Couldn't open {$shortPath} for writing.\n");
- // debug ("Error! Couldn't open {$path} for writing.");
+// debug ("Error! Couldn't open {$path} for writing.");
return false;
}
}
- /**
+/**
* Creates a directory with given path.
*
* @param string $path
@@ -600,13 +600,13 @@ class %sTest extends TestCase
if (mkdir($path))
{
fwrite($this->stdout, "Created {$shortPath}\n");
- // debug ("Created {$path}");
+// debug ("Created {$path}");
return true;
}
else
{
fwrite($this->stderr, "Error! Couldn't create dir {$shortPath}\n");
- // debug ("Error! Couldn't create dir {$path}");
+// debug ("Error! Couldn't create dir {$path}");
return false;
}
}
diff --git a/cake/libs/cache.php b/cake/libs/cache.php
index 3cbc51ce8..35b22c36c 100644
--- a/cake/libs/cache.php
+++ b/cake/libs/cache.php
@@ -30,9 +30,9 @@
/**
- * Included libraries.
- *
- */
+ * Included libraries.
+ *
+ */
if(!class_exists('Model'))
{
uses(DS.'model'.DS.'model');
@@ -48,64 +48,64 @@ if(!class_exists('Model'))
*/
class Cache extends Model {
- /**
- * Identifier. Either an MD5 string or NULL.
- *
- * @var string
- */
+/**
+ * Identifier. Either an MD5 string or NULL.
+ *
+ * @var string
+ */
var $id = null;
- /**
- * Content container for cache data.
- *
- * @var unknown_type
- */
+/**
+ * Content container for cache data.
+ *
+ * @var unknown_type
+ */
var $data = null;
- /**
- * Content to be cached.
- *
- * @var unknown_type
- */
+/**
+ * Content to be cached.
+ *
+ * @var unknown_type
+ */
var $for_caching = null;
- /**
- * Name of the database table used for caching.
- *
- * @var string
- */
+/**
+ * Name of the database table used for caching.
+ *
+ * @var string
+ */
var $useTable = 'cache';
- /**
- * Constructor. Generates an md5'ed id for internal use. Calls the constructor on Model as well.
- *
- * @param unknown_type $id
- */
+/**
+ * Constructor. Generates an md5'ed id for internal use. Calls the constructor on Model as well.
+ *
+ * @param unknown_type $id
+ */
function __construct ($id)
{
$this->id = (md5($id));
parent::__construct($this->id);
}
- /**
- * Returns this object's id after setting it. If called without parameters the current object's id is returned.
- *
- * @param unknown_type $id
- * @return unknown
- */
+/**
+ * Returns this object's id after setting it. If called without parameters the current object's id is returned.
+ *
+ * @param unknown_type $id
+ * @return unknown
+ */
function id ($id=null)
{
if (!$id) return $this->id;
return ($this->id = $id);
}
- /**
- * Store given content in cache database.
- *
- * @param string $content Content to keep in cache.
- * @param int $keep_for Number of seconds to keep data in cache.
- * @return boolean Success
- */
+/**
+ * Store given content in cache database.
+ *
+ * @param string $content Content to keep in cache.
+ * @param int $keep_for Number of seconds to keep data in cache.
+ * @return boolean Success
+ */
function remember ($content, $keep_for=CACHE_PAGES_FOR)
{
$data = addslashes($this->for_caching.$content);
@@ -113,12 +113,12 @@ class Cache extends Model {
return $this->query("REPLACE {$this->useTable} (id,data,expire) VALUES ('{$this->id}', '{$data}', '{$expire}')");
}
- /**
- * Returns content from the Cache object itself, if the Cache object has a non-empty data property.
- * Else from the database cache.
- *
- * @return unknown
- */
+/**
+ * Returns content from the Cache object itself, if the Cache object has a non-empty data property.
+ * Else from the database cache.
+ *
+ * @return unknown
+ */
function restore()
{
if (empty($this->data['data']))
@@ -127,31 +127,31 @@ class Cache extends Model {
return $this->data['data'];
}
- /**
- * Returns true if the cache data property has current (non-stale) content for given id.
- *
- * @return boolean
- */
+/**
+ * Returns true if the cache data property has current (non-stale) content for given id.
+ *
+ * @return boolean
+ */
function has()
{
return is_array($this->data = $this->find("id='{$this->id}' AND expire>NOW()"));
}
- /**
- * Appends $string to the for_caching property of the Cache object.
- *
- * @param string $string
- */
+/**
+ * Appends $string to the for_caching property of the Cache object.
+ *
+ * @param string $string
+ */
function append($string)
{
$this->for_caching .= $string;
}
- /**
- * Clears the cache database table.
- *
- * @return unknown
- */
+/**
+ * Clears the cache database table.
+ *
+ * @return unknown
+ */
function clear()
{
return $this->query("DELETE FROM {$this->useTable}");
diff --git a/cake/libs/cake_log.php b/cake/libs/cake_log.php
index e7ef5af06..1fa7f801a 100644
--- a/cake/libs/cake_log.php
+++ b/cake/libs/cake_log.php
@@ -29,9 +29,9 @@
*/
/**
- * Included libraries.
- *
- */
+ * Included libraries.
+ *
+ */
if(!class_exists('File'))
{
uses('file');
@@ -53,14 +53,14 @@ class CakeLog
* @param string $msg Message to log
* @return boolean Success
*/
- function write($type, $msg)
- {
+ function write($type, $msg)
+ {
$filename = LOGS.$type.'.log';
$output = date('y-m-d H:i:s').' '.ucfirst($type).': '.$msg."\n";
$log = new File($filename);
return $log->append($output);
- }
+ }
}
?>
\ No newline at end of file
diff --git a/cake/libs/class_registry.php b/cake/libs/class_registry.php
index 29c3c6943..de732c11a 100644
--- a/cake/libs/class_registry.php
+++ b/cake/libs/class_registry.php
@@ -48,22 +48,22 @@ class ClassRegistry
* @var array
* @access private
*/
- var $_objects = array();
+ var $_objects = array();
/**
* Return a singleton instance of the ClassRegistry.
*
* @return ClassRegistry instance
*/
- function &getInstance()
- {
- static $instance = array();
- if (!$instance)
- {
- $instance[0] =& new ClassRegistry;
- }
- return $instance[0];
- }
+ function &getInstance()
+ {
+ static $instance = array();
+ if (!$instance)
+ {
+ $instance[0] =& new ClassRegistry;
+ }
+ return $instance[0];
+ }
/**
* Add $object to the registry, associating it with the name $key.
@@ -71,8 +71,8 @@ class ClassRegistry
* @param string $key
* @param mixed $object
*/
- function addObject($key, &$object)
- {
+ function addObject($key, &$object)
+ {
$_this =& ClassRegistry::getInstance();
$key = strtolower($key);
@@ -80,7 +80,7 @@ class ClassRegistry
{
$_this->_objects[$key] =& $object;
}
- }
+ }
/**
* Returns true if given key is present in the ClassRegistry.
@@ -88,12 +88,12 @@ class ClassRegistry
* @param string $key Key to look for
* @return boolean Success
*/
- function isKeySet($key)
- {
+ function isKeySet($key)
+ {
$_this =& ClassRegistry::getInstance();
$key = strtolower($key);
return array_key_exists($key, $_this->_objects);
- }
+ }
/**
* Return object which corresponds to given key.
@@ -101,11 +101,11 @@ class ClassRegistry
* @param string $key
* @return mixed
*/
- function &getObject($key)
- {
+ function &getObject($key)
+ {
$key = strtolower($key);
$_this =& ClassRegistry::getInstance();
return $_this->_objects[$key];
- }
+ }
}
?>
\ No newline at end of file
diff --git a/cake/libs/controller/components/acl.php b/cake/libs/controller/components/acl.php
index 473963117..06833a9e7 100644
--- a/cake/libs/controller/components/acl.php
+++ b/cake/libs/controller/components/acl.php
@@ -41,25 +41,25 @@
class AclComponent extends Object
{
- var $_instance = null;
- var $controller = true;
+ var $_instance = null;
+ var $controller = true;
/**
* Constructor. Will return an instance of the correct ACL class.
*
*/
- function __construct()
- {
+ function __construct()
+ {
$this->getACL();
- }
+ }
/**
* Static function used to gain an instance of the correct ACL class.
*
* @return MyACL
*/
- function &getACL()
- {
+ function &getACL()
+ {
if($this->_instance == null)
{
uses('controller'.DS.'components'.DS.ACL_FILENAME);
@@ -67,26 +67,26 @@ class AclComponent extends Object
$this->_instance = new $classname;
}
return $this->_instance;
- }
+ }
/**
* Empty class defintion, to be overridden in subclasses.
*
*/
- function _initACL()
- {
+ function _initACL()
+ {
- }
+ }
/**
* Pass-thru function for ACL check instance.
*
* @return boolean
*/
- function check($aro, $aco, $action = "*")
- {
+ function check($aro, $aco, $action = "*")
+ {
return $this->_instance->check($aro, $aco, $action);
- }
+ }
/**
@@ -94,50 +94,50 @@ class AclComponent extends Object
*
* @return boolean
*/
- function allow($aro, $aco, $action = "*")
- {
+ function allow($aro, $aco, $action = "*")
+ {
return $this->_instance->allow($aro, $aco, $action);
- }
+ }
/**
* Pass-thru function for ACL deny instance.
*
* @return boolean
*/
- function deny($aro, $aco, $action = "*")
- {
+ function deny($aro, $aco, $action = "*")
+ {
return $this->_instance->deny($aro, $aco, $action);
- }
+ }
/**
* Pass-thru function for ACL inherit instance.
*
* @return boolean
*/
- function inherit($aro, $aco, $action = "*")
- {
+ function inherit($aro, $aco, $action = "*")
+ {
return $this->_instance->inherit($aro, $aco, $action);
- }
+ }
/**
* Pass-thru function for ACL grant instance.
*
* @return boolean
*/
- function grant($aro, $aco, $action = "*")
- {
+ function grant($aro, $aco, $action = "*")
+ {
return $this->_instance->grant($aro, $aco, $action);
- }
+ }
/**
* Pass-thru function for ACL grant instance.
*
* @return boolean
*/
- function revoke($aro, $aco, $action = "*")
- {
+ function revoke($aro, $aco, $action = "*")
+ {
return $this->_instance->revoke($aro, $aco, $action);
- }
+ }
/**
@@ -145,10 +145,10 @@ class AclComponent extends Object
*
* @return Aro
*/
- function getAro($id)
- {
+ function getAro($id)
+ {
return $this->_instance->getAro($id);
- }
+ }
/**
@@ -156,10 +156,10 @@ class AclComponent extends Object
*
* @return Aco
*/
- function getAco($id)
- {
+ function getAco($id)
+ {
return $this->_instance->getAco($id);
- }
+ }
}
diff --git a/cake/libs/controller/components/acl_base.php b/cake/libs/controller/components/acl_base.php
index 528f04bd2..3251778c0 100644
--- a/cake/libs/controller/components/acl_base.php
+++ b/cake/libs/controller/components/acl_base.php
@@ -45,16 +45,16 @@ class AclBase
*
* @return AclBase
*/
- function AclBase()
- {
- //No instantiations or constructor calls (even statically)
+ function AclBase()
+ {
+//No instantiations or constructor calls (even statically)
if (strcasecmp(get_class($this), "AclBase") == 0 || !is_subclass_of($this, "AclBase"))
{
trigger_error(__("[acl_base] The AclBase class constructor has been called, or the class was instantiated. This class must remain abstract. Please refer to the Cake docs for ACL configuration."), E_USER_ERROR);
return NULL;
}
- }
+ }
/**
* Empty method to be overridden in subclasses
@@ -63,7 +63,7 @@ class AclBase
* @param unknown_type $aco
* @param string $action
*/
- function check($aro, $aco, $action = "*") {}
+ function check($aro, $aco, $action = "*") {}
}
diff --git a/cake/libs/controller/components/dbacl/db_acl.php b/cake/libs/controller/components/dbacl/db_acl.php
index 7ce3c81b1..88a3dc7f2 100644
--- a/cake/libs/controller/components/dbacl/db_acl.php
+++ b/cake/libs/controller/components/dbacl/db_acl.php
@@ -49,10 +49,10 @@ class DB_ACL extends AclBase
* Enter description here...
*
*/
- function __construct()
- {
+ function __construct()
+ {
- }
+ }
/**
* Enter description here...
@@ -62,8 +62,8 @@ class DB_ACL extends AclBase
* @param unknown_type $action
* @return unknown
*/
- function check($aro, $aco, $action = "*")
- {
+ function check($aro, $aco, $action = "*")
+ {
$Perms = new ArosAco();
$Aro = new Aro();
@@ -101,9 +101,9 @@ class DB_ACL extends AclBase
{
foreach($perms as $perm)
{
- if($action == '*')
- {
- // ARO must be cleared for ALL ACO actions
+ if($action == '*')
+ {
+// ARO must be cleared for ALL ACO actions
foreach($permKeys as $key)
{
if(isset($perm['aros_acos']))
@@ -115,9 +115,9 @@ class DB_ACL extends AclBase
}
}
return true;
- }
- else
- {
+ }
+ else
+ {
switch($perm['aros_acos']['_' . $action])
{
case -1:
@@ -128,21 +128,21 @@ class DB_ACL extends AclBase
case 1:
return true;
}
- }
+ }
}
}
}
return false;
- }
+ }
/**
* Allow
*
* @return boolean
*/
- function allow($aro, $aco, $action = "*", $value = 1)
- {
+ function allow($aro, $aco, $action = "*", $value = 1)
+ {
$Perms = new ArosAco();
$perms = $this->getAclLink($aro, $aco);
$permKeys = $this->_getAcoKeys($Perms->loadInfo());
@@ -151,7 +151,7 @@ class DB_ACL extends AclBase
if($perms == false)
{
- // One of the nodes does not exist
+// One of the nodes does not exist
return false;
}
@@ -176,7 +176,7 @@ class DB_ACL extends AclBase
}
else
{
- // Raise an error
+// Raise an error
return false;
}
}
@@ -188,7 +188,7 @@ class DB_ACL extends AclBase
{
$save['id'] = $perms['link'][0]['aros_acos']['id'];
}
- //return $Perms->save(array('ArosAco' => $save));
+//return $Perms->save(array('ArosAco' => $save));
if(isset($save['id']))
{
@@ -198,7 +198,7 @@ class DB_ACL extends AclBase
{
if($key != 'id')
{
- $saveKeys[] = $key . ' = ' . $val;
+ $saveKeys[] = $key . ' = ' . $val;
}
}
$q .= implode(', ', $saveKeys) . ' where id = ' . $save['id'];
@@ -210,47 +210,47 @@ class DB_ACL extends AclBase
$Perms->db->query($q);
return true;
- }
+ }
/**
* Deny
*
* @return boolean
*/
- function deny($aro, $aco, $action = "*")
- {
+ function deny($aro, $aco, $action = "*")
+ {
return $this->allow($aro, $aco, $action, -1);
- }
+ }
/**
* Inherit
*
* @return boolean
*/
- function inherit($aro, $aco, $action = "*")
- {
+ function inherit($aro, $aco, $action = "*")
+ {
return $this->allow($aro, $aco, $action, 0);
- }
+ }
/**
* Allow alias
*
* @return boolean
*/
- function grant($aro, $aco, $action = "*")
- {
+ function grant($aro, $aco, $action = "*")
+ {
return $this->allow($aro, $aco, $action);
- }
+ }
/**
* Deny alias
*
* @return boolean
*/
- function revoke($aro, $aco, $action = "*")
- {
+ function revoke($aro, $aco, $action = "*")
+ {
return $this->deny($aro, $aco, $action);
- }
+ }
@@ -260,17 +260,17 @@ class DB_ACL extends AclBase
* @param unknown_type $id
* @return unknown
*/
- function getAro($id = null)
- {
+ function getAro($id = null)
+ {
if($id == null)
{
- // Raise error
+// Raise error
}
$aro = new Aro();
- $tmp = $aro->find(is_string($aro) ? "aros.alias = '" . addslashes($aro) . "'" : "aros.user_id = {$aro}");
+ $tmp = $aro->find(is_string($aro) ? "aros.alias = '" . addslashes($aro) . "'" : "aros.user_id = {$aro}");
$aro->setId($tmp['aro']['id']);
return $aro;
- }
+ }
/**
@@ -279,17 +279,17 @@ class DB_ACL extends AclBase
* @param unknown_type $id
* @return unknown
*/
- function getAco($id = null)
- {
+ function getAco($id = null)
+ {
if($id == null)
{
- // Raise error
+// Raise error
}
$aco = new Aco();
- $tmp = $aco->find(is_string($aco) ? "acos.alias = '" . addslashes($aco) . "'" : "acos.user_id = {$aco}");
+ $tmp = $aco->find(is_string($aco) ? "acos.alias = '" . addslashes($aco) . "'" : "acos.user_id = {$aco}");
$aro->setId($tmp['aco']['id']);
return $aco;
- }
+ }
/**
@@ -299,12 +299,12 @@ class DB_ACL extends AclBase
* @param unknown_type $aco
* @return unknown
*/
- function getAclLink($aro, $aco)
- {
+ function getAclLink($aro, $aco)
+ {
$Aro = new Aro();
$Aco = new Aco();
- $qAro = (is_string($aro) ? "alias = '" . addslashes($aro) . "'" : "user_id = {$aro}");
+ $qAro = (is_string($aro) ? "alias = '" . addslashes($aro) . "'" : "user_id = {$aro}");
$qAco = (is_string($aco) ? "alias = '" . addslashes($aco) . "'" : "object_id = {$aco}");
$obj = array();
@@ -323,7 +323,7 @@ class DB_ACL extends AclBase
'aco' => $obj['Aco']['id'],
'link' => $Aro->findBySql("select * from aros_acos where aro_id = {$obj['Aro']['id']} and aco_id = {$obj['Aco']['id']}")
);
- }
+ }
/**
* Enter description here...
@@ -331,8 +331,8 @@ class DB_ACL extends AclBase
* @param unknown_type $keys
* @return unknown
*/
- function _getAcoKeys($keys)
- {
+ function _getAcoKeys($keys)
+ {
$newKeys = array();
$keys = $keys->value;
foreach($keys as $key)
@@ -343,7 +343,7 @@ class DB_ACL extends AclBase
}
}
return $newKeys;
- }
+ }
}
diff --git a/cake/libs/controller/components/dbacl/models/aclnode.php b/cake/libs/controller/components/dbacl/models/aclnode.php
index 64f28f8ed..488139868 100644
--- a/cake/libs/controller/components/dbacl/models/aclnode.php
+++ b/cake/libs/controller/components/dbacl/models/aclnode.php
@@ -46,11 +46,11 @@ class AclNode extends AppModel
* Enter description here...
*
*/
- function __construct()
- {
+ function __construct()
+ {
$this->setSource();
parent::__construct();
- }
+ }
/**
* Enter description here...
@@ -60,8 +60,8 @@ class AclNode extends AppModel
* @param unknown_type $alias
* @return unknown
*/
- function create($link_id = 0, $parent_id = null, $alias = '')
- {
+ function create($link_id = 0, $parent_id = null, $alias = '')
+ {
parent::create();
if (strtolower(get_class($this)) == "aclnode")
@@ -78,7 +78,7 @@ class AclNode extends AppModel
if($parent[0]['MAX(rght)'] == null)
{
- // The tree is empty
+// The tree is empty
$parent['lft'] = 0;
}
}
@@ -96,14 +96,14 @@ class AclNode extends AppModel
$return = $this->save(array($class => array(
$secondary_id => $link_id,
- 'alias' => $alias,
+ 'alias' => $alias,
'lft' => $parent['lft'] + 1,
'rght' => $parent['lft'] + 2
)));
$this->setId($this->getLastInsertID());
return $return;
- }
+ }
/**
@@ -113,8 +113,8 @@ class AclNode extends AppModel
* @param unknown_type $id
* @return unknown
*/
- function setParent($parent_id = null, $id = null)
- {
+ function setParent($parent_id = null, $id = null)
+ {
if (strtolower(get_class($this)) == "aclnode")
{
trigger_error(__("[acl_base] The AclBase class constructor has been called, or the class was instantiated. This class must remain abstract. Please refer to the Cake docs for ACL configuration."), E_USER_ERROR);
@@ -134,12 +134,12 @@ class AclNode extends AppModel
$object = $this->find($this->_resolveID($id, $secondary_id));
if($object == null || count($object) == 0)
{
- // Couldn't find object
+// Couldn't find object
return false;
}
$parent = $this->getParent(intval($object[$class][$secondary_id]));
- // Node is already at root, or new parent == old parent
+// Node is already at root, or new parent == old parent
if(($parent == null && $parent_id == null) || ($parent_id == $parent[$class][$secondary_id]) || ($parent_id == $parent[$class]['alias']))
{
return false;
@@ -147,7 +147,7 @@ class AclNode extends AppModel
if($parent_id != null && $parent[$class]['lft'] <= $object[$class]['lft'] && $parent[$class]['rght'] >= $object[$class]['rght'])
{
- // Can't move object inside self or own child
+// Can't move object inside self or own child
return false;
}
$this->_syncTable($table_name, 0, $object[$class]['lft'], $object[$class]['lft']);
@@ -173,7 +173,7 @@ class AclNode extends AppModel
$this->_syncTable($table_name, 2, $parent['lft'], $parent['lft']);
}
- }
+ }
/**
@@ -182,8 +182,8 @@ class AclNode extends AppModel
* @param unknown_type $id
* @return unknown
*/
- function getParent($id)
- {
+ function getParent($id)
+ {
$path = $this->getPath($id);
if($path == null || count($path) < 2)
{
@@ -193,7 +193,7 @@ class AclNode extends AppModel
{
return $path[count($path) - 2];
}
- }
+ }
/**
* Enter description here...
@@ -201,8 +201,8 @@ class AclNode extends AppModel
* @param unknown_type $id
* @return unknown
*/
- function getPath($id)
- {
+ function getPath($id)
+ {
if (strtolower(get_class($this)) == "aclnode")
{
trigger_error(__("[acl_base] The AclBase class constructor has been called, or the class was instantiated. This class must remain abstract. Please refer to the Cake docs for ACL configuration."), E_USER_ERROR);
@@ -216,7 +216,7 @@ class AclNode extends AppModel
return null;
}
return $this->findAll("{$data_name}.lft <= {$item[$class]['lft']} and {$data_name}.rght >= {$item[$class]['rght']}");
- }
+ }
/**
* Enter description here...
@@ -224,8 +224,8 @@ class AclNode extends AppModel
* @param unknown_type $id
* @return unknown
*/
- function getChildren($id)
- {
+ function getChildren($id)
+ {
if (strtolower(get_class($this)) == "aclnode")
{
trigger_error(__("[acl_base] The AclBase class constructor has been called, or the class was instantiated. This class must remain abstract. Please refer to the Cake docs for ACL configuration."), E_USER_ERROR);
@@ -235,7 +235,7 @@ class AclNode extends AppModel
$item = $this->find($this->_resolveID($id, $secondary_id));
return $this->findAll("{$data_name}.lft > {$item[$class]['lft']} and {$data_name}.rght < {$item[$class]['rght']}");
- }
+ }
/**
* Enter description here...
@@ -244,12 +244,12 @@ class AclNode extends AppModel
* @param unknown_type $fKey
* @return unknown
*/
- function _resolveID($id, $fKey)
- {
+ function _resolveID($id, $fKey)
+ {
$key = (is_string($id) ? 'alias' : $fKey);
$val = (is_string($id) ? '"' . addslashes($id) . '"' : $id);
return "{$key} = {$val}";
- }
+ }
/**
* Enter description here...
@@ -259,37 +259,37 @@ class AclNode extends AppModel
* @param unknown_type $lft
* @param unknown_type $rght
*/
- function _syncTable($table, $dir, $lft, $rght)
- {
+ function _syncTable($table, $dir, $lft, $rght)
+ {
$shift = ($dir == 2 ? 1 : 2);
$this->db->query("UPDATE $table SET rght = rght " . ($dir > 0 ? "+" : "-") . " {$shift} WHERE rght > " . $rght);
$this->db->query("UPDATE $table SET lft = lft " . ($dir > 0 ? "+" : "-") . " {$shift} WHERE lft > " . $lft);
- }
+ }
/**
* Enter description here...
*
* @return unknown
*/
- function __dataVars()
- {
+ function __dataVars()
+ {
$vars = array();
$class = Inflector::camelize(strtolower(get_class($this)));
$vars['secondary_id'] = (strtolower($class) == 'aro' ? 'user_id' : 'object_id');
$vars['data_name'] = $class;
- $vars['table_name'] = strtolower($class) . 's';
+ $vars['table_name'] = strtolower($class) . 's';
$vars['class'] = Inflector::camelize($class);
return $vars;
- }
+ }
/**
* Enter description here...
*
*/
- function setSource()
- {
+ function setSource()
+ {
$this->table = low(get_class($this)) . "s";
- }
+ }
}
?>
\ No newline at end of file
diff --git a/cake/libs/controller/components/dbacl/models/aco.php b/cake/libs/controller/components/dbacl/models/aco.php
index e06f5bf02..6f41be80e 100644
--- a/cake/libs/controller/components/dbacl/models/aco.php
+++ b/cake/libs/controller/components/dbacl/models/aco.php
@@ -40,13 +40,13 @@
*/
class Aco extends AclNode
{
- var $name = 'Aco';
+ var $name = 'Aco';
/**
* Enter description here...
*
* @var unknown_type
*/
- var $hasMany = 'ArosAco';
+ var $hasMany = 'ArosAco';
}
diff --git a/cake/libs/controller/components/dbacl/models/acoaction.php b/cake/libs/controller/components/dbacl/models/acoaction.php
index d9cfe8f57..9159d912e 100644
--- a/cake/libs/controller/components/dbacl/models/acoaction.php
+++ b/cake/libs/controller/components/dbacl/models/acoaction.php
@@ -52,7 +52,7 @@ class AcoAction extends AppModel
*
* @var unknown_type
*/
- var $belongsTo = 'Aco';
+ var $belongsTo = 'Aco';
}
?>
\ No newline at end of file
diff --git a/cake/libs/controller/components/dbacl/models/aros_aco.php b/cake/libs/controller/components/dbacl/models/aros_aco.php
index ccc9c1604..fae62a723 100644
--- a/cake/libs/controller/components/dbacl/models/aros_aco.php
+++ b/cake/libs/controller/components/dbacl/models/aros_aco.php
@@ -47,19 +47,19 @@ class ArosAco extends AppModel
*
* @var unknown_type
*/
- var $name = 'ArosAco';
+ var $name = 'ArosAco';
/**
* Enter description here...
*
* @var unknown_type
*/
- var $useTable = 'aros_acos';
+ var $useTable = 'aros_acos';
/**
* Enter description here...
*
* @var unknown_type
*/
- var $belongsTo = 'Aro,Aco';
+ var $belongsTo = 'Aro,Aco';
}
?>
\ No newline at end of file
diff --git a/cake/libs/controller/components/iniacl/ini_acl.php b/cake/libs/controller/components/iniacl/ini_acl.php
index abdeaf564..8288fb7ce 100644
--- a/cake/libs/controller/components/iniacl/ini_acl.php
+++ b/cake/libs/controller/components/iniacl/ini_acl.php
@@ -43,152 +43,152 @@ class INI_ACL extends AclBase
* The constructor must be overridden, as AclBase is abstract.
*
*/
- function __construct()
- {
+ function __construct()
+ {
- }
-
+ }
+
/**
* Main ACL check function. Checks to see if the ARO (access request object) has access to the ACO (access control object).
- * Looks at the acl.ini.php file for permissions (see instructions in /config/acl.ini.php).
+ * Looks at the acl.ini.php file for permissions (see instructions in/config/acl.ini.php).
*
* @param string $aro
* @param string $aco
* @return boolean
*/
- function check($aro, $aco, $aco_action = null)
- {
+ function check($aro, $aco, $aco_action = null)
+ {
$aclConfig = $this->readConfigFile(CONFIGS . 'acl.ini.php');
- //First, if the user is specifically denied, then DENY
+//First, if the user is specifically denied, then DENY
if(isset($aclConfig[$aro]['deny']))
{
$userDenies = $this->arrayTrim(explode(",", $aclConfig[$aro]['deny']));
if (array_search($aco, $userDenies))
{
- //echo "User Denied!";
+//echo "User Denied!";
return false;
}
}
- //Second, if the user is specifically allowed, then ALLOW
+//Second, if the user is specifically allowed, then ALLOW
if(isset($aclConfig[$aro]['allow']))
{
$userAllows = $this->arrayTrim(explode(",", $aclConfig[$aro]['allow']));
if (array_search($aco, $userAllows))
{
- //echo "User Allowed!";
+//echo "User Allowed!";
return true;
}
}
- //Check group permissions
+//Check group permissions
if (isset($aclConfig[$aro]['groups']))
{
$userGroups = $this->arrayTrim(explode(",", $aclConfig[$aro]['groups']));
foreach ($userGroups as $group)
{
- //If such a group exists,
+//If such a group exists,
if(array_key_exists($group, $aclConfig))
{
- //If the group is specifically denied, then DENY
- if(isset($aclConfig[$group]['deny']))
- {
+//If the group is specifically denied, then DENY
+ if(isset($aclConfig[$group]['deny']))
+ {
$groupDenies = $this->arrayTrim(explode(",", $aclConfig[$group]['deny']));
if (array_search($aco, $groupDenies))
{
- //echo("Group Denied!");
+//echo("Group Denied!");
return false;
}
- }
+ }
- //If the group is specifically allowed, then ALLOW
- if(isset($aclConfig[$group]['allow']))
- {
+//If the group is specifically allowed, then ALLOW
+ if(isset($aclConfig[$group]['allow']))
+ {
$groupAllows = $this->arrayTrim(explode(",", $aclConfig[$group]['allow']));
if (array_search($aco, $groupAllows))
{
- //echo("Group Allowed!");
+//echo("Group Allowed!");
return true;
}
- }
+ }
}
}
}
- //Default, DENY
- //echo("DEFAULT: DENY.");
+//Default, DENY
+//echo("DEFAULT: DENY.");
return false;
- }
-
+ }
+
/**
* Parses an INI file and returns an array that reflects the INI file's section structure. Double-quote friendly.
*
* @param string $fileName
* @return array
*/
- function readConfigFile ($fileName)
- {
- $fileLineArray = file($fileName);
-
- foreach ($fileLineArray as $fileLine)
- {
- $dataLine = trim($fileLine);
- $firstChar = substr($dataLine, 0, 1);
- if ($firstChar != ';' && $dataLine != '')
- {
- if ($firstChar == '[' && substr($dataLine, -1, 1) == ']')
- {
- $sectionName = preg_replace('/[\[\]]/', '', $dataLine);
- }
- else
- {
- $delimiter = strpos($dataLine, '=');
- if ($delimiter > 0)
- {
- $key = strtolower(trim(substr($dataLine, 0, $delimiter)));
- $value = trim(substr($dataLine, $delimiter + 1));
- if (substr($value, 0, 1) == '"' && substr($value, -1) == '"')
- {
- $value = substr($value, 1, -1);
- }
- $iniSetting[$sectionName][$key] = stripcslashes($value);
- }
- else
- {
+ function readConfigFile ($fileName)
+ {
+ $fileLineArray = file($fileName);
+
+ foreach ($fileLineArray as $fileLine)
+ {
+ $dataLine = trim($fileLine);
+ $firstChar = substr($dataLine, 0, 1);
+ if ($firstChar != ';' && $dataLine != '')
+ {
+ if ($firstChar == '[' && substr($dataLine, -1, 1) == ']')
+ {
+ $sectionName = preg_replace('/[\[\]]/', '', $dataLine);
+ }
+ else
+ {
+ $delimiter = strpos($dataLine, '=');
+ if ($delimiter > 0)
+ {
+ $key = strtolower(trim(substr($dataLine, 0, $delimiter)));
+ $value = trim(substr($dataLine, $delimiter + 1));
+ if (substr($value, 0, 1) == '"' && substr($value, -1) == '"')
+ {
+ $value = substr($value, 1, -1);
+ }
+ $iniSetting[$sectionName][$key] = stripcslashes($value);
+ }
+ else
+ {
if(!isset($sectionName))
{
$sectionName = '';
}
- $iniSetting[$sectionName][strtolower(trim($dataLine))]='';
- }
- }
- }
- else
- {
- }
- }
- return $iniSetting;
- }
-
+ $iniSetting[$sectionName][strtolower(trim($dataLine))]='';
+ }
+ }
+ }
+ else
+ {
+ }
+ }
+ return $iniSetting;
+ }
+
/**
* Removes trailing spaces on all array elements (to prepare for searching)
*
* @param array $array
* @return array
*/
- function arrayTrim($array)
- {
+ function arrayTrim($array)
+ {
foreach($array as $element) {
$element = trim($element);
}
- //Adding this element keeps array_search from returning 0:
- //0 is the first key, which may be correct, but 0 is interpreted as false.
- //Adding this element makes all the keys be positive integers.
+//Adding this element keeps array_search from returning 0:
+//0 is the first key, which may be correct, but 0 is interpreted as false.
+//Adding this element makes all the keys be positive integers.
array_unshift($array, "");
return $array;
- }
+ }
}
diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php
index 5918ad2f7..317527d48 100644
--- a/cake/libs/controller/components/request_handler.php
+++ b/cake/libs/controller/components/request_handler.php
@@ -73,7 +73,7 @@ class RequestHandlerComponent extends Object
{
$controller->layout = $this->ajaxLayout;
- // Add UTF-8 header for IE6 on XPsp2 bug
+// Add UTF-8 header for IE6 on XPsp2 bug
header('Content-Type: text/html; charset=UTF-8');
}
}
diff --git a/cake/libs/controller/controller.php b/cake/libs/controller/controller.php
index a7db47f4e..cb6e192f4 100644
--- a/cake/libs/controller/controller.php
+++ b/cake/libs/controller/controller.php
@@ -246,7 +246,7 @@ class Controller extends Object
elseif($this->uses === false)
{
return $this->cakeError('missingModel',array(array('className' => $this->modelClass,
- 'webroot' => '')));
+ 'webroot' => '')));
}
if ($this->uses)
{
@@ -264,7 +264,7 @@ class Controller extends Object
else
{
return $this->cakeError('missingModel',array(array('className' => $modelClass,
- 'webroot' => '')));
+ 'webroot' => '')));
}
}
}
@@ -518,7 +518,7 @@ class Controller extends Object
* @param string $url Relative URL to redirect to after the time expires
* @param int $time Time to show the message
*/
- function flash($message, $url, $pause=1)
+ function flash($message, $url, $pause = 1)
{
$this->autoRender = false;
$this->autoLayout = false;
@@ -532,14 +532,11 @@ class Controller extends Object
{
$flash = VIEWS.'layouts'.DS.'flash.thtml';
}
- else if(file_exists(LIBS.'view'.DS.'templates'.DS."layouts".DS.'flash.thtml'))
+ elseif($flash = fileExistsInPath(LIBS.'view'.DS.'templates'.DS."layouts".DS.'flash.thtml'))
{
- $flash = LIBS.'view'.DS.'templates'.DS."layouts".DS.'flash.thtml';
+
}
-
-
-
- $this->render(null,false,$flash);
+ $this->render(null, false, $flash);
}
/**
@@ -563,7 +560,7 @@ class Controller extends Object
$this->set('message', $message);
$this->set('time', $time);
- $this->render(null,false,VIEWS.'layouts'.DS.'flash.thtml');
+ $this->render(null, false, VIEWS.'layouts'.DS.'flash.thtml');
}
/**
diff --git a/cake/libs/controller/pages_controller.php b/cake/libs/controller/pages_controller.php
index 4e6481e9d..bb08f7498 100644
--- a/cake/libs/controller/pages_controller.php
+++ b/cake/libs/controller/pages_controller.php
@@ -49,35 +49,35 @@ class PagesController extends AppController{
*
* @var unknown_type
*/
- var $helpers = array('Html');
+ var $helpers = array('Html');
/**
* This controller does not use a model
*
* @var $uses
*/
- var $uses = null;
+ var $uses = null;
/**
* Displays a view
*
*/
- function display()
- {
- if (!func_num_args())
- {
- $this->redirect('/');
- }
- $path = func_get_args();
- if (!count($path))
- {
- $this->redirect('/');
- }
- $this->set('page', $path[0]);
- $this->set('subpage', empty($path[1])? null: $path[1]);
- $this->set('title', ucfirst($path[count($path)-1]));
- $this->render(join('/', $path));
- }
+ function display()
+ {
+ if (!func_num_args())
+ {
+ $this->redirect('/');
+ }
+ $path = func_get_args();
+ if (!count($path))
+ {
+ $this->redirect('/');
+ }
+ $this->set('page', $path[0]);
+ $this->set('subpage', empty($path[1])? null: $path[1]);
+ $this->set('title', ucfirst($path[count($path)-1]));
+ $this->render(join('/', $path));
+ }
}
?>
\ No newline at end of file
diff --git a/cake/libs/controller/scaffold.php b/cake/libs/controller/scaffold.php
index acb4ea0d5..b0b263fa7 100644
--- a/cake/libs/controller/scaffold.php
+++ b/cake/libs/controller/scaffold.php
@@ -329,7 +329,7 @@ class Scaffold extends Object {
}
else
{
- return $this->controllerClass->flash('There was an error deleting the '.Inflector::humanize($this->modelKey).' with the id '.
+ return $this->controllerClass->flash('There was an error deleting the '.Inflector::humanize($this->modelKey).' with the id '.
$id, '/'.Inflector::underscore($this->controllerClass->viewPath));
}
}
@@ -360,52 +360,52 @@ class Scaffold extends Object {
if(isset($this->controllerClass->{$this->modelKey}->db))
{
if($params['action'] === 'index' || $params['action'] === 'list' ||
- $params['action'] === 'show' || $params['action'] === 'add' ||
- $params['action'] === 'create' || $params['action'] === 'edit' ||
- $params['action'] === 'update' || $params['action'] === 'destroy')
- {
- switch ($params['action'])
- {
- case 'index':
- $this->_scaffoldIndex($params);
- break;
+ $params['action'] === 'show' || $params['action'] === 'add' ||
+ $params['action'] === 'create' || $params['action'] === 'edit' ||
+ $params['action'] === 'update' || $params['action'] === 'destroy')
+ {
+ switch ($params['action'])
+ {
+ case 'index':
+ $this->_scaffoldIndex($params);
+ break;
- case 'show':
- $this->_scaffoldShow($params);
- break;
+ case 'show':
+ $this->_scaffoldShow($params);
+ break;
- case 'list':
- $this->_scaffoldList($params);
- break;
+ case 'list':
+ $this->_scaffoldList($params);
+ break;
- case 'add':
- $this->_scaffoldNew($params);
- break;
+ case 'add':
+ $this->_scaffoldNew($params);
+ break;
- case 'edit':
- $this->_scaffoldEdit($params);
- break;
+ case 'edit':
+ $this->_scaffoldEdit($params);
+ break;
- case 'create':
- $this->_scaffoldCreate($params);
- break;
+ case 'create':
+ $this->_scaffoldCreate($params);
+ break;
- case 'update':
- $this->_scaffoldUpdate($params);
- break;
+ case 'update':
+ $this->_scaffoldUpdate($params);
+ break;
- case 'destroy':
- $this->_scaffoldDestroy($params);
- break;
- }
- }
- else
- {
- return $this->cakeError('missingAction',
- array(array('className' => Inflector::camelize($params['controller']."Controller"),
- 'action' => $params['action'],
- 'webroot' => $this->controllerClass->webroot)));
- }
+ case 'destroy':
+ $this->_scaffoldDestroy($params);
+ break;
+ }
+ }
+ else
+ {
+ return $this->cakeError('missingAction',
+ array(array('className' => Inflector::camelize($params['controller']."Controller"),
+ 'action' => $params['action'],
+ 'webroot' => $this->controllerClass->webroot)));
+ }
}
else
{
diff --git a/cake/libs/file.php b/cake/libs/file.php
index 5f06908f1..b553c17f3 100644
--- a/cake/libs/file.php
+++ b/cake/libs/file.php
@@ -55,14 +55,14 @@ class File extends Object
*
* @var Folder
*/
- var $folder = null;
+ var $folder = null;
/**
* Filename
*
* @var string
*/
- var $name = null;
+ var $name = null;
/**
* Constructor
@@ -71,8 +71,8 @@ class File extends Object
* @param boolean $create Create file if it does not exist
* @return File
*/
- function __construct ($path, $create = false)
- {
+ function __construct ($path, $create = false)
+ {
parent::__construct();
$this->folder = new Folder(dirname($path), $create);
@@ -84,7 +84,7 @@ class File extends Object
{
if (!$this->create())
{
- return false;
+ return false;
}
}
else
@@ -92,17 +92,17 @@ class File extends Object
return false;
}
}
- }
+ }
/**
* Return the contents of this File as a string.
*
* @return string Contents
*/
- function read ()
- {
+ function read ()
+ {
return file_get_contents($this->getFullPath());
- }
+ }
/**
* Append given data string to this File.
@@ -110,10 +110,10 @@ class File extends Object
* @param string $data Data to write
* @return boolean Success
*/
- function append ($data)
- {
+ function append ($data)
+ {
return $this->write($data, 'a');
- }
+ }
/**
* Write given data to this File.
@@ -122,8 +122,8 @@ class File extends Object
* @param string $mode Mode of writing. {@link http://php.net/fwrite See fwrite()}.
* @return boolean Success
*/
- function write ($data, $mode = 'w')
- {
+ function write ($data, $mode = 'w')
+ {
$file = $this->getFullPath();
if (!($handle = fopen( $file , $mode)))
{
@@ -138,7 +138,7 @@ class File extends Object
return false;
return true;
- }
+ }
/**
* Get md5 Checksum of file with previous check of Filesize
@@ -146,8 +146,8 @@ class File extends Object
* @param string $force Data to write to this File.
* @return string md5 Checksum {@link http://php.net/md5_file See md5_file()}
*/
- function getMd5 ($force = false)
- {
+ function getMd5 ($force = false)
+ {
$md5 = '';
if ( $force == true || $this->getSize(false) < MAX_MD5SIZE )
{
@@ -155,7 +155,7 @@ class File extends Object
}
return $md5;
- }
+ }
/**
* Returns the Filesize, either in bytes or in human-readable format.
@@ -163,19 +163,19 @@ class File extends Object
* @param boolean $humanReadeble Data to write to this File.
* @return string|int filesize as int or as a human-readable string
*/
- function getSize ()
- {
+ function getSize ()
+ {
$size = filesize( $this->getFullPath() );
return $size;
- }
+ }
/**
* Returns the File extension.
*
* @return string The Fileextension
*/
- function getExt ()
- {
+ function getExt ()
+ {
$ext = '';
$parts = explode('.', $this->getName() );
@@ -190,45 +190,45 @@ class File extends Object
}
return $ext;
- }
+ }
/**
* Returns the filename.
*
* @return string The Filename
*/
- function getName ()
- {
+ function getName ()
+ {
return $this->name;
- }
+ }
/**
* Returns the File's owner.
*
* @return int the Fileowner
*/
- function getOwner ()
- {
+ function getOwner ()
+ {
return fileowner( $this->getFullPath() );
- }
+ }
/**
* Returns the File group.
*
* @return int the Filegroup
*/
- function getGroup ()
- {
+ function getGroup ()
+ {
return filegroup( $this->getFullPath() );
- }
+ }
/**
* Creates the File.
*
* @return boolean Success
*/
- function create ()
- {
+ function create ()
+ {
$dir = $this->folder->pwd();
if ( file_exists( $dir ) && is_dir($dir) && is_writable($dir) && !$this->exists() )
{
@@ -247,107 +247,107 @@ class File extends Object
print ("[File] Could not create $this->getName()!");
return false;
}
- }
+ }
/**
* Returns true if the File exists.
*
* @return boolean
*/
- function exists ()
- {
+ function exists ()
+ {
return file_exists( $this->getFullPath() );
- }
+ }
/**
* Deletes the File.
*
* @return boolean
*/
- function delete ()
- {
+ function delete ()
+ {
return unlink( $this->getFullPath() );
- }
+ }
/**
* Returns true if the File is writable.
*
* @return boolean
*/
- function writable ()
- {
+ function writable ()
+ {
return is_writable( $this->getFullPath() );
- }
+ }
/**
* Returns true if the File is executable.
*
* @return boolean
*/
- function executable ()
- {
+ function executable ()
+ {
return is_executable( $this->getFullPath() );
- }
+ }
/**
* Returns true if the File is readable.
*
* @return boolean
*/
- function readable ()
- {
+ function readable ()
+ {
return is_readable( $this->getFullPath() );
- }
+ }
/**
* Returns last access time.
*
* @return int timestamp
*/
- function lastAccess ()
- {
+ function lastAccess ()
+ {
return fileatime( $this->getFullPath() );
- }
+ }
/**
* Returns last modified time.
*
* @return int timestamp
*/
- function lastChange ()
- {
+ function lastChange ()
+ {
return filemtime( $this->getFullPath() );
- }
+ }
/**
* Returns the current folder.
*
* @return Folder
*/
- function getFolder ()
- {
+ function getFolder ()
+ {
return $this->folder;
- }
+ }
/**
* Returns the "chmod" (permissions) of the File.
*
* @return string
*/
- function getChmod ( )
- {
+ function getChmod ( )
+ {
return substr(sprintf('%o', fileperms($this->getFullPath())), -4);
- }
+ }
/**
* Returns the full path of the File.
*
* @return string
*/
- function getFullPath ( )
- {
+ function getFullPath ( )
+ {
return Folder::slashTerm($this->folder->pwd()).$this->getName();
- }
+ }
}
?>
\ No newline at end of file
diff --git a/cake/libs/flay.php b/cake/libs/flay.php
index ca39591c9..a26cf21bd 100644
--- a/cake/libs/flay.php
+++ b/cake/libs/flay.php
@@ -29,9 +29,9 @@
*/
/**
- * Included libraries.
- *
- */
+ * Included libraries.
+ *
+ */
if(!class_exists('Object'))
{
uses('object');
@@ -49,40 +49,40 @@ if(!class_exists('Object'))
class Flay extends Object
{
/**
- * Text to be parsed.
- *
- * @var string
- */
- var $text = null;
+ * Text to be parsed.
+ *
+ * @var string
+ */
+ var $text = null;
/**
- * Set this to allow HTML in the markup.
- *
- * @var boolean
- */
- var $allow_html = false;
+ * Set this to allow HTML in the markup.
+ *
+ * @var boolean
+ */
+ var $allow_html = false;
/**
- * Constructor.
- *
- * @param string $text
- */
- function __construct ($text=null)
- {
+ * Constructor.
+ *
+ * @param string $text
+ */
+ function __construct ($text=null)
+ {
$this->text = $text;
parent::__construct();
- }
+ }
/**
- * Returns given text translated to HTML using the Flay syntax.
- *
- * @param string $text String to format
- * @param boolean $bare Set this to only do
\n", "", $out);
$out = str_replace('
", $out);
$out = str_replace('
ERROR: {$this->error}");
}
print('
- * require('dbo_mysql.php'); // or 'dbo_postgres.php'
+ * require('dbo_mysql.php');// or 'dbo_postgres.php'
*
- * // create and connect the object
- * $db = new DBO_MySQL(array( // or 'DBO_Postgres'
+ *// create and connect the object
+ * $db = new DBO_MySQL(array(// or 'DBO_Postgres'
* 'host'=>'localhost',
* 'login'=>'username',
* 'password'=>'password',
* 'database'=>'database'));
*
- * // read the whole query result array (of rows)
+ *// read the whole query result array (of rows)
* $all_rows = $db->fetchAll("SELECT a,b,c FROM table");
*
- * // read the first row with debugging on
+ *// read the first row with debugging on
* $first_row_only = $db->one("SELECT a,b,c FROM table WHERE a=1", TRUE);
*
- * // emulate the usual way of reading query results
+ *// emulate the usual way of reading query results
* if ($db->query("SELECT a,b,c FROM table"))
* {
* while ($row = $db->fetchArray())
@@ -68,7 +68,7 @@ uses('object');
* }
* }
*
- * // show a log of all queries, sorted by execution time
+ *// show a log of all queries, sorted by execution time
* $db->showLog(TRUE);
*
*
@@ -85,7 +85,7 @@ class DBO extends Object
* @var boolean
* @access public
*/
- var $connected=FALSE;
+ var $connected=FALSE;
/**
* Connection configuration.
@@ -93,7 +93,7 @@ class DBO extends Object
* @var array
* @access public
*/
- var $config=FALSE;
+ var $config=FALSE;
/**
* Enter description here...
@@ -101,7 +101,7 @@ class DBO extends Object
* @var boolean
* @access public
*/
- var $debug=FALSE;
+ var $debug=FALSE;
/**
* Enter description here...
@@ -109,7 +109,7 @@ class DBO extends Object
* @var boolean
* @access public
*/
- var $fullDebug=FALSE;
+ var $fullDebug=FALSE;
/**
* Enter description here...
@@ -117,7 +117,7 @@ class DBO extends Object
* @var unknown_type
* @access public
*/
- var $error=NULL;
+ var $error=NULL;
/**
* String to hold how many rows were affected by the last SQL operation.
@@ -125,7 +125,7 @@ class DBO extends Object
* @var unknown_type
* @access public
*/
- var $affected=NULL;
+ var $affected=NULL;
/**
* Number of rows in current resultset
@@ -133,7 +133,7 @@ class DBO extends Object
* @var int
* @access public
*/
- var $numRows=NULL;
+ var $numRows=NULL;
/**
* Time the last query took
@@ -141,7 +141,7 @@ class DBO extends Object
* @var unknown_type
* @access public
*/
- var $took=NULL;
+ var $took=NULL;
/**
* Enter description here...
@@ -149,7 +149,7 @@ class DBO extends Object
* @var unknown_type
* @access private
*/
- var $_conn=NULL;
+ var $_conn=NULL;
/**
* Enter description here...
@@ -157,7 +157,7 @@ class DBO extends Object
* @var unknown_type
* @access private
*/
- var $_result=NULL;
+ var $_result=NULL;
/**
* Queries count.
@@ -165,7 +165,7 @@ class DBO extends Object
* @var unknown_type
* @access private
*/
- var $_queriesCnt=0;
+ var $_queriesCnt=0;
/**
* Total duration of all queries.
@@ -173,7 +173,7 @@ class DBO extends Object
* @var unknown_type
* @access private
*/
- var $_queriesTime=NULL;
+ var $_queriesTime=NULL;
/**
* Enter description here...
@@ -181,7 +181,7 @@ class DBO extends Object
* @var unknown_type
* @access private
*/
- var $_queriesLog=array();
+ var $_queriesLog=array();
/**
* Maximum number of items in query log, to prevent query log taking over
@@ -191,7 +191,7 @@ class DBO extends Object
* @var int Maximum number of queries in the queries log.
* @access private
*/
- var $_queriesLogMax=200;
+ var $_queriesLogMax=200;
/**
@@ -200,22 +200,22 @@ class DBO extends Object
* @param array $config
* @return unknown
*/
- function __construct($config=NULL)
- {
+ function __construct($config=NULL)
+ {
$this->debug = DEBUG > 0;
$this->fullDebug = DEBUG > 1;
parent::__construct();
return $this->connect($config);
- }
+ }
/**
* Destructor. Closes connection to the database.
*
*/
- function __destructor()
- {
+ function __destructor()
+ {
$this->close();
- }
+ }
/**
* Returns a string with a USE [databasename] SQL statement.
@@ -223,22 +223,22 @@ class DBO extends Object
* @param string $db_name Name of database to use
* @return unknown Result of the query
*/
- function useDb($db_name)
- {
+ function useDb($db_name)
+ {
return $this->query("USE {$db_name}");
- }
+ }
/**
* Disconnects database, kills the connection and says the connection is closed, and if DEBUG is turned on, the log for this object is shown.
*
*/
- function close ()
- {
+ function close ()
+ {
if ($this->fullDebug) $this->showLog();
$this->disconnect();
$this->_conn = NULL;
$this->connected = false;
- }
+ }
/**
* Prepares a value, or an array of values for database queries by quoting and escaping them.
@@ -246,8 +246,8 @@ class DBO extends Object
* @param mixed $data A value or an array of values to prepare.
* @return mixed Prepared value or array of values.
*/
- function prepare ($data)
- {
+ function prepare ($data)
+ {
if (is_array($data))
{
$out = null;
@@ -261,12 +261,12 @@ class DBO extends Object
{
return $this->prepareValue($data);
}
- }
+ }
- function sources ()
- {
+ function sources ()
+ {
return array_map('strtolower', $this->listSources());
- }
+ }
/**
* Executes given SQL statement.
@@ -274,11 +274,11 @@ class DBO extends Object
* @param string $sql SQL statement
* @return unknown
*/
- function rawQuery ($sql)
- {
+ function rawQuery ($sql)
+ {
$this->took = $this->error = $this->numRows = false;
return $this->execute($sql);
- }
+ }
/**
* Queries the database with given SQL statement, and obtains some metadata about the result
@@ -288,8 +288,8 @@ class DBO extends Object
* @param string $sql
* @return unknown
*/
- function query($sql)
- {
+ function query($sql)
+ {
$t = getMicrotime();
$this->_result = $this->execute($sql);
$this->affected = $this->lastAffected();
@@ -301,7 +301,7 @@ class DBO extends Object
$this->showQuery($sql);
return $this->error? false: $this->_result;
- }
+ }
/**
* Returns a single row of results from the _last_ SQL query.
@@ -309,8 +309,8 @@ class DBO extends Object
* @param resource $res
* @return array A single row of results
*/
- function farr ($assoc=false)
- {
+ function farr ($assoc=false)
+ {
if ($assoc === false)
{
return $this->fetchRow();
@@ -319,7 +319,7 @@ class DBO extends Object
{
return $this->fetchRow($assoc);
}
- }
+ }
/**
* Returns a single row of results for a _given_ SQL query.
@@ -327,10 +327,10 @@ class DBO extends Object
* @param string $sql SQL statement
* @return array A single row of results
*/
- function one ($sql)
- {
+ function one ($sql)
+ {
return $this->query($sql)? $this->fetchArray(): false;
- }
+ }
/**
* Returns an array of all result rows for a given SQL query.
@@ -339,8 +339,8 @@ class DBO extends Object
* @param string $sql SQL statement
* @return array Array of resultset rows, or false if no rows matched
*/
- function all ($sql)
- {
+ function all ($sql)
+ {
if($this->query($sql))
{
$out=array();
@@ -354,7 +354,7 @@ class DBO extends Object
{
return false;
}
- }
+ }
/**
* Returns a single field of the first of query results for a given SQL query, or false if empty.
@@ -363,11 +363,11 @@ class DBO extends Object
* @param string $sql SQL query
* @return unknown
*/
- function field ($name, $sql)
- {
+ function field ($name, $sql)
+ {
$data = $this->one($sql);
return empty($data[$name])? false: $data[$name];
- }
+ }
/**
* Checks if the specified table contains any record matching specified SQL
@@ -376,29 +376,29 @@ class DBO extends Object
* @param string $sql SQL WHERE clause (condition only, not the "WHERE" part)
* @return boolean True if the table has a matching record, else false
*/
- function hasAny($table, $sql)
- {
+ function hasAny($table, $sql)
+ {
$out = $this->one("SELECT COUNT(*) AS count FROM {$table}".($sql? " WHERE {$sql}":""));
return is_array($out)? $out[0]['count']: false;
- }
+ }
/**
* Checks if it's connected to the database
*
* @return boolean True if the database is connected, else false
*/
- function isConnected()
- {
+ function isConnected()
+ {
return $this->connected;
- }
+ }
/**
* Outputs the contents of the log.
*
* @param boolean $sorted
*/
- function showLog($sorted=false)
- {
+ function showLog($sorted=false)
+ {
$log = $sorted?
sortByKey($this->_queriesLog, 'took', 'desc', SORT_NUMERIC):
$this->_queriesLog;
@@ -412,15 +412,15 @@ class DBO extends Object
}
print("\n");
- }
+ }
/**
* Log given SQL query.
*
* @param string $sql SQL statement
*/
- function logQuery($sql)
- {
+ function logQuery($sql)
+ {
$this->_queriesCnt++;
$this->_queriesTime += $this->took;
@@ -438,8 +438,8 @@ class DBO extends Object
}
if ($this->error)
- return false; // shouldn't we be logging errors somehow?
- }
+ return false;// shouldn't we be logging errors somehow?
+ }
/**
* Output information about an SQL query. The SQL statement, number of rows in resultset,
@@ -447,8 +447,8 @@ class DBO extends Object
*
* @param string $sql
*/
- function showQuery($sql)
- {
+ function showQuery($sql)
+ {
$error = $this->error;
if (strlen($sql)>200 && !$this->fullDebug)
@@ -465,7 +465,7 @@ class DBO extends Object
}
print('
- * link (word,
- * array("url" => "undo", "n" => word_counter),
- * array("complete" => "undoRequestCompleted(request)"));
+ * link (word,
+ * array("url" => "undo", "n" => word_counter),
+ * array("complete" => "undoRequestCompleted(request)"));
*
*
* The callbacks that may be specified are:
*
- * - loading:: Called when the remote document is being
- * loaded with data by the browser.
+ * - loading:: Called when the remote document is being
+ * loaded with data by the browser.
* - loaded:: Called when the browser has finished loading
- * the remote document.
- * - interactive:: Called when the user can interact with the
- * remote document, even though it has not
- * finished loading.
+ * the remote document.
+ * - interactive:: Called when the user can interact with the
+ * remote document, even though it has not
+ * finished loading.
* - complete:: Called when the XMLHttpRequest is complete.
*
* If you for some reason or another need synchronous processing (that'll
@@ -151,17 +151,17 @@ class AjaxHelper extends Helper
* by this expression. Use this to
* describe browser-side conditions when
* request should not be initiated.
- * - before:: Called before request is initiated.
+ * - before:: Called before request is initiated.
* - after:: Called immediately after request was
- * initiated and before loading.
+ * initiated and before loading.
*
* @param string $title Title of link
* @param string $href Href string "/products/view/12"
* @param array $options Options for JavaScript function
- * @param string $confirm Confirmation message. Calls up a JavaScript confirm() message.
+ * @param string $confirm Confirmation message. Calls up a JavaScript confirm() message.
* @param boolean $escapeTitle Escaping the title string to HTML entities
*
- * @return string HTML code for link to remote action
+ * @return string HTML code for link to remote action
*/
function link($title, $href = null, $options = array(), $confirm = null, $escapeTitle = true)
{
@@ -200,7 +200,7 @@ class AjaxHelper extends Helper
function linkToRemote ($title, $options = array(), $html_options = array())
{
- //trigger_error('Deprecated function: use AjaxHelper::link', E_USER_WARNING);
+//trigger_error('Deprecated function: use AjaxHelper::link', E_USER_WARNING);
$href = '#';
if (!empty($options['fallback']) && isset($options['fallback']))
{
@@ -217,16 +217,16 @@ class AjaxHelper extends Helper
}
}
/**
- * Creates JavaScript function for remote AJAX call
- *
- * This function creates the javascript needed to make a remote call
- * it is primarily used as a helper for linkToRemote.
- *
- * @see linkToRemote() for docs on options parameter.
- *
- * @param array $options options for javascript
- * @return string html code for link to remote action
- */
+ * Creates JavaScript function for remote AJAX call
+ *
+ * This function creates the javascript needed to make a remote call
+ * it is primarily used as a helper for linkToRemote.
+ *
+ * @see linkToRemote() for docs on options parameter.
+ *
+ * @param array $options options for javascript
+ * @return string html code for link to remote action
+ */
function remoteFunction ($options = null)
{
$javascript_options = $this->__optionsForAjax($options);
@@ -255,15 +255,15 @@ class AjaxHelper extends Helper
}
/**
- * Periodically call remote url via AJAX.
- *
- * Periodically calls the specified url (options[url]) every options[frequency] seconds (default is 10).
- * Usually used to update a specified div (options[update]) with the results of the remote call.
- * The options for specifying the target with url and defining callbacks is the same as linkToRemote.
- *
- * @param array $options Callback options
- * @return string Javascript code
- */
+ * Periodically call remote url via AJAX.
+ *
+ * Periodically calls the specified url (options[url]) every options[frequency] seconds (default is 10).
+ * Usually used to update a specified div (options[update]) with the results of the remote call.
+ * The options for specifying the target with url and defining callbacks is the same as linkToRemote.
+ *
+ * @param array $options Callback options
+ * @return string Javascript code
+ */
function remoteTimer ($options = null)
{
$frequency = (isset($options['frequency']))? $options['frequency'] : 10;
@@ -272,18 +272,18 @@ class AjaxHelper extends Helper
}
/**
- * Returns form tag that will submit using Ajax.
- *
- * Returns a form tag that will submit using XMLHttpRequest in the background instead of the regular
- * reloading POST arrangement. Even though it's using Javascript to serialize the form elements, the form submission
- * will work just like a regular submission as viewed by the receiving side (all elements available in params).
- * The options for specifying the target with :url and defining callbacks is the same as link_to_remote.
- *
- * @param array $params Form id
- * @param array $type How form data is posted: 'get' or 'post'
- * @param array $options Callback/HTML options
- * @return string JavaScript/HTML code
- */
+ * Returns form tag that will submit using Ajax.
+ *
+ * Returns a form tag that will submit using XMLHttpRequest in the background instead of the regular
+ * reloading POST arrangement. Even though it's using Javascript to serialize the form elements, the form submission
+ * will work just like a regular submission as viewed by the receiving side (all elements available in params).
+ * The options for specifying the target with :url and defining callbacks is the same as link_to_remote.
+ *
+ * @param array $params Form id
+ * @param array $type How form data is posted: 'get' or 'post'
+ * @param array $options Callback/HTML options
+ * @return string JavaScript/HTML code
+ */
function form($params = null, $type = 'post', $options = array())
{
if (is_array($params))
@@ -326,15 +326,15 @@ class AjaxHelper extends Helper
}
/**
- * Returns a button input tag that will submit using Ajax
- *
- * Returns a button input tag that will submit form using XMLHttpRequest in the background instead of regular
- * reloading POST arrangement. options argument is the same as in form_remote_tag
- *
- * @param string $title Input button title
- * @param array $options Callback options
- * @return string Ajaxed input button
- */
+ * Returns a button input tag that will submit using Ajax
+ *
+ * Returns a button input tag that will submit form using XMLHttpRequest in the background instead of regular
+ * reloading POST arrangement. options argument is the same as in form_remote_tag
+ *
+ * @param string $title Input button title
+ * @param array $options Callback options
+ * @return string Ajaxed input button
+ */
function submit ($title = 'Submit', $options = array())
{
$htmlOptions = $this->__getHtmlOptions($options);
@@ -360,33 +360,33 @@ class AjaxHelper extends Helper
}
/**
- * Observe field and call ajax on change.
- *
- * Observes the field with the DOM ID specified by field_id and makes
- * an Ajax when its contents have changed.
- *
- * Required +options+ are:
- * - frequency:: The frequency (in seconds) at which changes to
- * this field will be detected.
- * - url:: @see urlFor() -style options for the action to call
- * when the field has changed.
- *
- * Additional options are:
- * - update:: Specifies the DOM ID of the element whose
- * innerHTML should be updated with the
- * XMLHttpRequest response text.
- * - with:: A Javascript expression specifying the
- * parameters for the XMLHttpRequest. This defaults
- * to Form.Element.serialize('$field_id'), which can be
- * accessed from params['form']['field_id'].
- *
- * Additionally, you may specify any of the options documented in
- * @see linkToRemote().
- *
- * @param string $field_id DOM ID of field to observe
- * @param array $options ajax options
- * @return string ajax script
- */
+ * Observe field and call ajax on change.
+ *
+ * Observes the field with the DOM ID specified by field_id and makes
+ * an Ajax when its contents have changed.
+ *
+ * Required +options+ are:
+ * - frequency:: The frequency (in seconds) at which changes to
+ * this field will be detected.
+ * - url:: @see urlFor() -style options for the action to call
+ * when the field has changed.
+ *
+ * Additional options are:
+ * - update:: Specifies the DOM ID of the element whose
+ * innerHTML should be updated with the
+ * XMLHttpRequest response text.
+ * - with:: A Javascript expression specifying the
+ * parameters for the XMLHttpRequest. This defaults
+ * to Form.Element.serialize('$field_id'), which can be
+ * accessed from params['form']['field_id'].
+ *
+ * Additionally, you may specify any of the options documented in
+ * @see linkToRemote().
+ *
+ * @param string $field_id DOM ID of field to observe
+ * @param array $options ajax options
+ * @return string ajax script
+ */
function observeField ($field_id, $options = array())
{
if (!isset($options['with']))
@@ -397,17 +397,17 @@ class AjaxHelper extends Helper
}
/**
- * Observe entire form and call ajax on change.
- *
- * Like @see observeField(), but operates on an entire form identified by the
- * DOM ID form_id. options are the same as observe_field, except
- * the default value of the with option evaluates to the
- * serialized (request string) value of the form.
- *
- * @param string $field_id DOM ID of field to observe
- * @param array $options ajax options
- * @return string ajax script
- */
+ * Observe entire form and call ajax on change.
+ *
+ * Like @see observeField(), but operates on an entire form identified by the
+ * DOM ID form_id. options are the same as observe_field, except
+ * the default value of the with option evaluates to the
+ * serialized (request string) value of the form.
+ *
+ * @param string $field_id DOM ID of field to observe
+ * @param array $options ajax options
+ * @return string ajax script
+ */
function observeForm ($field_id, $options = array())
{
if (!isset($options['with']))
@@ -418,18 +418,18 @@ class AjaxHelper extends Helper
}
/**
- * Create a text field with Autocomplete.
- *
- * Creates an autocomplete field with the given ID and options.
- *
- * options['with'] defaults to "Form.Element.serialize('$field_id')",
- * but can be any valid javascript expression defining the
- *
- * @param string $field_id DOM ID of field to observe
- * @param string $url URL for the autocomplete action
- * @param array $options Ajax options
- * @return string Ajax script
- */
+ * Create a text field with Autocomplete.
+ *
+ * Creates an autocomplete field with the given ID and options.
+ *
+ * options['with'] defaults to "Form.Element.serialize('$field_id')",
+ * but can be any valid javascript expression defining the
+ *
+ * @param string $field_id DOM ID of field to observe
+ * @param string $url URL for the autocomplete action
+ * @param array $options Ajax options
+ * @return string Ajax script
+ */
function autoComplete ($field, $url = "", $options = array())
{
if (!isset($options['id']))
@@ -468,10 +468,10 @@ class AjaxHelper extends Helper
}
/**
- * Private helper method to return an array of options for draggable.
- *
- * @param array $options
- * @return array
+ * Private helper method to return an array of options for draggable.
+ *
+ * @param array $options
+ * @return array
*/
function _optionsForDraggable ($options)
{
@@ -480,13 +480,13 @@ class AjaxHelper extends Helper
}
/**
- * For a reference on the options for this function, check out
- * http://wiki.script.aculo.us/scriptaculous/show/Droppables.add
- *
+ * For a reference on the options for this function, check out
+ * http://wiki.script.aculo.us/scriptaculous/show/Droppables.add
+ *
* @param unknown_type $id
- * @param array $options
- * @return array
- */
+ * @param array $options
+ * @return array
+ */
function drop($id, $options = array())
{
$options = $this->_optionsForDroppable($options);
@@ -520,13 +520,13 @@ class AjaxHelper extends Helper
}
/**
- * Makes a slider control.
- *
- * @param string $id DOM ID of slider handle
- * @param string $track_id DOM ID of slider track
- * @param array $options Array of options to control the slider
- * @link http://wiki.script.aculo.us/scriptaculous/show/Slider
- */
+ * Makes a slider control.
+ *
+ * @param string $id DOM ID of slider handle
+ * @param string $track_id DOM ID of slider track
+ * @param array $options Array of options to control the slider
+ * @link http://wiki.script.aculo.us/scriptaculous/show/Slider
+ */
function slider($id, $track_id, $options = array())
{
$options = $this->_optionsToString($options, array('axis','handleImage','handleDisabled'));
@@ -545,13 +545,13 @@ class AjaxHelper extends Helper
}
/**
- * Makes an Ajax In Place editor control.
- *
- * @param string $id DOM ID of input element
- * @param string $url Postback URL of saved data
- * @param array $options Array of options to control the editor, including ajaxOptions (see link).
- * @link http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
- */
+ * Makes an Ajax In Place editor control.
+ *
+ * @param string $id DOM ID of input element
+ * @param string $url Postback URL of saved data
+ * @param array $options Array of options to control the editor, including ajaxOptions (see link).
+ * @link http://wiki.script.aculo.us/scriptaculous/show/Ajax.InPlaceEditor
+ */
function editor($id, $url, $options = array())
{
$url = $this->Html->url($url);
@@ -574,12 +574,12 @@ class AjaxHelper extends Helper
}
/**
- * Makes a list or group of floated objects sortable.
- *
- * @param string $id DOM ID of parent
- * @param array $options Array of options to control sort.http://wiki.script.aculo.us/scriptaculous/show/Sortable.create
- * @link http://wiki.script.aculo.us/scriptaculous/show/Sortable.create
- */
+ * Makes a list or group of floated objects sortable.
+ *
+ * @param string $id DOM ID of parent
+ * @param array $options Array of options to control sort.http://wiki.script.aculo.us/scriptaculous/show/Sortable.create
+ * @link http://wiki.script.aculo.us/scriptaculous/show/Sortable.create
+ */
function sortable($id, $options = array())
{
if (!empty($options['url']))
@@ -604,9 +604,9 @@ class AjaxHelper extends Helper
}
/**
- * Private helper function for Javascript.
- *
- */
+ * Private helper function for Javascript.
+ *
+ */
function __optionsForAjax ($options = array())
{
$js_options = $this->_buildCallbacks($options);
@@ -690,12 +690,12 @@ class AjaxHelper extends Helper
}
/**
- * Return JavaScript text for an observer...
- *
- * @param string $klass Name of JavaScript class
- * @param string $name
- * @param array $options Ajax options
- * @return string Formatted JavaScript
+ * Return JavaScript text for an observer...
+ *
+ * @param string $klass Name of JavaScript class
+ * @param string $name
+ * @param array $options Ajax options
+ * @return string Formatted JavaScript
*/
function _buildObserver ($klass, $name, $options=null)
{
@@ -712,10 +712,10 @@ class AjaxHelper extends Helper
}
/**
- * Enter description here... Return JavaScript text for all callbacks...
- *
- * @param array $options
- * @return array
+ * Enter description here... Return JavaScript text for all callbacks...
+ *
+ * @param array $options
+ * @return array
*/
function _buildCallbacks($options)
{
@@ -744,10 +744,10 @@ class AjaxHelper extends Helper
{
foreach ($stringOpts as $option)
{
- if(isset($options[$option]) && !$options[$option][0] != "'")
- {
- $options[$option] = "'{$options[$option]}'";
- }
+ if(isset($options[$option]) && !$options[$option][0] != "'")
+ {
+ $options[$option] = "'{$options[$option]}'";
+ }
}
return $options;
}
diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php
index d66fd0400..67d18ee88 100644
--- a/cake/libs/view/helpers/form.php
+++ b/cake/libs/view/helpers/form.php
@@ -63,7 +63,7 @@ class FormHelper extends Helper
{
var $helpers = array('Html');
- /**
+/**
* Constructor which takes an instance of the HtmlHelper class.
*
* @return void
@@ -72,7 +72,7 @@ class FormHelper extends Helper
{
}
- /**
+/**
* Returns a formatted error message for given FORM field, NULL if no errors.
*
* @param string $field This should be "Modelname/fieldname"
@@ -92,7 +92,7 @@ class FormHelper extends Helper
}
}
- /**
+/**
* Returns a formatted LABEL element for HTML FORMs.
*
* @param string $tagName This should be "Modelname/fieldname"
@@ -104,10 +104,10 @@ class FormHelper extends Helper
return sprintf( TAG_LABEL, strtolower(str_replace('/', '_',$tagName)), $text );
}
- /**
+/**
* Returns a formatted DIV tag for HTML FORMs.
*
- * @param string $class CSS class name of the div element.
+ * @param string $class CSS class name of the div element.
* @param string $text String content that will appear inside the div element.
* @return string The formatted DIV element
*/
@@ -116,7 +116,7 @@ class FormHelper extends Helper
return sprintf( TAG_DIV, $class, $text );
}
- /**
+/**
* Returns a formatted P tag with class for HTML FORMs.
*
* @param string $class CSS class name of the p element.
@@ -128,13 +128,13 @@ class FormHelper extends Helper
return sprintf( TAG_P_CLASS, $class, $text );
}
- /**
+/**
* Returns a formatted INPUT tag for HTML FORMs.
*
* @param string $tagName This should be "Modelname/fieldname"
* @param string $prompt Text that will appear in the label field.
* @param bool $required True if this field is a required field.
- * @param string $errorMsg Text that will appear if an error has occurred.
+ * @param string $errorMsg Text that will appear if an error has occurred.
* @param int $size Size attribute for INPUT element
* @param array $htmlOptions HTML options array.
* @return string The formatted INPUT element, with a label and wrapped in a div.
@@ -152,11 +152,11 @@ class FormHelper extends Helper
if( $required )
$divClass = "required";
- $strError = ""; // initialize the error to empty.
+ $strError = "";// initialize the error to empty.
if( $this->isFieldError( $tagName ) )
{
- // if it was an error that occured, then add the error message, and append " error" to the div tag.
+// if it was an error that occured, then add the error message, and append " error" to the div tag.
$strError = $this->pTag( 'error', $errorMsg );
$divClass = sprintf( "%s error", $divClass );
}
@@ -166,7 +166,7 @@ class FormHelper extends Helper
}
- /**
+/**
* Returns a formatted CHECKBOX tag inside a DIV for HTML FORMs.
*
* @param string $tagName This should be "Modelname/fieldname"
@@ -188,11 +188,11 @@ class FormHelper extends Helper
if( $required )
$divClass = "required";
- $strError = ""; // initialize the error to empty.
+ $strError = "";// initialize the error to empty.
if( $this->isFieldError( $tagName ) )
{
- // if it was an error that occured, then add the error message, and append " error" to the div tag.
+// if it was an error that occured, then add the error message, and append " error" to the div tag.
$strError = $this->pTag( 'error', $errorMsg );
$divClass = sprintf( "%s error", $divClass );
}
@@ -202,13 +202,13 @@ class FormHelper extends Helper
}
- /**
+/**
* Returns a formatted date option element for HTML FORMs.
*
* @param string $tagName This should be "Modelname/fieldname"
* @param string $prompt Text that will appear in the label field.
* @param bool $required True if this field is a required field.
- * @param string $errorMsg Text that will appear if an error has occurred.
+ * @param string $errorMsg Text that will appear if an error has occurred.
* @param int $size Not used.
* @todo Remove the $size parameter from this method.
* @param array $htmlOptions HTML options array
@@ -225,11 +225,11 @@ class FormHelper extends Helper
if( $required )
$divClass = "required";
- $strError = ""; // initialize the error to empty.
+ $strError = "";// initialize the error to empty.
if( $this->isFieldError( $tagName ) )
{
- // if it was an error that occured, then add the error message, and append " error" to the div tag.
+// if it was an error that occured, then add the error message, and append " error" to the div tag.
$strError = $this->pTag( 'error', $errorMsg );
$divClass = sprintf( "%s error", $divClass );
}
@@ -240,7 +240,7 @@ class FormHelper extends Helper
return $this->divTag("date", $requiredDiv);
}
- /**
+/**
* Returns a formatted datetime option element for HTML FORMs.
*
* @param string $tagName This should be "Modelname/fieldname"
@@ -264,11 +264,11 @@ class FormHelper extends Helper
if( $required )
$divClass = "required";
- $strError = ""; // initialize the error to empty.
+ $strError = "";// initialize the error to empty.
if( $this->isFieldError( $tagName ) )
{
- // if it was an error that occured, then add the error message, and append " error" to the div tag.
+// if it was an error that occured, then add the error message, and append " error" to the div tag.
$strError = $this->pTag( 'error', $errorMsg );
$divClass = sprintf( "%s error", $divClass );
}
@@ -279,7 +279,7 @@ class FormHelper extends Helper
return $this->divTag("date", $requiredDiv);
}
- /**
+/**
* Returns a formatted TEXTAREA inside a DIV for use with HTML forms.
*
* @param string $tagName This should be "Modelname/fieldname"
@@ -305,11 +305,11 @@ class FormHelper extends Helper
if( $required )
$divClass = "required";
- $strError = ""; // initialize the error to empty.
+ $strError = "";// initialize the error to empty.
if( $this->isFieldError( $tagName ) )
{
- // if it was an error that occured, then add the error message, and append " error" to the div tag.
+// if it was an error that occured, then add the error message, and append " error" to the div tag.
$strError = $this->pTag( 'error', $errorMsg );
$divClass = sprintf( "%s error", $divClass );
}
@@ -319,7 +319,7 @@ class FormHelper extends Helper
}
- /**
+/**
* Returns a formatted SELECT tag for HTML FORMs.
*
* @param string $tagName This should be "Modelname/fieldname"
@@ -343,11 +343,11 @@ class FormHelper extends Helper
if( $required )
$divClass = "required";
- $strError = ""; // initialize the error to empty.
+ $strError = "";// initialize the error to empty.
if( $this->isFieldError( $tagName ) )
{
- // if it was an error that occured, then add the error message, and append " error" to the div tag.
+// if it was an error that occured, then add the error message, and append " error" to the div tag.
$strError = $this->pTag( 'error', $errorMsg );
$divClass = sprintf( "%s error", $divClass );
}
@@ -357,7 +357,7 @@ class FormHelper extends Helper
}
- /**
+/**
* Returns a formatted submit widget for HTML FORMs.
*
* @param string $displayText Text that will appear on the widget
@@ -369,7 +369,7 @@ class FormHelper extends Helper
return $this->divTag( 'submit', $this->Html->submitTag( $displayText, $htmlOptions) );
}
- /**
+/**
* Generates a form to go onto a HtmlHelper object.
*
* @param array $fields An array of form field definitions
diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php
index 53beddb48..13757c89b 100644
--- a/cake/libs/view/helpers/html.php
+++ b/cake/libs/view/helpers/html.php
@@ -37,69 +37,69 @@
*/
class HtmlHelper extends Helper
{
- /*************************************************************************
- * Public variables
- *************************************************************************/
+/*************************************************************************
+ * Public variables
+ *************************************************************************/
- /**#@+
- * @access public
- */
+/**#@+
+ * @access public
+ */
- /**
+/**
* Base URL
*
* @var string
*/
- var $base = null;
+ var $base = null;
- /**
+/**
* URL to current action.
*
* @var string
*/
- var $here = null;
- /**
+ var $here = null;
+/**
* Parameter array.
*
* @var array
*/
var $params = array();
- /**
+/**
* Current action.
*
* @var string
*/
var $action = null;
- /**
+/**
* Enter description here...
*
* @var array
*/
- var $data = null;
- /**
+ var $data = null;
+/**
* Name of model this helper is attached to.
*
* @var string
*/
var $model = null;
- /**
+/**
* Enter description here...
*
* @var string
*/
var $field = null;
- /**#@-*/
+/**#@-*/
- /*************************************************************************
- * Private variables
- *************************************************************************/
+/*************************************************************************
+ * Private variables
+ *************************************************************************/
- /**#@+
- * @access private
- */
+/**#@+
+ * @access private
+ */
- /**
+/**
* Breadcrumbs.
*
* @var array
@@ -109,7 +109,7 @@ class HtmlHelper extends Helper
- /**
+/**
* Adds a link to the breadcrumbs array.
*
* @param string $name Text for link
@@ -120,13 +120,13 @@ class HtmlHelper extends Helper
$this->_crumbs[] = array($name, $link);
}
- /**
+/**
* Returns a charset META-tag.
*
* @param string $charset
* @param boolean $return Wheter this method should return a value or
* output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function charset($charset, $return = false)
@@ -134,19 +134,19 @@ class HtmlHelper extends Helper
return $this->output(sprintf($this->tags['charset'], $charset), $return);
}
- /**
+/**
* Finds URL for specified action.
*
* Returns an URL pointing to a combination of controller and action. Param
* $url can be:
- * + Empty - the method will find adress to actuall controller/action.
- * + '/' - the method will find base URL of application.
- * + A combination of controller/action - the method will find url for it.
+ * + Empty - the method will find adress to actuall controller/action.
+ * + '/' - the method will find base URL of application.
+ * + A combination of controller/action - the method will find url for it.
*
* @param string $url Cake-relative URL, like "/products/edit/92" or "/presidents/elect/4"
* @param boolean $return Wheter this method should return a value or
* output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function url($url = null, $return = false)
@@ -167,7 +167,7 @@ class HtmlHelper extends Helper
return $this->output(preg_replace('/&([^a])/', '&\1', $output), $return);
}
- /**
+/**
* Creates an HTML link.
*
* If $url starts with "http://" this is treated as an external link. Else,
@@ -178,17 +178,17 @@ class HtmlHelper extends Helper
*
* @param string $title The content of the A tag.
* @param string $url Cake-relative URL, or external URL (starts with http://)
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param string $confirmMessage Confirmation message.
* @param boolean $escapeTitle Whether or not the text in the $title variable should be HTML escaped.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function link($title, $url = null, $htmlAttributes = null, $confirmMessage = false, $escapeTitle = true, $return = false)
{
- // prepare title for html display
+// prepare title for html display
if( $escapeTitle )
{
$title = htmlspecialchars($title, ENT_QUOTES);
@@ -198,11 +198,11 @@ class HtmlHelper extends Helper
if ($confirmMessage)
{
- // prepare for HTML display (fix everything except quotes)
+// prepare for HTML display (fix everything except quotes)
$confirmMessage = htmlspecialchars($confirmMessage, ENT_NOQUOTES);
- // fix single quotes
+// fix single quotes
$confirmMessage = str_replace("'", "\'", $confirmMessage);
- // fix double quotes
+// fix double quotes
$confirmMessage = str_replace('"', '"', $confirmMessage);
$htmlAttributes['onclick'] = "return confirm('{$confirmMessage}');";
@@ -222,14 +222,14 @@ class HtmlHelper extends Helper
return $this->output($output, $return);
}
- /**
+/**
* Creates a submit widget.
*
* @param string $caption Text on submit button
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function submit($caption = 'Submit', $htmlAttributes = null, $return = false)
@@ -241,14 +241,14 @@ class HtmlHelper extends Helper
- /**
+/**
* Creates a password input widget.
*
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function password($fieldName, $htmlAttributes = null, $return = false)
@@ -268,14 +268,14 @@ class HtmlHelper extends Helper
- /**
+/**
* Creates a textarea widget.
*
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function textarea($fieldName, $htmlAttributes = null, $return = false)
@@ -304,15 +304,15 @@ class HtmlHelper extends Helper
$this->_parseAttributes($htmlAttributes, null, ' '), $value), $return);
}
- /**
+/**
* Creates a checkbox widget.
*
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
* @param string $title
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function checkbox($fieldName, $title = null, $htmlAttributes = null,
@@ -326,15 +326,15 @@ class HtmlHelper extends Helper
$this->_parseAttributes($htmlAttributes, null, '', ' '), $title), $return);
}
- /**
+/**
* Creates a link element for CSS stylesheets.
*
- * @param string $path Path to CSS file
+ * @param string $path Path to CSS file
* @param string $rel Rel attribute. Defaults to "stylesheet".
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function css($path, $rel = 'stylesheet', $htmlAttributes = null, $return = false)
@@ -344,14 +344,14 @@ class HtmlHelper extends Helper
$this->parseHtmlOptions($htmlAttributes, null, '', ' ')), $return);
}
- /**
+/**
* Creates file input widget.
*
* @param string $fieldName Name of a field, like this "Modelname/fieldname" or just "thefile"
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function file($fieldName, $htmlAttributes = null, $return = false)
@@ -360,13 +360,13 @@ class HtmlHelper extends Helper
$this->_parseAttributes($htmlAttributes, null, '', ' ')), $return);
}
- /**
+/**
* Returns the breadcrumb trail as a sequence of »-separated links.
*
* @param string $separator Text to separate crumbs.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return. If $this->_crumbs is empty, return null.
*/
function getCrumbs($separator = '»', $return = false)
@@ -388,14 +388,14 @@ class HtmlHelper extends Helper
}
}
- /**
+/**
* Creates a hidden input field.
*
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function hidden($fieldName, $htmlAttributes = null, $return = false)
@@ -409,14 +409,14 @@ class HtmlHelper extends Helper
}
- /**
+/**
* Creates a formatted IMG element.
*
- * @param string $path Path to the image file, relative to the webroot/img/ directory.
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param string $path Path to the image file, relative to the webroot/img/ directory.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
@@ -433,14 +433,14 @@ class HtmlHelper extends Helper
return $this->output(sprintf($this->tags['image'], $url, $this->parseHtmlOptions($htmlAttributes, null, '', ' ')), $return);
}
- /**
+/**
* Creates a text input widget.
*
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function input($fieldName, $htmlAttributes = null, $return = false)
@@ -478,31 +478,30 @@ class HtmlHelper extends Helper
$this->_parseAttributes($htmlAttributes, null, ' ', ' ')), $return);
}
- /**
+/**
* Creates a set of radio widgets.
*
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
- * @param array $options Radio button options array
- * @param array $inbetween String that separates the radio buttons.
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $options Radio button options array
+ * @param array $inbetween String that separates the radio buttons.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
- function radio($fieldName, $options, $inbetween = null, $htmlAttributes = null,
- $return = false)
+ function radio($fieldName, $options, $inbetween = null, $htmlAttributes = array(), $return = false)
{
$this->setFormTag($fieldName);
$value = isset($htmlAttributes['value'])? $htmlAttributes['value']: $this->tagValue($fieldName);
$out = array();
- foreach ($options as $opt_value=>$opt_title)
+ foreach ($options as $optValue => $optTitle)
{
- $options_here = array('value' => $opt_value);
- $opt_value==$value? $options_here['checked'] = 'checked': null;
- $parsed_options = $this->parseHtmlOptions(array_merge($htmlAttributes, $options_here), null, '', ' ');
- $individual_tag_name = "{$this->field}_{$opt_value}";
- $out[] = sprintf($this->tags['radio'], $this->model, $this->field, $individual_tag_name, $parsed_options, $opt_title);
+ $optionsHere = array('value' => $optValue);
+ $optValue==$value? $optionsHere['checked'] = 'checked': null;
+ $parsedOptions = $this->parseHtmlOptions(array_merge($htmlAttributes, $optionsHere), null, '', ' ');
+ $individualTagName = "{$this->field}_{$optValue}";
+ $out[] = sprintf($this->tags['radio'], $this->model, $this->field, $individualTagName, $parsedOptions, $optTitle);
}
$out = join($inbetween, $out);
@@ -510,34 +509,34 @@ class HtmlHelper extends Helper
}
- /**
+/**
* Returns a row of formatted and named TABLE headers.
*
* @param array $names Array of tablenames.
- * @param array $tr_options HTML options for TR elements.
- * @param array $th_options HTML options for TH elements.
+ * @param array $trOptions HTML options for TR elements.
+ * @param array $thOptions HTML options for TH elements.
* @return string
*/
- function tableHeaders($names, $tr_options=null, $th_options=null)
+ function tableHeaders($names, $trOptions=null, $thOptions=null)
{
$out = array();
foreach ($names as $arg)
{
- $out[] = sprintf($this->tags['tableheader'], $this->parseHtmlOptions($th_options), $arg);
+ $out[] = sprintf($this->tags['tableheader'], $this->parseHtmlOptions($thOptions), $arg);
}
- return sprintf($this->tags['tablerow'], $this->parseHtmlOptions($tr_options), join(' ', $out));
+ return sprintf($this->tags['tablerow'], $this->parseHtmlOptions($trOptions), join(' ', $out));
}
- /**
- * Returns a formatted string of table rows (TR's with TD's in them).
- *
- * @param array $data Array of table data
- * @param array $odd_tr_options HTML options for odd TR elements
- * @param array $even_tr_options HTML options for even TR elements
- * @return string Formatted HTML
- */
- function tableCells($data, $odd_tr_options=null, $even_tr_options=null)
+/**
+ * Returns a formatted string of table rows (TR's with TD's in them).
+ *
+ * @param array $data Array of table data
+ * @param array $oddTrOptions HTML options for odd TR elements
+ * @param array $evenTrOptions HTML options for even TR elements
+ * @return string Formatted HTML
+ */
+ function tableCells($data, $oddTrOptions=null, $evenTrOptions=null)
{
if (empty($data[0]) || !is_array($data[0]))
{
@@ -548,21 +547,21 @@ class HtmlHelper extends Helper
foreach ($data as $line)
{
$count++;
- $cells_out = array();
+ $cellsOut = array();
foreach ($line as $cell)
{
- $cells_out[] = sprintf($this->tags['tablecell'], null, $cell);
+ $cellsOut[] = sprintf($this->tags['tablecell'], null, $cell);
}
- $options = $this->parseHtmlOptions($count%2? $odd_tr_options: $even_tr_options);
- $out[] = sprintf($this->tags['tablerow'], $options, join(' ', $cells_out));
+ $options = $this->parseHtmlOptions($count%2? $oddTrOptions: $evenTrOptions);
+ $out[] = sprintf($this->tags['tablerow'], $options, join(' ', $cellsOut));
}
return join("\n", $out);
}
- /**
+/**
* Returns value of $fieldName. False if the tag does not exist.
*
* @param string $fieldName Fieldname as "Modelname/fieldname" string
@@ -574,7 +573,7 @@ class HtmlHelper extends Helper
return isset($this->params['data'][$this->model][$this->field])? htmlspecialchars($this->params['data'][$this->model][$this->field]): false;
}
- /**
+/**
* Returns false if given FORM field has no errors. Otherwise it returns the constant set in the array Model->validationErrors.
*
* @param string $model Model name as string
@@ -586,7 +585,7 @@ class HtmlHelper extends Helper
return empty($this->validationErrors[$model][$field])? 0: $this->validationErrors[$model][$field];
}
- /**
+/**
* Returns number of errors in a submitted FORM.
*
* @return int Number of errors
@@ -599,7 +598,7 @@ class HtmlHelper extends Helper
return count($errors);
}
- /**
+/**
* Validates a FORM according to the rules set up in the Model.
*
* @return int Number of errors
@@ -618,7 +617,7 @@ class HtmlHelper extends Helper
return $this->validationErrors = (count($errors)? $errors: false);
}
- /**
+/**
* Returns a formatted error message for given FORM field, NULL if no errors.
*
* @param string $field A field name, like "Modelname/fieldname"
@@ -640,7 +639,7 @@ class HtmlHelper extends Helper
}
}
- /**
+/**
* Sets this helper's model and field properties to the slash-separated value-pair in $tagValue.
*
* @param string $tagValue A field name, like "Modelname/fieldname"
@@ -650,37 +649,37 @@ class HtmlHelper extends Helper
return list($this->model, $this->field) = explode("/", $tagValue);
}
- /**#@-*/
+/**#@-*/
- /*************************************************************************
- * Private methods
- *************************************************************************/
+/*************************************************************************
+ * Private methods
+ *************************************************************************/
- /**#@+
- * @access private
- */
+/**#@+
+ * @access private
+ */
- /**
+/**
* Returns a space-delimited string with items of the $options array. If a
* key of $options array happens to be one of:
- * + 'compact'
- * + 'checked'
- * + 'declare'
- * + 'readonly'
- * + 'disabled'
- * + 'selected'
- * + 'defer'
- * + 'ismap'
- * + 'nohref'
- * + 'noshade'
- * + 'nowrap'
- * + 'multiple'
- * + 'noresize'
+ * + 'compact'
+ * + 'checked'
+ * + 'declare'
+ * + 'readonly'
+ * + 'disabled'
+ * + 'selected'
+ * + 'defer'
+ * + 'ismap'
+ * + 'nohref'
+ * + 'noshade'
+ * + 'nowrap'
+ * + 'multiple'
+ * + 'noresize'
*
* And its value is one of:
- * + 1
- * + true
- * + 'true'
+ * + 1
+ * + true
+ * + 'true'
*
* Then the value will be reset to be identical with key's name.
* If the value is not one of these 3, the parameter is not output.
@@ -744,22 +743,22 @@ class HtmlHelper extends Helper
}
}
- /**#@-*/
+/**#@-*/
- /*************************************************************************
- * Renamed methods
- *************************************************************************/
+/*************************************************************************
+ * Renamed methods
+ *************************************************************************/
- /**
+/**
* @deprecated Name changed to 'textarea'. Version 0.9.2.
* @see HtmlHelper::textarea()
* @param string $tagName
* @param integer $cols
* @param integer $rows
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function areaTag($tagName, $cols = 60, $rows = 10, $htmlAttributes = null, $return = false)
@@ -769,13 +768,13 @@ class HtmlHelper extends Helper
return $this->textarea($tagName, $htmlAttributes, $return);
}
- /**
+/**
* @deprecated Name changed to 'charset'. Version 0.9.2.
* @see HtmlHelper::charset()
* @param string $charset
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function charsetTag($charset, $return = false)
@@ -783,16 +782,16 @@ class HtmlHelper extends Helper
return $this->charset($charset, $return);
}
- /**
+/**
* @deprecated Name changed to 'checkbox'. Version 0.9.2.
* @see HtmlHelper::checkbox()
* @param string $fieldName If field is to be used for CRUD, this
* should be modelName/fieldName.
* @param string $title
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function checkboxTag($fieldName, $title = null, $htmlAttributes = null, $return = false)
@@ -800,15 +799,15 @@ class HtmlHelper extends Helper
return $this->checkbox($fieldName, $title, $htmlAttributes, $return);
}
- /**
+/**
* @deprecated Name changed to 'css'. Version 0.9.2.
* @see HtmlHelper::css()
- * @param string $path Path to CSS file
+ * @param string $path Path to CSS file
* @param string $rel Rel attribute. Defaults to "stylesheet".
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function cssTag($path, $rel = 'stylesheet', $htmlAttributes = null, $return = false)
@@ -816,14 +815,14 @@ class HtmlHelper extends Helper
return $this->css($path, $rel , $htmlAttributes , $return );
}
- /**
+/**
* @deprecated Name changed to 'file'. Version 0.9.2.
* @see HtmlHelper::file()
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function fileTag($fieldName, $htmlAttributes = null, $return = false)
@@ -831,38 +830,38 @@ class HtmlHelper extends Helper
return $this->file($fieldName, $htmlAttributes, $return);
}
- /**
+/**
* @deprecated Name changed to 'hidden'. Version 0.9.2.
* @see HtmlHelper::hidden()
* @param string $fieldName If field is to be used for CRUD, this
* should be modelName/fieldName.
* @param string $value
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
- //function hiddenTag($fieldName, $value = null, $htmlAttributes = null, $return = false)
- //{
- // $htmlAttributes['value'] = $value;
- // return $this->hidden($fieldName, $htmlAttributes, $return);
- //}
+//function hiddenTag($fieldName, $value = null, $htmlAttributes = null, $return = false)
+//{
+// $htmlAttributes['value'] = $value;
+// return $this->hidden($fieldName, $htmlAttributes, $return);
+//}
function hiddenTag($tagName, $value=null, $htmlOptions=null)
{
$this->setFormTag($tagName);
$htmlOptions['value'] = $value? $value: $this->tagValue($tagName);
return $this->output(sprintf($this->tags['hidden'], $this->model, $this->field, $this->parseHtmlOptions($htmlOptions, null, '', ' ')));
}
- /**
+/**
* @deprecated Name changed to 'image'. Version 0.9.2.
* @see HtmlHelper::image()
- * @param string $path Path to the image file.
+ * @param string $path Path to the image file.
* @param string $alt
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function imageTag($path, $alt = null, $htmlAttributes = null, $return = false)
@@ -871,23 +870,23 @@ class HtmlHelper extends Helper
return $this->image($path, $htmlAttributes, $return);
}
- /**
+/**
* @deprecated Name changed to 'input'. Version 0.9.2.
* @see HtmlHelper::input()
* @param string $fieldName If field is to be used for CRUD, this
* should be modelName/fieldName.
* @param string $value
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
- //function inputTag($fieldName, $value = null, $htmlAttributes = null, $return = false)
- //{
- // $htmlAttributes['value'] = $value;
- // return $this->input($fieldName, $htmlAttributes, $return);
- //}
+//function inputTag($fieldName, $value = null, $htmlAttributes = null, $return = false)
+//{
+// $htmlAttributes['value'] = $value;
+// return $this->input($fieldName, $htmlAttributes, $return);
+//}
function inputTag($tagName, $size=20, $htmlOptions=null)
{
@@ -897,16 +896,16 @@ class HtmlHelper extends Helper
return $this->output(sprintf($this->tags['input'], $this->model, $this->field, $this->parseHtmlOptions($htmlOptions, null, '', ' ')));
}
- /**
+/**
* @deprecated Unified with 'link'. Version 0.9.2.
* @see HtmlHelper::link()
* @param string $title The content of the "a" tag.
* @param string $url
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $escapeTitle Whether or not the text in the $title variable should be HTML escaped.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function linkOut($title, $url = null, $htmlAttributes = null, $escapeTitle = true, $return = false)
@@ -914,17 +913,17 @@ class HtmlHelper extends Helper
return $this->link($title, $url, $htmlAttributes, false, $escapeTitle, $return);
}
- /**
+/**
* @deprecated Unified with 'link'. Version 0.9.2.
* @see HtmlHelper::link()
* @param string $title The content of the "a" tag.
* @param string $url
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param string $confirmMessage Confirmation message.
* @param boolean $escapeTitle Whether or not the text in the $title variable should be HTML escaped.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function linkTo($title, $url, $htmlAttributes = null, $confirmMessage = false, $escapeTitle = true, $return = false)
@@ -932,7 +931,7 @@ class HtmlHelper extends Helper
return $this->link($title, $url, $htmlAttributes, $confirmMessage, $escapeTitle, $return);
}
- /**
+/**
* @deprecated Name changed to '_parseAttributes'. Version 0.9.2.
* @see HtmlHelper::_parseAttributes()
* @param array $options Array of options.
@@ -941,12 +940,12 @@ class HtmlHelper extends Helper
* @param string $insertAfter String to be inserted ater options.
* @return string
*/
- //function parseHtmlOptions($options, $exclude = null, $insertBefore = ' ', $insertAfter = null)
- // {
- // $this->_parseAttributes($options, $exclude, $insertBefore, $insertAfter);
- // }
+//function parseHtmlOptions($options, $exclude = null, $insertBefore = ' ', $insertAfter = null)
+// {
+// $this->_parseAttributes($options, $exclude, $insertBefore, $insertAfter);
+// }
- function parseHtmlOptions($options, $exclude=null, $insert_before=' ', $insert_after=null)
+ function parseHtmlOptions($options, $exclude=null, $insertBefore=' ', $insertAfter=null)
{
if (!is_array($exclude)) $exclude = array();
@@ -961,22 +960,22 @@ class HtmlHelper extends Helper
}
}
$out = join(' ', $out);
- return $out? $insert_before.$out.$insert_after: null;
+ return $out? $insertBefore.$out.$insertAfter: null;
}
else
{
- return $options? $insert_before.$options.$insert_after: null;
+ return $options? $insertBefore.$options.$insertAfter: null;
}
}
- /**
+/**
* @deprecated Name changed to 'password'. Version 0.9.2.
* @see HtmlHelper::password()
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function passwordTag($fieldName, $size = 20, $htmlAttributes = null, $return = false)
@@ -985,16 +984,16 @@ class HtmlHelper extends Helper
return call_user_func_array(array(&$this, "password"), $args);
}
- /**
+/**
* @deprecated Name changed to 'radio'. Version 0.9.2.
* @see HtmlHelper::radio()
* @param string $fieldName Name of a field, like this "Modelname/fieldname"
- * @param array $options
- * @param array $inbetween
- * @param array $htmlAttributes Array of HTML attributes.
+ * @param array $options
+ * @param array $inbetween
+ * @param array $htmlAttributes Array of HTML attributes.
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function radioTags($fieldName, $options, $inbetween = null, $htmlAttributes = null,
@@ -1003,33 +1002,33 @@ class HtmlHelper extends Helper
return $this->radio($fieldName, $options, $inbetween, $htmlAttributes, $return);
}
- /**
+/**
* Returns a SELECT element,
*
* @param string $fieldName Name attribute of the SELECT
- * @param array $option_elements Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the SELECT element
+ * @param array $optionElements Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the SELECT element
* @param boolean $show_empty Show/hide the empty select option
- * @param array $select_attr Array of HTML options for the opening SELECT element
+ * @param array $selectAttr Array of HTML options for the opening SELECT element
* @param array $optionAttr Array of HTML options for the enclosed OPTION elements
* @return string Formatted SELECT element
*/
- function selectTag($fieldName, $option_elements, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty=true)
+ function selectTag($fieldName, $optionElements, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty=true)
{
$this->setFormTag($fieldName);
- // do not display the select tag if no option elements are avaible
- if (!is_array($option_elements) || count($option_elements) == 0)
+// do not display the select tag if no option elements are avaible
+ if (!is_array($optionElements) || count($optionElements) == 0)
{
return null;
}
- if( isset($select_attr) && array_key_exists( "multiple", $select_attr) )
+ if( isset($selectAttr) && array_key_exists( "multiple", $selectAttr) )
{
- $select[] = sprintf($this->tags['selectmultiplestart'], $this->model, $this->field, $this->parseHtmlOptions($select_attr));
+ $select[] = sprintf($this->tags['selectmultiplestart'], $this->model, $this->field, $this->parseHtmlOptions($selectAttr));
}
else
{
- $select[] = sprintf($this->tags['selectstart'], $this->model, $this->field, $this->parseHtmlOptions($select_attr));
+ $select[] = sprintf($this->tags['selectstart'], $this->model, $this->field, $this->parseHtmlOptions($selectAttr));
}
if($showEmpty == true)
@@ -1037,17 +1036,17 @@ class HtmlHelper extends Helper
$select[] = sprintf($this->tags['selectempty'], $this->parseHtmlOptions($optionAttr));
}
- foreach ($option_elements as $name=>$title)
+ foreach ($optionElements as $name => $title)
{
- $options_here = $optionAttr;
+ $optionsHere = $optionAttr;
if (($selected !== null) && ($selected == $name))
{
- $options_here['selected'] = 'selected';
+ $optionsHere['selected'] = 'selected';
} else if ( is_array($selected) && array_key_exists($name, $selected) )
{
- $options_here['selected'] = 'selected';
+ $optionsHere['selected'] = 'selected';
}
- $select[] = sprintf($this->tags['selectoption'], $name, $this->parseHtmlOptions($options_here), $title);
+ $select[] = sprintf($this->tags['selectoption'], $name, $this->parseHtmlOptions($optionsHere), $title);
}
$select[] = sprintf($this->tags['selectend']);
@@ -1056,7 +1055,7 @@ class HtmlHelper extends Helper
}
- /**
+/**
* @deprecated Name changed to 'url'. Version 0.9.2.
* @see HtmlHelper::url()
*/
@@ -1069,7 +1068,7 @@ class HtmlHelper extends Helper
- /**
+/**
* @deprecated Name changed to 'submit'. Version 0.9.2.
* @see HtmlHelper::submit()
*/
@@ -1079,11 +1078,11 @@ class HtmlHelper extends Helper
return call_user_func_array(array(&$this, "submit"), $args);
}
- /*************************************************************************
- * Moved methods
- *************************************************************************/
+/*************************************************************************
+ * Moved methods
+ *************************************************************************/
- /**
+/**
* @deprecated Moved to TextHelper. Version 0.9.2.
*/
function trim()
@@ -1091,7 +1090,7 @@ class HtmlHelper extends Helper
die("Method HtmlHelper::trim() was moved to TextHelper::trim().");
}
- /**
+/**
* @deprecated Moved to JavascriptHelper. Version 0.9.2.
*/
function javascriptIncludeTag($url)
@@ -1099,7 +1098,7 @@ class HtmlHelper extends Helper
die("Method HtmlHelper::javascriptIncludeTag() was moved to JavascriptHelper::link().");
}
- /**
+/**
* @deprecated Moved to JavascriptHelper. Version 0.9.2.
*/
function javascriptTag($script)
@@ -1107,11 +1106,11 @@ class HtmlHelper extends Helper
die("Method HtmlHelper::javascriptTag() was moved to JavascriptHelper::codeBlock().");
}
- /*************************************************************************
- * Deprecated methods
- *************************************************************************/
+/*************************************************************************
+ * Deprecated methods
+ *************************************************************************/
- /**
+/**
* Returns an HTML FORM element.
*
* @param string $target URL for the FORM's ACTION attribute.
@@ -1130,16 +1129,16 @@ class HtmlHelper extends Helper
return sprintf($this->tags['form'], $this->parseHtmlOptions($htmlAttributes, null, ''));
}
- /**
+/**
* Generates a nested unordered list tree from an array.
*
- * @param array $data
- * @param array $htmlAttributes
+ * @param array $data
+ * @param array $htmlAttributes
* @param string $bodyKey
* @param string $childrenKey
* @param boolean $return Wheter this method should return a value
* or output it. This overrides AUTO_OUTPUT.
- * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
+ * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return. If $this->_crumbs is empty, return null.
* @deprecated This seems useless. Version 0.9.2.
*/
@@ -1162,11 +1161,11 @@ class HtmlHelper extends Helper
return $this->output($out, $return);
}
- /**
+/**
* Returns a mailto: link.
*
* @param string $title Title of the link, or the e-mail address
- * (if the same).
+ * (if the same).
* @param string $email E-mail address if different from title.
* @param array $options
* @return string Formatted A tag
@@ -1174,20 +1173,20 @@ class HtmlHelper extends Helper
*/
function linkEmail($title, $email=null, $options=null)
{
- // if no $email, then title contains the email.
+// if no $email, then title contains the email.
if (empty($email)) $email = $title;
$match = array();
- // does the address contain extra attributes?
+// does the address contain extra attributes?
preg_match('!^(.*)(\?.*)$!', $email, $match);
- // plaintext
+// plaintext
if (empty($options['encode']) || !empty($match[2]))
{
return sprintf($this->tags['mailto'], $email, $this->parseHtmlOptions($options), $title);
}
- // encoded to avoid spiders
+// encoded to avoid spiders
else
{
$email_encoded = null;
@@ -1213,16 +1212,16 @@ class HtmlHelper extends Helper
}
}
- /**
+/**
* Returns a generic HTML tag (no content).
*
* Examples:
- * + tag("br") =>
- * + tag("input", array("type" => "text")) =>
+ * + tag("br") =>
+ * + tag("input", array("type" => "text")) =>
*
* @param string $name Name of HTML element
* @param array $options HTML options
- * @param bool $open Is the tag open or closed? (defaults to closed "/>")
+ * @param bool $open Is the tag open or closed? (defaults to closed "/>")
* @return string The formatted HTML tag
* @deprecated This seems useless. Version 0.9.2.
*/
@@ -1233,7 +1232,7 @@ class HtmlHelper extends Helper
return $tag;
}
- /**
+/**
* Returns a generic HTML tag with content.
*
* Examples:
@@ -1245,7 +1244,7 @@ class HtmlHelper extends Helper
*
* @param string $name Name of HTML element
* @param array $options HTML options
- * @param bool $open Is the tag open or closed? (defaults to closed "/>")
+ * @param bool $open Is the tag open or closed? (defaults to closed "/>")
* @return string The formatted HTML tag
* @deprecated This seems useless. Version 0.9.2.
*/
@@ -1254,7 +1253,7 @@ class HtmlHelper extends Helper
return "<$name ". $this->parseHtmlOptions($options). ">$content$name>";
}
- /**
+/**
* Returns a SELECT element for days.
*
* @param string $tagName Prefix name for the SELECT element
@@ -1264,7 +1263,7 @@ class HtmlHelper extends Helper
* @param boolean $show_empty Show/hide the empty select option
* @return string
*/
- function dayOptionTag($tagName, $value=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
+ function dayOptionTag($tagName, $value=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_day");
$dayValue = empty($selected) ? date('d') : $selected;
@@ -1277,11 +1276,11 @@ class HtmlHelper extends Helper
'22'=>'22','23'=>'23','24'=>'24',
'25'=>'25','26'=>'26','27'=>'27',
'28'=>'28','29'=>'29','30'=>'30','31'=>'31');
- $option = $this->selectTag($tagName.'_day', $days, $dayValue, $select_attr, $optionAttr, $showEmpty);
+ $option = $this->selectTag($tagName.'_day', $days, $dayValue, $selectAttr, $optionAttr, $showEmpty);
return $option;
}
- /**
+/**
* Returns a SELECT element for years
*
* @param string $tagName Prefix name for the SELECT element
@@ -1293,7 +1292,7 @@ class HtmlHelper extends Helper
* @param boolean $show_empty Show/hide the empty select option
* @return string
*/
- function yearOptionTag($tagName, $value=null, $minYear=null, $maxYear=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
+ function yearOptionTag($tagName, $value=null, $minYear=null, $maxYear=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_year");
@@ -1318,11 +1317,11 @@ class HtmlHelper extends Helper
$years[$yearCounter] = $yearCounter;
}
- $option = $this->selectTag($tagName.'_year', $years, $yearValue, $select_attr, $optionAttr, $showEmpty);
+ $option = $this->selectTag($tagName.'_year', $years, $yearValue, $selectAttr, $optionAttr, $showEmpty);
return $option;
}
- /**
+/**
* Returns a SELECT element for months.
*
* @param string $tagName Prefix name for the SELECT element
@@ -1332,18 +1331,18 @@ class HtmlHelper extends Helper
* @param boolean $show_empty Show/hide the empty select option
* @return string
*/
- function monthOptionTag($tagName, $value=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
+ function monthOptionTag($tagName, $value=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_month");
$monthValue = empty($selected) ? date('m') : $selected ;
$months=array('01'=>'January','02'=>'February','03'=>'March',
'04'=>'April','05'=>'May','06'=>'June','07'=>'July','08'=>'August',
'09'=>'September','10'=>'October','11'=>'November','12'=>'December');
- $option = $this->selectTag($tagName.'_month', $months, $monthValue, $select_attr, $optionAttr, $showEmpty);
+ $option = $this->selectTag($tagName.'_month', $months, $monthValue, $selectAttr, $optionAttr, $showEmpty);
return $option;
}
- /**
+/**
* Returns a SELECT element for hours.
*
* @param string $tagName Prefix name for the SELECT element
@@ -1353,7 +1352,7 @@ class HtmlHelper extends Helper
* @param array $optionAttr Attribute array for the option elements.
* @return string
*/
- function hourOptionTag($tagName, $value=null, $format24Hours = false, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true )
+ function hourOptionTag($tagName, $value=null, $format24Hours = false, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true )
{
$value = isset($value)? $value : $this->tagValue($tagName."_hour");
if ( $format24Hours )
@@ -1380,12 +1379,12 @@ class HtmlHelper extends Helper
'10'=>'10','11'=>'11','12'=>'12');
}
- $option = $this->selectTag($tagName.'_hour', $hours, $hourValue, $select_attr,
+ $option = $this->selectTag($tagName.'_hour', $hours, $hourValue, $selectAttr,
$optionAttr);
return $option;
}
- /**
+/**
* Returns a SELECT element for minutes.
*
* @param string $tagName Prefix name for the SELECT element
@@ -1394,7 +1393,7 @@ class HtmlHelper extends Helper
* @param array $optionAttr Attribute array for the option elements.
* @return string
*/
- function minuteOptionTag( $tagName, $value=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
+ function minuteOptionTag( $tagName, $value=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_min");
$minValue = empty($selected) ? date('i') : $selected ;
@@ -1403,12 +1402,12 @@ class HtmlHelper extends Helper
$mins[$minCount] = sprintf('%02d', $minCount);
}
- $option = $this->selectTag($tagName.'_min', $mins, $minValue, $select_attr,
+ $option = $this->selectTag($tagName.'_min', $mins, $minValue, $selectAttr,
$optionAttr);
return $option;
}
- /**
+/**
* Returns a SELECT element for AM or PM.
*
* @param string $tagName Prefix name for the SELECT element
@@ -1417,18 +1416,18 @@ class HtmlHelper extends Helper
* @param array $optionAttr Attribute array for the option elements.
* @return string
*/
- function meridianOptionTag( $tagName, $value=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
+ function meridianOptionTag( $tagName, $value=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_meridian");
$merValue = empty($selected) ? date('a') : $selected ;
$meridians = array('am'=>'am','pm'=>'pm');
- $option = $this->selectTag($tagName.'_meridian', $meridians, $merValue, $select_attr,
+ $option = $this->selectTag($tagName.'_meridian', $meridians, $merValue, $selectAttr,
$optionAttr);
return $option;
}
- /**
+/**
* Returns a set of SELECT elements for a full datetime setup: day, month and year, and then time.
*
* @param string $tagName Prefix name for the SELECT element
@@ -1438,13 +1437,13 @@ class HtmlHelper extends Helper
* @param array $optionAttr Attribute array for the option elements.
* @return string The HTML formatted OPTION element
*/
- function dateTimeOptionTag( $tagName, $dateFormat = 'DMY', $timeFormat = '12',$selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
+ function dateTimeOptionTag( $tagName, $dateFormat = 'DMY', $timeFormat = '12',$selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
- $day = null;
+ $day = null;
$month = null;
$year = null;
$hour = null;
- $min = null;
+ $min = null;
$meridian = null;
if(!empty($selected))
@@ -1457,7 +1456,7 @@ class HtmlHelper extends Helper
$date = explode('-',$selected);
$days = explode(' ',$date[2]);
- $day = $days[0];
+ $day = $days[0];
$month = $date[1];
$year = $date[0];
@@ -1474,7 +1473,7 @@ class HtmlHelper extends Helper
$meridian = 'pm';
}
$hour = $time[0];
- $min = $time[1];
+ $min = $time[1];
}
}
@@ -1482,13 +1481,13 @@ class HtmlHelper extends Helper
switch ( $dateFormat )
{
case 'DMY' :
- $opt = $this->dayOptionTag( $tagName ,null ,$day, $select_attr, $optionAttr, $showEmpty) . '-' . $this->monthOptionTag( $tagName, null, $month, $select_attr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag( $tagName, null, null, null, $year, $select_attr, $optionAttr, $showEmpty);
+ $opt = $this->dayOptionTag( $tagName ,null ,$day, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->monthOptionTag( $tagName, null, $month, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag( $tagName, null, null, null, $year, $selectAttr, $optionAttr, $showEmpty);
break;
case 'MDY' :
- $opt = $this->monthOptionTag($tagName, null, $month, $select_attr, $optionAttr, $showEmpty) .'-'.$this->dayOptionTag( $tagName, null, $day, $select_attr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag($tagName, null, null, null, $year, $optionAttr, $select_attr, $showEmpty);
+ $opt = $this->monthOptionTag($tagName, null, $month, $selectAttr, $optionAttr, $showEmpty) .'-'.$this->dayOptionTag( $tagName, null, $day, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag($tagName, null, null, null, $year, $optionAttr, $selectAttr, $showEmpty);
break;
case 'YMD' :
- $opt = $this->yearOptionTag($tagName, null, null, null, $year, $select_attr, $optionAttr, $showEmpty) . '-' . $this->monthOptionTag( $tagName, null, $month, $select_attr, $optionAttr, $showEmpty) . '-' . $this->dayOptionTag( $tagName, null, $day, $optionAttr, $select_attr, $showEmpty);
+ $opt = $this->yearOptionTag($tagName, null, null, null, $year, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->monthOptionTag( $tagName, null, $month, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->dayOptionTag( $tagName, null, $day, $optionAttr, $selectAttr, $showEmpty);
break;
case 'NONE':
$opt ='';
@@ -1500,10 +1499,10 @@ class HtmlHelper extends Helper
switch ($timeFormat)
{
case '24':
- $opt .= $this->hourOptionTag( $tagName, null , true, $hour, $select_attr, $optionAttr, $showEmpty) . ':' . $this->minuteOptionTag( $tagName, null, $min, $select_attr, $optionAttr, $showEmpty);
+ $opt .= $this->hourOptionTag( $tagName, null , true, $hour, $selectAttr, $optionAttr, $showEmpty) . ':' . $this->minuteOptionTag( $tagName, null, $min, $selectAttr, $optionAttr, $showEmpty);
break;
case '12':
- $opt .= $this->hourOptionTag( $tagName, null, false, $hour, $select_attr, $optionAttr, $showEmpty) . ':' . $this->minuteOptionTag( $tagName, null, $min, $select_attr, $optionAttr, $showEmpty) . ' ' . $this->meridianOptionTag($tagName, null, $meridian, $select_attr, $optionAttr, $showEmpty);
+ $opt .= $this->hourOptionTag( $tagName, null, false, $hour, $selectAttr, $optionAttr, $showEmpty) . ':' . $this->minuteOptionTag( $tagName, null, $min, $selectAttr, $optionAttr, $showEmpty) . ' ' . $this->meridianOptionTag($tagName, null, $meridian, $selectAttr, $optionAttr, $showEmpty);
break;
case 'NONE':
$opt .='';
diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php
index 822115d99..29c5a2179 100644
--- a/cake/libs/view/helpers/javascript.php
+++ b/cake/libs/view/helpers/javascript.php
@@ -43,7 +43,7 @@ class JavascriptHelper extends Helper
var $_cachedEvents = array();
var $_cacheEvents = false;
- /**
+/**
* Returns a JavaScript script tag.
*
* @param string $script The JavaScript to be wrapped in SCRIPT tags.
@@ -54,7 +54,7 @@ class JavascriptHelper extends Helper
return sprintf($this->tags['javascriptblock'], $script);
}
- /**
+/**
* Returns a JavaScript include tag (SCRIPT element)
*
* @param string $url URL to JavaScript file.
@@ -66,7 +66,7 @@ class JavascriptHelper extends Helper
return sprintf($this->tags['javascriptlink'], $this->webroot.JS_URL.$this->themeWeb.$url);
}
- /**
+/**
* Returns a JavaScript include tag for an externally-hosted script
*
* @param string $url URL to JavaScript file.
@@ -79,11 +79,11 @@ class JavascriptHelper extends Helper
}
/**
- * Escape carriage returns and single and double quotes for JavaScript segments.
- *
- * @param string $script string that might have javascript elements
- * @return string escaped string
- */
+ * Escape carriage returns and single and double quotes for JavaScript segments.
+ *
+ * @param string $script string that might have javascript elements
+ * @return string escaped string
+ */
function escapeScript ($script)
{
$script = str_replace(array("\r\n","\n","\r"),'\n', $script);
@@ -95,11 +95,11 @@ class JavascriptHelper extends Helper
* Escape a string to be JavaScript friendly.
*
* List of escaped ellements:
- * + "\r\n" => '\n'
- * + "\r" => '\n'
- * + "\n" => '\n'
- * + '"' => '\"'
- * + "'" => "\\'"
+ * + "\r\n" => '\n'
+ * + "\r" => '\n'
+ * + "\n" => '\n'
+ * + '"' => '\"'
+ * + "'" => "\\'"
*
* @param string $script String that needs to get escaped.
* @return string Escaped string.
@@ -108,8 +108,8 @@ class JavascriptHelper extends Helper
{
$escape = array(
"\r\n" => '\n',
- "\r" => '\n',
- "\n" => '\n',
+ "\r" => '\n',
+ "\n" => '\n',
'"' => '\"',
"'" => "\\'"
);
@@ -117,14 +117,14 @@ class JavascriptHelper extends Helper
return str_replace(array_keys($escape), array_values($escape), $string);
}
/**
- * Attach an event to an element. Used with the Prototype library.
- *
- * @param string $object Object to be observed
- * @param string $event event to observe
- * @param string $observer function to call
- * @param boolean $useCapture default true
- * @return boolean true on success
- */
+ * Attach an event to an element. Used with the Prototype library.
+ *
+ * @param string $object Object to be observed
+ * @param string $event event to observe
+ * @param string $observer function to call
+ * @param boolean $useCapture default true
+ * @return boolean true on success
+ */
function event ($object, $event, $observer, $useCapture = true)
{
if($useCapture == true)
@@ -149,10 +149,10 @@ class JavascriptHelper extends Helper
/**
- * Cache JavaScript events created with event()
- *
- * @return null
- */
+ * Cache JavaScript events created with event()
+ *
+ * @return null
+ */
function cacheEvents ()
{
$this->_cacheEvents = true;
@@ -160,10 +160,10 @@ class JavascriptHelper extends Helper
/**
- * Write cached JavaScript events
- *
- * @return string A single code block of all cached JavaScript events created with event()
- */
+ * Write cached JavaScript events
+ *
+ * @return string A single code block of all cached JavaScript events created with event()
+ */
function writeEvents ()
{
$this->_cacheEvents = false;
@@ -171,14 +171,14 @@ class JavascriptHelper extends Helper
}
/**
- * Includes the Prototype Javascript library (and anything else) inside a single script tag.
- *
- * Note: The recommended approach is to copy the contents of
- * javascripts into your application's
- * public/javascripts/ directory, and use @see javascriptIncludeTag() to
- * create remote script links.
- * @return string script with all javascript in /javascripts folder
- */
+ * Includes the Prototype Javascript library (and anything else) inside a single script tag.
+ *
+ * Note: The recommended approach is to copy the contents of
+ * javascripts into your application's
+ * public/javascripts/ directory, and use @see javascriptIncludeTag() to
+ * create remote script links.
+ * @return string script with all javascript in/javascripts folder
+ */
function includeScript ($script = "")
{
if($script == "")
@@ -201,18 +201,18 @@ class JavascriptHelper extends Helper
}
/**
- * Generates a JavaScript object in JavaScript Object Notation (JSON)
- * from an array
- *
- * @param array $data Data to be converted
- * @param boolean $block Wraps return value in a block if true
- * @param string $prefix Prepends the string to the returned data
- * @param string $postfix Appends the string to the returned data
- * @param array $stringKeys A list of array keys to be treated as a string
- * @param boolean $quoteKeys If false, treats $stringKey as a list of keys *not* to be quoted
- * @param string $q The type of quote to use
- * @return string A JSON code block
- */
+ * Generates a JavaScript object in JavaScript Object Notation (JSON)
+ * from an array
+ *
+ * @param array $data Data to be converted
+ * @param boolean $block Wraps return value in a block if true
+ * @param string $prefix Prepends the string to the returned data
+ * @param string $postfix Appends the string to the returned data
+ * @param array $stringKeys A list of array keys to be treated as a string
+ * @param boolean $quoteKeys If false, treats $stringKey as a list of keys *not* to be quoted
+ * @param string $q The type of quote to use
+ * @return string A JSON code block
+ */
function object ($data = array(), $block = false, $prefix = '', $postfix = '', $stringKeys = array(), $quoteKeys = true, $q = "'")
{
$out = array();
diff --git a/cake/libs/view/helpers/number.php b/cake/libs/view/helpers/number.php
index 4a26a3052..34e3a94b9 100644
--- a/cake/libs/view/helpers/number.php
+++ b/cake/libs/view/helpers/number.php
@@ -3,13 +3,13 @@
/**
* Number Helper.
- *
+ *
* Methods to make numbers more readable.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework