commit | author | age
|
175a52
|
1 |
<?php |
JK |
2 |
class convert { |
|
3 |
static function ISBN13_to_ISBN10($kod) { |
|
4 |
validate::EAN($kod); |
|
5 |
|
|
6 |
if(substr($kod, 0, 3)=='978') { |
|
7 |
$kod = substr($kod, 3, 9); |
|
8 |
|
|
9 |
return strtoupper( $kod . checksum::ISBN($kod) ); |
|
10 |
} |
|
11 |
else |
|
12 |
{ |
bc710e
|
13 |
errorclass::add('Kodu ISBN-13 '.$kod.' nie można zamienić na ISBN-10!'); |
175a52
|
14 |
} |
JK |
15 |
} |
|
16 |
|
|
17 |
static function ISBN10_to_ISBN13($kod) { |
|
18 |
validate::ISBN($kod); |
|
19 |
|
|
20 |
$kod = '978' . substr($kod, 0, -1); |
|
21 |
|
|
22 |
return $kod . checksum::EAN($kod); |
|
23 |
} |
|
24 |
|
|
25 |
static function ISSN13_to_ISSN8($kod) { |
|
26 |
validate::EAN($kod); |
|
27 |
|
|
28 |
$kod = substr($kod, 3, 7); |
|
29 |
|
|
30 |
return strtoupper( $kod . checksum::ISSN($kod) ); |
|
31 |
} |
|
32 |
|
|
33 |
static function ISSN8_to_ISSN13($kod) { |
|
34 |
validate::ISSN($kod); |
|
35 |
|
|
36 |
$kod = '977' . substr($kod, 0, -1).'00'; |
|
37 |
|
|
38 |
return $kod . checksum::EAN($kod); |
|
39 |
} |
|
40 |
} |
532779
|
41 |
?> |