Changeset 1441
- Timestamp:
- 12/10/07 10:01:38 (10 months ago)
- Files:
-
- releases/0.9/lib/typo3/class.t3lib_cs.php (modified) (15 diffs)
- releases/0.9/lib/typo3/class.t3lib_div.php (modified) (22 diffs)
- releases/0.9/lib/typo3/csconvtbl/ascii.tbl (copied) (copied from devel/lib/typo3/csconvtbl/ascii.tbl)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
releases/0.9/lib/typo3/class.t3lib_cs.php
r269 r1441 3 3 * Copyright notice 4 4 * 5 * (c) 2003-200 5Kasper Skaarhoj (kasperYYYY@typo3.com)5 * (c) 2003-2006 Kasper Skaarhoj (kasperYYYY@typo3.com) 6 6 * All rights reserved 7 7 * … … 25 25 * Class for conversion between charsets. 26 26 * 27 * $Id: class.t3lib_cs.php,v 1.54 2005/12/12 21:47:50 masi Exp $ 27 * Typo Id: class.t3lib_cs.php,v 1.56 2006/05/03 08:47:30 masi Exp $ 28 * Moodle $Id: class.t3lib_cs.php,v 1.7 2006/08/11 09:48:35 stronk7 Exp $ 28 29 * 29 30 * @author Kasper Skaarhoj <kasperYYYY@typo3.com> … … 36 37 * 37 38 * 136: class t3lib_cs 38 * 503: function parse_charset($charset)39 * 5 22: function get_locale_charset($locale)39 * 488: function parse_charset($charset) 40 * 507: function get_locale_charset($locale) 40 41 * 41 42 * SECTION: Charset Conversion functions 42 * 5 75: function conv($str,$fromCS,$toCS,$useEntityForNoChar=0)43 * 6 15: function convArray(&$array,$fromCS,$toCS,$useEntityForNoChar=0)44 * 6 32: function utf8_encode($str,$charset)45 * 6 78: function utf8_decode($str,$charset,$useEntityForNoChar=0)46 * 7 21: function utf8_to_entities($str)47 * 7 54: function entities_to_utf8($str,$alsoStdHtmlEnt=0)48 * 7 88: function utf8_to_numberarray($str,$convEntities=0,$retChar=0)49 * 8 38: function UnumberToChar($cbyte)50 * 8 83: function utf8CharToUnumber($str,$hex=0)43 * 560: function conv($str,$fromCS,$toCS,$useEntityForNoChar=0) 44 * 600: function convArray(&$array,$fromCS,$toCS,$useEntityForNoChar=0) 45 * 617: function utf8_encode($str,$charset) 46 * 663: function utf8_decode($str,$charset,$useEntityForNoChar=0) 47 * 706: function utf8_to_entities($str) 48 * 739: function entities_to_utf8($str,$alsoStdHtmlEnt=0) 49 * 773: function utf8_to_numberarray($str,$convEntities=0,$retChar=0) 50 * 823: function UnumberToChar($cbyte) 51 * 868: function utf8CharToUnumber($str,$hex=0) 51 52 * 52 53 * SECTION: Init functions 53 * 9 26: function initCharset($charset)54 * 9 88: function initUnicodeData($mode=null)55 * 1 213: function initCaseFolding($charset)56 * 12 75: function initToASCII($charset)54 * 911: function initCharset($charset) 55 * 973: function initUnicodeData($mode=null) 56 * 1198: function initCaseFolding($charset) 57 * 1260: function initToASCII($charset) 57 58 * 58 59 * SECTION: String operation functions 59 * 13 46: function substr($charset,$string,$start,$len=null)60 * 1331: function substr($charset,$string,$start,$len=null) 60 61 * 1384: function strlen($charset,$string) 61 * 141 2: function crop($charset,$string,$len,$crop='')62 * 146 5: function strtrunc($charset,$string,$len)63 * 1 499: function conv_case($charset,$string,$case)64 * 152 5: function specCharsToASCII($charset,$string)62 * 1414: function crop($charset,$string,$len,$crop='') 63 * 1467: function strtrunc($charset,$string,$len) 64 * 1501: function conv_case($charset,$string,$case) 65 * 1527: function specCharsToASCII($charset,$string) 65 66 * 66 67 * SECTION: Internal string operation functions 67 * 156 5: function sb_char_mapping($str,$charset,$mode,$opt='')68 * 1567: function sb_char_mapping($str,$charset,$mode,$opt='') 68 69 * 69 70 * SECTION: Internal UTF-8 string operation functions 70 * 162 0: function utf8_substr($str,$start,$len=null)71 * 165 3: function utf8_strlen($str)72 * 167 4: function utf8_strtrunc($str,$len)73 * 169 6: function utf8_strpos($haystack,$needle,$offset=0)74 * 17 19: function utf8_strrpos($haystack,$needle)75 * 17 39: function utf8_char2byte_pos($str,$pos)76 * 178 0: function utf8_byte2char_pos($str,$pos)77 * 180 3: function utf8_char_mapping($str,$mode,$opt='')71 * 1622: function utf8_substr($str,$start,$len=null) 72 * 1655: function utf8_strlen($str) 73 * 1676: function utf8_strtrunc($str,$len) 74 * 1698: function utf8_strpos($haystack,$needle,$offset=0) 75 * 1723: function utf8_strrpos($haystack,$needle) 76 * 1745: function utf8_char2byte_pos($str,$pos) 77 * 1786: function utf8_byte2char_pos($str,$pos) 78 * 1809: function utf8_char_mapping($str,$mode,$opt='') 78 79 * 79 80 * SECTION: Internal EUC string operation functions 80 * 18 79: function euc_strtrunc($str,$len,$charset)81 * 19 08: function euc_substr($str,$start,$charset,$len=null)82 * 193 3: function euc_strlen($str,$charset)83 * 196 0: function euc_char2byte_pos($str,$pos,$charset)84 * 200 1: function euc_char_mapping($str,$charset,$mode,$opt='')81 * 1885: function euc_strtrunc($str,$len,$charset) 82 * 1914: function euc_substr($str,$start,$charset,$len=null) 83 * 1939: function euc_strlen($str,$charset) 84 * 1966: function euc_char2byte_pos($str,$pos,$charset) 85 * 2007: function euc_char_mapping($str,$charset,$mode,$opt='') 85 86 * 86 87 * TOTAL FUNCTIONS: 35 … … 245 246 ); 246 247 247 // mapping of iso-639:2 language codes to language (family)names248 var $lang_to_ langfamily=array(248 // mapping of iso-639:2 language codes to script names 249 var $lang_to_script=array( 249 250 // iso-639:2 language codes, see: 250 251 // http://www.w3.org/WAI/ER/IG/ert/iso639.htm 252 // http://www.loc.gov/standards/iso639-2/langcodes.html 251 253 // http://www.unicode.org/onlinedat/languages.html 252 254 'ar' => 'arabic', 253 'bg' => 'cyrillic', 254 'cs' => 'east_european', 255 'da' => 'west_european', 256 'de' => 'west_european', 257 'es' => 'west_european', 255 'bg' => 'cyrillic', // Bulgarian 256 'bs' => 'east_european', // Bosnian 257 'cs' => 'east_european', // Czech 258 'da' => 'west_european', // Danish 259 'de' => 'west_european', // German 260 'es' => 'west_european', // Spanish 258 261 'et' => 'estonian', 259 'eu' => 'west_european', 260 'fi' => 'west_european', 261 'fr' => 'west_european', 262 'eo' => 'unicode', // Esperanto 263 'eu' => 'west_european', // Basque 264 'fa' => 'arabic', // Persian 265 'fi' => 'west_european', // Finish 266 'fo' => 'west_european', // Faroese 267 'fr' => 'west_european', // French 262 268 'gr' => 'greek', 263 'hr' => 'east_european', 264 'hu' => 'east_european', 265 'iw' => 'hebrew', 266 'is' => 'west_european', 267 'it' => 'west_european', 269 'he' => 'hebrew', // Hebrew (since 1998) 270 'hi' => 'unicode', // Hindi 271 'hr' => 'east_european', // Croatian 272 'hu' => 'east_european', // Hungarian 273 'iw' => 'hebrew', // Hebrew (til 1998) 274 'is' => 'west_european', // Icelandic 275 'it' => 'west_european', // Italian 268 276 'ja' => 'japanese', 269 'kl' => 'west_european', 277 'kl' => 'west_european', // Greenlandic 270 278 'ko' => 'korean', 271 279 'lt' => 'lithuanian', 272 'lv' => 'west_european', // Latvian/Lettish 273 'nl' => 'west_european', 274 'no' => 'west_european', 275 'pl' => 'east_european', 276 'pt' => 'west_european', 277 'ro' => 'east_european', 278 'ru' => 'cyrillic', 279 'sk' => 'east_european', 280 'sl' => 'east_european', 281 'sv' => 'west_european', 280 'lv' => 'west_european', // Latvian/Lettish 281 'nl' => 'west_european', // Dutch 282 'no' => 'west_european', // Norwegian 283 'pl' => 'east_european', // Polish 284 'pt' => 'west_european', // Portuguese 285 'ro' => 'east_european', // Romanian 286 'ru' => 'cyrillic', // Russian 287 'sk' => 'east_european', // Slovak 288 'sl' => 'east_european', // Slovenian 289 'sr' => 'cyrillic', // Serbian 290 'sv' => 'west_european', // Swedish 282 291 'th' => 'thai', 283 'uk' => 'cyrillic', 292 'uk' => 'cyrillic', // Ukranian 284 293 'vi' => 'vietnamese', 285 294 'zh' => 'chinese', 286 295 // MS language codes, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_language_strings.asp 296 // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceinternational5/html/wce50conLanguageIdentifiersandLocales.asp 297 'ara' => 'arabic', 298 'bgr' => 'cyrillic', // Bulgarian 299 'cat' => 'west_european', // Catalan 287 300 'chs' => 'simpl_chinese', 288 301 'cht' => 'trad_chinese', 289 'csy' => 'east_european', 290 'dan' => 'west_european', 291 'deu' => 'west_european', 292 'dea' => 'west_european', 293 'des' => 'west_european', 294 'ena' => 'west_european', 295 'enc' => 'west_european', 296 'eng' => 'west_european', 297 'enz' => 'west_european', 298 'enu' => 'west_european', 299 'nld' => 'west_european', 300 'nlb' => 'west_european', 301 'fin' => 'west_european', 302 'fra' => 'west_european', 303 'frb' => 'west_european', 304 'frc' => 'west_european', 305 'frs' => 'west_european', 302 'csy' => 'east_european', // Czech 303 'dan' => 'west_european', // Danisch 304 'deu' => 'west_european', // German 305 'dea' => 'west_european', // German (Austrian) 306 'des' => 'west_european', // German (Swiss) 307 'ena' => 'west_european', // English (Australian) 308 'enc' => 'west_european', // English (Canadian) 309 'eng' => 'west_european', // English 310 'enz' => 'west_european', // English (New Zealand) 311 'enu' => 'west_european', // English (United States) 312 'euq' => 'west_european', // Basque 313 'fos' => 'west_european', // Faroese 314 'far' => 'arabic', // Persian 315 'fin' => 'west_european', // Finish 316 'fra' => 'west_european', // French 317 'frb' => 'west_european', // French (Belgian) 318 'frc' => 'west_european', // French (Canadian) 319 'frs' => 'west_european', // French (Swiss) 306 320 'ell' => 'greek', 307 'hun' => 'east_european', 308 'isl' => 'west_euorpean', 309 'ita' => 'west_european', 310 'its' => 'west_european', 321 'heb' => 'hebrew', 322 'hin' => 'unicode', // Hindi 323 'hun' => 'east_european', // Hungarian 324 'isl' => 'west_euorpean', // Icelandic 325 'ita' => 'west_european', // Italian 326 'its' => 'west_european', // Italian (Swiss) 311 327 'jpn' => 'japanese', 312 328 'kor' => 'korean', 313 'nor' => 'west_european', 314 'non' => 'west_european', 315 'plk' => 'east_european', 316 'ptg' => 'west_european', 317 'ptb' => 'west_european', 318 'rus' => 'east_european', 319 'sky' => 'east_european', 320 'esp' => 'west_european', 321 'esm' => 'west_european', 322 'esn' => 'west_european', 323 'sve' => 'west_european', 329 'lth' => 'lithuanian', 330 'lvi' => 'west_european', // Latvian/Lettish 331 'msl' => 'west_european', // Malay 332 'nlb' => 'west_european', // Dutch (Belgian) 333 'nld' => 'west_european', // Dutch 334 'nor' => 'west_european', // Norwegian (bokmal) 335 'non' => 'west_european', // Norwegian (nynorsk) 336 'plk' => 'east_european', // Polish 337 'ptg' => 'west_european', // Portuguese 338 'ptb' => 'west_european', // Portuguese (Brazil) 339 'rom' => 'east_european', // Romanian 340 'rus' => 'cyrillic', // Russian 341 'slv' => 'east_european', // Slovenian 342 'sky' => 'east_european', // Slovak 343 'srl' => 'east_european', // Serbian (Latin) 344 'srb' => 'cyrillic', // Serbian (Cyrillic) 345 'esp' => 'west_european', // Spanish (trad. sort) 346 'esm' => 'west_european', // Spanish (Mexican) 347 'esn' => 'west_european', // Spanish (internat. sort) 348 'sve' => 'west_european', // Swedish 349 'tha' => 'thai', 324 350 'trk' => 'turkish', 351 'ukr' => 'cyrillic', // Ukrainian 325 352 // English language names 353 'arabic' => 'arabic', 354 'basque' => 'west_european', 355 'bosnian' => 'east_european', 326 356 'bulgarian' => 'east_european', 327 357 'catalan' => 'west_european', … … 331 361 'dutch' => 'west_european', 332 362 'english' => 'west_european', 363 'esperanto' => 'unicode', 364 'estonian' => 'estonian', 365 'faroese' => 'west_european', 366 'farsi' => 'arabic', 333 367 'finnish' => 'west_european', 334 368 'french' => 'west_european', 335 369 'galician' => 'west_european', 336 370 'german' => 'west_european', 371 'greek' => 'greek', 372 'greenlandic' => 'west_european', 373 'hebrew' => 'hebrew', 374 'hindi' => 'unicode', 337 375 'hungarian' => 'east_european', 338 376 'icelandic' => 'west_european', … … 340 378 'latvian' => 'west_european', 341 379 'lettish' => 'west_european', 380 'lithuanian' => 'lithuanian', 381 'malay' => 'west_european', 342 382 'norwegian' => 'west_european', 383 'persian' => 'arabic', 343 384 'polish' => 'east_european', 344 385 'portuguese' => 'west_european', 345 386 'russian' => 'cyrillic', 346 387 'romanian' => 'east_european', 388 'serbian' => 'cyrillic', 347 389 'slovak' => 'east_european', 348 390 'slovenian' => 'east_european', 349 391 'spanish' => 'west_european', 350 392 'svedish' => 'west_european', 351 'turkish' => 'east_european', 393 'that' => 'thai', 394 'turkish' => 'turkish', 352 395 'ukrainian' => 'cyrillic', 353 396 ); 354 397 355 398 // mapping of language (family) names to charsets on Unix 356 var $ lang_to_charset_unix=array(399 var $script_to_charset_unix=array( 357 400 'west_european' => 'iso-8859-1', 358 401 'estonian' => 'iso-8859-1', … … 372 415 'trad_chinese' => 'big5', 373 416 'vietnamese' => '', 417 'unicode' => 'utf-8', 374 418 ); 375 419 376 420 // mapping of language (family) names to charsets on Windows 377 var $ lang_to_charset_windows=array(421 var $script_to_charset_windows=array( 378 422 'east_european' => 'windows-1250', 379 423 'cyrillic' => 'windows-1251', … … 400 444 'ja_jp.ujis' => 'euc-jp', 401 445 'korean.euc' => 'euc-kr', 446 'sr@Latn' => 'iso-8859-2', 402 447 'zh_cn' => 'gb2312', 403 448 'zh_hk' => 'big5', … … 450 495 'my' => '', 451 496 'hi' => 'utf-8', 497 'fo' => 'utf-8', 498 'fa' => 'utf-8', 499 'sr' => 'utf-8' 452 500 ); 453 501 454 502 // TYPO3 specific: Array with the iso names used for each system language in TYPO3: 455 // Empty values means samesas Typo3503 // Missing keys means: same as Typo3 456 504 var $isoArray = array( 505 'ba' => 'bs', 506 'br' => 'pt_BR', 507 'ch' => 'zh_CN', 508 'cz' => 'cs', 457 509 'dk' => 'da', 458 'de' => '',459 'no' => '',460 'it' => '',461 'fr' => '',462 'es' => '',463 'nl' => '',464 'cz' => 'cs',465 'pl' => '',466 510 'si' => 'sl', 467 'fi' => '',468 'tr' => '',469 511 'se' => 'sv', 470 'pt' => '', 471 'ru' => '', 472 'ro' => '', 473 'ch' => 'zh_CN', 474 'sk' => '', 475 'lt' => '', 476 'is' => '', 477 'hr' => '', 478 'hu' => '', 479 'gl' => '', // Greenlandic 480 'th' => '', 512 'gl' => 'kl', 481 513 'gr' => 'el', 482 514 'hk' => 'zh_HK', 483 'eu' => '', 484 'bg' => '', 485 'br' => 'pt_BR', 486 'et' => '', 487 'ar' => '', 488 'he' => 'iw', 515 'kr' => 'ko', 489 516 'ua' => 'uk', 490 517 'jp' => 'ja', 491 'lv' => '',492 518 'vn' => 'vi', 493 'ca' => '',494 'ba' => '', // Bosnian495 'kr' => '',496 519 ); 497 520 … … 540 563 // get language 541 564 list($language,$country) = explode('_',$locale); 542 if (isset($this->lang_to_ langfamily[$language])) $language = $this->lang_to_langfamily[$language];565 if (isset($this->lang_to_script[$language])) $script = $this->lang_to_script[$language]; 543 566 544 567 if (TYPO3_OS == 'WIN') { 545 $cs = $this-> lang_to_charset_windows[$language];568 $cs = $this->script_to_charset_windows[$script] ? $this->script_to_charset_windows[$script] : 'window-1252'; 546 569 } else { 547 $cs = $this-> lang_to_charset_unix[$language];548 } 549 550 return $cs ? $cs : 'iso-8859-1';570 $cs = $this->script_to_charset_unix[$script] ? $this->script_to_charset_unix[$script] : 'iso-8859-1'; 571 } 572 573 return $cs; 551 574 } 552 575 … … 587 610 588 611 case 'iconv': 589 $conv_str = iconv($fromCS,$toCS.'// TRANSLIT',$str);612 $conv_str = iconv($fromCS,$toCS.'//IGNORE',$str); 590 613 if (false !== $conv_str) return $conv_str; 591 614 break; … … 646 669 if (isset($this->twoByteSets[$charset])) { // If the charset has two bytes per char 647 670 $ord2 = ord($str{$a+1}); 648 $ord = $ord<<8 &$ord2; // assume big endian671 $ord = $ord<<8 | $ord2; // assume big endian 649 672 650 673 if (isset($this->parsedCharsets[$charset]['local'][$ord])) { // If the local char-number was found in parsed conv. table then we use that, otherwise 127 (no char?) … … 1519 1542 if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_utils'] == 'mbstring' && (float)phpversion() >= 4.3) { 1520 1543 if ($case == 'toLower') { 1521 returnmb_strtolower($string,$charset);1544 $string = mb_strtolower($string,$charset); 1522 1545 } else { 1523 returnmb_strtoupper($string,$charset);1546 $string = mb_strtoupper($string,$charset); 1524 1547 } 1525 1548 } elseif ($charset == 'utf-8') { 1526 return$this->utf8_char_mapping($string,'case',$case);1549 $string = $this->utf8_char_mapping($string,'case',$case); 1527 1550 } elseif (isset($this->eucBasedSets[$charset])) { 1528 return$this->euc_char_mapping($string,$charset,'case',$case);1551 $string = $this->euc_char_mapping($string,$charset,'case',$case); 1529 1552 } else { 1530 1553 // treat everything else as single-byte encoding 1531 return$this->sb_char_mapping($string,$charset,'case',$case);1554 $string = $this->sb_char_mapping($string,$charset,'case',$case); 1532 1555 } 1533 1556 … … 1544 1567 function specCharsToASCII($charset,$string) { 1545 1568 if ($charset == 'utf-8') { 1546 return$this->utf8_char_mapping($string,'ascii');1569 $string = $this->utf8_char_mapping($string,'ascii'); 1547 1570 } elseif (isset($this->eucBasedSets[$charset])) { 1548 return$this->euc_char_mapping($string,$charset,'ascii');1571 $string = $this->euc_char_mapping($string,$charset,'ascii'); 1549 1572 } else { 1550 1573 // treat everything else as single-byte encoding 1551 return$this->sb_char_mapping($string,$charset,'ascii');1574 $string = $this->sb_char_mapping($string,$charset,'ascii'); 1552 1575 } 1553 1576 … … 1742 1765 return mb_strrpos($haystack,$needle,'utf-8'); 1743 1766 } elseif ($GLOBALS['TYPO3_CONF_VARS']['SYS']['t3lib_cs_utils'] == 'iconv') { 1744 return iconv_strrpos($haystack,$needle, $offset,'utf-8');1767 return iconv_strrpos($haystack,$needle,'utf-8'); 1745 1768 } 1746 1769 releases/0.9/lib/typo3/class.t3lib_div.php
r269 r1441 28 28 * Contains the reknown class "t3lib_div" with general purpose functions 29 29 * 30 * $Id: class.t3lib_div.php,v 1. 93 2005/12/26 23:59:37 kurfuerstExp $30 * $Id: class.t3lib_div.php,v 1.2 2005/10/17 15:48:29 stronk7 Exp $ 31 31 * Revised for TYPO3 3.6 July/2003 by Kasper Skaarhoj 32 32 * XHTML compliant … … 467 467 * Returns a new string of max. $chars length. 468 468 * If the string is longer, it will be truncated and appended with '...'. 469 * DEPREC ATED. Works ONLY for single-byte charsets! USE t3lib_div::fixed_lgd_cs() instead469 * DEPRECIATED. Works ONLY for single-byte charsets! USE t3lib_div::fixed_lgd_cs() instead 470 470 * Usage: 39 471 471 * 472 * @param string string to truncate473 * @param integer must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end.472 * @param string $string string to truncate 473 * @param integer $chars must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end. 474 474 * @param string String to append to the output if it is truncated, default is '...' 475 475 * @return string new string … … 493 493 * If the string is longer, it will be truncated and prepended with '...'. 494 494 * This works like fixed_lgd, but is truncated in the start of the string instead of the end 495 * DEPREC ATED. Use either fixed_lgd() or fixed_lgd_cs() (with negative input value for $chars)495 * DEPRECIATED. Use either fixed_lgd() or fixed_lgd_cs() (with negative input value for $chars) 496 496 * Usage: 6 497 497 * 498 * @param string string to truncate499 * @param integer must be an integer of at least 4498 * @param string $string string to truncate 499 * @param integer $chars must be an integer of at least 4 500 500 * @return string new string 501 501 * @see fixed_lgd() … … 510 510 * Usage: 75 511 511 * 512 * @param string string to truncate513 * @param integer must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end.512 * @param string $string string to truncate 513 * @param integer $chars must be an integer with an absolute value of at least 4. if negative the string is cropped from the right end. 514 514 * @return string New string 515 515 * @see fixed_lgd() … … 624 624 * Match fully qualified domain name with list of strings with wildcard 625 625 * 626 * @param string The current remote IP address for instance, typ. REMOTE_ADDR627 * @param string Acomma-list of domain names to match with. *-wildcard allowed but cannot be part of a string, so it must match the full host name (eg. myhost.*.com => correct, myhost.*domain.com => wrong)626 * @param string $baseIP is the current remote IP address for instance, typ. REMOTE_ADDR 627 * @param string $list is a comma-list of domain names to match with. *-wildcard allowed but cannot be part of a string, so it must match the full host name (eg. myhost.*.com => correct, myhost.*domain.com => wrong) 628 628 * @return boolean True if a domain name mask from $list matches $baseIP 629 629 */ … … 666 666 * Usage: 1 667 667 * 668 * @param string element to remove669 * @param string comma-separated list of items (string)668 * @param string $element element to remove 669 * @param string $list comma-separated list of items (string) 670 670 * @return string new comma-separated list of items 671 671 */ … … 682 682 * Ranges are limited to 1000 values per range. 683 683 * 684 * @param string comma-separated list of integers with ranges (string)684 * @param string $list comma-separated list of integers with ranges (string) 685 685 * @return string new comma-separated list of items 686 686 * @author Martin Kutschker <martin.kutschker@activesolution.at> … … 752 752 753 753 /** 754 * Returns true if the current TYPO3 version (or compatibility version) is compatible to the input version755 *756 * @param string Minimum version number required (format x.y.z)757 * @return boolean true or false758 */759 function compat_version($verNumberStr) {760 global $TYPO3_CONF_VARS;761 $currVersionStr = $TYPO3_CONF_VARS['SYS']['compat_version']?$TYPO3_CONF_VARS['SYS']['compat_version']:TYPO3_version;762 763 if (t3lib_div::int_from_ver($currVersionStr) < t3lib_div::int_from_ver($verNumberStr)) {764 return FALSE;765 } else {766 return TRUE;767 }768 }769 770 /**771 754 * Makes a positive integer hash out of the first 7 chars from the md5 hash of the input 772 755 * Usage: 5 … … 798 781 * 799 782 * @param string Accept multiple parameters wich can be comma-separated lists of values and arrays. 800 * @param mixed $secondParameter: Dummy field, which i fset will show a warning!783 * @param mixed $secondParameter: Dummy field, which is set will show a warning! 801 784 * @return string Returns the list without any duplicates of values, space around values are trimmed 802 785 */ … … 905 888 /** 906 889 * strtoupper which converts danish (and other characters) characters as well 907 * (DEPREC ATED, use t3lib_cs::conv_case() instead or for HTML output, wrap your content in <span class="uppercase">...</span>)890 * (DEPRECIATED, use t3lib_cs::conv_case() instead or for HTML output, wrap your content in <span class="uppercase">...</span>) 908 891 * Usage: 0 909 892 * … … 920 903 * Change umlaut characters to plain ASCII with normally two character target 921 904 * Only known characters will be converted, so don't expect a result for any character. 922 * (DEPREC ATED: Works only for western europe single-byte charsets! Use t3lib_cs::specCharsToASCII() instead!)905 * (DEPRECIATED: Works only for western europe single-byte charsets! Use t3lib_cs::specCharsToASCII() instead!) 923 906 * 924 907 * ä => ae, Ö => Oe … … 1210 1193 * Usage: 3 1211 1194 * 1212 * @param array one-dimensional array of items1213 * @param string item to check for1195 * @param array $in_array one-dimensional array of items 1196 * @param string $item item to check for 1214 1197 * @return boolean true if $item is in the one-dimensional array $in_array 1215 1198 * @internal … … 2093 2076 2094 2077 // (Proxy support implemented by Arco <arco@appeltaart.mine.nu>) 2095 if ((substr($url,0,7)=='http://') && ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse']=='1')) {2078 if((substr($url,0,7)=='http://') && ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse']=='1')) { 2096 2079 //external URL without error checking. 2097 2080 $ch = curl_init(); … … 2114 2097 curl_close ($ch); 2115 2098 return $content; 2116 } elseif (function_exists('file_get_contents')) { 2117 return file_get_contents($url); 2118 } elseif ($fd = fopen($url,'rb')) { 2099 } elseif($fd = fopen($url,'rb')) { 2119 2100 while (!feof($fd)) { 2120 $content.=fread($fd, 4096);2101 $content.=fread($fd, 5000); 2121 2102 } 2122 2103 fclose($fd); 2123 2104 return $content; 2124 2105 } 2125 2126 return false;2127 2106 } 2128 2107 … … 2136 2115 */ 2137 2116 function writeFile($file,$content) { 2138 if (!@is_file($file)) { $changePermissions=true; } 2139 2140 if ($fd = fopen($file,'wb')) { 2141 $res = fwrite($fd,$content); 2142 fclose($fd ); 2143 2144 if (!$res) { 2145 return false; 2146 } 2147 if ($changePermissions) { // Change the permissions only if the file has just been created 2148 t3lib_div::fixPermissions($file); 2149 } 2117 if($fd = fopen($file,'wb')) { 2118 fwrite( $fd, $content); 2119 fclose( $fd ); 2120 2121 t3lib_div::fixPermissions($file); // Change the permissions of the file 2150 2122 2151 2123 return true; 2152 2124 } 2153 2154 return false;2155 2125 } 2156 2126 … … 2499 2469 */ 2500 2470 function debug($var="",$brOrHeader=0) { 2501 if ($brOrHeader && !t3lib_div::testInt($brOrHeader)) {2502 echo '<table class="typo3-debug" border="0" cellpadding="0" cellspacing="0" bgcolor="white" style="border:0px; margin-top:3px; margin-bottom:3px;"><tr><td style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;">'.htmlspecialchars((string)$brOrHeader).'</td></tr><tr><td>';2503 } elseif ($brOrHeader<0) {2471 if ($brOrHeader && !t3lib_div::testInt($brOrHeader)) { 2472 echo '<table border="0" cellpadding="0" cellspacing="0" bgcolor="white" style="border:0px; margin-top:3px; margin-bottom:3px;"><tr><td style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;">'.htmlspecialchars((string)$brOrHeader).'</td></tr><td>'; 2473 } elseif ($brOrHeader<0) { 2504 2474 for($a=0;$a<abs(intval($brOrHeader));$a++){echo '<br />';} 2505 2475 } … … 2511 2481 print_r($var); 2512 2482 echo '</pre>|</b>'; 2513 } elseif ((string)$var!='') {2483 } elseif ((string)$var!='') { 2514 2484 echo '<b>|'.htmlspecialchars((string)$var).'|</b>'; 2515 2485 } else { … … 2517 2487 } 2518 2488 2519 if ($brOrHeader && !t3lib_div::testInt($brOrHeader)) {2489 if ($brOrHeader && !t3lib_div::testInt($brOrHeader)) { 2520 2490 echo '</td></tr></table>'; 2521 } elseif ($brOrHeader>0) {2491 } elseif ($brOrHeader>0) { 2522 2492 for($a=0;$a<intval($brOrHeader);$a++){echo '<br />';} 2523 2493 } 2524 2494 } 2525 2495 2526 /** 2527 * 2528 */ 2529 function debug_trail() { 2530 if (function_exists('debug_backtrace')) { 2531 $trail = debug_backtrace(); 2532 $trail = array_reverse($trail); 2533 array_pop($trail); 2534 2535 $path = array(); 2536 foreach($trail as $dat) { 2537 $path[] = $dat['class'].$dat['type'].$dat['function']; 2538 } 2539 2540 return implode(' // ',$path); 2541 } else return 'N/A'; 2542 } 2543 2544 function debugRows($rows,$header) { 2545 if (is_array($rows)) { 2546 reset($rows); 2547 $firstEl = current($rows); 2548 if (is_array($firstEl)) { 2549 $headerColumns = array_keys($firstEl); 2550 $tRows = array(); 2551 2552 // Header: 2553 $tRows[] = '<tr><td colspan="'.count($headerColumns).'" style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;"><strong>'.htmlspecialchars($header).'</strong></td></tr>'; 2554 $tCells = array(); 2555 foreach($headerColumns as $key) { 2556 $tCells[] = ' 2557 <td><font face="Verdana,Arial" size="1"><strong>'.htmlspecialchars($key).'</strong></font></td>'; 2558 } 2559 $tRows[] = ' 2560 <tr>'.implode('',$tCells).' 2561 </tr>'; 2562 2563 // Rows: 2564 foreach($rows as $singleRow) { 2565 $tCells = array(); 2566 foreach($headerColumns as $key) { 2567 $tCells[] = ' 2568 <td><font face="Verdana,Arial" size="1">'.htmlspecialchars($singleRow[$key]).'</font></td>'; 2569 } 2570 $tRows[] = ' 2571 <tr>'.implode('',$tCells).' 2572 </tr>'; 2573 } 2574 2575 $table = ' 2576 <table border="1" cellpadding="1" cellspacing="0" bgcolor="white">'.implode('',$tRows).' 2577 </table>'; 
