Actually check if the QR code is enabled before generating it

This commit is contained in:
Tom Slominski
2015-03-01 21:41:26 +00:00
parent 5127f68093
commit 89a74c7137
2 changed files with 16 additions and 6 deletions

View File

@@ -228,6 +228,11 @@ input[type="radio"] {
color:#013F6D; color:#013F6D;
} }
svg#url-qr-code {
width: 50%;
height: 50%;
}
/* Footer */ /* Footer */
.footer { .footer {
text-align: center; text-align: center;

View File

@@ -19,6 +19,8 @@ if ($recaptcha_json['success'] != 'true') {
} }
// QR code shenanigans // QR code shenanigans
if ( ISQ::$general['qr'] ) {
include('public/phpqrcode/qrlib.php'); include('public/phpqrcode/qrlib.php');
$qrContainerId = 'url-qr-code'; $qrContainerId = 'url-qr-code';
@@ -26,6 +28,9 @@ $saveToFile = false;
$imageWidth = 600; // in pixels $imageWidth = 600; // in pixels
$qrCode = QRcode::svg($url, $qrContainerId, $saveToFile, QR_ECLEVEL_L, $imageWidth); $qrCode = QRcode::svg($url, $qrContainerId, $saveToFile, QR_ECLEVEL_L, $imageWidth);
};
?> ?>
<!-- Error reporting --> <!-- Error reporting -->
@@ -42,7 +47,7 @@ $qrCode = QRcode::svg($url, $qrContainerId, $saveToFile, QR_ECLEVEL_L, $imageWid
</div> </div>
<!-- QR code --> <!-- QR code -->
<?php if (!empty(ISQ::$general['qr'])) { echo '<h2>' . yourls__( 'QR code', 'isq-translation' ) . '</h2><p>' . yourls__( 'Share your link with external devices', 'isq-translation' ) . '</p>' . $qrCode; } ?> <?php if ( ISQ::$general['qr'] ) { echo '<h2>' . yourls__( 'QR code', 'isq-translation' ) . '</h2><p>' . yourls__( 'Share your link with external devices', 'isq-translation' ) . '</p>' . $qrCode; } ?>
<!-- Social sharers --> <!-- Social sharers -->
<h2><?php yourls_e( 'Share', 'isq_translation'); ?></h2> <h2><?php yourls_e( 'Share', 'isq_translation'); ?></h2>