mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
da79dff7d7
- Dispatcher sets a Controller::here variable with the real URL used to access the page, so that tag generators can that use an url (linkTo and formTag for example) use the real url, not guess it from the controller and action names which often fails - Log class works more reliably and a LogError() shortcut function was added - Nstring class added, to store string-related functions (there are just four yet, including a random password generator and an string-to-array splitter - SimpleTest library (with Rephlux) included in /vendors; I've tweaked SimpleScorer::inCli() function, because it didn't work on my setup, it should work everywhere now (it checks for empty REQUEST_METHOD, which should only be empty in CLI) git-svn-id: https://svn.cakephp.org/repo/trunk/cake@248 3807eeeb-6ff5-0310-8944-8be069107fe0
42 lines
No EOL
901 B
PHP
42 lines
No EOL
901 B
PHP
<?php
|
|
|
|
// $Id$
|
|
|
|
class Nstring // static
|
|
{
|
|
function toArray ($string)
|
|
{
|
|
return preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
|
|
}
|
|
|
|
function toRoman ($string)
|
|
{
|
|
$pl = array('ą','ć','ę','ł','ń','ó','ś','ź','ż','Ą','Ć','Ę','Ł','Ń','Ó','Ś','Ź','Ż');
|
|
$ro = array('a','c','e','l','n','o','s','z','z','A','C','E','L','N','O','S','Z','Z');
|
|
|
|
return str_replace($pl, $ro, $string);
|
|
}
|
|
|
|
function toCompressed ($string)
|
|
{
|
|
$whitespace = array("\n", "\t", "\r", "\0", "\x0B", " ");
|
|
return strtolower(str_replace($whitespace, '', $string));
|
|
}
|
|
|
|
function randomPassword ($length, $available_chars = 'ABDEFHKMNPRTWXYABDEFHKMNPRTWXY23456789')
|
|
{
|
|
$chars = preg_split('//', $available_chars, -1, PREG_SPLIT_NO_EMPTY);
|
|
$char_count = count($chars);
|
|
|
|
$out = '';
|
|
for ($ii=0; $ii<$length; $ii++)
|
|
{
|
|
$out .= $chars[rand(1, $char_count)-1];
|
|
}
|
|
|
|
return $out;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|