This repository has been archived by the owner on Jun 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitializer.php
60 lines (47 loc) · 1.54 KB
/
initializer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/*
Plugin Name: SVG QRCODE Generator
Plugin URI: http://brandoncamenisch.com
Description: Creates an SVG QRCODE
Version: 1.0
Author: Brandon Camenisch
Author URI: http://brandoncamenisch.com/
License: GPLv2 or later
*/
namespace WPSE\svgqrcode;
new SVGQRcode;
class SVGQRcode {
#Construct
function __construct() {
add_action( 'init', array($this, 'loader') );
add_action( 'wp_enqueue_scripts', array($this,'load_scripts') );
add_shortcode( 'qrcode_generator', array($this, 'shortcode') );
}
public function loader() {
#define constants
define('QRLICIOUS_SVGQRCODE_PATH', plugin_dir_path(__FILE__));
define('QRLICIOUS_SVGQRCODE_URL', plugin_dir_url(__FILE__));
}
public function load_scripts() {
wp_enqueue_script( 'jquery' );
global $pagenow, $typenow;
if ( is_single('svg-qrcode-generator' ) ){
wp_register_script( 'qrlicious_raphael', plugins_url('/lib/raphael/raphael-min.js', __FILE__) );
wp_enqueue_script( 'qrlicious_raphael' );
#qrcode script
wp_register_script( 'qrlicious_qrcode_svg', plugins_url('/scripts/qrcodesvg.js', __FILE__) );
wp_enqueue_script( 'qrlicious_qrcode_svg' );
#custom script
wp_register_script( 'qrlicious_qrcode_custom', plugins_url('/scripts/custom.js', __FILE__) );
wp_enqueue_script( 'qrlicious_qrcode_custom' );
#setup vars
}
}
public function load_styles() {
#load styles
}
public function shortcode() {
$var = file_get_contents( QRLICIOUS_SVGQRCODE_PATH.'test.html' );
return $var;
}
} #END SVGQRcode CLASS