<?php

class Intense_QR_Code extends Intense_Shortcode {

	function __construct() {
        parent::__construct();

		global $intense_visions_options;

		$this->title = __( 'QR Code', 'intense' );
		$this->description = __( 'Add QR codes (Quick Response Code) to WordPress using the QR code shortcode. Choose the size of the QR code and the data to encode. QR codes are useful as links or data for mobile devices.', 'intense' );
		$this->category = __( 'Media', 'intense' );
		$this->show_preview = true;		
	}

	function shortcode( $atts, $content = null ) {
		global $intense_visions_options;
		extract( shortcode_atts( $this->get_shortcode_defaults( null, $atts ), $atts ) );

		$id = ( !empty ( $id ) ) ? ' id="' . $id . '"' : '';
		$class = ( !empty ( $class ) ) ? ' class="' . $class . '"' : '';

		return '<img' . $id . $class . ' src="https://chart.googleapis.com/chart?chs=' . $width . 'x' . $width . '&cht=qr&chld=L|0&chl=' . urlencode( $data ) . '" width="' . $width . '" height="' . $width . '" />';
	}
}
