XOOPS  2.6.0
QrcodeProvider.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
15 use Xoops\Html\Img;
16 
29 {
31  protected $renderScript = 'modules/qrcode/include/qrrender.php';
32 
39  public function getName()
40  {
41  return 'qrcode';
42  }
43 
49  public function getDescription()
50  {
51  return 'QR Code generation using endroid/qrcode';
52  }
53 
54 
62  private function getQRUrl($qrText)
63  {
65  $params = array(
66  'text' => (string) $qrText,
67  );
68  $url = $xoops->buildUrl($xoops->url($this->renderScript), $params);
69  return $url;
70  }
71 
80  public function getImgUrl(Response $response, $qrText)
81  {
82  $response->setValue($this->getQRUrl($qrText));
83  }
84 
94  public function getImgTag(Response $response, $qrText, $attributes = array())
95  {
96  $url = $this->getQRUrl($qrText);
97 
98  $imgTag = new Img(array('src' => $url,));
99  $imgTag->setAttributes($attributes);
100  $response->setValue($imgTag->render());
101  }
102 }
static getInstance()
Definition: Xoops.php:160
$xoops
Definition: admin.php:25
getImgUrl(Response $response, $qrText)
getImgTag(Response $response, $qrText, $attributes=array())
$url
Definition: register.php:72
if($xoops->isUser()&&$isAdmin) $response
Definition: userinfo.php:83