QR-Code

QR-Code QR Code (abbreviated from Quick Response Code) is a two-dimensional code that was first developed for the automotive industry by the Japanese company Denso Wave in 1994.
(Quote: Wikipedia)


In place of the TAG (with or without a specified size) a QR code image will be rendered.



rt_qr_code V1.0 16.04.2012

Docu: –
Forum: Artikel URL als QR-Code?

Author: Oliver Georgi (slackero) http://phpwcms.de
CMS Version: >= 1.5.1
Version: V1.0

TAG: {QR_CODE[][xxx]}, where xxx indicates the length of the edge of the image, for example {QR_CODE} or {QR_CODE 200} or {QR_CODE175}

Fileiname: rt_qr_code.php

Folder: template/inc_script/frontend_render/

Condition:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;



Description:

Replacer settings:

  • E.g.
  • - {QR_CODE} = Output of the QR Code of the current URL with the default edge length 150px
  • - {QR_CODE 200} = Output of the QR Code of the current URL with the edge length 200px
  • - {QR_CODE175} = Output of the QR Code of the current URL with the edge length 175px


Script:

Filename: rt_qr_code.php
Folder: template/inc_script/frontend_render/

rt_qr_code.php

<?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="http://chart.apis.google.com/chart?cht=qr&amp;chl='.$qr_code['url'].'&amp;chs='.$qr_code['size'].'x'.$qr_code['size'].'" alt="QR Direct Link" />',
      $content['all']
   );
 
}
?>

New since 2015

rt_qr_code.php

    <?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'].'&amp;cht=qr&amp;chl='.$qr_code['url'].'" />',
          $content['all']
       );
 
    }
    ?>


english/phpwcms_replacer_rts/frontend_render/qr-code.txt · Last modified: 2018/06/03 18:09 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0