| @@ 685-724 (lines=40) @@ | ||
| 682 | } |
|
| 683 | } |
|
| 684 | ||
| 685 | public function loadLanguageFile($filename, $lang = null) { |
|
| 686 | global $language; |
|
| 687 | ||
| 688 | $lang = isset($lang) ? basename($lang) : basename($language); |
|
| 689 | ||
| 690 | if ( $lang != 'english' ) { |
|
| 691 | $this->loadLanguageFile($filename, 'english'); |
|
| 692 | } |
|
| 693 | ||
| 694 | $pathname = DIR_FS_CATALOG . 'includes/apps/braintree/languages/' . $lang . '/' . $filename; |
|
| 695 | ||
| 696 | if ( file_exists($pathname) ) { |
|
| 697 | $contents = file($pathname); |
|
| 698 | ||
| 699 | $ini_array = array(); |
|
| 700 | ||
| 701 | foreach ( $contents as $line ) { |
|
| 702 | $line = trim($line); |
|
| 703 | ||
| 704 | if ( !empty($line) && (substr($line, 0, 1) != '#') ) { |
|
| 705 | $delimiter = strpos($line, '='); |
|
| 706 | ||
| 707 | if ( ($delimiter !== false) && (preg_match('/^[A-Za-z0-9_-]/', substr($line, 0, $delimiter)) === 1) && (substr_count(substr($line, 0, $delimiter), ' ') == 1) ) { |
|
| 708 | $key = trim(substr($line, 0, $delimiter)); |
|
| 709 | $value = trim(substr($line, $delimiter + 1)); |
|
| 710 | ||
| 711 | $ini_array[$key] = $value; |
|
| 712 | } elseif ( isset($key) ) { |
|
| 713 | $ini_array[$key] .= "\n" . $line; |
|
| 714 | } |
|
| 715 | } |
|
| 716 | } |
|
| 717 | ||
| 718 | unset($contents); |
|
| 719 | ||
| 720 | $this->_definitions = array_merge($this->_definitions, $ini_array); |
|
| 721 | ||
| 722 | unset($ini_array); |
|
| 723 | } |
|
| 724 | } |
|
| 725 | ||
| 726 | function getDef($key, $values = null) { |
|
| 727 | $def = isset($this->_definitions[$key]) ? $this->_definitions[$key] : $key; |
|
| @@ 739-778 (lines=40) @@ | ||
| 736 | } |
|
| 737 | } |
|
| 738 | ||
| 739 | public function loadLanguageFile($filename, $lang = null) { |
|
| 740 | global $language; |
|
| 741 | ||
| 742 | $lang = isset($lang) ? basename($lang) : basename($language); |
|
| 743 | ||
| 744 | if ( $lang != 'english' ) { |
|
| 745 | $this->loadLanguageFile($filename, 'english'); |
|
| 746 | } |
|
| 747 | ||
| 748 | $pathname = DIR_FS_CATALOG . 'includes/apps/paypal/languages/' . $lang . '/' . $filename; |
|
| 749 | ||
| 750 | if ( file_exists($pathname) ) { |
|
| 751 | $contents = file($pathname); |
|
| 752 | ||
| 753 | $ini_array = array(); |
|
| 754 | ||
| 755 | foreach ( $contents as $line ) { |
|
| 756 | $line = trim($line); |
|
| 757 | ||
| 758 | if ( !empty($line) && (substr($line, 0, 1) != '#') ) { |
|
| 759 | $delimiter = strpos($line, '='); |
|
| 760 | ||
| 761 | if ( ($delimiter !== false) && (preg_match('/^[A-Za-z0-9_-]/', substr($line, 0, $delimiter)) === 1) && (substr_count(substr($line, 0, $delimiter), ' ') == 1) ) { |
|
| 762 | $key = trim(substr($line, 0, $delimiter)); |
|
| 763 | $value = trim(substr($line, $delimiter + 1)); |
|
| 764 | ||
| 765 | $ini_array[$key] = $value; |
|
| 766 | } elseif ( isset($key) ) { |
|
| 767 | $ini_array[$key] .= "\n" . $line; |
|
| 768 | } |
|
| 769 | } |
|
| 770 | } |
|
| 771 | ||
| 772 | unset($contents); |
|
| 773 | ||
| 774 | $this->_definitions = array_merge($this->_definitions, $ini_array); |
|
| 775 | ||
| 776 | unset($ini_array); |
|
| 777 | } |
|
| 778 | } |
|
| 779 | ||
| 780 | function getDef($key, $values = null) { |
|
| 781 | $def = isset($this->_definitions[$key]) ? $this->_definitions[$key] : $key; |
|