mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
updating headers on inflector and adding map param to slug(). added more comments to app/config/bootstrap.php
This commit is contained in:
parent
66959d5849
commit
67d45cb28b
3 changed files with 50 additions and 56 deletions
|
@ -1,48 +1,46 @@
|
||||||
<?php
|
<?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
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.app.config
|
* @subpackage cake.app.config
|
||||||
* @since CakePHP(tm) v 0.10.8.2117
|
* @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
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* The settings below can be used to set additional paths to models, views and controllers.
|
* 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 is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
|
||||||
*
|
*
|
||||||
* $modelPaths = array('full path to models', 'second full path to models', 'etc...');
|
* $modelPaths = array('/full/path/to/models/', '/next/full/path/to/models/');
|
||||||
* $viewPaths = array('this path to views', 'second full path to views', 'etc...');
|
* $viewPaths = array('/full/path/to/views/', '/next/full/path/to/views/');
|
||||||
* $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
|
* $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/';
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* As of 1.3, additional rules for the inflector are added below
|
||||||
|
*
|
||||||
|
* 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()));
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* Pluralize and singularize English words.
|
* Pluralize and singularize English words.
|
||||||
*
|
*
|
||||||
|
@ -7,29 +6,25 @@
|
||||||
*
|
*
|
||||||
* PHP versions 4 and 5
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The MIT License
|
* Licensed under The MIT License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @link http://cakephp.org
|
||||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
|
||||||
* @package cake
|
* @package cake
|
||||||
* @subpackage cake.cake.libs
|
* @subpackage cake.cake.libs
|
||||||
* @since CakePHP(tm) v 0.2.9
|
* @since CakePHP(tm) v 0.2.9
|
||||||
* @version $Revision$
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
* @modifiedby $LastChangedBy$
|
|
||||||
* @lastmodified $Date$
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Included libraries.
|
* Included libraries.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!class_exists('Object')) {
|
if (!class_exists('Object')) {
|
||||||
uses('object');
|
require_once(LIBS . 'object.php');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Pluralize and singularize English words.
|
* Pluralize and singularize English words.
|
||||||
|
@ -422,17 +417,18 @@ class Inflector extends Object {
|
||||||
* Returns a string with all spaces converted to underscores (by default), accented
|
* Returns a string with all spaces converted to underscores (by default), accented
|
||||||
* characters converted to non-accented characters, and non word characters removed.
|
* characters converted to non-accented characters, and non word characters removed.
|
||||||
*
|
*
|
||||||
* @param string $string
|
* @param string $string the string you want to slug
|
||||||
* @param string $replacement
|
* @param string $replacement will replace keys in map
|
||||||
|
* @param array $map extra elements to map to the replacement
|
||||||
* @return string
|
* @return string
|
||||||
* @access public
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
* @link http://book.cakephp.org/view/572/Class-methods
|
* @link http://book.cakephp.org/view/572/Class-methods
|
||||||
*/
|
*/
|
||||||
function slug($string, $replacement = '_') {
|
function slug($string, $replacement = '_', $map = array()) {
|
||||||
$quotedReplacement = preg_quote($replacement, '/');
|
$quotedReplacement = preg_quote($replacement, '/');
|
||||||
|
|
||||||
$map = array(
|
$default = array(
|
||||||
'/à|á|å|â/' => 'a',
|
'/à|á|å|â/' => 'a',
|
||||||
'/è|é|ê|ẽ|ë/' => 'e',
|
'/è|é|ê|ẽ|ë/' => 'e',
|
||||||
'/ì|í|î/' => 'i',
|
'/ì|í|î/' => 'i',
|
||||||
|
@ -451,6 +447,7 @@ class Inflector extends Object {
|
||||||
'/\\s+/' => $replacement,
|
'/\\s+/' => $replacement,
|
||||||
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
|
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
|
||||||
);
|
);
|
||||||
|
$map = array_merge($default, $map);
|
||||||
return preg_replace(array_keys($map), array_values($map), $string);
|
return preg_replace(array_keys($map), array_values($map), $string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
<?php
|
<?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
|
* PHP versions 4 and 5
|
||||||
*
|
*
|
||||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
* Licensed under The Open Group Test Suite License
|
* Licensed under The Open Group Test Suite License
|
||||||
* Redistributions of files must retain the above copyright notice.
|
* Redistributions of files must retain the above copyright notice.
|
||||||
*
|
*
|
||||||
* @filesource
|
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
* @link http://book.cakephp.org/view/160/Testing
|
||||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
|
||||||
* @package cake.tests
|
* @package cake.tests
|
||||||
* @subpackage cake.tests.cases.libs
|
* @subpackage cake.tests.cases.libs
|
||||||
* @since CakePHP(tm) v 1.2.0.4206
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
* @version $Revision$
|
* @license Open Group Test Suite License (http://www.opensource.org/licenses/opengroup.php)
|
||||||
* @modifiedby $LastChangedBy$
|
*/
|
||||||
* @lastmodified $Date$
|
/**
|
||||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
* Included libraries.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'Inflector');
|
App::import('Core', 'Inflector');
|
||||||
/**
|
/**
|
||||||
|
@ -305,4 +304,4 @@ class InflectorTest extends CakeTestCase {
|
||||||
unset($this->Inflector);
|
unset($this->Inflector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue