xref: /plugin/doi/syntax/isbn.php (revision 307c69801b7d8b027f4d0b7119b53e92e2931cb6)
126b57c75SAndreas Gohr<?php
226b57c75SAndreas Gohr
326b57c75SAndreas Gohr/**
426b57c75SAndreas Gohr * DokuWiki Plugin doi (Syntax Component)
526b57c75SAndreas Gohr *
626b57c75SAndreas Gohr * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
726b57c75SAndreas Gohr * @author  Andreas Gohr <gohr@cosmocode.de>
826b57c75SAndreas Gohr */
9*307c6980SAndreas Gohrclass syntax_plugin_doi_isbn extends syntax_plugin_doi_doi
1026b57c75SAndreas Gohr{
1126b57c75SAndreas Gohr
1226b57c75SAndreas Gohr    /** @inheritDoc */
1326b57c75SAndreas Gohr    public function connectTo($mode)
1426b57c75SAndreas Gohr    {
1526b57c75SAndreas Gohr        $this->Lexer->addSpecialPattern('\[\[isbn>[^\]]+\]\]', $mode, 'plugin_doi_isbn');
1626b57c75SAndreas Gohr    }
1726b57c75SAndreas Gohr
1826b57c75SAndreas Gohr    /** @inheritDoc */
1926b57c75SAndreas Gohr    public function handle($match, $state, $pos, Doku_Handler $handler)
2026b57c75SAndreas Gohr    {
2119099051SAndreas Gohr        $isbn = substr($match, 7, -2);
22*307c6980SAndreas Gohr        return ['id' => $isbn];
2326b57c75SAndreas Gohr    }
2426b57c75SAndreas Gohr
2526b57c75SAndreas Gohr    /** @inheritDoc */
26*307c6980SAndreas Gohr    protected function getResolver()
2726b57c75SAndreas Gohr    {
28*307c6980SAndreas Gohr        $class = '\\dokuwiki\\plugin\\doi\\Resolver\\Isbn'.$this->getConf('isbnresolver').'Resolver';
29*307c6980SAndreas Gohr        return new $class();
3026b57c75SAndreas Gohr    }
3126b57c75SAndreas Gohr
3226b57c75SAndreas Gohr
3326b57c75SAndreas Gohr}
3426b57c75SAndreas Gohr
35