Diff for Metafox/lib/Platon.php between version 1.10 and 1.11
| version 1.10, 2014/10/15 13:00:16 |
version 1.11, 2015/01/20 15:20:17 |
|
|
| * @access public |
* @access public |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/lib/Platon.php,v 1.9 2012-05-15 17:47:56 igor Exp $ */ |
/* $Platon: Metafox/lib/Platon.php,v 1.10 2014-10-15 13:00:16 igor Exp $ */ |
| |
|
| class Platon |
class Platon |
| { |
{ |
|
|
| # end pretty_substr; |
# end pretty_substr; |
| # }}} |
# }}} |
| |
|
| |
/** |
| |
* Insert element into array on specific index. |
| |
* |
| |
* @param array $arr input array |
| |
* @param int $index position in array |
| |
* @param mix $element inserted element |
| |
* @return array output array |
| |
*/ |
| |
static function array_insert($arr, $index, $element) { |
| |
if (!is_array($arr)) { |
| |
return false; |
| |
} |
| |
$index = intval($index); |
| |
if ($index > count($arr)-1) { |
| |
array_push($arr, $element); |
| |
return $arr; |
| |
} |
| |
$before = array_splice($arr, 0, $index); |
| |
array_push($before, $element); |
| |
return array_merge($before, $arr); |
| |
} |
| |
|
| /** |
/** |
| * Returns english grammar related number. |
* Returns english grammar related number. |
| * |
* |
|
|
| { |
{ |
| $str = str_replace('/~', '/<TILDE>', $str); |
$str = str_replace('/~', '/<TILDE>', $str); |
| $str = str_replace('~', ' ', $str); |
$str = str_replace('~', ' ', $str); |
| $str = preg_replace('|<TILD[AE]?>|i', '~', $str); |
$str = preg_replace('|<TILD[AE]?'.'>|i', '~', $str); |
| return $str; |
return $str; |
| } /* }}} */ |
} /* }}} */ |
| |
|
Platon Group <platon@platon.org> http://platon.org/
|
|