mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-27 14:26:29 +00:00
removing changes made in trunk after directory changes made on next release
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1055 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a00a927cca
commit
a316884f37
2 changed files with 184 additions and 206 deletions
|
@ -565,5 +565,7 @@ class %sTest extends TestCase
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
118
libs/basics.php
118
libs/basics.php
|
@ -49,12 +49,12 @@ define('YEAR', 365 * DAY);
|
||||||
* @uses APP
|
* @uses APP
|
||||||
* @uses MODELS
|
* @uses MODELS
|
||||||
*/
|
*/
|
||||||
function loadModels()
|
function loadModels ()
|
||||||
{
|
{
|
||||||
require APP.'app_model.php';
|
require (APP.'app_model.php');
|
||||||
foreach (listClasses(MODELS) as $model_fn)
|
foreach (listClasses(MODELS) as $model_fn)
|
||||||
{
|
{
|
||||||
require_once MODELS.$model_fn;
|
require_once (MODELS.$model_fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,18 +66,18 @@ function loadModels()
|
||||||
* @uses HELPERS
|
* @uses HELPERS
|
||||||
* @uses CONTROLLERS
|
* @uses CONTROLLERS
|
||||||
*/
|
*/
|
||||||
function loadControllers()
|
function loadControllers ()
|
||||||
{
|
{
|
||||||
require APP.'app_controller.php';
|
require (APP.'app_controller.php');
|
||||||
|
|
||||||
foreach (listClasses(HELPERS) as $helper)
|
foreach (listClasses(HELPERS) as $helper)
|
||||||
{
|
{
|
||||||
require_once HELPERS.$helper.'.php';
|
require_once (HELPERS.$helper.'.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (listClasses(CONTROLLERS) as $controller)
|
foreach (listClasses(CONTROLLERS) as $controller)
|
||||||
{
|
{
|
||||||
require_once CONTROLLERS.$controller.'.php';
|
require_once (CONTROLLERS.$controller.'.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,26 +87,17 @@ function loadControllers()
|
||||||
* @param string $name Name of controller
|
* @param string $name Name of controller
|
||||||
* @return boolean Success
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
function loadController($name)
|
function loadController ($name)
|
||||||
{
|
{
|
||||||
$controllerFn = CONTROLLERS.Inflector::underscore($name).'_controller.php';
|
$controller_fn = CONTROLLERS.Inflector::underscore($name).'_controller.php';
|
||||||
$helperFn = HELPERS.Inflector::underscore($name).'_helper.php';
|
$helper_fn = HELPERS.Inflector::underscore($name).'_helper.php';
|
||||||
|
|
||||||
require_once(APP.'app_controller.php');
|
require_once(APP.'app_controller.php');
|
||||||
|
|
||||||
if (file_exists($helperFn))
|
if (file_exists($helper_fn))
|
||||||
{
|
require_once($helper_fn);
|
||||||
require_once $helperFn;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($controllerFn))
|
return file_exists($controller_fn)? require_once($controller_fn): false;
|
||||||
{
|
|
||||||
return require_once $controllerFn;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,29 +117,26 @@ function listClasses($path)
|
||||||
*
|
*
|
||||||
* @return boolean Success
|
* @return boolean Success
|
||||||
*/
|
*/
|
||||||
function config()
|
function config ()
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
foreach ($args as $arg)
|
foreach ($args as $arg)
|
||||||
{
|
{
|
||||||
if (('database' == $arg) && file_exists(CONFIGS.$arg.'.php'))
|
if (('database' == $arg) && file_exists(CONFIGS.$arg.'.php'))
|
||||||
{
|
{
|
||||||
require_once CONFIGS.$arg.'.php';
|
include_once(CONFIGS.$arg.'.php');
|
||||||
}
|
}
|
||||||
elseif (file_exists(CONFIGS.$arg.'.php'))
|
elseif (file_exists(CONFIGS.$arg.'.php'))
|
||||||
{
|
{
|
||||||
require_once CONFIGS.$arg.'.php';
|
include_once (CONFIGS.$arg.'.php');
|
||||||
|
if (count($args) == 1) return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (count($args) == 1) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (count($args) == 1)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (count($args) == 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,24 +150,27 @@ function config()
|
||||||
*
|
*
|
||||||
* @uses LIBS
|
* @uses LIBS
|
||||||
*/
|
*/
|
||||||
function uses()
|
function uses ()
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
foreach ($args as $arg)
|
foreach ($args as $arg)
|
||||||
{
|
{
|
||||||
require_once LIBS.strtolower($arg).'.php';
|
require_once(LIBS.strtolower($arg).'.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Require given files in the VENDORS directory. Takes optional number of parameters.
|
* Require given files in the VENDORS directory. Takes optional number of parameters.
|
||||||
|
*
|
||||||
|
* @param string $name Filename without the .php part.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
function vendor()
|
function vendor($name)
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
foreach ($args as $arg)
|
foreach ($args as $arg)
|
||||||
{
|
{
|
||||||
require_once VENDORS.$arg.'.php';
|
require_once(VENDORS.$arg.'.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,10 +187,7 @@ function debug($var = false, $show_html = false)
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
{
|
{
|
||||||
print "\n<pre>\n";
|
print "\n<pre>\n";
|
||||||
if ($show_html)
|
if ($show_html) $var = str_replace('<', '<', str_replace('>', '>', $var));
|
||||||
{
|
|
||||||
$var = str_replace('<', '<', str_replace('>', '>', $var));
|
|
||||||
}
|
|
||||||
print_r($var);
|
print_r($var);
|
||||||
print "\n</pre>\n";
|
print "\n</pre>\n";
|
||||||
}
|
}
|
||||||
|
@ -208,7 +196,7 @@ function debug($var = false, $show_html = false)
|
||||||
|
|
||||||
if (!function_exists('getMicrotime'))
|
if (!function_exists('getMicrotime'))
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns microtime for execution time checking.
|
* Returns microtime for execution time checking.
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
|
@ -222,7 +210,7 @@ if (!function_exists('getMicrotime'))
|
||||||
|
|
||||||
if (!function_exists('sortByKey'))
|
if (!function_exists('sortByKey'))
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Sorts given $array by key $sortby.
|
* Sorts given $array by key $sortby.
|
||||||
*
|
*
|
||||||
* @param array $array
|
* @param array $array
|
||||||
|
@ -231,26 +219,19 @@ if (!function_exists('sortByKey'))
|
||||||
* @param integer $type
|
* @param integer $type
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function sortByKey(&$array, $sortby, $order = 'asc', $type = SORT_NUMERIC)
|
function sortByKey(&$array, $sortby, $order='asc', $type=SORT_NUMERIC)
|
||||||
{
|
{
|
||||||
if (!is_array($array))
|
if (!is_array($array))
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($array as $key => $val)
|
foreach ($array as $key => $val)
|
||||||
{
|
{
|
||||||
$sa[$key] = $val[$sortby];
|
$sa[$key] = $val[$sortby];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($order == 'asc')
|
$order == 'asc'
|
||||||
{
|
? asort($sa, $type)
|
||||||
asort($sa, $type);
|
: arsort($sa, $type);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
arsort($sa, $type);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($sa as $key=>$val)
|
foreach ($sa as $key=>$val)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +244,7 @@ if (!function_exists('sortByKey'))
|
||||||
|
|
||||||
if (!function_exists('array_combine'))
|
if (!function_exists('array_combine'))
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Combines given identical arrays by using the first array's values as keys,
|
* Combines given identical arrays by using the first array's values as keys,
|
||||||
* and the second one's values as values. (Implemented for back-compatibility with PHP4.)
|
* and the second one's values as values. (Implemented for back-compatibility with PHP4.)
|
||||||
*
|
*
|
||||||
|
@ -278,16 +259,8 @@ if (!function_exists('array_combine'))
|
||||||
$c1 = count($a1);
|
$c1 = count($a1);
|
||||||
$c2 = count($a2);
|
$c2 = count($a2);
|
||||||
|
|
||||||
if ($c1 != $c2)
|
if ($c1 != $c2) return false; // different lenghts
|
||||||
{
|
if ($c1 <= 0) return false; // arrays are the same and both are empty
|
||||||
// different lenghts
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ($c1 <= 0)
|
|
||||||
{
|
|
||||||
// arrays are the same and both are empty
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$output = array();
|
$output = array();
|
||||||
|
|
||||||
|
@ -305,17 +278,19 @@ function h($text)
|
||||||
return htmlspecialchars($text);
|
return htmlspecialchars($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function a()
|
function a()
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function ha()
|
function ha()
|
||||||
{
|
{
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
|
||||||
for ($l=0 ; $l<count($args) ; $l++)
|
for($l=0 ; $l<count($args) ; $l++)
|
||||||
{
|
{
|
||||||
$a[$args[$l]] = $l+1<count($args) ? $args[$l+1] : null;
|
$a[$args[$l]] = $l+1<count($args) ? $args[$l+1] : null;
|
||||||
$l++;
|
$l++;
|
||||||
|
@ -323,6 +298,7 @@ function ha()
|
||||||
return $a;
|
return $a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function e($text)
|
function e($text)
|
||||||
{
|
{
|
||||||
echo $text;
|
echo $text;
|
||||||
|
@ -330,7 +306,7 @@ function e($text)
|
||||||
|
|
||||||
function pr($var)
|
function pr($var)
|
||||||
{
|
{
|
||||||
if (DEBUG > 0)
|
if(DEBUG > 0)
|
||||||
{
|
{
|
||||||
echo "<pre>";
|
echo "<pre>";
|
||||||
print_r($var);
|
print_r($var);
|
||||||
|
@ -341,13 +317,13 @@ function pr($var)
|
||||||
function params($p)
|
function params($p)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!is_array($p) || count($p) == 0)
|
if(!is_array($p) || count($p) == 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_array($p[0]) && count($p) == 1)
|
if(is_array($p[0]) && count($p) == 1)
|
||||||
{
|
{
|
||||||
return $p[0];
|
return $p[0];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue