-
Notifications
You must be signed in to change notification settings - Fork 6
/
bezahlcode.class.php
256 lines (235 loc) · 20.5 KB
/
bezahlcode.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<?php
/**
* Bezahlcode 0.3
*
* Generates SEPA QR-Codes for money transfer
*
* PHP version tested up to 7.3
*
* Bezahlcode is distributed under LGPL 3
* Copyright (C) 2019 Matthias Schaffer
*
* @package Bezahlcode
* @author Matthias Schaffer <hello <at> matthiasschaffer <dot> com>
* @copyright 2019
* @license https://www.gnu.org/licenses/lgpl LGPL 3
* @link https://github.com/fellwell5/bezahlcode/
* @since File available since beginning of project
*/
class Bezahlcode {
public $base64_frame = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbIAAAGaCAYAAABqjMZHAAAgAElEQVR4nO3de3xNd77/8fdOttwIMdgSjEtGjlsEoWREhzpInbgUR8oMM1pMe6qdjp5WmWmL4/Q8ik51Du2YUzFO1bXUJXSmCarul+PSIG0HQSixh0OzQy6S7N8fjjV2944m7L1Yv76ej8d+WN/vd63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8PARztCf0o5MQAAAAASUVORK5CYII=";
public $phpqrcode_path = "./phpqrcode.php";
private $qrprovider, $use_frame, $iban, $bic, $name, $payload, $usage, $amount;
/**
* __construct
*
* Create class object and save data for further use.
*
* @param string $iban
*
* @param string $bic
*
* @param string $name Name of the bank account owner.
*
* @param string $qrprovider (optional)
* Defaults to 'phpqrcode'.
* options are 'phpqrcode' or 'google'
*
* @param boolean $use_frame (optional) Use Bezahlcode-Frame around the QRcode. Defined by the public variable $base64_frame
*
* @access public
* @since Method available since Release 0.1
*/
function __construct($iban, $bic, $name, $qrprovider = "phpqrcode", $use_frame = true){
$this->iban = $iban;
$this->bic = $bic;
$this->name = $name;
$this->qrprovider = $qrprovider;
$this->use_frame = $use_frame;
if ($qrprovider == "phpqrcode") {
if (!file_exists($this->phpqrcode_path)) {
die("PHPQRCODE was selected as QR-Code provider, but phpqrcode.php was not found at the specified path. Please set the variable to the path.");
}
require_once $this->phpqrcode_path;
if (!class_exists("QRcode")) {
die("PHPQRCODE was selected as QR-Code provider, but QRcode class could not be loaded.");
}
}
}
/**
* generatePayload
*
* Generate payload array with specified data and save it for further use.
*
* @param string $usage
*
* @param decimal $amount Formatted like 10.56
*
* @access public
* @since Method available since Release 0.1
*/
public function generatePayload($usage, $amount){
$this->usage = $usage;
$this->amount = $amount;
$payload = array("BCD", "001", "1", "SCT", $this->bic, $this->name, $this->iban, "EUR".$amount, "", "", $usage);
$this->payload = implode("\n", $payload);
}
/**
* getPayload
*
* Return the payload saved from Bezahlcode->generatePayload().
*
* @return string
*
* @access private
* @since Method available since Release 0.1
*/
private function getPayload(){
return $this->payload;
}
/**
* getQRCode
*
* Return image resource with specified payload
*
* @param string $data Should be the payload but any text could be used.
*
* @return resource
*
* @access private
* @since Method available since Release 0.2
*/
private function getQRCode(){
if ($this->qrprovider == "phpqrcode") {
ob_start();
QRcode::png($this->payload, false, QR_ECLEVEL_L, 9, 1);
$qr = ob_get_contents();
ob_end_clean();
$qr = imagecreatefromstring($qr);
} elseif ($this->qrprovider == "google") {
$qr = imagecreatefrompng("https://chart.apis.google.com/chart?cht=qr&chs=350x350&chld=L|0&chl=".urlencode($this->payload));
} else {
die("QRCode provider $this->qrprovider is not valid");
}
if ($this->use_frame) {
$img = str_replace('data:image/png;base64,', '', $this->base64_frame);
$img = str_replace(' ', '+', $img);
$img = base64_decode($img);
$layer = imagecreatefromstring($img);
imagealphablending($layer, true);
imagesavealpha($layer, true);
imagecopy($layer, $qr, 33, 33, 0, 0, 350, 350);
return $layer;
} else {
return $qr;
}
}
/**
* selectType
*
* Return the content type and extension from specified image type.
*
* @param string $type optional The file type as which the image should be generated.
* Defaults to '' if nothing is specified jpg is used. See at Bezahlcode->selectType.
*
* @return array With the content type and the extension.
* for example: array("image/png", "png");
*
* @access private
* @since Method available since Release 0.2
*/
private function selectType($type=''){
switch(strtolower($type)){
case "gif": return ["image/gif", "gif"];
case "png": return ["image/png", "png"];
default: return ["image/jpeg", "jpg"];
}
}
/**
* generateBase64
*
* Generate a Bezahlcode with saved Payload and return the Bezahlcode as base64 encoded string.
*
* @param string $type optional The file type as which the image should be generated.
* Defaults to '' if nothing is specified jpg is used. See at Bezahlcode->selectType.
*
* @return string The generated base64 string.
*
* @access public
* @since Method available since Release 0.1
*/
public function generateBase64($type=''){
$type = $this->selectType($type);
$bezahlcode = $this->getQRCode();
ob_start();
if($type[1] == "gif"){
imagegif($bezahlcode);
}elseif($type[1] == "png"){
imagepng($bezahlcode);
}else{
imagejpeg($bezahlcode);
}
$imagedata = ob_get_contents();
ob_end_clean();
imagedestroy($bezahlcode);
header("Content-Type: text/html; charset=UTF-8");
return 'data:'.$type[0].';base64,'.base64_encode($imagedata);
}
/**
* saveImage
*
* Generate a Bezahlcode with saved Payload and save it as file.
*
* @param string $filename optional The path and filename where the Bezahlcode should be saved.
* Defaults to '' and then a filename is generated from the usage field.
* @param string $type optional The file type as which the image should be saved.
* Defaults to '' if nothing is specified jpg is used. See at Bezahlcode->selectType.
*
* @return string The filename where the Bezahlcode was saved.
*
* @access public
* @since Method available since Release 0.2
*/
public function saveImage($filename='',$type=''){
$type = $this->selectType($type);
$bezahlcode = $this->getQRCode();
if(empty($filename)) $filename = "bezahlcode_".preg_replace('/[^a-zA-Z0-9\-\_]/','', $this->usage).".".$type[1];
if($type[1] == "gif"){
imagegif($bezahlcode, $filename);
}elseif($type[1] == "png"){
imagepng($bezahlcode, $filename);
}else{
imagejpeg($bezahlcode, $filename);
}
return $filename;
}
/**
* outputImage
*
* Generate a Bezahlcode and output it to the webbrowser.
* After the output the function exit() is called to suppress further output.
*
* @param string $type optional The file type as which the image should be outputted.
* Defaults to '' if nothing is specified jpg is used. See at Bezahlcode->selectType.
*
*
* @access public
* @since Method available since Release 0.2
*/
public function outputImage($type=''){
$type = $this->selectType($type);
$bezahlcode = $this->getQRCode();
header("Content-type: ".$type[0]);
header("Content-Disposition: inline; filename=bezahlcode.".$type[1]);
if($type[1] == "gif"){
imagegif($bezahlcode);
}elseif($type[1] == "png"){
imagepng($bezahlcode);
}else{
imagejpeg($bezahlcode);
}
imagedestroy($bezahlcode);
exit();
}
}
?>