Skip to content

Commit

Permalink
[1125]
Browse files Browse the repository at this point in the history
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
phpnut committed Oct 18, 2005
1 parent ebdb8df commit 6baaa11
Show file tree
Hide file tree
Showing 35 changed files with 641 additions and 495 deletions.
5 changes: 5 additions & 0 deletions app/config/paths.php
Expand Up @@ -99,6 +99,11 @@
*/ */
define ('CONFIGS', APP.'config'.DS); define ('CONFIGS', APP.'config'.DS);


/**
* Path to the libs directory.
*/
define ('INFLECTIONS', CAKE.'config'.DS.'inflections'.DS);

/** /**
* Path to the libs directory. * Path to the libs directory.
*/ */
Expand Down
4 changes: 2 additions & 2 deletions cake/app_model.php
Expand Up @@ -2,7 +2,7 @@
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */


/** /**
* Short description for file. * Application model for Cake.
* *
* This file is application-wide model file. You can put all * This file is application-wide model file. You can put all
* application-wide model-related methods here. * application-wide model-related methods here.
Expand Down Expand Up @@ -33,7 +33,7 @@
*/ */


/** /**
* Short description for class. * Application model for Cake.
* *
* Add your application-wide methods in the class below, your models * Add your application-wide methods in the class below, your models
* will inherit them. * will inherit them.
Expand Down
38 changes: 21 additions & 17 deletions cake/basics.php
Expand Up @@ -297,10 +297,10 @@ function array_combine($a1, $a2)
} }


/** /**
* Enter description here... * Convenience method for htmlspecialchars.
* *
* @param unknown_type $text * @param string $text
* @return unknown * @return string
*/ */
function h($text) function h($text)
{ {
Expand All @@ -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() function a()
{ {
Expand All @@ -321,9 +321,10 @@ function a()




/** /**
* Enter description here... * Hierarchical arrays.
* *
* @return unknown * @return array
* @todo Explain this method better.
*/ */
function ha() function ha()
{ {
Expand All @@ -339,19 +340,21 @@ function ha()




/** /**
* Enter description here... * Convenience method for echo().
* *
* @param unknown_type $text * @param string $text String to echo
*/ */
function e($text) function e($text)
{ {
echo $text; echo $text;
} }


/** /**
* Enter description here... * Print_r convenience function, which prints out <PRE> tags around
* * the output of given array. Similar to debug().
* @param unknown_type $var *
* @see debug
* @param array $var
*/ */
function pr($var) function pr($var)
{ {
Expand All @@ -364,10 +367,10 @@ function pr($var)
} }


/** /**
* Enter description here... * Display parameter
* *
* @param unknown_type $p * @param mixed $p Parameter as string or array
* @return unknown * @return string
*/ */
function params($p) function params($p)
{ {
Expand All @@ -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() { function setUri() {
if (isset($_SERVER['REQUEST_URI'])) if (isset($_SERVER['REQUEST_URI']))
Expand Down
101 changes: 101 additions & 0 deletions 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',);

?>
40 changes: 20 additions & 20 deletions cake/dispatcher.php
Expand Up @@ -33,12 +33,12 @@
*/ */


/** /**
* Add Description * List of helpers to include
*/ */
uses('error_messages', 'object', 'router', DS.'controller'.DS.'controller', DS.'controller'.DS.'scaffold'); 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. * Dispatches the request, creating appropriate models and controllers.
* *
Expand Down Expand Up @@ -79,6 +79,7 @@ function dispatch($url, $additionalParams=array())
$missingController = false; $missingController = false;
$missingAction = false; $missingAction = false;
$missingView = false; $missingView = false;
$privateAction = false;


if(!in_array('render', array_keys($params))) if(!in_array('render', array_keys($params)))
{ {
Expand Down Expand Up @@ -130,6 +131,11 @@ function dispatch($url, $additionalParams=array())
$params['action'] = 'index'; $params['action'] = 'index';
} }


if(in_array($params['action'], $classMethods) && strpos($params['action'], '_', 0) === 0)
{
$privateAction = true;
}

if(!in_array($params['action'], $classMethods)) if(!in_array($params['action'], $classMethods))
{ {
$missingAction = true; $missingAction = true;
Expand Down Expand Up @@ -160,15 +166,21 @@ function dispatch($url, $additionalParams=array())
$params['action'] = 'missingAction'; $params['action'] = 'missingAction';
} }


if ($privateAction)
{
$controller->privateAction = $params['action'];
$params['action'] = 'privateAction';
}

return $this->_invoke($controller, $params ); 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 object $controller
* @param unknown_type $params * @param array $params
* @return unknown * @return string
*/ */
function _invoke (&$controller, $params ) function _invoke (&$controller, $params )
{ {
Expand Down Expand Up @@ -218,7 +230,7 @@ function parseParams($from_url)
} }


/** /**
* Recursively strips slashes. * Recursively strips slashes from given array.
* *
*/ */
function stripslashes_deep($val) function stripslashes_deep($val)
Expand All @@ -228,7 +240,7 @@ function stripslashes_deep($val)
} }


/** /**
* Recursively performs urldecode. * Recursively performs urldecode on given array.
* *
*/ */
function urldecode_deep($val) function urldecode_deep($val)
Expand Down Expand Up @@ -275,7 +287,6 @@ function baseUrl()
$webroot =setUri(); $webroot =setUri();
$htaccess = preg_replace('/(?:'.APP_DIR.'(.*)|index\\.php(.*))/i', '', $webroot).APP_DIR.'/'.WEBROOT_DIR.'/'; $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(APP_DIR === 'app')
{ {
if (preg_match('/^(.*)\\/'.APP_DIR.'\\/'.WEBROOT_DIR.'\\/index\\.php$/', $scriptName, $regs)) if (preg_match('/^(.*)\\/'.APP_DIR.'\\/'.WEBROOT_DIR.'\\/index\\.php$/', $scriptName, $regs))
Expand All @@ -302,17 +313,6 @@ function baseUrl()
return $base; 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; return $base;
} }
Expand Down
17 changes: 17 additions & 0 deletions 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
11 changes: 6 additions & 5 deletions cake/docs/README.txt
Expand Up @@ -8,11 +8,12 @@


This README will be updated This README will be updated


for now visit: For now visit:

https://www.cakephp.org/
https://trac.cakephp.org/


OR: User related documentation
http://wiki.cakephp.org/


https://www.cakephp.org/ For information on development:
https://trac.cakephp.org/


2 changes: 1 addition & 1 deletion cake/libs/cache.php
Expand Up @@ -33,7 +33,7 @@




/** /**
* Enter description here... * Included libraries.
* *
*/ */
uses(DS.'model'.DS.'model'); uses(DS.'model'.DS.'model');
Expand Down

0 comments on commit 6baaa11

Please sign in to comment.