QR code with the current article or blog url, or any other text.
Author: Matias S.
Author URI: matias@incerteza.org
Version: 0.0.7
Author URI: http://www.incerteza.org/blog/
Text Domain: scqrcode
Domain Path: /languages
*/
$scqrcode_domain = "scqrcode";
$scqrcode_dir = PLUGINDIR . '/' . basename(dirname(__FILE__));
/* Plugin Admin Localization */
if( !load_plugin_textdomain($scqrcode_domain, '/wp-content/languages') AND is_admin() )
load_plugin_textdomain($scqrcode_domain, $scqrcode_dir . '/languages');
/* Functions */
function scqrcode_url() {
return is_single() ? get_permalink() : get_settings('siteurl');
}
/* Widget */
add_action( 'widgets_init', 'scqrcode_init' );
function scqrcode_init() {
register_widget( 'scqrcode_widget' );
}
class scqrcode_widget extends WP_Widget {
function scqrcode_widget() {
global $scqrcode_domain, $scqrcode_dir;
$widget_ops = array( 'classname' => 'scqrcode', 'description' => __('A QR Code with the current url, or any other content', $scqrcode_domain) );
// $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'scqrcode-widget' );
$this->WP_Widget( 'scqrcode-widget', 'Super Cool QRCode', $widget_ops, $control_ops );
}
function widget($args, $instance){
extract($args);
if ( $instance['title'] ) $title = apply_filters('widget_title', $instance['title']);
$content = empty($instance['content']) ? scqrcode_url() : $instance['content'];
$before_content = $instance['before_content'];
$after_content = $instance['after_content'];
$size = empty($instance['size']) ? '125' : $instance['size'];
$encoding = empty($instance['encoding']) ? 'UTF-8' : $instance['encoding'];
$error = empty($instance['error']) ? 'L' : $instance['error'];
$margin = empty($instance['margin']) ? '2' : $instance['margin'];
$border = empty($instance['border']) ? '0' : $instance['border'];
?>
'',
'content' => '',
'before_content' => '
Content field blank the current page url will be used', $scqrcode_domain) ?>
lifehacker.com made me stop been lazy and fix some bugs, actually, rewrite almost all code and add multi-widget support, i decided to call version 0.0.7 "Lifehacker Edition", in honor of the blog that made me get out of chair and do something!', $scqrcode_domain) ?>
Google Chart API none significant load is added to your server.', $scqrcode_domain) ?>
[qrcode] a QR code with a link to the current URL will be rendered, if you use [qrcode]content[/qrcode] a QR code with content will be rendered.', $scqrcode_domain) ?>
[sqrcode size="150" link="true"]content[/sqrcode], will render a QR code with 150px of side, possible options are:', $scqrcode_domain) ?>
| size | |
| encoding | |
| error | L allows 7% of a QR code to be restored M allows 15% of a QR code to be restored Q allows 25% of a QR code to be restored H allows 30% of a QR code to be restored', $scqrcode_domain); ?> |
| margin | |
| border |
ZXing Decoder Online: decode your QR code in a online interface
Google Chart API: the API used by this plugin to generate the codes', $scqrcode_domain) ?>
Note: i\'m learning PHP & Wordpress coding and using this plugin to study, so if you have any idea or any kind of suggestion please contact me.', $scqrcode_domain) ?>
%2$s v%3$s by %5$s', $scqrcode_domain), $scqrcode_data['PluginURI'], $scqrcode_data['Name'], $scqrcode_data['Version'], $scqrcode_data['AuthorURI'], $scqrcode_data['Author']); ?>