public function testQrcode() { echo "test qrcode...\n"; $objQrCode = new class_qrcode(); $strImage1 = $objQrCode->getImageForString("Kajona Test Image"); $this->assertFileExists(_realpath_ . $strImage1); $strImage2 = $objQrCode->getImageForString(_webpath_); $this->assertFileExists(_realpath_ . $strImage2); echo "\t <img src=\"" . _webpath_ . $strImage1 . "\" />\n"; echo "\t <img src=\"" . _webpath_ . $strImage2 . "\" />\n"; }
/** * Processes the content. * Make sure to return the string again, otherwise the output will remain blank. * * @param string $strContent * * @return string */ public function processContent($strContent) { $arrTemp = array(); preg_match_all("#\\[qrcode,([ \\?\\&\\-=:+%;A-Za-z0-9_\\./\\\\]+)(,[1-3])\\]#i", $strContent, $arrTemp); foreach ($arrTemp[0] as $intKey => $strSearchString) { $intSize = 1; $strSubstr = isset($arrTemp[2][$intKey]) ? (int) substr($arrTemp[2][$intKey], 1) : 1; if ($strSubstr >= 1 && $strSubstr <= 3) { $intSize = $strSubstr; } $objQrCode = new class_qrcode(); $objQrCode->setIntSize($intSize); $strImage = $objQrCode->getImageForString($arrTemp[1][$intKey]); $strContent = uniStrReplace($strSearchString, _webpath_ . "/" . $strImage, $strContent); } return $strContent; }