mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/9574] Drop fallback implementations
phpBB 3.0 includes fallback implementations for following PHP5+ functions: array_combine str_split stripos htmlspecialchars_decode Since phpBB 3.1 requires PHP 5.2+ these can be dropped. PHPBB3-9574
This commit is contained in:
parent
34a1b044a1
commit
1e59666ee3
1 changed files with 0 additions and 101 deletions
|
@ -752,95 +752,6 @@ function phpbb_is_writable($file)
|
|||
}
|
||||
}
|
||||
|
||||
// Compatibility functions
|
||||
|
||||
if (!function_exists('array_combine'))
|
||||
{
|
||||
/**
|
||||
* A wrapper for the PHP5 function array_combine()
|
||||
* @param array $keys contains keys for the resulting array
|
||||
* @param array $values contains values for the resulting array
|
||||
*
|
||||
* @return Returns an array by using the values from the keys array as keys and the
|
||||
* values from the values array as the corresponding values. Returns false if the
|
||||
* number of elements for each array isn't equal or if the arrays are empty.
|
||||
*/
|
||||
function array_combine($keys, $values)
|
||||
{
|
||||
$keys = array_values($keys);
|
||||
$values = array_values($values);
|
||||
|
||||
$n = sizeof($keys);
|
||||
$m = sizeof($values);
|
||||
if (!$n || !$m || ($n != $m))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$combined = array();
|
||||
for ($i = 0; $i < $n; $i++)
|
||||
{
|
||||
$combined[$keys[$i]] = $values[$i];
|
||||
}
|
||||
return $combined;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('str_split'))
|
||||
{
|
||||
/**
|
||||
* A wrapper for the PHP5 function str_split()
|
||||
* @param array $string contains the string to be converted
|
||||
* @param array $split_length contains the length of each chunk
|
||||
*
|
||||
* @return Converts a string to an array. If the optional split_length parameter is specified,
|
||||
* the returned array will be broken down into chunks with each being split_length in length,
|
||||
* otherwise each chunk will be one character in length. FALSE is returned if split_length is
|
||||
* less than 1. If the split_length length exceeds the length of string, the entire string is
|
||||
* returned as the first (and only) array element.
|
||||
*/
|
||||
function str_split($string, $split_length = 1)
|
||||
{
|
||||
if ($split_length < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ($split_length >= strlen($string))
|
||||
{
|
||||
return array($string);
|
||||
}
|
||||
else
|
||||
{
|
||||
preg_match_all('#.{1,' . $split_length . '}#s', $string, $matches);
|
||||
return $matches[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('stripos'))
|
||||
{
|
||||
/**
|
||||
* A wrapper for the PHP5 function stripos
|
||||
* Find position of first occurrence of a case-insensitive string
|
||||
*
|
||||
* @param string $haystack is the string to search in
|
||||
* @param string $needle is the string to search for
|
||||
*
|
||||
* @return mixed Returns the numeric position of the first occurrence of needle in the haystack string. Unlike strpos(), stripos() is case-insensitive.
|
||||
* Note that the needle may be a string of one or more characters.
|
||||
* If needle is not found, stripos() will return boolean FALSE.
|
||||
*/
|
||||
function stripos($haystack, $needle)
|
||||
{
|
||||
if (preg_match('#' . preg_quote($needle, '#') . '#i', $haystack, $m))
|
||||
{
|
||||
return strpos($haystack, $m[0]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a path ($path) is absolute or relative
|
||||
*
|
||||
|
@ -1046,18 +957,6 @@ else
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('htmlspecialchars_decode'))
|
||||
{
|
||||
/**
|
||||
* A wrapper for htmlspecialchars_decode
|
||||
* @ignore
|
||||
*/
|
||||
function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT)
|
||||
{
|
||||
return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
|
||||
}
|
||||
}
|
||||
|
||||
// functions used for building option fields
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue