Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1125]

Adding empty directories where overrides for the core views can be placed.
Adding an empty directory for elements 

[1127]
Adding directory to hold core inflection files 

[1128]
More work on the new inflector.
This still is not completed but should be soon

[1130]
Documentation strings, du jour.

[1131]
Docstringed and ready. Inflector lacks one docstring. It is noted in its todo

[1132]
Incomplete documentation, and some corrections to previous documentation.
Gwoo noted that there'll be more changes in the Helpers soon, so I back off here.

[1134]
Adding before filters back to code.
Commented out a regex in Inflector::pluralize(); that os causing problems.
Removed a duplicate define in index.php.
Removed the bare array being set automatically when using requestAction().
With this change you must use requestAction(); like this.
$object->requestAction('/bare/controller/action/param');
Added GOTCHAS file with links to problems people may have with CakePHP.
Some more work done on new Inflector. 

[1135]
Added a check when trying to access a private method of a controller.
This will now display an error page informing user that this is not allowed. 

[1137]
Fixed a few undefined variable errors in the code
Corrected problem with double layout display when an error is returned and caught.

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1138 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information...
commit 6baaa1120f802bd484b0f81817a5c26d76cefb04 1 parent ebdb8df
@phpnut phpnut authored
Showing with 641 additions and 495 deletions.
  1. +5 −0 app/config/paths.php
  2. +2 −2 cake/app_model.php
  3. +21 −17 cake/basics.php
  4. +101 −0 cake/conf/inflections/nouns.php
  5. +20 −20 cake/dispatcher.php
  6. +17 −0 cake/docs/GOTCHAS.txt
  7. +6 −5 cake/docs/README.txt
  8. +1 −1  cake/libs/cache.php
  9. +27 −7 cake/libs/controller/controller.php
  10. +2 −1  cake/libs/error_messages.php
  11. +19 −19 cake/libs/file.php
  12. +1 −1  cake/libs/flay.php
  13. +10 −10 cake/libs/folder.php
  14. +25 −23 cake/libs/inflector.php
  15. +1 −1  cake/libs/legacy.php
  16. +8 −10 cake/libs/log.php
  17. +1 −1  cake/libs/model/model.php
  18. +2 −1  cake/libs/neat_array.php
  19. +18 −18 cake/libs/neat_string.php
  20. +116 −14 cake/libs/new_inflector.php
  21. +13 −13 cake/libs/object.php
  22. +7 −6 cake/libs/router.php
  23. +10 −8 cake/libs/sanitize.php
  24. +0 −266 cake/libs/time.php
  25. +1 −1  cake/libs/validators.php
  26. +9 −9 cake/libs/view/helper.php
  27. +50 −0 cake/libs/view/helpers/ajax.php
  28. +1 −1  cake/libs/view/helpers/form.php
  29. +72 −5 cake/libs/view/helpers/html.php
  30. +4 −3 cake/libs/view/helpers/text.php
  31. +40 −0 cake/libs/view/templates/errors/private_action.thtml
  32. +15 −13 cake/libs/view/view.php
  33. +2 −2 cake/scripts/bake.php
  34. +11 −10 cake/scripts/test.php
  35. +3 −7 index.php
View
5 app/config/paths.php
@@ -102,6 +102,11 @@
/**
* Path to the libs directory.
*/
+define ('INFLECTIONS', CAKE.'config'.DS.'inflections'.DS);
+
+/**
+ * Path to the libs directory.
+ */
define ('LIBS', CAKE.'libs'.DS);
/**
View
4 cake/app_model.php
@@ -2,7 +2,7 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * Application model for Cake.
*
* This file is application-wide model file. You can put all
* application-wide model-related methods here.
@@ -33,7 +33,7 @@
*/
/**
- * Short description for class.
+ * Application model for Cake.
*
* Add your application-wide methods in the class below, your models
* will inherit them.
View
38 cake/basics.php
@@ -297,10 +297,10 @@ function array_combine($a1, $a2)
}
/**
- * Enter description here...
+ * Convenience method for htmlspecialchars.
*
- * @param unknown_type $text
- * @return unknown
+ * @param string $text
+ * @return string
*/
function h($text)
{
@@ -309,9 +309,9 @@ function h($text)
/**
- * Enter description here...
+ * Returns an array of all the given parameters, making parameter lists shorter to write.
*
- * @return unknown
+ * @return array
*/
function a()
{
@@ -321,9 +321,10 @@ function a()
/**
- * Enter description here...
+ * Hierarchical arrays.
*
- * @return unknown
+ * @return array
+ * @todo Explain this method better.
*/
function ha()
{
@@ -339,9 +340,9 @@ function ha()
/**
- * Enter description here...
+ * Convenience method for echo().
*
- * @param unknown_type $text
+ * @param string $text String to echo
*/
function e($text)
{
@@ -349,9 +350,11 @@ function e($text)
}
/**
- * Enter description here...
- *
- * @param unknown_type $var
+ * Print_r convenience function, which prints out <PRE> tags around
+ * the output of given array. Similar to debug().
+ *
+ * @see debug
+ * @param array $var
*/
function pr($var)
{
@@ -364,10 +367,10 @@ function pr($var)
}
/**
- * Enter description here...
+ * Display parameter
*
- * @param unknown_type $p
- * @return unknown
+ * @param mixed $p Parameter as string or array
+ * @return string
*/
function params($p)
{
@@ -391,9 +394,10 @@ function params($p)
}
/**
- * Enter description here...
+ * Returns the REQUEST_URI from the server environment, or, failing that, constructs
+ * a new one, using the PHP_SELF constant and other variables.
*
- * @return unknown
+ * @return string
*/
function setUri() {
if (isset($_SERVER['REQUEST_URI']))
View
101 cake/conf/inflections/nouns.php
@@ -0,0 +1,101 @@
+<?php
+/* SVN FILE: $Id$ */
+
+/**
+ * Short description for file.
+ *
+ * Long description for file
+ *
+ * PHP versions 4 and 5
+ *
+ * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
+ * Copyright (c) 2005, CakePHP Authors/Developers
+ *
+ * Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
+ * Larry E. Masters aka PhpNut <nut@phpnut.com>
+ * Kamil Dzielinski aka Brego <brego.dk@gmail.com>
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @author CakePHP Authors/Developers
+ * @copyright Copyright (c) 2005, CakePHP Authors/Developers
+ * @link https://trac.cakephp.org/wiki/Authors Authors/Developers
+ * @package cake
+ * @subpackage cake.cake.config.inflections
+ * @since CakePHP v .0.10.x.x
+ * @version $Revision$
+ * @modifiedby $LastChangedBy$
+ * @lastmodified $Date$
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+
+$pluralUninflectedHerd = array(
+# DON'T INFLECT IN CLASSICAL MODE, OTHERWISE NORMAL INFLECTION
+'wildebeest', 'swine', 'eland', 'bison', 'buffalo','elk', 'moose', 'rhinoceros',);
+
+$pluralUninflecteds =array(
+# PAIRS OR GROUPS SUBSUMED TO A SINGULAR...
+'breeches', 'britches', 'clippers', 'gallows', 'hijinks',
+'headquarters', 'pliers', 'scissors', 'testes', 'herpes',
+'pincers', 'shears', 'proceedings', 'trousers',
+# UNASSIMILATED LATIN 4th DECLENSION
+'cantus', 'coitus', 'nexus',
+# RECENT IMPORTS...
+'contretemps', 'corps', 'debris',
+'.*ois', 'siemens',
+# DISEASES
+'.*measles', 'mumps',
+# MISCELLANEOUS OTHERS...
+'diabetes', 'jackanapes', 'series', 'species', 'rabies',
+'chassis', 'innings', 'news', 'mews',);
+
+$pluralUninflected = array(
+# SOME FISH AND HERD ANIMALS
+'.*fish', 'tuna', 'salmon', 'mackerel', 'trout',
+'bream', 'sea[- ]bass', 'carp', 'cod', 'flounder', 'whiting',
+'.*deer', '.*sheep',
+# ALL NATIONALS ENDING IN -ese
+'Portuguese', 'Amoyese', 'Borghese', 'Congoese', 'Faroese',
+'Foochowese', 'Genevese', 'Genoese', 'Gilbertese', 'Hottentotese',
+'Kiplingese', 'Kongoese', 'Lucchese', 'Maltese', 'Nankingese',
+'Niasese', 'Pekingese', 'Piedmontese', 'Pistoiese', 'Sarawakese',
+'Shavese', 'Vermontese', 'Wenchowese', 'Yengeese',
+'.*[nrlm]ese',
+# DISEASES
+'.*pox',
+# OTHER ODDITIES
+'graffiti', 'djinn');
+
+$pluralIrregulars = array(
+'corpus' => 'corpuses|corpora',
+'opus' => 'opuses|opera',
+'genus' => 'genera',
+'mythos' => 'mythoi',
+'penis' => 'penises|penes',
+'testis' => 'testes',
+'atlas' => 'atlases|atlantes',);
+
+$pluralIrregular =array(
+'child' => 'children',
+'brother' => 'brothers|brethren',
+'loaf' => 'loaves',
+'hoof' => 'hoofs|hooves',
+'beef' => 'beefs|beeves',
+'money' => 'monies',
+'mongoose' => 'mongooses|',
+'ox' => 'oxen',
+'cow' => 'cows|kine',
+'soliloquy' => 'soliloquies|',
+'graffito' => 'graffiti',
+'prima donna' => 'prima donnas|prime donne',
+'octopus' => 'octopuses|octopodes',
+'genie' => 'genies|genii',
+'ganglion' => 'ganglions|ganglia',
+'trilby' => 'trilbys',
+'turf' => 'turfs|turves',
+'numen' => 'numina',
+'occiput' => 'occiputs|occipita',);
+
+?>
View
40 cake/dispatcher.php
@@ -33,12 +33,12 @@
*/
/**
- * Add Description
+ * List of helpers to include
*/
uses('error_messages', 'object', 'router', DS.'controller'.DS.'controller', DS.'controller'.DS.'scaffold');
/**
- * Short description for class.
+ * Dispatcher translates URLs to controller-action-paramter triads.
*
* Dispatches the request, creating appropriate models and controllers.
*
@@ -79,6 +79,7 @@ function dispatch($url, $additionalParams=array())
$missingController = false;
$missingAction = false;
$missingView = false;
+ $privateAction = false;
if(!in_array('render', array_keys($params)))
{
@@ -130,6 +131,11 @@ function dispatch($url, $additionalParams=array())
$params['action'] = 'index';
}
+ if(in_array($params['action'], $classMethods) && strpos($params['action'], '_', 0) === 0)
+ {
+ $privateAction = true;
+ }
+
if(!in_array($params['action'], $classMethods))
{
$missingAction = true;
@@ -160,15 +166,21 @@ function dispatch($url, $additionalParams=array())
$params['action'] = 'missingAction';
}
+ if ($privateAction)
+ {
+ $controller->privateAction = $params['action'];
+ $params['action'] = 'privateAction';
+ }
+
return $this->_invoke($controller, $params );
}
/**
- * Enter description here...
+ * Invokes given controller's render action if autoRender option is set. Otherwise the contents of the operation are returned as a string.
*
- * @param unknown_type $controller
- * @param unknown_type $params
- * @return unknown
+ * @param object $controller
+ * @param array $params
+ * @return string
*/
function _invoke (&$controller, $params )
{
@@ -218,7 +230,7 @@ function parseParams($from_url)
}
/**
- * Recursively strips slashes.
+ * Recursively strips slashes from given array.
*
*/
function stripslashes_deep($val)
@@ -228,7 +240,7 @@ function stripslashes_deep($val)
}
/**
- * Recursively performs urldecode.
+ * Recursively performs urldecode on given array.
*
*/
function urldecode_deep($val)
@@ -275,7 +287,6 @@ function baseUrl()
$webroot =setUri();
$htaccess = preg_replace('/(?:'.APP_DIR.'(.*)|index\\.php(.*))/i', '', $webroot).APP_DIR.'/'.WEBROOT_DIR.'/';
}
- // Document root is probably not set to Cake 'webroot' dir
if(APP_DIR === 'app')
{
if (preg_match('/^(.*)\\/'.APP_DIR.'\\/'.WEBROOT_DIR.'\\/index\\.php$/', $scriptName, $regs))
@@ -302,17 +313,6 @@ function baseUrl()
return $base;
}
}
- //Fallback if all others fail
- if (preg_match('/^(.*)\\/index\\.php$/', $scriptName, $regs))
- {
- !empty($htaccess)? $this->webroot = $htaccess : $this->webroot = $regs[1].'/';
- return $regs[1];
- }
- else
- {
- !empty($htaccess)? $this->webroot = $htaccess : $this->webroot = '/';
- return $base;
- }
}
return $base;
}
View
17 cake/docs/GOTCHAS.txt
@@ -0,0 +1,17 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////////////
+// +---------------------------------------------------------------------------------------------------+ //
+// + $Id:$
+// + Last Modified:$
+// + Modified By:$
+// +---------------------------------------------------------------------------------------------------+ //
+///////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+You can find some help with problems you may have installing CakePHP here:
+
+http://wiki.cakephp.org/docs:0.10_dev_gotchas
+
+Visit our IRC channel for help.
+#cakephp on irc.freenode.net
+
+The google group is also a good place to get support from other users of CakePHP.
+http://groups.google.com/group/cake-php
View
11 cake/docs/README.txt
@@ -8,11 +8,12 @@
This README will be updated
-for now visit:
-
-https://trac.cakephp.org/
+For now visit:
+https://www.cakephp.org/
-OR:
+User related documentation
+http://wiki.cakephp.org/
-https://www.cakephp.org/
+For information on development:
+https://trac.cakephp.org/
View
2  cake/libs/cache.php
@@ -33,7 +33,7 @@
/**
- * Enter description here...
+ * Included libraries.
*
*/
uses(DS.'model'.DS.'model');
View
34 cake/libs/controller/controller.php
@@ -229,12 +229,18 @@ function constructClasses(){
{
foreach($this->beforeFilter as $filter)
{
-
+ if(is_callable(array($this,$filter)))
+ {
+ $this->$filter();
+ }
}
}
else
{
-
+ if(is_callable(array($this,$this->beforeFilter)))
+ {
+ $this->{$this->beforeFilter}();
+ }
}
}
@@ -388,6 +394,7 @@ function missingController()
$this->autoLayout = true;
$this->pageTitle = 'Missing Controller';
$this->render('../errors/missingController');
+ exit();
}
/**
@@ -399,6 +406,19 @@ function missingAction()
$this->autoLayout = true;
$this->pageTitle = 'Missing Method in Controller';
$this->render('../errors/missingAction');
+ exit();
+ }
+
+/**
+ * Renders the Private Action web page.
+ *
+ */
+ function privateAction()
+ {
+ $this->autoLayout = true;
+ $this->pageTitle = 'Trying to access private method in class';
+ $this->render('../errors/privateAction');
+ exit();
}
/**
@@ -409,8 +429,8 @@ function missingDatabase()
{
$this->autoLayout = true;
$this->pageTitle = 'Scaffold Missing Database Connection';
- //We are simulating action call below, this is not a filename!
$this->render('../errors/missingScaffolddb');
+ exit();
}
/**
@@ -422,8 +442,8 @@ function missingTable($tableName)
$this->autoLayout = true;
$this->missingTableName = $tableName;
$this->pageTitle = 'Missing Database Table';
- //We are simulating action call below, this is not a filename!
$this->render('../errors/missingTable');
+ exit();
}
/**
@@ -435,8 +455,8 @@ function missingHelperFile($file)
$this->missingHelperFile = $file;
$this->missingHelperClass = Inflector::camelize($file) . "Helper";
$this->pageTitle = 'Missing Helper File';
- //We are simulating action call below, this is not a filename!
$this->render('../errors/missingHelperFile');
+ exit();
}
@@ -449,8 +469,8 @@ function missingHelperClass($class)
$this->missingHelperClass = Inflector::camelize($class) . "Helper";
$this->missingHelperFile = Inflector::underscore($class);
$this->pageTitle = 'Missing Helper Class';
- //We are simulating action call below, this is not a filename!
$this->render('../errors/missingHelperClass');
+ exit();
}
/**
@@ -461,8 +481,8 @@ function missingConnection()
{
$this->autoLayout = true;
$this->pageTitle = 'Missing Database Connection';
- //We are simulating action call below, this is not a filename!
$this->render('../errors/missingDatabase');
+ exit();
}
// /**
// * Displays an error page to the user. Uses layouts/error.html to render the page.
View
3  cake/libs/error_messages.php
@@ -4,7 +4,8 @@
/**
* Error Messages Defines
*
- * Long description for file
+ * Longer, human-readable error messages for Cake operation errors to be displayed
+ * to end-users.
*
* PHP versions 4 and 5
*
View
38 cake/libs/file.php
@@ -31,7 +31,7 @@
*/
/**
- * Enter description here...
+ * Included libraries.
*
*/
uses('object');
@@ -153,10 +153,10 @@ function getMd5 ($force = false)
}
/**
- * Get the Filesize
+ * Returns the Filesize, either in bytes or in human-readable format.
*
* @param boolean $humanReadeble Data to write to this File.
- * @return string|int filesize as int or as humand readable string
+ * @return string|int filesize as int or as a human-readable string
*/
function getSize ()
{
@@ -165,7 +165,7 @@ function getSize ()
}
/**
- * Get the Fileextension
+ * Returns the File extension.
*
* @return string The Fileextension
*/
@@ -188,7 +188,7 @@ function getExt ()
}
/**
- * Get the Filename
+ * Returns the filename.
*
* @return string The Filename
*/
@@ -198,7 +198,7 @@ function getName ()
}
/**
- * get the File owner
+ * Returns the File's owner.
*
* @return int the Fileowner
*/
@@ -208,7 +208,7 @@ function getOwner ()
}
/**
- * get the File owner
+ * Returns the File group.
*
* @return int the Filegroup
*/
@@ -218,9 +218,9 @@ function getGroup ()
}
/**
- * creates the File
+ * Creates the File.
*
- * @return boolean
+ * @return boolean Success
*/
function create ()
{
@@ -245,7 +245,7 @@ function create ()
}
/**
- * deletes the File
+ * Returns true if the File exists.
*
* @return boolean
*/
@@ -255,7 +255,7 @@ function exists ()
}
/**
- * deletes the File
+ * Deletes the File.
*
* @return boolean
*/
@@ -265,7 +265,7 @@ function delete ()
}
/**
- * check if the File writable
+ * Returns true if the File is writable.
*
* @return boolean
*/
@@ -275,7 +275,7 @@ function writable ()
}
/**
- * check if the File executable
+ * Returns true if the File is executable.
*
* @return boolean
*/
@@ -285,7 +285,7 @@ function executable ()
}
/**
- * check if the File readable
+ * Returns true if the File is readable.
*
* @return boolean
*/
@@ -295,7 +295,7 @@ function readable ()
}
/**
- * get last access time
+ * Returns last access time.
*
* @return int timestamp
*/
@@ -305,7 +305,7 @@ function lastAccess ()
}
/**
- * get last access time
+ * Returns last modified time.
*
* @return int timestamp
*/
@@ -315,7 +315,7 @@ function lastChange ()
}
/**
- * get the current folder
+ * Returns the current folder.
*
* @return Folder
*/
@@ -325,7 +325,7 @@ function getFolder ()
}
/**
- * get the chmod of the File
+ * Returns the "chmod" (permissions) of the File.
*
* @return string
*/
@@ -335,7 +335,7 @@ function getChmod ( )
}
/**
- * get the chmod of the File
+ * Returns the full path of the File.
*
* @return string
*/
View
2  cake/libs/flay.php
@@ -32,7 +32,7 @@
*/
/**
- * Enter description here...
+ * Included libraries.
*/
uses('object');
View
20 cake/libs/folder.php
@@ -31,7 +31,7 @@
*/
/**
- * Enter description here...
+ * Included libraries.
*
*/
uses('object');
@@ -48,14 +48,14 @@
class Folder extends Object {
/**
- * Enter description here...
+ * Path to Folder.
*
* @var string
*/
var $path = null;
/**
- * Enter description here...
+ * Sortedness.
*
* @var boolean
*/
@@ -65,7 +65,7 @@ class Folder extends Object {
* Constructor.
*
* @param string $path
- * @param bollean $path
+ * @param boolean $path
*/
function Folder ($path = false , $create = false, $mode = false)
{
@@ -156,7 +156,7 @@ function ls($sort=true , $noDotFiles = false)
/**
- * Returns an array of all matching files in current directory
+ * Returns an array of all matching files in current directory.
*
* @param string $pattern Preg_match pattern (Defaults to: .*)
* @return array
@@ -186,7 +186,7 @@ function find ($regexp_pattern='.*')
/**
- * Returns an array of all matching files in and below current directory
+ * Returns an array of all matching files in and below current directory.
*
* @param string $pattern Preg_match pattern (Defaults to: .*)
* @return array Files matching $pattern
@@ -303,7 +303,7 @@ function addPathElement ($path, $element)
}
/**
- * check if the File is in a given CakePath
+ * Returns true if the File is in a given CakePath.
*
* @return boolean
*/
@@ -317,7 +317,7 @@ function inCakePath ( $path = '' )
}
/**
- * check if the File is in a given Path
+ * Returns true if the File is in given path.
*
* @return boolean
*/
@@ -338,7 +338,7 @@ function inPath ( $path = '' )
}
/**
- * Create a directory structure recursively
+ * Create a directory structure recursively.
*
* @author Aidan Lister <aidan@php.net>
* @version 1.0.0
@@ -375,7 +375,7 @@ function mkdirr($pathname, $mode = null)
}
/**
- * Get the size of a directory.
+ * Returns the size in bytes of this Folder.
*
* @author Aidan Lister <aidan@php.net>
* @version 1.0.0
View
48 cake/libs/inflector.php
@@ -2,9 +2,9 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * Pluralize and singularize English words.
*
- * Long description for file
+ * Used by Cake's naming conventions throughout the framework.
*
* PHP versions 4 and 5
*
@@ -32,9 +32,10 @@
*/
/**
- * Short description for class
+ * Pluralize and singularize English words.
*
- * Inflector pluralizes and singularizes English nouns.
+ * Inflector pluralizes and singularizes English nouns.
+ * Used by Cake's naming conventions throughout the framework.
* Test with $i = new Inflector(); $i->test();
*
* @package cake
@@ -66,7 +67,7 @@ function pluralize ($word)
'/([m|l])ouse$/' => '\1ice', # mouse, louse
'/(matr|vert|ind)ix|ex$/' => '\1ices', # matrix, vertex, index
'/(x|ch|ss|sh)$/' => '\1es', # search, switch, fix, box, process, address
- '/([^aeiouy]|qu)ies$/' => '\1y',
+ //'/([^aeiouy]|qu)ies$/' => '\1y',
'/([^aeiouy]|qu)y$/' => '\1ies', # query, ability, agency
'/(hive)$/' => '\1s', # archive, hive
'/(?:([^f])fe|([lr])f)$/' => '\1\2ves', # half, safe, wife
@@ -163,8 +164,8 @@ function camelize($lower_case_and_underscored_word)
*/
function underscore($camel_cased_word)
{
- $camel_cased_word = preg_replace('/([A-Z]+)([A-Z])/','\1_\2',$camel_cased_word);
- return strtolower(preg_replace('/([a-z])([A-Z])/','\1_\2',$camel_cased_word));
+ $camel_cased_word = preg_replace('/([A-Z]+)([A-Z])/','\1_\2', $camel_cased_word);
+ return strtolower(preg_replace('/([a-z])([A-Z])/','\1_\2', $camel_cased_word));
}
/**
@@ -180,7 +181,7 @@ function humanize($lower_case_and_underscored_word)
}
/**
- * Returns corresponding table name for given $class_name.
+ * Returns corresponding table name for given $class_name. ("posts" for the model class "Post").
*
* @param string $class_name Name of class to get database table name for
* @return string Name of the database table for given class
@@ -191,7 +192,7 @@ function tableize($class_name)
}
/**
- * Returns Cake class name ("Post" for the database table "posts".) for given database table.
+ * Returns Cake model class name ("Post" for the database table "posts".) for given database table.
*
* @param string $tableName Name of database table to get class name for
* @return string
@@ -203,7 +204,7 @@ function classify($tableName)
/**
* Returns $class_name in underscored form, with "_id" tacked on at the end.
- * This is for use in dealing with the database.
+ * This is for use in dealing with foreign keys in the database.
*
* @param string $class_name
* @return string
@@ -214,10 +215,10 @@ function foreignKey($class_name)
}
/**
- * Enter description here...
+ * Returns filename for given Cake controller name.
*
- * @param unknown_type $name
- * @return unknown
+ * @param string $name
+ * @return string
*/
function toControllerFilename($name)
{
@@ -225,10 +226,10 @@ function toControllerFilename($name)
}
/**
- * Enter description here...
+ * Returns filename for given Cake helper name.
*
- * @param unknown_type $name
- * @return unknown
+ * @param string $name
+ * @return string
*/
function toHelperFilename($name)
{
@@ -236,11 +237,12 @@ function toHelperFilename($name)
}
/**
- * Enter description here...
+ * Returns given name as camelized.
*
- * @param unknown_type $name
- * @param unknown_type $correct
- * @return unknown
+ * @param string $name
+ * @param string $correct
+ * @return string
+ * @todo Explain this method
*/
function toFullName($name, $correct)
{
@@ -267,10 +269,10 @@ function toFullName($name, $correct)
}
/**
- * Enter description here...
+ * Returns filename for given Cake library name.
*
- * @param unknown_type $name
- * @return unknown
+ * @param string $name
+ * @return string
*/
function toLibraryFilename ($name)
{
View
2  cake/libs/legacy.php
@@ -2,7 +2,7 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * Backwards compatibility functions.
*
* With this hack you can use clone() in PHP4 code
* use "clone($object)" not "clone $object"! the former works in both PHP4 and PHP5
View
18 cake/libs/log.php
@@ -2,9 +2,9 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * Logging.
*
- * Long description for file
+ * Log messages to text files.
*
* PHP versions 4 and 5
*
@@ -32,15 +32,13 @@
*/
/**
- * Enter description here...
+ * Included libraries.
*/
uses('file');
/**
* Logs messages to text files
*
- * Long description for class
- *
* @package cake
* @subpackage cake.cake.libs
* @since CakePHP v 0.2.9
@@ -48,11 +46,11 @@
class Log
{
/**
- * Enter description here...
+ * Writes given message to a log file in the logs directory.
*
- * @param unknown_type $type
- * @param unknown_type $msg
- * @return unknown
+ * @param string $type Type of log, becomes part of the log's filename
+ * @param string $msg Message to log
+ * @return boolean Success
*/
function write($type, $msg)
{
@@ -71,7 +69,7 @@ function write($type, $msg)
define ('LOG_ERROR', 2);
/**
- * Shortcut.
+ * Shortcut to Log::write.
*/
function LogError ($message)
{
View
2  cake/libs/model/model.php
@@ -1582,7 +1582,7 @@ function _invalidFields ($data=null)
$data = ($data? $data: (isset($this->data)? $this->data: array()));
$errors = array();
- foreach ($this->data as $table => $field)
+ foreach ($data as $table => $field)
{
foreach ($this->validate as $field_name=>$validator)
{
View
3  cake/libs/neat_array.php
@@ -180,7 +180,8 @@ function filter ($with)
}
/**
- * Passes each of its values through a specified function or method. Think of PHP's {@link http://php.net/array_walk array_walk()}.
+ * Passes each of its values through a specified function or method.
+ * Think of PHP's {@link http://php.net/array_walk array_walk()}.
*
* @param string $with Name of callback function
* @return array Returns value of NeatArray::value
View
36 cake/libs/neat_string.php
@@ -2,9 +2,9 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
- *
- * Long description for file
+ * String handling methods.
+ *
+ * Random passwords, splitting strings into arrays, removing Cyrillic characters, stripping whitespace.
*
* PHP versions 4 and 5
*
@@ -32,9 +32,9 @@
*/
/**
- * Short description for class
+ * String handling methods.
*
- * Long description for class
+ * Random passwords, splitting strings into arrays, removing Cyrillic characters, stripping whitespace.
*
* @package cake
* @subpackage cake.cake.libs
@@ -44,10 +44,10 @@
class NeatString
{
/**
- * Enter description here...
+ * Returns an array with each of the non-empty characters in $string as an element.
*
- * @param unknown_type $string
- * @return unknown
+ * @param string $string
+ * @return array
*/
function toArray ($string)
{
@@ -55,10 +55,10 @@ function toArray ($string)
}
/**
- * Enter description here...
+ * Returns string with Cyrillic characters translated to Roman ones.
*
- * @param unknown_type $string
- * @return unknown
+ * @param string $string
+ * @return string
*/
function toRoman ($string)
{
@@ -69,10 +69,10 @@ function toRoman ($string)
}
/**
- * Enter description here...
+ * Returns string as lowercase with whitespace removed.
*
- * @param unknown_type $string
- * @return unknown
+ * @param string $string
+ * @return string
*/
function toCompressed ($string)
{
@@ -81,11 +81,11 @@ function toCompressed ($string)
}
/**
- * Enter description here...
+ * Returns a random password.
*
- * @param unknown_type $length
- * @param unknown_type $available_chars
- * @return unknown
+ * @param integer $length Length of generated password
+ * @param string $available_chars List of characters to use in password
+ * @return string Generated password
*/
function randomPassword ($length, $available_chars = 'ABDEFHKMNPRTWXYABDEFHKMNPRTWXY23456789')
{
View
130 cake/libs/new_inflector.php
@@ -40,33 +40,102 @@
* @subpackage cake.cake.libs
* @since CakePHP v .0.10.x.x
*/
-class Inflector
+class Inflector
{
var $classical = array();
- function __construct()
- {
- }
-
+ var $pre = '';
+
+ var $word = '';
+
+ var $post = '';
+
+
+ function &getInstance() {
+
+ static $instance = array();
+ if (!$instance)
+ {
+ $instance[0] =& new Inflector;
+ }
+ return $instance[0];
+ }
+
function pluralize($text, $type = 'Noun' , $classical = false)
{
- $this->classical = $classical;
- $this->count = count($text);
+ $inflec =& Inflector::getInstance();
+ $inflec->classical = $classical;
+ $inflec->count = strlen($text);
- return $this->_plural.$type($text);
+ if ($inflec->count == 1)
+ {
+ return $text;
+ }
+ if(empty($text))
+ {
+ return;
+ }
+
+ $inflec->_pre($text);
+
+ if (empty($inflec->word))
+ {
+ return $text;
+ }
+
+ $type = '_plural'.$type;
+ $inflected = $inflec->_postProcess($inflec->word,$inflec->$type());
+ return $inflected;
}
function singularize($text, $type = 'Noun' , $classical = false)
{
- $this->classical = $classical;
- $this->count = count($text);
+ $inflec =& Inflector::getInstance();
+ $inflec->classical = $classical;
+ $inflec->count = count($text);
+
+ if ($inflec->count == 1)
+ {
+ return $text;
+ }
+ if(empty($text))
+ {
+ return;
+ }
- return $this->_singular.$type($text);
+ return $inflec->_singular.$type($text);
}
- function _pluralNoun($text)
+ function _pluralNoun()
{
- return $pluralText;
+ $inflec =& Inflector::getInstance();
+
+ require_once('config/nouns.php');
+
+ $regexPluralUninflected = $inflec->_enclose(join( '|', array_values(array_merge($pluralUninflected,$pluralUninflecteds))));
+
+ $regexPluralUninflectedHerd = $inflec->_enclose(join( '|', array_values($pluralUninflectedHerd)));
+
+ $pluralIrregular = array_merge($pluralIrregular,$pluralIrregulars);
+ $regexPluralIrregular = $inflec->_enclose(join( '|', array_keys($pluralIrregular)));
+
+ if (preg_match('/^('.$regexPluralUninflected.')$/i', $inflec->word, $regs))
+ {
+ return $inflec->word;
+ }
+
+ if (empty($inflec->classical))
+ {
+ preg_match('/^('.$regexPluralUninflectedHerd.')$/i', $inflec->word, $regs);
+ return $inflec->word;
+ }
+
+ if (preg_match('/(.*)\\b('.$regexPluralIrregular.')$/i', $inflec->word, $regs))
+ {
+ return $regs[1] . $pluralIrregular[strtolower($regs[2])];
+ }
+
+ return $inflec->word.'s';
}
function _pluralVerb($text)
@@ -136,7 +205,40 @@ function _singularSpecialAdjective($text)
function _enclose($string)
{
- return '"(?:'.$string.')"';
+ return '(?:'.$string.')';
+ }
+
+ function _pre($text)
+ {
+ $inflec =& Inflector::getInstance();
+ if (preg_match('/\\A(\\s*)(.+?)(\\s*)\\Z/', $text, $regs))
+ {
+ if (!empty($regs[1]))
+ {
+ $inflec->pre = $regs[1];
+ }
+
+ if (!empty($regs[2]))
+ {
+ $inflec->word = $regs[2];
+ }
+
+ if (!empty($regs[3]))
+ {
+ $inflec->post = $regs[3];;
+ }
+ }
+ }
+
+ function _postProcess($orig, $inflected)
+ {
+ $inflec =& Inflector::getInstance();
+ $inflected = preg_replace('/([^|]+)\\|(.+)/', $inflec->classical ? '${2}' : '${1}', $inflected);
+
+ return $inflected;
}
+
}
+
+echo Inflector::pluralize('rhinoceros');
?>
View
26 cake/libs/object.php
@@ -2,9 +2,10 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * Object class, allowing __construct and __destruct in PHP4.
*
- * Long description for file
+ * Also includes methods for logging and the special method RequestAction,
+ * to call other Controllers' Actions from anywhere.
*
* PHP versions 4 and 5
*
@@ -32,14 +33,15 @@
*/
/**
- * Enter description here...
+ * Included libraries.
*/
uses('log');
/**
* Object class, allowing __construct and __destruct in PHP4.
*
- * Long description for class
+ * Also includes methods for logging and the special method RequestAction,
+ * to call other Controllers' Actions from anywhere.
*
* @package cake
* @subpackage cake.cake.libs
@@ -86,9 +88,9 @@ function __destruct()
/**
* Object-to-string conversion.
- * Each class can override it as necessary.
+ * Each class can override this method as necessary.
*
- * @return string This name of this class
+ * @return string The name of this class
*/
function toString()
{
@@ -96,13 +98,11 @@ function toString()
}
/**
- *
- * Allow calling a controllers method from any location
- *
+ * Calls a controller's method from any location.
*
- * @param unknown_type $url
- * @param unknown_type $extra
- * @return unknown
+ * @param string $url URL in the form of Cake URL ("/controller/method/parameter")
+ * @param array $extra If array includes the key "render" it sets the AutoRender to true.
+ * @return boolean Success
*/
function requestAction ($url, $extra = array())
{
@@ -114,7 +114,7 @@ function requestAction ($url, $extra = array())
{
$extra['render'] = 1;
}
- $extra = array_merge($extra, array('bare'=>1));
+ //$extra = array_merge($extra, array('bare'=>1));
$dispatcher =& new Dispatcher();
return $dispatcher->dispatch($url, $extra);
}
View
13 cake/libs/router.php
@@ -2,7 +2,7 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * Parses the request URL into controller, action, and parameters.
*
* Long description for file
*
@@ -32,7 +32,7 @@
*/
/**
- * Enter description here...
+ * Included libraries.
*/
uses('object', 'neat_array');
@@ -56,10 +56,10 @@ class Router extends Object {
/**
* TODO: Better description. Returns this object's routes array. Returns false if there are no routes available.
*
- * @param string $route An empty string, or a route string "/"
- * @param array $default NULL or an array describing the default route
+ * @param string $route An empty string, or a route string "/"
+ * @param array $default NULL or an array describing the default route
* @see routes
- * @return array Array of routes
+ * @return array Array of routes
*/
function connect ($route, $default=null)
{
@@ -107,7 +107,8 @@ function connect ($route, $default=null)
}
/**
- * TODO: Better description. Returns an array of routes.
+ * Parses given URL and returns an array of controllers, action and parameters
+ * taken from that URL.
*
* @param string $url URL to be parsed
* @return array
View
18 cake/libs/sanitize.php
@@ -2,9 +2,9 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * Washes strings from unwanted noise.
*
- * Long description for file
+ * Helpful methods to make unsafe strings usable.
*
* PHP versions 4 and 5
*
@@ -34,7 +34,8 @@
/**
* Data Sanitization.
*
- * Long description for class
+ * Removal of alpahnumeric characters, SQL-safe slash-added strings, HTML-friendly strings,
+ * and all of the above on arrays.
*
* @package cake
* @subpackage cake.cake.libs
@@ -52,7 +53,7 @@ class Sanitize
*/
function paranoid($string)
{
- return preg_replace("/[^a-zA-Z0-9]/", "", $string);
+ return preg_replace( "/[^a-zA-Z0-9]/", "", $string );
}
/**
@@ -72,10 +73,10 @@ function sql($string)
}
/**
- * Makes the string safe for display as HTML. Renders entities and converts newlines to <br/>.
+ * Returns given string safe for display as HTML. Renders entities and converts newlines to <br/>.
*
* @param string $string
- * @param boolean $remove
+ * @param boolean $remove If true, the string is stripped of all HTML tags
* @return string
*/
function html($string, $remove = false)
@@ -95,7 +96,7 @@ function html($string, $remove = false)
}
/**
- * Recursively sanitizes an array of data for safe input.
+ * Recursively sanitizes given array of data for safe input.
*
* @param mixed $toClean
* @return mixed
@@ -110,6 +111,7 @@ function cleanArray(&$toClean)
*
* @param array $toClean
* @return array
+ * @see cleanArray
*/
function cleanArrayR(&$toClean)
{
@@ -157,7 +159,7 @@ function cleanKey($key)
*/
/**
- * Method used by cleanArray() to sanitized array nodes.
+ * Method used by cleanArray() to sanitize array nodes.
*
* @param string $val
* @return string
View
266 cake/libs/time.php
@@ -1,266 +0,0 @@
-<?php
-/* SVN FILE: $Id$ */
-
-/**
- * Time library for Cake.
- *
- * Methods for handling and formatting date and time information.
- *
- * PHP versions 4 and 5
- *
- * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
- * Copyright (c) 2005, CakePHP Authors/Developers
- *
- * Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
- * Larry E. Masters aka PhpNut <nut@phpnut.com>
- * Kamil Dzielinski aka Brego <brego.dk@gmail.com>
- *
- * Licensed under The MIT License
- * Redistributions of files must retain the above copyright notice.
- *
- * @filesource
- * @author CakePHP Authors/Developers
- * @copyright Copyright (c) 2005, CakePHP Authors/Developers
- * @link https://trac.cakephp.org/wiki/Authors Authors/Developers
- * @package cake
- * @subpackage cake.cake.libs
- * @since CakePHP v 0.2.9
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
- */
-
-/**
- * Enter description here...
- */
-uses ('object');
-
-/**
- * Time-related functions, formatting for dates etc.
- *
- * The Time class handles and formats date and time information.
- *
- * @package cake
- * @subpackage cake.cake.libs
- * @since CakePHP v 0.2.9
- */
-class Time extends Object
-{
-
-/**
- * Returns a formatted date string for given Datetime string.
- *
- * @param string $date_string Datetime string
- * @return string Formatted date string
- */
- function nice ($date_string=null)
- {
- $date = $date_string? strtotime($date_string): time();
- return date("D, M jS Y, H:i", $date);
- }
-
-/**
- * Returns a formatted descriptive date string for given datetime string.
- * If the given date is today, the returned string could be "Today, 16:54".
- * If the given date was yesterday, the returned string could be "Yesterday, 16:54".
- * If $date_string's year is the current year, the returned string does not
- * include mention of the year.
- *
- * @param string $date_string Datetime string
- * @return string Described, relative date string
- */
- function niceShort ($date_string=null)
- {
- $date = $date_string? Time::fromString($date_string): time();
-
- $y = Time::isThisYear($date)? '': ' Y';
-
- if (Time::isToday($date))
- {
- return "Today, ".date("H:i", $date);
- }
- elseif (Time::wasYesterday($date))
- {
- return "Yesterday, ".date("H:i", $date);
- }
- else
- {
- return date("M jS{$y}, H:i", $date);
- }
- }
-
-/**
- * Returns true if given datetime string is today.
- *
- * @param string $date Datetime string
- * @return boolean True if datetime string is today
- */
- function isToday ($date)
- {
- return date('Y-m-d', $date) == date('Y-m-d', time());
- }
-
-/**
- * Returns SQL for selecting a date range between the datetime pair $begin and $end.
- *
- * @param string $begin Start of date range as a Datetime string
- * @param string $end End of date range as a Datetime string
- * @param string $field_name Name of database date field
- * @return string SQL code for selecting the date range
- */
- function daysAsSql ($begin, $end, $field_name)
- {
- $begin = date('Y-m-d', $begin).' 00:00:00';
- $end = date('Y-m-d', $end). ' 23:59:59';
-
- return "($field_name >= '$begin') AND ($field_name <= '$end')";
- }
-
-/**
- * Returns SQL for selecting a date range that includes the whole day of given datetime string.
- *
- * @param string $date Datetime string
- * @param string $field_name Name of database date field
- * @return SQL for selecting the date range of that full day
- * @see Time::daysAsSql()
- */
- function dayAsSql ($date, $field_name)
- {
- return Time::daysAsSql($date, $date, $field_name);
- }
-
-/**
- * Returns true if given datetime string is within current year.
- *
- * @param string $date Datetime string
- * @return boolean True if datetime string is within current year
- */
- function isThisYear ($date)
- {
- return date('Y', $date) == date('Y', time());
- }
-
-/**
- * Returns true if given datetime string was yesterday.
- *
- * @param string $date Datetime string
- * @return boolean True if datetime string was yesterday
- */
- function wasYesterday ($date)
- {
- return date('Y-m-d', $date) == date('Y-m-d', strtotime('yesterday'));
- }
-
-/**
- * Returns a Unix timestamp from a textual datetime description. Wrapper for PHP function strtotime().
- *
- * @param string $date_string Datetime string to be represented as a Unix timestamp
- * @return int Unix timestamp
- */
- function fromString ($date_string)
- {
- return strtotime($date_string);
- }
-
-/**
- * Returns a date formatted for Atom RSS feeds.
- *
- * @param string $date Datetime string
- * @return string Formatted date string
- */
- function toAtom ($date)
- {
- return date('Y-m-d\TH:i:s\Z', $date);
- }
-
-/**
- * Formats date for RSS feeds
- *
- * @param datetime $date Datetime string
- * @return string Formatted date string
- * @todo Is this for RSS 0.9.2 or RSS 2.0?
- */
- function toRSS ($date)
- {
- return date('D, d M Y H:i:s O', $date);
- }
-
-/**
- * Returns either a relative date or a formatted date depending
- * on the difference between the current time and given datetime.
- * $datetime should be in a <i>strtotime</i>-parsable format like MySQL datetime.
- *
- * Relative dates look something like this:
- * 3 weeks, 4 days ago
- * 15 seconds ago
- * Formatted dates look like this:
- * on 02/18/2004
- *
- * The returned string includes 'ago' or 'on' and assumes you'll properly add a word
- * like 'Posted ' before the function output.
- *
- * @param $datetime Time in strtotime-parsable format
- * @return string Relative time string.
- */
-
- function timeAgoInWords ($datetime)
- {
- $in_seconds=strtotime($datetime);
- $diff = time()-$in_seconds;
- $months = floor($diff/2419200);
- $diff -= $months*2419200;
- $weeks = floor($diff/604800);
- $diff -= $weeks*604800;
- $days = floor($diff/86400);
- $diff -= $days*86400;
- $hours = floor($diff/3600);
- $diff -= $hours*3600;
- $minutes = floor($diff/60);
- $diff -= $minutes*60;
- $seconds = $diff;
-
- if ($months>0)
- {
- // over a month old, just show date (mm/dd/yyyy format)
- return 'on '.date("j/n/Y", $in_seconds);
- }
- else
- {
- $relative_date='';
- if ($weeks>0)
- {
- // weeks and days
- $relative_date .= ($relative_date?', ':'').$weeks.' week'.($weeks>1?'s':'');
- $relative_date .= $days>0?($relative_date?', ':'').$days.' day'.($days>1?'s':''):'';
- }
- elseif ($days>0)
- {
- // days and hours
- $relative_date .= ($relative_date?', ':'').$days.' day'.($days>1?'s':'');
- $relative_date .= $hours>0?($relative_date?', ':'').$hours.' hour'.($hours>1?'s':''):'';
- }
- elseif ($hours>0)
- {
- // hours and minutes
- $relative_date .= ($relative_date?', ':'').$hours.' hour'.($hours>1?'s':'');
- $relative_date .= $minutes>0?($relative_date?', ':'').$minutes.' minute'.($minutes>1?'s':''):'';
- }
- elseif ($minutes>0)
- {
- // minutes only
- $relative_date .= ($relative_date?', ':'').$minutes.' minute'.($minutes>1?'s':'');
- }
- else
- {
- // seconds only
- $relative_date .= ($relative_date?', ':'').$seconds.' second'.($seconds>1?'s':'');
- }
- }
- // show relative date and add proper verbiage
- return $relative_date.' ago';
- }
-
-}
-
-?>
View
2  cake/libs/validators.php
@@ -4,7 +4,7 @@
/**
* Tort Validators
*
- * Used to validate data in Models.
+ * Used to validate data in Models.
*
* PHP versions 4 and 5
*
View
18 cake/libs/view/helper.php
@@ -2,9 +2,9 @@
/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * Backend for helpers.
*
- * Long description for file
+ * Internal methods for the Helpers.
*
* PHP versions 4 and 5
*
@@ -83,13 +83,13 @@ function Helper()
}
/**
- * Decides wheter to output or return a string.
+ * Decides whether to output or return a string.
*
- * Based on AUTO_OUTPUT and $return's value, this method decides wheter to
+ * Based on AUTO_OUTPUT and $return's value, this method decides whether to
* output a string, or return it.
*
- * @param string $str String to be outputed or returned.
- * @param boolean $return Wheter this method should return a value or
+ * @param string $str String to be output or returned.
+ * @param boolean $return Whether this method should return a value or
* output it. This overrides AUTO_OUTPUT.
* @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
@@ -130,10 +130,10 @@ function assign($keyName, $values)
}
/**
- * Enter description here...
+ * Returns an array of settings in given INI file.
*
- * @param unknown_type $fileName
- * @return unknown
+ * @param string $fileName
+ * @return array
*/
function readConfigFile ($fileName)
{
View
50 cake/libs/view/helpers/ajax.php
@@ -47,16 +47,46 @@
class AjaxHelper extends Helper
{
+ /**
+ * Included helpers.
+ *
+ * @var array
+ */
var $helpers = array('html', 'javascript');
+ /**
+ * Enter description here...
+ *
+ * @var array
+ */
var $callbacks = array('uninitialized', 'loading', 'loaded', 'interactive', 'complete');
+ /**
+ * Enter description here...
+ *
+ * @var array
+ */
var $ajaxOptions = array('method','position','form','parameters','evalScripts', 'asynchronous', 'onComplete', 'onUninitialized', 'onLoading', 'onLoaded', 'onInteractive');
+ /**
+ * Enter description here...
+ *
+ * @var array
+ */
var $dragOptions = array('handle', 'revert', 'constraint', 'change');
+ /**
+ * Enter description here...
+ *
+ * @var array
+ */
var $dropOptions = array('accept', 'containment', 'overlap', 'greedy', 'hoverclass', 'onHover', 'onDrop');
+ /**
+ * Enter description here...
+ *
+ * @var array
+ */
var $sortOptions = array('tag', 'only', 'overlap', 'constraint', 'containment', 'handle', 'hoverClass', 'ghosting', 'dropOnEmpty', 'onUpdate', 'onChange');
@@ -338,6 +368,12 @@ function drag($id, $options = array())
return $this->javascript->codeBlock("new Draggable('$id'$options);");
}
+ /**
+ * Enter description here...
+ *
+ * @param array $options
+ * @return array
+ */
function _optionsForDraggable ($options)
{
$options = $this->_optionsToString($options, array('handle','constraint'));
@@ -453,6 +489,14 @@ function _buildOptions ($options, $acceptable) {
}
}
+ /**
+ * Enter description here... Return JavaScript text for ...
+ *
+ * @param string $klass Name of JavaScript class
+ * @param string $name
+ * @param array $options
+ * @return string Formatted JavaScript
+ */
function _buildObserver ($klass, $name, $options=null)
{
if(!isset($options['with']) && isset($options['update']))
@@ -467,6 +511,12 @@ function _buildObserver ($klass, $name, $options=null)
return $javascript;
}
+ /**
+ * Enter description here... Return JavaScript text for ...
+ *
+ * @param array $options
+ * @return array
+ */
function _buildCallbacks($options)
{
$callbacks = array();
View
2  cake/libs/view/helpers/form.php
@@ -361,7 +361,7 @@ function generateSubmitDiv($displayText, $htmlOptions = null)
}
/**
- * Generates an form to go onto a HtmlHelper object.
+ * Generates a form to go onto a HtmlHelper object.
*
* @param array $fields An array of form field definitions
* @param boolean $readOnly True if the form should be rendered as READONLY
View
77 cake/libs/view/helpers/html.php
@@ -49,20 +49,20 @@ class HtmlHelper extends Helper
*/
/**
- * Enter description here...
+ * Base URL
*
- * @var unknown_type
+ * @var string
*/
var $base = null;
/**
- * Enter description here...
+ * URL to current action.
*
- * @var unknown_type
+ * @var string
*/
var $here = null;
/**
- * Enter description here...
+ * Parameter array.
*
* @var array
*/
@@ -1236,6 +1236,15 @@ function contentTag($name, $content, $options=null)
return "<$name ". $this->parseHtmlOptions($options). ">$content</$name>";
}
+ /**
+ * Returns a SELECT element for days.
+ *
+ * @param string $tagName Prefix name for the SELECT element
+ * @param string $value
+ * @param string $selected Option which is selected.
+ * @param array $optionAttr Attribute array for the option elements.
+ * @return string
+ */
function dayOptionTag( $tagName, $value=null, $selected=null, $optionAttr=null)
{
$value = isset($value)? $value : $this->tagValue($tagName."_day");
@@ -1254,6 +1263,17 @@ function dayOptionTag( $tagName, $value=null, $selected=null, $optionAttr=null)
return $option;
}
+ /**
+ * Returns a SELECT element for years
+ *
+ * @param string $tagName Prefix name for the SELECT element
+ * @param string $value
+ * @param integer $minYear First year in sequence
+ * @param integer $maxYear Last year in sequence
+ * @param string $selected Option which is selected.
+ * @param array $optionAttr Attribute array for the option elements.
+ * @return string
+ */
function yearOptionTag( $tagName, $value=null, $minYear=null, $maxYear=null, $selected=null, $optionAttr=null)
{
$value = isset($value)? $value : $this->tagValue($tagName."_year");
@@ -1283,6 +1303,15 @@ function yearOptionTag( $tagName, $value=null, $minYear=null, $maxYear=null, $se
return $option;
}
+ /**
+ * Returns a SELECT element for months.
+ *
+ * @param string $tagName Prefix name for the SELECT element
+ * @param string $value
+ * @param string $selected Option which is selected.
+ * @param array $optionAttr Attribute array for the option elements.
+ * @return string
+ */
function monthOptionTag( $tagName,