Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1324

Přidáno uživatelem Michal Kliment před téměř 13 roky(ů)

Zapomenute vylepseni v helperech.

Zobrazit rozdíly:

freenetis/branches/testing/application/helpers/valid.php
*/
public static function ip_address($str)
{
return preg_match ("/^((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9])\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9])\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9])\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9])$/", $str);
$str = str_replace("\n", ",", $str);
return preg_match ("/^(((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9])\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9])\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9])\.((25[0-5])|(2[0-4][0-9])|(1[0-9][0-9])|([1-9][0-9])|[0-9]),?)+$/", $str);
}
/**
freenetis/branches/testing/application/helpers/arr.php
return FALSE;
}
/**
* Sorts array, almost same as default PHP sort function,
* but it doesn't edit original array and returns new array
*
* @author Michal Kliment
* @param array $array
* @return array
*/
public static function sort ($array)
{
sort ($array);
return $array;
}
} // End arr
freenetis/branches/testing/application/helpers/text.php
* @license http://kohanaphp.com/license.html
*/
class text {
const TAB = "\t";
const EOL = "\n";
/**
* Limits a phrase to a given number of words.
......
return '???';
}
/**
* Prints data in columns seperated by tabulator
*
* @author Michal Kliment
* @param array $data
* @param array $columns
* @return string
*/
public static function print_in_columns ($data, $columns)
{
$str = '';
// prints results
foreach ($data as $line)
{
foreach ($columns as $column)
{
if (isset($line[$column]))
$str .= $line[$column].self::TAB;
else
$str .= self::TAB;
}
$str .= self::EOL;
}
return $str;
}
} // End text

Také k dispozici: Unified diff