@@ 713-752 (lines=40) @@ | ||
710 | } |
|
711 | } |
|
712 | ||
713 | public function loadLanguageFile($filename, $lang = null) { |
|
714 | global $language; |
|
715 | ||
716 | $lang = isset($lang) ? basename($lang) : basename($language); |
|
717 | ||
718 | if ( $lang != 'english' ) { |
|
719 | $this->loadLanguageFile($filename, 'english'); |
|
720 | } |
|
721 | ||
722 | $pathname = DIR_FS_CATALOG . 'includes/apps/braintree/languages/' . $lang . '/' . $filename; |
|
723 | ||
724 | if ( file_exists($pathname) ) { |
|
725 | $contents = file($pathname); |
|
726 | ||
727 | $ini_array = array(); |
|
728 | ||
729 | foreach ( $contents as $line ) { |
|
730 | $line = trim($line); |
|
731 | ||
732 | if ( !empty($line) && (substr($line, 0, 1) != '#') ) { |
|
733 | $delimiter = strpos($line, '='); |
|
734 | ||
735 | if ( ($delimiter !== false) && (preg_match('/^[A-Za-z0-9_-]/', substr($line, 0, $delimiter)) === 1) && (substr_count(substr($line, 0, $delimiter), ' ') == 1) ) { |
|
736 | $key = trim(substr($line, 0, $delimiter)); |
|
737 | $value = trim(substr($line, $delimiter + 1)); |
|
738 | ||
739 | $ini_array[$key] = $value; |
|
740 | } elseif ( isset($key) ) { |
|
741 | $ini_array[$key] .= "\n" . $line; |
|
742 | } |
|
743 | } |
|
744 | } |
|
745 | ||
746 | unset($contents); |
|
747 | ||
748 | $this->_definitions = array_merge($this->_definitions, $ini_array); |
|
749 | ||
750 | unset($ini_array); |
|
751 | } |
|
752 | } |
|
753 | ||
754 | function getDef($key, $values = null) { |
|
755 | $def = isset($this->_definitions[$key]) ? $this->_definitions[$key] : $key; |
@@ 765-804 (lines=40) @@ | ||
762 | } |
|
763 | } |
|
764 | ||
765 | public function loadLanguageFile($filename, $lang = null) { |
|
766 | global $language; |
|
767 | ||
768 | $lang = isset($lang) ? basename($lang) : basename($language); |
|
769 | ||
770 | if ( $lang != 'english' ) { |
|
771 | $this->loadLanguageFile($filename, 'english'); |
|
772 | } |
|
773 | ||
774 | $pathname = DIR_FS_CATALOG . 'includes/apps/paypal/languages/' . $lang . '/' . $filename; |
|
775 | ||
776 | if ( file_exists($pathname) ) { |
|
777 | $contents = file($pathname); |
|
778 | ||
779 | $ini_array = array(); |
|
780 | ||
781 | foreach ( $contents as $line ) { |
|
782 | $line = trim($line); |
|
783 | ||
784 | if ( !empty($line) && (substr($line, 0, 1) != '#') ) { |
|
785 | $delimiter = strpos($line, '='); |
|
786 | ||
787 | if ( ($delimiter !== false) && (preg_match('/^[A-Za-z0-9_-]/', substr($line, 0, $delimiter)) === 1) && (substr_count(substr($line, 0, $delimiter), ' ') == 1) ) { |
|
788 | $key = trim(substr($line, 0, $delimiter)); |
|
789 | $value = trim(substr($line, $delimiter + 1)); |
|
790 | ||
791 | $ini_array[$key] = $value; |
|
792 | } elseif ( isset($key) ) { |
|
793 | $ini_array[$key] .= "\n" . $line; |
|
794 | } |
|
795 | } |
|
796 | } |
|
797 | ||
798 | unset($contents); |
|
799 | ||
800 | $this->_definitions = array_merge($this->_definitions, $ini_array); |
|
801 | ||
802 | unset($ini_array); |
|
803 | } |
|
804 | } |
|
805 | ||
806 | function getDef($key, $values = null) { |
|
807 | $def = isset($this->_definitions[$key]) ? $this->_definitions[$key] : $key; |