NAVIGATION
This shows you the differences between two versions of the page.
|
english:phpwcms_replacer_rts:frontend_render:qr-code [2012/04/16 14:44] Claus |
english:phpwcms_replacer_rts:frontend_render:qr-code [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 94: | Line 94: | ||
| </code> | </code> | ||
| + | ==== New since 2015 ==== | ||
| + | |||
| + | <code php |h rt_qr_code.php |h > | ||
| + | <?php | ||
| + | // ---------------------------------------------------------------- | ||
| + | // simple current url qr-code generator | ||
| + | // TAG {QR_CODE}, {QR_CODE 200}, {QR_CODE175} | ||
| + | // e.g. 200 or 175 are the dimensions of the image | ||
| + | // | ||
| + | // OG (Oliver Georgi): 16.02.2012 | ||
| + | // ---------------------------------------------------------------- | ||
| + | |||
| + | // ---------------------------------------------------------------- | ||
| + | // obligate check for phpwcms constants | ||
| + | if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");} | ||
| + | // ---------------------------------------------------------------- | ||
| + | |||
| + | if(preg_match('/\{QR_CODE(.*?)\}/', $content['all'], $qr_code)) { | ||
| + | |||
| + | $qr_code['size'] = abs(intval(trim($qr_code[1]))); | ||
| + | |||
| + | if(empty($qr_code['size'])) { | ||
| + | $qr_code['size'] = 150; // default size | ||
| + | } | ||
| + | |||
| + | $qr_code['url'] = rawurlencode( abs_url(array(),array(),'','') ); | ||
| + | |||
| + | $content['all'] = str_replace( | ||
| + | $qr_code[0], | ||
| + | '<img src="https://chart.googleapis.com/chart?chs='.$qr_code['size'].'x'.$qr_code['size'].'&cht=qr&chl='.$qr_code['url'].'" />', | ||
| + | $content['all'] | ||
| + | ); | ||
| + | |||
| + | } | ||
| + | ?> | ||
| + | </code> | ||
| \\ | \\ | ||