Subversion Repositories oidplus

Rev

Rev 1116 | Rev 1130 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1116 Rev 1125
Line 896... Line 896...
896
                $out_type = 'text/xml';
896
                $out_type = 'text/xml';
897
                return array($out_content, $out_type);
897
                return array($out_content, $out_type);
898
        }
898
        }
899
 
899
 
900
        /**
900
        /**
901
         * @param $str
901
         * @param string $str
902
         * @return mixed|string
902
         * @return string
903
         */
903
         */
904
        private static function _formatdate($str) {
904
        private static function _formatdate(string $str): string {
905
                $str = explode(' ',$str)[0];
905
                $str = explode(' ',$str)[0];
906
                if ($str == '0000-00-00') $str = '';
906
                if ($str == '0000-00-00') $str = '';
907
                return $str;
907
                return $str;
908
        }
908
        }
909
 
909
 
Line 926... Line 926...
926
                }, $str);
926
                }, $str);
927
                return $str;
927
                return $str;
928
        }
928
        }
929
 
929
 
930
        /**
930
        /**
931
         * @param $address
931
         * @param string $address
932
         * @return array|string[]
932
         * @return string[]
933
         */
933
         */
934
        private static function split_address_country($address) {
934
        private static function split_address_country(string $address): array {
935
                global $oidinfo_countries;
935
                global $oidinfo_countries;
936
                $ary = explode("\n", $address);
936
                $ary = explode("\n", $address);
937
                $last_line = array_pop($ary);
937
                $last_line = array_pop($ary);
938
                $rest = implode("\n", $ary);
938
                $rest = implode("\n", $ary);
939
                if (isset($oidinfo_countries[$last_line])) {
939
                if (isset($oidinfo_countries[$last_line])) {
Line 963... Line 963...
963
        /**
963
        /**
964
         * @param $xml_contents
964
         * @param $xml_contents
965
         * @param $errors
965
         * @param $errors
966
         * @param $replaceExistingOIDs
966
         * @param $replaceExistingOIDs
967
         * @param $orphan_mode
967
         * @param $orphan_mode
968
         * @return array|int[]
968
         * @return int[]
969
         * @throws OIDplusException
969
         * @throws OIDplusException
970
         */
970
         */
971
        protected function oidinfoImportXML($xml_contents, &$errors, $replaceExistingOIDs=false, $orphan_mode=self::ORPHAN_AUTO_DEORPHAN) {
971
        protected function oidinfoImportXML($xml_contents, &$errors, $replaceExistingOIDs=false, $orphan_mode=self::ORPHAN_AUTO_DEORPHAN): array {
972
                // TODO: Implement RA import (let the user decide)
972
                // TODO: Implement RA import (let the user decide)
973
                // TODO: Let the user decide about $replaceExistingOIDs
973
                // TODO: Let the user decide about $replaceExistingOIDs
974
                // TODO: Let the user decide if "created=now" should be set (this is good when the XML files is created by the user itself to do bulk-inserts)
974
                // TODO: Let the user decide if "created=now" should be set (this is good when the XML files is created by the user itself to do bulk-inserts)
975
 
975
 
976
                $xml_contents = str_replace('<description>', '<description><![CDATA[', $xml_contents);
976
                $xml_contents = str_replace('<description>', '<description><![CDATA[', $xml_contents);