Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updating headers on inflector and adding map param to slug(). added m…

…ore comments to app/config/bootstrap.php
  • Loading branch information...
commit 67d45cb28bfa69bda845428bd401cbb28cb1d9b8 1 parent 66959d5
gwoo authored
View
46 app/config/bootstrap.php
@@ -1,48 +1,46 @@
<?php
-/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php
*
- * Long description for file
+ * This is an application wide file to load any function that is not used within a class
+ * define. You can also use this to include or require any files in your application.
*
* PHP versions 4 and 5
*
- * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2008, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
- * @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
- * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org CakePHP(tm) Project
* @package cake
* @subpackage cake.app.config
* @since CakePHP(tm) v 0.10.8.2117
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
+ * The settings below can be used to set additional paths to models, views and controllers.
+ * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
*
- * This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php is loaded
- * This is an application wide file to load any function that is not used within a class define.
- * You can also use this to include or require any files in your application.
+ * $modelPaths = array('/full/path/to/models/', '/next/full/path/to/models/');
+ * $viewPaths = array('/full/path/to/views/', '/next/full/path/to/views/');
+ * $controllerPaths = array(/full/path/to/controllers/', '/next/full/path/to/controllers/');
+ * $pluginPaths = array('/full/path/to/plugins/', '/next/full/path/to/plugins/');
+ * $behaviorPaths = array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/');
+ * $componentPaths = array('/full/path/to/components/', '/next/full/path/to/components/');
+ * $helperPaths = array('/full/path/to/helpers/', '/next/full/path/to/helpers/');
+ * $vendorPaths = array('/full/path/to/vendors/', '/next/full/path/to/vendors/');
+ * $shellPaths = array('/full/path/to/shells/', '/next/full/path/to/shells/');
+ * $localePaths = array('/full/path/to/locale/', '/next/full/path/to/locale/';
*
*/
/**
- * The settings below can be used to set additional paths to models, views and controllers.
- * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
+ * As of 1.3, additional rules for the inflector are added below
*
- * $modelPaths = array('full path to models', 'second full path to models', 'etc...');
- * $viewPaths = array('this path to views', 'second full path to views', 'etc...');
- * $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
+ * Inflector::rule('singular', array('rules' => array(), irregular' => array(), 'uninflected' => array()));
+ * Inflector::rule('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
*
*/
-//EOF
-
-// Inflector::rule('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
-// Inflector::rule('singular', array('rules' => array(), irregular' => array(), 'uninflected' => array()));
-
?>
View
27 cake/libs/inflector.php
@@ -1,5 +1,4 @@
<?php
-/* SVN FILE: $Id$ */
/**
* Pluralize and singularize English words.
*
@@ -7,29 +6,25 @@
*
* PHP versions 4 and 5
*
- * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
- * @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
- * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://cakephp.org
* @package cake
* @subpackage cake.cake.libs
* @since CakePHP(tm) v 0.2.9
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
- * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Included libraries.
*
*/
if (!class_exists('Object')) {
- uses('object');
+ require_once(LIBS . 'object.php');
}
/**
* Pluralize and singularize English words.
@@ -422,17 +417,18 @@ function variable($string) {
* Returns a string with all spaces converted to underscores (by default), accented
* characters converted to non-accented characters, and non word characters removed.
*
- * @param string $string
- * @param string $replacement
+ * @param string $string the string you want to slug
+ * @param string $replacement will replace keys in map
+ * @param array $map extra elements to map to the replacement
* @return string
* @access public
* @static
* @link http://book.cakephp.org/view/572/Class-methods
*/
- function slug($string, $replacement = '_') {
+ function slug($string, $replacement = '_', $map = array()) {
$quotedReplacement = preg_quote($replacement, '/');
- $map = array(
+ $default = array(
'/à|á|å|â/' => 'a',
'/è|é|ê|ẽ|ë/' => 'e',
'/ì|í|î/' => 'i',
@@ -451,6 +447,7 @@ function slug($string, $replacement = '_') {
'/\\s+/' => $replacement,
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
);
+ $map = array_merge($default, $map);
return preg_replace(array_keys($map), array_values($map), $string);
}
}
View
29 cake/tests/cases/libs/inflector.test.php
@@ -1,28 +1,27 @@
<?php
-/* SVN FILE: $Id$ */
/**
- * Short description for file.
+ * InflectorTest
*
- * Long description for file
+ * InflectorTest is used to test cases on the Inflector class
*
* PHP versions 4 and 5
*
- * CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
- * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
- * Licensed under The Open Group Test Suite License
- * Redistributions of files must retain the above copyright notice.
+ * Licensed under The Open Group Test Suite License
+ * Redistributions of files must retain the above copyright notice.
*
- * @filesource
- * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
- * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
+ * @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link http://book.cakephp.org/view/160/Testing
* @package cake.tests
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
- * @version $Revision$
- * @modifiedby $LastChangedBy$
- * @lastmodified $Date$
- * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
+ * @license Open Group Test Suite License (http://www.opensource.org/licenses/opengroup.php)
+ */
+/**
+ * Included libraries.
+ *
*/
App::import('Core', 'Inflector');
/**
@@ -305,4 +304,4 @@ function tearDown() {
unset($this->Inflector);
}
}
-?>
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.