Browse code

php-iban ├╝ber composer einbinden

Bernd Wurst authored on 23/01/2018 18:20:13
Showing 22 changed files
... ...
@@ -4,6 +4,7 @@
4 4
     "license": "CC0-1.0",
5 5
     "require": {
6 6
         "bjeavons/zxcvbn-php": "0.3",
7
-        "giggsey/libphonenumber-for-php": "^8.8"
7
+        "giggsey/libphonenumber-for-php": "^8.8",
8
+        "globalcitizen/php-iban": "^2.6"
8 9
     }
9 10
 }
... ...
@@ -4,7 +4,7 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "d145356ef169caa8b33d4fe59422b14d",
7
+    "content-hash": "8e82fcd9fc27b40fafb297fc10633829",
8 8
     "packages": [
9 9
         {
10 10
             "name": "bjeavons/zxcvbn-php",
... ...
@@ -167,6 +167,34 @@
167 167
             ],
168 168
             "description": "Locale functions required by libphonenumber-for-php",
169 169
             "time": "2017-11-01T21:34:27+00:00"
170
+        },
171
+        {
172
+            "name": "globalcitizen/php-iban",
173
+            "version": "v2.6.1",
174
+            "source": {
175
+                "type": "git",
176
+                "url": "https://github.com/globalcitizen/php-iban.git",
177
+                "reference": "3de32bd2c02ebb5fe0694fd28d2d1a5d2f0ec291"
178
+            },
179
+            "dist": {
180
+                "type": "zip",
181
+                "url": "https://api.github.com/repos/globalcitizen/php-iban/zipball/3de32bd2c02ebb5fe0694fd28d2d1a5d2f0ec291",
182
+                "reference": "3de32bd2c02ebb5fe0694fd28d2d1a5d2f0ec291",
183
+                "shasum": ""
184
+            },
185
+            "type": "library",
186
+            "autoload": {
187
+                "files": [
188
+                    "oophp-iban.php",
189
+                    "php-iban.php"
190
+                ]
191
+            },
192
+            "notification-url": "https://packagist.org/downloads/",
193
+            "license": [
194
+                "LGPL-3.0"
195
+            ],
196
+            "description": "php-iban is a library for parsing and validating IBAN (and IIBAN) bank account information.",
197
+            "time": "2017-08-10T17:28:10+00:00"
170 198
         }
171 199
     ],
172 200
     "packages-dev": [],
173 201
deleted file mode 100644
... ...
@@ -1,165 +0,0 @@
1
-                   GNU LESSER GENERAL PUBLIC LICENSE
2
-                       Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
-  This version of the GNU Lesser General Public License incorporates
10
-the terms and conditions of version 3 of the GNU General Public
11
-License, supplemented by the additional permissions listed below.
12
-
13
-  0. Additional Definitions.
14
-
15
-  As used herein, "this License" refers to version 3 of the GNU Lesser
16
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
-General Public License.
18
-
19
-  "The Library" refers to a covered work governed by this License,
20
-other than an Application or a Combined Work as defined below.
21
-
22
-  An "Application" is any work that makes use of an interface provided
23
-by the Library, but which is not otherwise based on the Library.
24
-Defining a subclass of a class defined by the Library is deemed a mode
25
-of using an interface provided by the Library.
26
-
27
-  A "Combined Work" is a work produced by combining or linking an
28
-Application with the Library.  The particular version of the Library
29
-with which the Combined Work was made is also called the "Linked
30
-Version".
31
-
32
-  The "Minimal Corresponding Source" for a Combined Work means the
33
-Corresponding Source for the Combined Work, excluding any source code
34
-for portions of the Combined Work that, considered in isolation, are
35
-based on the Application, and not on the Linked Version.
36
-
37
-  The "Corresponding Application Code" for a Combined Work means the
38
-object code and/or source code for the Application, including any data
39
-and utility programs needed for reproducing the Combined Work from the
40
-Application, but excluding the System Libraries of the Combined Work.
41
-
42
-  1. Exception to Section 3 of the GNU GPL.
43
-
44
-  You may convey a covered work under sections 3 and 4 of this License
45
-without being bound by section 3 of the GNU GPL.
46
-
47
-  2. Conveying Modified Versions.
48
-
49
-  If you modify a copy of the Library, and, in your modifications, a
50
-facility refers to a function or data to be supplied by an Application
51
-that uses the facility (other than as an argument passed when the
52
-facility is invoked), then you may convey a copy of the modified
53
-version:
54
-
55
-   a) under this License, provided that you make a good faith effort to
56
-   ensure that, in the event an Application does not supply the
57
-   function or data, the facility still operates, and performs
58
-   whatever part of its purpose remains meaningful, or
59
-
60
-   b) under the GNU GPL, with none of the additional permissions of
61
-   this License applicable to that copy.
62
-
63
-  3. Object Code Incorporating Material from Library Header Files.
64
-
65
-  The object code form of an Application may incorporate material from
66
-a header file that is part of the Library.  You may convey such object
67
-code under terms of your choice, provided that, if the incorporated
68
-material is not limited to numerical parameters, data structure
69
-layouts and accessors, or small macros, inline functions and templates
70
-(ten or fewer lines in length), you do both of the following:
71
-
72
-   a) Give prominent notice with each copy of the object code that the
73
-   Library is used in it and that the Library and its use are
74
-   covered by this License.
75
-
76
-   b) Accompany the object code with a copy of the GNU GPL and this license
77
-   document.
78
-
79
-  4. Combined Works.
80
-
81
-  You may convey a Combined Work under terms of your choice that,
82
-taken together, effectively do not restrict modification of the
83
-portions of the Library contained in the Combined Work and reverse
84
-engineering for debugging such modifications, if you also do each of
85
-the following:
86
-
87
-   a) Give prominent notice with each copy of the Combined Work that
88
-   the Library is used in it and that the Library and its use are
89
-   covered by this License.
90
-
91
-   b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
-   document.
93
-
94
-   c) For a Combined Work that displays copyright notices during
95
-   execution, include the copyright notice for the Library among
96
-   these notices, as well as a reference directing the user to the
97
-   copies of the GNU GPL and this license document.
98
-
99
-   d) Do one of the following:
100
-
101
-       0) Convey the Minimal Corresponding Source under the terms of this
102
-       License, and the Corresponding Application Code in a form
103
-       suitable for, and under terms that permit, the user to
104
-       recombine or relink the Application with a modified version of
105
-       the Linked Version to produce a modified Combined Work, in the
106
-       manner specified by section 6 of the GNU GPL for conveying
107
-       Corresponding Source.
108
-
109
-       1) Use a suitable shared library mechanism for linking with the
110
-       Library.  A suitable mechanism is one that (a) uses at run time
111
-       a copy of the Library already present on the user's computer
112
-       system, and (b) will operate properly with a modified version
113
-       of the Library that is interface-compatible with the Linked
114
-       Version.
115
-
116
-   e) Provide Installation Information, but only if you would otherwise
117
-   be required to provide such information under section 6 of the
118
-   GNU GPL, and only to the extent that such information is
119
-   necessary to install and execute a modified version of the
120
-   Combined Work produced by recombining or relinking the
121
-   Application with a modified version of the Linked Version. (If
122
-   you use option 4d0, the Installation Information must accompany
123
-   the Minimal Corresponding Source and Corresponding Application
124
-   Code. If you use option 4d1, you must provide the Installation
125
-   Information in the manner specified by section 6 of the GNU GPL
126
-   for conveying Corresponding Source.)
127
-
128
-  5. Combined Libraries.
129
-
130
-  You may place library facilities that are a work based on the
131
-Library side by side in a single library together with other library
132
-facilities that are not Applications and are not covered by this
133
-License, and convey such a combined library under terms of your
134
-choice, if you do both of the following:
135
-
136
-   a) Accompany the combined library with a copy of the same work based
137
-   on the Library, uncombined with any other library facilities,
138
-   conveyed under the terms of this License.
139
-
140
-   b) Give prominent notice with the combined library that part of it
141
-   is a work based on the Library, and explaining where to find the
142
-   accompanying uncombined form of the same work.
143
-
144
-  6. Revised Versions of the GNU Lesser General Public License.
145
-
146
-  The Free Software Foundation may publish revised and/or new versions
147
-of the GNU Lesser General Public License from time to time. Such new
148
-versions will be similar in spirit to the present version, but may
149
-differ in detail to address new problems or concerns.
150
-
151
-  Each version is given a distinguishing version number. If the
152
-Library as you received it specifies that a certain numbered version
153
-of the GNU Lesser General Public License "or any later version"
154
-applies to it, you have the option of following the terms and
155
-conditions either of that published version or of any later version
156
-published by the Free Software Foundation. If the Library as you
157
-received it does not specify a version number of the GNU Lesser
158
-General Public License, you may choose any version of the GNU Lesser
159
-General Public License ever published by the Free Software Foundation.
160
-
161
-  If the Library as you received it specifies that a proxy can decide
162
-whether future versions of the GNU Lesser General Public License shall
163
-apply, that proxy's public statement of acceptance of any version is
164
-permanent authorization for you to choose that version for the
165
-Library.
166 0
deleted file mode 100644
... ...
@@ -1 +0,0 @@
1
-1.4.7
2 0
deleted file mode 100644
... ...
@@ -1,5 +0,0 @@
1
-{
2
-    "name": "php-iban/php-iban",
3
-    "description": "Parse and validate IBAN (and IIBAN) bank account information",
4
-    "version": "1.4.7"
5
-}
6 0
deleted file mode 100644
... ...
@@ -1,55 +0,0 @@
1
-This file lists specific errors observed in the official IBAN specification.
2
-
3
-In addition to the specific errors, there persist basic outstanding
4
-matters that cause issue for implementers:
5
- - Non 1:1 mapping of records to countries (eg: French territories, etc.)
6
- - Mixing of free text and hard data in specification fields
7
- - Lack of validation of information in fields prior to publishing
8
- - Lack of synchronisation between TXT and PDF versions of the registry
9
-
10
-2011-07-16
11
- - No information for Kuwait past sixth column
12
- - Total absence of information regarding Kazakhstan
13
- - '1.00001E+15' instead of a valid BBAN example for Lithuania
14
- - Repeated IBAN example in human format instead of IBAN format-
15
-   specification for UAE
16
- - Incorrect domestic example for Bulgaria, Kazakhstan, Latvia,
17
-   Lithuania, Luxembourg, Macedonia, Mauritius, Romania, San Marino
18
-   (complete, human-format IBAN instead of domestic example)
19
-
20
-Early 2012
21
- - Inconsistent record ordering (KW, KZ)
22
- - Inconsistent capitalization (DK)
23
- - Continued presence of incorrect domestic examples
24
-
25
-February 2013
26
- - Deployment of unparseable special values such as "Not in use" (FI).
27
- - Still(!) missing a registry entry for 2010's 'new' entry of Khazakstan
28
-
29
-September 2013
30
- - Azerbaijan, Brazil, Costa Rica, Palestine, Virgin Islands 'SEPA 
31
-   Country' field in PDF (yes/no) is completely blank
32
-
33
-March 2014
34
- - In multiple cases, territories of a major country have a SEPA status
35
-   that differs from the parent jurisdiction. The IBAN specification as
36
-   previously released does not include individual records for these
37
-   territories, and thus cannot convey this important information.
38
- - The IBAN registry's old URL is no longer publicly available! Its now
39
-   ends in a 404, and the apparent new home, located over at
40
-   http://www.swift.com/products_services/by_type/reference_data/iban_registry_iso13616
41
-   does not have any content. The parent portion of this part of the
42
-   SWIFT website suggests the information may have been moved to a new
43
-   'SWIFTRef' site, however that site appears to only peddle paid for
44
-   directories of BICs and similar. The new location after much
45
-   searching was found to be http://www.swift.com/products_services/bic_and_iban_format_registration_iban_format_r
46
-
47
-June 2014
48
- - The TXT registry records of QA and JO do not match those within the 
49
-   PDF and are essentially spurious while looking roughly correct. Dang.
50 0
deleted file mode 100644
51 1
Binary files a/external/php-iban/docs/ECBS standard implementation guidelines SIG203V3.2.pdf and /dev/null differ
52 2
deleted file mode 100644
... ...
@@ -1,63 +0,0 @@
1
-By unix tradition, this file outlines information that may be useful to
2
-people who wish to modify the php-iban project. It outlines some basic
3
-information around design decisions and other considerations.
4
-
5
- Procedural style
6
- ----------------
7
-   The code is written in PHP's original procedural style, and does
8
-   not require or assume any OO model. This is unix tradition and
9
-   should ease any integration pains due to objectspace mismatches.
10
-   In addition, it should make it easy for users both within an OO
11
-   or a procedural codebase to make use of the library. An OO wrapper
12
-   has been supplied to make things more familiar for those who are
13
-   only exposed to OO PHP: please try to keep it in synch with the
14
-   procedural (main) library where possible.
15
-
16
- Registry maintenance
17
- --------------------
18
-   The 'convert-registry.php' tool found in the 'utils/' subdirectory
19
-   is intended to assist with the automatic conversion of the SWIFT-
20
-   provided 'IBAN Registry' text files to the format required to
21
-   support php-iban execution. Why is there a new format, and why is it
22
-   distributed with php-iban instead of being generated on the fly
23
-   from SWIFT-provided data files? There are a few reasons:
24
-
25
-    - Error correction
26
-      If errors are discovered in the official specification then they
27
-      can be resolved by us. There are (or have been) known errors
28
-      with the official IBAN Registry. (See COMEDY-OF-ERRORS)
29
-
30
-    - Exclusion correction
31
-      If exclusions are discovered in the official specification then
32
-      they can be resolved by us. There are (or have been) known 
33
-      exclusions from the official IBAN Registry. (See COMEDY-OF-ERRORS)
34
-
35
-    - Efficiency
36
-      Because pattern matching is a core part of the functionality of
37
-      php-iban, and the pattern algorithms distributed by SWIFT are
38
-      (rather strangely) not in regular expression format, using their
39
-      files directly would result in a fairly significant startup
40
-      penalty as pattern conversion would be required (at each
41
-      invocation!) unless a caching strategy were deployed, which would
42
-      create additional complexity and sources of bugs (in addition,
43
-      due to the previous two points automatic conversion is not
44
-      presently possible ... and may never be!)
45
-
46
-    - Maintainability
47
-      Distribution of a modified registry along with php-iban places
48
-      the burden of registry maintenance on with the package 
49
-      maintainer(s) rather than with the user. This is better for
50
-      users who, if they really want, can still hack their local copy.
51
-
52
-   Note that due to points one and two, the 'convert-registry.php' tool
53
-   is insufficient to produce a correct 'registry.txt' file.  (You may
54
-   wish to review the differences between your newly generated file
55
-   and the original with the 'diff' tool in order to ascertain what
56
-   has changed.)
57
-
58
-   A closing point on the registry: obviously, if any new fields are
59
-   added, then it is best to append them to the end of the registry
60
-   (rightmost, new field) in order to preserve backwards compatibility
61
-   instead of re-ordering the fields which would break older installs.
62
-   (The internal '_iban_load_registry()' function re-orders these fields
63
-   at load time in order to simplify runtime debugging, anyway.)
64 0
deleted file mode 100644
65 1
Binary files a/external/php-iban/docs/ISO13616.pdf and /dev/null differ
66 2
deleted file mode 100644
... ...
@@ -1,165 +0,0 @@
1
-		   GNU LESSER GENERAL PUBLIC LICENSE
2
-                       Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
-  This version of the GNU Lesser General Public License incorporates
10
-the terms and conditions of version 3 of the GNU General Public
11
-License, supplemented by the additional permissions listed below.
12
-
13
-  0. Additional Definitions. 
14
-
15
-  As used herein, "this License" refers to version 3 of the GNU Lesser
16
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
-General Public License.
18
-
19
-  "The Library" refers to a covered work governed by this License,
20
-other than an Application or a Combined Work as defined below.
21
-
22
-  An "Application" is any work that makes use of an interface provided
23
-by the Library, but which is not otherwise based on the Library.
24
-Defining a subclass of a class defined by the Library is deemed a mode
25
-of using an interface provided by the Library.
26
-
27
-  A "Combined Work" is a work produced by combining or linking an
28
-Application with the Library.  The particular version of the Library
29
-with which the Combined Work was made is also called the "Linked
30
-Version".
31
-
32
-  The "Minimal Corresponding Source" for a Combined Work means the
33
-Corresponding Source for the Combined Work, excluding any source code
34
-for portions of the Combined Work that, considered in isolation, are
35
-based on the Application, and not on the Linked Version.
36
-
37
-  The "Corresponding Application Code" for a Combined Work means the
38
-object code and/or source code for the Application, including any data
39
-and utility programs needed for reproducing the Combined Work from the
40
-Application, but excluding the System Libraries of the Combined Work.
41
-
42
-  1. Exception to Section 3 of the GNU GPL.
43
-
44
-  You may convey a covered work under sections 3 and 4 of this License
45
-without being bound by section 3 of the GNU GPL.
46
-
47
-  2. Conveying Modified Versions.
48
-
49
-  If you modify a copy of the Library, and, in your modifications, a
50
-facility refers to a function or data to be supplied by an Application
51
-that uses the facility (other than as an argument passed when the
52
-facility is invoked), then you may convey a copy of the modified
53
-version:
54
-
55
-   a) under this License, provided that you make a good faith effort to
56
-   ensure that, in the event an Application does not supply the
57
-   function or data, the facility still operates, and performs
58
-   whatever part of its purpose remains meaningful, or
59
-
60
-   b) under the GNU GPL, with none of the additional permissions of
61
-   this License applicable to that copy.
62
-
63
-  3. Object Code Incorporating Material from Library Header Files.
64
-
65
-  The object code form of an Application may incorporate material from
66
-a header file that is part of the Library.  You may convey such object
67
-code under terms of your choice, provided that, if the incorporated
68
-material is not limited to numerical parameters, data structure
69
-layouts and accessors, or small macros, inline functions and templates
70
-(ten or fewer lines in length), you do both of the following:
71
-
72
-   a) Give prominent notice with each copy of the object code that the
73
-   Library is used in it and that the Library and its use are
74
-   covered by this License.
75
-
76
-   b) Accompany the object code with a copy of the GNU GPL and this license
77
-   document.
78
-
79
-  4. Combined Works.
80
-
81
-  You may convey a Combined Work under terms of your choice that,
82
-taken together, effectively do not restrict modification of the
83
-portions of the Library contained in the Combined Work and reverse
84
-engineering for debugging such modifications, if you also do each of
85
-the following:
86
-
87
-   a) Give prominent notice with each copy of the Combined Work that
88
-   the Library is used in it and that the Library and its use are
89
-   covered by this License.
90
-
91
-   b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
-   document.
93
-
94
-   c) For a Combined Work that displays copyright notices during
95
-   execution, include the copyright notice for the Library among
96
-   these notices, as well as a reference directing the user to the
97
-   copies of the GNU GPL and this license document.
98
-
99
-   d) Do one of the following:
100
-
101
-       0) Convey the Minimal Corresponding Source under the terms of this
102
-       License, and the Corresponding Application Code in a form
103
-       suitable for, and under terms that permit, the user to
104
-       recombine or relink the Application with a modified version of
105
-       the Linked Version to produce a modified Combined Work, in the
106
-       manner specified by section 6 of the GNU GPL for conveying
107
-       Corresponding Source.
108
-
109
-       1) Use a suitable shared library mechanism for linking with the
110
-       Library.  A suitable mechanism is one that (a) uses at run time
111
-       a copy of the Library already present on the user's computer
112
-       system, and (b) will operate properly with a modified version
113
-       of the Library that is interface-compatible with the Linked
114
-       Version. 
115
-
116
-   e) Provide Installation Information, but only if you would otherwise
117
-   be required to provide such information under section 6 of the
118
-   GNU GPL, and only to the extent that such information is
119
-   necessary to install and execute a modified version of the
120
-   Combined Work produced by recombining or relinking the
121
-   Application with a modified version of the Linked Version. (If
122
-   you use option 4d0, the Installation Information must accompany
123
-   the Minimal Corresponding Source and Corresponding Application
124
-   Code. If you use option 4d1, you must provide the Installation
125
-   Information in the manner specified by section 6 of the GNU GPL
126
-   for conveying Corresponding Source.)
127
-
128
-  5. Combined Libraries.
129
-
130
-  You may place library facilities that are a work based on the
131
-Library side by side in a single library together with other library
132
-facilities that are not Applications and are not covered by this
133
-License, and convey such a combined library under terms of your
134
-choice, if you do both of the following:
135
-
136
-   a) Accompany the combined library with a copy of the same work based
137
-   on the Library, uncombined with any other library facilities,
138
-   conveyed under the terms of this License.
139
-
140
-   b) Give prominent notice with the combined library that part of it
141
-   is a work based on the Library, and explaining where to find the
142
-   accompanying uncombined form of the same work.
143
-
144
-  6. Revised Versions of the GNU Lesser General Public License.
145
-
146
-  The Free Software Foundation may publish revised and/or new versions
147
-of the GNU Lesser General Public License from time to time. Such new
148
-versions will be similar in spirit to the present version, but may
149
-differ in detail to address new problems or concerns.
150
-
151
-  Each version is given a distinguishing version number. If the
152
-Library as you received it specifies that a certain numbered version
153
-of the GNU Lesser General Public License "or any later version"
154
-applies to it, you have the option of following the terms and
155
-conditions either of that published version or of any later version
156
-published by the Free Software Foundation. If the Library as you
157
-received it does not specify a version number of the GNU Lesser
158
-General Public License, you may choose any version of the GNU Lesser
159
-General Public License ever published by the Free Software Foundation.
160
-
161
-  If the Library as you received it specifies that a proxy can decide
162
-whether future versions of the GNU Lesser General Public License shall
163
-apply, that proxy's public statement of acceptance of any version is
164
-permanent authorization for you to choose that version for the
165
-Library.
166 0
deleted file mode 100644
... ...
@@ -1,207 +0,0 @@
1
-php-iban README
2
-
3
-php-iban is a library for parsing and validating International Bank
4
-Account Number (IBAN) information in PHP.
5
-
6
-It also validates Internet International Bank Account Number
7
-(IIBAN) as specified at http://tools.ietf.org/html/draft-iiban-01
8
-(see also http://www.ifex-project.org/our-proposals/iiban)
9
-
10
-php-iban lives at http://code.google.com/p/php-iban
11
-
12
-  What is an IBAN?
13
-  ----------------
14
-    An IBAN is basically a standardised way of explaining a bank
15
-    account number that works across borders.  Its structure is:
16
-
17
-     <Two Letter ISO Country Code> + <Two Digit Checksum] + <BBAN>
18
-    
19
-    BBAN is the term used to describe the national-level format
20
-    for a bank account number, which varies between countries
21
-    (and was sometimes created just to get IBAN connectivity!).
22
-    Note that a BBAN may have its own checksum algorithm.
23
-
24
-    IBAN provides basic protection, using the checksum, against
25
-    transcription (ie: human copying) errors. It also provides
26
-    a registry of valid destination countries and their BBAN
27
-    formats. Thus, when you ask php-iban to 'validate' an IBAN
28
-    it ensures that these checks are passed. However, it cannot
29
-    ensure that a bank account actually exists - the only party
30
-    who can do that is the receiving bank or country.
31
-
32
-    IBAN was invented in Europe, however its usage is growing
33
-    rapidly to other parts of the world. Thus, the future of
34
-    this library looks pretty good.
35
-
36
-    For further information, please see 'docs/ISO13616.pdf' or
37
-    visit Wikipedia at http://en.wikipedia.org/wiki/IBAN
38
-
39
-  What is an IIBAN?
40
-  -----------------
41
-   An Internet IBAN (IIBAN) identifies an internet-based financial
42
-   endpoint in a manner that is superset-compatible with the existing
43
-   European Committee for Banking Standards (ECBS) International Bank
44
-   Account Number (IBAN) standard [ISO13616].
45
-
46
-   For more information see http://tools.ietf.org/html/draft-iiban-00
47
-   and http://www.ifex-project.org/our-proposals/iiban
48
-
49
-   To disable IIBAN support from your installation, simply remove
50
-   the second ('AA|...') line from the top of the registry.txt file.
51
-
52
-  Execution environment
53
-  ---------------------
54
-    At present the library merely requires a PHP engine to be present
55
-    and has no external dependencies.  It is recommended that your
56
-    PHP engine is configured to disable verbose warnings for events
57
-    such as access of unknown array indexes, though this should be
58
-    standard on almost any PHP deployment today. Any PHP engine
59
-    in use today should be compatible, though PHP3 or PHP4 execution
60
-    environments may require minor modifications (specifically,
61
-    some string functions may have changed).
62
-
63
-  Installation
64
-  ------------
65
-    Simply copy 'php-iban.php' and 'registry.txt' to an appropriate
66
-    location for your project. The location of the files will affect
67
-    the 'require_once()' line used to load the library from your
68
-    codebase, and may have relevance security (see 'Security' below).
69
-    Note that 'php-iban.php' expects to find 'registry.txt' in the
70
-    same directory as itself.
71
-
72
-  Security
73
-  --------
74
-    Following best practice for library files, the location chosen 
75
-    for the php-iban.php and registry.txt files should ideally be 
76
-    outside of any web-accessible directories. Thus, if your 
77
-    web project lives in /var/www/myproject/htdocs/ then it would
78
-    be preferably to place php-iban in /var/www/myproject or some
79
-    other directory that is not visible to regular web users.
80
-    
81
-    Secondly, neither file should be writable by the web server
82
-    itself in order to prevent compromise of the execution path
83
-    (ie: getting hacked). So, for example if your web server runs
84
-    as user 'www', group 'www', you can ensure that the web server
85
-    has minimal required privileges against the files as follows
86
-    (note that you will need to be root to execute these commands):
87
-
88
-     # chown <myuser> php-iban registry.txt  # where <myuser> is a
89
-                                             # non-root user that
90
-                                             # is not 'www'.
91
-     # chgrp www php-iban registry.txt       # set group to 'www'
92
-     # chmod ugo-rwx php-iban registry.txt   # remove privileges
93
-     # chmod g+r php-iban registry.txt       # allow 'www' group
94
-                                             # to read the files
95
-
96
-    Obviously the above do not apply if you are using PHP in a 
97
-    non web-oriented project (eg: a cronjob or daemon), a usage
98
-    of the language that is apparently growing - but limited.
99
-
100
-  Using the library
101
-  -----------------
102
-    Basic invocation is as follows:
103
-
104
-      # include the library
105
-      require_once('/path/to/php-iban.php'); # /path/to/ is optional
106
-
107
-      # use some library function or other...
108
-      if(!verify_iban($iban_to_verify)) {
109
-       # blame the user...
110
-      }
111
-
112
-    Note that because the library is designed in a procedural manner
113
-    rather than an object-oriented manner it should be easy to 
114
-    integrate with a wide variety of established codebases and 
115
-    PHP interpreter versions.
116
-
117
-  Using the library's OO wrapper
118
-  ------------------------------
119
-    Because many new PHP programmers seems to learn the language via
120
-    books that only teach OO based programming and are thus unfamiliar
121
-    with procedural PHP (and often relatively inexperienced as 
122
-    programmers, too) an OO wrapper-library has been provided.
123
-
124
-    ======================= READ THIS =================================
125
-    However *you should avoid excessive use of OO*. For some thought
126
-    provoking discussions of the negative aspects of overusing OO,
127
-    please refer to 'Coders at Work' and 'The Art of UNIX Programming'.
128
-    (OO is great for some problems, but simply pointless for most.)
129
-    ===================================================================
130
-
131
-    Anyway, to use the OO wrapper supplied, invocation is as follows:
132
-
133
-      # include the OO wrapper to the library
134
-      require_once('/path/to/oophp-iban.php'); # /path/to is optional
135
-
136
-      # instantiate an IBAN object
137
-      $myIban = new IBAN('AZ12345678901234');
138
-      if(!$myIban->Verify()) {
139
-       # blame the user...
140
-      }
141
-
142
-  Documentation
143
-  -------------
144
-    There are three types of functions provided by the library:
145
-
146
-     - IBAN-level functions
147
-
148
-         These are functions that operate on an IBAN. All of these
149
-         functions accept either machine format or human format
150
-         IBANs as input. Typically they return facts about an IBAN
151
-         as their output (for example whether it is valid or not,
152
-         or the BBAN (national-level) portion of the IBAN), though
153
-         some of them may perform other functions (eg: fixing a
154
-         broken IBAN checksum). These functions are named 'iban_*'
155
-         with the exception of the most commonly used function,
156
-         'verify_iban()', and excepting the country-level functions.
157
-
158
-         (Regarding the object oriented wrapper - all of these
159
-          functions are implemented as methods on IBAN objects)
160
-
161
-     - IBAN country-level functions
162
-         These functions return information about countries that are
163
-         part of the IBAN standard. They each take the two letter 
164
-         ISO country code at the beginning of an IBAN as their
165
-         argument. They are named 'iban_country_*', with the 
166
-         exception of 'iban_countries()' which returns a list of
167
-         the known IBAN countries. (For example, functions that 
168
-         return an example IBAN or BBAN for the country, or the 
169
-         name of the country.)
170
-
171
-         (Regarding the object oriented wrapper - all of these
172
-          functions are implemented as methods on IBANCountry
173
-          objects, except for 'iban_countries()' which is 
174
-          implemented as the Countries() method on the IBAN class)
175
-
176
-     - Internal functions
177
-         These functions begin with '_iban_*' and can be ignored.
178
-
179
-         (Regarding the object oriented wrapper - these functions
180
-          are not present)
181
-
182
-    Please refer to either http://code.google.com/p/php-iban or the
183
-    commented source code of php-iban itself for the complete list of
184
-    which functions are available. Of course, in unix style one could
185
-    achieve the same in a pinch as follows (instant documentation!):
186
-     $ grep function php-iban.php
187
-     $ egrep '(Class|function)' oophp-iban.php
188
-
189
-  Community
190
-  ---------
191
-    You are encouraged to contribute bugs, feedback and suggestions 
192
-    through the project's website.
193
-
194
-    Particularly if you deploy php-iban in a commercial setting, you are
195
-    STRONGLY encouraged to join the project's mailing list, which can
196
-    be found via the website. Joining the mailing list ensures that you
197
-    can be made aware of important updates. Important updates include:
198
-     - Updates to new registry editions (support new countries that have
199
-       been added to the IBAN system)
200
-     - Bug fixes 
201
-     - Security updates
202
-
203
-    The email list receives almost no traffic and as a 'Google Group' is
204
-    well protected from spam, so don't worry about junk in your inbox.
205
-
206
-Thanks for choosing php-iban! You have excellent taste in software ;)
207 0
deleted file mode 100644
... ...
@@ -1,17 +0,0 @@
1
-To get the latest ISO13616 IBAN registry, go to:
2
- http://www.swift.com/products_services/bic_and_iban_format_registration_iban_format_r
3
-
4
-TXT format:
5
- http://www.swift.com/dsp/resources/documents/IBAN_Registry.txt
6
-
7
-PDF format:
8
- http://www.swift.com/dsp/resources/documents/IBAN_Registry.pdf
9
-
10
-Unfortunately, it has been noticed in 2011 that the official .txt file is
11
-not an accurate representation of the PDF format specification, and lacks
12
-some information. It is hoped that in future SWIFT will be more careful to
13
-publish only correct standards information.
14
-
15
-It has been noted in 2014 that this is still the case.
16
-
17
-(For more information on this subject, see the HACKING file)
18 0
deleted file mode 100644
... ...
@@ -1,9 +0,0 @@
1
-Interpreting the SEPA Field
2
-===========================
3
-
4
-Note that some IIBAN providers may in fact provide SEPA connectivity.
5
-
6
-Thus, implementers are reminded to consider the reported SEPA status
7
-of a country within the registry as confirming rather than negating
8
-the potential SEPA status of a potential financial institution who
9
-may be party to a proposed transaction.
10 0
deleted file mode 100644
... ...
@@ -1,21 +0,0 @@
1
-TODO
2
-
3
- - Finnish record suggests position at which to pad domestic account
4
-   numbers in order to reach a BBAN / IBAN, this data could be of
5
-   some use for certain applications and would be nice to include
6
- - Addition of information regarding preferred human-level formatting
7
-   for each country's BBAN - worthwhile?
8
- - Addition of 'date effective' information for records such as BH
9
-   and the UAE that published data in advance of deployment
10
- - Support for calculating or validating any known national (sub-
11
-   BBAN-level) checksum algorithms?
12
- - URLs to national-level BBAN format specifications
13
- - Consider adding a library of localised forms and abbreviations
14
-   for account number portions, for example Austria and Germany seem
15
-   to have 'Kontonummer' (KTO) for account number, and 'Bankleitzah'
16
-   (BLZ) for bank identifier. This could assist greatly with 
17
-   deployments requiring international and/or constrained input.
18
- - Consider building a library of national-level bank or payment
19
-   institution identifier codes. This would be rather large and an
20
-   optional extension and would be in competition with SWIFTRef.
21 0
deleted file mode 100644
... ...
@@ -1,49 +0,0 @@
1
- ; formalities
2
- input-roman = number / letter
3
- number      = c-0 / c-1 / c-2 / c-3 / c-4 / c-5 / c-6 / c-7 / c-8 / c-9
4
- letter      = c-a / c-b / c-c / c-d / c-e / c-f / c-g / c-h / c-i / c-j
5
-                   / c-k / c-l / c-m / c-n / c-o / c-p / c-q / c-r / c-s
6
-                   / c-t / c-u / c-v / c-w / c-x / c-y / c-z
7
-
8
- ; possible sources of mistranscribed numbers
9
- c-0 = "O" / "6" / "D" / "G"
10
- c-1 = "I" / "L" / "7" / "2" / "Z"
11
- c-2 = "Z" / "7" / "P" / "E" / "1"
12
- c-3 = "8" / "B"
13
- c-4 = "G" / "U"
14
- c-5 = "S" / "7"
15
- c-6 = "0" / "O" / "8" / "G" / "C" / "B" / "D"
16
- c-7 = "J" / "I" / "1" / "L"
17
- c-8 = "B" / "3" / "6"
18
- c-9 = "G" / "Y" / "O" / "0" / "D"
19
-
20
- ; possible sources of mistranscribed letters
21
- c-a = "G" / "Q" / "O" / "0"
22
- c-b = "6" / "3" / "8" / "P" / "0" / "O"
23
- c-c = "R" / "6" / "I" / "L" / "O" / "0"
24
- c-d = "0" / "O" / "9" / "Q" / "G" / "6" / "A"
25
- c-e = "F" / "G" / "0" / "2" / "K" / "Z" / "S" / "O"
26
- c-f = "E" / "K" / "T" / "P" / "Y" / "4" / "B" / "7" / "1"
27
- c-g = "9" / "Q" / "8" / "6" / "0" / "C" / "4" / "O"
28
- c-h = "B" / "N" / "A" / "4" / "6" / "M" / "W" / "F" / "R" / "T" / "X"
29
- c-i = "1" / "L" / "7" / "J" / "2" / "T" / "Z"
30
- c-j = "I" / "7" / "2" / "9" / "1" / "U" / "T" / "Q" / "P" / "Y" / "Z"
31
-           / "L" / "S"
32
- c-k = "F" / "X" / "H" / "R" 
33
- c-l = "1" / "2" / "7" / "C" / "I" / "J" / "R" / "T" / "Y" / "Z"
34
- c-m = "H" / "8" / "E" / "3" / "N" / "V" / "W" 
35
- c-n = "H" / "R" / "C" / "2" / "4" / "M" / "O" / "P" / "K" / "T" / "Z"
36
- c-o = "0" / "6" / "9" / "A" / "D" / "G" / "C" / "E" / "B" / "N" / "P"
37
-           / "Q" / "R"
38
- c-p = "F" / "4" / "8" / "2" / "B" / "J" / "R" / "N" / "O" / "T" / "Y"
39
- c-q = "O" / "G" / "9" / "Y" / "1" / "7" / "L"
40
- c-r = "K" / "B" / "V" / "C" / "1" / "L" / "2"
41
- c-s = "5" / "6" / "9" / "B" / "G" / "Q" / "A" / "Y"
42
- c-t = "1" / "4" / "7" / "F" / "I" / "J" / "L" / "P" / "X" / "Y"
43
- c-u = "V" / "N" / "A" / "4" / "9" / "W" / "Y"
44
- c-v = "U" / "R" / "N"
45
- c-w = "M" / "N" / "U" / "V"
46
- c-x = "K" / "F" / "4" / "T" / "V" / "Y"
47
- c-y = "G" / "V" / "J" / "I" / "4" / "9" / "T" / "F" / "Q" / "1"
48
- c-z = "2" / "1" / "L" / "R" / "I" / "7" / "V" / "3" / "4"
49
-
50 0
deleted file mode 100644
... ...
@@ -1,157 +0,0 @@
1
-<?php
2
-
3
-# OO wrapper for 'php-iban.php'
4
-Class IBAN {
5
-
6
- function __construct($iban = '') {
7
-  require_once('php-iban.php'); # load the procedural codebase
8
-  $this->iban = $iban;
9
- }
10
-
11
- public function Verify($iban='') {
12
-  if($iban!='') { return verify_iban($iban); }
13
-  return verify_iban($this->iban);
14
-  # we could throw exceptions of various types, but why - does it really
15
-  # add anything? possibly some slightly better user feedback potential.
16
-  # however, this can be written by hand by performing individual checks
17
-  # ala the code in verify_iban() itself where required, which is likely
18
-  # almost never. for the increased complexity and
19
-  # maintenance/documentation cost, i say, therefore: no. no exceptions.
20
- }
21
-
22
- public function MistranscriptionSuggestions() {
23
-  return iban_mistranscription_suggestions($this->iban);
24
- }
25
-
26
- public function MachineFormat() {
27
-  return iban_to_machine_format($this->iban);
28
- }
29
-
30
- public function HumanFormat() {
31
-  return iban_to_human_format($this->iban);
32
- }
33
-
34
- public function Country($iban='') {
35
-  return iban_get_country_part($this->iban);
36
- }
37
-
38
- public function Checksum($iban='') {
39
-  return iban_get_checksum_part($this->iban);
40
- }
41
-
42
- public function BBAN() {
43
-  return iban_get_bban_part($this->iban);
44
- }
45
-
46
- public function VerifyChecksum() {
47
-  return iban_verify_checksum($this->iban);
48
- }
49
-
50
- public function FindChecksum() {
51
-  return iban_find_checksum($this->iban);
52
- }
53
-
54
- public function SetChecksum() {
55
-  $this->iban = iban_set_checksum($this->iban);
56
- }
57
-
58
- public function ChecksumStringReplace() {
59
-  return iban_checksum_string_replace($this->iban);
60
- }
61
-
62
- public function Parts() {
63
-  return iban_get_parts($this->iban);
64
- }
65
-
66
- public function Bank() {
67
-  return iban_get_bank_part($this->iban);
68
- }
69
-
70
- public function Branch() {
71
-  return iban_get_branch_part($this->iban);
72
- }
73
-
74
- public function Account() {
75
-  return iban_get_account_part($this->iban);
76
- }
77
-
78
- public function Countries() {
79
-  return iban_countries();
80
- }
81
-}
82
-
83
-# IBANCountry
84
-Class IBANCountry {
85
-
86
- # constructor with code
87
- function __construct($code = '') {
88
-  $this->code = $code;
89
- }
90
-
91
- public function Name() {
92
-  return iban_country_get_country_name($this->code);
93
- }
94
-
95
- public function DomesticExample() {
96
-  return iban_country_get_domestic_example($this->code);
97
- }
98
-
99
- public function BBANExample() {
100
-  return iban_country_get_bban_example($this->code);
101
- }
102
-
103
- public function BBANFormatSWIFT() {
104
-  return iban_country_get_bban_format_swift($this->code);
105
- }
106
-
107
- public function BBANFormatRegex() {
108
-  return iban_country_get_bban_format_regex($this->code);
109
- }
110
-
111
- public function BBANLength() {
112
-  return iban_country_get_bban_length($this->code);
113
- }
114
-
115
- public function IBANExample() {
116
-  return iban_country_get_iban_example($this->code);
117
- }
118
-
119
- public function IBANFormatSWIFT() {
120
-  return iban_country_get_iban_format_swift($this->code);
121
- }
122
-
123
- public function IBANFormatRegex() {
124
-  return iban_country_get_iban_format_regex($this->code);
125
- }
126
-
127
- public function IBANLength() {
128
-  return iban_country_get_iban_length($this->code);
129
- }
130
-
131
- public function BankIDStartOffset() {
132
-  return iban_country_get_bankid_start_offset($this->code);
133
- }
134
-
135
- public function BankIDStopOffset() {
136
-  return iban_country_get_bankid_stop_offset($this->code);
137
- }
138
-
139
- public function BranchIDStartOffset() {
140
-  return iban_country_get_branchid_start_offset($this->code);
141
- }
142
-
143
- public function BranchIDStopOffset() {
144
-  return iban_country_get_branchid_stop_offset($this->code);
145
- }
146
-
147
- public function RegistryEdition() {
148
-  return iban_country_get_registry_edition($this->code);
149
- }
150
-
151
- public function IsSEPA() {
152
-  return iban_country_is_sepa($this->code);
153
- }
154
-
155
-}
156
-
157
-?>
158 0
deleted file mode 100644
... ...
@@ -1,486 +0,0 @@
1
-<?php
2
-
3
-# PHP IBAN - http://code.google.com/p/php-iban - LGPLv3
4
-
5
-# Global flag by request
6
-$__disable_iiban_gmp_extension=false;
7
-
8
-# Verify an IBAN number.  Returns true or false.
9
-#  NOTE: Input can be printed 'IIBAN xx xx xx...' or 'IBAN xx xx xx...' or machine 'xxxxx' format.
10
-function verify_iban($iban) {
11
-
12
- # First convert to machine format.
13
- $iban = iban_to_machine_format($iban);
14
-
15
- # Get country of IBAN
16
- $country = iban_get_country_part($iban);
17
-
18
- # Test length of IBAN
19
- if(strlen($iban)!=iban_country_get_iban_length($country)) { return false; }
20
-
21
- # Get checksum of IBAN
22
- $checksum = iban_get_checksum_part($iban);
23
-
24
- # Get country-specific IBAN format regex
25
- $regex = '/'.iban_country_get_iban_format_regex($country).'/';
26
-
27
- # Check regex
28
- if(preg_match($regex,$iban)) {
29
-  # Regex passed, check checksum
30
-  if(!iban_verify_checksum($iban)) { 
31
-   return false;
32
-  }
33
- }
34
- else {
35
-  return false;
36
- }
37
-
38
- # Otherwise it 'could' exist
39
- return true;
40
-}
41
-
42
-# Convert an IBAN to machine format.  To do this, we
43
-# remove IBAN from the start, if present, and remove
44
-# non basic roman letter / digit characters
45
-function iban_to_machine_format($iban) {
46
- # Uppercase and trim spaces from left
47
- $iban = ltrim(strtoupper($iban));
48
- # Remove IIBAN or IBAN from start of string, if present
49
- $iban = preg_replace('/^I?IBAN/','',$iban);
50
- # Remove all non basic roman letter / digit characters
51
- $iban = preg_replace('/[^a-zA-Z0-9]/','',$iban);
52
- return $iban;
53
-}
54
-
55
-# Convert an IBAN to human format. To do this, we
56
-# simply insert spaces right now, as per the ECBS
57
-# (European Committee for Banking Standards) 
58
-# recommendations available at:
59
-# http://www.europeanpaymentscouncil.eu/knowledge_bank_download.cfm?file=ECBS%20standard%20implementation%20guidelines%20SIG203V3.2.pdf 
60
-function iban_to_human_format($iban) {
61
- # First verify validity, or return
62
- if(!verify_iban($iban)) { return false; }
63
- # Add spaces every four characters
64
- $human_iban = '';
65
- for($i=0;$i<strlen($iban);$i++) {
66
-  $human_iban .= substr($iban,$i,1);
67
-  if(($i>0) && (($i+1)%4==0)) { $human_iban .= ' '; }
68
- }
69
- return $human_iban;
70
-}
71
-
72
-# Get the country part from an IBAN
73
-function iban_get_country_part($iban) {
74
- $iban = iban_to_machine_format($iban);
75
- return substr($iban,0,2);
76
-}
77
-
78
-# Get the checksum part from an IBAN
79
-function iban_get_checksum_part($iban) {
80
- $iban = iban_to_machine_format($iban);
81
- return substr($iban,2,2);
82
-}
83
-
84
-# Get the BBAN part from an IBAN
85
-function iban_get_bban_part($iban) {
86
- $iban = iban_to_machine_format($iban);
87
- return substr($iban,4);
88
-}
89
-
90
-# Check the checksum of an IBAN - code modified from Validate_Finance PEAR class
91
-function iban_verify_checksum($iban) {
92
- # convert to machine format
93
- $iban = iban_to_machine_format($iban);
94
- # move first 4 chars (countrycode and checksum) to the end of the string
95
- $tempiban = substr($iban, 4).substr($iban, 0, 4);
96
- # subsitutute chars
97
- $tempiban = iban_checksum_string_replace($tempiban);
98
- # mod97-10
99
- $result = iban_mod97_10($tempiban);
100
- # checkvalue of 1 indicates correct IBAN checksum
101
- if ($result != 1) {
102
-  return false;
103
- }
104
- return true;
105
-}
106
-
107
-# Find the correct checksum for an IBAN
108
-#  $iban  The IBAN whose checksum should be calculated
109
-function iban_find_checksum($iban) {
110
- $iban = iban_to_machine_format($iban);
111
- # move first 4 chars to right
112
- $left = substr($iban,0,2) . '00'; # but set right-most 2 (checksum) to '00'
113
- $right = substr($iban,4);
114
- # glue back together
115
- $tmp = $right . $left;
116
- # convert letters using conversion table
117
- $tmp = iban_checksum_string_replace($tmp);
118
- # get mod97-10 output
119
- $checksum = iban_mod97_10_checksum($tmp);
120
- # return 98 minus the mod97-10 output, left zero padded to two digits
121
- return str_pad((98-$checksum),2,'0',STR_PAD_LEFT);
122
-}
123
-
124
-# Set the correct checksum for an IBAN
125
-#  $iban  IBAN whose checksum should be set
126
-function iban_set_checksum($iban) {
127
- $iban = iban_to_machine_format($iban);
128
- return substr($iban,0,2) . iban_find_checksum($iban) . substr($iban,4);
129
-}
130
-
131
-# Character substitution required for IBAN MOD97-10 checksum validation/generation
132
-#  $s  Input string (IBAN)
133
-function iban_checksum_string_replace($s) {
134
- $iban_replace_chars = range('A','Z');
135
- foreach (range(10,35) as $tempvalue) { $iban_replace_values[]=strval($tempvalue); }
136
- return str_replace($iban_replace_chars,$iban_replace_values,$s);
137
-}
138
-
139
-# Same as below but actually returns resulting checksum
140
-function iban_mod97_10_checksum($numeric_representation) {
141
- $checksum = intval(substr($numeric_representation, 0, 1));
142
- for ($position = 1; $position < strlen($numeric_representation); $position++) {
143
-  $checksum *= 10;
144
-  $checksum += intval(substr($numeric_representation,$position,1));
145
-  $checksum %= 97;
146
- }
147
- return $checksum;
148
-}
149
-
150
-# Perform MOD97-10 checksum calculation ('Germanic-level effiency' version - thanks Chris!)
151
-function iban_mod97_10($numeric_representation) {
152
- global $__disable_iiban_gmp_extension;
153
- # prefer php5 gmp extension if available
154
- if(!($__disable_iiban_gmp_extension) && function_exists('gmp_intval')) { return gmp_intval(gmp_mod(gmp_init($numeric_representation, 10),'97')) === 1; }
155
-
156
-/*
157
- # old manual processing (~16x slower)
158
- $checksum = intval(substr($numeric_representation, 0, 1));
159
- for ($position = 1; $position < strlen($numeric_representation); $position++) {
160
-  $checksum *= 10;
161
-  $checksum += intval(substr($numeric_representation,$position,1));
162
-  $checksum %= 97;
163
- }
164
- return $checksum;
165
- */
166
-
167
- # new manual processing (~3x slower)
168
- $length = strlen($numeric_representation);
169
- $rest = "";
170
- $position = 0;
171
- while ($position < $length) {
172
-        $value = 9-strlen($rest);
173
-        $n = $rest . substr($numeric_representation,$position,$value);
174
-        $rest = $n % 97;
175
-        $position = $position + $value;
176
- }
177
- return ($rest === 1);
178
-}
179
-
180
-# Get an array of all the parts from an IBAN
181
-function iban_get_parts($iban) {
182
- return array(
183
-         'country'	=>      iban_get_country_part($iban),
184
- 	 'checksum'	=>	iban_get_checksum_part($iban),
185
-	 'bban'		=>	iban_get_bban_part($iban),
186
- 	 'bank'		=>	iban_get_bank_part($iban),
187
-	 'country'	=>	iban_get_country_part($iban),
188
-	 'branch'	=>	iban_get_branch_part($iban),
189
-	 'account'	=>	iban_get_account_part($iban)
190
-        );
191
-}
192
-
193
-# Get the Bank ID (institution code) from an IBAN
194
-function iban_get_bank_part($iban) {
195
- $iban = iban_to_machine_format($iban);
196
- $country = iban_get_country_part($iban);
197
- $start = iban_country_get_bankid_start_offset($country);
198
- $stop = iban_country_get_bankid_stop_offset($country);
199
- if($start!=''&&$stop!='') {
200
-  $bban = iban_get_bban_part($iban);
201
-  return substr($bban,$start,($stop-$start+1));
202
- }
203
- return '';
204
-}
205
-
206
-# Get the Branch ID (sort code) from an IBAN
207
-function iban_get_branch_part($iban) {
208
- $iban = iban_to_machine_format($iban);
209
- $country = iban_get_country_part($iban);
210
- $start = iban_country_get_branchid_start_offset($country);
211
- $stop = iban_country_get_branchid_stop_offset($country);
212
- if($start!=''&&$stop!='') {
213
-  $bban = iban_get_bban_part($iban);
214
-  return substr($bban,$start,($stop-$start+1));
215
- }
216
- return '';
217
-}
218
-
219
-# Get the (branch-local) account ID from an IBAN
220
-function iban_get_account_part($iban) {
221
- $iban = iban_to_machine_format($iban);
222
- $country = iban_get_country_part($iban);
223
- $start = iban_country_get_branchid_stop_offset($country);
224
- if($start=='') {
225
-  $start = iban_country_get_bankid_stop_offset($country);
226
- }
227
- if($start!='') {
228
-  $bban = iban_get_bban_part($iban);
229
-  return substr($bban,$start+1);
230
- }
231
- return '';
232
-}
233
-
234
-# Get the name of an IBAN country
235
-function iban_country_get_country_name($iban_country) {
236
- return _iban_country_get_info($iban_country,'country_name');
237
-}
238
-
239
-# Get the domestic example for an IBAN country
240
-function iban_country_get_domestic_example($iban_country) {
241
- return _iban_country_get_info($iban_country,'domestic_example');
242
-}
243
-
244
-# Get the BBAN example for an IBAN country
245
-function iban_country_get_bban_example($iban_country) {
246
- return _iban_country_get_info($iban_country,'bban_example');
247
-}
248
-
249
-# Get the BBAN format (in SWIFT format) for an IBAN country
250
-function iban_country_get_bban_format_swift($iban_country) {
251
- return _iban_country_get_info($iban_country,'bban_format_swift');
252
-}
253
-
254
-# Get the BBAN format (as a regular expression) for an IBAN country
255
-function iban_country_get_bban_format_regex($iban_country) {
256
- return _iban_country_get_info($iban_country,'bban_format_regex');
257
-}
258
-
259
-# Get the BBAN length for an IBAN country
260
-function iban_country_get_bban_length($iban_country) {
261
- return _iban_country_get_info($iban_country,'bban_length');
262
-}
263
-
264
-# Get the IBAN example for an IBAN country
265
-function iban_country_get_iban_example($iban_country) {
266
- return _iban_country_get_info($iban_country,'iban_example');
267
-}
268
-
269
-# Get the IBAN format (in SWIFT format) for an IBAN country
270
-function iban_country_get_iban_format_swift($iban_country) {
271
- return _iban_country_get_info($iban_country,'iban_format_swift');
272
-}
273
-
274
-# Get the IBAN format (as a regular expression) for an IBAN country
275
-function iban_country_get_iban_format_regex($iban_country) {
276
- return _iban_country_get_info($iban_country,'iban_format_regex');
277
-}
278
-
279
-# Get the IBAN length for an IBAN country
280
-function iban_country_get_iban_length($iban_country) {
281
- return _iban_country_get_info($iban_country,'iban_length');
282
-}
283
-
284
-# Get the BBAN Bank ID start offset for an IBAN country
285
-function iban_country_get_bankid_start_offset($iban_country) {
286
- return _iban_country_get_info($iban_country,'bban_bankid_start_offset');
287
-}
288
-
289
-# Get the BBAN Bank ID stop offset for an IBAN country
290
-function iban_country_get_bankid_stop_offset($iban_country) {
291
- return _iban_country_get_info($iban_country,'bban_bankid_stop_offset');
292
-}
293
-
294
-# Get the BBAN Branch ID start offset for an IBAN country
295
-function iban_country_get_branchid_start_offset($iban_country) {
296
- return _iban_country_get_info($iban_country,'bban_branchid_start_offset');
297
-}
298
-
299
-# Get the BBAN Branch ID stop offset for an IBAN country
300
-function iban_country_get_branchid_stop_offset($iban_country) {
301
- return _iban_country_get_info($iban_country,'bban_branchid_stop_offset');
302
-}
303
-
304
-# Get the registry edition for an IBAN country
305
-function iban_country_get_registry_edition($iban_country) {
306
- return _iban_country_get_info($iban_country,'registry_edition');
307
-}
308
-
309
-# Is the IBAN country a SEPA member?
310
-function iban_country_is_sepa($iban_country) {
311
- return _iban_country_get_info($iban_country,'country_sepa');
312
-}
313
-
314
-# Get the list of all IBAN countries
315
-function iban_countries() {
316
- global $_iban_registry;
317
- return array_keys($_iban_registry);
318
-}
319
-
320
-# Given an incorrect IBAN, return an array of zero or more checksum-valid
321
-# suggestions for what the user might have meant, based upon common
322
-# mistranscriptions.
323
-function iban_mistranscription_suggestions($incorrect_iban) {
324
- 
325
- # abort on ridiculous length input (but be liberal)
326
- $length = strlen($incorrect_iban);
327
- if($length<5 || $length>34) { return array('(length bad)'); }
328
-
329
- # abort if mistranscriptions data is unable to load
330
- if(!_iban_load_mistranscriptions()) { return array('(failed to load)'); }
331
-
332
- # init
333
- global $_iban_mistranscriptions;
334
- $suggestions = array();
335
-
336
- # we have a string of approximately IBAN-like length.
337
- # ... now let's make suggestions.
338
- $numbers = array('0','1','2','3','4','5','6','7','8','9');
339
- for($i=0;$i<$length;$i++) {
340
-  # get the character at this position
341
-  $character = substr($incorrect_iban,$i,1);
342
-  # for each known transcription error resulting in this character
343
-  foreach($_iban_mistranscriptions[$character] as $possible_origin) {
344
-   # if we're:
345
-   #  - in the first 2 characters (country) and the possible replacement
346
-   #    is a letter
347
-   #  - in the 3rd or 4th characters (checksum) and the possible
348
-   #    replacement is a number
349
-   #  - later in the string
350
-   if(($i<2 && !in_array($possible_origin,$numbers)) ||
351
-      ($i>=2 && $i<=3 && in_array($possible_origin,$numbers)) ||
352
-      $i>3) {
353
-    # construct a possible IBAN using this possible origin for the
354
-    # mistranscribed character, replaced at this position only
355
-    $possible_iban = substr($incorrect_iban,0,$i) . $possible_origin .  substr($incorrect_iban,$i+1);
356
-    # if the checksum passes, return it as a possibility
357
-    if(verify_iban($possible_iban)) {
358
-     array_push($suggestions,$possible_iban);
359
-    }
360
-   }
361
-  }
362
- }
363
-
364
- # now we check for the type of mistransposition case where all of
365
- # the characters of a certain type within a string were mistransposed.
366
- #  - first generate a character frequency table
367
- $char_freqs = array();
368
- for($i=0;$i<strlen($incorrect_iban);$i++) {
369
-  if(!isset($char_freqs[substr($incorrect_iban,$i,1)])) {
370
-   $char_freqs[substr($incorrect_iban,$i,1)] = 1;
371
-  }
372
-  else {
373
-   $char_freqs[substr($incorrect_iban,$i,1)]++;
374
-  }
375
- }
376
- #  - now, for each of the characters in the string...
377
- foreach($char_freqs as $char=>$freq) {
378
-  # if the character occurs more than once
379
-  if($freq>1) {
380
-   # check the 'all occurrences of <char> were mistranscribed' case
381
-   foreach($_iban_mistranscriptions[$char] as $possible_origin) {
382
-    $possible_iban = str_replace($char,$possible_origin,$incorrect_iban);
383
-    if(verify_iban($possible_iban)) {
384
-     array_push($suggestions,$possible_iban);
385
-    }
386
-   }
387
-  }
388
- }
389
-
390
- return $suggestions;
391
-}
392
-
393
-
394
-##### internal use functions - safe to ignore ######
395
-
396