* Returns an array of translated week days in short names.
* @param string $language (optional) Language indentificator. If it is omited, the current interface language is assumed.
* @param string $language (optional) Language id. If it is omitted, the current interface language is assumed.
* @return string Returns an array of week days (short names).
* Example: api_get_week_days_short('english') means array('Sun', 'Mon', ... 'Sat').
* Note: For all languges returned days are in the English order.
@ -788,7 +787,7 @@ function api_get_week_days_short($language = null) {
/**
* Returns an array of translated week days.
* @param string $language (optional) Language indentificator. If it is omited, the current interface language is assumed.
* @param string $language (optional) Language id. If it is omitted, the current interface language is assumed.
* @return string Returns an array of week days.
* Example: api_get_week_days_long('english') means array('Sunday, 'Monday', ... 'Saturday').
* Note: For all languges returned days are in the English order.
@ -800,7 +799,7 @@ function api_get_week_days_long($language = null) {
/**
* Returns an array of translated months in short names.
* @param string $language (optional) Language indentificator. If it is omited, the current interface language is assumed.
* @param string $language (optional) Language id. If it is omitted, the current interface language is assumed.
* @return string Returns an array of months (short names).
* Example: api_get_months_short('english') means array('Jan', 'Feb', ... 'Dec').
*/
@ -811,7 +810,7 @@ function api_get_months_short($language = null) {
/**
* Returns an array of translated months.
* @param string $language (optional) Language indentificator. If it is omited, the current interface language is assumed.
* @param string $language (optional) Language id. If it is omitted, the current interface language is assumed.
* @return string Returns an array of months.
* Example: api_get_months_long('english') means array('January, 'February' ... 'December').
*/
@ -826,11 +825,11 @@ function api_get_months_long($language = null) {
/**
* Builds a person (full) name depending on the convention for a given language.
* @param string $first_name The first name of the preson.
* @param string $first_name The first name of the person.
* @param string $last_name The last name of the person.
* @param string $title The title of the person.
* @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t %l, %f' or '%T %F %L', ...) or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
* @param string $language (optional) The language indentificator. If it is omited, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @param string $language (optional) The language id. If it is omitted, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @return bool The result is sort of full name of the person.
* Sample results:
@ -927,7 +926,7 @@ function api_get_person_name(
/**
* Checks whether a given format represents person name in Western order (for which first name is first).
* @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t. %l, %f') or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
* @param string $language (optional) The language identificator. If it is omited, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @param string $language (optional) The language id. If it is omitted, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @return bool The result TRUE means that the order is first_name last_name, FALSE means last_name first_name.
* Note: You may use this function for determing the order of the fields or columns "First name" and "Last name" in forms, tables and reports.
* This function encodes (conditionally) a given string to UTF-8 if XmlHttp-request has been detected.
* @param string $string The string being converted.
* @param string $from_encoding (optional) The encoding that $string is being converted from. If it is omited, the platform character set is assumed.
* @param string $from_encoding (optional) The encoding that $string is being converted from.
* If it is omitted, the platform character set is assumed.
* @return string Returns the converted string.
*/
function api_xml_http_response_encode($string, $from_encoding = 'UTF8')
@ -1120,7 +1128,8 @@ function api_xml_http_response_encode($string, $from_encoding = 'UTF8')
*
* @param string $string The input string.
* @param string $unknown (optional) Replacement character for unknown characters and illegal UTF-8 sequences.
* @param string $from_encoding (optional) The encoding of the input string. If it is omited, the platform character set is assumed.
* @param string $from_encoding (optional) The encoding of the input string.
* If it is omitted, the platform character set is assumed.
* @return string Plain ASCII output.
*
*/
@ -1146,9 +1155,10 @@ function api_ord($character, $encoding) {
* This function returns a string or an array with all occurrences of search in subject (ignoring case) replaced with the given replace value.
* @param mixed $search String or array of strings to be found.
* @param mixed $replace String or array of strings used for replacement.
* @param mixed $subject String or array of strings being searced.
* @param mixed $subject String or array of strings being searched.
* @param int $count (optional) The number of matched and replaced needles will be returned in count, which is passed by reference.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return mixed String or array as a result.
* Notes:
* If $subject is an array, then the search and replace is performed with every entry of subject, the return value is an array.
* @param string $haystack The string being checked.
* @param string $needle The string being found.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return int The number of times the needle substring occurs in the haystack string.
@ -1422,7 +1433,8 @@ function api_substr_count($haystack, $needle, $encoding = null)
* If it is negative, it represents the number of characters from the end of string at which to stop replacing.
* If it is not given, then it will default to api_strlen($string); i.e. end the replacing at the end of string.
* If $length is zero, then this function will have the effect of inserting replacement into the string at the given start offset.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return string The result string is returned.
* This function is aimed at replacing the function substr_replace() for human-language strings.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return string Returns a string with the first character capitalized, if that character is alphabetic.
* This function is aimed at replacing the function ucfirst() for human-language strings.
* @link http://php.net/manual/en/function.ucfirst
@ -1452,7 +1465,8 @@ function api_ucfirst($string, $encoding = null)
/**
* Uppercases the first character of each word in a string.
* @param string $string The input string.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return string Returns the modified string.
* This function is aimed at replacing the function ucwords() for human-language strings.
* @param string|array $subject The string or an array with strings to search and replace.
* @param int $limit The maximum possible replacements for each pattern in each subject string. Defaults to -1 (no limit).
* @param int &$count If specified, this variable will be filled with the number of replacements done.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return array|string|null returns an array if the subject parameter is an array, or a string otherwise.
* If matches are found, the new subject will be returned, otherwise subject will be returned unchanged or NULL if an error occurred.
* @param string $language (optional) The language in which comparison is to be made. If language is omitted, interface language is assumed then.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return int Returns <0if$string1islessthan$string2;> 0 if $string1 is greater than $string2; and 0 if the strings are equal.
* This function is aimed at replacing the function strcmp() for human-language strings.
* @param string $language (optional) The language in which comparison is to be made. If language is omitted, interface language is assumed then.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return int Returns <0if$string1islessthan$string2;> 0 if $string1 is greater than $string2; and 0 if the strings are equal.
* This function is aimed at replacing the function strnatcmp() for human-language strings.
* @param string $language (optional) The language in which comparison is to be made. If language is omitted, interface language is assumed then.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return bool Returns TRUE on success, FALSE on error.
* This function is aimed at replacing the function natsort() for sorting human-language strings.
* Sorts an array using natural order algorithm in reverse order.
* @param array $array The input array.
* @param string $language (optional) The language in which comparison is to be made. If language is omitted, interface language is assumed then.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted, the platform character set will be used by default.
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @return bool Returns TRUE on success, FALSE on error.
*/
function api_natrsort(&$array, $language = null, $encoding = null)
@ -1656,7 +1675,8 @@ function api_refine_encoding_id($encoding) {
* This function checks whether two $encoding are equal (same, equvalent).
* @param string/array $encoding1 The first encoding
* @param string/array $encoding2 The second encoding
* @param bool $strict When this parameter is TRUE the comparison ignores aliases of encodings. When the parameter is FALSE, aliases are taken into account.
* @param bool $strict When this parameter is TRUE the comparison ignores aliases of encodings.
* When the parameter is FALSE, aliases are taken into account.
* @return bool Returns TRUE if the encodings are equal, FALSE otherwise.
*/
function api_equal_encodings($encoding1, $encoding2, $strict = false) {
@ -1800,7 +1820,7 @@ function get_plugin_lang($variable, $pluginName) {
/**
* Returns an array of translated week days and months, short and normal names.
* @param string $language (optional) Language id. If it is ommited, the current interface language is assumed.
* @param string $language (optional) Language id. If it is omitted, the current interface language is assumed.
* @return array Returns a multidimensional array with translated week days and months.
*/
function &_api_get_day_month_names($language = null) {