xref: /plugin/doi/Resolver/AbstractIsbnResolver.php (revision 307c69801b7d8b027f4d0b7119b53e92e2931cb6)
1*307c6980SAndreas Gohr<?php
2*307c6980SAndreas Gohr
3*307c6980SAndreas Gohrnamespace dokuwiki\plugin\doi\Resolver;
4*307c6980SAndreas Gohr
5*307c6980SAndreas Gohrabstract class AbstractIsbnResolver extends AbstractResolver
6*307c6980SAndreas Gohr{
7*307c6980SAndreas Gohr    public function __construct()
8*307c6980SAndreas Gohr    {
9*307c6980SAndreas Gohr        $this->defaultResult['idtype'] = 'ISBN';
10*307c6980SAndreas Gohr        $this->defaultResult['type'] = 'book';
11*307c6980SAndreas Gohr    }
12*307c6980SAndreas Gohr
13*307c6980SAndreas Gohr    /** @inheritdoc */
14*307c6980SAndreas Gohr    public function getFallbackURL($id)
15*307c6980SAndreas Gohr    {
16*307c6980SAndreas Gohr        return 'https://www.google.com/search?q=isbn+' . rawurlencode($id);
17*307c6980SAndreas Gohr    }
18*307c6980SAndreas Gohr
19*307c6980SAndreas Gohr    /** @inheritdoc */
20*307c6980SAndreas Gohr    public function cleanID($id)
21*307c6980SAndreas Gohr    {
22*307c6980SAndreas Gohr        return preg_replace('/[^0-9X]/i', '', $id);
23*307c6980SAndreas Gohr    }
24*307c6980SAndreas Gohr
25*307c6980SAndreas Gohr
26*307c6980SAndreas Gohr}
27