Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/flow-flo.../libs/cakephp/utility
File: Inflector.php
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-plural-singular-forms
[500] Fix | Delete
*/
[501] Fix | Delete
public static function pluralize($word)
[502] Fix | Delete
{
[503] Fix | Delete
if (isset(static::$_cache['pluralize'][$word])) {
[504] Fix | Delete
return static::$_cache['pluralize'][$word];
[505] Fix | Delete
}
[506] Fix | Delete
[507] Fix | Delete
if (!isset(static::$_cache['irregular']['pluralize'])) {
[508] Fix | Delete
$words = array_keys(static::$_irregular);
[509] Fix | Delete
static::$_cache['irregular']['pluralize'] = '/(.*?(?:\\b|_))(' . implode('|', $words) . ')$/i';
[510] Fix | Delete
[511] Fix | Delete
$upperWords = array_map('ucfirst', $words);
[512] Fix | Delete
static::$_cache['irregular']['upperPluralize'] = '/(.*?(?:\\b|[a-z]))(' . implode('|', $upperWords) . ')$/';
[513] Fix | Delete
}
[514] Fix | Delete
[515] Fix | Delete
if (
[516] Fix | Delete
preg_match(static::$_cache['irregular']['pluralize'], $word, $regs) ||
[517] Fix | Delete
preg_match(static::$_cache['irregular']['upperPluralize'], $word, $regs)
[518] Fix | Delete
) {
[519] Fix | Delete
static::$_cache['pluralize'][$word] = $regs[1] . substr($regs[2], 0, 1) .
[520] Fix | Delete
substr(static::$_irregular[strtolower($regs[2])], 1);
[521] Fix | Delete
[522] Fix | Delete
return static::$_cache['pluralize'][$word];
[523] Fix | Delete
}
[524] Fix | Delete
[525] Fix | Delete
if (!isset(static::$_cache['uninflected'])) {
[526] Fix | Delete
static::$_cache['uninflected'] = '/^(' . implode('|', static::$_uninflected) . ')$/i';
[527] Fix | Delete
}
[528] Fix | Delete
[529] Fix | Delete
if (preg_match(static::$_cache['uninflected'], $word, $regs)) {
[530] Fix | Delete
static::$_cache['pluralize'][$word] = $word;
[531] Fix | Delete
[532] Fix | Delete
return $word;
[533] Fix | Delete
}
[534] Fix | Delete
[535] Fix | Delete
foreach (static::$_plural as $rule => $replacement) {
[536] Fix | Delete
if (preg_match($rule, $word)) {
[537] Fix | Delete
static::$_cache['pluralize'][$word] = preg_replace($rule, $replacement, $word);
[538] Fix | Delete
[539] Fix | Delete
return static::$_cache['pluralize'][$word];
[540] Fix | Delete
}
[541] Fix | Delete
}
[542] Fix | Delete
}
[543] Fix | Delete
[544] Fix | Delete
/**
[545] Fix | Delete
* Return $word in singular form.
[546] Fix | Delete
*
[547] Fix | Delete
* @param string $word Word in plural
[548] Fix | Delete
* @return string Word in singular
[549] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-plural-singular-forms
[550] Fix | Delete
*/
[551] Fix | Delete
public static function singularize($word)
[552] Fix | Delete
{
[553] Fix | Delete
if (isset(static::$_cache['singularize'][$word])) {
[554] Fix | Delete
return static::$_cache['singularize'][$word];
[555] Fix | Delete
}
[556] Fix | Delete
[557] Fix | Delete
if (!isset(static::$_cache['irregular']['singular'])) {
[558] Fix | Delete
$wordList = array_values(static::$_irregular);
[559] Fix | Delete
static::$_cache['irregular']['singular'] = '/(.*?(?:\\b|_))(' . implode('|', $wordList) . ')$/i';
[560] Fix | Delete
[561] Fix | Delete
$upperWordList = array_map('ucfirst', $wordList);
[562] Fix | Delete
static::$_cache['irregular']['singularUpper'] = '/(.*?(?:\\b|[a-z]))(' .
[563] Fix | Delete
implode('|', $upperWordList) .
[564] Fix | Delete
')$/';
[565] Fix | Delete
}
[566] Fix | Delete
[567] Fix | Delete
if (
[568] Fix | Delete
preg_match(static::$_cache['irregular']['singular'], $word, $regs) ||
[569] Fix | Delete
preg_match(static::$_cache['irregular']['singularUpper'], $word, $regs)
[570] Fix | Delete
) {
[571] Fix | Delete
static::$_cache['singularize'][$word] = $regs[1] . substr($regs[2], 0, 1) .
[572] Fix | Delete
substr(array_search(strtolower($regs[2]), static::$_irregular, true), 1);
[573] Fix | Delete
[574] Fix | Delete
return static::$_cache['singularize'][$word];
[575] Fix | Delete
}
[576] Fix | Delete
[577] Fix | Delete
if (!isset(static::$_cache['uninflected'])) {
[578] Fix | Delete
static::$_cache['uninflected'] = '/^(' . implode('|', static::$_uninflected) . ')$/i';
[579] Fix | Delete
}
[580] Fix | Delete
[581] Fix | Delete
if (preg_match(static::$_cache['uninflected'], $word, $regs)) {
[582] Fix | Delete
static::$_cache['pluralize'][$word] = $word;
[583] Fix | Delete
[584] Fix | Delete
return $word;
[585] Fix | Delete
}
[586] Fix | Delete
[587] Fix | Delete
foreach (static::$_singular as $rule => $replacement) {
[588] Fix | Delete
if (preg_match($rule, $word)) {
[589] Fix | Delete
static::$_cache['singularize'][$word] = preg_replace($rule, $replacement, $word);
[590] Fix | Delete
[591] Fix | Delete
return static::$_cache['singularize'][$word];
[592] Fix | Delete
}
[593] Fix | Delete
}
[594] Fix | Delete
static::$_cache['singularize'][$word] = $word;
[595] Fix | Delete
[596] Fix | Delete
return $word;
[597] Fix | Delete
}
[598] Fix | Delete
[599] Fix | Delete
/**
[600] Fix | Delete
* Returns the input lower_case_delimited_string as a CamelCasedString.
[601] Fix | Delete
*
[602] Fix | Delete
* @param string $string String to camelize
[603] Fix | Delete
* @param string $delimiter the delimiter in the input string
[604] Fix | Delete
* @return string CamelizedStringLikeThis.
[605] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-camelcase-and-under-scored-forms
[606] Fix | Delete
*/
[607] Fix | Delete
public static function camelize($string, $delimiter = '_')
[608] Fix | Delete
{
[609] Fix | Delete
$cacheKey = __FUNCTION__ . $delimiter;
[610] Fix | Delete
[611] Fix | Delete
$result = static::_cache($cacheKey, $string);
[612] Fix | Delete
[613] Fix | Delete
if ($result === false) {
[614] Fix | Delete
$result = str_replace(' ', '', static::humanize($string, $delimiter));
[615] Fix | Delete
static::_cache($cacheKey, $string, $result);
[616] Fix | Delete
}
[617] Fix | Delete
[618] Fix | Delete
return $result;
[619] Fix | Delete
}
[620] Fix | Delete
[621] Fix | Delete
/**
[622] Fix | Delete
* Returns the input CamelCasedString as an underscored_string.
[623] Fix | Delete
*
[624] Fix | Delete
* Also replaces dashes with underscores
[625] Fix | Delete
*
[626] Fix | Delete
* @param string $string CamelCasedString to be "underscorized"
[627] Fix | Delete
* @return string underscore_version of the input string
[628] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-camelcase-and-under-scored-forms
[629] Fix | Delete
*/
[630] Fix | Delete
public static function underscore($string)
[631] Fix | Delete
{
[632] Fix | Delete
return static::delimit(str_replace('-', '_', $string), '_');
[633] Fix | Delete
}
[634] Fix | Delete
[635] Fix | Delete
/**
[636] Fix | Delete
* Returns the input CamelCasedString as an dashed-string.
[637] Fix | Delete
*
[638] Fix | Delete
* Also replaces underscores with dashes
[639] Fix | Delete
*
[640] Fix | Delete
* @param string $string The string to dasherize.
[641] Fix | Delete
* @return string Dashed version of the input string
[642] Fix | Delete
*/
[643] Fix | Delete
public static function dasherize($string)
[644] Fix | Delete
{
[645] Fix | Delete
return static::delimit(str_replace('_', '-', $string), '-');
[646] Fix | Delete
}
[647] Fix | Delete
[648] Fix | Delete
/**
[649] Fix | Delete
* Returns the input lower_case_delimited_string as 'A Human Readable String'.
[650] Fix | Delete
* (Underscores are replaced by spaces and capitalized following words.)
[651] Fix | Delete
*
[652] Fix | Delete
* @param string $string String to be humanized
[653] Fix | Delete
* @param string $delimiter the character to replace with a space
[654] Fix | Delete
* @return string Human-readable string
[655] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-human-readable-forms
[656] Fix | Delete
*/
[657] Fix | Delete
public static function humanize($string, $delimiter = '_')
[658] Fix | Delete
{
[659] Fix | Delete
$cacheKey = __FUNCTION__ . $delimiter;
[660] Fix | Delete
[661] Fix | Delete
$result = static::_cache($cacheKey, $string);
[662] Fix | Delete
[663] Fix | Delete
if ($result === false) {
[664] Fix | Delete
$result = explode(' ', str_replace($delimiter, ' ', $string));
[665] Fix | Delete
foreach ($result as &$word) {
[666] Fix | Delete
$word = mb_strtoupper(mb_substr($word, 0, 1)) . mb_substr($word, 1);
[667] Fix | Delete
}
[668] Fix | Delete
$result = implode(' ', $result);
[669] Fix | Delete
static::_cache($cacheKey, $string, $result);
[670] Fix | Delete
}
[671] Fix | Delete
[672] Fix | Delete
return $result;
[673] Fix | Delete
}
[674] Fix | Delete
[675] Fix | Delete
/**
[676] Fix | Delete
* Expects a CamelCasedInputString, and produces a lower_case_delimited_string
[677] Fix | Delete
*
[678] Fix | Delete
* @param string $string String to delimit
[679] Fix | Delete
* @param string $delimiter the character to use as a delimiter
[680] Fix | Delete
* @return string delimited string
[681] Fix | Delete
*/
[682] Fix | Delete
public static function delimit($string, $delimiter = '_')
[683] Fix | Delete
{
[684] Fix | Delete
$cacheKey = __FUNCTION__ . $delimiter;
[685] Fix | Delete
[686] Fix | Delete
$result = static::_cache($cacheKey, $string);
[687] Fix | Delete
[688] Fix | Delete
if ($result === false) {
[689] Fix | Delete
$result = mb_strtolower(preg_replace('/(?<=\\w)([A-Z])/', $delimiter . '\\1', $string));
[690] Fix | Delete
static::_cache($cacheKey, $string, $result);
[691] Fix | Delete
}
[692] Fix | Delete
[693] Fix | Delete
return $result;
[694] Fix | Delete
}
[695] Fix | Delete
[696] Fix | Delete
/**
[697] Fix | Delete
* Returns corresponding table name for given model $className. ("people" for the model class "Person").
[698] Fix | Delete
*
[699] Fix | Delete
* @param string $className Name of class to get database table name for
[700] Fix | Delete
* @return string Name of the database table for given class
[701] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-table-and-class-name-forms
[702] Fix | Delete
*/
[703] Fix | Delete
public static function tableize($className)
[704] Fix | Delete
{
[705] Fix | Delete
$result = static::_cache(__FUNCTION__, $className);
[706] Fix | Delete
[707] Fix | Delete
if ($result === false) {
[708] Fix | Delete
$result = static::pluralize(static::underscore($className));
[709] Fix | Delete
static::_cache(__FUNCTION__, $className, $result);
[710] Fix | Delete
}
[711] Fix | Delete
[712] Fix | Delete
return $result;
[713] Fix | Delete
}
[714] Fix | Delete
[715] Fix | Delete
/**
[716] Fix | Delete
* Returns Cake model class name ("Person" for the database table "people".) for given database table.
[717] Fix | Delete
*
[718] Fix | Delete
* @param string $tableName Name of database table to get class name for
[719] Fix | Delete
* @return string Class name
[720] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-table-and-class-name-forms
[721] Fix | Delete
*/
[722] Fix | Delete
public static function classify($tableName)
[723] Fix | Delete
{
[724] Fix | Delete
$result = static::_cache(__FUNCTION__, $tableName);
[725] Fix | Delete
[726] Fix | Delete
if ($result === false) {
[727] Fix | Delete
$result = static::camelize(static::singularize($tableName));
[728] Fix | Delete
static::_cache(__FUNCTION__, $tableName, $result);
[729] Fix | Delete
}
[730] Fix | Delete
[731] Fix | Delete
return $result;
[732] Fix | Delete
}
[733] Fix | Delete
[734] Fix | Delete
/**
[735] Fix | Delete
* Returns camelBacked version of an underscored string.
[736] Fix | Delete
*
[737] Fix | Delete
* @param string $string String to convert.
[738] Fix | Delete
* @return string in variable form
[739] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-variable-names
[740] Fix | Delete
*/
[741] Fix | Delete
public static function variable($string)
[742] Fix | Delete
{
[743] Fix | Delete
$result = static::_cache(__FUNCTION__, $string);
[744] Fix | Delete
[745] Fix | Delete
if ($result === false) {
[746] Fix | Delete
$camelized = static::camelize(static::underscore($string));
[747] Fix | Delete
$replace = strtolower(substr($camelized, 0, 1));
[748] Fix | Delete
$result = $replace . substr($camelized, 1);
[749] Fix | Delete
static::_cache(__FUNCTION__, $string, $result);
[750] Fix | Delete
}
[751] Fix | Delete
[752] Fix | Delete
return $result;
[753] Fix | Delete
}
[754] Fix | Delete
[755] Fix | Delete
/**
[756] Fix | Delete
* Returns a string with all spaces converted to dashes (by default), accented
[757] Fix | Delete
* characters converted to non-accented characters, and non word characters removed.
[758] Fix | Delete
*
[759] Fix | Delete
* @deprecated 3.2.7 Use Text::slug() instead.
[760] Fix | Delete
* @param string $string the string you want to slug
[761] Fix | Delete
* @param string $replacement will replace keys in map
[762] Fix | Delete
* @return string
[763] Fix | Delete
* @link https://book.cakephp.org/3/en/core-libraries/inflector.html#creating-url-safe-strings
[764] Fix | Delete
*/
[765] Fix | Delete
public static function slug($string, $replacement = '-')
[766] Fix | Delete
{
[767] Fix | Delete
deprecationWarning(
[768] Fix | Delete
'Inflector::slug() is deprecated. ' .
[769] Fix | Delete
'Use Text::slug() instead.'
[770] Fix | Delete
);
[771] Fix | Delete
$quotedReplacement = preg_quote($replacement, '/');
[772] Fix | Delete
[773] Fix | Delete
$map = [
[774] Fix | Delete
'/[^\s\p{Zs}\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]/mu' => ' ',
[775] Fix | Delete
'/[\s\p{Zs}]+/mu' => $replacement,
[776] Fix | Delete
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
[777] Fix | Delete
];
[778] Fix | Delete
[779] Fix | Delete
$string = str_replace(
[780] Fix | Delete
array_keys(static::$_transliteration),
[781] Fix | Delete
static::$_transliteration,
[782] Fix | Delete
$string
[783] Fix | Delete
);
[784] Fix | Delete
[785] Fix | Delete
return preg_replace(array_keys($map), array_values($map), $string);
[786] Fix | Delete
}
[787] Fix | Delete
}
[788] Fix | Delete
[789] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function