'', 'alt' => '', 'size' => '', 'align' => '', 'class' => '', 'credit' => '', 'shadow' => '' ), $atts)); $current_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ''; if (empty($content) && $content !== 0) { $content = urlencode($current_uri); } else { $content = urlencode(strip_tags(trim($content))); } if (empty($alt) && $alt !==0) { $alt="Scan the QR Code"; } else { $alt = strip_tags(trim($alt)); } if (empty($size) && $size !==0) { $size = "120"; } else { $size = strip_tags(trim($size)); } if (empty($align) && $align !==0) { $align = ""; } else { $align = strip_tags(trim($align)); } if (empty($class) && $class !==0) { $class = ""; } else { $class = strip_tags(trim($class)); } if (empty($credit) && $credit !=='false' or $credit == 'true') { $credit_footer='
'; } else { $credit_footer = ""; } if (empty($shadow) && $shadow =! false or $shadow == 'true') { $preoutput = '
'; } else { $preoutput = '
'; } $output = ""; $image = 'https://chart.googleapis.com/chart?chs=' . $size . 'x' . $size . '&cht=qr&chld=H|1&chl=' . $content; if ($align == "right") { $align = ' align="right"'; } if ($align == "left") { $align = ' align="left"'; } if ($class != "") { $class = ' class="' . $class . '"'; } $output = $preoutput . '' . $alt . ''; return $output . $credit_footer; } /* check if its necessary to embed js or css file into wp_head*/ add_action('wp_print_styles', 'add_my_styles', 100); function add_my_styles() { wp_register_style( 'wprhe_style', '/wprhe_qrcode_style.css'); wp_enqueue_style( 'wprhe_style' ); } add_action('init', 'add_my_styles'); /* Add the style */ add_action( 'wp_print_styles', 'wp_enqueue_style' ); /* Add the Shortcode */ add_shortcode('qrcode', 'qrcode_wprhe_shortcode'); ?>